@whoz-oss/coday-client 0.0.0-workstream-forge.137 → 0.0.0-workstream-forge.139

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 (61) hide show
  1. package/browser/chunk-5ODubWrb.js +1 -0
  2. package/browser/{chunk-D15DFuJp.js → chunk-6kWS1PKC.js} +1 -1
  3. package/browser/chunk-7EDhMjxV.js +1 -0
  4. package/browser/{chunk-CD53Nuw2.js → chunk-B2dk_vmo.js} +1 -1
  5. package/browser/{chunk-CRSD_7gp.js → chunk-B4Q_0g-_.js} +1 -1
  6. package/browser/{chunk-CVRn6LsT.js → chunk-BEMVRmeG.js} +14 -14
  7. package/browser/{chunk-CHdSOM2s.js → chunk-BGMKyXoF.js} +1 -1
  8. package/browser/chunk-BLSh2_0D.js +1 -0
  9. package/browser/{chunk-DRlgcWxt.js → chunk-BT2woRcT.js} +1 -1
  10. package/browser/{chunk-BsoSZ4zl.js → chunk-BVOcWKcm.js} +1 -1
  11. package/browser/{chunk-DiEK89Yq.js → chunk-BYL05SsW.js} +1 -1
  12. package/browser/{chunk-C7Yrdan-.js → chunk-BZREGKOc.js} +1 -1
  13. package/browser/chunk-B__5UOxD.js +1 -0
  14. package/browser/{chunk-DzQWC9V8.js → chunk-BaCpXzDJ.js} +1 -1
  15. package/browser/chunk-BeXKfCoD.js +1 -0
  16. package/browser/chunk-BgRvD3oM.js +1 -0
  17. package/browser/{chunk-DbgLwilj.js → chunk-BrXPglDw.js} +1 -1
  18. package/browser/chunk-By9FfxYH.js +1 -0
  19. package/browser/{chunk-Dey_UbSa.js → chunk-C3JOi0i0.js} +1 -1
  20. package/browser/{chunk-BSLaLrHP.js → chunk-CCPF4zpr.js} +1 -1
  21. package/browser/{chunk-8q3shX1b.js → chunk-CCPzQvRS.js} +1 -1
  22. package/browser/{chunk-C3EMiO7k.js → chunk-CD4sWYKU.js} +1 -1
  23. package/browser/{chunk-DkbGVApc.js → chunk-CVfmLw44.js} +1 -1
  24. package/browser/{chunk-CnmdacDe.js → chunk-CcsUcQox.js} +1 -1
  25. package/browser/{chunk-DRSX1o4H.js → chunk-ClQMX6bw.js} +1 -1
  26. package/browser/{chunk-BmklVgYw.js → chunk-CzFnZmcR.js} +1 -1
  27. package/browser/{chunk-CStGlj_7.js → chunk-D-8GVHj3.js} +1 -1
  28. package/browser/chunk-D0p3V78J.js +1 -0
  29. package/browser/{chunk-CAeUbD08.js → chunk-D4zMOvBN.js} +1 -1
  30. package/browser/{chunk-BnQA_0XI.js → chunk-DerJId7r.js} +1 -1
  31. package/browser/chunk-DhuTTWMZ.js +1 -0
  32. package/browser/chunk-DrDV_l0f.js +1 -0
  33. package/browser/{chunk-DnWieioK.js → chunk-FeSXFPLM.js} +1 -1
  34. package/browser/{chunk-DmC--mKJ.js → chunk-OqGh4aos.js} +1 -1
  35. package/browser/chunk-Ty1QbSFW.js +1 -0
  36. package/browser/{chunk-M0gb-4lT.js → chunk-ZTumpdaw.js} +1 -1
  37. package/browser/{chunk-v6bdClci.js → chunk-bxHREu_g.js} +1 -1
  38. package/browser/{chunk-kMZS0c2C.js → chunk-hl_Gv2mE.js} +1 -1
  39. package/browser/chunk-nk841vhl.js +1 -0
  40. package/browser/{chunk-CD40pxUE.js → chunk-oNzbGo7J.js} +1 -1
  41. package/browser/{chunk-BKnKPsdI.js → chunk-oPG6SPli.js} +1 -1
  42. package/browser/{chunk-BGXIShQV.js → chunk-rnKKv5g9.js} +1 -1
  43. package/browser/chunk-tJcOqYO8.js +1 -0
  44. package/browser/chunk-zkmCarCb.js +1 -0
  45. package/browser/index.html +1 -1
  46. package/browser/{main-C5P4R2SK.js → main-NXEJVT36.js} +1 -1
  47. package/package.json +1 -1
  48. package/browser/chunk-B39qF4aW.js +0 -1
  49. package/browser/chunk-B6De2Tkv.js +0 -1
  50. package/browser/chunk-B_jFHDB4.js +0 -1
  51. package/browser/chunk-Bcx0Dgz9.js +0 -1
  52. package/browser/chunk-BqXWBq5V.js +0 -1
  53. package/browser/chunk-C3wOg5nO.js +0 -1
  54. package/browser/chunk-CDnvjyxa.js +0 -1
  55. package/browser/chunk-CY7zyJCe.js +0 -1
  56. package/browser/chunk-CrX22E7h.js +0 -1
  57. package/browser/chunk-D5G8zkh6.js +0 -1
  58. package/browser/chunk-DWvAYrrx.js +0 -1
  59. package/browser/chunk-DqiijfEc.js +0 -1
  60. package/browser/chunk-DsV4HOCK.js +0 -1
  61. package/browser/chunk-m5ZYTEyW.js +0 -1
@@ -1 +1 @@
1
- import {m,O,U,h as vi,x as xi,P}from'./chunk-CVRn6LsT.js';import {p,c as It,M as Me,P as De,i as ie,Q as Ae,v as vf,z as za,f as dc,C as Cf,r as r_,h as hT,a as yb,t as tv,d as pT,B as yT,N as NT,D as vT,I as Iv,R as Rf,e as bT,u as uc,k as ig,m as sg}from'./main-C5P4R2SK.js';var $=(n,t)=>t.id??t.name;function z(n,t){n&1&&(za(0,"p",3),r_(1,"Loading prompts\u2026"),Cf());}function L(n,t){n&1&&(za(0,"p",4),r_(1,"No platform prompts defined yet."),Cf());}function R(n,t){if(n&1){let e=bT();za(0,"span",15),r_(1,"Delete?"),Cf(),za(2,"button",16),dc("click",function(){ig(e);let s=NT().$implicit,p=NT(2);return sg(p.confirmDelete(s))}),r_(3," Confirm "),Cf(),za(4,"button",17),dc("click",function(){ig(e);let s=NT(3);return sg(s.cancelDelete())}),r_(5,"Cancel"),Cf();}if(n&2){let e=NT().$implicit;yb(2),uc("aria-label","Confirm deletion of "+e.name);}}function j(n,t){if(n&1){let e=bT();za(0,"button",17),dc("click",function(){ig(e);let s=NT().$implicit,p=NT(2);return sg(p.edit(s))}),r_(1,"Edit"),Cf(),za(2,"button",16),dc("click",function(){ig(e);let s=NT().$implicit,p=NT(2);return sg(p.requestDelete(s))}),r_(3," Delete "),Cf();}if(n&2){let e=NT().$implicit;uc("aria-label","Edit "+e.name),yb(2),uc("aria-label","Delete "+e.name);}}function A(n,t){if(n&1&&(za(0,"tr",8)(1,"td",11),r_(2),Cf(),za(3,"td",12),r_(4),Cf(),za(5,"td",13)(6,"div",14),hT(7,R,6,1)(8,j,4,2),Cf()()()),n&2){let e=t.$implicit,l=NT(2);yb(2),Iv(e.name),yb(2),Rf(" ",e.description||"\u2014"," "),yb(3),pT(l.pendingDeleteId()===e.id?7:8);}}function B(n,t){if(n&1&&(za(0,"div",5)(1,"table",6)(2,"thead",7)(3,"tr",8)(4,"th",9),r_(5,"Name"),Cf(),za(6,"th",9),r_(7,"Description"),Cf(),za(8,"th",9)(9,"span",10),r_(10,"Actions"),Cf()()()(),za(11,"tbody",7),yT(12,A,9,3,"tr",8,$),Cf()()()),n&2){let e=NT();yb(12),vT(e.rowFilter.filteredRows());}}var N=class n{router=p(It);destroyRef=p(Me);promptState=p(m);refresh$=new De(void 0);isLoading=ie(true);pendingDeleteId=ie(null);prompts=ie([]);rowFilter=O(this.prompts,t=>[t.name,t.description].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(Ae(()=>(this.isLoading.set(true),this.promptState.listPlatform())),U(this.destroyRef)).subscribe({next:t=>{this.prompts.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","prompts","new"]);}edit(t){t.id&&this.router.navigate(["/agentos","admin","prompts",t.id,"edit"]);}requestDelete(t){this.pendingDeleteId.set(t.id??null);}cancelDelete(){this.pendingDeleteId.set(null);}confirmDelete(t){this.pendingDeleteId.set(null),this.promptState.delete(t.id??"").pipe(U(this.destroyRef)).subscribe(()=>this.refresh$.next());}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=vf({type:n,selectors:[["agentos-platform-prompts"]],decls:7,vars:2,consts:[["title","Platform prompts","description","Prompts shared across every namespace."],["label","Filter prompts","placeholder","Filter prompts\u2026",3,"queryChange","query"],["type","button",1,"settings-table__new",3,"click"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],[1,"settings-table__confirm-label"],["type","button",1,"settings-table__delete",3,"click"],["type","button",3,"click"]],template:function(e,l){e&1&&(za(0,"ds-section-header",0)(1,"agentos-table-filter",1),dc("queryChange",function(p){return l.rowFilter.query.set(p)}),Cf(),za(2,"button",2),dc("click",function(){return l.openCreateForm()}),r_(3,"New prompt"),Cf()(),hT(4,z,2,0,"p",3)(5,L,2,0,"p",4)(6,B,14,0,"div",5)),e&2&&(yb(),tv("query",l.rowFilter.query()),yb(3),pT(l.isLoading()?4:l.prompts().length===0?5:6));},dependencies:[vi,xi,P],styles:['.settings-table__new[_ngcontent-%COMP%]{padding:7px 12px;border:1px solid var(--color-accent);border-radius:0;background:var(--color-accent);color:var(--color-bg);cursor:pointer;font-family:var(--font-heading);font-size:14px;font-weight:600;white-space:nowrap}.settings-table__new[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:2px}.settings-table__toolbar[_ngcontent-%COMP%]{display:flex;align-items:center;flex-wrap:wrap;gap:12px;margin:0 0 1rem}.settings-table__toolbar[_ngcontent-%COMP%] agentos-table-filter[_ngcontent-%COMP%]{margin:0;flex:0 1 240px;min-width:80px}.settings-table__toolbar[_ngcontent-%COMP%] .settings-table__new[_ngcontent-%COMP%]{margin-left:auto}.settings-table__toolbar-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;margin-left:auto}.settings-table__toolbar-actions[_ngcontent-%COMP%] agentos-table-filter[_ngcontent-%COMP%]{flex:0 1 240px;min-width:80px}.settings-table__toolbar-actions[_ngcontent-%COMP%] .settings-table__new[_ngcontent-%COMP%]{margin-left:0;white-space:nowrap}.settings-table__status[_ngcontent-%COMP%]{margin:20px 8px;color:var(--color-text-secondary)}.settings-table__error[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:.875rem;color:var(--color-error)}.settings-table__wrap[_ngcontent-%COMP%]{overflow-x:auto}table.ds-table[_ngcontent-%COMP%]{width:100%;border-collapse:collapse;font-size:14px}table.ds-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid var(--color-divider);color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-align:left;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid color-mix(in srgb,var(--color-text) 8%,transparent)}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.settings-table__name[_ngcontent-%COMP%]{font-weight:500}.settings-table__secondary[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.settings-table__stacked[_ngcontent-%COMP%]{display:block}.settings-table__tags[_ngcontent-%COMP%]{display:flex;gap:4px;flex-wrap:wrap}.settings-table__actions[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end;gap:4px;white-space:nowrap}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:4px 7px;border:1px solid transparent;background:transparent;color:var(--color-accent);cursor:pointer;font:inherit}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-100)}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:1px}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:disabled{color:var(--color-neutral-600);cursor:default}.settings-table__actions[_ngcontent-%COMP%] .settings-table__delete[_ngcontent-%COMP%]{color:var(--color-error)}@media(max-width:760px){.settings-table__toolbar[_ngcontent-%COMP%]{flex-direction:column;align-items:stretch;gap:12px}.settings-table__toolbar-actions[_ngcontent-%COMP%]{flex-direction:column;align-items:stretch;width:100%;margin-left:0}.settings-table__toolbar-actions[_ngcontent-%COMP%] agentos-table-filter[_ngcontent-%COMP%]{flex:none;width:100%;min-width:0}.settings-table__toolbar-actions[_ngcontent-%COMP%] .settings-table__new[_ngcontent-%COMP%]{width:100%;min-height:44px}}@media(max-width:760px){table.ds-table[_ngcontent-%COMP%]{position:relative;display:block;width:100%}table.ds-table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:14px;padding-top:12px}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%], table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{display:flex;flex-direction:column;padding:12px;background:var(--color-surface);border:1px solid var(--color-divider)}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{display:grid;grid-template-columns:minmax(88px,30%) minmax(0,1fr);align-items:baseline;gap:4px 12px;padding:5px 0;border-bottom:0;overflow-wrap:anywhere;white-space:normal}table.ds-table[_ngcontent-%COMP%] td[data-label][_ngcontent-%COMP%]:before{content:attr(data-label);content:attr(data-label) / "";color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[data-title][_ngcontent-%COMP%]{display:block;margin-bottom:4px;padding:0 0 6px;border-bottom:0;font-size:15px}table.ds-table[_ngcontent-%COMP%] td[data-title][_ngcontent-%COMP%]:before{display:none}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:4px;margin-top:6px;padding:10px 0 0;border-top:1px solid var(--color-divider);text-align:right}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%]:before{display:none}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%] .settings-table__actions[_ngcontent-%COMP%]{flex-wrap:wrap;width:100%;white-space:normal}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%] button[_ngcontent-%COMP%]{min-width:44px;min-height:44px;padding:0 12px}}.settings-table__confirm-label[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:13px}.sr-only[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}']})};export{N as PlatformPromptsComponent};
1
+ import {N as N$1}from'./chunk-BVOcWKcm.js';import {p,c as It,M as Me,K as D,P as De,i as ie,Q as Ae,v as vf,z as za,f as dc,C as Cf,r as r_,h as hT,a as yb,t as tv,d as pT,N as NT,I as Iv,B as yT,D as vT,e as bT,u as uc,k as ig,m as sg}from'./main-NXEJVT36.js';import {i,O,U as U$1,h as vi,x as xi,P,M}from'./chunk-BEMVRmeG.js';import'./chunk-tJcOqYO8.js';var N=(e,t)=>t.id??t.name;function z(e,t){if(e&1&&(za(0,"p",3),r_(1),Cf()),e&2){let n=NT();yb(),Iv(n.deletion.error());}}function j(e,t){e&1&&(za(0,"p",4),r_(1,"Loading integrations\u2026"),Cf());}function A(e,t){e&1&&(za(0,"p",5),r_(1,"No platform integrations defined yet."),Cf());}function K(e,t){e&1&&(za(0,"p",4),r_(1,"No integrations match the current filter."),Cf());}function B(e,t){if(e&1){let n=bT();za(0,"button",18),dc("click",function(){ig(n);let c=NT().$implicit,d=NT(2);return sg(d.edit(c))}),r_(1,"Edit"),Cf();}if(e&2){let n=NT().$implicit;uc("aria-label","Edit "+n.name);}}function H(e,t){if(e&1){let n=bT();za(0,"agentos-row-delete-action",19),dc("request",function(){ig(n);let c=NT().$implicit,d=NT(2);return sg(d.deletion.request(c.id))})("confirm",function(){ig(n);let c=NT().$implicit,d=NT(2);return sg(d.confirmDelete(c))})("cancel",function(){ig(n);let c=NT(3);return sg(c.deletion.cancel())}),Cf();}if(e&2){let n=NT().$implicit,a=NT(2);tv("rowKey",n.id)("rowLabel",n.name)("state",a.deletion);}}function U(e,t){if(e&1&&(za(0,"tr",9)(1,"td",12),r_(2),Cf(),za(3,"td",13),r_(4),Cf(),za(5,"td",14)(6,"div",15),hT(7,B,2,1,"button",16),hT(8,H,1,3,"agentos-row-delete-action",17),Cf()()()),e&2){let n=t.$implicit,a=NT(2);yb(2),Iv(n.name),yb(2),Iv(n.integrationType),yb(3),pT(a.deletion.confirmingId()!==n.id?7:-1),yb(),pT(n.id?8:-1);}}function G(e,t){if(e&1&&(za(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),r_(5,"Name"),Cf(),za(6,"th",10),r_(7,"Type"),Cf(),za(8,"th",10)(9,"span",11),r_(10,"Actions"),Cf()()()(),za(11,"tbody",8),yT(12,U,9,4,"tr",9,N),Cf()()()),e&2){let n=NT();yb(12),vT(n.rowFilter.filteredRows());}}var V=class e{router=p(It);destroyRef=p(Me);state=p(N$1);integrationConfigController=p(D);refresh$=new De(void 0);isLoading=ie(true);deletion=i();configs=ie([]);rowFilter=O(this.configs,t=>[t.name,t.integrationType].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(Ae(()=>(this.isLoading.set(true),this.state.loadPlatformConfigs())),U$1(this.destroyRef)).subscribe({next:t=>{this.configs.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","integration-configs","new"]);}edit(t){this.router.navigate(["/agentos","admin","integration-configs",t.id??"","edit"]);}confirmDelete(t){t.id&&this.deletion.execute(t.id,{request$:this.integrationConfigController.deleteIntegrationConfig(t.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${t.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=vf({type:e,selectors:[["agentos-platform-integration-configs"]],decls:9,vars:3,consts:[["title","Platform integrations","description","Integration configurations shared across every namespace."],["label","Filter integrations","placeholder","Filter integrations\u2026",3,"queryChange","query"],["type","button",1,"settings-table__new",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform integrations"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Type",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"request","confirm","cancel","rowKey","rowLabel","state"]],template:function(n,a){n&1&&(za(0,"ds-section-header",0)(1,"agentos-table-filter",1),dc("queryChange",function(d){return a.rowFilter.query.set(d)}),Cf(),za(2,"button",2),dc("click",function(){return a.openCreateForm()}),r_(3,"New integration"),Cf()(),hT(4,z,2,1,"p",3),hT(5,j,2,0,"p",4)(6,A,2,0,"p",5)(7,K,2,0,"p",4)(8,G,14,0,"div",6)),n&2&&(yb(),tv("query",a.rowFilter.query()),yb(3),pT(a.deletion.error()?4:-1),yb(),pT(a.isLoading()?5:a.configs().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[vi,xi,P,M],styles:['.settings-table__new[_ngcontent-%COMP%]{padding:7px 12px;border:1px solid var(--color-accent);border-radius:0;background:var(--color-accent);color:var(--color-bg);cursor:pointer;font-family:var(--font-heading);font-size:14px;font-weight:600;white-space:nowrap}.settings-table__new[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:2px}.settings-table__toolbar[_ngcontent-%COMP%]{display:flex;align-items:center;flex-wrap:wrap;gap:12px;margin:0 0 1rem}.settings-table__toolbar[_ngcontent-%COMP%] agentos-table-filter[_ngcontent-%COMP%]{margin:0;flex:0 1 240px;min-width:80px}.settings-table__toolbar[_ngcontent-%COMP%] .settings-table__new[_ngcontent-%COMP%]{margin-left:auto}.settings-table__toolbar-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;margin-left:auto}.settings-table__toolbar-actions[_ngcontent-%COMP%] agentos-table-filter[_ngcontent-%COMP%]{flex:0 1 240px;min-width:80px}.settings-table__toolbar-actions[_ngcontent-%COMP%] .settings-table__new[_ngcontent-%COMP%]{margin-left:0;white-space:nowrap}.settings-table__status[_ngcontent-%COMP%]{margin:20px 8px;color:var(--color-text-secondary)}.settings-table__error[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:.875rem;color:var(--color-error)}.settings-table__wrap[_ngcontent-%COMP%]{overflow-x:auto}table.ds-table[_ngcontent-%COMP%]{width:100%;border-collapse:collapse;font-size:14px}table.ds-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid var(--color-divider);color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-align:left;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid color-mix(in srgb,var(--color-text) 8%,transparent)}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.settings-table__name[_ngcontent-%COMP%]{font-weight:500}.settings-table__secondary[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.settings-table__stacked[_ngcontent-%COMP%]{display:block}.settings-table__tags[_ngcontent-%COMP%]{display:flex;gap:4px;flex-wrap:wrap}.settings-table__actions[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end;gap:4px;white-space:nowrap}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:4px 7px;border:1px solid transparent;background:transparent;color:var(--color-accent);cursor:pointer;font:inherit}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-100)}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:1px}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:disabled{color:var(--color-neutral-600);cursor:default}.settings-table__actions[_ngcontent-%COMP%] .settings-table__delete[_ngcontent-%COMP%]{color:var(--color-error)}@media(max-width:760px){.settings-table__toolbar[_ngcontent-%COMP%]{flex-direction:column;align-items:stretch;gap:12px}.settings-table__toolbar-actions[_ngcontent-%COMP%]{flex-direction:column;align-items:stretch;width:100%;margin-left:0}.settings-table__toolbar-actions[_ngcontent-%COMP%] agentos-table-filter[_ngcontent-%COMP%]{flex:none;width:100%;min-width:0}.settings-table__toolbar-actions[_ngcontent-%COMP%] .settings-table__new[_ngcontent-%COMP%]{width:100%;min-height:44px}}@media(max-width:760px){table.ds-table[_ngcontent-%COMP%]{position:relative;display:block;width:100%}table.ds-table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:14px;padding-top:12px}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%], table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{display:flex;flex-direction:column;padding:12px;background:var(--color-surface);border:1px solid var(--color-divider)}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{display:grid;grid-template-columns:minmax(88px,30%) minmax(0,1fr);align-items:baseline;gap:4px 12px;padding:5px 0;border-bottom:0;overflow-wrap:anywhere;white-space:normal}table.ds-table[_ngcontent-%COMP%] td[data-label][_ngcontent-%COMP%]:before{content:attr(data-label);content:attr(data-label) / "";color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[data-title][_ngcontent-%COMP%]{display:block;margin-bottom:4px;padding:0 0 6px;border-bottom:0;font-size:15px}table.ds-table[_ngcontent-%COMP%] td[data-title][_ngcontent-%COMP%]:before{display:none}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:4px;margin-top:6px;padding:10px 0 0;border-top:1px solid var(--color-divider);text-align:right}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%]:before{display:none}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%] .settings-table__actions[_ngcontent-%COMP%]{flex-wrap:wrap;width:100%;white-space:normal}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%] button[_ngcontent-%COMP%]{min-width:44px;min-height:44px;padding:0 12px}}.settings-table__confirm-label[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:13px}.sr-only[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}']})};export{V as PlatformIntegrationConfigsComponent};
@@ -1 +1 @@
1
- import {c}from'./chunk-BSLaLrHP.js';import {$ as $$1,v as vt,a as ve$1,F,U,K as Kn,z as zn,Z as Zn,X as Xn,Y as Ye,d as dn,e as Ft,c as bt,L as Ln,W as Wn$1,q as qt,b as pn,V as Vn}from'./chunk-CVRn6LsT.js';import {p,$ as $t,c as It,M as Me$1,T as $,U as Oe$1,V as Ee$1,i as ie,X as Ve$1,Y as Os,E as Mi,Z as pw,a0 as Wn,_,x,w,v as vf,z as za,f as dc,r as r_,C as Cf,h as hT,a as yb,R as Rf,d as pT,e as bT,l as lc,s as sS,B as yT,N as NT,t as tv,q as gv,g as cS,D as vT,I as Iv,k as ig,m as sg,a1 as Xm}from'./main-C5P4R2SK.js';var A=(n,t)=>t.value,me=(n,t)=>t.id;function pe(n,t){n&1&&(za(0,"p",5),r_(1,"Loading\u2026"),Cf());}function ue(n,t){n&1&&(za(0,"span",12),r_(1," Name is required. "),Cf());}function fe(n,t){if(n&1&&(za(0,"p",42),r_(1),Cf(),za(2,"span",13),r_(3,"Agent Config cannot be changed after creation."),Cf()),n&2){let e=NT(2);yb(),Iv(e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function _e(n,t){if(n&1&&(za(0,"a",43),r_(1,"Add an agent config"),Cf(),r_(2," first. ")),n&2){let e=NT(3);tv("href","/agentos/"+e.namespaceId+"/agent-configs/new",Xm);}}function he(n,t){if(n&1&&(za(0,"p",13),r_(1," No agent configs available in this scope yet. "),hT(2,_e,3,1),Cf()),n&2){let e=NT(2);yb(2),pT(e.isPlatformMode?-1:2);}}function ge(n,t){if(n&1&&(za(0,"option",23),r_(1),Cf()),n&2){let e=t.$implicit;tv("value",e.id),yb(),Iv(e.name);}}function Ce(n,t){n&1&&(za(0,"span",12),r_(1,"Agent Config is required."),Cf());}function ve(n,t){if(n&1&&(za(0,"select",44)(1,"option",45),r_(2,"Select an agent config\u2026"),Cf(),yT(3,ge,2,2,"option",23,me),Cf(),sS(),hT(5,Ce,2,0,"span",12),za(6,"span",13),r_(7,"Immutable after creation."),Cf()),n&2){let e=NT(2);tv("formControl",e.agentConfigIdControl),cS(),yb(3),vT(e.availableAgentConfigs()),yb(2),pT(e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?5:-1);}}function xe(n,t){n&1&&(za(0,"span",12),r_(1,"Opening message is required."),Cf());}function ye(n,t){if(n&1&&(za(0,"option",23),r_(1),Cf()),n&2){let e=t.$implicit;tv("value",e.value),yb(),Iv(e.label);}}function be(n,t){if(n&1){let e=bT();za(0,"label",48)(1,"input",49),dc("change",function(){let g=ig(e).$implicit,v=NT(3);return sg(v.toggleDay(g.value))}),Cf(),za(2,"span",50),r_(3),Cf()();}if(n&2){let e=t.$implicit,d=NT(3);yb(),tv("checked",d.isDaySelected(e.value)),yb(2),Iv(e.label);}}function Se(n,t){if(n&1&&(za(0,"div",8)(1,"span",46),r_(2,"Days of week"),Cf(),za(3,"div",47),yT(4,be,4,2,"label",48,A),Cf(),za(6,"span",13),r_(7,"Leave empty to run every day of the week."),Cf()()),n&2){let e=NT(2);yb(4),vT(e.dayOptions);}}function Ee(n,t){n&1&&(za(0,"span",12),r_(1,"Valid time is required (HH:mm)."),Cf());}function Pe(n,t){n&1&&(za(0,"span",12),r_(1,"Start date is required."),Cf());}function Me(n,t){if(n&1&&(za(0,"option",23),r_(1),Cf()),n&2){let e=t.$implicit;tv("value",e.value),yb(),Iv(e.label);}}function Oe(n,t){n&1&&(za(0,"span",12),r_(1,"End date is required."),Cf());}function De(n,t){if(n&1&&(za(0,"div",8)(1,"label",51),r_(2," End date "),za(3,"span",10),r_(4,"*"),Cf()(),lc(5,"input",52),sS(),hT(6,Oe,2,0,"span",12),Cf()),n&2){let e=NT(2);yb(5),gv("scheduled-prompt-form__input--invalid",e.form.hasError("endDateRequired")&&e.endDateControl.touched),tv("formControl",e.endDateControl),cS(),yb(),pT(e.form.hasError("endDateRequired")&&e.endDateControl.touched?6:-1);}}function Te(n,t){n&1&&(za(0,"span",12),r_(1,"Must be at least 1."),Cf());}function we(n,t){if(n&1&&(za(0,"div",8)(1,"label",53),r_(2," Number of occurrences "),za(3,"span",10),r_(4,"*"),Cf()(),lc(5,"input",54),sS(),hT(6,Te,2,0,"span",12),Cf()),n&2){let e=NT(2);yb(5),gv("scheduled-prompt-form__input--invalid",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched),tv("formControl",e.occurrenceCountControl),cS(),yb(),pT(e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?6:-1);}}function ke(n,t){n&1&&(za(0,"span",12),r_(1,"Invalid JSON."),Cf());}function Ne(n,t){if(n&1&&(za(0,"p",38),r_(1),Cf()),n&2){let e=NT(2);yb(),Iv(e.errorMessage());}}function Fe(n,t){if(n&1){let e=bT();za(0,"form",7),dc("ngSubmit",function(){ig(e);let g=NT();return sg(g.submit())}),za(1,"div",8)(2,"label",9),r_(3," Name "),za(4,"span",10),r_(5,"*"),Cf()(),lc(6,"input",11),sS(),hT(7,ue,2,0,"span",12),za(8,"span",13),r_(9,'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.'),Cf()(),za(10,"div",8)(11,"label",14),r_(12,"Description"),Cf(),lc(13,"input",15),sS(),Cf(),za(14,"div",8)(15,"label",16),r_(16," Agent Config "),za(17,"span",10),r_(18,"*"),Cf()(),hT(19,fe,4,1)(20,he,3,1,"p",13)(21,ve,8,2),Cf(),za(22,"div",8)(23,"label",17),r_(24," Opening message "),za(25,"span",10),r_(26,"*"),Cf()(),lc(27,"textarea",18),sS(),hT(28,xe,2,0,"span",12),za(29,"span",13),r_(30," The message sent to the agent when the scheduled prompt fires. "),Cf()(),za(31,"fieldset",19)(32,"legend",20),r_(33,"Recurrence"),Cf(),za(34,"div",8)(35,"label",21),r_(36," Unit "),za(37,"span",10),r_(38,"*"),Cf()(),za(39,"select",22),yT(40,ye,2,2,"option",23,A),Cf(),sS(),Cf(),hT(42,Se,8,0,"div",8),za(43,"div",8)(44,"label",24),r_(45," Time (UTC) "),za(46,"span",10),r_(47,"*"),Cf()(),za(48,"div",25),lc(49,"input",26),sS(),za(50,"span",27),r_(51,"UTC"),Cf()(),hT(52,Ee,2,0,"span",12),Cf()(),za(53,"fieldset",19)(54,"legend",20),r_(55,"Planning"),Cf(),za(56,"div",8)(57,"label",28),r_(58," Start date "),za(59,"span",10),r_(60,"*"),Cf()(),lc(61,"input",29),sS(),hT(62,Pe,2,0,"span",12),Cf(),za(63,"div",8)(64,"label",30),r_(65," Ends "),za(66,"span",10),r_(67,"*"),Cf()(),za(68,"select",31),yT(69,Me,2,2,"option",23,A),Cf(),sS(),Cf(),hT(71,De,7,4,"div",8),hT(72,we,7,4,"div",8),Cf(),za(73,"div",8)(74,"label",32),lc(75,"input",33),sS(),za(76,"span",34),r_(77,"Enabled"),Cf()(),za(78,"p",35),r_(79," When disabled, the scheduled prompt is saved but will not run on schedule. "),Cf()(),za(80,"div",8)(81,"label",36),r_(82,"External Metadata"),Cf(),lc(83,"textarea",37),sS(),hT(84,ke,2,0,"span",12),za(85,"span",13),r_(86,"Optional. Opaque JSON object stored as-is. Leave empty to clear."),Cf()(),hT(87,Ne,2,1,"p",38),za(88,"div",39)(89,"button",40),r_(90),Cf(),za(91,"button",41),dc("click",function(){ig(e);let g=NT();return sg(g.cancel())}),r_(92,"Cancel"),Cf()()();}if(n&2){let e=NT();tv("formGroup",e.form),yb(6),gv("scheduled-prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),tv("formControl",e.nameControl),cS(),yb(),pT(e.nameControl.invalid&&e.nameControl.touched?7:-1),yb(6),tv("formControl",e.descriptionControl),cS(),yb(6),pT(e.isEditMode()?19:e.availableAgentConfigs().length===0?20:21),yb(8),gv("scheduled-prompt-form__textarea--invalid",e.promptContentControl.invalid&&e.promptContentControl.touched),tv("formControl",e.promptContentControl),cS(),yb(),pT(e.promptContentControl.invalid&&e.promptContentControl.touched?28:-1),yb(11),tv("formControl",e.unitControl),cS(),yb(),vT(e.schedulerUnits),yb(2),pT(e.showDayFilter()?42:-1),yb(7),tv("formControl",e.timeUtcControl),cS(),yb(3),pT(e.timeUtcControl.invalid&&e.timeUtcControl.touched?52:-1),yb(9),gv("scheduled-prompt-form__input--invalid",e.startDateControl.invalid&&e.startDateControl.touched),tv("formControl",e.startDateControl),cS(),yb(),pT(e.startDateControl.invalid&&e.startDateControl.touched?62:-1),yb(6),tv("formControl",e.endTypeControl),cS(),yb(),vT(e.endTypes),yb(2),pT(e.showEndDate()?71:-1),yb(),pT(e.showOccurrenceCount()?72:-1),yb(3),tv("formControl",e.enabledControl),cS(),yb(8),tv("formControl",e.externalMetadataJsonControl),cS(),yb(),pT(e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?84:-1),yb(3),pT(e.errorMessage()?87:-1),yb(2),tv("disabled",e.form.invalid||e.isSubmitting()),yb(),Rf(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var se=class n{route=p($t);router=p(It);destroyRef=p(Me$1);state=p(c);agentConfigController=p($);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new $$1({name:new vt("",{nonNullable:true,validators:[ve$1.required]}),description:new vt(null),agentConfigId:new vt("",{nonNullable:true,validators:[ve$1.required]}),promptContent:new vt("",{nonNullable:true,validators:[ve$1.required]}),unit:new vt(Ee$1.WEEK,{nonNullable:true,validators:[ve$1.required]}),days:new vt([],{nonNullable:true}),timeUtc:new vt("09:00",{nonNullable:true,validators:[ve$1.required,ve$1.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new vt("",{nonNullable:true,validators:[ve$1.required]}),endType:new vt(Oe$1.NEVER,{nonNullable:true,validators:[ve$1.required]}),endDate:new vt(null),occurrenceCount:new vt(null),enabled:new vt(true,{nonNullable:true}),externalMetadataJson:new vt("",{nonNullable:true,validators:[Ae]})},{validators:[Ie,Ve]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}isEditMode=ie(false);isSubmitting=ie(false);isLoading=ie(false);errorMessage=ie(null);SchedulerUnit=Ee$1;SchedulerEndType=Oe$1;schedulerUnits=[{value:Ee$1.WEEK,label:"Week(s)"},{value:Ee$1.MONTH,label:"Month(s)"}];endTypes=[{value:Oe$1.NEVER,label:"Never"},{value:Oe$1.ON_DATE,label:"On date"},{value:Oe$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(Ve$1).map(([t,e])=>({value:t,label:e}));unitSignal=F(this.unitControl.valueChanges.pipe(Os(this.unitControl.value)));endTypeSignal=F(this.endTypeControl.valueChanges.pipe(Os(this.endTypeControl.value)));showDayFilter=Mi(()=>this.unitSignal()===Ee$1.WEEK);showEndDate=Mi(()=>this.endTypeSignal()===Oe$1.ON_DATE);showOccurrenceCount=Mi(()=>this.endTypeSignal()===Oe$1.OCCURRENCES);agentConfigs=ie([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Re());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),pw({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:d})=>{this.existingPrompt=e,this.agentConfigs.set(d),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(Wn(()=>_([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,d=e.includes(t)?e.filter(g=>g!==t):[...e,t];this.daysControl.setValue(d);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,d=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===Oe$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===Oe$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let v=this.externalMetadataJsonControl.value.trim();return v?JSON.parse(v):null})()});(t?this.state.update(this.existingPrompt.id,d):this.state.create(d)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:v=>{this.isSubmitting.set(false),v.status===409?this.errorMessage.set(`A scheduled prompt named "${d.name}" already exists in this scope.`):v.status===400?this.errorMessage.set(v.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=vf({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:10,vars:3,consts:[[1,"scheduled-prompt-form"],[1,"scheduled-prompt-form__header"],["type","button","title","Back to scheduled prompts",1,"scheduled-prompt-form__back",3,"click"],[1,"scheduled-prompt-form__back-icon"],[1,"scheduled-prompt-form__title"],[1,"scheduled-prompt-form__loading"],[1,"scheduled-prompt-form__form",3,"formGroup"],[1,"scheduled-prompt-form__form",3,"ngSubmit","formGroup"],[1,"scheduled-prompt-form__field"],["for","sp-name",1,"scheduled-prompt-form__label"],["aria-hidden","true"],["id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],[1,"scheduled-prompt-form__field-error"],[1,"scheduled-prompt-form__field-hint"],["for","sp-description",1,"scheduled-prompt-form__label"],["id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-agent-config",1,"scheduled-prompt-form__label"],["for","sp-prompt-content",1,"scheduled-prompt-form__label"],["id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",1,"scheduled-prompt-form__textarea",3,"formControl"],[1,"scheduled-prompt-form__fieldset"],[1,"scheduled-prompt-form__legend"],["for","sp-unit",1,"scheduled-prompt-form__label"],["id","sp-unit",1,"scheduled-prompt-form__select",3,"formControl"],[3,"value"],["for","sp-time",1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__time-wrapper"],["id","sp-time","type","time",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--time",3,"formControl"],[1,"scheduled-prompt-form__utc-badge"],["for","sp-start-date",1,"scheduled-prompt-form__label"],["id","sp-start-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-end-type",1,"scheduled-prompt-form__label"],["id","sp-end-type",1,"scheduled-prompt-form__select",3,"formControl"],[1,"scheduled-prompt-form__toggle-label"],["type","checkbox",1,"scheduled-prompt-form__toggle-checkbox",3,"formControl"],[1,"scheduled-prompt-form__toggle-text"],[1,"scheduled-prompt-form__toggle-hint"],["for","sp-external-metadata",1,"scheduled-prompt-form__label"],["id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",1,"scheduled-prompt-form__textarea","scheduled-prompt-form__textarea--code",3,"formControl"],[1,"scheduled-prompt-form__error"],[1,"scheduled-prompt-form__actions"],["type","submit",1,"scheduled-prompt-form__btn","scheduled-prompt-form__btn--primary",3,"disabled"],["type","button",1,"scheduled-prompt-form__btn",3,"click"],[1,"scheduled-prompt-form__readonly-value"],[3,"href"],["id","sp-agent-config",1,"scheduled-prompt-form__select",3,"formControl"],["value","","disabled",""],[1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__day-grid"],[1,"scheduled-prompt-form__day-label"],["type","checkbox",1,"scheduled-prompt-form__day-checkbox",3,"change","checked"],[1,"scheduled-prompt-form__day-text"],["for","sp-end-date",1,"scheduled-prompt-form__label"],["id","sp-end-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-occurrence-count",1,"scheduled-prompt-form__label"],["id","sp-occurrence-count","type","number","min","1",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--number",3,"formControl"]],template:function(e,d){e&1&&(za(0,"div",0)(1,"header",1)(2,"button",2),dc("click",function(){return d.cancel()}),za(3,"span",3),r_(4,"\u2190"),Cf(),r_(5),Cf(),za(6,"h1",4),r_(7),Cf()(),hT(8,pe,2,0,"p",5)(9,Fe,93,28,"form",6),Cf()),e&2&&(yb(5),Rf(" ",d.isPlatformMode?"Platform Scheduled Prompts":"Scheduled Prompts"," "),yb(2),Rf(" ",d.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"," "),yb(),pT(d.isLoading()?8:9));},dependencies:[Kn,zn,Zn,Xn,Ye,dn,Ft,bt,Ln,Wn$1,qt,pn,Vn],styles:[".scheduled-prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.scheduled-prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.scheduled-prompt-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.scheduled-prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.scheduled-prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.scheduled-prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.scheduled-prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.scheduled-prompt-form__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.scheduled-prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__input[_ngcontent-%COMP%], .scheduled-prompt-form__select[_ngcontent-%COMP%], .scheduled-prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.scheduled-prompt-form__input[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__select[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.scheduled-prompt-form__input[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__select[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__select[_ngcontent-%COMP%]{cursor:pointer;appearance:auto}.scheduled-prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.scheduled-prompt-form__input--time[_ngcontent-%COMP%]{flex:1;min-width:0}.scheduled-prompt-form__input--number[_ngcontent-%COMP%]{max-width:120px}.scheduled-prompt-form__time-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.scheduled-prompt-form__utc-badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.75rem;font-weight:600;font-family:monospace;color:var(--color-text-secondary, #6e6e73);background:var(--color-surface, rgba(0, 0, 0, .05));padding:.25rem .5rem;border-radius:4px;text-transform:uppercase;letter-spacing:.06em}.scheduled-prompt-form__fieldset[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:8px;padding:1rem 1.25rem 1.25rem;margin:0;display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__legend[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--color-text-secondary, #6e6e73);padding:0 .375rem}.scheduled-prompt-form__day-grid[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem}.scheduled-prompt-form__day-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__day-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__day-text[_ngcontent-%COMP%]{font-size:.875rem;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30);margin:0}.scheduled-prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30)}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--color-surface, rgba(0, 0, 0, .03))}.scheduled-prompt-form__input--invalid[_ngcontent-%COMP%], .scheduled-prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.scheduled-prompt-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.scheduled-prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"]})};function Ie(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===Oe$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===Oe$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function Ae(n){let t=n.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}function Re(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),d=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${d}`}export{se as ScheduledPromptFormComponent};
1
+ import {c}from'./chunk-CCPF4zpr.js';import {$ as $$1,v as vt,a as ve$1,F,U,K as Kn,z as zn,Z as Zn,X as Xn,Y as Ye,d as dn,e as Ft,c as bt,L as Ln,W as Wn$1,q as qt,b as pn,V as Vn}from'./chunk-BEMVRmeG.js';import {p,$ as $t,c as It,M as Me$1,T as $,U as Oe$1,V as Ee$1,i as ie,X as Ve$1,Y as Os,E as Mi,Z as pw,a0 as Wn,_,x,w,v as vf,z as za,f as dc,r as r_,C as Cf,h as hT,a as yb,R as Rf,d as pT,e as bT,l as lc,s as sS,B as yT,N as NT,t as tv,q as gv,g as cS,D as vT,I as Iv,k as ig,m as sg,a1 as Xm}from'./main-NXEJVT36.js';var A=(n,t)=>t.value,me=(n,t)=>t.id;function pe(n,t){n&1&&(za(0,"p",5),r_(1,"Loading\u2026"),Cf());}function ue(n,t){n&1&&(za(0,"span",12),r_(1," Name is required. "),Cf());}function fe(n,t){if(n&1&&(za(0,"p",42),r_(1),Cf(),za(2,"span",13),r_(3,"Agent Config cannot be changed after creation."),Cf()),n&2){let e=NT(2);yb(),Iv(e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function _e(n,t){if(n&1&&(za(0,"a",43),r_(1,"Add an agent config"),Cf(),r_(2," first. ")),n&2){let e=NT(3);tv("href","/agentos/"+e.namespaceId+"/agent-configs/new",Xm);}}function he(n,t){if(n&1&&(za(0,"p",13),r_(1," No agent configs available in this scope yet. "),hT(2,_e,3,1),Cf()),n&2){let e=NT(2);yb(2),pT(e.isPlatformMode?-1:2);}}function ge(n,t){if(n&1&&(za(0,"option",23),r_(1),Cf()),n&2){let e=t.$implicit;tv("value",e.id),yb(),Iv(e.name);}}function Ce(n,t){n&1&&(za(0,"span",12),r_(1,"Agent Config is required."),Cf());}function ve(n,t){if(n&1&&(za(0,"select",44)(1,"option",45),r_(2,"Select an agent config\u2026"),Cf(),yT(3,ge,2,2,"option",23,me),Cf(),sS(),hT(5,Ce,2,0,"span",12),za(6,"span",13),r_(7,"Immutable after creation."),Cf()),n&2){let e=NT(2);tv("formControl",e.agentConfigIdControl),cS(),yb(3),vT(e.availableAgentConfigs()),yb(2),pT(e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?5:-1);}}function xe(n,t){n&1&&(za(0,"span",12),r_(1,"Opening message is required."),Cf());}function ye(n,t){if(n&1&&(za(0,"option",23),r_(1),Cf()),n&2){let e=t.$implicit;tv("value",e.value),yb(),Iv(e.label);}}function be(n,t){if(n&1){let e=bT();za(0,"label",48)(1,"input",49),dc("change",function(){let g=ig(e).$implicit,v=NT(3);return sg(v.toggleDay(g.value))}),Cf(),za(2,"span",50),r_(3),Cf()();}if(n&2){let e=t.$implicit,d=NT(3);yb(),tv("checked",d.isDaySelected(e.value)),yb(2),Iv(e.label);}}function Se(n,t){if(n&1&&(za(0,"div",8)(1,"span",46),r_(2,"Days of week"),Cf(),za(3,"div",47),yT(4,be,4,2,"label",48,A),Cf(),za(6,"span",13),r_(7,"Leave empty to run every day of the week."),Cf()()),n&2){let e=NT(2);yb(4),vT(e.dayOptions);}}function Ee(n,t){n&1&&(za(0,"span",12),r_(1,"Valid time is required (HH:mm)."),Cf());}function Pe(n,t){n&1&&(za(0,"span",12),r_(1,"Start date is required."),Cf());}function Me(n,t){if(n&1&&(za(0,"option",23),r_(1),Cf()),n&2){let e=t.$implicit;tv("value",e.value),yb(),Iv(e.label);}}function Oe(n,t){n&1&&(za(0,"span",12),r_(1,"End date is required."),Cf());}function De(n,t){if(n&1&&(za(0,"div",8)(1,"label",51),r_(2," End date "),za(3,"span",10),r_(4,"*"),Cf()(),lc(5,"input",52),sS(),hT(6,Oe,2,0,"span",12),Cf()),n&2){let e=NT(2);yb(5),gv("scheduled-prompt-form__input--invalid",e.form.hasError("endDateRequired")&&e.endDateControl.touched),tv("formControl",e.endDateControl),cS(),yb(),pT(e.form.hasError("endDateRequired")&&e.endDateControl.touched?6:-1);}}function Te(n,t){n&1&&(za(0,"span",12),r_(1,"Must be at least 1."),Cf());}function we(n,t){if(n&1&&(za(0,"div",8)(1,"label",53),r_(2," Number of occurrences "),za(3,"span",10),r_(4,"*"),Cf()(),lc(5,"input",54),sS(),hT(6,Te,2,0,"span",12),Cf()),n&2){let e=NT(2);yb(5),gv("scheduled-prompt-form__input--invalid",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched),tv("formControl",e.occurrenceCountControl),cS(),yb(),pT(e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?6:-1);}}function ke(n,t){n&1&&(za(0,"span",12),r_(1,"Invalid JSON."),Cf());}function Ne(n,t){if(n&1&&(za(0,"p",38),r_(1),Cf()),n&2){let e=NT(2);yb(),Iv(e.errorMessage());}}function Fe(n,t){if(n&1){let e=bT();za(0,"form",7),dc("ngSubmit",function(){ig(e);let g=NT();return sg(g.submit())}),za(1,"div",8)(2,"label",9),r_(3," Name "),za(4,"span",10),r_(5,"*"),Cf()(),lc(6,"input",11),sS(),hT(7,ue,2,0,"span",12),za(8,"span",13),r_(9,'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.'),Cf()(),za(10,"div",8)(11,"label",14),r_(12,"Description"),Cf(),lc(13,"input",15),sS(),Cf(),za(14,"div",8)(15,"label",16),r_(16," Agent Config "),za(17,"span",10),r_(18,"*"),Cf()(),hT(19,fe,4,1)(20,he,3,1,"p",13)(21,ve,8,2),Cf(),za(22,"div",8)(23,"label",17),r_(24," Opening message "),za(25,"span",10),r_(26,"*"),Cf()(),lc(27,"textarea",18),sS(),hT(28,xe,2,0,"span",12),za(29,"span",13),r_(30," The message sent to the agent when the scheduled prompt fires. "),Cf()(),za(31,"fieldset",19)(32,"legend",20),r_(33,"Recurrence"),Cf(),za(34,"div",8)(35,"label",21),r_(36," Unit "),za(37,"span",10),r_(38,"*"),Cf()(),za(39,"select",22),yT(40,ye,2,2,"option",23,A),Cf(),sS(),Cf(),hT(42,Se,8,0,"div",8),za(43,"div",8)(44,"label",24),r_(45," Time (UTC) "),za(46,"span",10),r_(47,"*"),Cf()(),za(48,"div",25),lc(49,"input",26),sS(),za(50,"span",27),r_(51,"UTC"),Cf()(),hT(52,Ee,2,0,"span",12),Cf()(),za(53,"fieldset",19)(54,"legend",20),r_(55,"Planning"),Cf(),za(56,"div",8)(57,"label",28),r_(58," Start date "),za(59,"span",10),r_(60,"*"),Cf()(),lc(61,"input",29),sS(),hT(62,Pe,2,0,"span",12),Cf(),za(63,"div",8)(64,"label",30),r_(65," Ends "),za(66,"span",10),r_(67,"*"),Cf()(),za(68,"select",31),yT(69,Me,2,2,"option",23,A),Cf(),sS(),Cf(),hT(71,De,7,4,"div",8),hT(72,we,7,4,"div",8),Cf(),za(73,"div",8)(74,"label",32),lc(75,"input",33),sS(),za(76,"span",34),r_(77,"Enabled"),Cf()(),za(78,"p",35),r_(79," When disabled, the scheduled prompt is saved but will not run on schedule. "),Cf()(),za(80,"div",8)(81,"label",36),r_(82,"External Metadata"),Cf(),lc(83,"textarea",37),sS(),hT(84,ke,2,0,"span",12),za(85,"span",13),r_(86,"Optional. Opaque JSON object stored as-is. Leave empty to clear."),Cf()(),hT(87,Ne,2,1,"p",38),za(88,"div",39)(89,"button",40),r_(90),Cf(),za(91,"button",41),dc("click",function(){ig(e);let g=NT();return sg(g.cancel())}),r_(92,"Cancel"),Cf()()();}if(n&2){let e=NT();tv("formGroup",e.form),yb(6),gv("scheduled-prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),tv("formControl",e.nameControl),cS(),yb(),pT(e.nameControl.invalid&&e.nameControl.touched?7:-1),yb(6),tv("formControl",e.descriptionControl),cS(),yb(6),pT(e.isEditMode()?19:e.availableAgentConfigs().length===0?20:21),yb(8),gv("scheduled-prompt-form__textarea--invalid",e.promptContentControl.invalid&&e.promptContentControl.touched),tv("formControl",e.promptContentControl),cS(),yb(),pT(e.promptContentControl.invalid&&e.promptContentControl.touched?28:-1),yb(11),tv("formControl",e.unitControl),cS(),yb(),vT(e.schedulerUnits),yb(2),pT(e.showDayFilter()?42:-1),yb(7),tv("formControl",e.timeUtcControl),cS(),yb(3),pT(e.timeUtcControl.invalid&&e.timeUtcControl.touched?52:-1),yb(9),gv("scheduled-prompt-form__input--invalid",e.startDateControl.invalid&&e.startDateControl.touched),tv("formControl",e.startDateControl),cS(),yb(),pT(e.startDateControl.invalid&&e.startDateControl.touched?62:-1),yb(6),tv("formControl",e.endTypeControl),cS(),yb(),vT(e.endTypes),yb(2),pT(e.showEndDate()?71:-1),yb(),pT(e.showOccurrenceCount()?72:-1),yb(3),tv("formControl",e.enabledControl),cS(),yb(8),tv("formControl",e.externalMetadataJsonControl),cS(),yb(),pT(e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?84:-1),yb(3),pT(e.errorMessage()?87:-1),yb(2),tv("disabled",e.form.invalid||e.isSubmitting()),yb(),Rf(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var se=class n{route=p($t);router=p(It);destroyRef=p(Me$1);state=p(c);agentConfigController=p($);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new $$1({name:new vt("",{nonNullable:true,validators:[ve$1.required]}),description:new vt(null),agentConfigId:new vt("",{nonNullable:true,validators:[ve$1.required]}),promptContent:new vt("",{nonNullable:true,validators:[ve$1.required]}),unit:new vt(Ee$1.WEEK,{nonNullable:true,validators:[ve$1.required]}),days:new vt([],{nonNullable:true}),timeUtc:new vt("09:00",{nonNullable:true,validators:[ve$1.required,ve$1.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new vt("",{nonNullable:true,validators:[ve$1.required]}),endType:new vt(Oe$1.NEVER,{nonNullable:true,validators:[ve$1.required]}),endDate:new vt(null),occurrenceCount:new vt(null),enabled:new vt(true,{nonNullable:true}),externalMetadataJson:new vt("",{nonNullable:true,validators:[Ae]})},{validators:[Ie,Ve]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}isEditMode=ie(false);isSubmitting=ie(false);isLoading=ie(false);errorMessage=ie(null);SchedulerUnit=Ee$1;SchedulerEndType=Oe$1;schedulerUnits=[{value:Ee$1.WEEK,label:"Week(s)"},{value:Ee$1.MONTH,label:"Month(s)"}];endTypes=[{value:Oe$1.NEVER,label:"Never"},{value:Oe$1.ON_DATE,label:"On date"},{value:Oe$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(Ve$1).map(([t,e])=>({value:t,label:e}));unitSignal=F(this.unitControl.valueChanges.pipe(Os(this.unitControl.value)));endTypeSignal=F(this.endTypeControl.valueChanges.pipe(Os(this.endTypeControl.value)));showDayFilter=Mi(()=>this.unitSignal()===Ee$1.WEEK);showEndDate=Mi(()=>this.endTypeSignal()===Oe$1.ON_DATE);showOccurrenceCount=Mi(()=>this.endTypeSignal()===Oe$1.OCCURRENCES);agentConfigs=ie([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Re());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),pw({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:d})=>{this.existingPrompt=e,this.agentConfigs.set(d),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(Wn(()=>_([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,d=e.includes(t)?e.filter(g=>g!==t):[...e,t];this.daysControl.setValue(d);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,d=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===Oe$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===Oe$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let v=this.externalMetadataJsonControl.value.trim();return v?JSON.parse(v):null})()});(t?this.state.update(this.existingPrompt.id,d):this.state.create(d)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:v=>{this.isSubmitting.set(false),v.status===409?this.errorMessage.set(`A scheduled prompt named "${d.name}" already exists in this scope.`):v.status===400?this.errorMessage.set(v.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=vf({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:10,vars:3,consts:[[1,"scheduled-prompt-form"],[1,"scheduled-prompt-form__header"],["type","button","title","Back to scheduled prompts",1,"scheduled-prompt-form__back",3,"click"],[1,"scheduled-prompt-form__back-icon"],[1,"scheduled-prompt-form__title"],[1,"scheduled-prompt-form__loading"],[1,"scheduled-prompt-form__form",3,"formGroup"],[1,"scheduled-prompt-form__form",3,"ngSubmit","formGroup"],[1,"scheduled-prompt-form__field"],["for","sp-name",1,"scheduled-prompt-form__label"],["aria-hidden","true"],["id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],[1,"scheduled-prompt-form__field-error"],[1,"scheduled-prompt-form__field-hint"],["for","sp-description",1,"scheduled-prompt-form__label"],["id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-agent-config",1,"scheduled-prompt-form__label"],["for","sp-prompt-content",1,"scheduled-prompt-form__label"],["id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",1,"scheduled-prompt-form__textarea",3,"formControl"],[1,"scheduled-prompt-form__fieldset"],[1,"scheduled-prompt-form__legend"],["for","sp-unit",1,"scheduled-prompt-form__label"],["id","sp-unit",1,"scheduled-prompt-form__select",3,"formControl"],[3,"value"],["for","sp-time",1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__time-wrapper"],["id","sp-time","type","time",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--time",3,"formControl"],[1,"scheduled-prompt-form__utc-badge"],["for","sp-start-date",1,"scheduled-prompt-form__label"],["id","sp-start-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-end-type",1,"scheduled-prompt-form__label"],["id","sp-end-type",1,"scheduled-prompt-form__select",3,"formControl"],[1,"scheduled-prompt-form__toggle-label"],["type","checkbox",1,"scheduled-prompt-form__toggle-checkbox",3,"formControl"],[1,"scheduled-prompt-form__toggle-text"],[1,"scheduled-prompt-form__toggle-hint"],["for","sp-external-metadata",1,"scheduled-prompt-form__label"],["id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",1,"scheduled-prompt-form__textarea","scheduled-prompt-form__textarea--code",3,"formControl"],[1,"scheduled-prompt-form__error"],[1,"scheduled-prompt-form__actions"],["type","submit",1,"scheduled-prompt-form__btn","scheduled-prompt-form__btn--primary",3,"disabled"],["type","button",1,"scheduled-prompt-form__btn",3,"click"],[1,"scheduled-prompt-form__readonly-value"],[3,"href"],["id","sp-agent-config",1,"scheduled-prompt-form__select",3,"formControl"],["value","","disabled",""],[1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__day-grid"],[1,"scheduled-prompt-form__day-label"],["type","checkbox",1,"scheduled-prompt-form__day-checkbox",3,"change","checked"],[1,"scheduled-prompt-form__day-text"],["for","sp-end-date",1,"scheduled-prompt-form__label"],["id","sp-end-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-occurrence-count",1,"scheduled-prompt-form__label"],["id","sp-occurrence-count","type","number","min","1",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--number",3,"formControl"]],template:function(e,d){e&1&&(za(0,"div",0)(1,"header",1)(2,"button",2),dc("click",function(){return d.cancel()}),za(3,"span",3),r_(4,"\u2190"),Cf(),r_(5),Cf(),za(6,"h1",4),r_(7),Cf()(),hT(8,pe,2,0,"p",5)(9,Fe,93,28,"form",6),Cf()),e&2&&(yb(5),Rf(" ",d.isPlatformMode?"Platform Scheduled Prompts":"Scheduled Prompts"," "),yb(2),Rf(" ",d.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"," "),yb(),pT(d.isLoading()?8:9));},dependencies:[Kn,zn,Zn,Xn,Ye,dn,Ft,bt,Ln,Wn$1,qt,pn,Vn],styles:[".scheduled-prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.scheduled-prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.scheduled-prompt-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.scheduled-prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.scheduled-prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.scheduled-prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.scheduled-prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.scheduled-prompt-form__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.scheduled-prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__input[_ngcontent-%COMP%], .scheduled-prompt-form__select[_ngcontent-%COMP%], .scheduled-prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.scheduled-prompt-form__input[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__select[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.scheduled-prompt-form__input[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__select[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__select[_ngcontent-%COMP%]{cursor:pointer;appearance:auto}.scheduled-prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.scheduled-prompt-form__input--time[_ngcontent-%COMP%]{flex:1;min-width:0}.scheduled-prompt-form__input--number[_ngcontent-%COMP%]{max-width:120px}.scheduled-prompt-form__time-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.scheduled-prompt-form__utc-badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.75rem;font-weight:600;font-family:monospace;color:var(--color-text-secondary, #6e6e73);background:var(--color-surface, rgba(0, 0, 0, .05));padding:.25rem .5rem;border-radius:4px;text-transform:uppercase;letter-spacing:.06em}.scheduled-prompt-form__fieldset[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:8px;padding:1rem 1.25rem 1.25rem;margin:0;display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__legend[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--color-text-secondary, #6e6e73);padding:0 .375rem}.scheduled-prompt-form__day-grid[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem}.scheduled-prompt-form__day-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__day-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__day-text[_ngcontent-%COMP%]{font-size:.875rem;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30);margin:0}.scheduled-prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30)}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--color-surface, rgba(0, 0, 0, .03))}.scheduled-prompt-form__input--invalid[_ngcontent-%COMP%], .scheduled-prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.scheduled-prompt-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.scheduled-prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"]})};function Ie(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===Oe$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===Oe$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function Ae(n){let t=n.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}function Re(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),d=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${d}`}export{se as ScheduledPromptFormComponent};
@@ -0,0 +1 @@
1
+ import {m,i,O,U as U$1,h as vi,x as xi,P,M}from'./chunk-BEMVRmeG.js';import {p,c as It,M as Me,P as De,i as ie,Q as Ae,v as vf,z as za,f as dc,C as Cf,r as r_,h as hT,a as yb,t as tv,d as pT,N as NT,I as Iv,B as yT,D as vT,R as Rf,e as bT,u as uc,k as ig,m as sg}from'./main-NXEJVT36.js';var z=(e,t)=>t.id??t.name;function j(e,t){if(e&1&&(za(0,"p",3),r_(1),Cf()),e&2){let n=NT();yb(),Iv(n.deletion.error());}}function I(e,t){e&1&&(za(0,"p",4),r_(1,"Loading prompts\u2026"),Cf());}function A(e,t){e&1&&(za(0,"p",5),r_(1,"No platform prompts defined yet."),Cf());}function K(e,t){e&1&&(za(0,"p",4),r_(1,"No prompts match the current filter."),Cf());}function B(e,t){if(e&1){let n=bT();za(0,"button",18),dc("click",function(){ig(n);let c=NT().$implicit,p=NT(2);return sg(p.edit(c))}),r_(1,"Edit"),Cf();}if(e&2){let n=NT().$implicit;uc("aria-label","Edit "+n.name);}}function H(e,t){if(e&1){let n=bT();za(0,"agentos-row-delete-action",19),dc("request",function(){ig(n);let c=NT().$implicit,p=NT(2);return sg(p.deletion.request(c.id))})("confirm",function(){ig(n);let c=NT().$implicit,p=NT(2);return sg(p.confirmDelete(c))})("cancel",function(){ig(n);let c=NT(3);return sg(c.deletion.cancel())}),Cf();}if(e&2){let n=NT().$implicit,a=NT(2);tv("rowKey",n.id)("rowLabel",n.name)("state",a.deletion);}}function U(e,t){if(e&1&&(za(0,"tr",9)(1,"td",12),r_(2),Cf(),za(3,"td",13),r_(4),Cf(),za(5,"td",14)(6,"div",15),hT(7,B,2,1,"button",16),hT(8,H,1,3,"agentos-row-delete-action",17),Cf()()()),e&2){let n=t.$implicit,a=NT(2);yb(2),Iv(n.name),yb(2),Rf(" ",n.description||"\u2014"," "),yb(3),pT(a.deletion.confirmingId()!==n.id?7:-1),yb(),pT(n.id?8:-1);}}function G(e,t){if(e&1&&(za(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),r_(5,"Name"),Cf(),za(6,"th",10),r_(7,"Description"),Cf(),za(8,"th",10)(9,"span",11),r_(10,"Actions"),Cf()()()(),za(11,"tbody",8),yT(12,U,9,4,"tr",9,z),Cf()()()),e&2){let n=NT();yb(12),vT(n.rowFilter.filteredRows());}}var N=class e{router=p(It);destroyRef=p(Me);promptState=p(m);refresh$=new De(void 0);isLoading=ie(true);deletion=i();prompts=ie([]);rowFilter=O(this.prompts,t=>[t.name,t.description].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(Ae(()=>(this.isLoading.set(true),this.promptState.listPlatform())),U$1(this.destroyRef)).subscribe({next:t=>{this.prompts.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","prompts","new"]);}edit(t){t.id&&this.router.navigate(["/agentos","admin","prompts",t.id,"edit"]);}confirmDelete(t){t.id&&this.deletion.execute(t.id,{request$:this.promptState.delete(t.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${t.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=vf({type:e,selectors:[["agentos-platform-prompts"]],decls:9,vars:3,consts:[["title","Platform prompts","description","Prompts shared across every namespace."],["label","Filter prompts","placeholder","Filter prompts\u2026",3,"queryChange","query"],["type","button",1,"settings-table__new",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"request","confirm","cancel","rowKey","rowLabel","state"]],template:function(n,a){n&1&&(za(0,"ds-section-header",0)(1,"agentos-table-filter",1),dc("queryChange",function(p){return a.rowFilter.query.set(p)}),Cf(),za(2,"button",2),dc("click",function(){return a.openCreateForm()}),r_(3,"New prompt"),Cf()(),hT(4,j,2,1,"p",3),hT(5,I,2,0,"p",4)(6,A,2,0,"p",5)(7,K,2,0,"p",4)(8,G,14,0,"div",6)),n&2&&(yb(),tv("query",a.rowFilter.query()),yb(3),pT(a.deletion.error()?4:-1),yb(),pT(a.isLoading()?5:a.prompts().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[vi,xi,P,M],styles:['.settings-table__new[_ngcontent-%COMP%]{padding:7px 12px;border:1px solid var(--color-accent);border-radius:0;background:var(--color-accent);color:var(--color-bg);cursor:pointer;font-family:var(--font-heading);font-size:14px;font-weight:600;white-space:nowrap}.settings-table__new[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:2px}.settings-table__toolbar[_ngcontent-%COMP%]{display:flex;align-items:center;flex-wrap:wrap;gap:12px;margin:0 0 1rem}.settings-table__toolbar[_ngcontent-%COMP%] agentos-table-filter[_ngcontent-%COMP%]{margin:0;flex:0 1 240px;min-width:80px}.settings-table__toolbar[_ngcontent-%COMP%] .settings-table__new[_ngcontent-%COMP%]{margin-left:auto}.settings-table__toolbar-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;margin-left:auto}.settings-table__toolbar-actions[_ngcontent-%COMP%] agentos-table-filter[_ngcontent-%COMP%]{flex:0 1 240px;min-width:80px}.settings-table__toolbar-actions[_ngcontent-%COMP%] .settings-table__new[_ngcontent-%COMP%]{margin-left:0;white-space:nowrap}.settings-table__status[_ngcontent-%COMP%]{margin:20px 8px;color:var(--color-text-secondary)}.settings-table__error[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:.875rem;color:var(--color-error)}.settings-table__wrap[_ngcontent-%COMP%]{overflow-x:auto}table.ds-table[_ngcontent-%COMP%]{width:100%;border-collapse:collapse;font-size:14px}table.ds-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid var(--color-divider);color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-align:left;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid color-mix(in srgb,var(--color-text) 8%,transparent)}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.settings-table__name[_ngcontent-%COMP%]{font-weight:500}.settings-table__secondary[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.settings-table__stacked[_ngcontent-%COMP%]{display:block}.settings-table__tags[_ngcontent-%COMP%]{display:flex;gap:4px;flex-wrap:wrap}.settings-table__actions[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end;gap:4px;white-space:nowrap}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:4px 7px;border:1px solid transparent;background:transparent;color:var(--color-accent);cursor:pointer;font:inherit}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-100)}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:1px}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:disabled{color:var(--color-neutral-600);cursor:default}.settings-table__actions[_ngcontent-%COMP%] .settings-table__delete[_ngcontent-%COMP%]{color:var(--color-error)}@media(max-width:760px){.settings-table__toolbar[_ngcontent-%COMP%]{flex-direction:column;align-items:stretch;gap:12px}.settings-table__toolbar-actions[_ngcontent-%COMP%]{flex-direction:column;align-items:stretch;width:100%;margin-left:0}.settings-table__toolbar-actions[_ngcontent-%COMP%] agentos-table-filter[_ngcontent-%COMP%]{flex:none;width:100%;min-width:0}.settings-table__toolbar-actions[_ngcontent-%COMP%] .settings-table__new[_ngcontent-%COMP%]{width:100%;min-height:44px}}@media(max-width:760px){table.ds-table[_ngcontent-%COMP%]{position:relative;display:block;width:100%}table.ds-table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:14px;padding-top:12px}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%], table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{display:flex;flex-direction:column;padding:12px;background:var(--color-surface);border:1px solid var(--color-divider)}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{display:grid;grid-template-columns:minmax(88px,30%) minmax(0,1fr);align-items:baseline;gap:4px 12px;padding:5px 0;border-bottom:0;overflow-wrap:anywhere;white-space:normal}table.ds-table[_ngcontent-%COMP%] td[data-label][_ngcontent-%COMP%]:before{content:attr(data-label);content:attr(data-label) / "";color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[data-title][_ngcontent-%COMP%]{display:block;margin-bottom:4px;padding:0 0 6px;border-bottom:0;font-size:15px}table.ds-table[_ngcontent-%COMP%] td[data-title][_ngcontent-%COMP%]:before{display:none}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:4px;margin-top:6px;padding:10px 0 0;border-top:1px solid var(--color-divider);text-align:right}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%]:before{display:none}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%] .settings-table__actions[_ngcontent-%COMP%]{flex-wrap:wrap;width:100%;white-space:normal}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%] button[_ngcontent-%COMP%]{min-width:44px;min-height:44px;padding:0 12px}}.settings-table__confirm-label[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:13px}.sr-only[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}']})};export{N as PlatformPromptsComponent};
@@ -0,0 +1 @@
1
+ import {O,U as U$1,h as vi,x as xi,C as Ci,P}from'./chunk-BEMVRmeG.js';import {p,$ as $t,c as It,M as Me,T as $,P as De,i as ie,Q as Ae,v as vf,Z as pw,a0 as Wn,_,z as za,f as dc,C as Cf,r as r_,h as hT,a as yb,t as tv,d as pT,B as yT,N as NT,D as vT,e as bT,I as Iv,R as Rf,k as ig,m as sg}from'./main-NXEJVT36.js';var j=(o,e)=>e.key;function z(o,e){o&1&&(za(0,"p",3),r_(1,"Loading agent configs\u2026"),Cf());}function B(o,e){o&1&&(za(0,"p",4),r_(1,"No agent configs available."),Cf());}function H(o,e){o&1&&(za(0,"p",3),r_(1,"No agent configs match the current filter."),Cf());}function J(o,e){o&1&&(za(0,"ds-tag",17),r_(1,"Read-only"),Cf());}function U(o,e){if(o&1){let t=bT();za(0,"button",19),dc("click",function(){ig(t);let c=NT().$implicit,d=NT(2);return sg(d.launch(c))}),r_(1,"Launch"),Cf();}}function G(o,e){if(o&1){let t=bT();za(0,"button",19),dc("click",function(){ig(t);let c=NT().$implicit,d=NT(2);return sg(d.edit(c))}),r_(1,"Edit"),Cf(),za(2,"button",21),dc("click",function(){ig(t);let c=NT().$implicit,d=NT(2);return sg(d.delete(c))}),r_(3,"Delete"),Cf();}}function K(o,e){if(o&1){let t=bT();za(0,"tr",8)(1,"td",11),r_(2),Cf(),za(3,"td",12),r_(4),Cf(),za(5,"td",13),r_(6),Cf(),za(7,"td",14)(8,"div",15)(9,"ds-tag",16),r_(10),Cf(),hT(11,J,2,0,"ds-tag",17),Cf()(),za(12,"td",18)(13,"button",19),dc("click",function(){let c=ig(t).$implicit,d=NT(2);return sg(d.inspect(c))}),r_(14,"Inspect"),Cf(),hT(15,U,2,0,"button",20),hT(16,G,4,0),Cf()();}if(o&2){let t=e.$implicit,a=NT(2);yb(2),Iv(t.config.name),yb(2),Rf(" ",t.config.description||"\u2014"," "),yb(2),Iv(a.mode(t)),yb(3),tv("variant",t.scope==="platform"?"neutral":"accent"),yb(),Iv(t.scope==="platform"?"Platform":"Namespace"),yb(),pT(t.scope==="platform"?11:-1),yb(4),pT(a.canLaunch(t)?15:-1),yb(),pT(t.scope==="namespace"?16:-1);}}function Q(o,e){if(o&1&&(za(0,"div",5)(1,"table",6)(2,"thead",7)(3,"tr",8)(4,"th",9),r_(5,"Name"),Cf(),za(6,"th",9),r_(7,"Description"),Cf(),za(8,"th",9),r_(9,"Execution mode"),Cf(),za(10,"th",9),r_(11,"Scope"),Cf(),za(12,"th",9)(13,"span",10),r_(14,"Actions"),Cf()()()(),za(15,"tbody",7),yT(16,K,17,8,"tr",8,j),Cf()()()),o&2){let t=NT();yb(16),vT(t.rowFilter.filteredRows());}}var q=class o{route=p($t);router=p(It);destroyRef=p(Me);controller=p($);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new De(void 0);isLoading=ie(true);rows=ie([]);rowFilter=O(this.rows,e=>[e.config.name,e.config.description,this.mode(e),e.scope].filter(Boolean).join(" "));allConfigs$=this.refresh$.pipe(Ae(()=>(this.isLoading.set(true),pw({namespace:this.controller.listByParentAgentConfig(this.namespaceId),platform:this.controller.listPlatformAgentsAgentConfig().pipe(Wn(()=>_([])))}))));constructor(){this.allConfigs$.pipe(U$1(this.destroyRef)).subscribe({next:({namespace:e,platform:t})=>{this.rows.set([...t.map((a,c)=>({key:`platform:${a.id??c}`,config:a,scope:"platform"})),...e.map((a,c)=>({key:`namespace:${a.id??c}`,config:a,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"agent-configs","new"]);}inspect(e){e.config.id&&this.router.navigate(e.scope==="platform"?["/agentos","admin","agent-configs",e.config.id,"inspect"]:["/agentos",this.namespaceId,"agent-configs",e.config.id,"inspect"]);}launch(e){e.scope==="platform"||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"agent-configs",e.config.id,"launch"]);}edit(e){e.scope==="platform"||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"agent-configs",e.config.id,"edit"]);}delete(e){e.scope==="platform"||!e.config.id||!confirm(`Delete agent config \u201C${e.config.name}\u201D?`)||this.controller.deleteAgentConfig(e.config.id).pipe(U$1(this.destroyRef)).subscribe(()=>this.refresh$.next());}canLaunch(e){return e.scope==="namespace"&&e.config.executionMode==="LOOP"}mode(e){return e.config.executionMode??(e.config.advancedExecution?"ADVANCED":"SIMPLE")}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=vf({type:o,selectors:[["agentos-namespace-agent-configs"]],decls:8,vars:2,consts:[["title","Agent configs","description","Agent configurations available in this namespace, including configurations inherited from the platform."],["label","Filter agent configs","placeholder","Filter agent configs\u2026",3,"queryChange","query"],["type","button",1,"agent-configs__new",3,"click"],["role","status",1,"agent-configs__status"],[1,"agent-configs__status"],[1,"agent-configs__table-wrap"],["dsTable","","role","table","aria-label","Agent configs"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"agent-configs__name"],["role","cell","data-label","Description",1,"agent-configs__description"],["role","cell","data-label","Execution mode"],["role","cell","data-label","Scope"],[1,"agent-configs__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions","",1,"agent-configs__actions"],["type","button",3,"click"],["type","button"],["type","button",1,"agent-configs__delete",3,"click"]],template:function(t,a){t&1&&(za(0,"ds-section-header",0)(1,"agentos-table-filter",1),dc("queryChange",function(d){return a.rowFilter.query.set(d)}),Cf(),za(2,"button",2),dc("click",function(){return a.openCreateForm()}),r_(3," New agent config "),Cf()(),hT(4,z,2,0,"p",3)(5,B,2,0,"p",4)(6,H,2,0,"p",3)(7,Q,18,0,"div",5)),t&2&&(yb(),tv("query",a.rowFilter.query()),yb(3),pT(a.isLoading()?4:a.rows().length===0?5:a.rowFilter.filteredRows().length===0?6:7));},dependencies:[vi,xi,Ci,P],styles:['.agent-configs__new[_ngcontent-%COMP%]{white-space:nowrap;padding:7px 12px;border:1px solid var(--color-accent);border-radius:0;background:var(--color-accent);color:var(--color-bg);cursor:pointer;font-family:var(--font-heading);font-size:14px;font-weight:600}.agent-configs__status[_ngcontent-%COMP%]{margin:20px 8px;color:var(--color-text-secondary)}.agent-configs__table-wrap[_ngcontent-%COMP%]{overflow-x:auto}table.ds-table[_ngcontent-%COMP%]{width:100%;border-collapse:collapse;font-size:14px}table.ds-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid var(--color-divider);color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-align:left;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid color-mix(in srgb,var(--color-text) 8%,transparent)}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.agent-configs__name[_ngcontent-%COMP%]{font-weight:500}.agent-configs__description[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.agent-configs__tags[_ngcontent-%COMP%]{display:flex;gap:4px;flex-wrap:wrap}.agent-configs__actions[_ngcontent-%COMP%]{white-space:nowrap;vertical-align:middle;text-align:center}.agent-configs__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;vertical-align:middle}.agent-configs__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:4px 7px;border:1px solid transparent;background:transparent;color:var(--color-accent);cursor:pointer;font:inherit}.agent-configs__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-100)}.agent-configs__actions[_ngcontent-%COMP%] .agent-configs__delete[_ngcontent-%COMP%]{color:var(--color-error)}.sr-only[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}@media(max-width:760px){table.ds-table[_ngcontent-%COMP%]{position:relative;display:block;width:100%}table.ds-table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:14px;padding-top:12px}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%], table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{display:flex;flex-direction:column;padding:12px;background:var(--color-surface);border:1px solid var(--color-divider)}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{display:grid;grid-template-columns:minmax(88px,30%) minmax(0,1fr);align-items:baseline;gap:4px 12px;padding:5px 0;border-bottom:0;overflow-wrap:anywhere;white-space:normal}table.ds-table[_ngcontent-%COMP%] td[data-label][_ngcontent-%COMP%]:before{content:attr(data-label);content:attr(data-label) / "";color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[data-title][_ngcontent-%COMP%]{display:block;margin-bottom:4px;padding:0 0 6px;border-bottom:0;font-size:15px}table.ds-table[_ngcontent-%COMP%] td[data-title][_ngcontent-%COMP%]:before{display:none}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:4px;margin-top:6px;padding:10px 0 0;border-top:1px solid var(--color-divider);text-align:right}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%]:before{display:none}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%] .settings-table__actions[_ngcontent-%COMP%]{flex-wrap:wrap;width:100%;white-space:normal}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%] button[_ngcontent-%COMP%]{min-width:44px;min-height:44px;padding:0 12px}}']})};export{q as NamespaceAgentConfigsComponent};
@@ -1 +1 @@
1
- import {$,v as vt,a as ve,U,K as Kn,z as zn,Y as Ye,d as dn,L as Ln,W as Wn,q as qt,b as pn,V as Vn}from'./chunk-CVRn6LsT.js';import {p,$ as $t,c as It,G,M as Me,i as ie,x,w,v as vf,z as za,r as r_,C as Cf,h as hT,a as yb,I as Iv,d as pT,e as bT,f as dc,l as lc,s as sS,N as NT,t as tv,g as cS,u as uc,R as Rf,k as ig,m as sg}from'./main-C5P4R2SK.js';function H(l,r){l&1&&(za(0,"p",3),r_(1,"Loading\u2026"),Cf());}function J(l,r){l&1&&(za(0,"span",24),r_(1," Enter a whole number of at least 1, or leave the field empty. "),Cf());}function K(l,r){if(l&1){let e=bT();za(0,"form",5),dc("ngSubmit",function(){ig(e);let f=NT();return sg(f.submit())}),za(1,"div",6)(2,"label",7),r_(3,"Name "),za(4,"span",8),r_(5,"*"),Cf()(),lc(6,"input",9),sS(),Cf(),za(7,"div",6)(8,"label",10),r_(9,"Description"),Cf(),lc(10,"textarea",11),sS(),Cf(),za(11,"div",6)(12,"label",12),r_(13,"External ID"),Cf(),lc(14,"input",13),sS(),Cf(),za(15,"div",6)(16,"label",14),r_(17,"Default agent"),Cf(),lc(18,"input",15),sS(),Cf(),za(19,"div",6)(20,"label",16),r_(21,"Config path"),Cf(),lc(22,"input",17),sS(),Cf(),za(23,"div",6)(24,"label",18),r_(25,"Run cost threshold"),Cf(),lc(26,"input",19),sS(),za(27,"span",20),r_(28,"Leave empty to inherit the platform default."),Cf()(),za(29,"div",6)(30,"label",21),r_(31,"Maximum tool rounds"),Cf(),za(32,"input",22),dc("input",function(f){ig(e);let q=NT();return sg(q.onMaxToolRoundsInput(f))}),Cf(),sS(),za(33,"span",23),r_(34," Most tool rounds one agent run may take. Leave empty to inherit the server default. A change applies from the next agent run. "),Cf(),hT(35,J,2,0,"span",24),Cf(),za(36,"div",25)(37,"button",26),r_(38),Cf(),za(39,"button",27),dc("click",function(){ig(e);let f=NT();return sg(f.cancel())}),r_(40,"Cancel"),Cf()()();}if(l&2){let e=NT();tv("formGroup",e.form),yb(6),tv("formControl",e.nameControl),cS(),yb(4),tv("formControl",e.descriptionControl),cS(),yb(4),tv("formControl",e.externalIdControl),cS(),yb(4),tv("formControl",e.defaultAgentNameControl),cS(),yb(4),tv("formControl",e.configPathControl),cS(),yb(4),tv("formControl",e.runCostThresholdControl),cS(),yb(6),tv("formControl",e.maxToolRoundsControl),uc("aria-invalid",e.maxToolRoundsControl.invalid||e.maxToolRoundsUnparsable()),cS(),yb(3),pT(e.maxToolRoundsUnparsable()||e.maxToolRoundsControl.invalid&&(e.maxToolRoundsControl.dirty||e.maxToolRoundsControl.touched)?35:-1),yb(2),tv("disabled",e.form.invalid||e.isSubmitting()),yb(),Rf(" ",e.isEditMode()?"Save changes":"Create"," ");}}var Q=1,W=2147483647,j=class l{route=p($t);router=p(It);namespaceController=p(G);destroyRef=p(Me);form=new $({name:new vt("",{nonNullable:true,validators:[ve.required,ve.minLength(1)]}),description:new vt("",{nonNullable:true}),configPath:new vt("",{nonNullable:true}),externalId:new vt("",{nonNullable:true}),defaultAgentName:new vt("",{nonNullable:true}),runCostThreshold:new vt(null),maxToolRounds:new vt(null,{validators:[ve.min(Q),ve.max(W),ve.pattern(/^\d+$/)]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get configPathControl(){return this.form.controls.configPath}get externalIdControl(){return this.form.controls.externalId}get defaultAgentNameControl(){return this.form.controls.defaultAgentName}get runCostThresholdControl(){return this.form.controls.runCostThreshold}get maxToolRoundsControl(){return this.form.controls.maxToolRounds}maxToolRoundsUnparsable=ie(false);onMaxToolRoundsInput(r){this.maxToolRoundsUnparsable.set(r.target.validity.badInput);}isEditMode=ie(false);isSubmitting=ie(false);isLoading=ie(false);existingNamespace=null;ngOnInit(){let r=this.route.snapshot.paramMap.get("namespaceId")??this.route.parent?.snapshot.paramMap.get("namespaceId");r&&(this.isEditMode.set(true),this.loadNamespace(r));}loadNamespace(r){this.isLoading.set(true),this.namespaceController.getByIdNamespace(r).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingNamespace=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??""),this.configPathControl.setValue(e.configPath??""),this.externalIdControl.setValue(e.externalId??""),this.defaultAgentNameControl.setValue(e.defaultAgentName??""),this.runCostThresholdControl.setValue(e.runCostThreshold??null),this.maxToolRoundsControl.setValue(e.maxToolRounds??null),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.maxToolRoundsUnparsable()||this.isSubmitting())return;this.isSubmitting.set(true);let r=x(w({},this.existingNamespace),{name:this.nameControl.value.trim(),description:this.descriptionControl.value.trim()||void 0,configPath:this.configPathControl.value.trim()||void 0,externalId:this.externalIdControl.value.trim()||void 0,defaultAgentName:this.defaultAgentNameControl.value.trim()||void 0,runCostThreshold:this.runCostThresholdControl.value??void 0,maxToolRounds:this.maxToolRoundsControl.value??void 0});(this.isEditMode()?this.namespaceController.updateNamespace(this.existingNamespace.id??"",r):this.namespaceController.createNamespace(r)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.router.navigate(["/agentos/namespaces"]);}static \u0275fac=function(e){return new(e||l)};static \u0275cmp=vf({type:l,selectors:[["agentos-namespace-form"]],decls:6,vars:2,consts:[[1,"namespace-form"],[1,"namespace-form__header"],[1,"namespace-form__title"],[1,"namespace-form__loading"],[1,"namespace-form__form",3,"formGroup"],[1,"namespace-form__form",3,"ngSubmit","formGroup"],[1,"namespace-form__field"],["for","ns-name",1,"namespace-form__label"],["aria-hidden","true"],["id","ns-name","type","text","placeholder","Namespace name","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-description",1,"namespace-form__label"],["id","ns-description","rows","4","placeholder","Optional description",1,"namespace-form__textarea",3,"formControl"],["for","ns-external-id",1,"namespace-form__label"],["id","ns-external-id","type","text","placeholder","Optional federation ID from an external system","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-default-agent",1,"namespace-form__label"],["id","ns-default-agent","type","text","placeholder","Logical name of the default agent (e.g. coday)","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-config-path",1,"namespace-form__label"],["id","ns-config-path","type","text","placeholder","Optional path to base configuration directory","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-run-cost-threshold",1,"namespace-form__label"],["id","ns-run-cost-threshold","type","number","min","0","step","0.01","placeholder","Optional maximum cost per run (e.g. 0.50)",1,"namespace-form__input",3,"formControl"],[1,"namespace-form__hint"],["for","ns-max-tool-rounds",1,"namespace-form__label"],["id","ns-max-tool-rounds","type","number","min","1","step","1","placeholder","Server default","aria-describedby","ns-max-tool-rounds-hint",1,"namespace-form__input",3,"input","formControl"],["id","ns-max-tool-rounds-hint",1,"namespace-form__hint"],["id","ns-max-tool-rounds-error","role","alert",1,"namespace-form__error"],[1,"namespace-form__actions"],["type","submit",1,"namespace-form__btn","namespace-form__btn--primary",3,"disabled"],["type","button",1,"namespace-form__btn",3,"click"]],template:function(e,u){e&1&&(za(0,"div",0)(1,"header",1)(2,"h1",2),r_(3),Cf()(),hT(4,H,2,0,"p",3)(5,K,41,12,"form",4),Cf()),e&2&&(yb(3),Iv(u.isEditMode()?"Edit namespace":"New namespace"),yb(),pT(u.isLoading()?4:5));},dependencies:[Kn,zn,Ye,dn,Ln,Wn,qt,pn,Vn],styles:[".namespace-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:480px;margin:0 auto;padding:2rem 1rem}.namespace-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.namespace-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)}.namespace-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.namespace-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.namespace-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.namespace-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.namespace-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.namespace-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.namespace-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.namespace-form__input[_ngcontent-%COMP%], .namespace-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}.namespace-form__input[_ngcontent-%COMP%]:focus, .namespace-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.namespace-form__input[_ngcontent-%COMP%]::placeholder, .namespace-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.namespace-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:96px;line-height:1.5}.namespace-form__hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary)}.namespace-form__error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #dc2626)}.namespace-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.namespace-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}.namespace-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.namespace-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.namespace-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.namespace-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"]})};export{j as NamespaceFormComponent};
1
+ import {$,v as vt,a as ve,U,K as Kn,z as zn,Y as Ye,d as dn,L as Ln,W as Wn,q as qt,b as pn,V as Vn}from'./chunk-BEMVRmeG.js';import {p,$ as $t,c as It,G,M as Me,i as ie,x,w,v as vf,z as za,r as r_,C as Cf,h as hT,a as yb,I as Iv,d as pT,e as bT,f as dc,l as lc,s as sS,N as NT,t as tv,g as cS,u as uc,R as Rf,k as ig,m as sg}from'./main-NXEJVT36.js';function H(l,r){l&1&&(za(0,"p",3),r_(1,"Loading\u2026"),Cf());}function J(l,r){l&1&&(za(0,"span",24),r_(1," Enter a whole number of at least 1, or leave the field empty. "),Cf());}function K(l,r){if(l&1){let e=bT();za(0,"form",5),dc("ngSubmit",function(){ig(e);let f=NT();return sg(f.submit())}),za(1,"div",6)(2,"label",7),r_(3,"Name "),za(4,"span",8),r_(5,"*"),Cf()(),lc(6,"input",9),sS(),Cf(),za(7,"div",6)(8,"label",10),r_(9,"Description"),Cf(),lc(10,"textarea",11),sS(),Cf(),za(11,"div",6)(12,"label",12),r_(13,"External ID"),Cf(),lc(14,"input",13),sS(),Cf(),za(15,"div",6)(16,"label",14),r_(17,"Default agent"),Cf(),lc(18,"input",15),sS(),Cf(),za(19,"div",6)(20,"label",16),r_(21,"Config path"),Cf(),lc(22,"input",17),sS(),Cf(),za(23,"div",6)(24,"label",18),r_(25,"Run cost threshold"),Cf(),lc(26,"input",19),sS(),za(27,"span",20),r_(28,"Leave empty to inherit the platform default."),Cf()(),za(29,"div",6)(30,"label",21),r_(31,"Maximum tool rounds"),Cf(),za(32,"input",22),dc("input",function(f){ig(e);let q=NT();return sg(q.onMaxToolRoundsInput(f))}),Cf(),sS(),za(33,"span",23),r_(34," Most tool rounds one agent run may take. Leave empty to inherit the server default. A change applies from the next agent run. "),Cf(),hT(35,J,2,0,"span",24),Cf(),za(36,"div",25)(37,"button",26),r_(38),Cf(),za(39,"button",27),dc("click",function(){ig(e);let f=NT();return sg(f.cancel())}),r_(40,"Cancel"),Cf()()();}if(l&2){let e=NT();tv("formGroup",e.form),yb(6),tv("formControl",e.nameControl),cS(),yb(4),tv("formControl",e.descriptionControl),cS(),yb(4),tv("formControl",e.externalIdControl),cS(),yb(4),tv("formControl",e.defaultAgentNameControl),cS(),yb(4),tv("formControl",e.configPathControl),cS(),yb(4),tv("formControl",e.runCostThresholdControl),cS(),yb(6),tv("formControl",e.maxToolRoundsControl),uc("aria-invalid",e.maxToolRoundsControl.invalid||e.maxToolRoundsUnparsable()),cS(),yb(3),pT(e.maxToolRoundsUnparsable()||e.maxToolRoundsControl.invalid&&(e.maxToolRoundsControl.dirty||e.maxToolRoundsControl.touched)?35:-1),yb(2),tv("disabled",e.form.invalid||e.isSubmitting()),yb(),Rf(" ",e.isEditMode()?"Save changes":"Create"," ");}}var Q=1,W=2147483647,j=class l{route=p($t);router=p(It);namespaceController=p(G);destroyRef=p(Me);form=new $({name:new vt("",{nonNullable:true,validators:[ve.required,ve.minLength(1)]}),description:new vt("",{nonNullable:true}),configPath:new vt("",{nonNullable:true}),externalId:new vt("",{nonNullable:true}),defaultAgentName:new vt("",{nonNullable:true}),runCostThreshold:new vt(null),maxToolRounds:new vt(null,{validators:[ve.min(Q),ve.max(W),ve.pattern(/^\d+$/)]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get configPathControl(){return this.form.controls.configPath}get externalIdControl(){return this.form.controls.externalId}get defaultAgentNameControl(){return this.form.controls.defaultAgentName}get runCostThresholdControl(){return this.form.controls.runCostThreshold}get maxToolRoundsControl(){return this.form.controls.maxToolRounds}maxToolRoundsUnparsable=ie(false);onMaxToolRoundsInput(r){this.maxToolRoundsUnparsable.set(r.target.validity.badInput);}isEditMode=ie(false);isSubmitting=ie(false);isLoading=ie(false);existingNamespace=null;ngOnInit(){let r=this.route.snapshot.paramMap.get("namespaceId")??this.route.parent?.snapshot.paramMap.get("namespaceId");r&&(this.isEditMode.set(true),this.loadNamespace(r));}loadNamespace(r){this.isLoading.set(true),this.namespaceController.getByIdNamespace(r).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingNamespace=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??""),this.configPathControl.setValue(e.configPath??""),this.externalIdControl.setValue(e.externalId??""),this.defaultAgentNameControl.setValue(e.defaultAgentName??""),this.runCostThresholdControl.setValue(e.runCostThreshold??null),this.maxToolRoundsControl.setValue(e.maxToolRounds??null),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.maxToolRoundsUnparsable()||this.isSubmitting())return;this.isSubmitting.set(true);let r=x(w({},this.existingNamespace),{name:this.nameControl.value.trim(),description:this.descriptionControl.value.trim()||void 0,configPath:this.configPathControl.value.trim()||void 0,externalId:this.externalIdControl.value.trim()||void 0,defaultAgentName:this.defaultAgentNameControl.value.trim()||void 0,runCostThreshold:this.runCostThresholdControl.value??void 0,maxToolRounds:this.maxToolRoundsControl.value??void 0});(this.isEditMode()?this.namespaceController.updateNamespace(this.existingNamespace.id??"",r):this.namespaceController.createNamespace(r)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.router.navigate(["/agentos/namespaces"]);}static \u0275fac=function(e){return new(e||l)};static \u0275cmp=vf({type:l,selectors:[["agentos-namespace-form"]],decls:6,vars:2,consts:[[1,"namespace-form"],[1,"namespace-form__header"],[1,"namespace-form__title"],[1,"namespace-form__loading"],[1,"namespace-form__form",3,"formGroup"],[1,"namespace-form__form",3,"ngSubmit","formGroup"],[1,"namespace-form__field"],["for","ns-name",1,"namespace-form__label"],["aria-hidden","true"],["id","ns-name","type","text","placeholder","Namespace name","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-description",1,"namespace-form__label"],["id","ns-description","rows","4","placeholder","Optional description",1,"namespace-form__textarea",3,"formControl"],["for","ns-external-id",1,"namespace-form__label"],["id","ns-external-id","type","text","placeholder","Optional federation ID from an external system","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-default-agent",1,"namespace-form__label"],["id","ns-default-agent","type","text","placeholder","Logical name of the default agent (e.g. coday)","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-config-path",1,"namespace-form__label"],["id","ns-config-path","type","text","placeholder","Optional path to base configuration directory","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-run-cost-threshold",1,"namespace-form__label"],["id","ns-run-cost-threshold","type","number","min","0","step","0.01","placeholder","Optional maximum cost per run (e.g. 0.50)",1,"namespace-form__input",3,"formControl"],[1,"namespace-form__hint"],["for","ns-max-tool-rounds",1,"namespace-form__label"],["id","ns-max-tool-rounds","type","number","min","1","step","1","placeholder","Server default","aria-describedby","ns-max-tool-rounds-hint",1,"namespace-form__input",3,"input","formControl"],["id","ns-max-tool-rounds-hint",1,"namespace-form__hint"],["id","ns-max-tool-rounds-error","role","alert",1,"namespace-form__error"],[1,"namespace-form__actions"],["type","submit",1,"namespace-form__btn","namespace-form__btn--primary",3,"disabled"],["type","button",1,"namespace-form__btn",3,"click"]],template:function(e,u){e&1&&(za(0,"div",0)(1,"header",1)(2,"h1",2),r_(3),Cf()(),hT(4,H,2,0,"p",3)(5,K,41,12,"form",4),Cf()),e&2&&(yb(3),Iv(u.isEditMode()?"Edit namespace":"New namespace"),yb(),pT(u.isLoading()?4:5));},dependencies:[Kn,zn,Ye,dn,Ln,Wn,qt,pn,Vn],styles:[".namespace-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:480px;margin:0 auto;padding:2rem 1rem}.namespace-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.namespace-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)}.namespace-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.namespace-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.namespace-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.namespace-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.namespace-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.namespace-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.namespace-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.namespace-form__input[_ngcontent-%COMP%], .namespace-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}.namespace-form__input[_ngcontent-%COMP%]:focus, .namespace-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.namespace-form__input[_ngcontent-%COMP%]::placeholder, .namespace-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.namespace-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:96px;line-height:1.5}.namespace-form__hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary)}.namespace-form__error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #dc2626)}.namespace-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.namespace-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}.namespace-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.namespace-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.namespace-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.namespace-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"]})};export{j as NamespaceFormComponent};
@@ -1,2 +1,2 @@
1
- import {v}from'./chunk-D15DFuJp.js';import {R,q,J}from'./chunk-DbgLwilj.js';import {p,$ as $t,c as It,M as Me,i as ie,E as Mi,F as Sg,x,w,v as vf,z as za,f as dc,r as r_,C as Cf,h as hT,a as yb,I as Iv,d as pT,e as bT,B as yT,J as mT,s as sS,l as lc,N as NT,t as tv,g as cS,D as vT,R as Rf,H as dT,k as ig,m as sg,a6 as WT,u as uc}from'./main-C5P4R2SK.js';import {F,v as vt,a as ve,$,U,K as Kn,z as zn,Z as Zn,X as Xn,Y as Ye,c as bt,f as fn,L as Ln,W as Wn,b as pn,V as Vn}from'./chunk-CVRn6LsT.js';import'./chunk-D5G8zkh6.js';function se(i,t){i&1&&(za(0,"p",5),r_(1,"Loading\u2026"),Cf());}function ce(i,t){if(i&1&&(za(0,"label",23),lc(1,"input",24),sS(),za(2,"span"),r_(3),Cf()()),i&2){let e=t.$implicit,o=NT(3);yb(),tv("formControl",o.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!o.isAdmin()),cS(),yb(2),Iv(e.label);}}function de(i,t){if(i&1&&(za(0,"fieldset",8)(1,"legend",22),r_(2,"Configuration scope"),Cf(),yT(3,ce,4,4,"label",23,dT().trackByScope,true),Cf()),i&2){let e=NT(2);tv("disabled",e.isEditMode()),yb(3),vT(e.scopeOptions);}}function ue(i,t){if(i&1&&(za(0,"option",13),r_(1),Cf()),i&2){let e=t.$implicit,o=NT(2);tv("value",e),yb(),Iv(o.authTypeLabel[e]);}}function pe(i,t){i&1&&r_(0," Leave a field unchanged to keep the stored credential. ");}function he(i,t){i&1&&(za(0,"span",11),r_(1,"*"),Cf());}function me(i,t){if(i&1&&(za(0,"p",28),r_(1),Cf()),i&2){let e=NT(2).$implicit;tv("id","as-hint-"+e.key),yb(),Iv(e.hint);}}function ge(i,t){if(i&1&&(lc(0,"input",27),sS(),hT(1,me,2,2,"p",28)),i&2){let e=NT().$implicit;WT("auth-setting-form__input"+(e.secret?" auth-setting-form__input--secret":"")),tv("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),uc("aria-describedby",e.hint?"as-hint-"+e.key:null),cS(),yb(),pT(e.hint?1:-1);}}function Ce(i,t){if(i&1&&(za(0,"div",9)(1,"label",26),r_(2),hT(3,he,2,0,"span",11),Cf(),hT(4,ge,2,9),Cf()),i&2){let e,o=t.$implicit,l=NT(3);yb(),tv("for","as-cred-"+o.key),yb(),Rf(" ",o.label," "),yb(),pT(o.required?3:-1),yb(),pT((e=l.controlForField(o.key))?4:-1,e);}}function fe(i,t){if(i&1&&(za(0,"fieldset",18)(1,"legend",22),r_(2,"Credentials"),Cf(),za(3,"p",25),r_(4," Values are stored encrypted and masked on read. "),hT(5,pe,1,0),Cf(),yT(6,Ce,5,4,"div",9,dT().trackByField,true),Cf()),i&2){let e=NT(2);yb(5),pT(e.isEditMode()?5:-1),yb(),vT(e.credentialFields());}}function ye(i,t){if(i&1){let e=bT();za(0,"form",7),dc("ngSubmit",function(){ig(e);let l=NT();return sg(l.submit())}),hT(1,de,5,1,"fieldset",8),za(2,"div",9)(3,"label",10),r_(4,"Auth type "),za(5,"span",11),r_(6,"*"),Cf()(),za(7,"select",12),yT(8,ue,2,2,"option",13,mT),Cf(),sS(),Cf(),za(10,"div",9)(11,"label",14),r_(12,"Name "),za(13,"span",11),r_(14,"*"),Cf()(),lc(15,"input",15),sS(),Cf(),za(16,"div",9)(17,"label",16),r_(18,"Description"),Cf(),lc(19,"input",17),sS(),Cf(),hT(20,fe,8,1,"fieldset",18),za(21,"div",19)(22,"button",20),r_(23),Cf(),za(24,"button",21),dc("click",function(){ig(e);let l=NT();return sg(l.cancel())}),r_(25,"Cancel"),Cf()()();}if(i&2){let e=NT();tv("formGroup",e.form),yb(),pT(e.isPlatformMode?-1:1),yb(6),tv("formControl",e.authTypeControl),cS(),yb(),vT(e.authTypeOptions),yb(7),tv("formControl",e.nameControl),cS(),yb(4),tv("formControl",e.descriptionControl),cS(),yb(),pT(e.credentialFields().length>0?20:-1),yb(2),tv("disabled",e.form.invalid||e.isSubmitting()),yb(),Rf(" ",e.isEditMode()?"Save changes":"Create"," ");}}var _e=new Set(["namespace","userOnNs","userGlobal"]),P=Object.freeze({platform:"Platform (read-only)",namespace:"Namespace configuration",userOnNs:"Personal \u2014 this namespace only",userGlobal:"Personal \u2014 all namespaces"}),Se={ApiKeyAuthSetting:[{key:"apiKey",label:"API Key",placeholder:"sk-\u2026",secret:true,required:false}],BasicAuthAuthSetting:[{key:"username",label:"Username",placeholder:"user@example.com",secret:false,required:false},{key:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",secret:true,required:false}],BearerTokenAuthSetting:[{key:"token",label:"Bearer token",placeholder:"eyJ\u2026",secret:true,required:false}],OAuthDiscoverableAuthSetting:[{key:"discoveryUrl",label:"Discovery URL",placeholder:"https://\u2026/.well-known/openid-configuration",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthCustomAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthRegisteredAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthMcpDiscoverableAuthSetting:[{key:"resourceUrl",label:"Resource URL",placeholder:"https://mcp.example.com",hint:"Use the base URL exactly as documented by your provider \u2014 do not append a path suffix. Examples: https://mcp.hubspot.com (HubSpot), https://mcp.atlassian.com/v1/mcp (Atlassian).",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",hint:"Leave empty to let the server register an OAuth client automatically (RFC 7591 dynamic registration). Fill in only if you have a pre-registered client ID from your provider.",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Leave empty in most cases \u2014 the MCP server declares the required scopes itself. Fill in only if your provider explicitly requires client-declared scopes.",secret:false,required:false}]},le=class i{route=p($t);router=p(It);destroyRef=p(Me);state=p(R);namespaceRole=p(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?ie(true):F(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=q;authTypeLabel=J;scopeOptions=[{value:"namespace",label:P.namespace},{value:"userOnNs",label:P.userOnNs},{value:"userGlobal",label:P.userGlobal}];nameControl=new vt("",{nonNullable:true,validators:[ve.required,ve.minLength(1)]});descriptionControl=new vt(null);authTypeControl=new vt("ApiKeyAuthSetting",{nonNullable:true,validators:[ve.required]});scopeControl=new vt("namespace",{nonNullable:true});form=new $({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new vt("",{nonNullable:true});usernameControl=new vt("",{nonNullable:true});passwordControl=new vt("",{nonNullable:true});tokenControl=new vt("",{nonNullable:true});discoveryUrlControl=new vt("",{nonNullable:true});authorizationUrlControl=new vt("",{nonNullable:true});tokenUrlControl=new vt("",{nonNullable:true});clientIdControl=new vt("",{nonNullable:true});clientSecretControl=new vt("",{nonNullable:true});scopesControl=new vt("",{nonNullable:true});resourceUrlControl=new vt("",{nonNullable:true});selectedAuthType=F(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=Mi(()=>Se[this.selectedAuthType()]);isEditMode=ie(false);isSubmitting=ie(false);isLoading=ie(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Sg(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,o=t.get("authSettingId");if(o){this.isEditMode.set(true),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(o);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let l=this.parseScope(e.get("scope"));this.scopeControl.setValue(l);let v=e.get("template");v&&this.hydrateFromTemplate(v);}parseScope(t){return t&&_e.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId&&!t.namespaceId?"platform":t.userId?t.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AuthSettingForm] Could not load auth setting '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.authTypeControl.setValue(e.authType),this.clearCredentialControls(),this.initialCredentials={},this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AuthSettingForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){switch(this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.authTypeControl.setValue(t.authType),this.clearCredentialControls(),this.initialCredentials={},t.authType){case "ApiKeyAuthSetting":{let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialCredentials.apiKey=e;break}case "BasicAuthAuthSetting":{let e=t,o=e.username??"",l=e.password??"";this.usernameControl.setValue(o),this.passwordControl.setValue(l),this.initialCredentials.username=o,this.initialCredentials.password=l;break}case "BearerTokenAuthSetting":{let e=t.token??"";this.tokenControl.setValue(e),this.initialCredentials.token=e;break}case "OAuthDiscoverableAuthSetting":{let e=t;this.discoveryUrlControl.setValue(e.discoveryUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.discoveryUrl=e.discoveryUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthCustomAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthRegisteredAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthMcpDiscoverableAuthSetting":{let e=t;this.resourceUrlControl.setValue(e.resourceUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.resourceUrl=e.resourceUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}}}clearCredentialControls(){this.apiKeyControl.setValue(""),this.usernameControl.setValue(""),this.passwordControl.setValue(""),this.tokenControl.setValue(""),this.discoveryUrlControl.setValue(""),this.authorizationUrlControl.setValue(""),this.tokenUrlControl.setValue(""),this.clientIdControl.setValue(""),this.clientSecretControl.setValue(""),this.scopesControl.setValue(""),this.resourceUrlControl.setValue("");}credentialValue(t,e){if(!(this.isEditMode()&&e===this.initialCredentials[t]))return e||void 0}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.nameControl.value.trim(),e=this.descriptionControl.value?.trim()||void 0,o=this.authTypeControl.value,l=this.form.getRawValue().scope,v=this.isPlatformMode?null:this.namespaceId??null,w=this.buildTypedPayload(o,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,this.existingConfig):this.state.create(w,l,v)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}buildTypedPayload(t,e,o){let l={name:e,description:o};switch(t){case "ApiKeyAuthSetting":return x(w({},l),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return x(w({},l),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return x(w({},l),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return x(w({},l),{authType:"OAuthDiscoverableAuthSetting",discoveryUrl:this.credentialValue("discoveryUrl",this.discoveryUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthCustomAuthSetting":return x(w({},l),{authType:"OAuthCustomAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthRegisteredAuthSetting":return x(w({},l),{authType:"OAuthRegisteredAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthMcpDiscoverableAuthSetting":return x(w({},l),{authType:"OAuthMcpDiscoverableAuthSetting",resourceUrl:this.credentialValue("resourceUrl",this.resourceUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)})}}controlForField(t){return {apiKey:this.apiKeyControl,username:this.usernameControl,password:this.passwordControl,token:this.tokenControl,discoveryUrl:this.discoveryUrlControl,authorizationUrl:this.authorizationUrlControl,tokenUrl:this.tokenUrlControl,clientId:this.clientIdControl,clientSecret:this.clientSecretControl,scopes:this.scopesControl,resourceUrl:this.resourceUrlControl}[t]}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","auth-settings"]):this.router.navigate(["/agentos",this.namespaceId,"auth-settings"]);}trackByScope(t,e){return e.value}trackByField(t,e){return e.key}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=vf({type:i,selectors:[["agentos-auth-setting-form"]],decls:10,vars:2,consts:[[1,"auth-setting-form"],[1,"auth-setting-form__header"],["type","button","title","Back to auth settings",1,"auth-setting-form__back",3,"click"],[1,"auth-setting-form__back-icon"],[1,"auth-setting-form__title"],[1,"auth-setting-form__loading"],[1,"auth-setting-form__form",3,"formGroup"],[1,"auth-setting-form__form",3,"ngSubmit","formGroup"],[1,"auth-setting-form__scope",3,"disabled"],[1,"auth-setting-form__field"],["for","as-auth-type",1,"auth-setting-form__label"],["aria-hidden","true"],["id","as-auth-type",1,"auth-setting-form__select",3,"formControl"],[3,"value"],["for","as-name",1,"auth-setting-form__label"],["id","as-name","type","text","placeholder","e.g. GitHub OAuth App","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],["for","as-description",1,"auth-setting-form__label"],["id","as-description","type","text","placeholder","Optional \u2014 short description of this auth setting","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],[1,"auth-setting-form__credentials"],[1,"auth-setting-form__actions"],["type","submit",1,"auth-setting-form__btn","auth-setting-form__btn--primary",3,"disabled"],["type","button",1,"auth-setting-form__btn",3,"click"],[1,"auth-setting-form__label"],[1,"auth-setting-form__scope-option"],["type","radio",3,"formControl","value","disabled"],[1,"auth-setting-form__credentials-hint"],[1,"auth-setting-form__label",3,"for"],[3,"id","type","placeholder","formControl","autocomplete"],[1,"auth-setting-form__field-hint",3,"id"]],template:function(e,o){e&1&&(za(0,"div",0)(1,"header",1)(2,"button",2),dc("click",function(){return o.cancel()}),za(3,"span",3),r_(4,"\u2190"),Cf(),r_(5," Auth Settings "),Cf(),za(6,"h1",4),r_(7),Cf()(),hT(8,se,2,0,"p",5)(9,ye,26,8,"form",6),Cf()),e&2&&(yb(7),Iv(o.isEditMode()?"Edit auth setting":"New auth setting"),yb(),pT(o.isLoading()?8:9));},dependencies:[Kn,zn,Zn,Xn,Ye,bt,fn,Ln,Wn,pn,Vn],styles:[".auth-setting-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem;padding:1.5rem;max-width:640px}.auth-setting-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.4rem;background:none;border:none;cursor:pointer;color:var(--color-text-secondary);font-size:.85rem;padding:0}.auth-setting-form__back[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.auth-setting-form__back-icon[_ngcontent-%COMP%]{font-size:1rem}.auth-setting-form__title[_ngcontent-%COMP%]{font-size:1.4rem;font-weight:600;color:var(--color-text);margin:0}.auth-setting-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem}.auth-setting-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.auth-setting-form__scope[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem;display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__scope[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__scope-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;font-size:.9rem;color:var(--color-text)}.auth-setting-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem}.auth-setting-form__field-hint[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);margin:0;line-height:1.4}.auth-setting-form__label[_ngcontent-%COMP%]{font-size:.85rem;font-weight:500;color:var(--color-text-secondary)}.auth-setting-form__input[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;transition:border-color .15s ease;width:100%;box-sizing:border-box}.auth-setting-form__input[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__input--secret[_ngcontent-%COMP%]{font-family:monospace;letter-spacing:.05em}.auth-setting-form__select[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;cursor:pointer;transition:border-color .15s ease}.auth-setting-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__credentials[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem 1rem;display:flex;flex-direction:column;gap:.75rem;margin:0}.auth-setting-form__credentials[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__credentials-hint[_ngcontent-%COMP%]{font-size:.78rem;color:var(--color-text-secondary);margin:0}.auth-setting-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center;padding-top:.5rem}.auth-setting-form__btn[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem 1.25rem;cursor:pointer;font-size:.9rem;font-weight:500;background:var(--color-bg-secondary);color:var(--color-text);transition:background .15s ease}.auth-setting-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover)}.auth-setting-form__btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.auth-setting-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-on-primary, #fff);border-color:var(--color-primary)}.auth-setting-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, var(--color-primary))}"]})};
1
+ import {v}from'./chunk-6kWS1PKC.js';import {R,q,J}from'./chunk-BrXPglDw.js';import {p,$ as $t,c as It,M as Me,i as ie,E as Mi,F as Sg,x,w,v as vf,z as za,f as dc,r as r_,C as Cf,h as hT,a as yb,I as Iv,d as pT,e as bT,B as yT,J as mT,s as sS,l as lc,N as NT,t as tv,g as cS,D as vT,R as Rf,H as dT,k as ig,m as sg,a6 as WT,u as uc}from'./main-NXEJVT36.js';import {F,v as vt,a as ve,$,U,K as Kn,z as zn,Z as Zn,X as Xn,Y as Ye,c as bt,f as fn,L as Ln,W as Wn,b as pn,V as Vn}from'./chunk-BEMVRmeG.js';import'./chunk-tJcOqYO8.js';function se(i,t){i&1&&(za(0,"p",5),r_(1,"Loading\u2026"),Cf());}function ce(i,t){if(i&1&&(za(0,"label",23),lc(1,"input",24),sS(),za(2,"span"),r_(3),Cf()()),i&2){let e=t.$implicit,o=NT(3);yb(),tv("formControl",o.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!o.isAdmin()),cS(),yb(2),Iv(e.label);}}function de(i,t){if(i&1&&(za(0,"fieldset",8)(1,"legend",22),r_(2,"Configuration scope"),Cf(),yT(3,ce,4,4,"label",23,dT().trackByScope,true),Cf()),i&2){let e=NT(2);tv("disabled",e.isEditMode()),yb(3),vT(e.scopeOptions);}}function ue(i,t){if(i&1&&(za(0,"option",13),r_(1),Cf()),i&2){let e=t.$implicit,o=NT(2);tv("value",e),yb(),Iv(o.authTypeLabel[e]);}}function pe(i,t){i&1&&r_(0," Leave a field unchanged to keep the stored credential. ");}function he(i,t){i&1&&(za(0,"span",11),r_(1,"*"),Cf());}function me(i,t){if(i&1&&(za(0,"p",28),r_(1),Cf()),i&2){let e=NT(2).$implicit;tv("id","as-hint-"+e.key),yb(),Iv(e.hint);}}function ge(i,t){if(i&1&&(lc(0,"input",27),sS(),hT(1,me,2,2,"p",28)),i&2){let e=NT().$implicit;WT("auth-setting-form__input"+(e.secret?" auth-setting-form__input--secret":"")),tv("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),uc("aria-describedby",e.hint?"as-hint-"+e.key:null),cS(),yb(),pT(e.hint?1:-1);}}function Ce(i,t){if(i&1&&(za(0,"div",9)(1,"label",26),r_(2),hT(3,he,2,0,"span",11),Cf(),hT(4,ge,2,9),Cf()),i&2){let e,o=t.$implicit,l=NT(3);yb(),tv("for","as-cred-"+o.key),yb(),Rf(" ",o.label," "),yb(),pT(o.required?3:-1),yb(),pT((e=l.controlForField(o.key))?4:-1,e);}}function fe(i,t){if(i&1&&(za(0,"fieldset",18)(1,"legend",22),r_(2,"Credentials"),Cf(),za(3,"p",25),r_(4," Values are stored encrypted and masked on read. "),hT(5,pe,1,0),Cf(),yT(6,Ce,5,4,"div",9,dT().trackByField,true),Cf()),i&2){let e=NT(2);yb(5),pT(e.isEditMode()?5:-1),yb(),vT(e.credentialFields());}}function ye(i,t){if(i&1){let e=bT();za(0,"form",7),dc("ngSubmit",function(){ig(e);let l=NT();return sg(l.submit())}),hT(1,de,5,1,"fieldset",8),za(2,"div",9)(3,"label",10),r_(4,"Auth type "),za(5,"span",11),r_(6,"*"),Cf()(),za(7,"select",12),yT(8,ue,2,2,"option",13,mT),Cf(),sS(),Cf(),za(10,"div",9)(11,"label",14),r_(12,"Name "),za(13,"span",11),r_(14,"*"),Cf()(),lc(15,"input",15),sS(),Cf(),za(16,"div",9)(17,"label",16),r_(18,"Description"),Cf(),lc(19,"input",17),sS(),Cf(),hT(20,fe,8,1,"fieldset",18),za(21,"div",19)(22,"button",20),r_(23),Cf(),za(24,"button",21),dc("click",function(){ig(e);let l=NT();return sg(l.cancel())}),r_(25,"Cancel"),Cf()()();}if(i&2){let e=NT();tv("formGroup",e.form),yb(),pT(e.isPlatformMode?-1:1),yb(6),tv("formControl",e.authTypeControl),cS(),yb(),vT(e.authTypeOptions),yb(7),tv("formControl",e.nameControl),cS(),yb(4),tv("formControl",e.descriptionControl),cS(),yb(),pT(e.credentialFields().length>0?20:-1),yb(2),tv("disabled",e.form.invalid||e.isSubmitting()),yb(),Rf(" ",e.isEditMode()?"Save changes":"Create"," ");}}var _e=new Set(["namespace","userOnNs","userGlobal"]),P=Object.freeze({platform:"Platform (read-only)",namespace:"Namespace configuration",userOnNs:"Personal \u2014 this namespace only",userGlobal:"Personal \u2014 all namespaces"}),Se={ApiKeyAuthSetting:[{key:"apiKey",label:"API Key",placeholder:"sk-\u2026",secret:true,required:false}],BasicAuthAuthSetting:[{key:"username",label:"Username",placeholder:"user@example.com",secret:false,required:false},{key:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",secret:true,required:false}],BearerTokenAuthSetting:[{key:"token",label:"Bearer token",placeholder:"eyJ\u2026",secret:true,required:false}],OAuthDiscoverableAuthSetting:[{key:"discoveryUrl",label:"Discovery URL",placeholder:"https://\u2026/.well-known/openid-configuration",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthCustomAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthRegisteredAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthMcpDiscoverableAuthSetting:[{key:"resourceUrl",label:"Resource URL",placeholder:"https://mcp.example.com",hint:"Use the base URL exactly as documented by your provider \u2014 do not append a path suffix. Examples: https://mcp.hubspot.com (HubSpot), https://mcp.atlassian.com/v1/mcp (Atlassian).",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",hint:"Leave empty to let the server register an OAuth client automatically (RFC 7591 dynamic registration). Fill in only if you have a pre-registered client ID from your provider.",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Leave empty in most cases \u2014 the MCP server declares the required scopes itself. Fill in only if your provider explicitly requires client-declared scopes.",secret:false,required:false}]},le=class i{route=p($t);router=p(It);destroyRef=p(Me);state=p(R);namespaceRole=p(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?ie(true):F(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=q;authTypeLabel=J;scopeOptions=[{value:"namespace",label:P.namespace},{value:"userOnNs",label:P.userOnNs},{value:"userGlobal",label:P.userGlobal}];nameControl=new vt("",{nonNullable:true,validators:[ve.required,ve.minLength(1)]});descriptionControl=new vt(null);authTypeControl=new vt("ApiKeyAuthSetting",{nonNullable:true,validators:[ve.required]});scopeControl=new vt("namespace",{nonNullable:true});form=new $({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new vt("",{nonNullable:true});usernameControl=new vt("",{nonNullable:true});passwordControl=new vt("",{nonNullable:true});tokenControl=new vt("",{nonNullable:true});discoveryUrlControl=new vt("",{nonNullable:true});authorizationUrlControl=new vt("",{nonNullable:true});tokenUrlControl=new vt("",{nonNullable:true});clientIdControl=new vt("",{nonNullable:true});clientSecretControl=new vt("",{nonNullable:true});scopesControl=new vt("",{nonNullable:true});resourceUrlControl=new vt("",{nonNullable:true});selectedAuthType=F(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=Mi(()=>Se[this.selectedAuthType()]);isEditMode=ie(false);isSubmitting=ie(false);isLoading=ie(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Sg(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,o=t.get("authSettingId");if(o){this.isEditMode.set(true),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(o);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let l=this.parseScope(e.get("scope"));this.scopeControl.setValue(l);let v=e.get("template");v&&this.hydrateFromTemplate(v);}parseScope(t){return t&&_e.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId&&!t.namespaceId?"platform":t.userId?t.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AuthSettingForm] Could not load auth setting '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.authTypeControl.setValue(e.authType),this.clearCredentialControls(),this.initialCredentials={},this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AuthSettingForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){switch(this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.authTypeControl.setValue(t.authType),this.clearCredentialControls(),this.initialCredentials={},t.authType){case "ApiKeyAuthSetting":{let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialCredentials.apiKey=e;break}case "BasicAuthAuthSetting":{let e=t,o=e.username??"",l=e.password??"";this.usernameControl.setValue(o),this.passwordControl.setValue(l),this.initialCredentials.username=o,this.initialCredentials.password=l;break}case "BearerTokenAuthSetting":{let e=t.token??"";this.tokenControl.setValue(e),this.initialCredentials.token=e;break}case "OAuthDiscoverableAuthSetting":{let e=t;this.discoveryUrlControl.setValue(e.discoveryUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.discoveryUrl=e.discoveryUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthCustomAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthRegisteredAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthMcpDiscoverableAuthSetting":{let e=t;this.resourceUrlControl.setValue(e.resourceUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.resourceUrl=e.resourceUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}}}clearCredentialControls(){this.apiKeyControl.setValue(""),this.usernameControl.setValue(""),this.passwordControl.setValue(""),this.tokenControl.setValue(""),this.discoveryUrlControl.setValue(""),this.authorizationUrlControl.setValue(""),this.tokenUrlControl.setValue(""),this.clientIdControl.setValue(""),this.clientSecretControl.setValue(""),this.scopesControl.setValue(""),this.resourceUrlControl.setValue("");}credentialValue(t,e){if(!(this.isEditMode()&&e===this.initialCredentials[t]))return e||void 0}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.nameControl.value.trim(),e=this.descriptionControl.value?.trim()||void 0,o=this.authTypeControl.value,l=this.form.getRawValue().scope,v=this.isPlatformMode?null:this.namespaceId??null,w=this.buildTypedPayload(o,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,this.existingConfig):this.state.create(w,l,v)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}buildTypedPayload(t,e,o){let l={name:e,description:o};switch(t){case "ApiKeyAuthSetting":return x(w({},l),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return x(w({},l),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return x(w({},l),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return x(w({},l),{authType:"OAuthDiscoverableAuthSetting",discoveryUrl:this.credentialValue("discoveryUrl",this.discoveryUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthCustomAuthSetting":return x(w({},l),{authType:"OAuthCustomAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthRegisteredAuthSetting":return x(w({},l),{authType:"OAuthRegisteredAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthMcpDiscoverableAuthSetting":return x(w({},l),{authType:"OAuthMcpDiscoverableAuthSetting",resourceUrl:this.credentialValue("resourceUrl",this.resourceUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)})}}controlForField(t){return {apiKey:this.apiKeyControl,username:this.usernameControl,password:this.passwordControl,token:this.tokenControl,discoveryUrl:this.discoveryUrlControl,authorizationUrl:this.authorizationUrlControl,tokenUrl:this.tokenUrlControl,clientId:this.clientIdControl,clientSecret:this.clientSecretControl,scopes:this.scopesControl,resourceUrl:this.resourceUrlControl}[t]}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","auth-settings"]):this.router.navigate(["/agentos",this.namespaceId,"auth-settings"]);}trackByScope(t,e){return e.value}trackByField(t,e){return e.key}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=vf({type:i,selectors:[["agentos-auth-setting-form"]],decls:10,vars:2,consts:[[1,"auth-setting-form"],[1,"auth-setting-form__header"],["type","button","title","Back to auth settings",1,"auth-setting-form__back",3,"click"],[1,"auth-setting-form__back-icon"],[1,"auth-setting-form__title"],[1,"auth-setting-form__loading"],[1,"auth-setting-form__form",3,"formGroup"],[1,"auth-setting-form__form",3,"ngSubmit","formGroup"],[1,"auth-setting-form__scope",3,"disabled"],[1,"auth-setting-form__field"],["for","as-auth-type",1,"auth-setting-form__label"],["aria-hidden","true"],["id","as-auth-type",1,"auth-setting-form__select",3,"formControl"],[3,"value"],["for","as-name",1,"auth-setting-form__label"],["id","as-name","type","text","placeholder","e.g. GitHub OAuth App","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],["for","as-description",1,"auth-setting-form__label"],["id","as-description","type","text","placeholder","Optional \u2014 short description of this auth setting","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],[1,"auth-setting-form__credentials"],[1,"auth-setting-form__actions"],["type","submit",1,"auth-setting-form__btn","auth-setting-form__btn--primary",3,"disabled"],["type","button",1,"auth-setting-form__btn",3,"click"],[1,"auth-setting-form__label"],[1,"auth-setting-form__scope-option"],["type","radio",3,"formControl","value","disabled"],[1,"auth-setting-form__credentials-hint"],[1,"auth-setting-form__label",3,"for"],[3,"id","type","placeholder","formControl","autocomplete"],[1,"auth-setting-form__field-hint",3,"id"]],template:function(e,o){e&1&&(za(0,"div",0)(1,"header",1)(2,"button",2),dc("click",function(){return o.cancel()}),za(3,"span",3),r_(4,"\u2190"),Cf(),r_(5," Auth Settings "),Cf(),za(6,"h1",4),r_(7),Cf()(),hT(8,se,2,0,"p",5)(9,ye,26,8,"form",6),Cf()),e&2&&(yb(7),Iv(o.isEditMode()?"Edit auth setting":"New auth setting"),yb(),pT(o.isLoading()?8:9));},dependencies:[Kn,zn,Zn,Xn,Ye,bt,fn,Ln,Wn,pn,Vn],styles:[".auth-setting-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem;padding:1.5rem;max-width:640px}.auth-setting-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.4rem;background:none;border:none;cursor:pointer;color:var(--color-text-secondary);font-size:.85rem;padding:0}.auth-setting-form__back[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.auth-setting-form__back-icon[_ngcontent-%COMP%]{font-size:1rem}.auth-setting-form__title[_ngcontent-%COMP%]{font-size:1.4rem;font-weight:600;color:var(--color-text);margin:0}.auth-setting-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem}.auth-setting-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.auth-setting-form__scope[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem;display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__scope[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__scope-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;font-size:.9rem;color:var(--color-text)}.auth-setting-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem}.auth-setting-form__field-hint[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);margin:0;line-height:1.4}.auth-setting-form__label[_ngcontent-%COMP%]{font-size:.85rem;font-weight:500;color:var(--color-text-secondary)}.auth-setting-form__input[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;transition:border-color .15s ease;width:100%;box-sizing:border-box}.auth-setting-form__input[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__input--secret[_ngcontent-%COMP%]{font-family:monospace;letter-spacing:.05em}.auth-setting-form__select[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;cursor:pointer;transition:border-color .15s ease}.auth-setting-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__credentials[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem 1rem;display:flex;flex-direction:column;gap:.75rem;margin:0}.auth-setting-form__credentials[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__credentials-hint[_ngcontent-%COMP%]{font-size:.78rem;color:var(--color-text-secondary);margin:0}.auth-setting-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center;padding-top:.5rem}.auth-setting-form__btn[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem 1.25rem;cursor:pointer;font-size:.9rem;font-weight:500;background:var(--color-bg-secondary);color:var(--color-text);transition:background .15s ease}.auth-setting-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover)}.auth-setting-form__btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.auth-setting-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-on-primary, #fff);border-color:var(--color-primary)}.auth-setting-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, var(--color-primary))}"]})};
2
2
  export{le as AuthSettingFormComponent};
@@ -0,0 +1 @@
1
+ import {i,O,U as U$1,h as vi,x as xi,P,M}from'./chunk-BEMVRmeG.js';import {p,c as It,M as Me,a5 as k,P as De,i as ie,Q as Ae,v as vf,z as za,f as dc,C as Cf,r as r_,h as hT,a as yb,t as tv,d as pT,N as NT,I as Iv,B as yT,D as vT,e as bT,u as uc,k as ig,m as sg}from'./main-NXEJVT36.js';var $=(n,t)=>t.id??t.name;function V(n,t){if(n&1&&(za(0,"p",3),r_(1),Cf()),n&2){let e=NT();yb(),Iv(e.deletion.error());}}function N(n,t){n&1&&(za(0,"p",4),r_(1,"Loading AI providers\u2026"),Cf());}function z(n,t){n&1&&(za(0,"p",5),r_(1,"No platform AI providers defined yet."),Cf());}function j(n,t){n&1&&(za(0,"p",4),r_(1,"No AI providers match the current filter."),Cf());}function U(n,t){if(n&1){let e=bT();za(0,"button",19),dc("click",function(){ig(e);let d=NT().$implicit,c=NT(2);return sg(c.edit(d))}),r_(1," Edit "),Cf();}if(n&2){let e=NT().$implicit;uc("aria-label","Edit "+e.name);}}function B(n,t){if(n&1){let e=bT();za(0,"agentos-row-delete-action",20),dc("request",function(){ig(e);let d=NT().$implicit,c=NT(2);return sg(c.deletion.request(d.id))})("confirm",function(){ig(e);let d=NT().$implicit,c=NT(2);return sg(c.confirmDelete(d))})("cancel",function(){ig(e);let d=NT(3);return sg(d.deletion.cancel())}),Cf();}if(n&2){let e=NT().$implicit,r=NT(2);tv("rowKey",e.id)("rowLabel",e.name)("state",r.deletion);}}function K(n,t){if(n&1&&(za(0,"tr",9)(1,"td",12),r_(2),Cf(),za(3,"td",13),r_(4),Cf(),za(5,"td",14),r_(6),Cf(),za(7,"td",15)(8,"div",16),hT(9,U,2,1,"button",17),hT(10,B,1,3,"agentos-row-delete-action",18),Cf()()()),n&2){let e=t.$implicit,r=NT(2);yb(2),Iv(e.name),yb(2),Iv(e.apiType),yb(2),Iv(e.baseUrl||"\u2014"),yb(3),pT(r.deletion.confirmingId()!==e.id?9:-1),yb(),pT(e.id?10:-1);}}function H(n,t){if(n&1&&(za(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),r_(5,"Name"),Cf(),za(6,"th",10),r_(7,"API type"),Cf(),za(8,"th",10),r_(9,"Base URL"),Cf(),za(10,"th",10)(11,"span",11),r_(12,"Actions"),Cf()()()(),za(13,"tbody",8),yT(14,K,11,5,"tr",9,$),Cf()()()),n&2){let e=NT();yb(14),vT(e.rowFilter.filteredRows());}}var R=class n{router=p(It);destroyRef=p(Me);aiProviderController=p(k);refresh$=new De(void 0);isLoading=ie(true);deletion=i();providers=ie([]);rowFilter=O(this.providers,t=>[t.name,t.apiType,t.baseUrl].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(Ae(()=>(this.isLoading.set(true),this.aiProviderController.listAiProvider("none"))),U$1(this.destroyRef)).subscribe({next:t=>{this.providers.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","ai-providers","new"]);}edit(t){t.id&&this.router.navigate(["/agentos","admin","ai-providers",t.id,"edit"]);}confirmDelete(t){t.id&&this.deletion.execute(t.id,{request$:this.aiProviderController.deleteAiProvider(t.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${t.name}" failed. Try again.`});}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=vf({type:n,selectors:[["agentos-platform-ai-providers"]],decls:9,vars:3,consts:[["title","Platform AI providers","description","AI providers shared across every namespace."],["label","Filter AI providers","placeholder","Filter AI providers\u2026",3,"queryChange","query"],["type","button",1,"settings-table__new",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform AI providers"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","API type"],["role","cell","data-label","Base URL",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"request","confirm","cancel","rowKey","rowLabel","state"]],template:function(e,r){e&1&&(za(0,"ds-section-header",0)(1,"agentos-table-filter",1),dc("queryChange",function(c){return r.rowFilter.query.set(c)}),Cf(),za(2,"button",2),dc("click",function(){return r.openCreateForm()}),r_(3,"New AI provider"),Cf()(),hT(4,V,2,1,"p",3),hT(5,N,2,0,"p",4)(6,z,2,0,"p",5)(7,j,2,0,"p",4)(8,H,16,0,"div",6)),e&2&&(yb(),tv("query",r.rowFilter.query()),yb(3),pT(r.deletion.error()?4:-1),yb(),pT(r.isLoading()?5:r.providers().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[vi,xi,P,M],styles:['.settings-table__new[_ngcontent-%COMP%]{padding:7px 12px;border:1px solid var(--color-accent);border-radius:0;background:var(--color-accent);color:var(--color-bg);cursor:pointer;font-family:var(--font-heading);font-size:14px;font-weight:600;white-space:nowrap}.settings-table__new[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:2px}.settings-table__toolbar[_ngcontent-%COMP%]{display:flex;align-items:center;flex-wrap:wrap;gap:12px;margin:0 0 1rem}.settings-table__toolbar[_ngcontent-%COMP%] agentos-table-filter[_ngcontent-%COMP%]{margin:0;flex:0 1 240px;min-width:80px}.settings-table__toolbar[_ngcontent-%COMP%] .settings-table__new[_ngcontent-%COMP%]{margin-left:auto}.settings-table__toolbar-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;margin-left:auto}.settings-table__toolbar-actions[_ngcontent-%COMP%] agentos-table-filter[_ngcontent-%COMP%]{flex:0 1 240px;min-width:80px}.settings-table__toolbar-actions[_ngcontent-%COMP%] .settings-table__new[_ngcontent-%COMP%]{margin-left:0;white-space:nowrap}.settings-table__status[_ngcontent-%COMP%]{margin:20px 8px;color:var(--color-text-secondary)}.settings-table__error[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:.875rem;color:var(--color-error)}.settings-table__wrap[_ngcontent-%COMP%]{overflow-x:auto}table.ds-table[_ngcontent-%COMP%]{width:100%;border-collapse:collapse;font-size:14px}table.ds-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid var(--color-divider);color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-align:left;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid color-mix(in srgb,var(--color-text) 8%,transparent)}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.settings-table__name[_ngcontent-%COMP%]{font-weight:500}.settings-table__secondary[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.settings-table__stacked[_ngcontent-%COMP%]{display:block}.settings-table__tags[_ngcontent-%COMP%]{display:flex;gap:4px;flex-wrap:wrap}.settings-table__actions[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end;gap:4px;white-space:nowrap}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:4px 7px;border:1px solid transparent;background:transparent;color:var(--color-accent);cursor:pointer;font:inherit}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-100)}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:1px}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:disabled{color:var(--color-neutral-600);cursor:default}.settings-table__actions[_ngcontent-%COMP%] .settings-table__delete[_ngcontent-%COMP%]{color:var(--color-error)}@media(max-width:760px){.settings-table__toolbar[_ngcontent-%COMP%]{flex-direction:column;align-items:stretch;gap:12px}.settings-table__toolbar-actions[_ngcontent-%COMP%]{flex-direction:column;align-items:stretch;width:100%;margin-left:0}.settings-table__toolbar-actions[_ngcontent-%COMP%] agentos-table-filter[_ngcontent-%COMP%]{flex:none;width:100%;min-width:0}.settings-table__toolbar-actions[_ngcontent-%COMP%] .settings-table__new[_ngcontent-%COMP%]{width:100%;min-height:44px}}@media(max-width:760px){table.ds-table[_ngcontent-%COMP%]{position:relative;display:block;width:100%}table.ds-table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:14px;padding-top:12px}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%], table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{display:flex;flex-direction:column;padding:12px;background:var(--color-surface);border:1px solid var(--color-divider)}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{display:grid;grid-template-columns:minmax(88px,30%) minmax(0,1fr);align-items:baseline;gap:4px 12px;padding:5px 0;border-bottom:0;overflow-wrap:anywhere;white-space:normal}table.ds-table[_ngcontent-%COMP%] td[data-label][_ngcontent-%COMP%]:before{content:attr(data-label);content:attr(data-label) / "";color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[data-title][_ngcontent-%COMP%]{display:block;margin-bottom:4px;padding:0 0 6px;border-bottom:0;font-size:15px}table.ds-table[_ngcontent-%COMP%] td[data-title][_ngcontent-%COMP%]:before{display:none}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:4px;margin-top:6px;padding:10px 0 0;border-top:1px solid var(--color-divider);text-align:right}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%]:before{display:none}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%] .settings-table__actions[_ngcontent-%COMP%]{flex-wrap:wrap;width:100%;white-space:normal}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%] button[_ngcontent-%COMP%]{min-width:44px;min-height:44px;padding:0 12px}}.settings-table__confirm-label[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:13px}.sr-only[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}']})};export{R as PlatformAiProvidersComponent};
@@ -1 +1 @@
1
- import {i}from'./chunk-D5G8zkh6.js';import {l}from'./chunk-CVRn6LsT.js';import {p,a5 as k,P as De,af as Ms,Q as Ae,aq as gw,_,L as Le,w,n as R,a0 as Wn,an as j}from'./main-C5P4R2SK.js';var g="none",N="me",O=class p$1{nsController=p(k);userState=p(l);refresh$=new De(void 0);namespaceId$=new De(null);vm$=Ms([this.namespaceId$,this.refresh$]).pipe(Ae(([e])=>{let r=this.loadPlatformProviders().pipe(Wn(()=>_([])));return e?Ms([r,this.loadNamespaceProviders(e).pipe(Wn(()=>_([]))),this.loadUserProviders(e).pipe(Wn(()=>_([]))),this.loadUserProviders("global").pipe(Wn(()=>_([])))]).pipe(j(([i,n,s,t])=>({platform:i,namespace:n,userOnNs:s,userGlobal:t}))):Ms([r,this.loadNamespaceProviders("").pipe(Wn(()=>_([]))),this.loadUserProviders("global").pipe(Wn(()=>_([])))]).pipe(j(([i,n,s])=>({platform:i,namespace:n,userOnNs:[],userGlobal:s})))}),gw({bufferSize:1,refCount:true}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e);}refresh(){this.refresh$.next();}loadUserProviders(e){let r=e==="global"?g:e;return this.nsController.listAiProvider(r,N)}userGlobal$=i(this.refresh$,()=>this.loadUserProviders("global"),[]);loadPlatformProviders(){return this.nsController.listAiProvider(g)}loadNamespaceProviders(e){return e?this.nsController.listAiProvider(e):_([])}getById(e,r){return this.nsController.getByIdAiProvider(e)}create(e,r,i){let s=this.userState.currentUser()?.id;if((r==="userOnNs"||r==="userGlobal")&&!s)throw new Error(`Cannot create ${r} provider before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(r==="namespace"){if(i===void 0||i==="")throw new Error("Cannot create namespace-scoped provider without a namespaceId");let S={name:e.name,apiType:e.apiType,description:e.description,baseUrl:e.baseUrl,apiKey:e.apiKey,headers:e.headers??void 0,namespaceId:i??void 0};return this.nsController.createAiProvider(S).pipe(Le(()=>this.refresh()))}if(r==="userOnNs"&&!i)throw new Error("Cannot create userOnNs provider without a namespaceId");let t={name:e.name,apiType:e.apiType,description:e.description,baseUrl:e.baseUrl,apiKey:e.apiKey,headers:e.headers??void 0,userId:s,namespaceId:r==="userOnNs"?i:void 0};return this.nsController.createAiProvider(t).pipe(Le(()=>this.refresh()))}update(e,r,i,n){let s=r.apiKey===null?{}:{apiKey:r.apiKey},t=w({name:r.name,apiType:r.apiType,description:r.description,baseUrl:r.baseUrl,headers:r.headers??void 0,namespaceId:n.namespaceId,userId:n.userId},s);return this.nsController.updateAiProvider(e,t).pipe(Le(()=>this.refresh()))}delete(e,r){return this.nsController.deleteAiProvider(e).pipe(Le(()=>this.refresh()))}static \u0275fac=function(r){return new(r||p$1)};static \u0275prov=R({token:p$1,factory:p$1.\u0275fac,providedIn:"root"})};export{O};
1
+ import {i}from'./chunk-tJcOqYO8.js';import {l}from'./chunk-BEMVRmeG.js';import {p,a5 as k,P as De,af as Ms,Q as Ae,aq as gw,_,L as Le,w,n as R,a0 as Wn,an as j}from'./main-NXEJVT36.js';var g="none",N="me",O=class p$1{nsController=p(k);userState=p(l);refresh$=new De(void 0);namespaceId$=new De(null);vm$=Ms([this.namespaceId$,this.refresh$]).pipe(Ae(([e])=>{let r=this.loadPlatformProviders().pipe(Wn(()=>_([])));return e?Ms([r,this.loadNamespaceProviders(e).pipe(Wn(()=>_([]))),this.loadUserProviders(e).pipe(Wn(()=>_([]))),this.loadUserProviders("global").pipe(Wn(()=>_([])))]).pipe(j(([i,n,s,t])=>({platform:i,namespace:n,userOnNs:s,userGlobal:t}))):Ms([r,this.loadNamespaceProviders("").pipe(Wn(()=>_([]))),this.loadUserProviders("global").pipe(Wn(()=>_([])))]).pipe(j(([i,n,s])=>({platform:i,namespace:n,userOnNs:[],userGlobal:s})))}),gw({bufferSize:1,refCount:true}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e);}refresh(){this.refresh$.next();}loadUserProviders(e){let r=e==="global"?g:e;return this.nsController.listAiProvider(r,N)}userGlobal$=i(this.refresh$,()=>this.loadUserProviders("global"),[]);loadPlatformProviders(){return this.nsController.listAiProvider(g)}loadNamespaceProviders(e){return e?this.nsController.listAiProvider(e):_([])}getById(e,r){return this.nsController.getByIdAiProvider(e)}create(e,r,i){let s=this.userState.currentUser()?.id;if((r==="userOnNs"||r==="userGlobal")&&!s)throw new Error(`Cannot create ${r} provider before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(r==="namespace"){if(i===void 0||i==="")throw new Error("Cannot create namespace-scoped provider without a namespaceId");let S={name:e.name,apiType:e.apiType,description:e.description,baseUrl:e.baseUrl,apiKey:e.apiKey,headers:e.headers??void 0,namespaceId:i??void 0};return this.nsController.createAiProvider(S).pipe(Le(()=>this.refresh()))}if(r==="userOnNs"&&!i)throw new Error("Cannot create userOnNs provider without a namespaceId");let t={name:e.name,apiType:e.apiType,description:e.description,baseUrl:e.baseUrl,apiKey:e.apiKey,headers:e.headers??void 0,userId:s,namespaceId:r==="userOnNs"?i:void 0};return this.nsController.createAiProvider(t).pipe(Le(()=>this.refresh()))}update(e,r,i,n){let s=r.apiKey===null?{}:{apiKey:r.apiKey},t=w({name:r.name,apiType:r.apiType,description:r.description,baseUrl:r.baseUrl,headers:r.headers??void 0,namespaceId:n.namespaceId,userId:n.userId},s);return this.nsController.updateAiProvider(e,t).pipe(Le(()=>this.refresh()))}delete(e,r){return this.nsController.deleteAiProvider(e).pipe(Le(()=>this.refresh()))}static \u0275fac=function(r){return new(r||p$1)};static \u0275prov=R({token:p$1,factory:p$1.\u0275fac,providedIn:"root"})};export{O};