@whoz-oss/coday-client 0.0.0-workstream-forge.237 → 0.0.0-workstream-forge.238

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 (50) hide show
  1. package/browser/{chunk-BzHtPq4J.js → chunk-3Mu1CwGQ.js} +1 -1
  2. package/browser/{chunk-BXNum5Uv.js → chunk-4Qu3PeXh.js} +1 -1
  3. package/browser/{chunk-BiTjjS7f.js → chunk-B0TP-VcL.js} +1 -1
  4. package/browser/{chunk-CMTE1K7b.js → chunk-B98jntj8.js} +1 -1
  5. package/browser/{chunk-BRida568.js → chunk-BJQFMO9C.js} +1 -1
  6. package/browser/{chunk-DdQVnFkx.js → chunk-BKu1hxzv.js} +1 -1
  7. package/browser/chunk-BcBIZEZM.js +1 -0
  8. package/browser/{chunk-AyHTO4Sx.js → chunk-BtXpRuOX.js} +1 -1
  9. package/browser/{chunk-BxmI0rEJ.js → chunk-C6f8vXFe.js} +1 -1
  10. package/browser/{chunk-DWhB9E6K.js → chunk-CAFGZIDY.js} +1 -1
  11. package/browser/{chunk-Ncao0R2n.js → chunk-CFzCpWz-.js} +12 -12
  12. package/browser/{chunk-ClfOew6l.js → chunk-CGS23_n4.js} +1 -1
  13. package/browser/{chunk-CFbt2W-4.js → chunk-CP-wBH0B.js} +1 -1
  14. package/browser/{chunk-DgjvisKR.js → chunk-CS0402GI.js} +1 -1
  15. package/browser/{chunk-B1vEKrz_.js → chunk-CVVVa3NL.js} +1 -1
  16. package/browser/{chunk-BXWcQ9nJ.js → chunk-C_1WQz37.js} +1 -1
  17. package/browser/{chunk-Dv--4A7A.js → chunk-C_cUx8TW.js} +1 -1
  18. package/browser/{chunk-D6Jd9h9a.js → chunk-D-5QxzwU.js} +1 -1
  19. package/browser/{chunk-kgDzsPcI.js → chunk-D1yRNu41.js} +1 -1
  20. package/browser/{chunk-CQe9V6Kx.js → chunk-D3UsWSII.js} +1 -1
  21. package/browser/{chunk-ldd-YZJ3.js → chunk-D6GAaaHQ.js} +1 -1
  22. package/browser/{chunk-Ck42W3Td.js → chunk-D7noK7K1.js} +1 -1
  23. package/browser/{chunk-Xi-gu1fS.js → chunk-DAzj31Q1.js} +1 -1
  24. package/browser/{chunk-h4Ucvwue.js → chunk-DFbrlwVp.js} +1 -1
  25. package/browser/{chunk-D4dSdxUc.js → chunk-DHRExHpH.js} +1 -1
  26. package/browser/{chunk-C9uCCw8u.js → chunk-DI3lyKCO.js} +1 -1
  27. package/browser/{chunk-BmA5vDQy.js → chunk-DQHXda6g.js} +1 -1
  28. package/browser/{chunk-DrL2kj2Q.js → chunk-DWnNoXF0.js} +1 -1
  29. package/browser/{chunk-DKozzs8J.js → chunk-DYWY5OhH.js} +1 -1
  30. package/browser/{chunk-Dsli5F3b.js → chunk-DhIZi4oj.js} +1 -1
  31. package/browser/{chunk-CxGrMAsv.js → chunk-DmahkUjc.js} +1 -1
  32. package/browser/{chunk-CWVqBlP_.js → chunk-DoM0k8h_.js} +1 -1
  33. package/browser/{chunk-B-B5NvWL.js → chunk-DrNFetgE.js} +1 -1
  34. package/browser/{chunk-pTZfve8g.js → chunk-Ds5mQ2wb.js} +1 -1
  35. package/browser/{chunk-DGjD1lCO.js → chunk-Duwy1SeF.js} +1 -1
  36. package/browser/{chunk-DZLxIPvO.js → chunk-DzdjH73a.js} +1 -1
  37. package/browser/{chunk-DHNEs7J8.js → chunk-GlyHtVZI.js} +1 -1
  38. package/browser/{chunk-CuBq-gTP.js → chunk-J5EbAnQd.js} +1 -1
  39. package/browser/{chunk-HNne7KzG.js → chunk-LuLnPYyM.js} +1 -1
  40. package/browser/{chunk-D0VIctP9.js → chunk-LxdeFBP9.js} +1 -1
  41. package/browser/{chunk-2_zz7NAC.js → chunk-UZMqdHVD.js} +1 -1
  42. package/browser/{chunk-CJA7LP9I.js → chunk-tE_dMycD.js} +1 -1
  43. package/browser/{chunk-CRTm3TW7.js → chunk-wfyLfMEx.js} +1 -1
  44. package/browser/{chunk-jbtuI0D4.js → chunk-xNK5FyFm.js} +1 -1
  45. package/browser/{chunk-1eRn_62f.js → chunk-yjjjr8V4.js} +1 -1
  46. package/browser/{chunk-B6qP3Hvp.js → chunk-zFiPZAOG.js} +1 -1
  47. package/browser/index.html +1 -1
  48. package/browser/{main-6MVJZWGK.js → main-OK5QY7NU.js} +1 -1
  49. package/package.json +1 -1
  50. package/browser/chunk-DbZbECFq.js +0 -1
@@ -1 +1 @@
1
- import {e}from'./chunk-C6dIhkYp.js';import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-B6qP3Hvp.js';import {O}from'./chunk-Xi-gu1fS.js';import {g,W as W$1,q as F,I as we,H as J,$ as $i,K as U$1,ad as ne$1,a1 as ga,aa as br,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,P as dg,b as BE,c as Bw,t as eC,F as Fg,U as Uw,k as $w,s as Dl,Y as Yw,l as lg,u as pf,w as hf}from'./main-6MVJZWGK.js';import {z as k,O as O$1,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-Ncao0R2n.js';import'./chunk-DbZbECFq.js';var Q=(n,e)=>e.key;function W(n,e){if(n&1&&(Es(0,"p",3),xC(1),hl()),n&2){let t=eC();BE(),Fg(t.deletion.error());}}function X(n,e){n&1&&(Es(0,"p",4),xC(1,"Loading integrations\u2026"),hl());}function Z(n,e){n&1&&(Es(0,"p",5),xC(1,"No integrations available."),hl());}function ee(n,e){n&1&&(Es(0,"p",4),xC(1,"No integrations match the current filter."),hl());}function te(n,e){n&1&&(Es(0,"ds-tag",20),xC(1,"YAML"),hl(),Es(2,"ds-tag",21),xC(3,"Read-only"),hl());}function ne(n,e){if(n&1){let t=Yw();Es(0,"button",22),vg("click",function(){pf(t);let s=eC().$implicit,c=eC(2);return hf(c.view(s))}),xC(1,"View"),hl();}if(n&2){let t=eC().$implicit;lg("aria-label","View "+t.config.name);}}function ie(n,e){if(n&1){let t=Yw();Es(0,"button",22),vg("click",function(){pf(t);let s=eC(3).$implicit,c=eC(2);return hf(c.edit(s))}),xC(1," Edit "),hl();}if(n&2){let t=eC(3).$implicit;lg("aria-label","Edit "+t.config.name);}}function oe(n,e){if(n&1){let t=Yw();Es(0,"button",22),vg("click",function(){pf(t);let s=eC(2).$implicit,c=eC(2);return hf(c.duplicate(s))}),xC(1," Duplicate "),hl(),jw(2,ie,2,1,"button",19);}if(n&2){let t=eC(2).$implicit;lg("aria-label","Duplicate "+t.config.name),BE(2),Bw(t.canEdit?2:-1);}}function ae(n,e){if(n&1){let t=Yw();Es(0,"agentos-row-delete-action",25),vg("deleteRequested",function(){pf(t);let s=eC(2).$implicit,c=eC(2);return hf(c.deletion.request(s.key))})("deleteConfirmed",function(){pf(t);let s=eC(2).$implicit,c=eC(2);return hf(c.confirmDelete(s))})("deleteCancelled",function(){pf(t);let s=eC(4);return hf(s.deletion.cancel())}),hl();}if(n&2){let t=eC(2).$implicit,a=eC(2);dg("rowKey",t.key)("rowLabel",t.config.name)("state",a.deletion);}}function re(n,e){n&1&&(Es(0,"button",24),xC(1,"Inherited"),hl());}function le(n,e){if(n&1&&(jw(0,oe,3,2),jw(1,ae,1,3,"agentos-row-delete-action",23),jw(2,re,2,0,"button",24)),n&2){let t=eC().$implicit,a=eC(2);Bw(a.deletion.confirmingId()!==t.key?0:-1),BE(),Bw(t.canDelete?1:-1),BE(),Bw(!t.canEdit&&!t.canDelete?2:-1);}}function se(n,e){if(n&1&&(Es(0,"tr",9)(1,"td",12),xC(2),hl(),Es(3,"td",13),xC(4),hl(),Es(5,"td",14)(6,"div",15)(7,"ds-tag",16),xC(8),hl(),jw(9,te,4,0),hl()(),Es(10,"td",17)(11,"div",18),jw(12,ne,2,1,"button",19)(13,le,3,3),hl()()()),n&2){let t=e.$implicit;BE(2),Fg(t.config.name),BE(2),Dl(" ",t.config.integrationType," "),BE(3),dg("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),BE(),Dl(" ",t.scopeLabel," "),BE(),Bw(t.source==="FILESYSTEM"?9:-1),BE(3),Bw(t.source==="FILESYSTEM"?12:13);}}function ce(n,e){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Type"),hl(),Es(8,"th",10),xC(9,"Scope"),hl(),Es(10,"th",10)(11,"span",11),xC(12,"Actions"),hl()()()(),Es(13,"tbody",8),Uw(14,se,14,6,"tr",9,Q),hl()()()),n&2){let t=eC();BE(14),$w(t.rowFilter.filteredRows());}}var U=class n$1{route=g(W$1);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceApi=g(J);namespaceId=this.route.snapshot.params.namespaceId;namespaceName=$i("this namespace");isAdmin=$i(false);isLoading=$i(true);rows=$i([]);deletion=k();rowFilter=O$1(this.rows,e=>[e.config.name,e.config.integrationType,e.scopeLabel,e.source].join(" "));ngOnInit(){this.state.setNamespace(this.namespaceId),this.namespaceId&&this.namespaceApi.getByIdNamespace(this.namespaceId).pipe(U$1(this.destroyRef)).subscribe({next:e=>this.namespaceName.set(e.name)}),this.route.paramMap.pipe(ne$1(e=>e.get("namespaceId")??""),ga(e=>e?this.namespaceRole.isAdminOfNamespace$(e):br(false)),U$1(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.rows.set(this.toRows(e)),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:n(this.isAdmin())}});}view(e){e.config.id&&this.router.navigate(["/agentos",this.namespaceId,"integrations",e.config.id,"view"]);}edit(e){!e.canEdit||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"integrations",e.config.id,"edit"],{queryParams:{scope:e.scope}});}duplicate(e){if(e.source==="FILESYSTEM"||!e.config.id)return;let a=(e.scope==="platform"||e.scope==="namespace")&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:a,template:e.config.id,templateScope:e.scope}});}confirmDelete(e){!e.canDelete||!e.config.id||this.deletion.execute(e.key,{request$:this.state.delete(e.config.id,e.scope).pipe(U$1(this.destroyRef)),errorMessage:`Deleting "${e.config.name}" failed. Try again.`});}toRows(e){return [...this.mapScope(e.platform,"platform","Platform",true),...this.mapScope(e.namespace,"namespace","Namespace",!this.isAdmin()),...this.mapScope(e.userOnNs,"userOnNs","Personal",false),...this.mapScope(e.userGlobal,"userGlobal","Personal",false)]}mapScope(e$1,t,a,s){return e$1.map((c,z)=>{let h=e(c),w=h==="NEO4J"&&!s;return {key:`${t}:${c.id??z}`,config:c,scope:t,scopeLabel:a,source:h,canEdit:w,canDelete:w}})}static \u0275fac=function(t){return new(t||n$1)};static \u0275cmp=vw({type:n$1,selectors:[["agentos-integrations-all-scopes"]],decls:9,vars:4,consts:[["title","Integrations",3,"description"],["label","Filter integrations","placeholder","Filter integrations\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","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","Scope"],[1,"settings-table__tags"],[3,"variant"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["variant","neutral"],["variant","outline"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button","disabled",""],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,a){t&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return a.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return a.openCreateForm()}),xC(3,"New integration"),hl()(),jw(4,W,2,1,"p",3),jw(5,X,2,0,"p",4)(6,Z,2,0,"p",5)(7,ee,2,0,"p",4)(8,ce,16,0,"div",6)),t&2&&(dg("description","Integrations for "+a.namespaceName()+", including entries inherited from the platform."),BE(),dg("query",a.rowFilter.query()),BE(3),Bw(a.deletion.error()?4:-1),BE(),Bw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{U as IntegrationsAllScopesComponent};
1
+ import {e}from'./chunk-C6dIhkYp.js';import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-zFiPZAOG.js';import {O}from'./chunk-DAzj31Q1.js';import {g,W as W$1,q as F,I as we,H as J,$ as $i,K as U$1,ad as ne$1,a1 as ga,aa as br,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,P as dg,b as BE,c as Bw,t as eC,F as Fg,U as Uw,k as $w,s as Dl,Y as Yw,l as lg,u as pf,w as hf}from'./main-OK5QY7NU.js';import {z as k,O as O$1,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-CFzCpWz-.js';import'./chunk-BcBIZEZM.js';var Q=(n,e)=>e.key;function W(n,e){if(n&1&&(Es(0,"p",3),xC(1),hl()),n&2){let t=eC();BE(),Fg(t.deletion.error());}}function X(n,e){n&1&&(Es(0,"p",4),xC(1,"Loading integrations\u2026"),hl());}function Z(n,e){n&1&&(Es(0,"p",5),xC(1,"No integrations available."),hl());}function ee(n,e){n&1&&(Es(0,"p",4),xC(1,"No integrations match the current filter."),hl());}function te(n,e){n&1&&(Es(0,"ds-tag",20),xC(1,"YAML"),hl(),Es(2,"ds-tag",21),xC(3,"Read-only"),hl());}function ne(n,e){if(n&1){let t=Yw();Es(0,"button",22),vg("click",function(){pf(t);let s=eC().$implicit,c=eC(2);return hf(c.view(s))}),xC(1,"View"),hl();}if(n&2){let t=eC().$implicit;lg("aria-label","View "+t.config.name);}}function ie(n,e){if(n&1){let t=Yw();Es(0,"button",22),vg("click",function(){pf(t);let s=eC(3).$implicit,c=eC(2);return hf(c.edit(s))}),xC(1," Edit "),hl();}if(n&2){let t=eC(3).$implicit;lg("aria-label","Edit "+t.config.name);}}function oe(n,e){if(n&1){let t=Yw();Es(0,"button",22),vg("click",function(){pf(t);let s=eC(2).$implicit,c=eC(2);return hf(c.duplicate(s))}),xC(1," Duplicate "),hl(),jw(2,ie,2,1,"button",19);}if(n&2){let t=eC(2).$implicit;lg("aria-label","Duplicate "+t.config.name),BE(2),Bw(t.canEdit?2:-1);}}function ae(n,e){if(n&1){let t=Yw();Es(0,"agentos-row-delete-action",25),vg("deleteRequested",function(){pf(t);let s=eC(2).$implicit,c=eC(2);return hf(c.deletion.request(s.key))})("deleteConfirmed",function(){pf(t);let s=eC(2).$implicit,c=eC(2);return hf(c.confirmDelete(s))})("deleteCancelled",function(){pf(t);let s=eC(4);return hf(s.deletion.cancel())}),hl();}if(n&2){let t=eC(2).$implicit,a=eC(2);dg("rowKey",t.key)("rowLabel",t.config.name)("state",a.deletion);}}function re(n,e){n&1&&(Es(0,"button",24),xC(1,"Inherited"),hl());}function le(n,e){if(n&1&&(jw(0,oe,3,2),jw(1,ae,1,3,"agentos-row-delete-action",23),jw(2,re,2,0,"button",24)),n&2){let t=eC().$implicit,a=eC(2);Bw(a.deletion.confirmingId()!==t.key?0:-1),BE(),Bw(t.canDelete?1:-1),BE(),Bw(!t.canEdit&&!t.canDelete?2:-1);}}function se(n,e){if(n&1&&(Es(0,"tr",9)(1,"td",12),xC(2),hl(),Es(3,"td",13),xC(4),hl(),Es(5,"td",14)(6,"div",15)(7,"ds-tag",16),xC(8),hl(),jw(9,te,4,0),hl()(),Es(10,"td",17)(11,"div",18),jw(12,ne,2,1,"button",19)(13,le,3,3),hl()()()),n&2){let t=e.$implicit;BE(2),Fg(t.config.name),BE(2),Dl(" ",t.config.integrationType," "),BE(3),dg("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),BE(),Dl(" ",t.scopeLabel," "),BE(),Bw(t.source==="FILESYSTEM"?9:-1),BE(3),Bw(t.source==="FILESYSTEM"?12:13);}}function ce(n,e){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Type"),hl(),Es(8,"th",10),xC(9,"Scope"),hl(),Es(10,"th",10)(11,"span",11),xC(12,"Actions"),hl()()()(),Es(13,"tbody",8),Uw(14,se,14,6,"tr",9,Q),hl()()()),n&2){let t=eC();BE(14),$w(t.rowFilter.filteredRows());}}var U=class n$1{route=g(W$1);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceApi=g(J);namespaceId=this.route.snapshot.params.namespaceId;namespaceName=$i("this namespace");isAdmin=$i(false);isLoading=$i(true);rows=$i([]);deletion=k();rowFilter=O$1(this.rows,e=>[e.config.name,e.config.integrationType,e.scopeLabel,e.source].join(" "));ngOnInit(){this.state.setNamespace(this.namespaceId),this.namespaceId&&this.namespaceApi.getByIdNamespace(this.namespaceId).pipe(U$1(this.destroyRef)).subscribe({next:e=>this.namespaceName.set(e.name)}),this.route.paramMap.pipe(ne$1(e=>e.get("namespaceId")??""),ga(e=>e?this.namespaceRole.isAdminOfNamespace$(e):br(false)),U$1(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.rows.set(this.toRows(e)),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:n(this.isAdmin())}});}view(e){e.config.id&&this.router.navigate(["/agentos",this.namespaceId,"integrations",e.config.id,"view"]);}edit(e){!e.canEdit||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"integrations",e.config.id,"edit"],{queryParams:{scope:e.scope}});}duplicate(e){if(e.source==="FILESYSTEM"||!e.config.id)return;let a=(e.scope==="platform"||e.scope==="namespace")&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:a,template:e.config.id,templateScope:e.scope}});}confirmDelete(e){!e.canDelete||!e.config.id||this.deletion.execute(e.key,{request$:this.state.delete(e.config.id,e.scope).pipe(U$1(this.destroyRef)),errorMessage:`Deleting "${e.config.name}" failed. Try again.`});}toRows(e){return [...this.mapScope(e.platform,"platform","Platform",true),...this.mapScope(e.namespace,"namespace","Namespace",!this.isAdmin()),...this.mapScope(e.userOnNs,"userOnNs","Personal",false),...this.mapScope(e.userGlobal,"userGlobal","Personal",false)]}mapScope(e$1,t,a,s){return e$1.map((c,z)=>{let h=e(c),w=h==="NEO4J"&&!s;return {key:`${t}:${c.id??z}`,config:c,scope:t,scopeLabel:a,source:h,canEdit:w,canDelete:w}})}static \u0275fac=function(t){return new(t||n$1)};static \u0275cmp=vw({type:n$1,selectors:[["agentos-integrations-all-scopes"]],decls:9,vars:4,consts:[["title","Integrations",3,"description"],["label","Filter integrations","placeholder","Filter integrations\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","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","Scope"],[1,"settings-table__tags"],[3,"variant"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["variant","neutral"],["variant","outline"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button","disabled",""],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,a){t&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return a.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return a.openCreateForm()}),xC(3,"New integration"),hl()(),jw(4,W,2,1,"p",3),jw(5,X,2,0,"p",4)(6,Z,2,0,"p",5)(7,ee,2,0,"p",4)(8,ce,16,0,"div",6)),t&2&&(dg("description","Integrations for "+a.namespaceName()+", including entries inherited from the platform."),BE(),dg("query",a.rowFilter.query()),BE(3),Bw(a.deletion.error()?4:-1),BE(),Bw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{U as IntegrationsAllScopesComponent};
@@ -1 +1 @@
1
- import {ab as N,d as pn,h as hn,e as cn,g as dn,C as mn,i as at,j as an}from'./chunk-Ncao0R2n.js';import {g,W,q as F,aU as D,ag as U,I as we,$ as $i,K as U$1,B,aV as gy,v as vw,E as Es,Q as vg,x as xC,a as hl,f as fg,j as jw,b as BE,P as dg,c as Bw,s as Dl,t as eC,F as Fg}from'./main-6MVJZWGK.js';function P(l,t){if(l&1&&(Es(0,"ds-notice"),xC(1),hl()),l&2){let n=eC();BE(),Fg(n.launchError());}}var T=class l{route=g(W);router=g(F);caseController=g(D);caseState=g(N);agentConfigController=g(U);destroyRef=g(we);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.params.agentConfigId;resolvedAgentConfig=null;payloadJson=$i("");launchError=$i(null);isLaunching=$i(false);isLoading=$i(false);ngOnInit(){this.isLoading.set(true),this.agentConfigController.getByIdAgentConfig(this.agentConfigId).pipe(U$1(this.destroyRef)).subscribe({next:t=>{this.resolvedAgentConfig=t,t.loopConfig!=null&&this.payloadJson.set(JSON.stringify(t.loopConfig,null,2)),this.isLoading.set(false);},error:()=>{this.isLoading.set(false);}});}launch(){return B(this,null,function*(){this.launchError.set(null),this.isLaunching.set(true);try{let t=this.resolvedAgentConfig??(yield gy(this.agentConfigController.getByIdAgentConfig(this.agentConfigId))),n=yield gy(this.caseController.createCase({namespaceId:this.namespaceId}));this.caseState.addCase(n);let e=n.id??"",d={content:`@${t.name} start`};yield gy(this.caseController.addMessageCase(e,d)),this.router.navigate(["/agentos/home"],{queryParams:{ns:this.namespaceId,case:e}});}catch(t){console.error("[AgentConfigLaunch] Failed to launch loop agent",t),this.launchError.set("Failed to launch the agent loop. Please check the console for details."),this.isLaunching.set(false);}})}back(){this.router.navigate(["/agentos",this.namespaceId,"agent-configs",this.agentConfigId,"edit"]);}static \u0275fac=function(n){return new(n||l)};static \u0275cmp=vw({type:l,selectors:[["agentos-agent-config-launch"]],decls:17,vars:6,consts:[["title","Launch loop agent"],["dsButton","","variant","ghost","type","button","title","Back to agent config",3,"click"],[1,"ds-hint"],["label","Loop configuration (read-only)","controlId","agent-loop-payload"],["dsControl","","mono","","id","agent-loop-payload","rows","15","readonly","","spellcheck","false","autocomplete","off",3,"value","disabled"],["dsButton","","variant","primary","type","button",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(n,e){n&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return e.back()}),xC(3," \u2190 Edit agent config "),hl()(),Es(4,"p",2),xC(5," The loop configuration below is read from "),Es(6,"code"),xC(7,"AgentConfig.loopConfig"),hl(),xC(8," and will be used by the backend when the agent loop starts. A new Case will be created and one child case will be launched per entity found. "),hl(),Es(9,"ds-form-field",3),fg(10,"textarea",4),hl(),jw(11,P,2,1,"ds-notice"),Es(12,"ds-form-actions")(13,"button",5),vg("click",function(){return e.launch()}),xC(14),hl(),Es(15,"button",6),vg("click",function(){return e.back()}),xC(16,"Cancel"),hl()()()),n&2&&(BE(10),dg("value",e.payloadJson())("disabled",e.isLaunching()||e.isLoading()),BE(),Bw(e.launchError()?11:-1),BE(2),dg("disabled",e.isLaunching()),BE(),Dl(" ",e.isLaunching()?"Launching\u2026":"Launch"," "),BE(),dg("disabled",e.isLaunching()));},dependencies:[pn,hn,cn,dn,mn,at,an],encapsulation:2})};export{T as AgentConfigLaunchComponent};
1
+ import {ab as N,d as pn,h as hn,e as cn,g as dn,C as mn,i as at,j as an}from'./chunk-CFzCpWz-.js';import {g,W,q as F,aU as D,ag as U,I as we,$ as $i,K as U$1,B,aV as gy,v as vw,E as Es,Q as vg,x as xC,a as hl,f as fg,j as jw,b as BE,P as dg,c as Bw,s as Dl,t as eC,F as Fg}from'./main-OK5QY7NU.js';function P(l,t){if(l&1&&(Es(0,"ds-notice"),xC(1),hl()),l&2){let n=eC();BE(),Fg(n.launchError());}}var T=class l{route=g(W);router=g(F);caseController=g(D);caseState=g(N);agentConfigController=g(U);destroyRef=g(we);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.params.agentConfigId;resolvedAgentConfig=null;payloadJson=$i("");launchError=$i(null);isLaunching=$i(false);isLoading=$i(false);ngOnInit(){this.isLoading.set(true),this.agentConfigController.getByIdAgentConfig(this.agentConfigId).pipe(U$1(this.destroyRef)).subscribe({next:t=>{this.resolvedAgentConfig=t,t.loopConfig!=null&&this.payloadJson.set(JSON.stringify(t.loopConfig,null,2)),this.isLoading.set(false);},error:()=>{this.isLoading.set(false);}});}launch(){return B(this,null,function*(){this.launchError.set(null),this.isLaunching.set(true);try{let t=this.resolvedAgentConfig??(yield gy(this.agentConfigController.getByIdAgentConfig(this.agentConfigId))),n=yield gy(this.caseController.createCase({namespaceId:this.namespaceId}));this.caseState.addCase(n);let e=n.id??"",d={content:`@${t.name} start`};yield gy(this.caseController.addMessageCase(e,d)),this.router.navigate(["/agentos/home"],{queryParams:{ns:this.namespaceId,case:e}});}catch(t){console.error("[AgentConfigLaunch] Failed to launch loop agent",t),this.launchError.set("Failed to launch the agent loop. Please check the console for details."),this.isLaunching.set(false);}})}back(){this.router.navigate(["/agentos",this.namespaceId,"agent-configs",this.agentConfigId,"edit"]);}static \u0275fac=function(n){return new(n||l)};static \u0275cmp=vw({type:l,selectors:[["agentos-agent-config-launch"]],decls:17,vars:6,consts:[["title","Launch loop agent"],["dsButton","","variant","ghost","type","button","title","Back to agent config",3,"click"],[1,"ds-hint"],["label","Loop configuration (read-only)","controlId","agent-loop-payload"],["dsControl","","mono","","id","agent-loop-payload","rows","15","readonly","","spellcheck","false","autocomplete","off",3,"value","disabled"],["dsButton","","variant","primary","type","button",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(n,e){n&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return e.back()}),xC(3," \u2190 Edit agent config "),hl()(),Es(4,"p",2),xC(5," The loop configuration below is read from "),Es(6,"code"),xC(7,"AgentConfig.loopConfig"),hl(),xC(8," and will be used by the backend when the agent loop starts. A new Case will be created and one child case will be launched per entity found. "),hl(),Es(9,"ds-form-field",3),fg(10,"textarea",4),hl(),jw(11,P,2,1,"ds-notice"),Es(12,"ds-form-actions")(13,"button",5),vg("click",function(){return e.launch()}),xC(14),hl(),Es(15,"button",6),vg("click",function(){return e.back()}),xC(16,"Cancel"),hl()()()),n&2&&(BE(10),dg("value",e.payloadJson())("disabled",e.isLaunching()||e.isLoading()),BE(),Bw(e.launchError()?11:-1),BE(2),dg("disabled",e.isLaunching()),BE(),Dl(" ",e.isLaunching()?"Launching\u2026":"Launch"," "),BE(),dg("disabled",e.isLaunching()));},dependencies:[pn,hn,cn,dn,mn,at,an],encapsulation:2})};export{T as AgentConfigLaunchComponent};
@@ -1 +1 @@
1
- import {o as o$1,r,i,l}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-2_zz7NAC.js';import {O}from'./chunk-Xi-gu1fS.js';import {g,W,q as F$1,I as we,ag as U,ay as N,$ as $i,az as K,a8 as _,r as rT,a9 as F$2,aA as qe$1,K as U$1,a2 as ha,aa as br,ac as by,ad as ne,N as x,L as w,v as vw,au as $t,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,c as Bw,t as eC,Y as Yw,f as fg,R as MI,S as xI,l as lg,s as Dl,U as Uw,k as $w,F as Fg,u as pf,w as hf,as as Pg}from'./main-6MVJZWGK.js';import {N as A,p as pt$1,T as Te,a as fn,Q as E,U as Ut,n as nd,b as bo,x as xo,L as Lt$1,k as kn,u as vn,G as Gt,m as mo,c as po,$ as $r,H as qr,V as Vn,A as An,d as pn,h as hn,e as cn,r as ln,g as dn,C as mn,i as at$1,j as an,t as rn,l as ko}from'./chunk-Ncao0R2n.js';import'./chunk-DbZbECFq.js';var F="*";function Be(n){return (n??[]).some(t=>t.trim()===F)}function $e(n){let t=(n??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==F).map(e=>e.toLowerCase());return new Set(t)}function j(n){return n.includes(F)}function He(n){let t=n.replace(/[\\.[\]{}()^$|]/g,"\\$&").replace(/\*/g,".*");try{return new RegExp(`^${t}$`,"i")}catch(e){return null}}function Y(n,t){return (t??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==F&&j(e)).some(e=>He(e)?.test(n)??false)}var Ge="AGENTOS_CONFIG",Je=new Set(["HTTP_API","MCP_HTTP","MCP_STDIO","BASH","TMUX","GIT"]);function Ue(n){return n.configEnabled&&(n.hasSubAgents||n.integrationTypes.some(t=>Je.has(t)))}var je=(n,t)=>t.value,Ye=(n,t)=>t.config.id,qe=(n,t)=>t.type,We=(n,t)=>t.selector;function ze(n,t){if(n&1&&(Es(0,"a",2),xC(1,"View resolved definition \u2192"),hl()),n&2){let e=eC();dg("routerLink",e.inspectRoute());}}function Xe(n,t){n&1&&(Es(0,"ds-tag",3),xC(1,"Platform level"),hl());}function Qe(n,t){n&1&&(Es(0,"p",4),xC(1,"Loading\u2026"),hl());}function Ze(n,t){if(n&1&&(fg(0,"input",17),MI()),n&2){let e=eC(2);dg("formControl",e.modelNameControl),xI();}}function et(n,t){if(n&1&&(Es(0,"option",41),xC(1),hl()),n&2){let e=t;dg("ngValue",e.value),BE(),Fg(e.label);}}function tt(n,t){if(n&1&&(Es(0,"option",41),xC(1),hl()),n&2){let e=t.$implicit;dg("ngValue",e.value),BE(),Fg(e.label);}}function nt(n,t){if(n&1&&(Es(0,"optgroup",42),Uw(1,tt,2,2,"option",41,je),hl()),n&2){let e=eC(3);BE(),$w(e.modelOptions().aliases);}}function it(n,t){if(n&1&&(Es(0,"option",41),xC(1),hl()),n&2){let e=t.$implicit;dg("ngValue",e.value),BE(),Fg(e.label);}}function ot(n,t){if(n&1&&(Es(0,"optgroup",43),Uw(1,it,2,2,"option",41,je),hl()),n&2){let e=eC(3);BE(),$w(e.modelOptions().apiNames);}}function at(n,t){if(n&1&&(Es(0,"select",18)(1,"option",40),xC(2,"Select a model"),hl(),jw(3,et,2,2,"option",41),jw(4,nt,3,0,"optgroup",42),jw(5,ot,3,0,"optgroup",43),hl(),MI()),n&2){let e,i=eC(2);dg("formControl",i.modelNameControl),xI(),BE(),dg("ngValue",null),BE(2),Bw((e=i.modelOptions().current)?3:-1,e),BE(),Bw(i.modelOptions().aliases.length>0?4:-1),BE(),Bw(i.modelOptions().apiNames.length>0?5:-1);}}function lt(n,t){if(n&1&&(Es(0,"span",44),xC(1),hl()),n&2){let e=eC().$implicit;BE(),Fg(e.config.integrationType);}}function rt(n,t){if(n&1&&(fg(0,"input",45),MI()),n&2){let e=eC().$implicit;dg("formControl",e.toolsControl),lg("aria-label","Tools of "+e.config.name),xI();}}function st(n,t){if(n&1){let e=Yw();Es(0,"div",10)(1,"label",11)(2,"input",23),vg("change",function(){let s=pf(e).$implicit,c=eC(3);return hf(c.toggleIntegration(s))}),hl(),Es(3,"span",24),xC(4),hl(),jw(5,lt,2,1,"span",44),hl(),jw(6,rt,1,2,"input",45),hl();}if(n&2){let e=t.$implicit;BE(2),dg("checked",e.enabled()),BE(2),Fg(e.config.name),BE(),Bw(e.config.integrationType?5:-1),BE(),Bw(e.enabled()?6:-1);}}function dt(n,t){if(n&1&&(Es(0,"p",13),xC(1),hl()),n&2){let e=eC().$implicit;BE(),Dl(" Restricted to: ",e.restrictedTools.join(", ")," (set outside this form, preserved on save) ");}}function ct(n,t){if(n&1){let e=Yw();Es(0,"div",10)(1,"label",24),xC(2),Es(3,"span",44),xC(4,"built-in"),hl()(),Es(5,"select",47),vg("change",function(s){let c=pf(e).$implicit,C=eC(4);return hf(C.setBuiltInState(c,s.target.value))}),Es(6,"option",48),xC(7),hl(),Es(8,"option",49),xC(9,"Enabled"),hl(),Es(10,"option",50),xC(11,"Disabled"),hl()(),jw(12,dt,2,1,"p",13),Es(13,"p",13),xC(14),hl()();}if(n&2){let e=t.$implicit,i=eC(4);BE(),lg("for","built-in-"+e.type),BE(),Dl(" ",e.displayName," "),BE(3),dg("id","built-in-"+e.type)("value",e.state()),BE(2),Fg(i.builtInDefaultLabel(e)),BE(5),Bw(e.state()==="on"&&e.restrictedTools?12:-1),BE(2),Fg(e.description);}}function mt(n,t){if(n&1&&(Es(0,"span",46),xC(1,"Built-in integrations"),hl(),Uw(2,ct,15,7,"div",10,qe)),n&2){let e=eC(3);BE(2),$w(e.builtInRows());}}function ut(n,t){n&1&&(Es(0,"ds-notice",26),xC(1," This agent can read the AgentOS configuration and also has a network integration or sub-agents: what it reads could be sent outside without any confirmation. Prefer a dedicated configuration agent without them. "),hl());}function gt(n,t){if(n&1&&(Es(0,"ds-fieldset",21),Uw(1,st,7,4,"div",10,Ye),jw(3,mt,4,0),jw(4,ut,2,0,"ds-notice",26),hl()),n&2){let e=eC(2);BE(),$w(e.integrationRows()),BE(2),Bw(e.builtInRows().length>0?3:-1),BE(),Bw(e.configAgentExposureWarning()?4:-1);}}function pt(n,t){n&1&&xC(0," A platform config can only list platform skills here: namespace skills are resolved per namespace when the agent runs. ");}function ft(n,t){n&1&&(Es(0,"ds-notice",26),xC(1," Saving with this on replaces the selection below with "),Es(2,"code",25),xC(3,"*"),hl(),xC(4,". "),hl());}function Ct(n,t){n&1&&(Es(0,"ds-notice"),xC(1," The skill catalogue could not be loaded. What this agent already declares is listed below and preserved on save. "),hl());}function _t(n,t){n&1&&(Es(0,"p",4),xC(1,"No skill available in this scope yet."),hl());}function bt(n,t){n&1&&(Es(0,"span",44),xC(1,"platform"),hl());}function ht(n,t){if(n&1&&(Es(0,"span",44),xC(1),hl()),n&2){let e=eC(4);BE(),Dl(" ",e.skillCatalogueUnavailable()?"not verified":"no matching skill"," ");}}function yt(n,t){if(n&1&&(Es(0,"p",13),xC(1),hl()),n&2){let e=eC().$implicit;BE(),Fg(e.description);}}function vt(n,t){if(n&1){let e=Yw();Es(0,"div",10)(1,"label",11)(2,"input",51),vg("change",function(){let s=pf(e).$implicit,c=eC(3);return hf(c.toggleSkill(s))}),hl(),Es(3,"span",24),xC(4),hl(),jw(5,bt,2,0,"span",44),jw(6,ht,2,1,"span",44),hl(),jw(7,yt,2,1,"p",13),hl();}if(n&2){let e=t.$implicit,i=eC(3);BE(2),dg("checked",e.selected())("disabled",i.allSkillsSelected()),BE(2),Fg(e.name),BE(),Bw(e.platform?5:-1),BE(),Bw(e.unresolved?6:-1),BE(),Bw(e.description?7:-1);}}function xt(n,t){if(n&1&&Uw(0,vt,8,6,"div",10,We),n&2){let e=eC(2);$w(e.skillRows());}}function St(n,t){if(n&1&&(Es(0,"ds-form-field",30),fg(1,"textarea",52),MI(),Es(2,"p",4),xC(3," Default payload for this loop agent. Overridden at launch time if the first message contains a valid "),Es(4,"code"),xC(5,"AgentLoopPayload"),hl(),xC(6,". Leave empty if you always provide the payload at launch. "),hl()()),n&2){let e=eC(2);dg("error",e.loopConfigControl.invalid&&e.loopConfigControl.touched?"Invalid JSON \u2014 please fix the syntax.":null),BE(),dg("placeholder",e.loopConfigPlaceholder)("formControl",e.loopConfigControl),xI();}}function At(n,t){n&1&&xC(0," A platform config can only list platform agents here: a namespace's agents are resolved per namespace when the agent runs. ");}function wt(n,t){if(n&1&&xC(0),n&2){let e=eC(3);Pg(" That deletes ",e.droppedUnresolvedSubAgents()," flagged ",e.droppedUnresolvedSubAgents()===1?"selector":"selectors"," nothing matched, which this form cannot restore. ");}}function Et(n,t){if(n&1&&(Es(0,"ds-notice",26),xC(1," Saving with this on replaces the selection below with "),Es(2,"code",25),xC(3,"*"),hl(),xC(4,". "),jw(5,wt,1,2),hl()),n&2){let e=eC(2);BE(5),Bw(e.droppedUnresolvedSubAgents()>0?5:-1);}}function Tt(n,t){n&1&&(Es(0,"ds-notice"),xC(1," The list of agents could not be loaded. What this agent already declares is listed below and preserved on save. "),hl());}function kt(n,t){n&1&&(Es(0,"p",4),xC(1,"No other agent is available in this scope yet."),hl());}function It(n,t){n&1&&(Es(0,"span",44),xC(1,"pattern"),hl());}function Rt(n,t){n&1&&(Es(0,"span",44),xC(1,"via pattern"),hl());}function Mt(n,t){if(n&1&&(Es(0,"span",44),xC(1),hl()),n&2){let e=eC(4);BE(),Dl(" ",e.subAgentCandidatesUnavailable()?"not verified":"no matching agent"," ");}}function Ft(n,t){if(n&1){let e=Yw();Es(0,"button",55),vg("click",function(){pf(e);let s=eC().$implicit,c=eC(3);return hf(c.removeSubAgent(s))}),xC(1," \xD7 "),hl();}if(n&2){let e=eC().$implicit;lg("aria-label","Remove "+e.selector);}}function Nt(n,t){if(n&1){let e=Yw();Es(0,"div",32)(1,"label",53)(2,"input",51),vg("change",function(){let s=pf(e).$implicit,c=eC(3);return hf(c.toggleSubAgent(s))}),hl(),Es(3,"span",24),xC(4),hl(),jw(5,It,2,0,"span",44)(6,Rt,2,0,"span",44)(7,Mt,2,1,"span",44),hl(),jw(8,Ft,2,1,"button",54),hl();}if(n&2){let e=t.$implicit,i=eC(3);BE(2),dg("checked",e.selected())("disabled",i.allSubAgentsSelected()),BE(2),Fg(e.name),BE(),Bw(e.pattern?5:e.grantedByPattern?6:e.unresolved?7:-1),BE(3),Bw(e.unresolved?8:-1);}}function Dt(n,t){if(n&1&&Uw(0,Nt,9,5,"div",32,We),n&2){let e=eC(2);$w(e.subAgentRows());}}function Lt(n,t){if(n&1){let e=Yw();Es(0,"div")(1,"button",56),vg("click",function(){pf(e);let s=eC(2);return hf(s.useDefaultDelegationTimeout())}),xC(2," Use server default "),hl()();}}function Vt(n,t){n&1&&(Es(0,"ds-notice"),xC(1),hl()),n&2&&(BE(),Fg(t));}function Pt(n,t){if(n&1){let e=Yw();Es(0,"button",57),vg("click",function(){pf(e);let s=eC(2);return hf(s.exportYaml())}),xC(1),hl();}if(n&2){let e=eC(2);dg("disabled",e.isExporting()),BE(),Dl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ot(n,t){if(n&1){let e=Yw();Es(0,"form",6),vg("ngSubmit",function(){pf(e);let s=eC();return hf(s.submit())}),Es(1,"ds-fieldset",7)(2,"ds-form-field",8),fg(3,"input",9),MI(),hl(),Es(4,"div",10)(5,"label",11),fg(6,"input",12),MI(),xC(7," Enabled "),hl(),Es(8,"p",13),xC(9,"Disabled agents are excluded from namespace resolution."),hl()(),Es(10,"ds-form-field",14),fg(11,"input",15),MI(),hl(),Es(12,"ds-form-field",16),jw(13,Ze,1,1,"input",17)(14,at,6,5,"select",18),hl(),Es(15,"ds-form-field",19),fg(16,"textarea",20),MI(),hl()(),jw(17,gt,5,2,"ds-fieldset",21),Es(18,"ds-fieldset",22)(19,"p",4),xC(20," Instruction bundles this agent can read on demand. Selecting at least one grants it the "),Es(21,"code"),xC(22,"readSkill"),hl(),xC(23," and "),Es(24,"code"),xC(25,"readSkillResource"),hl(),xC(26," tools; selecting none grants neither. "),jw(27,pt,1,0),hl(),Es(28,"label",11)(29,"input",23),vg("change",function(){pf(e);let s=eC();return hf(s.toggleAllSkills())}),hl(),Es(30,"span",24),xC(31,"Every skill in the catalogue ("),Es(32,"code",25),xC(33,"*"),hl(),xC(34,")"),hl()(),Es(35,"p",13),xC(36," Resolved at run time, so skills added later are granted too, without editing this agent. "),hl(),jw(37,ft,5,0,"ds-notice",26),jw(38,Ct,2,0,"ds-notice"),jw(39,_t,2,0,"p",4)(40,xt,2,0),hl(),Es(41,"ds-form-field",27)(42,"select",28)(43,"option",29),xC(44,"SIMPLE \u2014 Standard agent (single LLM call)"),hl(),Es(45,"option",29),xC(46,"ADVANCED \u2014 Multi-step reasoning loop"),hl(),Es(47,"option",29),xC(48,"LOOP \u2014 Bulk loop agent (no LLM, experimental)"),hl()(),MI(),hl(),jw(49,St,7,3,"ds-form-field",30),Es(50,"ds-fieldset",31)(51,"p",4),xC(52," The agents this one may delegate to. Selecting at least one grants it the "),Es(53,"code"),xC(54,"DELEGATE__delegate"),hl(),xC(55," tool; selecting none grants it no way to delegate. Entries are matched against agent names, never ids. "),jw(56,At,1,0),hl(),Es(57,"label",11)(58,"input",23),vg("change",function(){pf(e);let s=eC();return hf(s.toggleAllSubAgents())}),hl(),Es(59,"span",24),xC(60,"Every agent it can reach ("),Es(61,"code",25),xC(62,"*"),hl(),xC(63,")"),hl()(),Es(64,"p",13),xC(65," Resolved at run time, so agents added later can be delegated to as well, without editing this agent. "),hl(),jw(66,Et,6,1,"ds-notice",26),jw(67,Tt,2,0,"ds-notice"),jw(68,kt,2,0,"p",4)(69,Dt,2,0),Es(70,"p",4),xC(71," Advanced \u2014 add a glob instead of picking a name, for example "),Es(72,"code"),xC(73,"*Fixer"),hl(),xC(74," to cover BugFixer and StoryFixer. "),hl(),Es(75,"div",32)(76,"input",33),vg("keydown.enter",function(){pf(e);let s=eC();return hf(s.addSubAgent())}),hl(),MI(),Es(77,"button",34),vg("click",function(){pf(e);let s=eC();return hf(s.addSubAgent())}),xC(78," + "),hl()(),Es(79,"ds-form-field",35),fg(80,"input",36),MI(),jw(81,Lt,3,0,"div"),hl()(),jw(82,Vt,2,1,"ds-notice"),Es(83,"ds-form-actions")(84,"button",37),xC(85),hl(),jw(86,Pt,2,2,"button",38),Es(87,"button",39),vg("click",function(){pf(e);let s=eC();return hf(s.cancel())}),xC(88,"Cancel"),hl()()();}if(n&2){let e,i=eC();dg("formGroup",i.form),BE(3),dg("formControl",i.nameControl),xI(),BE(3),dg("formControl",i.enabledControl),xI(),BE(5),dg("formControl",i.descriptionControl),xI(),BE(2),Bw(i.modelAsFreeText()?13:14),BE(3),dg("formControl",i.instructionsControl),xI(),BE(),Bw(i.integrationRows().length>0||i.builtInRows().length>0?17:-1),BE(10),Bw(i.isPlatformMode?27:-1),BE(2),dg("checked",i.allSkillsSelected()),BE(8),Bw(i.namedSkillSelectionDropped()?37:-1),BE(),Bw(i.skillCatalogueUnavailable()?38:-1),BE(),Bw(i.skillRows().length===0?39:40),BE(3),dg("formControl",i.executionModeControl),xI(),BE(),dg("value",i.ExecutionMode.SIMPLE),BE(2),dg("value",i.ExecutionMode.ADVANCED),BE(2),dg("value",i.ExecutionMode.LOOP),BE(2),Bw(i.isLoopMode()?49:-1),BE(7),Bw(i.isPlatformMode?56:-1),BE(2),dg("checked",i.allSubAgentsSelected()),BE(8),Bw(i.namedSubAgentSelectionDropped()?66:-1),BE(),Bw(i.subAgentCandidatesUnavailable()?67:-1),BE(),Bw(i.subAgentRows().length===0?68:69),BE(8),dg("formControl",i.newSubAgentControl),xI(),BE(),dg("disabled",!i.newSubAgentControl.value.trim()),BE(2),dg("hint",i.delegationTimeoutHint())("error",i.delegationTimeoutControl.invalid?"Enter a valid positive whole number of seconds, or leave empty to inherit the server default.":null),BE(),dg("formControl",i.delegationTimeoutControl),lg("aria-invalid",i.delegationTimeoutControl.invalid),xI(),BE(),Bw(i.delegationTimeoutControl.value!==null?81:-1),BE(),Bw((e=i.submitError())?82:-1,e),BE(2),dg("disabled",i.form.invalid||i.isSubmitting()),BE(),Dl(" ",i.isEditMode()?"Save changes":"Create"," "),BE(),Bw(i.isEditMode()?86:-1);}}var Ke=class n{route=g(W);router=g(F$1);destroyRef=g(we);agentConfigController=g(U);defaultsController=g(N);defaultDelegationTimeoutSeconds=$i(null);exportService=g(K);integrationConfigState=g(O);integrationTypeController=g(_);skillState=g(o);aiModelState=g(A);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt$1({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(null),modelName:new Te(null,{validators:[fn.required,n.notBlankValidator]}),instructions:new Te(null),executionMode:new Te("SIMPLE",{nonNullable:true}),delegationTimeoutSeconds:new Te(null,{validators:[fn.min(1),fn.max(2147483647),fn.pattern(/^\d+$/)]}),enabled:new Te(false,{nonNullable:true}),loopConfig:new Te(null,{validators:[n.jsonValidator]})});static notBlankValidator(t){let e=t.value;return typeof e=="string"&&e.length>0&&e.trim().length===0?{required:true}:null}static jsonValidator(t){let e=t.value?.trim();if(!e)return null;try{return JSON.parse(e),null}catch(i){return {invalidJson:true}}}get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get modelNameControl(){return this.form.controls.modelName}get instructionsControl(){return this.form.controls.instructions}get executionModeControl(){return this.form.controls.executionMode}get delegationTimeoutControl(){return this.form.controls.delegationTimeoutSeconds}useDefaultDelegationTimeout(){this.delegationTimeoutControl.setValue(null),this.delegationTimeoutControl.markAsDirty();}delegationTimeoutHint=rT(()=>{let t=this.defaultDelegationTimeoutSeconds();return `How long each delegation launched by this agent waits without activity from the sub-agent, including its own delegations. When it runs out, the sub-agent and its active descendants are stopped and can be resumed. Leave empty to use the server default${t!==null?`: ${t} s (${t/60} min)`:""}.`});get enabledControl(){return this.form.controls.enabled}get loopConfigControl(){return this.form.controls.loopConfig}executionModeValue=F$2(this.form.controls.executionMode.valueChanges,{initialValue:this.form.controls.executionMode.value});isLoopMode=rT(()=>this.executionModeValue()==="LOOP");subAgentRows=$i([]);allSubAgentsSelected=$i(false);subAgentCandidatesUnavailable=$i(false);namedSubAgentSelectionDropped=rT(()=>this.allSubAgentsSelected()&&this.subAgentRows().some(t=>t.selected()));droppedUnresolvedSubAgents=rT(()=>this.allSubAgentsSelected()?this.subAgentRows().filter(t=>t.unresolved&&t.selected()).length:0);hasAnySubAgent=rT(()=>this.allSubAgentsSelected()||this.subAgentRows().some(t=>t.selected()));newSubAgentControl=new Te("",{nonNullable:true});isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);isExporting=$i(false);submitError=$i(null);ExecutionMode=qe$1;loopConfigPlaceholder=JSON.stringify({search:{tool:"SearchTalents",params:{talentId:["6ac76692a909eaaae0b078d6"],resolveTargets:["MANAGER"],next:null}},act:{agentName:"ProfileCaretaker",promptTemplate:"This talent has not completed their profile. As their manager, I need you to help me review and improve it."}},null,2);builtInRows=$i([]);inspectRoute(){let t=this.route.snapshot.paramMap.get("agentConfigId")??"";return this.isPlatformMode?["/agentos","admin","agent-configs",t,"inspect"]:["/agentos",this.namespaceId,"agent-configs",t,"inspect"]}configAgentExposureWarning=rT(()=>Ue({configEnabled:this.builtInRows().some(t=>t.type===Ge&&t.state()==="on"),integrationTypes:this.integrationRows().filter(t=>t.enabled()).map(t=>t.config.integrationType),hasSubAgents:this.hasAnySubAgent()}));modelOptions=$i({aliases:[],apiNames:[],current:null});modelCatalogueLoaded=$i(false);modelAsFreeText=rT(()=>{let{aliases:t,apiNames:e}=this.modelOptions();return this.modelCatalogueLoaded()&&t.length+e.length===0});applyModelCatalogue(t,e){this.modelOptions.set(E(t,e)),this.modelCatalogueLoaded.set(true);}integrationRows=$i([]);skillRows=$i([]);allSkillsSelected=$i(false);skillCatalogueUnavailable=$i(false);namedSkillSelectionDropped=rT(()=>this.allSkillsSelected()&&this.skillRows().some(t=>t.selected()));existingConfig=null;ngOnInit(){this.defaultsController.getAgentConfigDefaults().pipe(U$1(this.destroyRef),ha(()=>br(null))).subscribe(e=>this.defaultDelegationTimeoutSeconds.set(e?.delegationTimeoutSeconds??null));let t=this.route.snapshot.paramMap.get("agentConfigId");t?(this.isEditMode.set(true),this.loadConfigAndIntegrations(t)):this.loadIntegrations(void 0);}loadConfigAndIntegrations(t){this.isLoading.set(true),by({config:this.agentConfigController.getByIdAgentConfig(t),namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):br([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes(),skillCatalogue:this.loadSkillCatalogue(),delegationCandidates:this.loadDelegationCandidates(),models:this.aiModelState.listAvailable(this.namespaceId)}).pipe(U$1(this.destroyRef)).subscribe({next:({config:e,namespaceIntegrations:i,platformIntegrations:s,builtInTypes:c,skillCatalogue:C,delegationCandidates:E,models:T})=>{this.existingConfig=e,this.applyModelCatalogue(T,e.modelName??null),this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.modelNameControl.setValue(e.modelName??null),this.instructionsControl.setValue(e.instructions??null);let f=e.executionMode??(e.advancedExecution?"ADVANCED":"SIMPLE");this.executionModeControl.setValue(f),this.delegationTimeoutControl.setValue(e.delegationTimeoutSeconds??null),this.enabledControl.setValue(e.enabled??true),this.loopConfigControl.setValue(e.loopConfig!=null?JSON.stringify(e.loopConfig,null,2):null);let N=[...s,...i];this.integrationRows.set(this.buildIntegrationRows(N,e.integrations??void 0)),this.builtInRows.set(this.buildBuiltInRows(c,e.integrations??void 0)),this.allSubAgentsSelected.set(Be(e.subAgents)),this.subAgentRows.set(this.buildSubAgentRows(E,e.subAgents,e.name)),this.allSkillsSelected.set(o$1(e.skillSelectors)),this.skillRows.set(this.buildSkillRows(C,e.skillSelectors)),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadIntegrations(t){by({namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):br([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes(),skillCatalogue:this.loadSkillCatalogue(),delegationCandidates:this.loadDelegationCandidates(),models:this.aiModelState.listAvailable(this.namespaceId)}).pipe(U$1(this.destroyRef)).subscribe({next:({namespaceIntegrations:e,platformIntegrations:i,builtInTypes:s,skillCatalogue:c,delegationCandidates:C,models:E})=>{this.applyModelCatalogue(E,null);let T=[...i,...e];this.integrationRows.set(this.buildIntegrationRows(T,t??void 0)),this.builtInRows.set(this.buildBuiltInRows(s,t??void 0)),this.allSubAgentsSelected.set(false),this.subAgentRows.set(this.buildSubAgentRows(C,void 0,null)),this.allSkillsSelected.set(false),this.skillRows.set(this.buildSkillRows(c,void 0));}});}loadSkillCatalogue(){return (this.namespaceId?this.skillState.listEffective(this.namespaceId):this.skillState.listPlatform().pipe(ne(e=>e.map(i=>({id:i.id??"",name:i.name,description:i.description,namespaceId:i.namespaceId??null,readOnly:i.readOnly===true}))))).pipe(ha(e=>(console.error("[agent-config-form] failed to load the skill catalogue",e),this.skillCatalogueUnavailable.set(true),br([]))))}buildSkillRows(t,e){let s=(e??[]).map(f=>f.trim()).filter(f=>f.length>0).filter(f=>f!==r),c=i(s),C=new Set(t.map(f=>f.name.toLowerCase())),E=t.map(f=>({selector:f.name,name:f.name,description:f.description,platform:f.namespaceId==null,unresolved:false,selected:$i(c.has(f.name.toLowerCase()))})),T=new Set;for(let f of s){let N=l(f).toLowerCase();C.has(N)||T.has(N)||(T.add(N),E.push({selector:f,name:f,description:"",platform:false,unresolved:true,selected:$i(true)}));}return E}toggleSkill(t){t.selected.update(e=>!e);}toggleAllSkills(){this.allSkillsSelected.update(t=>!t);}buildSkillSelectorsPayload(){if(this.allSkillsSelected())return [r];let t=this.skillRows().filter(e=>e.selected()).map(e=>e.selector);return t.length>0?t:void 0}loadDelegationCandidates(){let t=this.agentConfigController.listPlatformAgentsAgentConfig(false).pipe(this.orNoCandidates()),e=this.namespaceId?this.agentConfigController.listByParentAgentConfig(this.namespaceId,false).pipe(this.orNoCandidates()):br([]);return by({platform:t,namespace:e}).pipe(ne(({platform:i,namespace:s})=>[...i,...s]),ne(i=>i.map(s=>s.name).filter(s=>s.length>0)),ne(i=>n.dedupeByKey(i)))}orNoCandidates(){return ha(t=>(console.error("[agent-config-form] failed to load the delegation candidates",t),this.subAgentCandidatesUnavailable.set(true),br([])))}static dedupeByKey(t){let e=new Set;return t.filter(i=>{let s=i.toLowerCase();return e.has(s)?false:(e.add(s),true)})}buildSubAgentRows(t,e,i){let s=$e(e),c=i?.toLowerCase()??null,C=t.filter(_=>{let O=_.toLowerCase();return O!==c||s.has(O)}),E=new Set(C.map(_=>_.toLowerCase())),T=C.map(_=>({selector:_,name:_,unresolved:false,pattern:false,grantedByPattern:Y(_,e),selected:$i(s.has(_.toLowerCase()))})),f=new Set,N=(e??[]).map(_=>_.trim()).filter(_=>_.length>0&&_!==F);for(let _ of N){let O=_.toLowerCase();E.has(O)||f.has(O)||(f.add(O),T.push({selector:_,name:_,unresolved:true,pattern:j(_),grantedByPattern:false,selected:$i(true)}));}return T}loadBuiltInTypes(){return this.integrationTypeController.listTypesIntegrationType().pipe(ne(t=>t.filter(e=>!e.configSchema)),ha(t=>(console.error("[agent-config-form] failed to load integration types",t),br([]))))}buildIntegrationRows(t,e){return t.map(i=>{let s=i.name??"",c=e?.[s],C=e!=null&&s in e,E=Array.isArray(c)?c.join(", "):"";return {config:i,enabled:$i(C),toolsControl:new Te(E,{nonNullable:true})}})}buildBuiltInRows(t,e){return t.map(i=>{let s=e!=null&&i.type in e,c=e?.[i.type],C=s?Array.isArray(c)&&c.length===0?"off":"on":"default";return {type:i.type,displayName:i.displayName,description:i.description,enabledByDefault:i.enabledByDefault===true,state:$i(C),restrictedTools:Array.isArray(c)&&c.length>0?c:null}})}toggleIntegration(t){t.enabled.update(e=>!e);}setBuiltInState(t,e){t.state.set(e);}builtInDefaultLabel(t){return t.enabledByDefault?"Platform default (enabled)":"Platform default (disabled)"}addSubAgent(){let t=this.newSubAgentControl.value.trim();if(!t)return;let e=this.subAgentRows().find(i=>i.selector.toLowerCase()===t.toLowerCase());e?e.selected.set(true):t===F?this.allSubAgentsSelected.set(true):this.subAgentRows.update(i=>this.withPatternGrants([...i,{selector:t,name:t,unresolved:true,pattern:j(t),grantedByPattern:false,selected:$i(true)}])),this.newSubAgentControl.reset("");}removeSubAgent(t){let e=t.selector.toLowerCase();this.subAgentRows.update(i=>this.withPatternGrants(i.filter(s=>s.selector.toLowerCase()!==e)));}toggleSubAgent(t){t.selected.update(e=>!e),t.pattern&&this.subAgentRows.update(e=>this.withPatternGrants(e));}withPatternGrants(t){let e=this.allSubAgentsSelected()?[]:t.filter(i=>i.selected()).map(i=>i.selector);return t.map(i=>i.unresolved?i:x(w({},i),{grantedByPattern:Y(i.name,e)}))}toggleAllSubAgents(){this.allSubAgentsSelected.update(t=>!t),this.subAgentRows.update(t=>this.withPatternGrants(t));}buildSubAgentsPayload(){if(this.allSubAgentsSelected())return [F];let t=this.subAgentRows().filter(e=>e.selected()).map(e=>e.selector);return t.length>0?t:void 0}buildIntegrationsPayload(){let t={};for(let i of this.integrationRows().filter(s=>s.enabled())){let s=i.config.name??"",c=i.toolsControl.value.trim();t[s]=c===""?null:c.split(",").map(C=>C.trim()).filter(C=>C.length>0);}for(let i of this.builtInRows()){let s=i.state();s==="on"?t[i.type]=i.restrictedTools??null:s==="off"&&(t[i.type]=[]);}let e=new Set([...this.integrationRows().map(i=>i.config.name??""),...this.builtInRows().map(i=>i.type)]);for(let[i,s]of Object.entries(this.existingConfig?.integrations??{}))e.has(i)||(t[i]=s);return Object.keys(t).length>0?t:void 0}submit(){if(this.form.invalid||this.isSubmitting())return;this.addSubAgent(),this.submitError.set(null),this.isSubmitting.set(true);let t=x(w({},this.existingConfig??{}),{createdOn:this.existingConfig?.createdOn,updatedOn:this.existingConfig?.updatedOn,namespaceId:this.namespaceId,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,modelName:this.modelNameControl.value?.trim()||void 0,instructions:this.instructionsControl.value?.trim()||void 0,integrations:this.buildIntegrationsPayload(),executionMode:this.executionModeControl.value,advancedExecution:this.executionModeControl.value==="ADVANCED",enabled:this.enabledControl.value,subAgents:this.buildSubAgentsPayload(),skillSelectors:this.buildSkillSelectorsPayload(),delegationTimeoutSeconds:this.delegationTimeoutControl.value,loopConfig:this.buildLoopConfigPayload()});(this.isEditMode()?this.agentConfigController.updateAgentConfig(this.existingConfig.id??"",t):this.agentConfigController.createAgentConfig(t)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:i=>{this.isSubmitting.set(false),this.submitError.set(n.serverMessage(i));}});}static serverMessage(t){let i=t?.error?.message;if(typeof i=="string"&&i.trim().length>0)return i;let s=t?.status;return s===0?"The server could not be reached. The agent was not saved.":typeof s=="number"&&s>=500?`The server failed to save the agent (HTTP ${s}). Nothing was changed.`:"The server refused the save and gave no reason. Check the values and try again."}exportYaml(){let t=this.existingConfig?.id;!t||this.isExporting()||(this.isExporting.set(true),this.exportService.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let i=new Blob([e],{type:"application/yaml"}),s=URL.createObjectURL(i),c=document.createElement("a");c.href=s,c.download=`${this.existingConfig?.name??"agent"}.yaml`,c.click(),URL.revokeObjectURL(s),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}buildLoopConfigPayload(){let t=this.loopConfigControl.value?.trim();if(!t)return this.existingConfig?.loopConfig!=null?null:void 0;try{return JSON.parse(t)}catch(e){return}}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=vw({type:n,selectors:[["agentos-agent-config-form"]],decls:8,vars:4,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to agent configs",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],["headerMeta","","variant","outline"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Agent"],["label","Name","controlId","agent-config-name","required",""],["dsControl","","id","agent-config-name","type","text","placeholder","e.g. Support agent","autocomplete","off",3,"formControl"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","Description","controlId","agent-config-description"],["dsControl","","id","agent-config-description","type","text","placeholder","Optional \u2014 short description of this agent","autocomplete","off",3,"formControl"],["label","Model","controlId","agent-config-model-name","required","","hint","Aliases are matched first, then API model names. Resolved when the agent runs."],["dsControl","","id","agent-config-model-name","type","text","placeholder","Model alias or name to use, e.g. BIG","autocomplete","off",3,"formControl"],["dsControl","","id","agent-config-model-name",3,"formControl"],["label","Instructions","controlId","agent-config-instructions"],["dsControl","","id","agent-config-instructions","rows","6","placeholder","Optional \u2014 system instructions for this agent",3,"formControl"],["legend","Integrations","hint","Select which integrations this agent can use. Leave tool names empty to allow all tools from an integration."],["legend","Skills"],["type","checkbox",3,"change","checked"],[1,"ds-strong"],[1,"ds-code"],["tone","warning"],["label","Execution mode","controlId","agent-config-execution-mode","hint",'SIMPLE runs a single LLM pass. ADVANCED uses an intention loop for complex tasks and requires a model that supports advanced execution, otherwise the agent fails to run. LOOP (experimental) starts one case per result of a tool, without an LLM \u2014 run it with "Launch loop" in the agent list menu.'],["dsControl","","id","agent-config-execution-mode",3,"formControl"],[3,"value"],["label","Loop configuration (JSON)","controlId","agent-config-loop-config",3,"error"],["legend","Sub-agents"],[1,"ds-inline"],["dsControl","","type","text","aria-label","New sub-agent pattern","placeholder","e.g. *Fixer","autocomplete","off",3,"keydown.enter","formControl"],["dsButton","","variant","icon","type","button","title","Add pattern","aria-label","Add pattern",3,"click","disabled"],["label","Delegation timeout (seconds)","controlId","delegation-timeout","hintId","delegation-timeout-hint","errorId","delegation-timeout-error",3,"hint","error"],["dsControl","","id","delegation-timeout","type","number","min","1","max","2147483647","step","1","placeholder","Server default","aria-describedby","delegation-timeout-hint delegation-timeout-error",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["disabled","",3,"ngValue"],[3,"ngValue"],["label","Aliases"],["label","API model names"],[1,"ds-meta"],["dsControl","","type","text","placeholder","Tool names, comma-separated (empty = all tools)","autocomplete","off",1,"ds-indent",3,"formControl"],[1,"ds-micro"],["dsControl","",1,"ds-indent","ds-control--auto",3,"change","id","value"],["value","default"],["value","on"],["value","off"],["type","checkbox",3,"change","checked","disabled"],["dsControl","","mono","","id","agent-config-loop-config","rows","10","spellcheck","false","autocomplete","off",3,"placeholder","formControl"],["dsCheck","",1,"ds-grow"],["dsButton","","variant","icon-danger","type","button","title","Remove"],["dsButton","","variant","icon-danger","type","button","title","Remove",3,"click"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,i){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return i.cancel()}),xC(3," \u2190 Agent configs "),hl(),jw(4,ze,2,1,"a",2),jw(5,Xe,2,0,"ds-tag",3),hl(),jw(6,Qe,2,0,"p",4)(7,Ot,89,33,"form",5),hl()),e&2&&(BE(),dg("title",i.isEditMode()?"Edit agent config":"New agent config"),BE(3),Bw(i.isEditMode()?4:-1),BE(),Bw(i.isPlatformMode?5:-1),BE(),Bw(i.isLoading()?6:7));},dependencies:[Ut,nd,bo,xo,Lt$1,kn,vn,Gt,mo,po,$r,qr,Vn,An,$t,pn,hn,cn,ln,dn,mn,at$1,an,rn,ko],encapsulation:2})};export{Ke as AgentConfigFormComponent};
1
+ import {o as o$1,r,i,l}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-UZMqdHVD.js';import {O}from'./chunk-DAzj31Q1.js';import {g,W,q as F$1,I as we,ag as U,ay as N,$ as $i,az as K,a8 as _,r as rT,a9 as F$2,aA as qe$1,K as U$1,a2 as ha,aa as br,ac as by,ad as ne,N as x,L as w,v as vw,au as $t,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,c as Bw,t as eC,Y as Yw,f as fg,R as MI,S as xI,l as lg,s as Dl,U as Uw,k as $w,F as Fg,u as pf,w as hf,as as Pg}from'./main-OK5QY7NU.js';import {N as A,p as pt$1,T as Te,a as fn,Q as E,U as Ut,n as nd,b as bo,x as xo,L as Lt$1,k as kn,u as vn,G as Gt,m as mo,c as po,$ as $r,H as qr,V as Vn,A as An,d as pn,h as hn,e as cn,r as ln,g as dn,C as mn,i as at$1,j as an,t as rn,l as ko}from'./chunk-CFzCpWz-.js';import'./chunk-BcBIZEZM.js';var F="*";function Be(n){return (n??[]).some(t=>t.trim()===F)}function $e(n){let t=(n??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==F).map(e=>e.toLowerCase());return new Set(t)}function j(n){return n.includes(F)}function He(n){let t=n.replace(/[\\.[\]{}()^$|]/g,"\\$&").replace(/\*/g,".*");try{return new RegExp(`^${t}$`,"i")}catch(e){return null}}function Y(n,t){return (t??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==F&&j(e)).some(e=>He(e)?.test(n)??false)}var Ge="AGENTOS_CONFIG",Je=new Set(["HTTP_API","MCP_HTTP","MCP_STDIO","BASH","TMUX","GIT"]);function Ue(n){return n.configEnabled&&(n.hasSubAgents||n.integrationTypes.some(t=>Je.has(t)))}var je=(n,t)=>t.value,Ye=(n,t)=>t.config.id,qe=(n,t)=>t.type,We=(n,t)=>t.selector;function ze(n,t){if(n&1&&(Es(0,"a",2),xC(1,"View resolved definition \u2192"),hl()),n&2){let e=eC();dg("routerLink",e.inspectRoute());}}function Xe(n,t){n&1&&(Es(0,"ds-tag",3),xC(1,"Platform level"),hl());}function Qe(n,t){n&1&&(Es(0,"p",4),xC(1,"Loading\u2026"),hl());}function Ze(n,t){if(n&1&&(fg(0,"input",17),MI()),n&2){let e=eC(2);dg("formControl",e.modelNameControl),xI();}}function et(n,t){if(n&1&&(Es(0,"option",41),xC(1),hl()),n&2){let e=t;dg("ngValue",e.value),BE(),Fg(e.label);}}function tt(n,t){if(n&1&&(Es(0,"option",41),xC(1),hl()),n&2){let e=t.$implicit;dg("ngValue",e.value),BE(),Fg(e.label);}}function nt(n,t){if(n&1&&(Es(0,"optgroup",42),Uw(1,tt,2,2,"option",41,je),hl()),n&2){let e=eC(3);BE(),$w(e.modelOptions().aliases);}}function it(n,t){if(n&1&&(Es(0,"option",41),xC(1),hl()),n&2){let e=t.$implicit;dg("ngValue",e.value),BE(),Fg(e.label);}}function ot(n,t){if(n&1&&(Es(0,"optgroup",43),Uw(1,it,2,2,"option",41,je),hl()),n&2){let e=eC(3);BE(),$w(e.modelOptions().apiNames);}}function at(n,t){if(n&1&&(Es(0,"select",18)(1,"option",40),xC(2,"Select a model"),hl(),jw(3,et,2,2,"option",41),jw(4,nt,3,0,"optgroup",42),jw(5,ot,3,0,"optgroup",43),hl(),MI()),n&2){let e,i=eC(2);dg("formControl",i.modelNameControl),xI(),BE(),dg("ngValue",null),BE(2),Bw((e=i.modelOptions().current)?3:-1,e),BE(),Bw(i.modelOptions().aliases.length>0?4:-1),BE(),Bw(i.modelOptions().apiNames.length>0?5:-1);}}function lt(n,t){if(n&1&&(Es(0,"span",44),xC(1),hl()),n&2){let e=eC().$implicit;BE(),Fg(e.config.integrationType);}}function rt(n,t){if(n&1&&(fg(0,"input",45),MI()),n&2){let e=eC().$implicit;dg("formControl",e.toolsControl),lg("aria-label","Tools of "+e.config.name),xI();}}function st(n,t){if(n&1){let e=Yw();Es(0,"div",10)(1,"label",11)(2,"input",23),vg("change",function(){let s=pf(e).$implicit,c=eC(3);return hf(c.toggleIntegration(s))}),hl(),Es(3,"span",24),xC(4),hl(),jw(5,lt,2,1,"span",44),hl(),jw(6,rt,1,2,"input",45),hl();}if(n&2){let e=t.$implicit;BE(2),dg("checked",e.enabled()),BE(2),Fg(e.config.name),BE(),Bw(e.config.integrationType?5:-1),BE(),Bw(e.enabled()?6:-1);}}function dt(n,t){if(n&1&&(Es(0,"p",13),xC(1),hl()),n&2){let e=eC().$implicit;BE(),Dl(" Restricted to: ",e.restrictedTools.join(", ")," (set outside this form, preserved on save) ");}}function ct(n,t){if(n&1){let e=Yw();Es(0,"div",10)(1,"label",24),xC(2),Es(3,"span",44),xC(4,"built-in"),hl()(),Es(5,"select",47),vg("change",function(s){let c=pf(e).$implicit,C=eC(4);return hf(C.setBuiltInState(c,s.target.value))}),Es(6,"option",48),xC(7),hl(),Es(8,"option",49),xC(9,"Enabled"),hl(),Es(10,"option",50),xC(11,"Disabled"),hl()(),jw(12,dt,2,1,"p",13),Es(13,"p",13),xC(14),hl()();}if(n&2){let e=t.$implicit,i=eC(4);BE(),lg("for","built-in-"+e.type),BE(),Dl(" ",e.displayName," "),BE(3),dg("id","built-in-"+e.type)("value",e.state()),BE(2),Fg(i.builtInDefaultLabel(e)),BE(5),Bw(e.state()==="on"&&e.restrictedTools?12:-1),BE(2),Fg(e.description);}}function mt(n,t){if(n&1&&(Es(0,"span",46),xC(1,"Built-in integrations"),hl(),Uw(2,ct,15,7,"div",10,qe)),n&2){let e=eC(3);BE(2),$w(e.builtInRows());}}function ut(n,t){n&1&&(Es(0,"ds-notice",26),xC(1," This agent can read the AgentOS configuration and also has a network integration or sub-agents: what it reads could be sent outside without any confirmation. Prefer a dedicated configuration agent without them. "),hl());}function gt(n,t){if(n&1&&(Es(0,"ds-fieldset",21),Uw(1,st,7,4,"div",10,Ye),jw(3,mt,4,0),jw(4,ut,2,0,"ds-notice",26),hl()),n&2){let e=eC(2);BE(),$w(e.integrationRows()),BE(2),Bw(e.builtInRows().length>0?3:-1),BE(),Bw(e.configAgentExposureWarning()?4:-1);}}function pt(n,t){n&1&&xC(0," A platform config can only list platform skills here: namespace skills are resolved per namespace when the agent runs. ");}function ft(n,t){n&1&&(Es(0,"ds-notice",26),xC(1," Saving with this on replaces the selection below with "),Es(2,"code",25),xC(3,"*"),hl(),xC(4,". "),hl());}function Ct(n,t){n&1&&(Es(0,"ds-notice"),xC(1," The skill catalogue could not be loaded. What this agent already declares is listed below and preserved on save. "),hl());}function _t(n,t){n&1&&(Es(0,"p",4),xC(1,"No skill available in this scope yet."),hl());}function bt(n,t){n&1&&(Es(0,"span",44),xC(1,"platform"),hl());}function ht(n,t){if(n&1&&(Es(0,"span",44),xC(1),hl()),n&2){let e=eC(4);BE(),Dl(" ",e.skillCatalogueUnavailable()?"not verified":"no matching skill"," ");}}function yt(n,t){if(n&1&&(Es(0,"p",13),xC(1),hl()),n&2){let e=eC().$implicit;BE(),Fg(e.description);}}function vt(n,t){if(n&1){let e=Yw();Es(0,"div",10)(1,"label",11)(2,"input",51),vg("change",function(){let s=pf(e).$implicit,c=eC(3);return hf(c.toggleSkill(s))}),hl(),Es(3,"span",24),xC(4),hl(),jw(5,bt,2,0,"span",44),jw(6,ht,2,1,"span",44),hl(),jw(7,yt,2,1,"p",13),hl();}if(n&2){let e=t.$implicit,i=eC(3);BE(2),dg("checked",e.selected())("disabled",i.allSkillsSelected()),BE(2),Fg(e.name),BE(),Bw(e.platform?5:-1),BE(),Bw(e.unresolved?6:-1),BE(),Bw(e.description?7:-1);}}function xt(n,t){if(n&1&&Uw(0,vt,8,6,"div",10,We),n&2){let e=eC(2);$w(e.skillRows());}}function St(n,t){if(n&1&&(Es(0,"ds-form-field",30),fg(1,"textarea",52),MI(),Es(2,"p",4),xC(3," Default payload for this loop agent. Overridden at launch time if the first message contains a valid "),Es(4,"code"),xC(5,"AgentLoopPayload"),hl(),xC(6,". Leave empty if you always provide the payload at launch. "),hl()()),n&2){let e=eC(2);dg("error",e.loopConfigControl.invalid&&e.loopConfigControl.touched?"Invalid JSON \u2014 please fix the syntax.":null),BE(),dg("placeholder",e.loopConfigPlaceholder)("formControl",e.loopConfigControl),xI();}}function At(n,t){n&1&&xC(0," A platform config can only list platform agents here: a namespace's agents are resolved per namespace when the agent runs. ");}function wt(n,t){if(n&1&&xC(0),n&2){let e=eC(3);Pg(" That deletes ",e.droppedUnresolvedSubAgents()," flagged ",e.droppedUnresolvedSubAgents()===1?"selector":"selectors"," nothing matched, which this form cannot restore. ");}}function Et(n,t){if(n&1&&(Es(0,"ds-notice",26),xC(1," Saving with this on replaces the selection below with "),Es(2,"code",25),xC(3,"*"),hl(),xC(4,". "),jw(5,wt,1,2),hl()),n&2){let e=eC(2);BE(5),Bw(e.droppedUnresolvedSubAgents()>0?5:-1);}}function Tt(n,t){n&1&&(Es(0,"ds-notice"),xC(1," The list of agents could not be loaded. What this agent already declares is listed below and preserved on save. "),hl());}function kt(n,t){n&1&&(Es(0,"p",4),xC(1,"No other agent is available in this scope yet."),hl());}function It(n,t){n&1&&(Es(0,"span",44),xC(1,"pattern"),hl());}function Rt(n,t){n&1&&(Es(0,"span",44),xC(1,"via pattern"),hl());}function Mt(n,t){if(n&1&&(Es(0,"span",44),xC(1),hl()),n&2){let e=eC(4);BE(),Dl(" ",e.subAgentCandidatesUnavailable()?"not verified":"no matching agent"," ");}}function Ft(n,t){if(n&1){let e=Yw();Es(0,"button",55),vg("click",function(){pf(e);let s=eC().$implicit,c=eC(3);return hf(c.removeSubAgent(s))}),xC(1," \xD7 "),hl();}if(n&2){let e=eC().$implicit;lg("aria-label","Remove "+e.selector);}}function Nt(n,t){if(n&1){let e=Yw();Es(0,"div",32)(1,"label",53)(2,"input",51),vg("change",function(){let s=pf(e).$implicit,c=eC(3);return hf(c.toggleSubAgent(s))}),hl(),Es(3,"span",24),xC(4),hl(),jw(5,It,2,0,"span",44)(6,Rt,2,0,"span",44)(7,Mt,2,1,"span",44),hl(),jw(8,Ft,2,1,"button",54),hl();}if(n&2){let e=t.$implicit,i=eC(3);BE(2),dg("checked",e.selected())("disabled",i.allSubAgentsSelected()),BE(2),Fg(e.name),BE(),Bw(e.pattern?5:e.grantedByPattern?6:e.unresolved?7:-1),BE(3),Bw(e.unresolved?8:-1);}}function Dt(n,t){if(n&1&&Uw(0,Nt,9,5,"div",32,We),n&2){let e=eC(2);$w(e.subAgentRows());}}function Lt(n,t){if(n&1){let e=Yw();Es(0,"div")(1,"button",56),vg("click",function(){pf(e);let s=eC(2);return hf(s.useDefaultDelegationTimeout())}),xC(2," Use server default "),hl()();}}function Vt(n,t){n&1&&(Es(0,"ds-notice"),xC(1),hl()),n&2&&(BE(),Fg(t));}function Pt(n,t){if(n&1){let e=Yw();Es(0,"button",57),vg("click",function(){pf(e);let s=eC(2);return hf(s.exportYaml())}),xC(1),hl();}if(n&2){let e=eC(2);dg("disabled",e.isExporting()),BE(),Dl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ot(n,t){if(n&1){let e=Yw();Es(0,"form",6),vg("ngSubmit",function(){pf(e);let s=eC();return hf(s.submit())}),Es(1,"ds-fieldset",7)(2,"ds-form-field",8),fg(3,"input",9),MI(),hl(),Es(4,"div",10)(5,"label",11),fg(6,"input",12),MI(),xC(7," Enabled "),hl(),Es(8,"p",13),xC(9,"Disabled agents are excluded from namespace resolution."),hl()(),Es(10,"ds-form-field",14),fg(11,"input",15),MI(),hl(),Es(12,"ds-form-field",16),jw(13,Ze,1,1,"input",17)(14,at,6,5,"select",18),hl(),Es(15,"ds-form-field",19),fg(16,"textarea",20),MI(),hl()(),jw(17,gt,5,2,"ds-fieldset",21),Es(18,"ds-fieldset",22)(19,"p",4),xC(20," Instruction bundles this agent can read on demand. Selecting at least one grants it the "),Es(21,"code"),xC(22,"readSkill"),hl(),xC(23," and "),Es(24,"code"),xC(25,"readSkillResource"),hl(),xC(26," tools; selecting none grants neither. "),jw(27,pt,1,0),hl(),Es(28,"label",11)(29,"input",23),vg("change",function(){pf(e);let s=eC();return hf(s.toggleAllSkills())}),hl(),Es(30,"span",24),xC(31,"Every skill in the catalogue ("),Es(32,"code",25),xC(33,"*"),hl(),xC(34,")"),hl()(),Es(35,"p",13),xC(36," Resolved at run time, so skills added later are granted too, without editing this agent. "),hl(),jw(37,ft,5,0,"ds-notice",26),jw(38,Ct,2,0,"ds-notice"),jw(39,_t,2,0,"p",4)(40,xt,2,0),hl(),Es(41,"ds-form-field",27)(42,"select",28)(43,"option",29),xC(44,"SIMPLE \u2014 Standard agent (single LLM call)"),hl(),Es(45,"option",29),xC(46,"ADVANCED \u2014 Multi-step reasoning loop"),hl(),Es(47,"option",29),xC(48,"LOOP \u2014 Bulk loop agent (no LLM, experimental)"),hl()(),MI(),hl(),jw(49,St,7,3,"ds-form-field",30),Es(50,"ds-fieldset",31)(51,"p",4),xC(52," The agents this one may delegate to. Selecting at least one grants it the "),Es(53,"code"),xC(54,"DELEGATE__delegate"),hl(),xC(55," tool; selecting none grants it no way to delegate. Entries are matched against agent names, never ids. "),jw(56,At,1,0),hl(),Es(57,"label",11)(58,"input",23),vg("change",function(){pf(e);let s=eC();return hf(s.toggleAllSubAgents())}),hl(),Es(59,"span",24),xC(60,"Every agent it can reach ("),Es(61,"code",25),xC(62,"*"),hl(),xC(63,")"),hl()(),Es(64,"p",13),xC(65," Resolved at run time, so agents added later can be delegated to as well, without editing this agent. "),hl(),jw(66,Et,6,1,"ds-notice",26),jw(67,Tt,2,0,"ds-notice"),jw(68,kt,2,0,"p",4)(69,Dt,2,0),Es(70,"p",4),xC(71," Advanced \u2014 add a glob instead of picking a name, for example "),Es(72,"code"),xC(73,"*Fixer"),hl(),xC(74," to cover BugFixer and StoryFixer. "),hl(),Es(75,"div",32)(76,"input",33),vg("keydown.enter",function(){pf(e);let s=eC();return hf(s.addSubAgent())}),hl(),MI(),Es(77,"button",34),vg("click",function(){pf(e);let s=eC();return hf(s.addSubAgent())}),xC(78," + "),hl()(),Es(79,"ds-form-field",35),fg(80,"input",36),MI(),jw(81,Lt,3,0,"div"),hl()(),jw(82,Vt,2,1,"ds-notice"),Es(83,"ds-form-actions")(84,"button",37),xC(85),hl(),jw(86,Pt,2,2,"button",38),Es(87,"button",39),vg("click",function(){pf(e);let s=eC();return hf(s.cancel())}),xC(88,"Cancel"),hl()()();}if(n&2){let e,i=eC();dg("formGroup",i.form),BE(3),dg("formControl",i.nameControl),xI(),BE(3),dg("formControl",i.enabledControl),xI(),BE(5),dg("formControl",i.descriptionControl),xI(),BE(2),Bw(i.modelAsFreeText()?13:14),BE(3),dg("formControl",i.instructionsControl),xI(),BE(),Bw(i.integrationRows().length>0||i.builtInRows().length>0?17:-1),BE(10),Bw(i.isPlatformMode?27:-1),BE(2),dg("checked",i.allSkillsSelected()),BE(8),Bw(i.namedSkillSelectionDropped()?37:-1),BE(),Bw(i.skillCatalogueUnavailable()?38:-1),BE(),Bw(i.skillRows().length===0?39:40),BE(3),dg("formControl",i.executionModeControl),xI(),BE(),dg("value",i.ExecutionMode.SIMPLE),BE(2),dg("value",i.ExecutionMode.ADVANCED),BE(2),dg("value",i.ExecutionMode.LOOP),BE(2),Bw(i.isLoopMode()?49:-1),BE(7),Bw(i.isPlatformMode?56:-1),BE(2),dg("checked",i.allSubAgentsSelected()),BE(8),Bw(i.namedSubAgentSelectionDropped()?66:-1),BE(),Bw(i.subAgentCandidatesUnavailable()?67:-1),BE(),Bw(i.subAgentRows().length===0?68:69),BE(8),dg("formControl",i.newSubAgentControl),xI(),BE(),dg("disabled",!i.newSubAgentControl.value.trim()),BE(2),dg("hint",i.delegationTimeoutHint())("error",i.delegationTimeoutControl.invalid?"Enter a valid positive whole number of seconds, or leave empty to inherit the server default.":null),BE(),dg("formControl",i.delegationTimeoutControl),lg("aria-invalid",i.delegationTimeoutControl.invalid),xI(),BE(),Bw(i.delegationTimeoutControl.value!==null?81:-1),BE(),Bw((e=i.submitError())?82:-1,e),BE(2),dg("disabled",i.form.invalid||i.isSubmitting()),BE(),Dl(" ",i.isEditMode()?"Save changes":"Create"," "),BE(),Bw(i.isEditMode()?86:-1);}}var Ke=class n{route=g(W);router=g(F$1);destroyRef=g(we);agentConfigController=g(U);defaultsController=g(N);defaultDelegationTimeoutSeconds=$i(null);exportService=g(K);integrationConfigState=g(O);integrationTypeController=g(_);skillState=g(o);aiModelState=g(A);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt$1({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(null),modelName:new Te(null,{validators:[fn.required,n.notBlankValidator]}),instructions:new Te(null),executionMode:new Te("SIMPLE",{nonNullable:true}),delegationTimeoutSeconds:new Te(null,{validators:[fn.min(1),fn.max(2147483647),fn.pattern(/^\d+$/)]}),enabled:new Te(false,{nonNullable:true}),loopConfig:new Te(null,{validators:[n.jsonValidator]})});static notBlankValidator(t){let e=t.value;return typeof e=="string"&&e.length>0&&e.trim().length===0?{required:true}:null}static jsonValidator(t){let e=t.value?.trim();if(!e)return null;try{return JSON.parse(e),null}catch(i){return {invalidJson:true}}}get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get modelNameControl(){return this.form.controls.modelName}get instructionsControl(){return this.form.controls.instructions}get executionModeControl(){return this.form.controls.executionMode}get delegationTimeoutControl(){return this.form.controls.delegationTimeoutSeconds}useDefaultDelegationTimeout(){this.delegationTimeoutControl.setValue(null),this.delegationTimeoutControl.markAsDirty();}delegationTimeoutHint=rT(()=>{let t=this.defaultDelegationTimeoutSeconds();return `How long each delegation launched by this agent waits without activity from the sub-agent, including its own delegations. When it runs out, the sub-agent and its active descendants are stopped and can be resumed. Leave empty to use the server default${t!==null?`: ${t} s (${t/60} min)`:""}.`});get enabledControl(){return this.form.controls.enabled}get loopConfigControl(){return this.form.controls.loopConfig}executionModeValue=F$2(this.form.controls.executionMode.valueChanges,{initialValue:this.form.controls.executionMode.value});isLoopMode=rT(()=>this.executionModeValue()==="LOOP");subAgentRows=$i([]);allSubAgentsSelected=$i(false);subAgentCandidatesUnavailable=$i(false);namedSubAgentSelectionDropped=rT(()=>this.allSubAgentsSelected()&&this.subAgentRows().some(t=>t.selected()));droppedUnresolvedSubAgents=rT(()=>this.allSubAgentsSelected()?this.subAgentRows().filter(t=>t.unresolved&&t.selected()).length:0);hasAnySubAgent=rT(()=>this.allSubAgentsSelected()||this.subAgentRows().some(t=>t.selected()));newSubAgentControl=new Te("",{nonNullable:true});isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);isExporting=$i(false);submitError=$i(null);ExecutionMode=qe$1;loopConfigPlaceholder=JSON.stringify({search:{tool:"SearchTalents",params:{talentId:["6ac76692a909eaaae0b078d6"],resolveTargets:["MANAGER"],next:null}},act:{agentName:"ProfileCaretaker",promptTemplate:"This talent has not completed their profile. As their manager, I need you to help me review and improve it."}},null,2);builtInRows=$i([]);inspectRoute(){let t=this.route.snapshot.paramMap.get("agentConfigId")??"";return this.isPlatformMode?["/agentos","admin","agent-configs",t,"inspect"]:["/agentos",this.namespaceId,"agent-configs",t,"inspect"]}configAgentExposureWarning=rT(()=>Ue({configEnabled:this.builtInRows().some(t=>t.type===Ge&&t.state()==="on"),integrationTypes:this.integrationRows().filter(t=>t.enabled()).map(t=>t.config.integrationType),hasSubAgents:this.hasAnySubAgent()}));modelOptions=$i({aliases:[],apiNames:[],current:null});modelCatalogueLoaded=$i(false);modelAsFreeText=rT(()=>{let{aliases:t,apiNames:e}=this.modelOptions();return this.modelCatalogueLoaded()&&t.length+e.length===0});applyModelCatalogue(t,e){this.modelOptions.set(E(t,e)),this.modelCatalogueLoaded.set(true);}integrationRows=$i([]);skillRows=$i([]);allSkillsSelected=$i(false);skillCatalogueUnavailable=$i(false);namedSkillSelectionDropped=rT(()=>this.allSkillsSelected()&&this.skillRows().some(t=>t.selected()));existingConfig=null;ngOnInit(){this.defaultsController.getAgentConfigDefaults().pipe(U$1(this.destroyRef),ha(()=>br(null))).subscribe(e=>this.defaultDelegationTimeoutSeconds.set(e?.delegationTimeoutSeconds??null));let t=this.route.snapshot.paramMap.get("agentConfigId");t?(this.isEditMode.set(true),this.loadConfigAndIntegrations(t)):this.loadIntegrations(void 0);}loadConfigAndIntegrations(t){this.isLoading.set(true),by({config:this.agentConfigController.getByIdAgentConfig(t),namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):br([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes(),skillCatalogue:this.loadSkillCatalogue(),delegationCandidates:this.loadDelegationCandidates(),models:this.aiModelState.listAvailable(this.namespaceId)}).pipe(U$1(this.destroyRef)).subscribe({next:({config:e,namespaceIntegrations:i,platformIntegrations:s,builtInTypes:c,skillCatalogue:C,delegationCandidates:E,models:T})=>{this.existingConfig=e,this.applyModelCatalogue(T,e.modelName??null),this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.modelNameControl.setValue(e.modelName??null),this.instructionsControl.setValue(e.instructions??null);let f=e.executionMode??(e.advancedExecution?"ADVANCED":"SIMPLE");this.executionModeControl.setValue(f),this.delegationTimeoutControl.setValue(e.delegationTimeoutSeconds??null),this.enabledControl.setValue(e.enabled??true),this.loopConfigControl.setValue(e.loopConfig!=null?JSON.stringify(e.loopConfig,null,2):null);let N=[...s,...i];this.integrationRows.set(this.buildIntegrationRows(N,e.integrations??void 0)),this.builtInRows.set(this.buildBuiltInRows(c,e.integrations??void 0)),this.allSubAgentsSelected.set(Be(e.subAgents)),this.subAgentRows.set(this.buildSubAgentRows(E,e.subAgents,e.name)),this.allSkillsSelected.set(o$1(e.skillSelectors)),this.skillRows.set(this.buildSkillRows(C,e.skillSelectors)),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadIntegrations(t){by({namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):br([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes(),skillCatalogue:this.loadSkillCatalogue(),delegationCandidates:this.loadDelegationCandidates(),models:this.aiModelState.listAvailable(this.namespaceId)}).pipe(U$1(this.destroyRef)).subscribe({next:({namespaceIntegrations:e,platformIntegrations:i,builtInTypes:s,skillCatalogue:c,delegationCandidates:C,models:E})=>{this.applyModelCatalogue(E,null);let T=[...i,...e];this.integrationRows.set(this.buildIntegrationRows(T,t??void 0)),this.builtInRows.set(this.buildBuiltInRows(s,t??void 0)),this.allSubAgentsSelected.set(false),this.subAgentRows.set(this.buildSubAgentRows(C,void 0,null)),this.allSkillsSelected.set(false),this.skillRows.set(this.buildSkillRows(c,void 0));}});}loadSkillCatalogue(){return (this.namespaceId?this.skillState.listEffective(this.namespaceId):this.skillState.listPlatform().pipe(ne(e=>e.map(i=>({id:i.id??"",name:i.name,description:i.description,namespaceId:i.namespaceId??null,readOnly:i.readOnly===true}))))).pipe(ha(e=>(console.error("[agent-config-form] failed to load the skill catalogue",e),this.skillCatalogueUnavailable.set(true),br([]))))}buildSkillRows(t,e){let s=(e??[]).map(f=>f.trim()).filter(f=>f.length>0).filter(f=>f!==r),c=i(s),C=new Set(t.map(f=>f.name.toLowerCase())),E=t.map(f=>({selector:f.name,name:f.name,description:f.description,platform:f.namespaceId==null,unresolved:false,selected:$i(c.has(f.name.toLowerCase()))})),T=new Set;for(let f of s){let N=l(f).toLowerCase();C.has(N)||T.has(N)||(T.add(N),E.push({selector:f,name:f,description:"",platform:false,unresolved:true,selected:$i(true)}));}return E}toggleSkill(t){t.selected.update(e=>!e);}toggleAllSkills(){this.allSkillsSelected.update(t=>!t);}buildSkillSelectorsPayload(){if(this.allSkillsSelected())return [r];let t=this.skillRows().filter(e=>e.selected()).map(e=>e.selector);return t.length>0?t:void 0}loadDelegationCandidates(){let t=this.agentConfigController.listPlatformAgentsAgentConfig(false).pipe(this.orNoCandidates()),e=this.namespaceId?this.agentConfigController.listByParentAgentConfig(this.namespaceId,false).pipe(this.orNoCandidates()):br([]);return by({platform:t,namespace:e}).pipe(ne(({platform:i,namespace:s})=>[...i,...s]),ne(i=>i.map(s=>s.name).filter(s=>s.length>0)),ne(i=>n.dedupeByKey(i)))}orNoCandidates(){return ha(t=>(console.error("[agent-config-form] failed to load the delegation candidates",t),this.subAgentCandidatesUnavailable.set(true),br([])))}static dedupeByKey(t){let e=new Set;return t.filter(i=>{let s=i.toLowerCase();return e.has(s)?false:(e.add(s),true)})}buildSubAgentRows(t,e,i){let s=$e(e),c=i?.toLowerCase()??null,C=t.filter(_=>{let O=_.toLowerCase();return O!==c||s.has(O)}),E=new Set(C.map(_=>_.toLowerCase())),T=C.map(_=>({selector:_,name:_,unresolved:false,pattern:false,grantedByPattern:Y(_,e),selected:$i(s.has(_.toLowerCase()))})),f=new Set,N=(e??[]).map(_=>_.trim()).filter(_=>_.length>0&&_!==F);for(let _ of N){let O=_.toLowerCase();E.has(O)||f.has(O)||(f.add(O),T.push({selector:_,name:_,unresolved:true,pattern:j(_),grantedByPattern:false,selected:$i(true)}));}return T}loadBuiltInTypes(){return this.integrationTypeController.listTypesIntegrationType().pipe(ne(t=>t.filter(e=>!e.configSchema)),ha(t=>(console.error("[agent-config-form] failed to load integration types",t),br([]))))}buildIntegrationRows(t,e){return t.map(i=>{let s=i.name??"",c=e?.[s],C=e!=null&&s in e,E=Array.isArray(c)?c.join(", "):"";return {config:i,enabled:$i(C),toolsControl:new Te(E,{nonNullable:true})}})}buildBuiltInRows(t,e){return t.map(i=>{let s=e!=null&&i.type in e,c=e?.[i.type],C=s?Array.isArray(c)&&c.length===0?"off":"on":"default";return {type:i.type,displayName:i.displayName,description:i.description,enabledByDefault:i.enabledByDefault===true,state:$i(C),restrictedTools:Array.isArray(c)&&c.length>0?c:null}})}toggleIntegration(t){t.enabled.update(e=>!e);}setBuiltInState(t,e){t.state.set(e);}builtInDefaultLabel(t){return t.enabledByDefault?"Platform default (enabled)":"Platform default (disabled)"}addSubAgent(){let t=this.newSubAgentControl.value.trim();if(!t)return;let e=this.subAgentRows().find(i=>i.selector.toLowerCase()===t.toLowerCase());e?e.selected.set(true):t===F?this.allSubAgentsSelected.set(true):this.subAgentRows.update(i=>this.withPatternGrants([...i,{selector:t,name:t,unresolved:true,pattern:j(t),grantedByPattern:false,selected:$i(true)}])),this.newSubAgentControl.reset("");}removeSubAgent(t){let e=t.selector.toLowerCase();this.subAgentRows.update(i=>this.withPatternGrants(i.filter(s=>s.selector.toLowerCase()!==e)));}toggleSubAgent(t){t.selected.update(e=>!e),t.pattern&&this.subAgentRows.update(e=>this.withPatternGrants(e));}withPatternGrants(t){let e=this.allSubAgentsSelected()?[]:t.filter(i=>i.selected()).map(i=>i.selector);return t.map(i=>i.unresolved?i:x(w({},i),{grantedByPattern:Y(i.name,e)}))}toggleAllSubAgents(){this.allSubAgentsSelected.update(t=>!t),this.subAgentRows.update(t=>this.withPatternGrants(t));}buildSubAgentsPayload(){if(this.allSubAgentsSelected())return [F];let t=this.subAgentRows().filter(e=>e.selected()).map(e=>e.selector);return t.length>0?t:void 0}buildIntegrationsPayload(){let t={};for(let i of this.integrationRows().filter(s=>s.enabled())){let s=i.config.name??"",c=i.toolsControl.value.trim();t[s]=c===""?null:c.split(",").map(C=>C.trim()).filter(C=>C.length>0);}for(let i of this.builtInRows()){let s=i.state();s==="on"?t[i.type]=i.restrictedTools??null:s==="off"&&(t[i.type]=[]);}let e=new Set([...this.integrationRows().map(i=>i.config.name??""),...this.builtInRows().map(i=>i.type)]);for(let[i,s]of Object.entries(this.existingConfig?.integrations??{}))e.has(i)||(t[i]=s);return Object.keys(t).length>0?t:void 0}submit(){if(this.form.invalid||this.isSubmitting())return;this.addSubAgent(),this.submitError.set(null),this.isSubmitting.set(true);let t=x(w({},this.existingConfig??{}),{createdOn:this.existingConfig?.createdOn,updatedOn:this.existingConfig?.updatedOn,namespaceId:this.namespaceId,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,modelName:this.modelNameControl.value?.trim()||void 0,instructions:this.instructionsControl.value?.trim()||void 0,integrations:this.buildIntegrationsPayload(),executionMode:this.executionModeControl.value,advancedExecution:this.executionModeControl.value==="ADVANCED",enabled:this.enabledControl.value,subAgents:this.buildSubAgentsPayload(),skillSelectors:this.buildSkillSelectorsPayload(),delegationTimeoutSeconds:this.delegationTimeoutControl.value,loopConfig:this.buildLoopConfigPayload()});(this.isEditMode()?this.agentConfigController.updateAgentConfig(this.existingConfig.id??"",t):this.agentConfigController.createAgentConfig(t)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:i=>{this.isSubmitting.set(false),this.submitError.set(n.serverMessage(i));}});}static serverMessage(t){let i=t?.error?.message;if(typeof i=="string"&&i.trim().length>0)return i;let s=t?.status;return s===0?"The server could not be reached. The agent was not saved.":typeof s=="number"&&s>=500?`The server failed to save the agent (HTTP ${s}). Nothing was changed.`:"The server refused the save and gave no reason. Check the values and try again."}exportYaml(){let t=this.existingConfig?.id;!t||this.isExporting()||(this.isExporting.set(true),this.exportService.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let i=new Blob([e],{type:"application/yaml"}),s=URL.createObjectURL(i),c=document.createElement("a");c.href=s,c.download=`${this.existingConfig?.name??"agent"}.yaml`,c.click(),URL.revokeObjectURL(s),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}buildLoopConfigPayload(){let t=this.loopConfigControl.value?.trim();if(!t)return this.existingConfig?.loopConfig!=null?null:void 0;try{return JSON.parse(t)}catch(e){return}}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=vw({type:n,selectors:[["agentos-agent-config-form"]],decls:8,vars:4,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to agent configs",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],["headerMeta","","variant","outline"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Agent"],["label","Name","controlId","agent-config-name","required",""],["dsControl","","id","agent-config-name","type","text","placeholder","e.g. Support agent","autocomplete","off",3,"formControl"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","Description","controlId","agent-config-description"],["dsControl","","id","agent-config-description","type","text","placeholder","Optional \u2014 short description of this agent","autocomplete","off",3,"formControl"],["label","Model","controlId","agent-config-model-name","required","","hint","Aliases are matched first, then API model names. Resolved when the agent runs."],["dsControl","","id","agent-config-model-name","type","text","placeholder","Model alias or name to use, e.g. BIG","autocomplete","off",3,"formControl"],["dsControl","","id","agent-config-model-name",3,"formControl"],["label","Instructions","controlId","agent-config-instructions"],["dsControl","","id","agent-config-instructions","rows","6","placeholder","Optional \u2014 system instructions for this agent",3,"formControl"],["legend","Integrations","hint","Select which integrations this agent can use. Leave tool names empty to allow all tools from an integration."],["legend","Skills"],["type","checkbox",3,"change","checked"],[1,"ds-strong"],[1,"ds-code"],["tone","warning"],["label","Execution mode","controlId","agent-config-execution-mode","hint",'SIMPLE runs a single LLM pass. ADVANCED uses an intention loop for complex tasks and requires a model that supports advanced execution, otherwise the agent fails to run. LOOP (experimental) starts one case per result of a tool, without an LLM \u2014 run it with "Launch loop" in the agent list menu.'],["dsControl","","id","agent-config-execution-mode",3,"formControl"],[3,"value"],["label","Loop configuration (JSON)","controlId","agent-config-loop-config",3,"error"],["legend","Sub-agents"],[1,"ds-inline"],["dsControl","","type","text","aria-label","New sub-agent pattern","placeholder","e.g. *Fixer","autocomplete","off",3,"keydown.enter","formControl"],["dsButton","","variant","icon","type","button","title","Add pattern","aria-label","Add pattern",3,"click","disabled"],["label","Delegation timeout (seconds)","controlId","delegation-timeout","hintId","delegation-timeout-hint","errorId","delegation-timeout-error",3,"hint","error"],["dsControl","","id","delegation-timeout","type","number","min","1","max","2147483647","step","1","placeholder","Server default","aria-describedby","delegation-timeout-hint delegation-timeout-error",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["disabled","",3,"ngValue"],[3,"ngValue"],["label","Aliases"],["label","API model names"],[1,"ds-meta"],["dsControl","","type","text","placeholder","Tool names, comma-separated (empty = all tools)","autocomplete","off",1,"ds-indent",3,"formControl"],[1,"ds-micro"],["dsControl","",1,"ds-indent","ds-control--auto",3,"change","id","value"],["value","default"],["value","on"],["value","off"],["type","checkbox",3,"change","checked","disabled"],["dsControl","","mono","","id","agent-config-loop-config","rows","10","spellcheck","false","autocomplete","off",3,"placeholder","formControl"],["dsCheck","",1,"ds-grow"],["dsButton","","variant","icon-danger","type","button","title","Remove"],["dsButton","","variant","icon-danger","type","button","title","Remove",3,"click"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,i){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return i.cancel()}),xC(3," \u2190 Agent configs "),hl(),jw(4,ze,2,1,"a",2),jw(5,Xe,2,0,"ds-tag",3),hl(),jw(6,Qe,2,0,"p",4)(7,Ot,89,33,"form",5),hl()),e&2&&(BE(),dg("title",i.isEditMode()?"Edit agent config":"New agent config"),BE(3),Bw(i.isEditMode()?4:-1),BE(),Bw(i.isPlatformMode?5:-1),BE(),Bw(i.isLoading()?6:7));},dependencies:[Ut,nd,bo,xo,Lt$1,kn,vn,Gt,mo,po,$r,qr,Vn,An,$t,pn,hn,cn,ln,dn,mn,at$1,an,rn,ko],encapsulation:2})};export{Ke as AgentConfigFormComponent};
@@ -1 +1 @@
1
- import {c}from'./chunk-C9uCCw8u.js';import {p as pt,T as Te$1,a as fn,U as Ut,n as nd,b as bo,x as xo,L as Lt,k as kn,u as vn,G as Gt,m as mo,c as po,$ as $r,V as Vn,A as An,d as pn,h as hn,e as cn,r as ln,g as dn,C as mn,i as at,j as an,t as rn}from'./chunk-Ncao0R2n.js';import {g,W,q as F,I as we$1,ag as U,ah as ke$1,ai as Ne$1,$ as $i,aj as Fe$1,a9 as F$1,ak as yd,r as rT,ac as by,K as U$1,a2 as ha,aa as br,N as x,L as w,v as vw,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,s as Dl,c as Bw,Y as Yw,f as fg,R as MI,U as Uw,t as eC,S as xI,k as $w,F as Fg,u as pf,w as hf,y as sh}from'./main-6MVJZWGK.js';var V=(n,t)=>t.value,ve=(n,t)=>t.id;function be(n,t){n&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function _e(n,t){if(n&1&&(Es(0,"ds-form-field",9),fg(1,"input",38),hl()),n&2){let e=eC(2);BE(),dg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function Se(n,t){if(n&1&&(Es(0,"a",39),xC(1,"Add an agent config"),hl(),xC(2," first. ")),n&2){let e=eC(3);dg("href","/agentos/"+e.namespaceId+"/agent-configs/new",sh);}}function xe(n,t){if(n&1&&(Es(0,"ds-form-field",10)(1,"p",2),xC(2," No agent configs available in this scope yet. "),jw(3,Se,3,1),hl()()),n&2){let e=eC(2);BE(3),Bw(e.isPlatformMode?-1:3);}}function Ee(n,t){if(n&1&&(Es(0,"option",17),xC(1),hl()),n&2){let e=t.$implicit;dg("value",e.id),BE(),Fg(e.name);}}function De(n,t){if(n&1&&(Es(0,"ds-form-field",11)(1,"select",40)(2,"option",41),xC(3,"Select an agent config\u2026"),hl(),Uw(4,Ee,2,2,"option",17,ve),hl(),MI(),hl()),n&2){let e=eC(2);dg("error",e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?"Agent Config is required.":null),BE(),dg("formControl",e.agentConfigIdControl),xI(),BE(3),$w(e.availableAgentConfigs());}}function Te(n,t){if(n&1&&(Es(0,"option",17),xC(1),hl()),n&2){let e=t.$implicit;dg("value",e.value),BE(),Fg(e.label);}}function Ne(n,t){if(n&1){let e=Yw();Es(0,"label",31)(1,"input",43),vg("change",function(){let f=pf(e).$implicit,h=eC(3);return hf(h.toggleDay(f.value))}),hl(),xC(2),hl();}if(n&2){let e=t.$implicit,l=eC(3);BE(),dg("checked",l.isDaySelected(e.value)),BE(),Dl(" ",e.label," ");}}function Ie(n,t){if(n&1&&(Es(0,"ds-form-field",18)(1,"div",42),Uw(2,Ne,3,2,"label",31,V),hl()()),n&2){let e=eC(2);BE(2),$w(e.dayOptions);}}function Me(n,t){if(n&1&&(Es(0,"option",17),xC(1),hl()),n&2){let e=t.$implicit;dg("value",e.value),BE(),Fg(e.label);}}function Pe(n,t){if(n&1&&(Es(0,"ds-form-field",28),fg(1,"input",44),MI(),hl()),n&2){let e=eC(2);dg("error",e.form.hasError("endDateRequired")&&e.endDateControl.touched?"End date is required.":null),BE(),dg("formControl",e.endDateControl),xI();}}function we(n,t){if(n&1&&(Es(0,"ds-form-field",29),fg(1,"input",45),MI(),hl()),n&2){let e=eC(2);dg("error",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?"Must be at least 1.":null),BE(),dg("formControl",e.occurrenceCountControl),xI();}}function Fe(n,t){if(n&1&&(Es(0,"ds-notice"),xC(1),hl()),n&2){let e=eC(2);BE(),Fg(e.errorMessage());}}function Oe(n,t){if(n&1){let e=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let f=eC();return hf(f.submit())}),Es(1,"ds-form-field",5),fg(2,"input",6),MI(),hl(),Es(3,"ds-form-field",7),fg(4,"input",8),MI(),hl(),jw(5,_e,2,1,"ds-form-field",9)(6,xe,4,1,"ds-form-field",10)(7,De,6,2,"ds-form-field",11),Es(8,"ds-form-field",12),fg(9,"textarea",13),MI(),hl(),Es(10,"ds-fieldset",14)(11,"ds-form-field",15)(12,"select",16),Uw(13,Te,2,2,"option",17,V),hl(),MI(),hl(),jw(15,Ie,4,0,"ds-form-field",18),Es(16,"ds-form-field",19)(17,"div",20),fg(18,"input",21),MI(),Es(19,"span",22),xC(20,"UTC"),hl()()()(),Es(21,"ds-fieldset",23)(22,"ds-form-field",24),fg(23,"input",25),MI(),hl(),Es(24,"ds-form-field",26)(25,"select",27),Uw(26,Me,2,2,"option",17,V),hl(),MI(),hl(),jw(28,Pe,2,2,"ds-form-field",28),jw(29,we,2,2,"ds-form-field",29),hl(),Es(30,"div",30)(31,"label",31),fg(32,"input",32),MI(),xC(33," Enabled "),hl(),Es(34,"p",33),xC(35,"When disabled, the scheduled prompt is saved but will not run on schedule."),hl()(),Es(36,"ds-form-field",34),fg(37,"textarea",35),MI(),hl(),jw(38,Fe,2,1,"ds-notice"),Es(39,"ds-form-actions")(40,"button",36),xC(41),hl(),Es(42,"button",37),vg("click",function(){pf(e);let f=eC();return hf(f.cancel())}),xC(43,"Cancel"),hl()()();}if(n&2){let e=eC();dg("formGroup",e.form),BE(),dg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),BE(),dg("formControl",e.nameControl),xI(),BE(2),dg("formControl",e.descriptionControl),xI(),BE(),Bw(e.isEditMode()?5:e.availableAgentConfigs().length===0?6:7),BE(3),dg("error",e.promptContentControl.invalid&&e.promptContentControl.touched?"Opening message is required.":null),BE(),dg("formControl",e.promptContentControl),xI(),BE(3),dg("formControl",e.unitControl),xI(),BE(),$w(e.schedulerUnits),BE(2),Bw(e.showDayFilter()?15:-1),BE(),dg("error",e.timeUtcControl.invalid&&e.timeUtcControl.touched?"Valid time is required (HH:mm).":null),BE(2),dg("formControl",e.timeUtcControl),xI(),BE(4),dg("error",e.startDateControl.invalid&&e.startDateControl.touched?"Start date is required.":null),BE(),dg("formControl",e.startDateControl),xI(),BE(2),dg("formControl",e.endTypeControl),xI(),BE(),$w(e.endTypes),BE(2),Bw(e.showEndDate()?28:-1),BE(),Bw(e.showOccurrenceCount()?29:-1),BE(3),dg("formControl",e.enabledControl),xI(),BE(4),dg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),BE(),dg("formControl",e.externalMetadataJsonControl),xI(),BE(),Bw(e.errorMessage()?38:-1),BE(2),dg("disabled",e.form.invalid||e.isSubmitting()),BE(),Dl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var ye=class n{route=g(W);router=g(F);destroyRef=g(we$1);state=g(c);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te$1("",{nonNullable:true,validators:[fn.required]}),description:new Te$1(null),agentConfigId:new Te$1("",{nonNullable:true,validators:[fn.required]}),promptContent:new Te$1("",{nonNullable:true,validators:[fn.required]}),unit:new Te$1(Ne$1.WEEK,{nonNullable:true,validators:[fn.required]}),days:new Te$1([],{nonNullable:true}),timeUtc:new Te$1("09:00",{nonNullable:true,validators:[fn.required,fn.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new Te$1("",{nonNullable:true,validators:[fn.required]}),endType:new Te$1(ke$1.NEVER,{nonNullable:true,validators:[fn.required]}),endDate:new Te$1(null),occurrenceCount:new Te$1(null),enabled:new Te$1(true,{nonNullable:true}),externalMetadataJson:new Te$1("",{nonNullable:true,validators:[ke]})},{validators:[Ae,Ve]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);errorMessage=$i(null);SchedulerUnit=Ne$1;SchedulerEndType=ke$1;schedulerUnits=[{value:Ne$1.WEEK,label:"Week(s)"},{value:Ne$1.MONTH,label:"Month(s)"}];endTypes=[{value:ke$1.NEVER,label:"Never"},{value:ke$1.ON_DATE,label:"On date"},{value:ke$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(Fe$1).map(([t,e])=>({value:t,label:e}));unitSignal=F$1(this.unitControl.valueChanges.pipe(yd(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(yd(this.endTypeControl.value)));showDayFilter=rT(()=>this.unitSignal()===Ne$1.WEEK);showEndDate=rT(()=>this.endTypeSignal()===ke$1.ON_DATE);showOccurrenceCount=rT(()=>this.endTypeSignal()===ke$1.OCCURRENCES);agentConfigs=$i([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Re());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),by({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U$1(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U$1(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(ha(()=>br([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,l=e.includes(t)?e.filter(f=>f!==t):[...e,t];this.daysControl.setValue(l);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===ke$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===ke$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let h=this.externalMetadataJsonControl.value.trim();return h?JSON.parse(h):null})()});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:h=>{this.isSubmitting.set(false),h.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):h.status===400?this.errorMessage.set(h.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=vw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to scheduled prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","sp-name","required","","hint",'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.',3,"error"],["dsControl","","id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",3,"formControl"],["label","Description","controlId","sp-description"],["dsControl","","id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",3,"formControl"],["label","Agent Config","required","","hint","Agent Config cannot be changed after creation."],["label","Agent Config","required",""],["label","Agent Config","controlId","sp-agent-config","required","","hint","Immutable after creation.",3,"error"],["label","Opening message","controlId","sp-prompt-content","required","","hint","The message sent to the agent when the scheduled prompt fires.",3,"error"],["dsControl","","id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",3,"formControl"],["legend","Recurrence"],["label","Unit","controlId","sp-unit","required",""],["dsControl","","id","sp-unit",3,"formControl"],[3,"value"],["label","Days of week","hint","Leave empty to run every day of the week."],["label","Time (UTC)","controlId","sp-time","required","",3,"error"],[1,"ds-inline"],["dsControl","","id","sp-time","type","time",3,"formControl"],[1,"ds-meta"],["legend","Planning"],["label","Start date","controlId","sp-start-date","required","",3,"error"],["dsControl","","id","sp-start-date","type","date",3,"formControl"],["label","Ends","controlId","sp-end-type","required",""],["dsControl","","id","sp-end-type",3,"formControl"],["label","End date","controlId","sp-end-date","required","",3,"error"],["label","Number of occurrences","controlId","sp-occurrence-count","required","",3,"error"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","External Metadata","controlId","sp-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsControl","","type","text","readonly","",3,"value"],[3,"href"],["dsControl","","id","sp-agent-config",3,"formControl"],["value","","disabled",""],[1,"ds-inline","ds-inline--wrap"],["type","checkbox",3,"change","checked"],["dsControl","","id","sp-end-date","type","date",3,"formControl"],["dsControl","","id","sp-occurrence-count","type","number","min","1",1,"ds-control--narrow",3,"formControl"]],template:function(e,l){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return l.cancel()}),xC(3),hl()(),jw(4,be,2,0,"p",2)(5,Oe,44,22,"form",3),hl()),e&2&&(BE(),dg("title",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"),BE(2),Dl(" \u2190 ",l.isPlatformMode?"Platform scheduled prompts":"Scheduled prompts"," "),BE(),Bw(l.isLoading()?4:5));},dependencies:[Ut,nd,bo,xo,Lt,kn,vn,Gt,mo,po,$r,Vn,An,pn,hn,cn,ln,dn,mn,at,an,rn],encapsulation:2})};function Ae(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===ke$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===ke$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function ke(n){let t=n.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}function Re(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${l}`}export{ye as ScheduledPromptFormComponent};
1
+ import {c}from'./chunk-DI3lyKCO.js';import {p as pt,T as Te$1,a as fn,U as Ut,n as nd,b as bo,x as xo,L as Lt,k as kn,u as vn,G as Gt,m as mo,c as po,$ as $r,V as Vn,A as An,d as pn,h as hn,e as cn,r as ln,g as dn,C as mn,i as at,j as an,t as rn}from'./chunk-CFzCpWz-.js';import {g,W,q as F,I as we$1,ag as U,ah as ke$1,ai as Ne$1,$ as $i,aj as Fe$1,a9 as F$1,ak as yd,r as rT,ac as by,K as U$1,a2 as ha,aa as br,N as x,L as w,v as vw,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,s as Dl,c as Bw,Y as Yw,f as fg,R as MI,U as Uw,t as eC,S as xI,k as $w,F as Fg,u as pf,w as hf,y as sh}from'./main-OK5QY7NU.js';var V=(n,t)=>t.value,ve=(n,t)=>t.id;function be(n,t){n&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function _e(n,t){if(n&1&&(Es(0,"ds-form-field",9),fg(1,"input",38),hl()),n&2){let e=eC(2);BE(),dg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function Se(n,t){if(n&1&&(Es(0,"a",39),xC(1,"Add an agent config"),hl(),xC(2," first. ")),n&2){let e=eC(3);dg("href","/agentos/"+e.namespaceId+"/agent-configs/new",sh);}}function xe(n,t){if(n&1&&(Es(0,"ds-form-field",10)(1,"p",2),xC(2," No agent configs available in this scope yet. "),jw(3,Se,3,1),hl()()),n&2){let e=eC(2);BE(3),Bw(e.isPlatformMode?-1:3);}}function Ee(n,t){if(n&1&&(Es(0,"option",17),xC(1),hl()),n&2){let e=t.$implicit;dg("value",e.id),BE(),Fg(e.name);}}function De(n,t){if(n&1&&(Es(0,"ds-form-field",11)(1,"select",40)(2,"option",41),xC(3,"Select an agent config\u2026"),hl(),Uw(4,Ee,2,2,"option",17,ve),hl(),MI(),hl()),n&2){let e=eC(2);dg("error",e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?"Agent Config is required.":null),BE(),dg("formControl",e.agentConfigIdControl),xI(),BE(3),$w(e.availableAgentConfigs());}}function Te(n,t){if(n&1&&(Es(0,"option",17),xC(1),hl()),n&2){let e=t.$implicit;dg("value",e.value),BE(),Fg(e.label);}}function Ne(n,t){if(n&1){let e=Yw();Es(0,"label",31)(1,"input",43),vg("change",function(){let f=pf(e).$implicit,h=eC(3);return hf(h.toggleDay(f.value))}),hl(),xC(2),hl();}if(n&2){let e=t.$implicit,l=eC(3);BE(),dg("checked",l.isDaySelected(e.value)),BE(),Dl(" ",e.label," ");}}function Ie(n,t){if(n&1&&(Es(0,"ds-form-field",18)(1,"div",42),Uw(2,Ne,3,2,"label",31,V),hl()()),n&2){let e=eC(2);BE(2),$w(e.dayOptions);}}function Me(n,t){if(n&1&&(Es(0,"option",17),xC(1),hl()),n&2){let e=t.$implicit;dg("value",e.value),BE(),Fg(e.label);}}function Pe(n,t){if(n&1&&(Es(0,"ds-form-field",28),fg(1,"input",44),MI(),hl()),n&2){let e=eC(2);dg("error",e.form.hasError("endDateRequired")&&e.endDateControl.touched?"End date is required.":null),BE(),dg("formControl",e.endDateControl),xI();}}function we(n,t){if(n&1&&(Es(0,"ds-form-field",29),fg(1,"input",45),MI(),hl()),n&2){let e=eC(2);dg("error",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?"Must be at least 1.":null),BE(),dg("formControl",e.occurrenceCountControl),xI();}}function Fe(n,t){if(n&1&&(Es(0,"ds-notice"),xC(1),hl()),n&2){let e=eC(2);BE(),Fg(e.errorMessage());}}function Oe(n,t){if(n&1){let e=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let f=eC();return hf(f.submit())}),Es(1,"ds-form-field",5),fg(2,"input",6),MI(),hl(),Es(3,"ds-form-field",7),fg(4,"input",8),MI(),hl(),jw(5,_e,2,1,"ds-form-field",9)(6,xe,4,1,"ds-form-field",10)(7,De,6,2,"ds-form-field",11),Es(8,"ds-form-field",12),fg(9,"textarea",13),MI(),hl(),Es(10,"ds-fieldset",14)(11,"ds-form-field",15)(12,"select",16),Uw(13,Te,2,2,"option",17,V),hl(),MI(),hl(),jw(15,Ie,4,0,"ds-form-field",18),Es(16,"ds-form-field",19)(17,"div",20),fg(18,"input",21),MI(),Es(19,"span",22),xC(20,"UTC"),hl()()()(),Es(21,"ds-fieldset",23)(22,"ds-form-field",24),fg(23,"input",25),MI(),hl(),Es(24,"ds-form-field",26)(25,"select",27),Uw(26,Me,2,2,"option",17,V),hl(),MI(),hl(),jw(28,Pe,2,2,"ds-form-field",28),jw(29,we,2,2,"ds-form-field",29),hl(),Es(30,"div",30)(31,"label",31),fg(32,"input",32),MI(),xC(33," Enabled "),hl(),Es(34,"p",33),xC(35,"When disabled, the scheduled prompt is saved but will not run on schedule."),hl()(),Es(36,"ds-form-field",34),fg(37,"textarea",35),MI(),hl(),jw(38,Fe,2,1,"ds-notice"),Es(39,"ds-form-actions")(40,"button",36),xC(41),hl(),Es(42,"button",37),vg("click",function(){pf(e);let f=eC();return hf(f.cancel())}),xC(43,"Cancel"),hl()()();}if(n&2){let e=eC();dg("formGroup",e.form),BE(),dg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),BE(),dg("formControl",e.nameControl),xI(),BE(2),dg("formControl",e.descriptionControl),xI(),BE(),Bw(e.isEditMode()?5:e.availableAgentConfigs().length===0?6:7),BE(3),dg("error",e.promptContentControl.invalid&&e.promptContentControl.touched?"Opening message is required.":null),BE(),dg("formControl",e.promptContentControl),xI(),BE(3),dg("formControl",e.unitControl),xI(),BE(),$w(e.schedulerUnits),BE(2),Bw(e.showDayFilter()?15:-1),BE(),dg("error",e.timeUtcControl.invalid&&e.timeUtcControl.touched?"Valid time is required (HH:mm).":null),BE(2),dg("formControl",e.timeUtcControl),xI(),BE(4),dg("error",e.startDateControl.invalid&&e.startDateControl.touched?"Start date is required.":null),BE(),dg("formControl",e.startDateControl),xI(),BE(2),dg("formControl",e.endTypeControl),xI(),BE(),$w(e.endTypes),BE(2),Bw(e.showEndDate()?28:-1),BE(),Bw(e.showOccurrenceCount()?29:-1),BE(3),dg("formControl",e.enabledControl),xI(),BE(4),dg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),BE(),dg("formControl",e.externalMetadataJsonControl),xI(),BE(),Bw(e.errorMessage()?38:-1),BE(2),dg("disabled",e.form.invalid||e.isSubmitting()),BE(),Dl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var ye=class n{route=g(W);router=g(F);destroyRef=g(we$1);state=g(c);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te$1("",{nonNullable:true,validators:[fn.required]}),description:new Te$1(null),agentConfigId:new Te$1("",{nonNullable:true,validators:[fn.required]}),promptContent:new Te$1("",{nonNullable:true,validators:[fn.required]}),unit:new Te$1(Ne$1.WEEK,{nonNullable:true,validators:[fn.required]}),days:new Te$1([],{nonNullable:true}),timeUtc:new Te$1("09:00",{nonNullable:true,validators:[fn.required,fn.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new Te$1("",{nonNullable:true,validators:[fn.required]}),endType:new Te$1(ke$1.NEVER,{nonNullable:true,validators:[fn.required]}),endDate:new Te$1(null),occurrenceCount:new Te$1(null),enabled:new Te$1(true,{nonNullable:true}),externalMetadataJson:new Te$1("",{nonNullable:true,validators:[ke]})},{validators:[Ae,Ve]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);errorMessage=$i(null);SchedulerUnit=Ne$1;SchedulerEndType=ke$1;schedulerUnits=[{value:Ne$1.WEEK,label:"Week(s)"},{value:Ne$1.MONTH,label:"Month(s)"}];endTypes=[{value:ke$1.NEVER,label:"Never"},{value:ke$1.ON_DATE,label:"On date"},{value:ke$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(Fe$1).map(([t,e])=>({value:t,label:e}));unitSignal=F$1(this.unitControl.valueChanges.pipe(yd(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(yd(this.endTypeControl.value)));showDayFilter=rT(()=>this.unitSignal()===Ne$1.WEEK);showEndDate=rT(()=>this.endTypeSignal()===ke$1.ON_DATE);showOccurrenceCount=rT(()=>this.endTypeSignal()===ke$1.OCCURRENCES);agentConfigs=$i([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Re());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),by({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U$1(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U$1(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(ha(()=>br([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,l=e.includes(t)?e.filter(f=>f!==t):[...e,t];this.daysControl.setValue(l);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===ke$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===ke$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let h=this.externalMetadataJsonControl.value.trim();return h?JSON.parse(h):null})()});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:h=>{this.isSubmitting.set(false),h.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):h.status===400?this.errorMessage.set(h.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=vw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to scheduled prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","sp-name","required","","hint",'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.',3,"error"],["dsControl","","id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",3,"formControl"],["label","Description","controlId","sp-description"],["dsControl","","id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",3,"formControl"],["label","Agent Config","required","","hint","Agent Config cannot be changed after creation."],["label","Agent Config","required",""],["label","Agent Config","controlId","sp-agent-config","required","","hint","Immutable after creation.",3,"error"],["label","Opening message","controlId","sp-prompt-content","required","","hint","The message sent to the agent when the scheduled prompt fires.",3,"error"],["dsControl","","id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",3,"formControl"],["legend","Recurrence"],["label","Unit","controlId","sp-unit","required",""],["dsControl","","id","sp-unit",3,"formControl"],[3,"value"],["label","Days of week","hint","Leave empty to run every day of the week."],["label","Time (UTC)","controlId","sp-time","required","",3,"error"],[1,"ds-inline"],["dsControl","","id","sp-time","type","time",3,"formControl"],[1,"ds-meta"],["legend","Planning"],["label","Start date","controlId","sp-start-date","required","",3,"error"],["dsControl","","id","sp-start-date","type","date",3,"formControl"],["label","Ends","controlId","sp-end-type","required",""],["dsControl","","id","sp-end-type",3,"formControl"],["label","End date","controlId","sp-end-date","required","",3,"error"],["label","Number of occurrences","controlId","sp-occurrence-count","required","",3,"error"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","External Metadata","controlId","sp-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsControl","","type","text","readonly","",3,"value"],[3,"href"],["dsControl","","id","sp-agent-config",3,"formControl"],["value","","disabled",""],[1,"ds-inline","ds-inline--wrap"],["type","checkbox",3,"change","checked"],["dsControl","","id","sp-end-date","type","date",3,"formControl"],["dsControl","","id","sp-occurrence-count","type","number","min","1",1,"ds-control--narrow",3,"formControl"]],template:function(e,l){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return l.cancel()}),xC(3),hl()(),jw(4,be,2,0,"p",2)(5,Oe,44,22,"form",3),hl()),e&2&&(BE(),dg("title",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"),BE(2),Dl(" \u2190 ",l.isPlatformMode?"Platform scheduled prompts":"Scheduled prompts"," "),BE(),Bw(l.isLoading()?4:5));},dependencies:[Ut,nd,bo,xo,Lt,kn,vn,Gt,mo,po,$r,Vn,An,pn,hn,cn,ln,dn,mn,at,an,rn],encapsulation:2})};function Ae(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===ke$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===ke$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function ke(n){let t=n.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}function Re(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${l}`}export{ye as ScheduledPromptFormComponent};
@@ -1 +1 @@
1
- import {D as m,p as pt,E as Bt,T as Te,a as fn,U as Ut,n as nd,b as bo,x as xo,L as Lt,G as Gt,m as mo,c as po,V as Vn,A as An,v as va,F as go,_ as _o,d as pn,h as hn,e as cn,r as ln,g as dn,C as mn,i as at,j as an}from'./chunk-Ncao0R2n.js';import {g,W,q as F,I as we,ag as U,$ as $i,K as U$1,a2 as ha,aa as br,N as x,L as w,v as vw,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,s as Dl,c as Bw,Y as Yw,f as fg,R as MI,U as Uw,am as Vw,t as eC,S as xI,F as Fg,k as $w,l as lg,u as pf,w as hf}from'./main-6MVJZWGK.js';var ce=(o,t)=>t.id;function ue(o,t){o&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function fe(o,t){if(o&1&&(Es(0,"ds-form-field",20),fg(1,"input",22),hl()),o&2){let e=eC(3);BE(),dg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function ge(o,t){if(o&1&&(Es(0,"option",24),xC(1),hl()),o&2){let e=t.$implicit;dg("ngValue",e.id),BE(),Fg(e.name);}}function Ce(o,t){if(o&1&&(Es(0,"ds-form-field",21)(1,"select",23)(2,"option",24),xC(3,"\u2014 None \u2014"),hl(),Uw(4,ge,2,2,"option",24,ce),hl(),MI(),hl()),o&2){let e=eC(3);BE(),dg("formControl",e.agentConfigIdControl),xI(),BE(),dg("ngValue",null),BE(2),$w(e.availableAgentConfigs());}}function ye(o,t){if(o&1&&jw(0,fe,2,1,"ds-form-field",20)(1,Ce,6,2,"ds-form-field",21),o&2){let e=eC(2);Bw(e.isEditMode()&&e.agentConfigIdControl.value?0:e.isEditMode()?-1:1);}}function ve(o,t){o&1&&(Es(0,"p",2),xC(1,"No parameters defined."),hl());}function he(o,t){if(o&1){let e=Yw();Es(0,"div",11)(1,"div",25)(2,"ds-form-field",26),fg(3,"input",27),MI(),hl(),Es(4,"ds-form-field",28),fg(5,"input",29),MI(),hl(),Es(6,"ds-form-field",30),fg(7,"input",31),MI(),hl()(),Es(8,"button",32),vg("click",function(){let d=pf(e).$index,m=eC(2);return hf(m.removeParameter(d))}),xC(9," \xD7 "),hl()();}if(o&2){let e=t.$implicit,r=t.$index;dg("formGroupName",r),BE(2),dg("controlId","param-name-"+r)("error",e.controls.name.invalid&&e.controls.name.touched?"Parameter name is required.":null),BE(),dg("id","param-name-"+r),xI(),BE(),dg("controlId","param-desc-"+r),BE(),dg("id","param-desc-"+r),xI(),BE(),dg("controlId","param-default-"+r),BE(),dg("id","param-default-"+r),xI();}}function _e(o,t){if(o&1){let e=Yw();Es(0,"div",14)(1,"span",33),xC(2),hl(),Es(3,"ds-form-field",34),fg(4,"textarea",35),MI(),hl(),Es(5,"button",36),vg("click",function(){let d=pf(e).$index,m=eC(2);return hf(m.removeContentEntry(d))}),xC(6," \xD7 "),hl()();}if(o&2){let e=t.$implicit,r=t.$index,d=eC(2);BE(2),Fg(r+1),BE(),dg("error",e.invalid&&e.touched?"Content entry must not be blank.":null),BE(),dg("formControlName",r),lg("aria-label","Content entry "+(r+1)),xI(),BE(),dg("disabled",d.contentArray.length===1);}}function xe(o,t){if(o&1&&(Es(0,"ds-notice"),xC(1),hl()),o&2){let e=eC(2);BE(),Fg(e.errorMessage());}}function be(o,t){if(o&1){let e=Yw();Es(0,"button",37),vg("click",function(){pf(e);let d=eC(2);return hf(d.exportYaml())}),xC(1),hl();}if(o&2){let e=eC(2);dg("disabled",e.isExporting()),BE(),Dl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ee(o,t){if(o&1){let e=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let d=eC();return hf(d.submit())}),Es(1,"ds-form-field",5),fg(2,"input",6),MI(),hl(),Es(3,"ds-form-field",7),fg(4,"input",8),MI(),hl(),jw(5,ye,2,1),Es(6,"ds-fieldset",9)(7,"p",2),xC(8," Each parameter must have a name and a default value. Use "),Es(9,"code"),xC(10),hl(),xC(11," in content entries to reference them. "),hl(),Es(12,"div",10),jw(13,ve,2,0,"p",2),Uw(14,he,10,8,"div",11,Vw),Es(16,"div")(17,"button",12),vg("click",function(){pf(e);let d=eC();return hf(d.addParameter())}),xC(18,"+ Add parameter"),hl()()()(),Es(19,"ds-fieldset",13)(20,"p",2),xC(21," Each content entry is a command. Use "),Es(22,"code"),xC(23,"@AgentName"),hl(),xC(24," to target an agent, "),Es(25,"code"),xC(26,"/promptName param1 param2"),hl(),xC(27," to call another prompt, and "),Es(28,"code"),xC(29),hl(),xC(30," for parameter placeholders. "),hl(),Es(31,"div",10),Uw(32,_e,7,5,"div",14,Vw),Es(34,"div")(35,"button",12),vg("click",function(){pf(e);let d=eC();return hf(d.addContentEntry())}),xC(36,"+ Add content entry"),hl()()()(),jw(37,xe,2,1,"ds-notice"),Es(38,"ds-form-field",15),fg(39,"textarea",16),MI(),hl(),Es(40,"ds-form-actions")(41,"button",17),xC(42),hl(),jw(43,be,2,2,"button",18),Es(44,"button",19),vg("click",function(){pf(e);let d=eC();return hf(d.cancel())}),xC(45,"Cancel"),hl()()();}if(o&2){let e=eC();dg("formGroup",e.form),BE(),dg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),BE(),dg("formControl",e.nameControl),xI(),BE(2),dg("formControl",e.descriptionControl),xI(),BE(),Bw(e.availableAgentConfigs().length>0?5:-1),BE(5),Fg(e.paramPlaceholderSyntax),BE(2),dg("formArrayName","parameters"),BE(),Bw(e.parametersArray.length===0?13:-1),BE(),$w(e.parametersArray.controls),BE(15),Fg(e.paramPlaceholderSyntax),BE(2),dg("formArrayName","content"),BE(),$w(e.contentArray.controls),BE(5),Bw(e.errorMessage()?37:-1),BE(),dg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),BE(),dg("formControl",e.externalMetadataJsonControl),xI(),BE(2),dg("disabled",e.form.invalid||e.isSubmitting()),BE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," "),BE(),Bw(e.isEditMode()?43:-1);}}var pe=class o{route=g(W);router=g(F);destroyRef=g(we);promptState=g(m);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(null),agentConfigId:new Te(null),externalMetadataJson:new Te("",{nonNullable:true,validators:[Pe]}),content:new Bt([this.createContentControl()],{validators:[fn.required]}),parameters:new Bt([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);isExporting=$i(false);errorMessage=$i(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=$i([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(true),this.loadPrompt(t)),this.isPlatformMode?this.loadPlatformAgentConfigs():this.namespaceId&&this.loadAgentConfigs(this.namespaceId);}loadPrompt(t){this.isLoading.set(true),this.promptState.getById(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadAgentConfigs(t){this.agentConfigController.listByParentAgentConfig(t).pipe(U$1(this.destroyRef),ha(()=>br([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U$1(this.destroyRef),ha(()=>br([]))).subscribe(t=>this.agentConfigs.set(t));}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(r=>this.contentArray.push(this.createContentControl(r))),this.parametersArray.clear(),(t.parameters??[]).forEach(r=>this.parametersArray.push(this.createParameterGroup(r))),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}createContentControl(t=""){return new Te(t,{nonNullable:true,validators:[fn.required,fn.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl());}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t);}createParameterGroup(t){return new pt({name:new Te(t?.name??"",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(t?.description??null),defaultValue:new Te(t?.defaultValue??"",{nonNullable:true,validators:[fn.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup());}removeParameter(t){this.parametersArray.removeAt(t);}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId,sourceLanguage:this.existingPrompt?.sourceLanguage??"en",name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(m=>m.value.trim()),parameters:this.parametersArray.controls.map(m=>({name:m.controls.name.value.trim(),description:m.controls.description.value?.trim()||void 0,defaultValue:m.controls.defaultValue.value.trim()}))});t||(e.agentConfigId=this.agentConfigIdControl.value||null);let r=this.externalMetadataJsonControl.value.trim();e.externalMetadata=r?JSON.parse(r):null;let d=t?this.promptState.update(this.existingPrompt.id,e):this.promptState.create(e);this.errorMessage.set(null),d.pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:m=>{this.isSubmitting.set(false),m.status===409?this.errorMessage.set(`A prompt named "${e.name}" already exists in this scope.`):m.status===400?this.errorMessage.set(m.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}exportYaml(){let t=this.existingPrompt?.id;!t||this.isExporting()||(this.isExporting.set(true),this.promptState.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let r=new Blob([e],{type:"application/yaml"}),d=URL.createObjectURL(r),m=document.createElement("a");m.href=d,m.download=`${this.existingPrompt?.name??"prompt"}.yaml`,m.click(),URL.revokeObjectURL(d),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"]);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=vw({type:o,selectors:[["agentos-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","prompt-name","required","",3,"error"],["dsControl","","id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",3,"formControl"],["label","Description","controlId","prompt-description"],["dsControl","","id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",3,"formControl"],["legend","Parameters","legendHint","Named placeholders used in content"],[1,"ds-stack",3,"formArrayName"],[1,"ds-panel","ds-inline","ds-inline--start",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["legend","Content","legendHint","Ordered list of text commands"],[1,"ds-inline","ds-inline--start"],["label","External Metadata","controlId","prompt-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["label","Agent Config","hint","Agent Config cannot be changed after creation."],["label","Agent Config","controlId","prompt-agent-config","hint","Optional. Links this prompt to an agent as a starter. Immutable after creation."],["dsControl","","type","text","readonly","",3,"value"],["dsControl","","id","prompt-agent-config",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-grow"],["label","Name","required","",3,"controlId","error"],["dsControl","","type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",3,"id"],["label","Description",3,"controlId"],["dsControl","","type","text","placeholder","Optional","formControlName","description","autocomplete","off",3,"id"],["label","Default value",3,"controlId"],["dsControl","","type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",3,"id"],["dsButton","","variant","icon-danger","type","button","title","Remove this parameter","aria-label","Remove this parameter",3,"click"],[1,"ds-index"],["grow","",3,"error"],["dsControl","","rows","4","placeholder","Enter a command\u2026",3,"formControlName"],["dsButton","","variant","icon-danger","type","button","title","Remove this entry","aria-label","Remove this entry",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,r){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return r.cancel()}),xC(3),hl()(),jw(4,ue,2,0,"p",2)(5,Ee,46,16,"form",3),hl()),e&2&&(BE(),dg("title",r.isEditMode()?"Edit prompt":"New prompt"),BE(2),Dl(" \u2190 ",r.isPlatformMode?"Platform prompts":"Prompts"," "),BE(),Bw(r.isLoading()?4:5));},dependencies:[Ut,nd,bo,xo,Lt,Gt,mo,po,Vn,An,va,go,_o,pn,hn,cn,ln,dn,mn,at,an],encapsulation:2})};function Pe(o){let t=o.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}export{pe as PromptFormComponent};
1
+ import {D as m,p as pt,E as Bt,T as Te,a as fn,U as Ut,n as nd,b as bo,x as xo,L as Lt,G as Gt,m as mo,c as po,V as Vn,A as An,v as va,F as go,_ as _o,d as pn,h as hn,e as cn,r as ln,g as dn,C as mn,i as at,j as an}from'./chunk-CFzCpWz-.js';import {g,W,q as F,I as we,ag as U,$ as $i,K as U$1,a2 as ha,aa as br,N as x,L as w,v as vw,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,s as Dl,c as Bw,Y as Yw,f as fg,R as MI,U as Uw,am as Vw,t as eC,S as xI,F as Fg,k as $w,l as lg,u as pf,w as hf}from'./main-OK5QY7NU.js';var ce=(o,t)=>t.id;function ue(o,t){o&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function fe(o,t){if(o&1&&(Es(0,"ds-form-field",20),fg(1,"input",22),hl()),o&2){let e=eC(3);BE(),dg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function ge(o,t){if(o&1&&(Es(0,"option",24),xC(1),hl()),o&2){let e=t.$implicit;dg("ngValue",e.id),BE(),Fg(e.name);}}function Ce(o,t){if(o&1&&(Es(0,"ds-form-field",21)(1,"select",23)(2,"option",24),xC(3,"\u2014 None \u2014"),hl(),Uw(4,ge,2,2,"option",24,ce),hl(),MI(),hl()),o&2){let e=eC(3);BE(),dg("formControl",e.agentConfigIdControl),xI(),BE(),dg("ngValue",null),BE(2),$w(e.availableAgentConfigs());}}function ye(o,t){if(o&1&&jw(0,fe,2,1,"ds-form-field",20)(1,Ce,6,2,"ds-form-field",21),o&2){let e=eC(2);Bw(e.isEditMode()&&e.agentConfigIdControl.value?0:e.isEditMode()?-1:1);}}function ve(o,t){o&1&&(Es(0,"p",2),xC(1,"No parameters defined."),hl());}function he(o,t){if(o&1){let e=Yw();Es(0,"div",11)(1,"div",25)(2,"ds-form-field",26),fg(3,"input",27),MI(),hl(),Es(4,"ds-form-field",28),fg(5,"input",29),MI(),hl(),Es(6,"ds-form-field",30),fg(7,"input",31),MI(),hl()(),Es(8,"button",32),vg("click",function(){let d=pf(e).$index,m=eC(2);return hf(m.removeParameter(d))}),xC(9," \xD7 "),hl()();}if(o&2){let e=t.$implicit,r=t.$index;dg("formGroupName",r),BE(2),dg("controlId","param-name-"+r)("error",e.controls.name.invalid&&e.controls.name.touched?"Parameter name is required.":null),BE(),dg("id","param-name-"+r),xI(),BE(),dg("controlId","param-desc-"+r),BE(),dg("id","param-desc-"+r),xI(),BE(),dg("controlId","param-default-"+r),BE(),dg("id","param-default-"+r),xI();}}function _e(o,t){if(o&1){let e=Yw();Es(0,"div",14)(1,"span",33),xC(2),hl(),Es(3,"ds-form-field",34),fg(4,"textarea",35),MI(),hl(),Es(5,"button",36),vg("click",function(){let d=pf(e).$index,m=eC(2);return hf(m.removeContentEntry(d))}),xC(6," \xD7 "),hl()();}if(o&2){let e=t.$implicit,r=t.$index,d=eC(2);BE(2),Fg(r+1),BE(),dg("error",e.invalid&&e.touched?"Content entry must not be blank.":null),BE(),dg("formControlName",r),lg("aria-label","Content entry "+(r+1)),xI(),BE(),dg("disabled",d.contentArray.length===1);}}function xe(o,t){if(o&1&&(Es(0,"ds-notice"),xC(1),hl()),o&2){let e=eC(2);BE(),Fg(e.errorMessage());}}function be(o,t){if(o&1){let e=Yw();Es(0,"button",37),vg("click",function(){pf(e);let d=eC(2);return hf(d.exportYaml())}),xC(1),hl();}if(o&2){let e=eC(2);dg("disabled",e.isExporting()),BE(),Dl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ee(o,t){if(o&1){let e=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let d=eC();return hf(d.submit())}),Es(1,"ds-form-field",5),fg(2,"input",6),MI(),hl(),Es(3,"ds-form-field",7),fg(4,"input",8),MI(),hl(),jw(5,ye,2,1),Es(6,"ds-fieldset",9)(7,"p",2),xC(8," Each parameter must have a name and a default value. Use "),Es(9,"code"),xC(10),hl(),xC(11," in content entries to reference them. "),hl(),Es(12,"div",10),jw(13,ve,2,0,"p",2),Uw(14,he,10,8,"div",11,Vw),Es(16,"div")(17,"button",12),vg("click",function(){pf(e);let d=eC();return hf(d.addParameter())}),xC(18,"+ Add parameter"),hl()()()(),Es(19,"ds-fieldset",13)(20,"p",2),xC(21," Each content entry is a command. Use "),Es(22,"code"),xC(23,"@AgentName"),hl(),xC(24," to target an agent, "),Es(25,"code"),xC(26,"/promptName param1 param2"),hl(),xC(27," to call another prompt, and "),Es(28,"code"),xC(29),hl(),xC(30," for parameter placeholders. "),hl(),Es(31,"div",10),Uw(32,_e,7,5,"div",14,Vw),Es(34,"div")(35,"button",12),vg("click",function(){pf(e);let d=eC();return hf(d.addContentEntry())}),xC(36,"+ Add content entry"),hl()()()(),jw(37,xe,2,1,"ds-notice"),Es(38,"ds-form-field",15),fg(39,"textarea",16),MI(),hl(),Es(40,"ds-form-actions")(41,"button",17),xC(42),hl(),jw(43,be,2,2,"button",18),Es(44,"button",19),vg("click",function(){pf(e);let d=eC();return hf(d.cancel())}),xC(45,"Cancel"),hl()()();}if(o&2){let e=eC();dg("formGroup",e.form),BE(),dg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),BE(),dg("formControl",e.nameControl),xI(),BE(2),dg("formControl",e.descriptionControl),xI(),BE(),Bw(e.availableAgentConfigs().length>0?5:-1),BE(5),Fg(e.paramPlaceholderSyntax),BE(2),dg("formArrayName","parameters"),BE(),Bw(e.parametersArray.length===0?13:-1),BE(),$w(e.parametersArray.controls),BE(15),Fg(e.paramPlaceholderSyntax),BE(2),dg("formArrayName","content"),BE(),$w(e.contentArray.controls),BE(5),Bw(e.errorMessage()?37:-1),BE(),dg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),BE(),dg("formControl",e.externalMetadataJsonControl),xI(),BE(2),dg("disabled",e.form.invalid||e.isSubmitting()),BE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," "),BE(),Bw(e.isEditMode()?43:-1);}}var pe=class o{route=g(W);router=g(F);destroyRef=g(we);promptState=g(m);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(null),agentConfigId:new Te(null),externalMetadataJson:new Te("",{nonNullable:true,validators:[Pe]}),content:new Bt([this.createContentControl()],{validators:[fn.required]}),parameters:new Bt([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);isExporting=$i(false);errorMessage=$i(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=$i([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(true),this.loadPrompt(t)),this.isPlatformMode?this.loadPlatformAgentConfigs():this.namespaceId&&this.loadAgentConfigs(this.namespaceId);}loadPrompt(t){this.isLoading.set(true),this.promptState.getById(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadAgentConfigs(t){this.agentConfigController.listByParentAgentConfig(t).pipe(U$1(this.destroyRef),ha(()=>br([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U$1(this.destroyRef),ha(()=>br([]))).subscribe(t=>this.agentConfigs.set(t));}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(r=>this.contentArray.push(this.createContentControl(r))),this.parametersArray.clear(),(t.parameters??[]).forEach(r=>this.parametersArray.push(this.createParameterGroup(r))),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}createContentControl(t=""){return new Te(t,{nonNullable:true,validators:[fn.required,fn.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl());}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t);}createParameterGroup(t){return new pt({name:new Te(t?.name??"",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(t?.description??null),defaultValue:new Te(t?.defaultValue??"",{nonNullable:true,validators:[fn.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup());}removeParameter(t){this.parametersArray.removeAt(t);}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId,sourceLanguage:this.existingPrompt?.sourceLanguage??"en",name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(m=>m.value.trim()),parameters:this.parametersArray.controls.map(m=>({name:m.controls.name.value.trim(),description:m.controls.description.value?.trim()||void 0,defaultValue:m.controls.defaultValue.value.trim()}))});t||(e.agentConfigId=this.agentConfigIdControl.value||null);let r=this.externalMetadataJsonControl.value.trim();e.externalMetadata=r?JSON.parse(r):null;let d=t?this.promptState.update(this.existingPrompt.id,e):this.promptState.create(e);this.errorMessage.set(null),d.pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:m=>{this.isSubmitting.set(false),m.status===409?this.errorMessage.set(`A prompt named "${e.name}" already exists in this scope.`):m.status===400?this.errorMessage.set(m.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}exportYaml(){let t=this.existingPrompt?.id;!t||this.isExporting()||(this.isExporting.set(true),this.promptState.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let r=new Blob([e],{type:"application/yaml"}),d=URL.createObjectURL(r),m=document.createElement("a");m.href=d,m.download=`${this.existingPrompt?.name??"prompt"}.yaml`,m.click(),URL.revokeObjectURL(d),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"]);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=vw({type:o,selectors:[["agentos-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","prompt-name","required","",3,"error"],["dsControl","","id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",3,"formControl"],["label","Description","controlId","prompt-description"],["dsControl","","id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",3,"formControl"],["legend","Parameters","legendHint","Named placeholders used in content"],[1,"ds-stack",3,"formArrayName"],[1,"ds-panel","ds-inline","ds-inline--start",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["legend","Content","legendHint","Ordered list of text commands"],[1,"ds-inline","ds-inline--start"],["label","External Metadata","controlId","prompt-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["label","Agent Config","hint","Agent Config cannot be changed after creation."],["label","Agent Config","controlId","prompt-agent-config","hint","Optional. Links this prompt to an agent as a starter. Immutable after creation."],["dsControl","","type","text","readonly","",3,"value"],["dsControl","","id","prompt-agent-config",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-grow"],["label","Name","required","",3,"controlId","error"],["dsControl","","type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",3,"id"],["label","Description",3,"controlId"],["dsControl","","type","text","placeholder","Optional","formControlName","description","autocomplete","off",3,"id"],["label","Default value",3,"controlId"],["dsControl","","type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",3,"id"],["dsButton","","variant","icon-danger","type","button","title","Remove this parameter","aria-label","Remove this parameter",3,"click"],[1,"ds-index"],["grow","",3,"error"],["dsControl","","rows","4","placeholder","Enter a command\u2026",3,"formControlName"],["dsButton","","variant","icon-danger","type","button","title","Remove this entry","aria-label","Remove this entry",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,r){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return r.cancel()}),xC(3),hl()(),jw(4,ue,2,0,"p",2)(5,Ee,46,16,"form",3),hl()),e&2&&(BE(),dg("title",r.isEditMode()?"Edit prompt":"New prompt"),BE(2),Dl(" \u2190 ",r.isPlatformMode?"Platform prompts":"Prompts"," "),BE(),Bw(r.isLoading()?4:5));},dependencies:[Ut,nd,bo,xo,Lt,Gt,mo,po,Vn,An,va,go,_o,pn,hn,cn,ln,dn,mn,at,an],encapsulation:2})};function Pe(o){let t=o.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}export{pe as PromptFormComponent};
@@ -1 +1 @@
1
- import {D as m,z as k,O as O$1,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-Ncao0R2n.js';import {g,q as F,I as we,Z as Tr,$ as $i,a1 as ga,K as U$1,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,s as Dl,Y as Yw,l as lg,u as pf,w as hf}from'./main-6MVJZWGK.js';var j=(t,e)=>e.id??e.name;function A(t,e){if(t&1&&(Es(0,"p",3),xC(1),hl()),t&2){let n=eC();BE(),Fg(n.deletion.error());}}function K(t,e){t&1&&(Es(0,"p",4),xC(1,"Loading prompts\u2026"),hl());}function H(t,e){t&1&&(Es(0,"p",5),xC(1,"No platform prompts defined yet."),hl());}function U(t,e){t&1&&(Es(0,"p",4),xC(1,"No prompts match the current filter."),hl());}function z(t,e){if(t&1){let n=Yw();Es(0,"button",18),vg("click",function(){pf(n);let m=eC().$implicit,p=eC(2);return hf(p.edit(m))}),xC(1,"Edit"),hl();}if(t&2){let n=eC().$implicit;lg("aria-label","Edit "+n.name);}}function G(t,e){if(t&1){let n=Yw();Es(0,"agentos-row-delete-action",19),vg("deleteRequested",function(){pf(n);let m=eC().$implicit,p=eC(2);return hf(p.deletion.request(m.id))})("deleteConfirmed",function(){pf(n);let m=eC().$implicit,p=eC(2);return hf(p.confirmDelete(m))})("deleteCancelled",function(){pf(n);let m=eC(3);return hf(m.deletion.cancel())}),hl();}if(t&2){let n=eC().$implicit,r=eC(2);dg("rowKey",n.id)("rowLabel",n.name)("state",r.deletion);}}function J(t,e){if(t&1&&(Es(0,"tr",9)(1,"td",12),xC(2),hl(),Es(3,"td",13),xC(4),hl(),Es(5,"td",14)(6,"div",15),jw(7,z,2,1,"button",16),jw(8,G,1,3,"agentos-row-delete-action",17),hl()()()),t&2){let n=e.$implicit,r=eC(2);BE(2),Fg(n.name),BE(2),Dl(" ",n.description||"\u2014"," "),BE(3),Bw(r.deletion.confirmingId()!==n.id?7:-1),BE(),Bw(n.id?8:-1);}}function O(t,e){if(t&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Description"),hl(),Es(8,"th",10)(9,"span",11),xC(10,"Actions"),hl()()()(),Es(11,"tbody",8),Uw(12,J,9,4,"tr",9,j),hl()()()),t&2){let n=eC();BE(12),$w(n.rowFilter.filteredRows());}}var B=class t{router=g(F);destroyRef=g(we);promptState=g(m);refresh$=new Tr(void 0);isLoading=$i(true);deletion=k();prompts=$i([]);rowFilter=O$1(this.prompts,e=>[e.name,e.description].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(this.isLoading.set(true),this.promptState.listPlatform())),U$1(this.destroyRef)).subscribe({next:e=>{this.prompts.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","prompts","new"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","prompts",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.promptState.delete(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=vw({type:t,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"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform 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,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(n,r){n&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(p){return r.rowFilter.query.set(p)}),hl(),Es(2,"button",2),vg("click",function(){return r.openCreateForm()}),xC(3,"New prompt"),hl()(),jw(4,A,2,1,"p",3),jw(5,K,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,O,14,0,"div",6)),n&2&&(BE(),dg("query",r.rowFilter.query()),BE(3),Bw(r.deletion.error()?4:-1),BE(),Bw(r.isLoading()?5:r.prompts().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{B as PlatformPromptsComponent};
1
+ import {D as m,z as k,O as O$1,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-CFzCpWz-.js';import {g,q as F,I as we,Z as Tr,$ as $i,a1 as ga,K as U$1,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,s as Dl,Y as Yw,l as lg,u as pf,w as hf}from'./main-OK5QY7NU.js';var j=(t,e)=>e.id??e.name;function A(t,e){if(t&1&&(Es(0,"p",3),xC(1),hl()),t&2){let n=eC();BE(),Fg(n.deletion.error());}}function K(t,e){t&1&&(Es(0,"p",4),xC(1,"Loading prompts\u2026"),hl());}function H(t,e){t&1&&(Es(0,"p",5),xC(1,"No platform prompts defined yet."),hl());}function U(t,e){t&1&&(Es(0,"p",4),xC(1,"No prompts match the current filter."),hl());}function z(t,e){if(t&1){let n=Yw();Es(0,"button",18),vg("click",function(){pf(n);let m=eC().$implicit,p=eC(2);return hf(p.edit(m))}),xC(1,"Edit"),hl();}if(t&2){let n=eC().$implicit;lg("aria-label","Edit "+n.name);}}function G(t,e){if(t&1){let n=Yw();Es(0,"agentos-row-delete-action",19),vg("deleteRequested",function(){pf(n);let m=eC().$implicit,p=eC(2);return hf(p.deletion.request(m.id))})("deleteConfirmed",function(){pf(n);let m=eC().$implicit,p=eC(2);return hf(p.confirmDelete(m))})("deleteCancelled",function(){pf(n);let m=eC(3);return hf(m.deletion.cancel())}),hl();}if(t&2){let n=eC().$implicit,r=eC(2);dg("rowKey",n.id)("rowLabel",n.name)("state",r.deletion);}}function J(t,e){if(t&1&&(Es(0,"tr",9)(1,"td",12),xC(2),hl(),Es(3,"td",13),xC(4),hl(),Es(5,"td",14)(6,"div",15),jw(7,z,2,1,"button",16),jw(8,G,1,3,"agentos-row-delete-action",17),hl()()()),t&2){let n=e.$implicit,r=eC(2);BE(2),Fg(n.name),BE(2),Dl(" ",n.description||"\u2014"," "),BE(3),Bw(r.deletion.confirmingId()!==n.id?7:-1),BE(),Bw(n.id?8:-1);}}function O(t,e){if(t&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Description"),hl(),Es(8,"th",10)(9,"span",11),xC(10,"Actions"),hl()()()(),Es(11,"tbody",8),Uw(12,J,9,4,"tr",9,j),hl()()()),t&2){let n=eC();BE(12),$w(n.rowFilter.filteredRows());}}var B=class t{router=g(F);destroyRef=g(we);promptState=g(m);refresh$=new Tr(void 0);isLoading=$i(true);deletion=k();prompts=$i([]);rowFilter=O$1(this.prompts,e=>[e.name,e.description].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(this.isLoading.set(true),this.promptState.listPlatform())),U$1(this.destroyRef)).subscribe({next:e=>{this.prompts.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","prompts","new"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","prompts",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.promptState.delete(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=vw({type:t,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"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform 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,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(n,r){n&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(p){return r.rowFilter.query.set(p)}),hl(),Es(2,"button",2),vg("click",function(){return r.openCreateForm()}),xC(3,"New prompt"),hl()(),jw(4,A,2,1,"p",3),jw(5,K,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,O,14,0,"div",6)),n&2&&(BE(),dg("query",r.rowFilter.query()),BE(3),Bw(r.deletion.error()?4:-1),BE(),Bw(r.isLoading()?5:r.prompts().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{B as PlatformPromptsComponent};
@@ -1 +1 @@
1
- import {f,y,p as pt,T as Te,a as fn,U as Ut,n as nd,b as bo,x as xo,L as Lt,k as kn,G as Gt,m as mo,c as po,$ as $r,V as Vn,A as An,d as pn,h as hn,e as cn,g as dn,i as at,j as an}from'./chunk-Ncao0R2n.js';import {g,W,q as F,H as J,I as we,r as rT,$ as $i,O as Of,K as U,L as w,N as x,v as vw,E as Es,f as fg,j as jw,a as hl,P as dg,b as BE,c as Bw,x as xC,Y as Yw,Q as vg,R as MI,U as Uw,t as eC,S as xI,l as lg,k as $w,s as Dl,F as Fg,u as pf,w as hf}from'./main-6MVJZWGK.js';var de=/^(\/|[A-Za-z]:[\\/]|\\\\)/;function me(i){return de.test(i)}function ie(i=()=>true){return t=>{let e=(t.value??"").trim();return !i()||e===""||me(e)?null:{absolutePath:true}}}var ce=(i,t)=>t.value;function ue(i,t){i&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function he(i,t){if(i&1&&(Es(0,"option",23),xC(1),hl()),i&2){let e=t.$implicit;dg("value",e.value),BE(),Fg(e.label);}}function pe(i,t){if(i&1){let e=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let p=eC();return hf(p.submit())}),Es(1,"ds-form-field",5),fg(2,"input",6),MI(),hl(),Es(3,"ds-form-field",7),fg(4,"textarea",8),MI(),hl(),Es(5,"ds-form-field",9),fg(6,"input",10),MI(),hl(),Es(7,"ds-form-field",11),fg(8,"input",12),MI(),hl(),Es(9,"ds-form-field",13),fg(10,"input",14),MI(),hl(),Es(11,"ds-form-field",15),fg(12,"input",16),MI(),hl(),Es(13,"ds-form-field",17),fg(14,"input",18),MI(),hl(),Es(15,"ds-form-field",19)(16,"input",20),vg("input",function(p){pf(e);let se=eC();return hf(se.onMaxToolRoundsInput(p))}),hl(),MI(),hl(),Es(17,"ds-form-field",21)(18,"select",22),Uw(19,he,2,2,"option",23,ce),hl(),MI(),hl(),Es(21,"ds-form-actions")(22,"button",24),xC(23),hl(),Es(24,"button",25),vg("click",function(){pf(e);let p=eC();return hf(p.cancel())}),xC(25,"Cancel"),hl()()();}if(i&2){let e=eC();dg("formGroup",e.form),BE(2),dg("formControl",e.nameControl),xI(),BE(2),dg("formControl",e.descriptionControl),xI(),BE(2),dg("formControl",e.externalIdControl),xI(),BE(2),dg("formControl",e.defaultAgentNameControl),xI(),BE(2),dg("formControl",e.configPathControl),xI(),BE(),dg("hint",e.sharedExchangePathHint())("error",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid&&(e.sharedExchangePathControl.dirty||e.sharedExchangePathControl.touched)?"Enter an absolute path (e.g. /home/me/Coday or C:\\Coday), or leave the field empty.":null),BE(),dg("readOnly",!e.canEditSharedExchangePath())("formControl",e.sharedExchangePathControl),lg("aria-invalid",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid),xI(),BE(),dg("hint",e.runCostThresholdHint()),BE(),dg("placeholder",e.runCostThresholdPlaceholder())("formControl",e.runCostThresholdControl),xI(),BE(),dg("error",e.maxToolRoundsUnparsable()||e.maxToolRoundsControl.invalid&&(e.maxToolRoundsControl.dirty||e.maxToolRoundsControl.touched)?"Enter a whole number of at least 1, or leave the field empty.":null),BE(),dg("formControl",e.maxToolRoundsControl),lg("aria-invalid",e.maxToolRoundsControl.invalid||e.maxToolRoundsUnparsable()),xI(),BE(2),dg("formControl",e.adminCaseListingControl),xI(),BE(),$w(e.adminCaseListingOptions),BE(3),dg("disabled",e.form.invalid||e.isSubmitting()),BE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var fe=1,ge=2147483647,Ce=[{value:"",label:"Default"},{value:"OWN",label:"Their own cases"},{value:"SWITCH",label:"Their own, with a switch to see all"},{value:"ALL",label:"All cases of the namespace"}],le=class i{route=g(W);router=g(F);namespaceController=g(J);destroyRef=g(we);usageConfiguration=g(f);userState=g(y);canEditSharedExchangePath=rT(()=>this.userState.currentUser()?.isAdmin===true);sharedExchangePathHint=rT(()=>this.canEditSharedExchangePath()?"Absolute path of a folder on the server that holds the files shared by the namespace. Leave empty for the default location.":"Only a super-admin can change this folder.");runCostThresholdPlaceholder=rT(()=>{let t=this.usageConfiguration.runCostThreshold();return this.usageConfiguration.enabled()?t===null?"No platform limit":`Platform default: ${t}`:"Optional maximum cost per run (e.g. 0.50)"});runCostThresholdHint=rT(()=>{let t="Leave empty to inherit the platform default",e=this.usageConfiguration.runCostThreshold();switch(this.usageConfiguration.state()){case "enabled":return e===null?`${t}: no limit.`:`${t} (${e}).`;case "disabled":return `${t}. Cost limits are inactive while usage tracking is disabled.`;default:return `${t}.`}});form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te("",{nonNullable:true}),configPath:new Te("",{nonNullable:true}),sharedExchangePath:new Te("",{nonNullable:true,validators:[ie(()=>this.canEditSharedExchangePath())]}),externalId:new Te("",{nonNullable:true}),defaultAgentName:new Te("",{nonNullable:true}),runCostThreshold:new Te(null),maxToolRounds:new Te(null,{validators:[fn.min(fe),fn.max(ge),fn.pattern(/^\d+$/)]}),adminCaseListing:new Te("",{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get configPathControl(){return this.form.controls.configPath}get sharedExchangePathControl(){return this.form.controls.sharedExchangePath}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}get adminCaseListingControl(){return this.form.controls.adminCaseListing}adminCaseListingOptions=Ce;maxToolRoundsUnparsable=$i(false);onMaxToolRoundsInput(t){this.maxToolRoundsUnparsable.set(t.target.validity.badInput);}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);existingNamespace=null;constructor(){Of(()=>{this.canEditSharedExchangePath(),this.sharedExchangePathControl.updateValueAndValidity();});}ngOnInit(){this.userState.currentUser()||this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({error:()=>{}});let t=this.route.snapshot.paramMap.get("namespaceId")??this.route.parent?.snapshot.paramMap.get("namespaceId");t&&(this.isEditMode.set(true),this.loadNamespace(t));}loadNamespace(t){this.isLoading.set(true),this.namespaceController.getByIdNamespace(t).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.sharedExchangePathControl.setValue(e.sharedExchangePath??""),this.externalIdControl.setValue(e.externalId??""),this.defaultAgentNameControl.setValue(e.defaultAgentName??""),this.runCostThresholdControl.setValue(e.runCostThreshold??null),this.maxToolRoundsControl.setValue(e.maxToolRounds??null),this.adminCaseListingControl.setValue(e.adminCaseListing??""),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 t=w(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,adminCaseListing:this.adminCaseListingControl.value||void 0}),this.canEditSharedExchangePath()?{sharedExchangePath:this.sharedExchangePathPayload()}:{});(this.isEditMode()?this.namespaceController.updateNamespace(this.existingNamespace.id??"",t):this.namespaceController.createNamespace(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}sharedExchangePathPayload(){return this.sharedExchangePathControl.value.trim()||(this.existingNamespace?.sharedExchangePath?"":void 0)}cancel(){this.navigateBack();}navigateBack(){this.router.navigate(["/agentos/namespaces"]);}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=vw({type:i,selectors:[["agentos-namespace-form"]],decls:4,vars:3,consts:[[3,"framed"],[3,"title"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","ns-name","required",""],["dsControl","","id","ns-name","type","text","placeholder","Namespace name","autocomplete","off",3,"formControl"],["label","Description","controlId","ns-description"],["dsControl","","id","ns-description","rows","4","placeholder","Optional description",3,"formControl"],["label","External ID","controlId","ns-external-id"],["dsControl","","id","ns-external-id","type","text","placeholder","Optional federation ID from an external system","autocomplete","off",3,"formControl"],["label","Default agent","controlId","ns-default-agent"],["dsControl","","id","ns-default-agent","type","text","placeholder","Logical name of the default agent (e.g. coday)","autocomplete","off",3,"formControl"],["label","Config path","controlId","ns-config-path"],["dsControl","","id","ns-config-path","type","text","placeholder","Optional path to base configuration directory","autocomplete","off",3,"formControl"],["label","Shared files folder","controlId","ns-shared-exchange-path","hintId","ns-shared-exchange-path-hint","errorId","ns-shared-exchange-path-error",3,"hint","error"],["dsControl","","id","ns-shared-exchange-path","type","text","placeholder","Default location managed by AgentOS","aria-describedby","ns-shared-exchange-path-hint","autocomplete","off",3,"readOnly","formControl"],["label","Run cost threshold","controlId","ns-run-cost-threshold","hintId","ns-run-cost-threshold-hint",3,"hint"],["dsControl","","id","ns-run-cost-threshold","type","number","min","0","step","0.01","aria-describedby","ns-run-cost-threshold-hint",3,"placeholder","formControl"],["label","Maximum tool rounds","controlId","ns-max-tool-rounds","hintId","ns-max-tool-rounds-hint","errorId","ns-max-tool-rounds-error","hint","Most tool rounds one agent run may take. Leave empty to inherit the server default. A change applies from the next agent run.",3,"error"],["dsControl","","id","ns-max-tool-rounds","type","number","min","1","step","1","placeholder","Server default","aria-describedby","ns-max-tool-rounds-hint",3,"input","formControl"],["label","Cases visible to admins","controlId","ns-admin-case-listing","hintId","ns-admin-case-listing-hint","hint","Choose which conversations the admins of this namespace see in their list. Members always see only their own."],["dsControl","","id","ns-admin-case-listing","aria-describedby","ns-admin-case-listing-hint",3,"formControl"],[3,"value"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"]],template:function(e,u){e&1&&(Es(0,"ds-page",0),fg(1,"ds-section-header",1),jw(2,ue,2,0,"p",2)(3,pe,26,20,"form",3),hl()),e&2&&(dg("framed",!u.isEditMode()),BE(),dg("title",u.isEditMode()?"Edit namespace":"New namespace"),BE(),Bw(u.isLoading()?2:3));},dependencies:[Ut,nd,bo,xo,Lt,kn,Gt,mo,po,$r,Vn,An,pn,hn,cn,dn,at,an],encapsulation:2})};export{Ce as ADMIN_CASE_LISTING_OPTIONS,le as NamespaceFormComponent};
1
+ import {f,y,p as pt,T as Te,a as fn,U as Ut,n as nd,b as bo,x as xo,L as Lt,k as kn,G as Gt,m as mo,c as po,$ as $r,V as Vn,A as An,d as pn,h as hn,e as cn,g as dn,i as at,j as an}from'./chunk-CFzCpWz-.js';import {g,W,q as F,H as J,I as we,r as rT,$ as $i,O as Of,K as U,L as w,N as x,v as vw,E as Es,f as fg,j as jw,a as hl,P as dg,b as BE,c as Bw,x as xC,Y as Yw,Q as vg,R as MI,U as Uw,t as eC,S as xI,l as lg,k as $w,s as Dl,F as Fg,u as pf,w as hf}from'./main-OK5QY7NU.js';var de=/^(\/|[A-Za-z]:[\\/]|\\\\)/;function me(i){return de.test(i)}function ie(i=()=>true){return t=>{let e=(t.value??"").trim();return !i()||e===""||me(e)?null:{absolutePath:true}}}var ce=(i,t)=>t.value;function ue(i,t){i&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function he(i,t){if(i&1&&(Es(0,"option",23),xC(1),hl()),i&2){let e=t.$implicit;dg("value",e.value),BE(),Fg(e.label);}}function pe(i,t){if(i&1){let e=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let p=eC();return hf(p.submit())}),Es(1,"ds-form-field",5),fg(2,"input",6),MI(),hl(),Es(3,"ds-form-field",7),fg(4,"textarea",8),MI(),hl(),Es(5,"ds-form-field",9),fg(6,"input",10),MI(),hl(),Es(7,"ds-form-field",11),fg(8,"input",12),MI(),hl(),Es(9,"ds-form-field",13),fg(10,"input",14),MI(),hl(),Es(11,"ds-form-field",15),fg(12,"input",16),MI(),hl(),Es(13,"ds-form-field",17),fg(14,"input",18),MI(),hl(),Es(15,"ds-form-field",19)(16,"input",20),vg("input",function(p){pf(e);let se=eC();return hf(se.onMaxToolRoundsInput(p))}),hl(),MI(),hl(),Es(17,"ds-form-field",21)(18,"select",22),Uw(19,he,2,2,"option",23,ce),hl(),MI(),hl(),Es(21,"ds-form-actions")(22,"button",24),xC(23),hl(),Es(24,"button",25),vg("click",function(){pf(e);let p=eC();return hf(p.cancel())}),xC(25,"Cancel"),hl()()();}if(i&2){let e=eC();dg("formGroup",e.form),BE(2),dg("formControl",e.nameControl),xI(),BE(2),dg("formControl",e.descriptionControl),xI(),BE(2),dg("formControl",e.externalIdControl),xI(),BE(2),dg("formControl",e.defaultAgentNameControl),xI(),BE(2),dg("formControl",e.configPathControl),xI(),BE(),dg("hint",e.sharedExchangePathHint())("error",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid&&(e.sharedExchangePathControl.dirty||e.sharedExchangePathControl.touched)?"Enter an absolute path (e.g. /home/me/Coday or C:\\Coday), or leave the field empty.":null),BE(),dg("readOnly",!e.canEditSharedExchangePath())("formControl",e.sharedExchangePathControl),lg("aria-invalid",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid),xI(),BE(),dg("hint",e.runCostThresholdHint()),BE(),dg("placeholder",e.runCostThresholdPlaceholder())("formControl",e.runCostThresholdControl),xI(),BE(),dg("error",e.maxToolRoundsUnparsable()||e.maxToolRoundsControl.invalid&&(e.maxToolRoundsControl.dirty||e.maxToolRoundsControl.touched)?"Enter a whole number of at least 1, or leave the field empty.":null),BE(),dg("formControl",e.maxToolRoundsControl),lg("aria-invalid",e.maxToolRoundsControl.invalid||e.maxToolRoundsUnparsable()),xI(),BE(2),dg("formControl",e.adminCaseListingControl),xI(),BE(),$w(e.adminCaseListingOptions),BE(3),dg("disabled",e.form.invalid||e.isSubmitting()),BE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var fe=1,ge=2147483647,Ce=[{value:"",label:"Default"},{value:"OWN",label:"Their own cases"},{value:"SWITCH",label:"Their own, with a switch to see all"},{value:"ALL",label:"All cases of the namespace"}],le=class i{route=g(W);router=g(F);namespaceController=g(J);destroyRef=g(we);usageConfiguration=g(f);userState=g(y);canEditSharedExchangePath=rT(()=>this.userState.currentUser()?.isAdmin===true);sharedExchangePathHint=rT(()=>this.canEditSharedExchangePath()?"Absolute path of a folder on the server that holds the files shared by the namespace. Leave empty for the default location.":"Only a super-admin can change this folder.");runCostThresholdPlaceholder=rT(()=>{let t=this.usageConfiguration.runCostThreshold();return this.usageConfiguration.enabled()?t===null?"No platform limit":`Platform default: ${t}`:"Optional maximum cost per run (e.g. 0.50)"});runCostThresholdHint=rT(()=>{let t="Leave empty to inherit the platform default",e=this.usageConfiguration.runCostThreshold();switch(this.usageConfiguration.state()){case "enabled":return e===null?`${t}: no limit.`:`${t} (${e}).`;case "disabled":return `${t}. Cost limits are inactive while usage tracking is disabled.`;default:return `${t}.`}});form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te("",{nonNullable:true}),configPath:new Te("",{nonNullable:true}),sharedExchangePath:new Te("",{nonNullable:true,validators:[ie(()=>this.canEditSharedExchangePath())]}),externalId:new Te("",{nonNullable:true}),defaultAgentName:new Te("",{nonNullable:true}),runCostThreshold:new Te(null),maxToolRounds:new Te(null,{validators:[fn.min(fe),fn.max(ge),fn.pattern(/^\d+$/)]}),adminCaseListing:new Te("",{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get configPathControl(){return this.form.controls.configPath}get sharedExchangePathControl(){return this.form.controls.sharedExchangePath}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}get adminCaseListingControl(){return this.form.controls.adminCaseListing}adminCaseListingOptions=Ce;maxToolRoundsUnparsable=$i(false);onMaxToolRoundsInput(t){this.maxToolRoundsUnparsable.set(t.target.validity.badInput);}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);existingNamespace=null;constructor(){Of(()=>{this.canEditSharedExchangePath(),this.sharedExchangePathControl.updateValueAndValidity();});}ngOnInit(){this.userState.currentUser()||this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({error:()=>{}});let t=this.route.snapshot.paramMap.get("namespaceId")??this.route.parent?.snapshot.paramMap.get("namespaceId");t&&(this.isEditMode.set(true),this.loadNamespace(t));}loadNamespace(t){this.isLoading.set(true),this.namespaceController.getByIdNamespace(t).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.sharedExchangePathControl.setValue(e.sharedExchangePath??""),this.externalIdControl.setValue(e.externalId??""),this.defaultAgentNameControl.setValue(e.defaultAgentName??""),this.runCostThresholdControl.setValue(e.runCostThreshold??null),this.maxToolRoundsControl.setValue(e.maxToolRounds??null),this.adminCaseListingControl.setValue(e.adminCaseListing??""),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 t=w(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,adminCaseListing:this.adminCaseListingControl.value||void 0}),this.canEditSharedExchangePath()?{sharedExchangePath:this.sharedExchangePathPayload()}:{});(this.isEditMode()?this.namespaceController.updateNamespace(this.existingNamespace.id??"",t):this.namespaceController.createNamespace(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}sharedExchangePathPayload(){return this.sharedExchangePathControl.value.trim()||(this.existingNamespace?.sharedExchangePath?"":void 0)}cancel(){this.navigateBack();}navigateBack(){this.router.navigate(["/agentos/namespaces"]);}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=vw({type:i,selectors:[["agentos-namespace-form"]],decls:4,vars:3,consts:[[3,"framed"],[3,"title"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","ns-name","required",""],["dsControl","","id","ns-name","type","text","placeholder","Namespace name","autocomplete","off",3,"formControl"],["label","Description","controlId","ns-description"],["dsControl","","id","ns-description","rows","4","placeholder","Optional description",3,"formControl"],["label","External ID","controlId","ns-external-id"],["dsControl","","id","ns-external-id","type","text","placeholder","Optional federation ID from an external system","autocomplete","off",3,"formControl"],["label","Default agent","controlId","ns-default-agent"],["dsControl","","id","ns-default-agent","type","text","placeholder","Logical name of the default agent (e.g. coday)","autocomplete","off",3,"formControl"],["label","Config path","controlId","ns-config-path"],["dsControl","","id","ns-config-path","type","text","placeholder","Optional path to base configuration directory","autocomplete","off",3,"formControl"],["label","Shared files folder","controlId","ns-shared-exchange-path","hintId","ns-shared-exchange-path-hint","errorId","ns-shared-exchange-path-error",3,"hint","error"],["dsControl","","id","ns-shared-exchange-path","type","text","placeholder","Default location managed by AgentOS","aria-describedby","ns-shared-exchange-path-hint","autocomplete","off",3,"readOnly","formControl"],["label","Run cost threshold","controlId","ns-run-cost-threshold","hintId","ns-run-cost-threshold-hint",3,"hint"],["dsControl","","id","ns-run-cost-threshold","type","number","min","0","step","0.01","aria-describedby","ns-run-cost-threshold-hint",3,"placeholder","formControl"],["label","Maximum tool rounds","controlId","ns-max-tool-rounds","hintId","ns-max-tool-rounds-hint","errorId","ns-max-tool-rounds-error","hint","Most tool rounds one agent run may take. Leave empty to inherit the server default. A change applies from the next agent run.",3,"error"],["dsControl","","id","ns-max-tool-rounds","type","number","min","1","step","1","placeholder","Server default","aria-describedby","ns-max-tool-rounds-hint",3,"input","formControl"],["label","Cases visible to admins","controlId","ns-admin-case-listing","hintId","ns-admin-case-listing-hint","hint","Choose which conversations the admins of this namespace see in their list. Members always see only their own."],["dsControl","","id","ns-admin-case-listing","aria-describedby","ns-admin-case-listing-hint",3,"formControl"],[3,"value"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"]],template:function(e,u){e&1&&(Es(0,"ds-page",0),fg(1,"ds-section-header",1),jw(2,ue,2,0,"p",2)(3,pe,26,20,"form",3),hl()),e&2&&(dg("framed",!u.isEditMode()),BE(),dg("title",u.isEditMode()?"Edit namespace":"New namespace"),BE(),Bw(u.isLoading()?2:3));},dependencies:[Ut,nd,bo,xo,Lt,kn,Gt,mo,po,$r,Vn,An,pn,hn,cn,dn,at,an],encapsulation:2})};export{Ce as ADMIN_CASE_LISTING_OPTIONS,le as NamespaceFormComponent};
@@ -1 +1 @@
1
- import {c}from'./chunk-C9uCCw8u.js';import {z as k,O as O$1,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-Ncao0R2n.js';import {g,q as F,I as we,$ as $i,K as U$1,ai as Ne,al as De,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,Y as Yw,u as pf,w as hf,l as lg}from'./main-6MVJZWGK.js';var M=(n,t)=>t.id??t.name;function U(n,t){if(n&1&&(Es(0,"p",3),xC(1),hl()),n&2){let e=eC();BE(),Fg(e.deletion.error());}}function B(n,t){n&1&&(Es(0,"p",4),xC(1,"Loading scheduled prompts\u2026"),hl());}function j(n,t){n&1&&(Es(0,"p",5),xC(1,"No platform scheduled prompts defined yet."),hl());}function W(n,t){n&1&&(Es(0,"p",4),xC(1,"No scheduled prompts match the current filter."),hl());}function H(n,t){if(n&1&&(Es(0,"span",14),xC(1),hl()),n&2){let e=eC().$implicit;BE(),Fg(e.description);}}function O(n,t){if(n&1){let e=Yw();Es(0,"button",21),vg("click",function(){pf(e);let s=eC().$implicit,c=eC(2);return hf(c.toggle(s))}),xC(1),hl(),Es(2,"button",21),vg("click",function(){pf(e);let s=eC().$implicit,c=eC(2);return hf(c.edit(s))}),xC(3,"Edit"),hl();}if(n&2){let e=eC().$implicit;BE(),Fg(e.enabled?"Disable":"Enable"),BE(),lg("aria-label","Edit "+e.name);}}function Y(n,t){if(n&1){let e=Yw();Es(0,"agentos-row-delete-action",22),vg("deleteRequested",function(){pf(e);let s=eC().$implicit,c=eC(2);return hf(c.deletion.request(s.id))})("deleteConfirmed",function(){pf(e);let s=eC().$implicit,c=eC(2);return hf(c.confirmDelete(s))})("deleteCancelled",function(){pf(e);let s=eC(3);return hf(s.deletion.cancel())}),hl();}if(n&2){let e=eC().$implicit,i=eC(2);dg("rowKey",e.id)("rowLabel",e.name)("state",i.deletion);}}function z(n,t){if(n&1&&(Es(0,"tr",9)(1,"td",12)(2,"span",13),xC(3),hl(),jw(4,H,2,1,"span",14),hl(),Es(5,"td",15),xC(6),hl(),Es(7,"td",16)(8,"ds-tag",17),xC(9),hl()(),Es(10,"td",18)(11,"div",19),jw(12,O,4,2),jw(13,Y,1,3,"agentos-row-delete-action",20),hl()()()),n&2){let e=t.$implicit,i=eC(2);BE(3),Fg(e.name),BE(),Bw(e.description?4:-1),BE(2),Fg(i.scheduleLabel(e)),BE(2),dg("variant",e.enabled?"accent":"outline"),BE(),Fg(e.enabled?"Enabled":"Disabled"),BE(3),Bw(i.deletion.confirmingId()!==e.id?12:-1),BE(),Bw(e.id?13:-1);}}function G(n,t){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Schedule"),hl(),Es(8,"th",10),xC(9,"Status"),hl(),Es(10,"th",10)(11,"span",11),xC(12,"Actions"),hl()()()(),Es(13,"tbody",8),Uw(14,z,14,7,"tr",9,M),hl()()()),n&2){let e=eC();BE(14),$w(e.rowFilter.filteredRows());}}var A=class n{router=g(F);destroyRef=g(we);state=g(c);prompts=$i([]);isLoading=$i(true);deletion=k();rowFilter=O$1(this.prompts,t=>[t.name,t.description,this.scheduleLabel(t),t.enabled?"Enabled":"Disabled"].filter(Boolean).join(" "));constructor(){this.state.listPlatform().pipe(U$1(this.destroyRef)).subscribe({next:t=>{this.prompts.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}scheduleLabel(t){let{recurrence:e}=t,i=e.unit===Ne.WEEK?"week":"month",s=e.unit===Ne.WEEK&&e.days?.length?` (${e.days.map(c=>De[c]??c).join(", ")})`:"";return `Every ${i}${s} at ${e.timeUtc} UTC`}openCreateForm(){this.router.navigate(["/agentos","admin","scheduled-prompts","new"]);}edit(t){t.id&&this.router.navigate(["/agentos","admin","scheduled-prompts",t.id,"edit"]);}toggle(t){(t.enabled?this.state.disable(t.id??""):this.state.enable(t.id??"")).pipe(U$1(this.destroyRef)).subscribe(i=>this.patchPrompt(i));}confirmDelete(t){if(!t.id)return;let e=t.id;this.deletion.execute(e,{request$:this.state.delete(e).pipe(U$1(this.destroyRef)),onSuccess:()=>this.prompts.update(i=>i.filter(s=>s.id!==e)),errorMessage:`Deleting "${t.name}" failed. Try again.`});}patchPrompt(t){this.prompts.update(e=>e.map(i=>i.id===t.id?t:i));}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=vw({type:n,selectors:[["agentos-platform-scheduled-prompts"]],decls:9,vars:3,consts:[["title","Platform scheduled prompts","description","Scheduled prompts shared across every namespace."],["label","Filter scheduled prompts","placeholder","Filter scheduled prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform scheduled prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Schedule"],["role","cell","data-label","Status"],[3,"variant"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(e,i){e&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return i.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return i.openCreateForm()}),xC(3,"New scheduled prompt"),hl()(),jw(4,U,2,1,"p",3),jw(5,B,2,0,"p",4)(6,j,2,0,"p",5)(7,W,2,0,"p",4)(8,G,16,0,"div",6)),e&2&&(BE(),dg("query",i.rowFilter.query()),BE(3),Bw(i.deletion.error()?4:-1),BE(),Bw(i.isLoading()?5:i.prompts().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{A as PlatformScheduledPromptsComponent};
1
+ import {c}from'./chunk-DI3lyKCO.js';import {z as k,O as O$1,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-CFzCpWz-.js';import {g,q as F,I as we,$ as $i,K as U$1,ai as Ne,al as De,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,Y as Yw,u as pf,w as hf,l as lg}from'./main-OK5QY7NU.js';var M=(n,t)=>t.id??t.name;function U(n,t){if(n&1&&(Es(0,"p",3),xC(1),hl()),n&2){let e=eC();BE(),Fg(e.deletion.error());}}function B(n,t){n&1&&(Es(0,"p",4),xC(1,"Loading scheduled prompts\u2026"),hl());}function j(n,t){n&1&&(Es(0,"p",5),xC(1,"No platform scheduled prompts defined yet."),hl());}function W(n,t){n&1&&(Es(0,"p",4),xC(1,"No scheduled prompts match the current filter."),hl());}function H(n,t){if(n&1&&(Es(0,"span",14),xC(1),hl()),n&2){let e=eC().$implicit;BE(),Fg(e.description);}}function O(n,t){if(n&1){let e=Yw();Es(0,"button",21),vg("click",function(){pf(e);let s=eC().$implicit,c=eC(2);return hf(c.toggle(s))}),xC(1),hl(),Es(2,"button",21),vg("click",function(){pf(e);let s=eC().$implicit,c=eC(2);return hf(c.edit(s))}),xC(3,"Edit"),hl();}if(n&2){let e=eC().$implicit;BE(),Fg(e.enabled?"Disable":"Enable"),BE(),lg("aria-label","Edit "+e.name);}}function Y(n,t){if(n&1){let e=Yw();Es(0,"agentos-row-delete-action",22),vg("deleteRequested",function(){pf(e);let s=eC().$implicit,c=eC(2);return hf(c.deletion.request(s.id))})("deleteConfirmed",function(){pf(e);let s=eC().$implicit,c=eC(2);return hf(c.confirmDelete(s))})("deleteCancelled",function(){pf(e);let s=eC(3);return hf(s.deletion.cancel())}),hl();}if(n&2){let e=eC().$implicit,i=eC(2);dg("rowKey",e.id)("rowLabel",e.name)("state",i.deletion);}}function z(n,t){if(n&1&&(Es(0,"tr",9)(1,"td",12)(2,"span",13),xC(3),hl(),jw(4,H,2,1,"span",14),hl(),Es(5,"td",15),xC(6),hl(),Es(7,"td",16)(8,"ds-tag",17),xC(9),hl()(),Es(10,"td",18)(11,"div",19),jw(12,O,4,2),jw(13,Y,1,3,"agentos-row-delete-action",20),hl()()()),n&2){let e=t.$implicit,i=eC(2);BE(3),Fg(e.name),BE(),Bw(e.description?4:-1),BE(2),Fg(i.scheduleLabel(e)),BE(2),dg("variant",e.enabled?"accent":"outline"),BE(),Fg(e.enabled?"Enabled":"Disabled"),BE(3),Bw(i.deletion.confirmingId()!==e.id?12:-1),BE(),Bw(e.id?13:-1);}}function G(n,t){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Schedule"),hl(),Es(8,"th",10),xC(9,"Status"),hl(),Es(10,"th",10)(11,"span",11),xC(12,"Actions"),hl()()()(),Es(13,"tbody",8),Uw(14,z,14,7,"tr",9,M),hl()()()),n&2){let e=eC();BE(14),$w(e.rowFilter.filteredRows());}}var A=class n{router=g(F);destroyRef=g(we);state=g(c);prompts=$i([]);isLoading=$i(true);deletion=k();rowFilter=O$1(this.prompts,t=>[t.name,t.description,this.scheduleLabel(t),t.enabled?"Enabled":"Disabled"].filter(Boolean).join(" "));constructor(){this.state.listPlatform().pipe(U$1(this.destroyRef)).subscribe({next:t=>{this.prompts.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}scheduleLabel(t){let{recurrence:e}=t,i=e.unit===Ne.WEEK?"week":"month",s=e.unit===Ne.WEEK&&e.days?.length?` (${e.days.map(c=>De[c]??c).join(", ")})`:"";return `Every ${i}${s} at ${e.timeUtc} UTC`}openCreateForm(){this.router.navigate(["/agentos","admin","scheduled-prompts","new"]);}edit(t){t.id&&this.router.navigate(["/agentos","admin","scheduled-prompts",t.id,"edit"]);}toggle(t){(t.enabled?this.state.disable(t.id??""):this.state.enable(t.id??"")).pipe(U$1(this.destroyRef)).subscribe(i=>this.patchPrompt(i));}confirmDelete(t){if(!t.id)return;let e=t.id;this.deletion.execute(e,{request$:this.state.delete(e).pipe(U$1(this.destroyRef)),onSuccess:()=>this.prompts.update(i=>i.filter(s=>s.id!==e)),errorMessage:`Deleting "${t.name}" failed. Try again.`});}patchPrompt(t){this.prompts.update(e=>e.map(i=>i.id===t.id?t:i));}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=vw({type:n,selectors:[["agentos-platform-scheduled-prompts"]],decls:9,vars:3,consts:[["title","Platform scheduled prompts","description","Scheduled prompts shared across every namespace."],["label","Filter scheduled prompts","placeholder","Filter scheduled prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform scheduled prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Schedule"],["role","cell","data-label","Status"],[3,"variant"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(e,i){e&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return i.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return i.openCreateForm()}),xC(3,"New scheduled prompt"),hl()(),jw(4,U,2,1,"p",3),jw(5,B,2,0,"p",4)(6,j,2,0,"p",5)(7,W,2,0,"p",4)(8,G,16,0,"div",6)),e&2&&(BE(),dg("query",i.rowFilter.query()),BE(3),Bw(i.deletion.error()?4:-1),BE(),Bw(i.isLoading()?5:i.prompts().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{A as PlatformScheduledPromptsComponent};