@whoz-oss/coday-client 0.233.1 → 0.235.0

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 (67) hide show
  1. package/browser/{chunk-2OX7XSO7.js → chunk-3L5HH2LW.js} +1 -1
  2. package/browser/chunk-3SWGL6G7.js +1 -0
  3. package/browser/{chunk-GULJQNKJ.js → chunk-3WHV3A3F.js} +1 -1
  4. package/browser/{chunk-ZJ5WTNW7.js → chunk-3XEA5TTG.js} +1 -1
  5. package/browser/{chunk-NAJJT42Y.js → chunk-4QUKFJVG.js} +1 -1
  6. package/browser/{chunk-XZAGZJYJ.js → chunk-5F4OBAQR.js} +1 -1
  7. package/browser/{chunk-LVLF3D4X.js → chunk-5P3YDX4D.js} +1 -1
  8. package/browser/{chunk-V4WIZDIH.js → chunk-62SCRDTI.js} +1 -1
  9. package/browser/{chunk-5EIDKSSY.js → chunk-6OUF4MB3.js} +1 -1
  10. package/browser/{chunk-OFLO4C7X.js → chunk-6V5ZHXTF.js} +1 -1
  11. package/browser/chunk-7PHHASXE.js +1 -0
  12. package/browser/{chunk-2RRKNP4O.js → chunk-7WNGYNNF.js} +1 -1
  13. package/browser/chunk-A2IQII4O.js +1 -0
  14. package/browser/{chunk-63DV6LLE.js → chunk-AK3ITDZL.js} +1 -1
  15. package/browser/{chunk-UCATWB2P.js → chunk-B235KWLK.js} +1 -1
  16. package/browser/{chunk-OFPREK4V.js → chunk-B4YVERDA.js} +1 -1
  17. package/browser/{chunk-VZVJKZA2.js → chunk-BJ6IXKIG.js} +1 -1
  18. package/browser/{chunk-BYGLGHPS.js → chunk-BSULGZWF.js} +1 -1
  19. package/browser/{chunk-FS4CUJQH.js → chunk-C7HN2AHW.js} +1 -1
  20. package/browser/{chunk-4KS5XFO4.js → chunk-CMDN4G5T.js} +1 -1
  21. package/browser/{chunk-ALD52Y36.js → chunk-D4DYD37W.js} +1 -1
  22. package/browser/chunk-DDBWRK3B.js +1 -0
  23. package/browser/{chunk-XKAY4JO3.js → chunk-DYASMOHQ.js} +1 -1
  24. package/browser/{chunk-56F7GUQR.js → chunk-EPOMVQLK.js} +1 -1
  25. package/browser/{chunk-NQVAKMAF.js → chunk-FIDJLAO5.js} +1 -1
  26. package/browser/{chunk-55CCIZ6Y.js → chunk-FKSUXVTW.js} +1 -1
  27. package/browser/{chunk-KY2WN2WL.js → chunk-GGJJHI5J.js} +1 -1
  28. package/browser/{chunk-ZGOOG7E4.js → chunk-GVUZDCHM.js} +1 -1
  29. package/browser/{chunk-OMBUBJIY.js → chunk-HGDDIJKH.js} +1 -1
  30. package/browser/chunk-HQF5YXBC.js +1 -0
  31. package/browser/chunk-HW7FY6FY.js +1 -0
  32. package/browser/{chunk-4MIM6YHV.js → chunk-IGXPPLQW.js} +1 -1
  33. package/browser/{chunk-SBHTD5EV.js → chunk-IUKPWUMW.js} +1 -1
  34. package/browser/chunk-J3QUVW75.js +1 -0
  35. package/browser/chunk-JD6LMKJY.js +1 -0
  36. package/browser/{chunk-QAGM2FI6.js → chunk-JWECOKZF.js} +1 -1
  37. package/browser/chunk-M4ES4I34.js +1 -0
  38. package/browser/{chunk-TT5QO735.js → chunk-MGHX6XY3.js} +1 -1
  39. package/browser/{chunk-OUCM7C5E.js → chunk-OESN2OVC.js} +1 -1
  40. package/browser/chunk-OJPNIW6G.js +1 -0
  41. package/browser/chunk-OLEK57CJ.js +1 -0
  42. package/browser/{chunk-HV4YVRZD.js → chunk-PBZL7DN5.js} +1 -1
  43. package/browser/chunk-PL3BJFLT.js +1 -0
  44. package/browser/{chunk-U6DZITWN.js → chunk-QNOZT6US.js} +1 -1
  45. package/browser/{chunk-EUKRA2OA.js → chunk-QO3SLUF6.js} +1 -1
  46. package/browser/chunk-RDEFHYHJ.js +1 -0
  47. package/browser/{chunk-MHB6HAME.js → chunk-SLVL4O7X.js} +1 -1
  48. package/browser/{chunk-OJAJVOW4.js → chunk-T5DS7HZO.js} +1 -1
  49. package/browser/chunk-U26U4YUX.js +1 -0
  50. package/browser/chunk-UWESGTIU.js +1 -0
  51. package/browser/{chunk-SG2Y5LGP.js → chunk-VDPBH6I4.js} +1 -1
  52. package/browser/{chunk-MKGPVNPI.js → chunk-XZDUSWYE.js} +1 -1
  53. package/browser/{chunk-3DCEAZDI.js → chunk-YONCBD5A.js} +1 -1
  54. package/browser/{chunk-TOQLOSTJ.js → chunk-ZO272F3U.js} +1 -1
  55. package/browser/index.html +1 -1
  56. package/browser/{main-SDUET5IO.js → main-6K2RB63O.js} +1 -1
  57. package/package.json +1 -1
  58. package/browser/chunk-3PL5XB7S.js +0 -1
  59. package/browser/chunk-4WS3QONK.js +0 -1
  60. package/browser/chunk-5SWFEZKV.js +0 -1
  61. package/browser/chunk-7ZDYCVKF.js +0 -1
  62. package/browser/chunk-E5K3YORT.js +0 -1
  63. package/browser/chunk-EJX3SCU5.js +0 -1
  64. package/browser/chunk-LPBSLDC7.js +0 -1
  65. package/browser/chunk-MDHGCSE2.js +0 -1
  66. package/browser/chunk-MFNQXB7D.js +0 -1
  67. package/browser/chunk-VH7ZEMCE.js +0 -1
@@ -1 +1 @@
1
- import{a as le}from"./chunk-55CCIZ6Y.js";import{b as G,v as x,w as u,x as H}from"./chunk-VH7ZEMCE.js";import{a as L,c as B}from"./chunk-COLWSJEP.js";import{a as w,c as N}from"./chunk-PUWEEZSA.js";import{B as ie,F as ae,b as K,c as j,e as h,g as Y,h as J,i as Q,l as p,n as X,o as Z,s as ee,w as te,x as ne,y as oe,z as re}from"./chunk-ZJV25K6M.js";import{Bb as F,D as q,Db as E,Fb as s,Ha as $,Ka as a,R as k,Rb as b,Tb as i,Ub as g,Vb as D,Wa as W,a as V,b as A,ca as C,ga as M,ha as O,lb as c,m as R,ma as z,mb as m,mc as T,pb as S,qb as P,rb as d,sb as o,ta as v,tb as r,ub as _,z as U}from"./chunk-3DOXTB6J.js";var I=(n,t)=>t.value,ce=(n,t)=>t.id;function me(n,t){n&1&&(o(0,"p",5),i(1,"Loading\u2026"),r())}function se(n,t){n&1&&(o(0,"span",12),i(1," Name is required. "),r())}function pe(n,t){if(n&1&&(o(0,"p",40),i(1),r(),o(2,"span",13),i(3,"Agent Config cannot be changed after creation."),r()),n&2){let e=s(2);a(),g(e.resolveAgentConfigName(e.agentConfigIdControl.value))}}function ue(n,t){if(n&1&&(o(0,"a",41),i(1,"Add an agent config"),r(),i(2," first. ")),n&2){let e=s(3);d("href","/agentos/"+e.namespaceId+"/agent-configs/new",$)}}function fe(n,t){if(n&1&&(o(0,"p",13),i(1," No agent configs available in this scope yet. "),c(2,ue,3,1),r()),n&2){let e=s(2);a(2),m(e.isPlatformMode?-1:2)}}function _e(n,t){if(n&1&&(o(0,"option",23),i(1),r()),n&2){let e=t.$implicit;d("value",e.id),a(),g(e.name)}}function he(n,t){n&1&&(o(0,"span",12),i(1,"Agent Config is required."),r())}function ge(n,t){if(n&1&&(o(0,"select",42)(1,"option",43),i(2,"Select an agent config\u2026"),r(),S(3,_e,2,2,"option",23,ce),r(),c(5,he,2,0,"span",12),o(6,"span",13),i(7,"Immutable after creation."),r()),n&2){let e=s(2);d("formControl",e.agentConfigIdControl),a(3),P(e.availableAgentConfigs()),a(2),m(e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?5:-1)}}function Ce(n,t){n&1&&(o(0,"span",12),i(1,"Opening message is required."),r())}function ve(n,t){if(n&1&&(o(0,"option",23),i(1),r()),n&2){let e=t.$implicit;d("value",e.value),a(),g(e.label)}}function be(n,t){if(n&1){let e=F();o(0,"label",46)(1,"input",47),E("change",function(){let f=M(e).$implicit,y=s(3);return O(y.toggleDay(f.value))}),r(),o(2,"span",48),i(3),r()()}if(n&2){let e=t.$implicit,l=s(3);a(),d("checked",l.isDaySelected(e.value)),a(2),g(e.label)}}function xe(n,t){if(n&1&&(o(0,"div",8)(1,"span",44),i(2,"Days of week"),r(),o(3,"div",45),S(4,be,4,2,"label",46,I),r(),o(6,"span",13),i(7,"Leave empty to run every day of the week."),r()()),n&2){let e=s(2);a(4),P(e.dayOptions)}}function ye(n,t){n&1&&(o(0,"span",12),i(1,"Valid time is required (HH:mm)."),r())}function Se(n,t){n&1&&(o(0,"span",12),i(1,"Start date is required."),r())}function Pe(n,t){if(n&1&&(o(0,"option",23),i(1),r()),n&2){let e=t.$implicit;d("value",e.value),a(),g(e.label)}}function Ee(n,t){n&1&&(o(0,"span",12),i(1,"End date is required."),r())}function Me(n,t){if(n&1&&(o(0,"div",8)(1,"label",49),i(2," End date "),o(3,"span",10),i(4,"*"),r()(),_(5,"input",50),c(6,Ee,2,0,"span",12),r()),n&2){let e=s(2);a(5),b("scheduled-prompt-form__input--invalid",e.form.hasError("endDateRequired")&&e.endDateControl.touched),d("formControl",e.endDateControl),a(),m(e.form.hasError("endDateRequired")&&e.endDateControl.touched?6:-1)}}function Oe(n,t){n&1&&(o(0,"span",12),i(1,"Must be at least 1."),r())}function De(n,t){if(n&1&&(o(0,"div",8)(1,"label",51),i(2," Number of occurrences "),o(3,"span",10),i(4,"*"),r()(),_(5,"input",52),c(6,Oe,2,0,"span",12),r()),n&2){let e=s(2);a(5),b("scheduled-prompt-form__input--invalid",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched),d("formControl",e.occurrenceCountControl),a(),m(e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?6:-1)}}function Te(n,t){if(n&1&&(o(0,"p",36),i(1),r()),n&2){let e=s(2);a(),g(e.errorMessage())}}function we(n,t){if(n&1){let e=F();o(0,"form",7),E("ngSubmit",function(){M(e);let f=s();return O(f.submit())}),o(1,"div",8)(2,"label",9),i(3," Name "),o(4,"span",10),i(5,"*"),r()(),_(6,"input",11),c(7,se,2,0,"span",12),o(8,"span",13),i(9,'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.'),r()(),o(10,"div",8)(11,"label",14),i(12,"Description"),r(),_(13,"input",15),r(),o(14,"div",8)(15,"label",16),i(16," Agent Config "),o(17,"span",10),i(18,"*"),r()(),c(19,pe,4,1)(20,fe,3,1,"p",13)(21,ge,8,2),r(),o(22,"div",8)(23,"label",17),i(24," Opening message "),o(25,"span",10),i(26,"*"),r()(),_(27,"textarea",18),c(28,Ce,2,0,"span",12),o(29,"span",13),i(30," The message sent to the agent when the scheduled prompt fires. "),r()(),o(31,"fieldset",19)(32,"legend",20),i(33,"Recurrence"),r(),o(34,"div",8)(35,"label",21),i(36," Unit "),o(37,"span",10),i(38,"*"),r()(),o(39,"select",22),S(40,ve,2,2,"option",23,I),r()(),c(42,xe,8,0,"div",8),o(43,"div",8)(44,"label",24),i(45," Time (UTC) "),o(46,"span",10),i(47,"*"),r()(),o(48,"div",25),_(49,"input",26),o(50,"span",27),i(51,"UTC"),r()(),c(52,ye,2,0,"span",12),r()(),o(53,"fieldset",19)(54,"legend",20),i(55,"Planning"),r(),o(56,"div",8)(57,"label",28),i(58," Start date "),o(59,"span",10),i(60,"*"),r()(),_(61,"input",29),c(62,Se,2,0,"span",12),r(),o(63,"div",8)(64,"label",30),i(65," Ends "),o(66,"span",10),i(67,"*"),r()(),o(68,"select",31),S(69,Pe,2,2,"option",23,I),r()(),c(71,Me,7,4,"div",8),c(72,De,7,4,"div",8),r(),o(73,"div",8)(74,"label",32),_(75,"input",33),o(76,"span",34),i(77,"Enabled"),r()(),o(78,"p",35),i(79," When disabled, the scheduled prompt is saved but will not run on schedule. "),r()(),c(80,Te,2,1,"p",36),o(81,"div",37)(82,"button",38),i(83),r(),o(84,"button",39),E("click",function(){M(e);let f=s();return O(f.cancel())}),i(85,"Cancel"),r()()()}if(n&2){let e=s();d("formGroup",e.form),a(6),b("scheduled-prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),d("formControl",e.nameControl),a(),m(e.nameControl.invalid&&e.nameControl.touched?7:-1),a(6),d("formControl",e.descriptionControl),a(6),m(e.isEditMode()?19:e.availableAgentConfigs().length===0?20:21),a(8),b("scheduled-prompt-form__textarea--invalid",e.promptContentControl.invalid&&e.promptContentControl.touched),d("formControl",e.promptContentControl),a(),m(e.promptContentControl.invalid&&e.promptContentControl.touched?28:-1),a(11),d("formControl",e.unitControl),a(),P(e.schedulerUnits),a(2),m(e.showDayFilter()?42:-1),a(7),d("formControl",e.timeUtcControl),a(3),m(e.timeUtcControl.invalid&&e.timeUtcControl.touched?52:-1),a(9),b("scheduled-prompt-form__input--invalid",e.startDateControl.invalid&&e.startDateControl.touched),d("formControl",e.startDateControl),a(),m(e.startDateControl.invalid&&e.startDateControl.touched?62:-1),a(6),d("formControl",e.endTypeControl),a(),P(e.endTypes),a(2),m(e.showEndDate()?71:-1),a(),m(e.showOccurrenceCount()?72:-1),a(3),d("formControl",e.enabledControl),a(5),m(e.errorMessage()?80:-1),a(2),d("disabled",e.form.invalid||e.isSubmitting()),a(),D(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ")}}var de=class n{route=C(L);router=C(B);destroyRef=C(z);state=C(le);agentConfigController=C(G);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new Q({name:new p("",{nonNullable:!0,validators:[h.required]}),description:new p(null),agentConfigId:new p("",{nonNullable:!0,validators:[h.required]}),promptContent:new p("",{nonNullable:!0,validators:[h.required]}),unit:new p(x.WEEK,{nonNullable:!0,validators:[h.required]}),days:new p([],{nonNullable:!0}),timeUtc:new p("09:00",{nonNullable:!0,validators:[h.required,h.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new p("",{nonNullable:!0,validators:[h.required]}),endType:new p(u.NEVER,{nonNullable:!0,validators:[h.required]}),endDate:new p(null),occurrenceCount:new p(null),enabled:new p(!0,{nonNullable:!0})},{validators:[ke,Fe]});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}isEditMode=v(!1);isSubmitting=v(!1);isLoading=v(!1);errorMessage=v(null);SchedulerUnit=x;SchedulerEndType=u;schedulerUnits=[{value:x.WEEK,label:"Week(s)"},{value:x.MONTH,label:"Month(s)"}];endTypes=[{value:u.NEVER,label:"Never"},{value:u.ON_DATE,label:"On date"},{value:u.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(H).map(([t,e])=>({value:t,label:e}));unitSignal=N(this.unitControl.valueChanges.pipe(k(this.unitControl.value)));endTypeSignal=N(this.endTypeControl.valueChanges.pipe(k(this.endTypeControl.value)));showDayFilter=T(()=>this.unitSignal()===x.WEEK);showEndDate=T(()=>this.endTypeSignal()===u.ON_DATE);showOccurrenceCount=T(()=>this.endTypeSignal()===u.OCCURRENCES);agentConfigs=v([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Ne());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(!0),this.loadPromptAndResources(t)):this.loadResources()}loadPromptAndResources(t){this.isLoading.set(!0),U({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(w(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(!1)},error:()=>{this.isLoading.set(!1),this.navigateBack()}})}loadResources(){this.agentConfigs$().pipe(w(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t))}agentConfigs$(){return(this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(q(()=>R([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled)}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(!0),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=A(V({},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===u.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===u.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(w(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:y=>{this.isSubmitting.set(!1),y.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):y.status===400?this.errorMessage.set(y.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=W({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:10,vars:3,consts:[[1,"scheduled-prompt-form"],[1,"scheduled-prompt-form__header"],["type","button","title","Back to scheduled prompts",1,"scheduled-prompt-form__back",3,"click"],[1,"scheduled-prompt-form__back-icon"],[1,"scheduled-prompt-form__title"],[1,"scheduled-prompt-form__loading"],[1,"scheduled-prompt-form__form",3,"formGroup"],[1,"scheduled-prompt-form__form",3,"ngSubmit","formGroup"],[1,"scheduled-prompt-form__field"],["for","sp-name",1,"scheduled-prompt-form__label"],["aria-hidden","true"],["id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],[1,"scheduled-prompt-form__field-error"],[1,"scheduled-prompt-form__field-hint"],["for","sp-description",1,"scheduled-prompt-form__label"],["id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-agent-config",1,"scheduled-prompt-form__label"],["for","sp-prompt-content",1,"scheduled-prompt-form__label"],["id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",1,"scheduled-prompt-form__textarea",3,"formControl"],[1,"scheduled-prompt-form__fieldset"],[1,"scheduled-prompt-form__legend"],["for","sp-unit",1,"scheduled-prompt-form__label"],["id","sp-unit",1,"scheduled-prompt-form__select",3,"formControl"],[3,"value"],["for","sp-time",1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__time-wrapper"],["id","sp-time","type","time",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--time",3,"formControl"],[1,"scheduled-prompt-form__utc-badge"],["for","sp-start-date",1,"scheduled-prompt-form__label"],["id","sp-start-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-end-type",1,"scheduled-prompt-form__label"],["id","sp-end-type",1,"scheduled-prompt-form__select",3,"formControl"],[1,"scheduled-prompt-form__toggle-label"],["type","checkbox",1,"scheduled-prompt-form__toggle-checkbox",3,"formControl"],[1,"scheduled-prompt-form__toggle-text"],[1,"scheduled-prompt-form__toggle-hint"],[1,"scheduled-prompt-form__error"],[1,"scheduled-prompt-form__actions"],["type","submit",1,"scheduled-prompt-form__btn","scheduled-prompt-form__btn--primary",3,"disabled"],["type","button",1,"scheduled-prompt-form__btn",3,"click"],[1,"scheduled-prompt-form__readonly-value"],[3,"href"],["id","sp-agent-config",1,"scheduled-prompt-form__select",3,"formControl"],["value","","disabled",""],[1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__day-grid"],[1,"scheduled-prompt-form__day-label"],["type","checkbox",1,"scheduled-prompt-form__day-checkbox",3,"change","checked"],[1,"scheduled-prompt-form__day-text"],["for","sp-end-date",1,"scheduled-prompt-form__label"],["id","sp-end-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-occurrence-count",1,"scheduled-prompt-form__label"],["id","sp-occurrence-count","type","number","min","1",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--number",3,"formControl"]],template:function(e,l){e&1&&(o(0,"div",0)(1,"header",1)(2,"button",2),E("click",function(){return l.cancel()}),o(3,"span",3),i(4,"\u2190"),r(),i(5),r(),o(6,"h1",4),i(7),r()(),c(8,me,2,0,"p",5)(9,we,86,26,"form",6),r()),e&2&&(a(5),D(" ",l.isPlatformMode?"Platform Scheduled Prompts":"Scheduled Prompts"," "),a(2),D(" ",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"," "),a(),m(l.isLoading()?8:9))},dependencies:[ae,X,oe,re,j,Z,K,ne,Y,J,ie,ee,te],styles:[".scheduled-prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.scheduled-prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.scheduled-prompt-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.scheduled-prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.scheduled-prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.scheduled-prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.scheduled-prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.scheduled-prompt-form__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.scheduled-prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__input[_ngcontent-%COMP%], .scheduled-prompt-form__select[_ngcontent-%COMP%], .scheduled-prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.scheduled-prompt-form__input[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__select[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.scheduled-prompt-form__input[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__select[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__select[_ngcontent-%COMP%]{cursor:pointer;appearance:auto}.scheduled-prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.scheduled-prompt-form__input--time[_ngcontent-%COMP%]{flex:1;min-width:0}.scheduled-prompt-form__input--number[_ngcontent-%COMP%]{max-width:120px}.scheduled-prompt-form__time-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.scheduled-prompt-form__utc-badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.75rem;font-weight:600;font-family:monospace;color:var(--color-text-secondary, #6e6e73);background:var(--color-surface, rgba(0, 0, 0, .05));padding:.25rem .5rem;border-radius:4px;text-transform:uppercase;letter-spacing:.06em}.scheduled-prompt-form__fieldset[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:8px;padding:1rem 1.25rem 1.25rem;margin:0;display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__legend[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--color-text-secondary, #6e6e73);padding:0 .375rem}.scheduled-prompt-form__day-grid[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem}.scheduled-prompt-form__day-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__day-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__day-text[_ngcontent-%COMP%]{font-size:.875rem;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30);margin:0}.scheduled-prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30)}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--color-surface, rgba(0, 0, 0, .03))}.scheduled-prompt-form__input--invalid[_ngcontent-%COMP%], .scheduled-prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.scheduled-prompt-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.scheduled-prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"],changeDetection:0})};function ke(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===u.ON_DATE&&!e?{endDateRequired:!0}:null}function Fe(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===u.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:!0}:null}function Ne(){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{de as ScheduledPromptFormComponent};
1
+ import{a as le}from"./chunk-FKSUXVTW.js";import{b as G,w as x,x as u,y as H}from"./chunk-DDBWRK3B.js";import{a as L,c as B}from"./chunk-COLWSJEP.js";import{a as w,c as N}from"./chunk-PUWEEZSA.js";import{B as ie,F as ae,b as K,c as j,e as h,g as Y,h as J,i as Q,l as p,n as X,o as Z,s as ee,w as te,x as ne,y as oe,z as re}from"./chunk-ZJV25K6M.js";import{Bb as F,D as q,Db as E,Fb as s,Ha as $,Ka as a,R as k,Rb as b,Tb as i,Ub as g,Vb as D,Wa as W,a as V,b as A,ca as C,ga as M,ha as O,lb as c,m as R,ma as z,mb as m,mc as T,pb as S,qb as P,rb as d,sb as o,ta as v,tb as r,ub as _,z as U}from"./chunk-3DOXTB6J.js";var I=(n,t)=>t.value,ce=(n,t)=>t.id;function me(n,t){n&1&&(o(0,"p",5),i(1,"Loading\u2026"),r())}function se(n,t){n&1&&(o(0,"span",12),i(1," Name is required. "),r())}function pe(n,t){if(n&1&&(o(0,"p",40),i(1),r(),o(2,"span",13),i(3,"Agent Config cannot be changed after creation."),r()),n&2){let e=s(2);a(),g(e.resolveAgentConfigName(e.agentConfigIdControl.value))}}function ue(n,t){if(n&1&&(o(0,"a",41),i(1,"Add an agent config"),r(),i(2," first. ")),n&2){let e=s(3);d("href","/agentos/"+e.namespaceId+"/agent-configs/new",$)}}function fe(n,t){if(n&1&&(o(0,"p",13),i(1," No agent configs available in this scope yet. "),c(2,ue,3,1),r()),n&2){let e=s(2);a(2),m(e.isPlatformMode?-1:2)}}function _e(n,t){if(n&1&&(o(0,"option",23),i(1),r()),n&2){let e=t.$implicit;d("value",e.id),a(),g(e.name)}}function he(n,t){n&1&&(o(0,"span",12),i(1,"Agent Config is required."),r())}function ge(n,t){if(n&1&&(o(0,"select",42)(1,"option",43),i(2,"Select an agent config\u2026"),r(),S(3,_e,2,2,"option",23,ce),r(),c(5,he,2,0,"span",12),o(6,"span",13),i(7,"Immutable after creation."),r()),n&2){let e=s(2);d("formControl",e.agentConfigIdControl),a(3),P(e.availableAgentConfigs()),a(2),m(e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?5:-1)}}function Ce(n,t){n&1&&(o(0,"span",12),i(1,"Opening message is required."),r())}function ve(n,t){if(n&1&&(o(0,"option",23),i(1),r()),n&2){let e=t.$implicit;d("value",e.value),a(),g(e.label)}}function be(n,t){if(n&1){let e=F();o(0,"label",46)(1,"input",47),E("change",function(){let f=M(e).$implicit,y=s(3);return O(y.toggleDay(f.value))}),r(),o(2,"span",48),i(3),r()()}if(n&2){let e=t.$implicit,l=s(3);a(),d("checked",l.isDaySelected(e.value)),a(2),g(e.label)}}function xe(n,t){if(n&1&&(o(0,"div",8)(1,"span",44),i(2,"Days of week"),r(),o(3,"div",45),S(4,be,4,2,"label",46,I),r(),o(6,"span",13),i(7,"Leave empty to run every day of the week."),r()()),n&2){let e=s(2);a(4),P(e.dayOptions)}}function ye(n,t){n&1&&(o(0,"span",12),i(1,"Valid time is required (HH:mm)."),r())}function Se(n,t){n&1&&(o(0,"span",12),i(1,"Start date is required."),r())}function Pe(n,t){if(n&1&&(o(0,"option",23),i(1),r()),n&2){let e=t.$implicit;d("value",e.value),a(),g(e.label)}}function Ee(n,t){n&1&&(o(0,"span",12),i(1,"End date is required."),r())}function Me(n,t){if(n&1&&(o(0,"div",8)(1,"label",49),i(2," End date "),o(3,"span",10),i(4,"*"),r()(),_(5,"input",50),c(6,Ee,2,0,"span",12),r()),n&2){let e=s(2);a(5),b("scheduled-prompt-form__input--invalid",e.form.hasError("endDateRequired")&&e.endDateControl.touched),d("formControl",e.endDateControl),a(),m(e.form.hasError("endDateRequired")&&e.endDateControl.touched?6:-1)}}function Oe(n,t){n&1&&(o(0,"span",12),i(1,"Must be at least 1."),r())}function De(n,t){if(n&1&&(o(0,"div",8)(1,"label",51),i(2," Number of occurrences "),o(3,"span",10),i(4,"*"),r()(),_(5,"input",52),c(6,Oe,2,0,"span",12),r()),n&2){let e=s(2);a(5),b("scheduled-prompt-form__input--invalid",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched),d("formControl",e.occurrenceCountControl),a(),m(e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?6:-1)}}function Te(n,t){if(n&1&&(o(0,"p",36),i(1),r()),n&2){let e=s(2);a(),g(e.errorMessage())}}function we(n,t){if(n&1){let e=F();o(0,"form",7),E("ngSubmit",function(){M(e);let f=s();return O(f.submit())}),o(1,"div",8)(2,"label",9),i(3," Name "),o(4,"span",10),i(5,"*"),r()(),_(6,"input",11),c(7,se,2,0,"span",12),o(8,"span",13),i(9,'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.'),r()(),o(10,"div",8)(11,"label",14),i(12,"Description"),r(),_(13,"input",15),r(),o(14,"div",8)(15,"label",16),i(16," Agent Config "),o(17,"span",10),i(18,"*"),r()(),c(19,pe,4,1)(20,fe,3,1,"p",13)(21,ge,8,2),r(),o(22,"div",8)(23,"label",17),i(24," Opening message "),o(25,"span",10),i(26,"*"),r()(),_(27,"textarea",18),c(28,Ce,2,0,"span",12),o(29,"span",13),i(30," The message sent to the agent when the scheduled prompt fires. "),r()(),o(31,"fieldset",19)(32,"legend",20),i(33,"Recurrence"),r(),o(34,"div",8)(35,"label",21),i(36," Unit "),o(37,"span",10),i(38,"*"),r()(),o(39,"select",22),S(40,ve,2,2,"option",23,I),r()(),c(42,xe,8,0,"div",8),o(43,"div",8)(44,"label",24),i(45," Time (UTC) "),o(46,"span",10),i(47,"*"),r()(),o(48,"div",25),_(49,"input",26),o(50,"span",27),i(51,"UTC"),r()(),c(52,ye,2,0,"span",12),r()(),o(53,"fieldset",19)(54,"legend",20),i(55,"Planning"),r(),o(56,"div",8)(57,"label",28),i(58," Start date "),o(59,"span",10),i(60,"*"),r()(),_(61,"input",29),c(62,Se,2,0,"span",12),r(),o(63,"div",8)(64,"label",30),i(65," Ends "),o(66,"span",10),i(67,"*"),r()(),o(68,"select",31),S(69,Pe,2,2,"option",23,I),r()(),c(71,Me,7,4,"div",8),c(72,De,7,4,"div",8),r(),o(73,"div",8)(74,"label",32),_(75,"input",33),o(76,"span",34),i(77,"Enabled"),r()(),o(78,"p",35),i(79," When disabled, the scheduled prompt is saved but will not run on schedule. "),r()(),c(80,Te,2,1,"p",36),o(81,"div",37)(82,"button",38),i(83),r(),o(84,"button",39),E("click",function(){M(e);let f=s();return O(f.cancel())}),i(85,"Cancel"),r()()()}if(n&2){let e=s();d("formGroup",e.form),a(6),b("scheduled-prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),d("formControl",e.nameControl),a(),m(e.nameControl.invalid&&e.nameControl.touched?7:-1),a(6),d("formControl",e.descriptionControl),a(6),m(e.isEditMode()?19:e.availableAgentConfigs().length===0?20:21),a(8),b("scheduled-prompt-form__textarea--invalid",e.promptContentControl.invalid&&e.promptContentControl.touched),d("formControl",e.promptContentControl),a(),m(e.promptContentControl.invalid&&e.promptContentControl.touched?28:-1),a(11),d("formControl",e.unitControl),a(),P(e.schedulerUnits),a(2),m(e.showDayFilter()?42:-1),a(7),d("formControl",e.timeUtcControl),a(3),m(e.timeUtcControl.invalid&&e.timeUtcControl.touched?52:-1),a(9),b("scheduled-prompt-form__input--invalid",e.startDateControl.invalid&&e.startDateControl.touched),d("formControl",e.startDateControl),a(),m(e.startDateControl.invalid&&e.startDateControl.touched?62:-1),a(6),d("formControl",e.endTypeControl),a(),P(e.endTypes),a(2),m(e.showEndDate()?71:-1),a(),m(e.showOccurrenceCount()?72:-1),a(3),d("formControl",e.enabledControl),a(5),m(e.errorMessage()?80:-1),a(2),d("disabled",e.form.invalid||e.isSubmitting()),a(),D(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ")}}var de=class n{route=C(L);router=C(B);destroyRef=C(z);state=C(le);agentConfigController=C(G);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new Q({name:new p("",{nonNullable:!0,validators:[h.required]}),description:new p(null),agentConfigId:new p("",{nonNullable:!0,validators:[h.required]}),promptContent:new p("",{nonNullable:!0,validators:[h.required]}),unit:new p(x.WEEK,{nonNullable:!0,validators:[h.required]}),days:new p([],{nonNullable:!0}),timeUtc:new p("09:00",{nonNullable:!0,validators:[h.required,h.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new p("",{nonNullable:!0,validators:[h.required]}),endType:new p(u.NEVER,{nonNullable:!0,validators:[h.required]}),endDate:new p(null),occurrenceCount:new p(null),enabled:new p(!0,{nonNullable:!0})},{validators:[ke,Fe]});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}isEditMode=v(!1);isSubmitting=v(!1);isLoading=v(!1);errorMessage=v(null);SchedulerUnit=x;SchedulerEndType=u;schedulerUnits=[{value:x.WEEK,label:"Week(s)"},{value:x.MONTH,label:"Month(s)"}];endTypes=[{value:u.NEVER,label:"Never"},{value:u.ON_DATE,label:"On date"},{value:u.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(H).map(([t,e])=>({value:t,label:e}));unitSignal=N(this.unitControl.valueChanges.pipe(k(this.unitControl.value)));endTypeSignal=N(this.endTypeControl.valueChanges.pipe(k(this.endTypeControl.value)));showDayFilter=T(()=>this.unitSignal()===x.WEEK);showEndDate=T(()=>this.endTypeSignal()===u.ON_DATE);showOccurrenceCount=T(()=>this.endTypeSignal()===u.OCCURRENCES);agentConfigs=v([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Ne());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(!0),this.loadPromptAndResources(t)):this.loadResources()}loadPromptAndResources(t){this.isLoading.set(!0),U({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(w(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(!1)},error:()=>{this.isLoading.set(!1),this.navigateBack()}})}loadResources(){this.agentConfigs$().pipe(w(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t))}agentConfigs$(){return(this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(q(()=>R([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled)}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(!0),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=A(V({},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===u.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===u.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(w(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:y=>{this.isSubmitting.set(!1),y.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):y.status===400?this.errorMessage.set(y.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=W({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:10,vars:3,consts:[[1,"scheduled-prompt-form"],[1,"scheduled-prompt-form__header"],["type","button","title","Back to scheduled prompts",1,"scheduled-prompt-form__back",3,"click"],[1,"scheduled-prompt-form__back-icon"],[1,"scheduled-prompt-form__title"],[1,"scheduled-prompt-form__loading"],[1,"scheduled-prompt-form__form",3,"formGroup"],[1,"scheduled-prompt-form__form",3,"ngSubmit","formGroup"],[1,"scheduled-prompt-form__field"],["for","sp-name",1,"scheduled-prompt-form__label"],["aria-hidden","true"],["id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],[1,"scheduled-prompt-form__field-error"],[1,"scheduled-prompt-form__field-hint"],["for","sp-description",1,"scheduled-prompt-form__label"],["id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-agent-config",1,"scheduled-prompt-form__label"],["for","sp-prompt-content",1,"scheduled-prompt-form__label"],["id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",1,"scheduled-prompt-form__textarea",3,"formControl"],[1,"scheduled-prompt-form__fieldset"],[1,"scheduled-prompt-form__legend"],["for","sp-unit",1,"scheduled-prompt-form__label"],["id","sp-unit",1,"scheduled-prompt-form__select",3,"formControl"],[3,"value"],["for","sp-time",1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__time-wrapper"],["id","sp-time","type","time",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--time",3,"formControl"],[1,"scheduled-prompt-form__utc-badge"],["for","sp-start-date",1,"scheduled-prompt-form__label"],["id","sp-start-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-end-type",1,"scheduled-prompt-form__label"],["id","sp-end-type",1,"scheduled-prompt-form__select",3,"formControl"],[1,"scheduled-prompt-form__toggle-label"],["type","checkbox",1,"scheduled-prompt-form__toggle-checkbox",3,"formControl"],[1,"scheduled-prompt-form__toggle-text"],[1,"scheduled-prompt-form__toggle-hint"],[1,"scheduled-prompt-form__error"],[1,"scheduled-prompt-form__actions"],["type","submit",1,"scheduled-prompt-form__btn","scheduled-prompt-form__btn--primary",3,"disabled"],["type","button",1,"scheduled-prompt-form__btn",3,"click"],[1,"scheduled-prompt-form__readonly-value"],[3,"href"],["id","sp-agent-config",1,"scheduled-prompt-form__select",3,"formControl"],["value","","disabled",""],[1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__day-grid"],[1,"scheduled-prompt-form__day-label"],["type","checkbox",1,"scheduled-prompt-form__day-checkbox",3,"change","checked"],[1,"scheduled-prompt-form__day-text"],["for","sp-end-date",1,"scheduled-prompt-form__label"],["id","sp-end-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-occurrence-count",1,"scheduled-prompt-form__label"],["id","sp-occurrence-count","type","number","min","1",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--number",3,"formControl"]],template:function(e,l){e&1&&(o(0,"div",0)(1,"header",1)(2,"button",2),E("click",function(){return l.cancel()}),o(3,"span",3),i(4,"\u2190"),r(),i(5),r(),o(6,"h1",4),i(7),r()(),c(8,me,2,0,"p",5)(9,we,86,26,"form",6),r()),e&2&&(a(5),D(" ",l.isPlatformMode?"Platform Scheduled Prompts":"Scheduled Prompts"," "),a(2),D(" ",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"," "),a(),m(l.isLoading()?8:9))},dependencies:[ae,X,oe,re,j,Z,K,ne,Y,J,ie,ee,te],styles:[".scheduled-prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.scheduled-prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.scheduled-prompt-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.scheduled-prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.scheduled-prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.scheduled-prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.scheduled-prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.scheduled-prompt-form__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.scheduled-prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__input[_ngcontent-%COMP%], .scheduled-prompt-form__select[_ngcontent-%COMP%], .scheduled-prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.scheduled-prompt-form__input[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__select[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.scheduled-prompt-form__input[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__select[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__select[_ngcontent-%COMP%]{cursor:pointer;appearance:auto}.scheduled-prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.scheduled-prompt-form__input--time[_ngcontent-%COMP%]{flex:1;min-width:0}.scheduled-prompt-form__input--number[_ngcontent-%COMP%]{max-width:120px}.scheduled-prompt-form__time-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.scheduled-prompt-form__utc-badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.75rem;font-weight:600;font-family:monospace;color:var(--color-text-secondary, #6e6e73);background:var(--color-surface, rgba(0, 0, 0, .05));padding:.25rem .5rem;border-radius:4px;text-transform:uppercase;letter-spacing:.06em}.scheduled-prompt-form__fieldset[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:8px;padding:1rem 1.25rem 1.25rem;margin:0;display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__legend[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--color-text-secondary, #6e6e73);padding:0 .375rem}.scheduled-prompt-form__day-grid[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem}.scheduled-prompt-form__day-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__day-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__day-text[_ngcontent-%COMP%]{font-size:.875rem;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30);margin:0}.scheduled-prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30)}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--color-surface, rgba(0, 0, 0, .03))}.scheduled-prompt-form__input--invalid[_ngcontent-%COMP%], .scheduled-prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.scheduled-prompt-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.scheduled-prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"],changeDetection:0})};function ke(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===u.ON_DATE&&!e?{endDateRequired:!0}:null}function Fe(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===u.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:!0}:null}function Ne(){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{de as ScheduledPromptFormComponent};
@@ -0,0 +1 @@
1
+ import{w,z as O}from"./chunk-DDBWRK3B.js";import{c as D}from"./chunk-COLWSJEP.js";import{A as k,s as E}from"./chunk-2X6HKQMK.js";import{Bb as v,Db as g,Fb as l,Ka as d,Rb as y,Tb as s,Ub as b,Vb as C,Wa as M,ca as P,ga as h,ha as f,lb as c,mb as m,pc as x,qc as u,rb as I,sb as r,ta as S,tb as o}from"./chunk-3DOXTB6J.js";function L(n,t){if(n&1&&(r(0,"span",5),s(1),o()),n&2){let e=l();d(),b(e.definition().description)}}function q(n,t){if(n&1&&(r(0,"span",7),s(1),o()),n&2){let e=l();d(),C("Next: ",e.nextRunLabel)}}function U(n,t){if(n&1&&(r(0,"span",8),s(1),o()),n&2){let e=l();d(),C("Last run: ",e.lastRunLabel)}}function $(n,t){if(n&1){let e=v();r(0,"span",12),s(1,"Delete?"),o(),r(2,"ds-icon-button",13),g("action",function(){h(e);let a=l(2);return f(a.onDeleteConfirmed())}),o(),r(3,"ds-icon-button",14),g("action",function(){h(e);let a=l(2);return f(a.onDeleteCancelled())}),o()}}function N(n,t){if(n&1){let e=v();r(0,"ds-kebab-menu",15),g("itemSelected",function(a){h(e);let p=l(2);return f(p.onMenuAction(a))}),o()}if(n&2){let e=l(2);I("items",e.menuItems)}}function V(n,t){if(n&1&&(r(0,"div",10),c(1,$,4,0)(2,N,1,1,"ds-kebab-menu",11),o()),n&2){let e=l();y("scheduled-prompt-item__actions--confirming",e.pendingDelete()),d(),m(e.pendingDelete()?1:2)}}var R=class n{router=P(D);definition=u.required();namespaceId=u(void 0);platformMode=u(!1);readOnly=u(!1);enableRequested=x();disableRequested=x();deleteRequested=x();pendingDelete=S(!1);get scheduleLabel(){let{recurrence:t}=this.definition(),e=t.unit,i=t.timeUtc,a=e===w.WEEK?"week":"month",p=e===w.WEEK&&t.days?.length?` (${t.days.map(_=>O[_]??_).join(", ")})`:"";return`Every ${a}${p} at ${i} UTC`}formatInstant(t){if(!t)return null;let e=new Date(t),i=e.getUTCDate(),a=e.toLocaleString("en-GB",{month:"short",timeZone:"UTC"}),p=e.getUTCFullYear(),_=String(e.getUTCHours()).padStart(2,"0"),T=String(e.getUTCMinutes()).padStart(2,"0");return`${i} ${a} ${p} at ${_}:${T} UTC`}get nextRunLabel(){return this.formatInstant(this.definition().nextRunAt)}get lastRunLabel(){return this.formatInstant(this.definition().lastRunAt)}get menuItems(){let t=this.definition();return[{key:"edit",label:"Edit scheduled prompt",icon:"edit"},{key:"toggle",label:t.enabled?"Disable":"Enable",icon:t.enabled?"toggle_on":"toggle_off"},{key:"delete",label:"Delete scheduled prompt",icon:"delete",variant:"danger"}]}onMenuAction(t){let e=this.definition();switch(t){case"edit":this.platformMode()?this.router.navigate(["/agentos","admin","scheduled-prompts",e.id,"edit"]):this.router.navigate(["/agentos",this.namespaceId(),"scheduled-prompts",e.id,"edit"]);break;case"toggle":e.enabled?this.disableRequested.emit(e):this.enableRequested.emit(e);break;case"delete":this.pendingDelete.set(!0);break}}onDeleteConfirmed(){this.pendingDelete.set(!1),this.deleteRequested.emit(this.definition())}onDeleteCancelled(){this.pendingDelete.set(!1)}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=M({type:n,selectors:[["agentos-scheduled-prompt-item"]],inputs:{definition:[1,"definition"],namespaceId:[1,"namespaceId"],platformMode:[1,"platformMode"],readOnly:[1,"readOnly"]},outputs:{enableRequested:"enableRequested",disableRequested:"disableRequested",deleteRequested:"deleteRequested"},decls:13,vars:11,consts:[["role","listitem",1,"scheduled-prompt-item"],[1,"scheduled-prompt-item__body"],[1,"scheduled-prompt-item__header"],[1,"scheduled-prompt-item__name"],[1,"scheduled-prompt-item__status"],[1,"scheduled-prompt-item__description"],[1,"scheduled-prompt-item__schedule"],[1,"scheduled-prompt-item__next-run"],[1,"scheduled-prompt-item__last-run"],[1,"scheduled-prompt-item__actions",3,"scheduled-prompt-item__actions--confirming"],[1,"scheduled-prompt-item__actions"],[3,"items"],[1,"scheduled-prompt-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],[3,"itemSelected","items"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),s(4),o(),r(5,"span",4),s(6),o()(),c(7,L,2,1,"span",5),r(8,"span",6),s(9),o(),c(10,q,2,1,"span",7),c(11,U,2,1,"span",8),o(),c(12,V,3,3,"div",9),o()),e&2&&(d(4),b(i.definition().name),d(),y("scheduled-prompt-item__status--enabled",i.definition().enabled)("scheduled-prompt-item__status--disabled",!i.definition().enabled),d(),C(" ",i.definition().enabled?"Enabled":"Disabled"," "),d(),m(i.definition().description?7:-1),d(2),b(i.scheduleLabel),d(),m(i.nextRunLabel?10:-1),d(),m(i.lastRunLabel?11:-1),d(),m(i.readOnly()?-1:12))},dependencies:[k,E],styles:[".scheduled-prompt-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem 1rem;border-radius:10px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--glass-bg, rgba(255, 255, 255, .72));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));backdrop-filter:var(--glass-backdrop-blur, blur(20px));transition:background .15s ease,border-color .15s ease}.scheduled-prompt-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-color:var(--color-primary, #007aff)}.scheduled-prompt-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.scheduled-prompt-item__header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;min-width:0}.scheduled-prompt-item__name[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text, #1d1d1f);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0}.scheduled-prompt-item__status[_ngcontent-%COMP%]{font-size:.7rem;font-weight:600;padding:.15rem .5rem;border-radius:999px;white-space:nowrap;flex-shrink:0;text-transform:uppercase;letter-spacing:.04em}.scheduled-prompt-item__status--enabled[_ngcontent-%COMP%]{background:var(--color-success-bg, rgba(52, 199, 89, .12));color:var(--color-success, #34c759)}.scheduled-prompt-item__status--disabled[_ngcontent-%COMP%]{background:var(--color-warning-bg, rgba(255, 159, 10, .12));color:var(--color-warning, #ff9f0a)}.scheduled-prompt-item__description[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.scheduled-prompt-item__schedule[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);font-family:monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.scheduled-prompt-item__next-run[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text, #1d1d1f);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.scheduled-prompt-item__last-run[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary, #6e6e73);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.scheduled-prompt-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.scheduled-prompt-item[_ngcontent-%COMP%]:hover .scheduled-prompt-item__actions[_ngcontent-%COMP%], .scheduled-prompt-item[_ngcontent-%COMP%]:focus-within .scheduled-prompt-item__actions[_ngcontent-%COMP%]{opacity:1}.scheduled-prompt-item__actions--confirming[_ngcontent-%COMP%]{opacity:1}.scheduled-prompt-item__confirm-label[_ngcontent-%COMP%]{font-size:.8rem;font-weight:500;color:var(--color-error, #ff3b30);margin-right:.25rem;white-space:nowrap}"],changeDetection:0})};export{R as a};
@@ -0,0 +1 @@
1
+ import{b as y}from"./chunk-DLB34U6L.js";import{c as k}from"./chunk-COLWSJEP.js";import"./chunk-2X6HKQMK.js";import"./chunk-EGMTTOHU.js";import"./chunk-TQXOFKZO.js";import"./chunk-PUWEEZSA.js";import"./chunk-WXFL4OGQ.js";import"./chunk-ZJV25K6M.js";import"./chunk-GO5IXCK2.js";import{Bb as f,Db as u,Fb as _,Ka as d,Tb as o,Wa as p,ca as r,ga as m,ha as c,pb as l,qb as g,rb as h,sb as t,tb as i}from"./chunk-3DOXTB6J.js";var M=(a,n)=>n.key;function b(a,n){if(a&1){let e=f();t(0,"agentos-action-card",6),u("nameClicked",function(){let v=m(e).$implicit,x=_();return c(x.navigateTo(v.path))}),i()}if(a&2){let e=n.$implicit;h("name",e.name)("mark",e.mark)("markIsEmoji",!0)("description",e.description)("clickable",!0)}}var C=class a{router=r(k);sections=[{key:"users",mark:"\u{1F464}",name:"Users & Groups",description:"Manage platform users, their admin rights, and namespace user groups.",path:"/agentos/admin/users"},{key:"agents",mark:"\u{1F916}",name:"Platform agents",description:"Manage agent configs shared across all namespaces.",path:"/agentos/admin/agent-configs"},{key:"integrations",mark:"\u{1F517}",name:"Platform integrations",description:"Manage integration configs shared across all namespaces.",path:"/agentos/admin/integration-configs"},{key:"authSetting",mark:"\u{1F512}",name:"Auth settings",description:"Manage auth settings shared across all namespaces.",path:"/agentos/admin/auth-settings"},{key:"ai-providers",mark:"\u{1F9E0}",name:"Platform AI providers",description:"Manage AI provider configs shared across all namespaces.",path:"/agentos/admin/ai-providers"},{key:"ai-models",mark:"\u2728",name:"Platform AI models",description:"Manage AI model configs shared across all namespaces.",path:"/agentos/admin/ai-models"},{key:"prompts",mark:"\u{1F4C4}",name:"Platform prompts",description:"Manage prompts shared across all namespaces.",path:"/agentos/admin/prompts"},{key:"case-definitions",mark:"\u23F0",name:"Platform case definitions",description:"Manage scheduled case definitions shared across all namespaces.",path:"/agentos/admin/case-definitions"}];navigateTo(n){this.router.navigate([n])}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=p({type:a,selectors:[["agentos-admin-home"]],decls:9,vars:0,consts:[[1,"admin-home"],[1,"admin-home__header"],[1,"admin-home__title"],[1,"admin-home__subtitle"],[1,"admin-home__sections"],[3,"name","mark","markIsEmoji","description","clickable"],[3,"nameClicked","name","mark","markIsEmoji","description","clickable"]],template:function(e,s){e&1&&(t(0,"div",0)(1,"header",1)(2,"h1",2),o(3,"Administration"),i(),t(4,"p",3),o(5,"Platform-level settings, visible to super-admins only."),i()(),t(6,"nav",4),l(7,b,1,5,"agentos-action-card",5,M),i()()),e&2&&(d(7),g(s.sections))},dependencies:[y],styles:[".admin-home[_ngcontent-%COMP%]{max-width:860px;margin:0 auto;padding:2rem 1rem;display:flex;flex-direction:column;gap:2rem}.admin-home__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.admin-home__title[_ngcontent-%COMP%]{margin:0;font-size:28px;font-weight:700;color:var(--color-text);font-family:var(--font-heading)}.admin-home__subtitle[_ngcontent-%COMP%]{margin:0;font-size:13px;color:var(--color-neutral-600)}.admin-home__sections[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}"],changeDetection:0})};export{C as AdminHomeComponent};
@@ -1 +1 @@
1
- import{a as I}from"./chunk-7ZDYCVKF.js";import{a as T}from"./chunk-55CCIZ6Y.js";import"./chunk-VH7ZEMCE.js";import{c as w}from"./chunk-COLWSJEP.js";import{s as x,z as q}from"./chunk-2X6HKQMK.js";import"./chunk-EGMTTOHU.js";import"./chunk-TQXOFKZO.js";import{a as p}from"./chunk-PUWEEZSA.js";import"./chunk-WXFL4OGQ.js";import"./chunk-ZJV25K6M.js";import"./chunk-GO5IXCK2.js";import{Bb as C,Db as c,Fb as s,Pb as S,Wa as P,ab as b,ca as m,ga as d,ha as a,jc as v,lb as g,ma as f,mb as y,mc as R,rb as u,sb as l,ta as h,tb as _}from"./chunk-3DOXTB6J.js";function M(i,e){if(i&1){let t=C();l(0,"agentos-scheduled-prompt-item",4),c("enableRequested",function(n){d(t);let r=s(2);return a(r.enablePrompt(n))})("disableRequested",function(n){d(t);let r=s(2);return a(r.disablePrompt(n))})("deleteRequested",function(n){d(t);let r=s(2);return a(r.deletePrompt(n))}),_()}i&2&&u("definition",e)("platformMode",!0)}function E(i,e){if(i&1&&g(0,M,1,2,"agentos-scheduled-prompt-item",3),i&2){let t,o=e.$implicit,n=s();y((t=n.resolvePrompt(o.id))?0:-1,t)}}var D=class i{router=m(w);destroyRef=m(f);state=m(T);prompts=h([]);promptItems=R(()=>this.prompts().map(e=>({id:e.id??"",name:e.name,description:e.description,badges:[{label:e.enabled?"Enabled":"Disabled",variant:e.enabled?"success":"warning"}]})));constructor(){this.state.listPlatform().pipe(p(this.destroyRef)).subscribe(e=>this.prompts.set(e))}goBack(){this.router.navigate(["/agentos","admin"])}openCreateForm(){this.router.navigate(["/agentos","admin","scheduled-prompts","new"])}enablePrompt(e){this.state.enable(e.id??"").pipe(p(this.destroyRef)).subscribe(t=>this.patchPrompt(t))}disablePrompt(e){this.state.disable(e.id??"").pipe(p(this.destroyRef)).subscribe(t=>this.patchPrompt(t))}deletePrompt(e){let t=e.id??"";this.state.delete(t).pipe(p(this.destroyRef)).subscribe(()=>this.prompts.update(o=>o.filter(n=>n.id!==t)))}resolvePrompt(e){return this.prompts().find(t=>t.id===e)??null}patchPrompt(e){this.prompts.update(t=>t.map(o=>o.id===e.id?e:o))}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=P({type:i,selectors:[["agentos-platform-scheduled-prompts"]],decls:4,vars:3,consts:[["scheduledPromptItemTpl",""],["title","Platform Scheduled Prompts","emptyMessage","No platform scheduled prompts defined yet. Add one above.","cardMinWidth","420px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[3,"definition","platformMode"],[3,"enableRequested","disableRequested","deleteRequested","definition","platformMode"]],template:function(t,o){if(t&1&&(l(0,"ds-entity-list",1),c("createRequested",function(){return o.openCreateForm()}),l(1,"ds-icon-button",2),c("action",function(){return o.goBack()}),_()(),b(2,E,1,1,"ng-template",null,0,v)),t&2){let n=S(3);u("items",o.promptItems())("showCreate",!0)("itemTemplate",n)}},dependencies:[q,I,x],encapsulation:2,changeDetection:0})};export{D as PlatformScheduledPromptsComponent};
1
+ import{a as I}from"./chunk-J3QUVW75.js";import{a as T}from"./chunk-FKSUXVTW.js";import"./chunk-DDBWRK3B.js";import{c as w}from"./chunk-COLWSJEP.js";import{s as x,z as q}from"./chunk-2X6HKQMK.js";import"./chunk-EGMTTOHU.js";import"./chunk-TQXOFKZO.js";import{a as p}from"./chunk-PUWEEZSA.js";import"./chunk-WXFL4OGQ.js";import"./chunk-ZJV25K6M.js";import"./chunk-GO5IXCK2.js";import{Bb as C,Db as c,Fb as s,Pb as S,Wa as P,ab as b,ca as m,ga as d,ha as a,jc as v,lb as g,ma as f,mb as y,mc as R,rb as u,sb as l,ta as h,tb as _}from"./chunk-3DOXTB6J.js";function M(i,e){if(i&1){let t=C();l(0,"agentos-scheduled-prompt-item",4),c("enableRequested",function(n){d(t);let r=s(2);return a(r.enablePrompt(n))})("disableRequested",function(n){d(t);let r=s(2);return a(r.disablePrompt(n))})("deleteRequested",function(n){d(t);let r=s(2);return a(r.deletePrompt(n))}),_()}i&2&&u("definition",e)("platformMode",!0)}function E(i,e){if(i&1&&g(0,M,1,2,"agentos-scheduled-prompt-item",3),i&2){let t,o=e.$implicit,n=s();y((t=n.resolvePrompt(o.id))?0:-1,t)}}var D=class i{router=m(w);destroyRef=m(f);state=m(T);prompts=h([]);promptItems=R(()=>this.prompts().map(e=>({id:e.id??"",name:e.name,description:e.description,badges:[{label:e.enabled?"Enabled":"Disabled",variant:e.enabled?"success":"warning"}]})));constructor(){this.state.listPlatform().pipe(p(this.destroyRef)).subscribe(e=>this.prompts.set(e))}goBack(){this.router.navigate(["/agentos","admin"])}openCreateForm(){this.router.navigate(["/agentos","admin","scheduled-prompts","new"])}enablePrompt(e){this.state.enable(e.id??"").pipe(p(this.destroyRef)).subscribe(t=>this.patchPrompt(t))}disablePrompt(e){this.state.disable(e.id??"").pipe(p(this.destroyRef)).subscribe(t=>this.patchPrompt(t))}deletePrompt(e){let t=e.id??"";this.state.delete(t).pipe(p(this.destroyRef)).subscribe(()=>this.prompts.update(o=>o.filter(n=>n.id!==t)))}resolvePrompt(e){return this.prompts().find(t=>t.id===e)??null}patchPrompt(e){this.prompts.update(t=>t.map(o=>o.id===e.id?e:o))}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=P({type:i,selectors:[["agentos-platform-scheduled-prompts"]],decls:4,vars:3,consts:[["scheduledPromptItemTpl",""],["title","Platform Scheduled Prompts","emptyMessage","No platform scheduled prompts defined yet. Add one above.","cardMinWidth","420px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[3,"definition","platformMode"],[3,"enableRequested","disableRequested","deleteRequested","definition","platformMode"]],template:function(t,o){if(t&1&&(l(0,"ds-entity-list",1),c("createRequested",function(){return o.openCreateForm()}),l(1,"ds-icon-button",2),c("action",function(){return o.goBack()}),_()(),b(2,E,1,1,"ng-template",null,0,v)),t&2){let n=S(3);u("items",o.promptItems())("showCreate",!0)("itemTemplate",n)}},dependencies:[q,I,x],encapsulation:2,changeDetection:0})};export{D as PlatformScheduledPromptsComponent};
@@ -0,0 +1 @@
1
+ import{a as oe}from"./chunk-7PHHASXE.js";import"./chunk-JIYGZGAO.js";import"./chunk-FIDJLAO5.js";import{b as G,i as U,v as W}from"./chunk-DDBWRK3B.js";import{a as L,c as $,d as j}from"./chunk-COLWSJEP.js";import{a as S}from"./chunk-PUWEEZSA.js";import{F as ne,b as Y,c as q,e as P,g as J,h as H,i as K,l as _,n as Q,s as X,w as Z,y as ee,z as te}from"./chunk-ZJV25K6M.js";import{Bb as w,D as N,Db as b,Fb as s,Ka as g,Tb as a,Ub as y,Vb as E,Wa as V,a as R,b as T,ca as v,ga as C,ha as x,jb as B,lb as f,m as I,ma as D,mb as p,nb as z,pb as A,qb as M,rb as d,sb as i,t as F,ta as u,tb as n,ub as h,z as O}from"./chunk-3DOXTB6J.js";var re=(r,t)=>t.config.id,ae=(r,t)=>t.type;function le(r,t){if(r&1&&(i(0,"a",5),a(1,"View resolved definition \u2192"),n()),r&2){let e=s();d("routerLink",e.inspectRoute())}}function ge(r,t){r&1&&(i(0,"span",6),a(1,"Platform level"),n())}function ce(r,t){r&1&&(i(0,"p",7),a(1,"Loading\u2026"),n())}function se(r,t){if(r&1&&(i(0,"span",41),a(1),n()),r&2){let e=s().$implicit;g(),y(e.config.integrationType)}}function de(r,t){if(r&1&&h(0,"input",42),r&2){let e=s().$implicit;d("formControl",e.toolsControl)}}function me(r,t){if(r&1){let e=w();i(0,"div",37)(1,"label",38)(2,"input",39),b("change",function(){let l=C(e).$implicit,c=s(3);return x(c.toggleIntegration(l))}),n(),i(3,"span",40),a(4),n(),f(5,se,2,1,"span",41),n(),f(6,de,1,1,"input",42),n()}if(r&2){let e=t.$implicit;g(2),d("checked",e.enabled()),g(2),y(e.config.name),g(),p(e.config.integrationType?5:-1),g(),p(e.enabled()?6:-1)}}function fe(r,t){if(r&1&&(i(0,"p",48),a(1),n()),r&2){let e=s().$implicit;g(),E(" Restricted to: ",e.restrictedTools.join(", ")," (set outside this form, preserved on save) ")}}function pe(r,t){if(r&1){let e=w();i(0,"div",37)(1,"label",38)(2,"span",40),a(3),n(),i(4,"span",41),a(5,"built-in"),n()(),i(6,"select",44),b("change",function(l){let c=C(e).$implicit,m=s(4);return x(m.setBuiltInState(c,l.target.value))}),i(7,"option",45),a(8),n(),i(9,"option",46),a(10,"Enabled"),n(),i(11,"option",47),a(12,"Disabled"),n()(),f(13,fe,2,1,"p",48),i(14,"p",49),a(15),n()()}if(r&2){let e=t.$implicit,o=s(4);g(),B("for","built-in-"+e.type),g(2),y(e.displayName),g(3),d("id","built-in-"+e.type)("value",e.state()),g(2),y(o.builtInDefaultLabel(e)),g(5),p(e.state()==="on"&&e.restrictedTools?13:-1),g(2),y(e.description)}}function _e(r,t){if(r&1&&(i(0,"p",43),a(1,"Built-in integrations"),n(),A(2,pe,16,7,"div",37,ae)),r&2){let e=s(3);g(2),M(e.builtInRows())}}function ue(r,t){if(r&1&&(i(0,"fieldset",20)(1,"legend",25),a(2,"Integrations"),n(),i(3,"p",36),a(4," Select which integrations this agent can use. Leave tool names empty to allow all tools from an integration. "),n(),A(5,me,7,4,"div",37,re),f(7,_e,4,0),n()),r&2){let e=s(2);g(5),M(e.integrationRows()),g(2),p(e.builtInRows().length>0?7:-1)}}function be(r,t){if(r&1){let e=w();i(0,"li",50),h(1,"input",51),i(2,"button",52),b("click",function(){let l=C(e).$implicit,c=s(3);return x(c.removeSubAgent(l))}),a(3," \u{1F5D1} "),n()()}if(r&2){let e=t.$implicit;g(),d("formControl",e.control)}}function Ce(r,t){if(r&1&&(i(0,"ul",28),A(1,be,4,1,"li",50,z),n()),r&2){let e=s(2);g(),M(e.subAgentRows())}}function xe(r,t){if(r&1){let e=w();i(0,"button",53),b("click",function(){C(e);let l=s(2);return x(l.exportYaml())}),a(1),n()}if(r&2){let e=s(2);d("disabled",e.isExporting()),g(),E(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ")}}function he(r,t){if(r&1){let e=w();i(0,"form",9),b("ngSubmit",function(){C(e);let l=s();return x(l.submit())}),i(1,"div",10)(2,"label",11),a(3,"Name "),i(4,"span",12),a(5,"*"),n()(),h(6,"input",13),n(),i(7,"div",10)(8,"label",14),a(9,"Description"),n(),h(10,"input",15),n(),i(11,"div",10)(12,"label",16),a(13,"Model name"),n(),h(14,"input",17),n(),i(15,"div",10)(16,"label",18),a(17,"Instructions"),n(),h(18,"textarea",19),n(),f(19,ue,8,1,"fieldset",20),i(20,"div",10)(21,"label",21),h(22,"input",22),i(23,"span",23),a(24,"Advanced mode"),n()(),i(25,"p",24),a(26," When enabled, this agent uses a multi-step reasoning loop instead of a single LLM call. "),n()(),i(27,"div",10)(28,"label",21),h(29,"input",22),i(30,"span",23),a(31,"Enabled"),n()(),i(32,"p",24),a(33,"Disabled agents are excluded from namespace resolution."),n()(),i(34,"div",10)(35,"span",25),a(36,"Sub-agents"),n(),i(37,"p",26),a(38," Glob patterns for agents this agent may delegate to. "),i(39,"code",27),a(40,"*"),n(),a(41," matches any sequence of characters (e.g.\xA0"),i(42,"code",27),a(43,"*Fixer"),n(),a(44,", "),i(45,"code",27),a(46,"*"),n(),a(47," for all). Leave empty to disable delegation. "),n(),f(48,Ce,3,0,"ul",28),i(49,"div",29)(50,"input",30),b("keydown.enter",function(){C(e);let l=s();return x(l.addSubAgent())}),n(),i(51,"button",31),b("click",function(){C(e);let l=s();return x(l.addSubAgent())}),a(52," + "),n()()(),i(53,"div",32)(54,"button",33),a(55),n(),f(56,xe,2,2,"button",34),i(57,"button",35),b("click",function(){C(e);let l=s();return x(l.cancel())}),a(58,"Cancel"),n()()()}if(r&2){let e=s();d("formGroup",e.form),g(6),d("formControl",e.nameControl),g(4),d("formControl",e.descriptionControl),g(4),d("formControl",e.modelNameControl),g(4),d("formControl",e.instructionsControl),g(),p(e.integrationRows().length>0||e.builtInRows().length>0?19:-1),g(3),d("formControl",e.advancedExecutionControl),g(7),d("formControl",e.enabledControl),g(19),p(e.subAgentRows().length>0?48:-1),g(2),d("formControl",e.newSubAgentControl),g(),d("disabled",!e.newSubAgentControl.value.trim()),g(3),d("disabled",e.form.invalid||e.isSubmitting()),g(),E(" ",e.isEditMode()?"Save changes":"Create"," "),g(),p(e.isEditMode()?56:-1)}}var ie=class r{route=v(L);router=v($);destroyRef=v(D);agentConfigController=v(G);exportService=v(W);integrationConfigState=v(oe);integrationTypeController=v(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new K({name:new _("",{nonNullable:!0,validators:[P.required,P.minLength(1)]}),description:new _(null),modelName:new _(null),instructions:new _(null),advancedExecution:new _(!1,{nonNullable:!0}),enabled:new _(!1,{nonNullable:!0})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get modelNameControl(){return this.form.controls.modelName}get instructionsControl(){return this.form.controls.instructions}get advancedExecutionControl(){return this.form.controls.advancedExecution}get enabledControl(){return this.form.controls.enabled}subAgentRows=u([]);newSubAgentControl=new _("",{nonNullable:!0});isEditMode=u(!1);isSubmitting=u(!1);isLoading=u(!1);isExporting=u(!1);builtInRows=u([]);inspectRoute(){let t=this.route.snapshot.paramMap.get("agentConfigId")??"";return this.isPlatformMode?["/agentos","admin","agent-configs",t,"inspect"]:["/agentos",this.namespaceId,"agent-configs",t,"inspect"]}integrationRows=u([]);existingConfig=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("agentConfigId");t?(this.isEditMode.set(!0),this.loadConfigAndIntegrations(t)):this.loadIntegrations(void 0)}loadConfigAndIntegrations(t){this.isLoading.set(!0),O({config:this.agentConfigController.getByIdAgentConfig(t),namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):I([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes()}).pipe(S(this.destroyRef)).subscribe({next:({config:e,namespaceIntegrations:o,platformIntegrations:l,builtInTypes:c})=>{this.existingConfig=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.modelNameControl.setValue(e.modelName??null),this.instructionsControl.setValue(e.instructions??null),this.advancedExecutionControl.setValue(e.advancedExecution??!1),this.enabledControl.setValue(e.enabled??!0);let m=[...l,...o];this.integrationRows.set(this.buildIntegrationRows(m,e.integrations??void 0)),this.builtInRows.set(this.buildBuiltInRows(c,e.integrations??void 0)),this.subAgentRows.set((e.subAgents??[]).map(k=>({control:new _(k,{nonNullable:!0})}))),this.isLoading.set(!1)},error:()=>{this.isLoading.set(!1),this.navigateBack()}})}loadIntegrations(t){O({namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):I([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes()}).pipe(S(this.destroyRef)).subscribe({next:({namespaceIntegrations:e,platformIntegrations:o,builtInTypes:l})=>{let c=[...o,...e];this.integrationRows.set(this.buildIntegrationRows(c,t??void 0)),this.builtInRows.set(this.buildBuiltInRows(l,t??void 0))}})}loadBuiltInTypes(){return this.integrationTypeController.listTypesIntegrationType().pipe(F(t=>t.filter(e=>!e.configSchema)),N(t=>(console.error("[agent-config-form] failed to load integration types",t),I([]))))}buildIntegrationRows(t,e){return t.map(o=>{let l=o.name??"",c=e?.[l],m=e!=null&&l in e,k=Array.isArray(c)?c.join(", "):"";return{config:o,enabled:u(m),toolsControl:new _(k,{nonNullable:!0})}})}buildBuiltInRows(t,e){return t.map(o=>{let l=e!=null&&o.type in e,c=e?.[o.type],m=l?Array.isArray(c)&&c.length===0?"off":"on":"default";return{type:o.type,displayName:o.displayName,description:o.description,enabledByDefault:o.enabledByDefault===!0,state:u(m),restrictedTools:Array.isArray(c)&&c.length>0?c:null}})}toggleIntegration(t){t.enabled.update(e=>!e)}setBuiltInState(t,e){t.state.set(e)}builtInDefaultLabel(t){return t.enabledByDefault?"Platform default (enabled)":"Platform default (disabled)"}addSubAgent(){let t=this.newSubAgentControl.value.trim();t&&(this.subAgentRows.update(e=>[...e,{control:new _(t,{nonNullable:!0})}]),this.newSubAgentControl.reset(""))}removeSubAgent(t){this.subAgentRows.update(e=>e.filter(o=>o!==t))}buildSubAgentsPayload(){let t=this.subAgentRows().map(e=>e.control.value.trim()).filter(e=>e.length>0);return t.length>0?t:void 0}buildIntegrationsPayload(){let t={};for(let o of this.integrationRows().filter(l=>l.enabled())){let l=o.config.name??"",c=o.toolsControl.value.trim();t[l]=c===""?null:c.split(",").map(m=>m.trim()).filter(m=>m.length>0)}for(let o of this.builtInRows()){let l=o.state();l==="on"?t[o.type]=o.restrictedTools??null:l==="off"&&(t[o.type]=[])}let e=new Set([...this.integrationRows().map(o=>o.config.name??""),...this.builtInRows().map(o=>o.type)]);for(let[o,l]of Object.entries(this.existingConfig?.integrations??{}))e.has(o)||(t[o]=l);return Object.keys(t).length>0?t:void 0}submit(){if(this.form.invalid||this.isSubmitting())return;this.addSubAgent(),this.isSubmitting.set(!0);let t=T(R({},this.existingConfig??{}),{createdOn:this.existingConfig?.createdOn,updatedOn:this.existingConfig?.updatedOn,namespaceId:this.namespaceId,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,modelName:this.modelNameControl.value?.trim()||void 0,instructions:this.instructionsControl.value?.trim()||void 0,integrations:this.buildIntegrationsPayload(),advancedExecution:this.advancedExecutionControl.value,enabled:this.enabledControl.value,subAgents:this.buildSubAgentsPayload()});(this.isEditMode()?this.agentConfigController.updateAgentConfig(this.existingConfig.id??"",t):this.agentConfigController.createAgentConfig(t)).pipe(S(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(!1)})}exportYaml(){let t=this.existingConfig?.id;!t||this.isExporting()||(this.isExporting.set(!0),this.exportService.exportAsYaml(t).pipe(S(this.destroyRef)).subscribe({next:e=>{let o=new Blob([e],{type:"application/yaml"}),l=URL.createObjectURL(o),c=document.createElement("a");c.href=l,c.download=`${this.existingConfig?.name??"agent"}.yaml`,c.click(),URL.revokeObjectURL(l),this.isExporting.set(!1)},error:()=>this.isExporting.set(!1)}))}cancel(){this.navigateBack()}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"])}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=V({type:r,selectors:[["agentos-agent-config-form"]],decls:12,vars:4,consts:[[1,"agent-config-form"],[1,"agent-config-form__header"],["type","button","title","Back to agent configs",1,"agent-config-form__back",3,"click"],[1,"agent-config-form__back-icon"],[1,"agent-config-form__title"],[1,"agent-config-form__sibling-link",3,"routerLink"],[1,"agent-config-form__platform-badge"],[1,"agent-config-form__loading"],[1,"agent-config-form__form",3,"formGroup"],[1,"agent-config-form__form",3,"ngSubmit","formGroup"],[1,"agent-config-form__field"],["for","agent-config-name",1,"agent-config-form__label"],["aria-hidden","true"],["id","agent-config-name","type","text","placeholder","e.g. Support agent","autocomplete","off",1,"agent-config-form__input",3,"formControl"],["for","agent-config-description",1,"agent-config-form__label"],["id","agent-config-description","type","text","placeholder","Optional \u2014 short description of this agent","autocomplete","off",1,"agent-config-form__input",3,"formControl"],["for","agent-config-model-name",1,"agent-config-form__label"],["id","agent-config-model-name","type","text","placeholder","Optional \u2014 model alias or name to use","autocomplete","off",1,"agent-config-form__input",3,"formControl"],["for","agent-config-instructions",1,"agent-config-form__label"],["id","agent-config-instructions","rows","6","placeholder","Optional \u2014 system instructions for this agent",1,"agent-config-form__textarea",3,"formControl"],[1,"agent-config-form__integrations"],[1,"agent-config-form__toggle-label"],["type","checkbox",1,"agent-config-form__toggle-checkbox",3,"formControl"],[1,"agent-config-form__toggle-text"],[1,"agent-config-form__toggle-hint"],[1,"agent-config-form__label"],[1,"agent-config-form__field-hint"],[1,"agent-config-form__code"],[1,"agent-config-form__sub-agent-list"],[1,"agent-config-form__sub-agent-add"],["type","text","placeholder","e.g. *Fixer or *","autocomplete","off",1,"agent-config-form__input","agent-config-form__sub-agent-input",3,"keydown.enter","formControl"],["type","button","title","Add pattern",1,"agent-config-form__sub-agent-btn","agent-config-form__sub-agent-btn--add",3,"click","disabled"],[1,"agent-config-form__actions"],["type","submit",1,"agent-config-form__btn","agent-config-form__btn--primary",3,"disabled"],["type","button",1,"agent-config-form__btn","agent-config-form__btn--export",3,"disabled"],["type","button",1,"agent-config-form__btn",3,"click"],[1,"agent-config-form__integrations-hint"],[1,"agent-config-form__integration-row"],[1,"agent-config-form__integration-toggle"],["type","checkbox",1,"agent-config-form__integration-checkbox",3,"change","checked"],[1,"agent-config-form__integration-name"],[1,"agent-config-form__integration-type"],["type","text","placeholder","Tool names, comma-separated (empty = all tools)","autocomplete","off",1,"agent-config-form__input","agent-config-form__integration-tools",3,"formControl"],[1,"agent-config-form__integrations-separator"],[1,"agent-config-form__integration-state",3,"change","id","value"],["value","default"],["value","on"],["value","off"],[1,"agent-config-form__integration-restriction"],[1,"agent-config-form__integration-builtin-desc"],[1,"agent-config-form__sub-agent-row"],["type","text","autocomplete","off",1,"agent-config-form__input","agent-config-form__sub-agent-input",3,"formControl"],["type","button","title","Remove",1,"agent-config-form__sub-agent-btn","agent-config-form__sub-agent-btn--danger",3,"click"],["type","button",1,"agent-config-form__btn","agent-config-form__btn--export",3,"click","disabled"]],template:function(e,o){e&1&&(i(0,"div",0)(1,"header",1)(2,"button",2),b("click",function(){return o.cancel()}),i(3,"span",3),a(4,"\u2190"),n(),a(5," Agent Configs "),n(),i(6,"h1",4),a(7),n(),f(8,le,2,1,"a",5),f(9,ge,2,0,"span",6),n(),f(10,ce,2,0,"p",7)(11,he,59,14,"form",8),n()),e&2&&(g(7),y(o.isEditMode()?"Edit agent config":"New agent config"),g(),p(o.isEditMode()?8:-1),g(),p(o.isPlatformMode?9:-1),g(),p(o.isLoading()?10:11))},dependencies:[ne,Q,ee,te,q,Y,J,H,X,Z,j],styles:[".agent-config-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.agent-config-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.agent-config-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.agent-config-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.agent-config-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.agent-config-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.agent-config-form__sibling-link[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-accent);text-decoration:none}.agent-config-form__sibling-link[_ngcontent-%COMP%]:hover{text-decoration:underline}.agent-config-form__platform-badge[_ngcontent-%COMP%]{display:inline-block;font-size:.75rem;font-weight:500;color:var(--color-text-secondary);background:var(--color-surface);border:1px solid var(--color-divider);border-radius:0;padding:.125rem .5rem;letter-spacing:.02em;align-self:flex-start}.agent-config-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.agent-config-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.agent-config-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.agent-config-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.agent-config-form__input[_ngcontent-%COMP%], .agent-config-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.agent-config-form__input[_ngcontent-%COMP%]:focus, .agent-config-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.agent-config-form__input[_ngcontent-%COMP%]::placeholder, .agent-config-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.agent-config-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:120px;line-height:1.5}.agent-config-form__integrations[_ngcontent-%COMP%]{border:1px solid var(--color-divider);border-radius:0;padding:1rem;margin:0;display:flex;flex-direction:column;gap:.75rem}.agent-config-form__integrations-hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__integration-row[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.agent-config-form__integration-toggle[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.agent-config-form__integration-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-accent);cursor:pointer}.agent-config-form__integration-name[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text)}.agent-config-form__integration-type[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);font-family:monospace}.agent-config-form__integration-tools[_ngcontent-%COMP%]{margin-left:1.5rem;font-size:.875rem}.agent-config-form__integrations-separator[_ngcontent-%COMP%]{margin:.25rem 0 0;padding-top:.5rem;border-top:1px solid var(--color-divider);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);font-family:var(--font-heading)}.agent-config-form__integration-state[_ngcontent-%COMP%]{margin-left:1.5rem;padding:.375rem .625rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.875rem;font-family:inherit;outline:none;transition:border-color .15s ease}.agent-config-form__integration-state[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.agent-config-form__integration-restriction[_ngcontent-%COMP%]{margin:0 0 0 1.5rem;font-size:.8rem;font-style:italic;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.agent-config-form__integration-builtin-desc[_ngcontent-%COMP%]{margin:0 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__field-hint[_ngcontent-%COMP%]{margin:.25rem 0 0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__code[_ngcontent-%COMP%]{font-family:monospace;font-size:.85em;background:var(--color-surface-muted, rgba(0, 0, 0, .06));padding:.1em .3em;border-radius:0}.agent-config-form__sub-agent-list[_ngcontent-%COMP%]{list-style:none;margin:.5rem 0 0;padding:0;display:flex;flex-direction:column;gap:.375rem}.agent-config-form__sub-agent-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem}.agent-config-form__sub-agent-input[_ngcontent-%COMP%]{flex:1;min-width:0}.agent-config-form__sub-agent-add[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;margin-top:.5rem}.agent-config-form__sub-agent-btn[_ngcontent-%COMP%]{flex-shrink:0;width:2rem;height:2rem;padding:0;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text-secondary);font-size:.9rem;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .15s ease,border-color .15s ease,color .15s ease}.agent-config-form__sub-agent-btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500);color:var(--color-text)}.agent-config-form__sub-agent-btn[_ngcontent-%COMP%]:disabled{opacity:.35;cursor:not-allowed}.agent-config-form__sub-agent-btn--add[_ngcontent-%COMP%]{width:2rem;height:2rem;font-size:1.25rem;font-weight:300;border-color:var(--color-accent);color:var(--color-accent)}.agent-config-form__sub-agent-btn--add[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent);color:#fff}.agent-config-form__sub-agent-btn--danger[_ngcontent-%COMP%]{border:1px solid transparent;color:var(--color-neutral-500)}.agent-config-form__sub-agent-btn--danger[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--red);color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent)}.agent-config-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.agent-config-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-accent);cursor:pointer}.agent-config-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text)}.agent-config-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.agent-config-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.agent-config-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.agent-config-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.agent-config-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.agent-config-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"],changeDetection:0})};export{ie as AgentConfigFormComponent};
@@ -1 +1 @@
1
- import{b as a}from"./chunk-MDHGCSE2.js";import"./chunk-DLB34U6L.js";import"./chunk-VH7ZEMCE.js";import"./chunk-COLWSJEP.js";import"./chunk-2X6HKQMK.js";import"./chunk-EGMTTOHU.js";import"./chunk-TQXOFKZO.js";import"./chunk-PUWEEZSA.js";import"./chunk-WXFL4OGQ.js";import"./chunk-ZJV25K6M.js";import"./chunk-GO5IXCK2.js";import"./chunk-3DOXTB6J.js";export{a as NamespaceListComponent};
1
+ import{b as a}from"./chunk-OLEK57CJ.js";import"./chunk-DLB34U6L.js";import"./chunk-DDBWRK3B.js";import"./chunk-COLWSJEP.js";import"./chunk-2X6HKQMK.js";import"./chunk-EGMTTOHU.js";import"./chunk-TQXOFKZO.js";import"./chunk-PUWEEZSA.js";import"./chunk-WXFL4OGQ.js";import"./chunk-ZJV25K6M.js";import"./chunk-GO5IXCK2.js";import"./chunk-3DOXTB6J.js";export{a as NamespaceListComponent};