@whoz-oss/coday-client 0.0.0-workstream-forge.220 → 0.0.0-workstream-forge.222

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/browser/{chunk-BiYZtMHe.js → chunk-2O1S906W.js} +1 -1
  2. package/browser/{chunk-BBLPPk_o.js → chunk-2u0oy3pB.js} +1 -1
  3. package/browser/{chunk-xxu5j6Nl.js → chunk-5W0A2Kue.js} +1 -1
  4. package/browser/chunk-AYvnGrVn.js +1 -0
  5. package/browser/{chunk-CP4by4ZM.js → chunk-B0IpC4Tx.js} +1 -1
  6. package/browser/{chunk-BPuTg4JQ.js → chunk-B14dZoHL.js} +1 -1
  7. package/browser/{chunk-DPw6IK23.js → chunk-B1I1hZNS.js} +1 -1
  8. package/browser/{chunk-DsH4tZb8.js → chunk-B7AKjdX_.js} +1 -1
  9. package/browser/{chunk-6zEdcIps.js → chunk-BBxXNycr.js} +1 -1
  10. package/browser/{chunk-CBmMdnwI.js → chunk-BLQEGpZn.js} +1 -1
  11. package/browser/{chunk-DouSBHR_.js → chunk-BRztV5KS.js} +1 -1
  12. package/browser/{chunk-YYuiKD5g.js → chunk-BUMB5qoO.js} +1 -1
  13. package/browser/{chunk-Ki6OlrsT.js → chunk-BUcJXW_D.js} +1 -1
  14. package/browser/{chunk-C-guYrHg.js → chunk-BXexfMTK.js} +1 -1
  15. package/browser/{chunk-Cbch15h_.js → chunk-BYALO427.js} +1 -1
  16. package/browser/{chunk-Cs6PVDKT.js → chunk-BgWMjUkX.js} +1 -1
  17. package/browser/{chunk-BkOARKYi.js → chunk-BiaxZ40F.js} +1 -1
  18. package/browser/{chunk-uUbEG3mJ.js → chunk-Bt9WGCpK.js} +1 -1
  19. package/browser/{chunk-D-TW1kvT.js → chunk-C0etY4Vc.js} +1 -1
  20. package/browser/{chunk-DtA8tVTN.js → chunk-CETI95mp.js} +1 -1
  21. package/browser/{chunk-D4wgkKOe.js → chunk-CIW6m5h-.js} +1 -1
  22. package/browser/{chunk-CElIbImY.js → chunk-CS0QFOWp.js} +1 -1
  23. package/browser/{chunk-CO7YlRKR.js → chunk-CWp__iQx.js} +1 -1
  24. package/browser/{chunk-BgupfmD4.js → chunk-CfgdpEiu.js} +1 -1
  25. package/browser/{chunk-DYW4g2K_.js → chunk-CkGCNFHp.js} +1 -1
  26. package/browser/{chunk-RMDi6DVr.js → chunk-CliJpUKT.js} +1 -1
  27. package/browser/{chunk-DAb9vQsg.js → chunk-CuWqEiiR.js} +1 -1
  28. package/browser/{chunk-G3yW7aHe.js → chunk-Cyx8tBRd.js} +1 -1
  29. package/browser/{chunk-DNaBFrnl.js → chunk-D3BSgsqF.js} +1 -1
  30. package/browser/{chunk-BldpQhN_.js → chunk-D526Porz.js} +1 -1
  31. package/browser/{chunk-CfIy8NTK.js → chunk-D7jTT9JH.js} +1 -1
  32. package/browser/{chunk-BsVctJ9r.js → chunk-DADuuKw_.js} +1 -1
  33. package/browser/{chunk-DSaLJP2p.js → chunk-DAGhNGM0.js} +1 -1
  34. package/browser/{chunk-BgWVTYYJ.js → chunk-DIWXU7lQ.js} +1 -1
  35. package/browser/{chunk-CUPkxKvr.js → chunk-DM-FW0Tn.js} +1 -1
  36. package/browser/{chunk-Dw13V5Y9.js → chunk-DSLqhqjK.js} +1 -1
  37. package/browser/{chunk-DPJLJzou.js → chunk-DTzPzIc0.js} +1 -1
  38. package/browser/{chunk-BM05N8oL.js → chunk-DXD-ZIv9.js} +1 -1
  39. package/browser/{chunk-N087G3DJ.js → chunk-DYEst6mA.js} +1 -1
  40. package/browser/{chunk-CJLkP_aL.js → chunk-Dn4mtCZo.js} +1 -1
  41. package/browser/{chunk-BYeNpjs5.js → chunk-DueFkMuu.js} +1 -1
  42. package/browser/chunk-DvqKcX7A.js +672 -0
  43. package/browser/{chunk-B_50gI3y.js → chunk-Mb2Bp9Qb.js} +1 -1
  44. package/browser/{chunk-BVGfpYn2.js → chunk-W2RB-deX.js} +1 -1
  45. package/browser/{chunk-DrH55v4Y.js → chunk-cS_tqqI2.js} +1 -1
  46. package/browser/{chunk-BlS8im7N.js → chunk-r3Ie6sEa.js} +1 -1
  47. package/browser/index.html +1 -1
  48. package/browser/{main-FJXP2G5I.js → main-BGDYOJBA.js} +1 -1
  49. package/package.json +1 -1
  50. package/browser/chunk-B5eEl07l.js +0 -1
  51. package/browser/chunk-D2BTEyR1.js +0 -670
@@ -1 +1 @@
1
- import {a}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-CP4by4ZM.js';import {J as s,z as k,O,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-D2BTEyR1.js';import {g,W,F,I as Ie,$ as Cr,U as Ui,a1 as fa,ac as Ty,a2 as da,aa as Tr,ad as ne$1,G as U,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,H as Hw,m as Uw,v as vl,as as kg,Z as Zw,r as df,s as ff,k as cg}from'./main-FJXP2G5I.js';var Y=(n,e)=>e.key;function Z(n,e){if(n&1&&(Ds(0,"p",3),NC(1),pl()),n&2){let t=Jw();BE(),Og(t.deletion.error());}}function ee(n,e){n&1&&(Ds(0,"p",4),NC(1,"Loading skills\u2026"),pl());}function te(n,e){n&1&&(Ds(0,"p",5),NC(1," No skills defined yet. Add one above, or drop a SKILL.md under the namespace config path. "),pl());}function ne(n,e){n&1&&(Ds(0,"p",4),NC(1,"No skills match the current filter."),pl());}function ie(n,e){if(n&1&&(Ds(0,"span",14),NC(1),pl()),n&2){let t=Jw().$implicit;BE(),kg(" named by ",t.namedByAgents," ",t.namedByAgents===1?"agent":"agents"," ");}}function ae(n,e){n&1&&(Ds(0,"ds-tag",20),NC(1,"Read-only"),pl());}function oe(n,e){n&1&&(Ds(0,"ds-tag",21),NC(1,"SKILL.md"),pl());}function le(n,e){if(n&1){let t=Zw();Ds(0,"button",25),mg("click",function(){df(t);let d=Jw(2).$implicit,c=Jw(2);return ff(c.edit(d))}),NC(1,"Edit"),pl();}if(n&2){let t=Jw(2).$implicit;cg("aria-label","Edit "+t.skill.name);}}function re(n,e){if(n&1){let t=Zw();Ds(0,"button",25),mg("click",function(){df(t);let d=Jw().$implicit,c=Jw(2);return ff(c.inspect(d))}),NC(1," View "),pl(),Lw(2,le,2,1,"button",26);}if(n&2){let t=Jw().$implicit,a=Jw(2);cg("aria-label","View "+t.skill.name),BE(2),jw(a.isMutable(t)?2:-1);}}function se(n,e){if(n&1){let t=Zw();Ds(0,"agentos-row-delete-action",27),mg("deleteRequested",function(){df(t);let d=Jw().$implicit,c=Jw(2);return ff(c.requestDelete(d))})("deleteConfirmed",function(){df(t);let d=Jw().$implicit,c=Jw(2);return ff(c.confirmDelete(d))})("deleteCancelled",function(){df(t);let d=Jw(3);return ff(d.deletion.cancel())}),pl();}if(n&2){let t=Jw().$implicit,a=Jw(2);ug("rowKey",t.key)("rowLabel",t.skill.name)("state",a.deletion);}}function ce(n,e){if(n&1&&(Ds(0,"tr",9)(1,"td",12)(2,"span",13),NC(3),pl(),Lw(4,ie,2,2,"span",14),pl(),Ds(5,"td",15),NC(6),pl(),Ds(7,"td",16),NC(8),pl(),Ds(9,"td",17)(10,"div",18)(11,"ds-tag",19),NC(12),pl(),Lw(13,ae,2,0,"ds-tag",20),Lw(14,oe,2,0,"ds-tag",21),pl()(),Ds(15,"td",22)(16,"div",23),Lw(17,re,3,2),Lw(18,se,1,3,"agentos-row-delete-action",24),pl()()()),n&2){let t=e.$implicit,a=Jw(2);BE(3),Og(t.skill.name),BE(),jw(t.namedByAgents>0?4:-1),BE(2),vl(" ",t.skill.description||"\u2014"," "),BE(2),Og(a.resourceCount(t.skill)),BE(3),ug("variant",t.scope==="platform"?"neutral":"accent"),BE(),Og(t.scope==="platform"?"Platform":"Namespace"),BE(),jw(t.scope==="platform"?13:-1),BE(),jw(t.skill.readOnly?14:-1),BE(3),jw(a.deletion.confirmingId()!==t.key?17:-1),BE(),jw(a.isMutable(t)?18:-1);}}function de(n,e){if(n&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"Description"),pl(),Ds(8,"th",10),NC(9,"Resources"),pl(),Ds(10,"th",10),NC(11,"Scope"),pl(),Ds(12,"th",10)(13,"span",11),NC(14,"Actions"),pl()()()(),Ds(15,"tbody",8),Hw(16,ce,19,10,"tr",9,Y),pl()()()),n&2){let t=Jw();BE(16),Uw(t.rowFilter.filteredRows());}}var Q=class n{route=g(W);router=g(F);destroyRef=g(Ie);skillState=g(o);agentState=g(s);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k();rows=Ui([]);rowFilter=O(this.rows,e=>[e.skill.name,e.skill.description,e.scope].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),Ty({platform:this.skillState.listPlatform().pipe(da(()=>Tr([]))),namespace:this.skillState.listByNamespace(this.namespaceId),agents:Ty({namespace:this.agentState.listByNamespace(this.namespaceId),platform:this.agentState.listPlatform().pipe(da(()=>Tr([])))}).pipe(ne$1(({namespace:e,platform:t})=>[...e,...t]),da(()=>Tr([])))}))),U(this.destroyRef)).subscribe({next:({platform:e,namespace:t,agents:a$1})=>{let d=(c,_,W)=>({key:`${_}:${c.id??W}`,skill:c,scope:_,namedByAgents:a$1.filter(X=>a(X.skillSelectors,c.name)==="named").length});this.rows.set([...e.map((c,_)=>d(c,"platform",_)),...t.map((c,_)=>d(c,"namespace",_))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}resourceCount(e){return Object.keys(e.resources??{}).length}isMutable(e){return e.scope==="namespace"&&e.skill.readOnly!==true&&!!e.skill.id}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"skills","new"]);}inspect(e){e.skill.id&&this.router.navigate(e.scope==="platform"?["/agentos","admin","skills",e.skill.id,"inspect"]:["/agentos",this.namespaceId,"skills",e.skill.id,"inspect"]);}edit(e){!this.isMutable(e)||!e.skill.id||this.router.navigate(["/agentos",this.namespaceId,"skills",e.skill.id,"edit"]);}requestDelete(e){this.deletion.request(e.key);}confirmDelete(e){if(!this.isMutable(e)||!e.skill.id)return;let t=e.namedByAgents;this.deletion.execute(e.key,{request$:this.skillState.delete(e.skill.id).pipe(U(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:a=>a.status===400?`"${e.skill.name}" is defined by a SKILL.md file and cannot be deleted through the API.`:`Deleting "${e.skill.name}" failed.${t>0?` ${t} agent(s) still name it.`:""}`});}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=yw({type:n,selectors:[["agentos-namespace-skills"]],decls:9,vars:3,consts:[["title","Skills","description","Skills available in this namespace, including skills inherited from the platform."],["label","Filter skills","placeholder","Filter skills\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Skills"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Resources"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["variant","neutral"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,a){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(c){return a.rowFilter.query.set(c)}),pl(),Ds(2,"button",2),mg("click",function(){return a.openCreateForm()}),NC(3,"New skill"),pl()(),Lw(4,Z,2,1,"p",3),Lw(5,ee,2,0,"p",4)(6,te,2,0,"p",5)(7,ne,2,0,"p",4)(8,de,18,0,"div",6)),t&2&&(BE(),ug("query",a.rowFilter.query()),BE(3),jw(a.deletion.error()?4:-1),BE(),jw(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{Q as NamespaceSkillsComponent};
1
+ import {a}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-B0IpC4Tx.js';import {J as s,z as k,O,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-DvqKcX7A.js';import {g,W,F,I as Ie,$ as Cr,U as Ui,a1 as fa,ac as Ty,a2 as da,aa as Tr,ad as ne$1,G as U,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,H as Hw,m as Uw,v as vl,as as kg,Z as Zw,r as df,s as ff,k as cg}from'./main-BGDYOJBA.js';var Y=(n,e)=>e.key;function Z(n,e){if(n&1&&(Ds(0,"p",3),NC(1),pl()),n&2){let t=Jw();BE(),Og(t.deletion.error());}}function ee(n,e){n&1&&(Ds(0,"p",4),NC(1,"Loading skills\u2026"),pl());}function te(n,e){n&1&&(Ds(0,"p",5),NC(1," No skills defined yet. Add one above, or drop a SKILL.md under the namespace config path. "),pl());}function ne(n,e){n&1&&(Ds(0,"p",4),NC(1,"No skills match the current filter."),pl());}function ie(n,e){if(n&1&&(Ds(0,"span",14),NC(1),pl()),n&2){let t=Jw().$implicit;BE(),kg(" named by ",t.namedByAgents," ",t.namedByAgents===1?"agent":"agents"," ");}}function ae(n,e){n&1&&(Ds(0,"ds-tag",20),NC(1,"Read-only"),pl());}function oe(n,e){n&1&&(Ds(0,"ds-tag",21),NC(1,"SKILL.md"),pl());}function le(n,e){if(n&1){let t=Zw();Ds(0,"button",25),mg("click",function(){df(t);let d=Jw(2).$implicit,c=Jw(2);return ff(c.edit(d))}),NC(1,"Edit"),pl();}if(n&2){let t=Jw(2).$implicit;cg("aria-label","Edit "+t.skill.name);}}function re(n,e){if(n&1){let t=Zw();Ds(0,"button",25),mg("click",function(){df(t);let d=Jw().$implicit,c=Jw(2);return ff(c.inspect(d))}),NC(1," View "),pl(),Lw(2,le,2,1,"button",26);}if(n&2){let t=Jw().$implicit,a=Jw(2);cg("aria-label","View "+t.skill.name),BE(2),jw(a.isMutable(t)?2:-1);}}function se(n,e){if(n&1){let t=Zw();Ds(0,"agentos-row-delete-action",27),mg("deleteRequested",function(){df(t);let d=Jw().$implicit,c=Jw(2);return ff(c.requestDelete(d))})("deleteConfirmed",function(){df(t);let d=Jw().$implicit,c=Jw(2);return ff(c.confirmDelete(d))})("deleteCancelled",function(){df(t);let d=Jw(3);return ff(d.deletion.cancel())}),pl();}if(n&2){let t=Jw().$implicit,a=Jw(2);ug("rowKey",t.key)("rowLabel",t.skill.name)("state",a.deletion);}}function ce(n,e){if(n&1&&(Ds(0,"tr",9)(1,"td",12)(2,"span",13),NC(3),pl(),Lw(4,ie,2,2,"span",14),pl(),Ds(5,"td",15),NC(6),pl(),Ds(7,"td",16),NC(8),pl(),Ds(9,"td",17)(10,"div",18)(11,"ds-tag",19),NC(12),pl(),Lw(13,ae,2,0,"ds-tag",20),Lw(14,oe,2,0,"ds-tag",21),pl()(),Ds(15,"td",22)(16,"div",23),Lw(17,re,3,2),Lw(18,se,1,3,"agentos-row-delete-action",24),pl()()()),n&2){let t=e.$implicit,a=Jw(2);BE(3),Og(t.skill.name),BE(),jw(t.namedByAgents>0?4:-1),BE(2),vl(" ",t.skill.description||"\u2014"," "),BE(2),Og(a.resourceCount(t.skill)),BE(3),ug("variant",t.scope==="platform"?"neutral":"accent"),BE(),Og(t.scope==="platform"?"Platform":"Namespace"),BE(),jw(t.scope==="platform"?13:-1),BE(),jw(t.skill.readOnly?14:-1),BE(3),jw(a.deletion.confirmingId()!==t.key?17:-1),BE(),jw(a.isMutable(t)?18:-1);}}function de(n,e){if(n&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"Description"),pl(),Ds(8,"th",10),NC(9,"Resources"),pl(),Ds(10,"th",10),NC(11,"Scope"),pl(),Ds(12,"th",10)(13,"span",11),NC(14,"Actions"),pl()()()(),Ds(15,"tbody",8),Hw(16,ce,19,10,"tr",9,Y),pl()()()),n&2){let t=Jw();BE(16),Uw(t.rowFilter.filteredRows());}}var Q=class n{route=g(W);router=g(F);destroyRef=g(Ie);skillState=g(o);agentState=g(s);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k();rows=Ui([]);rowFilter=O(this.rows,e=>[e.skill.name,e.skill.description,e.scope].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),Ty({platform:this.skillState.listPlatform().pipe(da(()=>Tr([]))),namespace:this.skillState.listByNamespace(this.namespaceId),agents:Ty({namespace:this.agentState.listByNamespace(this.namespaceId),platform:this.agentState.listPlatform().pipe(da(()=>Tr([])))}).pipe(ne$1(({namespace:e,platform:t})=>[...e,...t]),da(()=>Tr([])))}))),U(this.destroyRef)).subscribe({next:({platform:e,namespace:t,agents:a$1})=>{let d=(c,_,W)=>({key:`${_}:${c.id??W}`,skill:c,scope:_,namedByAgents:a$1.filter(X=>a(X.skillSelectors,c.name)==="named").length});this.rows.set([...e.map((c,_)=>d(c,"platform",_)),...t.map((c,_)=>d(c,"namespace",_))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}resourceCount(e){return Object.keys(e.resources??{}).length}isMutable(e){return e.scope==="namespace"&&e.skill.readOnly!==true&&!!e.skill.id}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"skills","new"]);}inspect(e){e.skill.id&&this.router.navigate(e.scope==="platform"?["/agentos","admin","skills",e.skill.id,"inspect"]:["/agentos",this.namespaceId,"skills",e.skill.id,"inspect"]);}edit(e){!this.isMutable(e)||!e.skill.id||this.router.navigate(["/agentos",this.namespaceId,"skills",e.skill.id,"edit"]);}requestDelete(e){this.deletion.request(e.key);}confirmDelete(e){if(!this.isMutable(e)||!e.skill.id)return;let t=e.namedByAgents;this.deletion.execute(e.key,{request$:this.skillState.delete(e.skill.id).pipe(U(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:a=>a.status===400?`"${e.skill.name}" is defined by a SKILL.md file and cannot be deleted through the API.`:`Deleting "${e.skill.name}" failed.${t>0?` ${t} agent(s) still name it.`:""}`});}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=yw({type:n,selectors:[["agentos-namespace-skills"]],decls:9,vars:3,consts:[["title","Skills","description","Skills available in this namespace, including skills inherited from the platform."],["label","Filter skills","placeholder","Filter skills\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Skills"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Resources"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["variant","neutral"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,a){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(c){return a.rowFilter.query.set(c)}),pl(),Ds(2,"button",2),mg("click",function(){return a.openCreateForm()}),NC(3,"New skill"),pl()(),Lw(4,Z,2,1,"p",3),Lw(5,ee,2,0,"p",4)(6,te,2,0,"p",5)(7,ne,2,0,"p",4)(8,de,18,0,"div",6)),t&2&&(BE(),ug("query",a.rowFilter.query()),BE(3),jw(a.deletion.error()?4:-1),BE(),jw(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{Q as NamespaceSkillsComponent};
@@ -1 +1 @@
1
- import {o as o$1,r,i,l}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-CP4by4ZM.js';import {O}from'./chunk-BYeNpjs5.js';import {g,W as W$1,F,I as Ie,ag as U,ay as N,U as Ui,az as K,a8 as _,X as XC,a9 as F$1,aA as qe$1,G as U$1,a2 as da,aa as Tr,ac as Ty,ad as ne,M as x,K as w,y as yw,au as $t$1,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,j as jw,aq as k,a6 as x$1,J as Jw,Z as Zw,l as lg,_ as _I,R as NI,k as cg,v as vl,H as Hw,m as Uw,O as Og,r as df,s as ff,as as kg}from'./main-FJXP2G5I.js';import {p as pt$1,T as Te,a as fn,U as Ut$1,n as nd,l as bo,x as xo,L as Lt$1,k as kn,u as vn,G as Gt$1,m as mo,b as po,$ as $r,H as qr,V as Vn,A as An,c as pn,h as hn,d as cn,r as ln,e as dn,C as mn,g as at$1,i as an,t as rn,j as ko}from'./chunk-D2BTEyR1.js';import'./chunk-B5eEl07l.js';var W=class n{aiModelController=g(k);listAvailable(t){let e=this.aiModelController.listPlatformLevelAiModel().pipe(this.orEmpty("platform")),o=t?this.aiModelController.listByNamespaceIdAiModel(t).pipe(this.orEmpty("namespace")):Tr([]);return Ty({platform:e,namespace:o}).pipe(ne(({platform:r,namespace:d})=>[...r,...d]))}orEmpty(t){return da(e=>(console.error(`[ai-model-state] failed to load the ${t} AI models`,e),Tr([])))}static \u0275fac=function(e){return new(e||n)};static \u0275prov=x$1({token:n,factory:n.\u0275fac,providedIn:"root"})};var D="*";function Ge(n){return (n??[]).some(t=>t.trim()===D)}function Ue(n){let t=(n??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==D).map(e=>e.toLowerCase());return new Set(t)}function H(n){return n.includes(D)}function Xe(n){let t=n.replace(/[\\.[\]{}()^$|]/g,"\\$&").replace(/\*/g,".*");try{return new RegExp(`^${t}$`,"i")}catch(e){return null}}function z(n,t){return (t??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==D&&H(e)).some(e=>Xe(e)?.test(n)??false)}var je="AGENTOS_CONFIG",Qe=new Set(["HTTP_API","MCP_HTTP","MCP_STDIO","BASH","TMUX","GIT"]);function Ke(n){return n.configEnabled&&(n.hasSubAgents||n.integrationTypes.some(t=>Qe.has(t)))}var $=n=>n.trim().toLowerCase();function Ze(n,t){let e=o=>o.namespaceId?1:0;return e(n)-e(t)||n.priority-t.priority}var We=(n,t)=>n.label.localeCompare(t.label);function He(n,t){let e=new Map;for(let _ of n){let m=_.alias?.trim();if(!m)continue;let I=e.get($(m));(!I||Ze(_,I)>0)&&e.set($(m),_);}let o=[...e.values()].map(_=>({value:_.alias.trim(),label:`${_.alias.trim()} (${_.apiModelName})`})).sort(We),r=new Set,d=[];for(let _ of n){let m=_.apiModelName?.trim();!m||r.has($(m))||(r.add($(m)),e.has($(m))||d.push({value:m,label:m}));}d.sort(We);let f=t??"";if(f.trim().length===0||[...o,...d].some(_=>_.value===f))return {aliases:o,apiNames:d,current:null};let S=e.has($(f))||r.has($(f));return {aliases:o,apiNames:d,current:{value:f,label:S?f:`${f} (not in the list)`}}}var Ye=(n,t)=>t.value,et=(n,t)=>t.config.id,tt=(n,t)=>t.type,qe=(n,t)=>t.selector;function nt(n,t){if(n&1&&(Ds(0,"a",2),NC(1,"View resolved definition \u2192"),pl()),n&2){let e=Jw();ug("routerLink",e.inspectRoute());}}function ot(n,t){n&1&&(Ds(0,"ds-tag",3),NC(1,"Platform level"),pl());}function it(n,t){n&1&&(Ds(0,"p",4),NC(1,"Loading\u2026"),pl());}function at(n,t){if(n&1&&(lg(0,"input",17),_I()),n&2){let e=Jw(2);ug("formControl",e.modelNameControl),NI();}}function lt(n,t){if(n&1&&(Ds(0,"option",41),NC(1),pl()),n&2){let e=t;ug("ngValue",e.value),BE(),Og(e.label);}}function rt(n,t){if(n&1&&(Ds(0,"option",41),NC(1),pl()),n&2){let e=t.$implicit;ug("ngValue",e.value),BE(),Og(e.label);}}function st(n,t){if(n&1&&(Ds(0,"optgroup",42),Hw(1,rt,2,2,"option",41,Ye),pl()),n&2){let e=Jw(3);BE(),Uw(e.modelOptions().aliases);}}function dt(n,t){if(n&1&&(Ds(0,"option",41),NC(1),pl()),n&2){let e=t.$implicit;ug("ngValue",e.value),BE(),Og(e.label);}}function ct(n,t){if(n&1&&(Ds(0,"optgroup",43),Hw(1,dt,2,2,"option",41,Ye),pl()),n&2){let e=Jw(3);BE(),Uw(e.modelOptions().apiNames);}}function mt(n,t){if(n&1&&(Ds(0,"select",18)(1,"option",40),NC(2,"Select a model"),pl(),Lw(3,lt,2,2,"option",41),Lw(4,st,3,0,"optgroup",42),Lw(5,ct,3,0,"optgroup",43),pl(),_I()),n&2){let e,o=Jw(2);ug("formControl",o.modelNameControl),NI(),BE(),ug("ngValue",null),BE(2),jw((e=o.modelOptions().current)?3:-1,e),BE(),jw(o.modelOptions().aliases.length>0?4:-1),BE(),jw(o.modelOptions().apiNames.length>0?5:-1);}}function ut(n,t){if(n&1&&(Ds(0,"span",44),NC(1),pl()),n&2){let e=Jw().$implicit;BE(),Og(e.config.integrationType);}}function gt(n,t){if(n&1&&(lg(0,"input",45),_I()),n&2){let e=Jw().$implicit;ug("formControl",e.toolsControl),cg("aria-label","Tools of "+e.config.name),NI();}}function pt(n,t){if(n&1){let e=Zw();Ds(0,"div",10)(1,"label",11)(2,"input",23),mg("change",function(){let r=df(e).$implicit,d=Jw(3);return ff(d.toggleIntegration(r))}),pl(),Ds(3,"span",24),NC(4),pl(),Lw(5,ut,2,1,"span",44),pl(),Lw(6,gt,1,2,"input",45),pl();}if(n&2){let e=t.$implicit;BE(2),ug("checked",e.enabled()),BE(2),Og(e.config.name),BE(),jw(e.config.integrationType?5:-1),BE(),jw(e.enabled()?6:-1);}}function ft(n,t){if(n&1&&(Ds(0,"p",13),NC(1),pl()),n&2){let e=Jw().$implicit;BE(),vl(" Restricted to: ",e.restrictedTools.join(", ")," (set outside this form, preserved on save) ");}}function Ct(n,t){if(n&1){let e=Zw();Ds(0,"div",10)(1,"label",24),NC(2),Ds(3,"span",44),NC(4,"built-in"),pl()(),Ds(5,"select",47),mg("change",function(r){let d=df(e).$implicit,f=Jw(4);return ff(f.setBuiltInState(d,r.target.value))}),Ds(6,"option",48),NC(7),pl(),Ds(8,"option",49),NC(9,"Enabled"),pl(),Ds(10,"option",50),NC(11,"Disabled"),pl()(),Lw(12,ft,2,1,"p",13),Ds(13,"p",13),NC(14),pl()();}if(n&2){let e=t.$implicit,o=Jw(4);BE(),cg("for","built-in-"+e.type),BE(),vl(" ",e.displayName," "),BE(3),ug("id","built-in-"+e.type)("value",e.state()),BE(2),Og(o.builtInDefaultLabel(e)),BE(5),jw(e.state()==="on"&&e.restrictedTools?12:-1),BE(2),Og(e.description);}}function _t(n,t){if(n&1&&(Ds(0,"span",46),NC(1,"Built-in integrations"),pl(),Hw(2,Ct,15,7,"div",10,tt)),n&2){let e=Jw(3);BE(2),Uw(e.builtInRows());}}function bt(n,t){n&1&&(Ds(0,"ds-notice",26),NC(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. "),pl());}function ht(n,t){if(n&1&&(Ds(0,"ds-fieldset",21),Hw(1,pt,7,4,"div",10,et),Lw(3,_t,4,0),Lw(4,bt,2,0,"ds-notice",26),pl()),n&2){let e=Jw(2);BE(),Uw(e.integrationRows()),BE(2),jw(e.builtInRows().length>0?3:-1),BE(),jw(e.configAgentExposureWarning()?4:-1);}}function yt(n,t){n&1&&NC(0," A platform config can only list platform skills here: namespace skills are resolved per namespace when the agent runs. ");}function vt(n,t){n&1&&(Ds(0,"ds-notice",26),NC(1," Saving with this on replaces the selection below with "),Ds(2,"code",25),NC(3,"*"),pl(),NC(4,". "),pl());}function xt(n,t){n&1&&(Ds(0,"ds-notice"),NC(1," The skill catalogue could not be loaded. What this agent already declares is listed below and preserved on save. "),pl());}function St(n,t){n&1&&(Ds(0,"p",4),NC(1,"No skill available in this scope yet."),pl());}function At(n,t){n&1&&(Ds(0,"span",44),NC(1,"platform"),pl());}function wt(n,t){if(n&1&&(Ds(0,"span",44),NC(1),pl()),n&2){let e=Jw(4);BE(),vl(" ",e.skillCatalogueUnavailable()?"not verified":"no matching skill"," ");}}function Et(n,t){if(n&1&&(Ds(0,"p",13),NC(1),pl()),n&2){let e=Jw().$implicit;BE(),Og(e.description);}}function Tt(n,t){if(n&1){let e=Zw();Ds(0,"div",10)(1,"label",11)(2,"input",51),mg("change",function(){let r=df(e).$implicit,d=Jw(3);return ff(d.toggleSkill(r))}),pl(),Ds(3,"span",24),NC(4),pl(),Lw(5,At,2,0,"span",44),Lw(6,wt,2,1,"span",44),pl(),Lw(7,Et,2,1,"p",13),pl();}if(n&2){let e=t.$implicit,o=Jw(3);BE(2),ug("checked",e.selected())("disabled",o.allSkillsSelected()),BE(2),Og(e.name),BE(),jw(e.platform?5:-1),BE(),jw(e.unresolved?6:-1),BE(),jw(e.description?7:-1);}}function kt(n,t){if(n&1&&Hw(0,Tt,8,6,"div",10,qe),n&2){let e=Jw(2);Uw(e.skillRows());}}function It(n,t){if(n&1&&(Ds(0,"ds-form-field",30),lg(1,"textarea",52),_I(),Ds(2,"p",4),NC(3," Default payload for this loop agent. Overridden at launch time if the first message contains a valid "),Ds(4,"code"),NC(5,"AgentLoopPayload"),pl(),NC(6,". Leave empty if you always provide the payload at launch. "),pl()()),n&2){let e=Jw(2);ug("error",e.loopConfigControl.invalid&&e.loopConfigControl.touched?"Invalid JSON \u2014 please fix the syntax.":null),BE(),ug("placeholder",e.loopConfigPlaceholder)("formControl",e.loopConfigControl),NI();}}function Mt(n,t){n&1&&NC(0," A platform config can only list platform agents here: a namespace's agents are resolved per namespace when the agent runs. ");}function Rt(n,t){if(n&1&&NC(0),n&2){let e=Jw(3);kg(" That deletes ",e.droppedUnresolvedSubAgents()," flagged ",e.droppedUnresolvedSubAgents()===1?"selector":"selectors"," nothing matched, which this form cannot restore. ");}}function Ft(n,t){if(n&1&&(Ds(0,"ds-notice",26),NC(1," Saving with this on replaces the selection below with "),Ds(2,"code",25),NC(3,"*"),pl(),NC(4,". "),Lw(5,Rt,1,2),pl()),n&2){let e=Jw(2);BE(5),jw(e.droppedUnresolvedSubAgents()>0?5:-1);}}function Nt(n,t){n&1&&(Ds(0,"ds-notice"),NC(1," The list of agents could not be loaded. What this agent already declares is listed below and preserved on save. "),pl());}function Dt(n,t){n&1&&(Ds(0,"p",4),NC(1,"No other agent is available in this scope yet."),pl());}function Lt(n,t){n&1&&(Ds(0,"span",44),NC(1,"pattern"),pl());}function Ot(n,t){n&1&&(Ds(0,"span",44),NC(1,"via pattern"),pl());}function Vt(n,t){if(n&1&&(Ds(0,"span",44),NC(1),pl()),n&2){let e=Jw(4);BE(),vl(" ",e.subAgentCandidatesUnavailable()?"not verified":"no matching agent"," ");}}function Pt(n,t){if(n&1){let e=Zw();Ds(0,"button",55),mg("click",function(){df(e);let r=Jw().$implicit,d=Jw(3);return ff(d.removeSubAgent(r))}),NC(1," \xD7 "),pl();}if(n&2){let e=Jw().$implicit;cg("aria-label","Remove "+e.selector);}}function Bt(n,t){if(n&1){let e=Zw();Ds(0,"div",32)(1,"label",53)(2,"input",51),mg("change",function(){let r=df(e).$implicit,d=Jw(3);return ff(d.toggleSubAgent(r))}),pl(),Ds(3,"span",24),NC(4),pl(),Lw(5,Lt,2,0,"span",44)(6,Ot,2,0,"span",44)(7,Vt,2,1,"span",44),pl(),Lw(8,Pt,2,1,"button",54),pl();}if(n&2){let e=t.$implicit,o=Jw(3);BE(2),ug("checked",e.selected())("disabled",o.allSubAgentsSelected()),BE(2),Og(e.name),BE(),jw(e.pattern?5:e.grantedByPattern?6:e.unresolved?7:-1),BE(3),jw(e.unresolved?8:-1);}}function $t(n,t){if(n&1&&Hw(0,Bt,9,5,"div",32,qe),n&2){let e=Jw(2);Uw(e.subAgentRows());}}function Gt(n,t){if(n&1){let e=Zw();Ds(0,"div")(1,"button",56),mg("click",function(){df(e);let r=Jw(2);return ff(r.useDefaultDelegationTimeout())}),NC(2," Use server default "),pl()();}}function Ut(n,t){n&1&&(Ds(0,"ds-notice"),NC(1),pl()),n&2&&(BE(),Og(t));}function jt(n,t){if(n&1){let e=Zw();Ds(0,"button",57),mg("click",function(){df(e);let r=Jw(2);return ff(r.exportYaml())}),NC(1),pl();}if(n&2){let e=Jw(2);ug("disabled",e.isExporting()),BE(),vl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Kt(n,t){if(n&1){let e=Zw();Ds(0,"form",6),mg("ngSubmit",function(){df(e);let r=Jw();return ff(r.submit())}),Ds(1,"ds-fieldset",7)(2,"ds-form-field",8),lg(3,"input",9),_I(),pl(),Ds(4,"div",10)(5,"label",11),lg(6,"input",12),_I(),NC(7," Enabled "),pl(),Ds(8,"p",13),NC(9,"Disabled agents are excluded from namespace resolution."),pl()(),Ds(10,"ds-form-field",14),lg(11,"input",15),_I(),pl(),Ds(12,"ds-form-field",16),Lw(13,at,1,1,"input",17)(14,mt,6,5,"select",18),pl(),Ds(15,"ds-form-field",19),lg(16,"textarea",20),_I(),pl()(),Lw(17,ht,5,2,"ds-fieldset",21),Ds(18,"ds-fieldset",22)(19,"p",4),NC(20," Instruction bundles this agent can read on demand. Selecting at least one grants it the "),Ds(21,"code"),NC(22,"readSkill"),pl(),NC(23," and "),Ds(24,"code"),NC(25,"readSkillResource"),pl(),NC(26," tools; selecting none grants neither. "),Lw(27,yt,1,0),pl(),Ds(28,"label",11)(29,"input",23),mg("change",function(){df(e);let r=Jw();return ff(r.toggleAllSkills())}),pl(),Ds(30,"span",24),NC(31,"Every skill in the catalogue ("),Ds(32,"code",25),NC(33,"*"),pl(),NC(34,")"),pl()(),Ds(35,"p",13),NC(36," Resolved at run time, so skills added later are granted too, without editing this agent. "),pl(),Lw(37,vt,5,0,"ds-notice",26),Lw(38,xt,2,0,"ds-notice"),Lw(39,St,2,0,"p",4)(40,kt,2,0),pl(),Ds(41,"ds-form-field",27)(42,"select",28)(43,"option",29),NC(44,"SIMPLE \u2014 Standard agent (single LLM call)"),pl(),Ds(45,"option",29),NC(46,"ADVANCED \u2014 Multi-step reasoning loop"),pl(),Ds(47,"option",29),NC(48,"LOOP \u2014 Bulk loop agent (no LLM, experimental)"),pl()(),_I(),pl(),Lw(49,It,7,3,"ds-form-field",30),Ds(50,"ds-fieldset",31)(51,"p",4),NC(52," The agents this one may delegate to. Selecting at least one grants it the "),Ds(53,"code"),NC(54,"DELEGATE__delegate"),pl(),NC(55," tool; selecting none grants it no way to delegate. Entries are matched against agent names, never ids. "),Lw(56,Mt,1,0),pl(),Ds(57,"label",11)(58,"input",23),mg("change",function(){df(e);let r=Jw();return ff(r.toggleAllSubAgents())}),pl(),Ds(59,"span",24),NC(60,"Every agent it can reach ("),Ds(61,"code",25),NC(62,"*"),pl(),NC(63,")"),pl()(),Ds(64,"p",13),NC(65," Resolved at run time, so agents added later can be delegated to as well, without editing this agent. "),pl(),Lw(66,Ft,6,1,"ds-notice",26),Lw(67,Nt,2,0,"ds-notice"),Lw(68,Dt,2,0,"p",4)(69,$t,2,0),Ds(70,"p",4),NC(71," Advanced \u2014 add a glob instead of picking a name, for example "),Ds(72,"code"),NC(73,"*Fixer"),pl(),NC(74," to cover BugFixer and StoryFixer. "),pl(),Ds(75,"div",32)(76,"input",33),mg("keydown.enter",function(){df(e);let r=Jw();return ff(r.addSubAgent())}),pl(),_I(),Ds(77,"button",34),mg("click",function(){df(e);let r=Jw();return ff(r.addSubAgent())}),NC(78," + "),pl()(),Ds(79,"ds-form-field",35),lg(80,"input",36),_I(),Lw(81,Gt,3,0,"div"),pl()(),Lw(82,Ut,2,1,"ds-notice"),Ds(83,"ds-form-actions")(84,"button",37),NC(85),pl(),Lw(86,jt,2,2,"button",38),Ds(87,"button",39),mg("click",function(){df(e);let r=Jw();return ff(r.cancel())}),NC(88,"Cancel"),pl()()();}if(n&2){let e,o=Jw();ug("formGroup",o.form),BE(3),ug("formControl",o.nameControl),NI(),BE(3),ug("formControl",o.enabledControl),NI(),BE(5),ug("formControl",o.descriptionControl),NI(),BE(2),jw(o.modelAsFreeText()?13:14),BE(3),ug("formControl",o.instructionsControl),NI(),BE(),jw(o.integrationRows().length>0||o.builtInRows().length>0?17:-1),BE(10),jw(o.isPlatformMode?27:-1),BE(2),ug("checked",o.allSkillsSelected()),BE(8),jw(o.namedSkillSelectionDropped()?37:-1),BE(),jw(o.skillCatalogueUnavailable()?38:-1),BE(),jw(o.skillRows().length===0?39:40),BE(3),ug("formControl",o.executionModeControl),NI(),BE(),ug("value",o.ExecutionMode.SIMPLE),BE(2),ug("value",o.ExecutionMode.ADVANCED),BE(2),ug("value",o.ExecutionMode.LOOP),BE(2),jw(o.isLoopMode()?49:-1),BE(7),jw(o.isPlatformMode?56:-1),BE(2),ug("checked",o.allSubAgentsSelected()),BE(8),jw(o.namedSubAgentSelectionDropped()?66:-1),BE(),jw(o.subAgentCandidatesUnavailable()?67:-1),BE(),jw(o.subAgentRows().length===0?68:69),BE(8),ug("formControl",o.newSubAgentControl),NI(),BE(),ug("disabled",!o.newSubAgentControl.value.trim()),BE(2),ug("hint",o.delegationTimeoutHint())("error",o.delegationTimeoutControl.invalid?"Enter a valid positive whole number of seconds, or leave empty to inherit the server default.":null),BE(),ug("formControl",o.delegationTimeoutControl),cg("aria-invalid",o.delegationTimeoutControl.invalid),NI(),BE(),jw(o.delegationTimeoutControl.value!==null?81:-1),BE(),jw((e=o.submitError())?82:-1,e),BE(2),ug("disabled",o.form.invalid||o.isSubmitting()),BE(),vl(" ",o.isEditMode()?"Save changes":"Create"," "),BE(),jw(o.isEditMode()?86:-1);}}var Je=class n{route=g(W$1);router=g(F);destroyRef=g(Ie);agentConfigController=g(U);defaultsController=g(N);defaultDelegationTimeoutSeconds=Ui(null);exportService=g(K);integrationConfigState=g(O);integrationTypeController=g(_);skillState=g(o);aiModelState=g(W);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(o){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=XC(()=>{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$1(this.form.controls.executionMode.valueChanges,{initialValue:this.form.controls.executionMode.value});isLoopMode=XC(()=>this.executionModeValue()==="LOOP");subAgentRows=Ui([]);allSubAgentsSelected=Ui(false);subAgentCandidatesUnavailable=Ui(false);namedSubAgentSelectionDropped=XC(()=>this.allSubAgentsSelected()&&this.subAgentRows().some(t=>t.selected()));droppedUnresolvedSubAgents=XC(()=>this.allSubAgentsSelected()?this.subAgentRows().filter(t=>t.unresolved&&t.selected()).length:0);hasAnySubAgent=XC(()=>this.allSubAgentsSelected()||this.subAgentRows().some(t=>t.selected()));newSubAgentControl=new Te("",{nonNullable:true});isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);isExporting=Ui(false);submitError=Ui(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=Ui([]);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=XC(()=>Ke({configEnabled:this.builtInRows().some(t=>t.type===je&&t.state()==="on"),integrationTypes:this.integrationRows().filter(t=>t.enabled()).map(t=>t.config.integrationType),hasSubAgents:this.hasAnySubAgent()}));modelOptions=Ui({aliases:[],apiNames:[],current:null});modelCatalogueLoaded=Ui(false);modelAsFreeText=XC(()=>{let{aliases:t,apiNames:e}=this.modelOptions();return this.modelCatalogueLoaded()&&t.length+e.length===0});applyModelCatalogue(t,e){this.modelOptions.set(He(t,e)),this.modelCatalogueLoaded.set(true);}integrationRows=Ui([]);skillRows=Ui([]);allSkillsSelected=Ui(false);skillCatalogueUnavailable=Ui(false);namedSkillSelectionDropped=XC(()=>this.allSkillsSelected()&&this.skillRows().some(t=>t.selected()));existingConfig=null;ngOnInit(){this.defaultsController.getAgentConfigDefaults().pipe(U$1(this.destroyRef),da(()=>Tr(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),Ty({config:this.agentConfigController.getByIdAgentConfig(t),namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):Tr([]),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:o,platformIntegrations:r,builtInTypes:d,skillCatalogue:f,delegationCandidates:S,models:_})=>{this.existingConfig=e,this.applyModelCatalogue(_,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 m=e.executionMode??(e.advancedExecution?"ADVANCED":"SIMPLE");this.executionModeControl.setValue(m),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 I=[...r,...o];this.integrationRows.set(this.buildIntegrationRows(I,e.integrations??void 0)),this.builtInRows.set(this.buildBuiltInRows(d,e.integrations??void 0)),this.allSubAgentsSelected.set(Ge(e.subAgents)),this.subAgentRows.set(this.buildSubAgentRows(S,e.subAgents,e.name)),this.allSkillsSelected.set(o$1(e.skillSelectors)),this.skillRows.set(this.buildSkillRows(f,e.skillSelectors)),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadIntegrations(t){Ty({namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):Tr([]),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:o,builtInTypes:r,skillCatalogue:d,delegationCandidates:f,models:S})=>{this.applyModelCatalogue(S,null);let _=[...o,...e];this.integrationRows.set(this.buildIntegrationRows(_,t??void 0)),this.builtInRows.set(this.buildBuiltInRows(r,t??void 0)),this.allSubAgentsSelected.set(false),this.subAgentRows.set(this.buildSubAgentRows(f,void 0,null)),this.allSkillsSelected.set(false),this.skillRows.set(this.buildSkillRows(d,void 0));}});}loadSkillCatalogue(){return (this.namespaceId?this.skillState.listEffective(this.namespaceId):this.skillState.listPlatform().pipe(ne(e=>e.map(o=>({id:o.id??"",name:o.name,description:o.description,namespaceId:o.namespaceId??null,readOnly:o.readOnly===true}))))).pipe(da(e=>(console.error("[agent-config-form] failed to load the skill catalogue",e),this.skillCatalogueUnavailable.set(true),Tr([]))))}buildSkillRows(t,e){let r$1=(e??[]).map(m=>m.trim()).filter(m=>m.length>0).filter(m=>m!==r),d=i(r$1),f=new Set(t.map(m=>m.name.toLowerCase())),S=t.map(m=>({selector:m.name,name:m.name,description:m.description,platform:m.namespaceId==null,unresolved:false,selected:Ui(d.has(m.name.toLowerCase()))})),_=new Set;for(let m of r$1){let I=l(m).toLowerCase();f.has(I)||_.has(I)||(_.add(I),S.push({selector:m,name:m,description:"",platform:false,unresolved:true,selected:Ui(true)}));}return S}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()):Tr([]);return Ty({platform:t,namespace:e}).pipe(ne(({platform:o,namespace:r})=>[...o,...r]),ne(o=>o.map(r=>r.name).filter(r=>r.length>0)),ne(o=>n.dedupeByKey(o)))}orNoCandidates(){return da(t=>(console.error("[agent-config-form] failed to load the delegation candidates",t),this.subAgentCandidatesUnavailable.set(true),Tr([])))}static dedupeByKey(t){let e=new Set;return t.filter(o=>{let r=o.toLowerCase();return e.has(r)?false:(e.add(r),true)})}buildSubAgentRows(t,e,o){let r=Ue(e),d=o?.toLowerCase()??null,f=t.filter(b=>{let G=b.toLowerCase();return G!==d||r.has(G)}),S=new Set(f.map(b=>b.toLowerCase())),_=f.map(b=>({selector:b,name:b,unresolved:false,pattern:false,grantedByPattern:z(b,e),selected:Ui(r.has(b.toLowerCase()))})),m=new Set,I=(e??[]).map(b=>b.trim()).filter(b=>b.length>0&&b!==D);for(let b of I){let G=b.toLowerCase();S.has(G)||m.has(G)||(m.add(G),_.push({selector:b,name:b,unresolved:true,pattern:H(b),grantedByPattern:false,selected:Ui(true)}));}return _}loadBuiltInTypes(){return this.integrationTypeController.listTypesIntegrationType().pipe(ne(t=>t.filter(e=>!e.configSchema)),da(t=>(console.error("[agent-config-form] failed to load integration types",t),Tr([]))))}buildIntegrationRows(t,e){return t.map(o=>{let r=o.name??"",d=e?.[r],f=e!=null&&r in e,S=Array.isArray(d)?d.join(", "):"";return {config:o,enabled:Ui(f),toolsControl:new Te(S,{nonNullable:true})}})}buildBuiltInRows(t,e){return t.map(o=>{let r=e!=null&&o.type in e,d=e?.[o.type],f=r?Array.isArray(d)&&d.length===0?"off":"on":"default";return {type:o.type,displayName:o.displayName,description:o.description,enabledByDefault:o.enabledByDefault===true,state:Ui(f),restrictedTools:Array.isArray(d)&&d.length>0?d: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(o=>o.selector.toLowerCase()===t.toLowerCase());e?e.selected.set(true):t===D?this.allSubAgentsSelected.set(true):this.subAgentRows.update(o=>this.withPatternGrants([...o,{selector:t,name:t,unresolved:true,pattern:H(t),grantedByPattern:false,selected:Ui(true)}])),this.newSubAgentControl.reset("");}removeSubAgent(t){let e=t.selector.toLowerCase();this.subAgentRows.update(o=>this.withPatternGrants(o.filter(r=>r.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(o=>o.selected()).map(o=>o.selector);return t.map(o=>o.unresolved?o:x(w({},o),{grantedByPattern:z(o.name,e)}))}toggleAllSubAgents(){this.allSubAgentsSelected.update(t=>!t),this.subAgentRows.update(t=>this.withPatternGrants(t));}buildSubAgentsPayload(){if(this.allSubAgentsSelected())return [D];let t=this.subAgentRows().filter(e=>e.selected()).map(e=>e.selector);return t.length>0?t:void 0}buildIntegrationsPayload(){let t={};for(let o of this.integrationRows().filter(r=>r.enabled())){let r=o.config.name??"",d=o.toolsControl.value.trim();t[r]=d===""?null:d.split(",").map(f=>f.trim()).filter(f=>f.length>0);}for(let o of this.builtInRows()){let r=o.state();r==="on"?t[o.type]=o.restrictedTools??null:r==="off"&&(t[o.type]=[]);}let e=new Set([...this.integrationRows().map(o=>o.config.name??""),...this.builtInRows().map(o=>o.type)]);for(let[o,r]of Object.entries(this.existingConfig?.integrations??{}))e.has(o)||(t[o]=r);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:o=>{this.isSubmitting.set(false),this.submitError.set(n.serverMessage(o));}});}static serverMessage(t){let o=t?.error?.message;if(typeof o=="string"&&o.trim().length>0)return o;let r=t?.status;return r===0?"The server could not be reached. The agent was not saved.":typeof r=="number"&&r>=500?`The server failed to save the agent (HTTP ${r}). 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 o=new Blob([e],{type:"application/yaml"}),r=URL.createObjectURL(o),d=document.createElement("a");d.href=r,d.download=`${this.existingConfig?.name??"agent"}.yaml`,d.click(),URL.revokeObjectURL(r),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=yw({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,o){e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return o.cancel()}),NC(3," \u2190 Agent configs "),pl(),Lw(4,nt,2,1,"a",2),Lw(5,ot,2,0,"ds-tag",3),pl(),Lw(6,it,2,0,"p",4)(7,Kt,89,33,"form",5),pl()),e&2&&(BE(),ug("title",o.isEditMode()?"Edit agent config":"New agent config"),BE(3),jw(o.isEditMode()?4:-1),BE(),jw(o.isPlatformMode?5:-1),BE(),jw(o.isLoading()?6:7));},dependencies:[Ut$1,nd,bo,xo,Lt$1,kn,vn,Gt$1,mo,po,$r,qr,Vn,An,$t$1,pn,hn,cn,ln,dn,mn,at$1,an,rn,ko],encapsulation:2})};export{Je as AgentConfigFormComponent};
1
+ import {o as o$1,r,i,l}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-B0IpC4Tx.js';import {O}from'./chunk-DueFkMuu.js';import {g,W as W$1,F,I as Ie,ag as U,ay as N,U as Ui,az as K,a8 as _,X as XC,a9 as F$1,aA as qe$1,G as U$1,a2 as da,aa as Tr,ac as Ty,ad as ne,M as x,K as w,y as yw,au as $t$1,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,j as jw,aq as k,a6 as x$1,J as Jw,Z as Zw,l as lg,_ as _I,R as NI,k as cg,v as vl,H as Hw,m as Uw,O as Og,r as df,s as ff,as as kg}from'./main-BGDYOJBA.js';import {p as pt$1,T as Te,a as fn,U as Ut$1,n as nd,l as bo,x as xo,L as Lt$1,k as kn,u as vn,G as Gt$1,m as mo,b as po,$ as $r,H as qr,V as Vn,A as An,c as pn,h as hn,d as cn,r as ln,e as dn,C as mn,g as at$1,i as an,t as rn,j as ko}from'./chunk-DvqKcX7A.js';import'./chunk-AYvnGrVn.js';var W=class n{aiModelController=g(k);listAvailable(t){let e=this.aiModelController.listPlatformLevelAiModel().pipe(this.orEmpty("platform")),o=t?this.aiModelController.listByNamespaceIdAiModel(t).pipe(this.orEmpty("namespace")):Tr([]);return Ty({platform:e,namespace:o}).pipe(ne(({platform:r,namespace:d})=>[...r,...d]))}orEmpty(t){return da(e=>(console.error(`[ai-model-state] failed to load the ${t} AI models`,e),Tr([])))}static \u0275fac=function(e){return new(e||n)};static \u0275prov=x$1({token:n,factory:n.\u0275fac,providedIn:"root"})};var D="*";function Ge(n){return (n??[]).some(t=>t.trim()===D)}function Ue(n){let t=(n??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==D).map(e=>e.toLowerCase());return new Set(t)}function H(n){return n.includes(D)}function Xe(n){let t=n.replace(/[\\.[\]{}()^$|]/g,"\\$&").replace(/\*/g,".*");try{return new RegExp(`^${t}$`,"i")}catch(e){return null}}function z(n,t){return (t??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==D&&H(e)).some(e=>Xe(e)?.test(n)??false)}var je="AGENTOS_CONFIG",Qe=new Set(["HTTP_API","MCP_HTTP","MCP_STDIO","BASH","TMUX","GIT"]);function Ke(n){return n.configEnabled&&(n.hasSubAgents||n.integrationTypes.some(t=>Qe.has(t)))}var $=n=>n.trim().toLowerCase();function Ze(n,t){let e=o=>o.namespaceId?1:0;return e(n)-e(t)||n.priority-t.priority}var We=(n,t)=>n.label.localeCompare(t.label);function He(n,t){let e=new Map;for(let _ of n){let m=_.alias?.trim();if(!m)continue;let I=e.get($(m));(!I||Ze(_,I)>0)&&e.set($(m),_);}let o=[...e.values()].map(_=>({value:_.alias.trim(),label:`${_.alias.trim()} (${_.apiModelName})`})).sort(We),r=new Set,d=[];for(let _ of n){let m=_.apiModelName?.trim();!m||r.has($(m))||(r.add($(m)),e.has($(m))||d.push({value:m,label:m}));}d.sort(We);let f=t??"";if(f.trim().length===0||[...o,...d].some(_=>_.value===f))return {aliases:o,apiNames:d,current:null};let S=e.has($(f))||r.has($(f));return {aliases:o,apiNames:d,current:{value:f,label:S?f:`${f} (not in the list)`}}}var Ye=(n,t)=>t.value,et=(n,t)=>t.config.id,tt=(n,t)=>t.type,qe=(n,t)=>t.selector;function nt(n,t){if(n&1&&(Ds(0,"a",2),NC(1,"View resolved definition \u2192"),pl()),n&2){let e=Jw();ug("routerLink",e.inspectRoute());}}function ot(n,t){n&1&&(Ds(0,"ds-tag",3),NC(1,"Platform level"),pl());}function it(n,t){n&1&&(Ds(0,"p",4),NC(1,"Loading\u2026"),pl());}function at(n,t){if(n&1&&(lg(0,"input",17),_I()),n&2){let e=Jw(2);ug("formControl",e.modelNameControl),NI();}}function lt(n,t){if(n&1&&(Ds(0,"option",41),NC(1),pl()),n&2){let e=t;ug("ngValue",e.value),BE(),Og(e.label);}}function rt(n,t){if(n&1&&(Ds(0,"option",41),NC(1),pl()),n&2){let e=t.$implicit;ug("ngValue",e.value),BE(),Og(e.label);}}function st(n,t){if(n&1&&(Ds(0,"optgroup",42),Hw(1,rt,2,2,"option",41,Ye),pl()),n&2){let e=Jw(3);BE(),Uw(e.modelOptions().aliases);}}function dt(n,t){if(n&1&&(Ds(0,"option",41),NC(1),pl()),n&2){let e=t.$implicit;ug("ngValue",e.value),BE(),Og(e.label);}}function ct(n,t){if(n&1&&(Ds(0,"optgroup",43),Hw(1,dt,2,2,"option",41,Ye),pl()),n&2){let e=Jw(3);BE(),Uw(e.modelOptions().apiNames);}}function mt(n,t){if(n&1&&(Ds(0,"select",18)(1,"option",40),NC(2,"Select a model"),pl(),Lw(3,lt,2,2,"option",41),Lw(4,st,3,0,"optgroup",42),Lw(5,ct,3,0,"optgroup",43),pl(),_I()),n&2){let e,o=Jw(2);ug("formControl",o.modelNameControl),NI(),BE(),ug("ngValue",null),BE(2),jw((e=o.modelOptions().current)?3:-1,e),BE(),jw(o.modelOptions().aliases.length>0?4:-1),BE(),jw(o.modelOptions().apiNames.length>0?5:-1);}}function ut(n,t){if(n&1&&(Ds(0,"span",44),NC(1),pl()),n&2){let e=Jw().$implicit;BE(),Og(e.config.integrationType);}}function gt(n,t){if(n&1&&(lg(0,"input",45),_I()),n&2){let e=Jw().$implicit;ug("formControl",e.toolsControl),cg("aria-label","Tools of "+e.config.name),NI();}}function pt(n,t){if(n&1){let e=Zw();Ds(0,"div",10)(1,"label",11)(2,"input",23),mg("change",function(){let r=df(e).$implicit,d=Jw(3);return ff(d.toggleIntegration(r))}),pl(),Ds(3,"span",24),NC(4),pl(),Lw(5,ut,2,1,"span",44),pl(),Lw(6,gt,1,2,"input",45),pl();}if(n&2){let e=t.$implicit;BE(2),ug("checked",e.enabled()),BE(2),Og(e.config.name),BE(),jw(e.config.integrationType?5:-1),BE(),jw(e.enabled()?6:-1);}}function ft(n,t){if(n&1&&(Ds(0,"p",13),NC(1),pl()),n&2){let e=Jw().$implicit;BE(),vl(" Restricted to: ",e.restrictedTools.join(", ")," (set outside this form, preserved on save) ");}}function Ct(n,t){if(n&1){let e=Zw();Ds(0,"div",10)(1,"label",24),NC(2),Ds(3,"span",44),NC(4,"built-in"),pl()(),Ds(5,"select",47),mg("change",function(r){let d=df(e).$implicit,f=Jw(4);return ff(f.setBuiltInState(d,r.target.value))}),Ds(6,"option",48),NC(7),pl(),Ds(8,"option",49),NC(9,"Enabled"),pl(),Ds(10,"option",50),NC(11,"Disabled"),pl()(),Lw(12,ft,2,1,"p",13),Ds(13,"p",13),NC(14),pl()();}if(n&2){let e=t.$implicit,o=Jw(4);BE(),cg("for","built-in-"+e.type),BE(),vl(" ",e.displayName," "),BE(3),ug("id","built-in-"+e.type)("value",e.state()),BE(2),Og(o.builtInDefaultLabel(e)),BE(5),jw(e.state()==="on"&&e.restrictedTools?12:-1),BE(2),Og(e.description);}}function _t(n,t){if(n&1&&(Ds(0,"span",46),NC(1,"Built-in integrations"),pl(),Hw(2,Ct,15,7,"div",10,tt)),n&2){let e=Jw(3);BE(2),Uw(e.builtInRows());}}function bt(n,t){n&1&&(Ds(0,"ds-notice",26),NC(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. "),pl());}function ht(n,t){if(n&1&&(Ds(0,"ds-fieldset",21),Hw(1,pt,7,4,"div",10,et),Lw(3,_t,4,0),Lw(4,bt,2,0,"ds-notice",26),pl()),n&2){let e=Jw(2);BE(),Uw(e.integrationRows()),BE(2),jw(e.builtInRows().length>0?3:-1),BE(),jw(e.configAgentExposureWarning()?4:-1);}}function yt(n,t){n&1&&NC(0," A platform config can only list platform skills here: namespace skills are resolved per namespace when the agent runs. ");}function vt(n,t){n&1&&(Ds(0,"ds-notice",26),NC(1," Saving with this on replaces the selection below with "),Ds(2,"code",25),NC(3,"*"),pl(),NC(4,". "),pl());}function xt(n,t){n&1&&(Ds(0,"ds-notice"),NC(1," The skill catalogue could not be loaded. What this agent already declares is listed below and preserved on save. "),pl());}function St(n,t){n&1&&(Ds(0,"p",4),NC(1,"No skill available in this scope yet."),pl());}function At(n,t){n&1&&(Ds(0,"span",44),NC(1,"platform"),pl());}function wt(n,t){if(n&1&&(Ds(0,"span",44),NC(1),pl()),n&2){let e=Jw(4);BE(),vl(" ",e.skillCatalogueUnavailable()?"not verified":"no matching skill"," ");}}function Et(n,t){if(n&1&&(Ds(0,"p",13),NC(1),pl()),n&2){let e=Jw().$implicit;BE(),Og(e.description);}}function Tt(n,t){if(n&1){let e=Zw();Ds(0,"div",10)(1,"label",11)(2,"input",51),mg("change",function(){let r=df(e).$implicit,d=Jw(3);return ff(d.toggleSkill(r))}),pl(),Ds(3,"span",24),NC(4),pl(),Lw(5,At,2,0,"span",44),Lw(6,wt,2,1,"span",44),pl(),Lw(7,Et,2,1,"p",13),pl();}if(n&2){let e=t.$implicit,o=Jw(3);BE(2),ug("checked",e.selected())("disabled",o.allSkillsSelected()),BE(2),Og(e.name),BE(),jw(e.platform?5:-1),BE(),jw(e.unresolved?6:-1),BE(),jw(e.description?7:-1);}}function kt(n,t){if(n&1&&Hw(0,Tt,8,6,"div",10,qe),n&2){let e=Jw(2);Uw(e.skillRows());}}function It(n,t){if(n&1&&(Ds(0,"ds-form-field",30),lg(1,"textarea",52),_I(),Ds(2,"p",4),NC(3," Default payload for this loop agent. Overridden at launch time if the first message contains a valid "),Ds(4,"code"),NC(5,"AgentLoopPayload"),pl(),NC(6,". Leave empty if you always provide the payload at launch. "),pl()()),n&2){let e=Jw(2);ug("error",e.loopConfigControl.invalid&&e.loopConfigControl.touched?"Invalid JSON \u2014 please fix the syntax.":null),BE(),ug("placeholder",e.loopConfigPlaceholder)("formControl",e.loopConfigControl),NI();}}function Mt(n,t){n&1&&NC(0," A platform config can only list platform agents here: a namespace's agents are resolved per namespace when the agent runs. ");}function Rt(n,t){if(n&1&&NC(0),n&2){let e=Jw(3);kg(" That deletes ",e.droppedUnresolvedSubAgents()," flagged ",e.droppedUnresolvedSubAgents()===1?"selector":"selectors"," nothing matched, which this form cannot restore. ");}}function Ft(n,t){if(n&1&&(Ds(0,"ds-notice",26),NC(1," Saving with this on replaces the selection below with "),Ds(2,"code",25),NC(3,"*"),pl(),NC(4,". "),Lw(5,Rt,1,2),pl()),n&2){let e=Jw(2);BE(5),jw(e.droppedUnresolvedSubAgents()>0?5:-1);}}function Nt(n,t){n&1&&(Ds(0,"ds-notice"),NC(1," The list of agents could not be loaded. What this agent already declares is listed below and preserved on save. "),pl());}function Dt(n,t){n&1&&(Ds(0,"p",4),NC(1,"No other agent is available in this scope yet."),pl());}function Lt(n,t){n&1&&(Ds(0,"span",44),NC(1,"pattern"),pl());}function Ot(n,t){n&1&&(Ds(0,"span",44),NC(1,"via pattern"),pl());}function Vt(n,t){if(n&1&&(Ds(0,"span",44),NC(1),pl()),n&2){let e=Jw(4);BE(),vl(" ",e.subAgentCandidatesUnavailable()?"not verified":"no matching agent"," ");}}function Pt(n,t){if(n&1){let e=Zw();Ds(0,"button",55),mg("click",function(){df(e);let r=Jw().$implicit,d=Jw(3);return ff(d.removeSubAgent(r))}),NC(1," \xD7 "),pl();}if(n&2){let e=Jw().$implicit;cg("aria-label","Remove "+e.selector);}}function Bt(n,t){if(n&1){let e=Zw();Ds(0,"div",32)(1,"label",53)(2,"input",51),mg("change",function(){let r=df(e).$implicit,d=Jw(3);return ff(d.toggleSubAgent(r))}),pl(),Ds(3,"span",24),NC(4),pl(),Lw(5,Lt,2,0,"span",44)(6,Ot,2,0,"span",44)(7,Vt,2,1,"span",44),pl(),Lw(8,Pt,2,1,"button",54),pl();}if(n&2){let e=t.$implicit,o=Jw(3);BE(2),ug("checked",e.selected())("disabled",o.allSubAgentsSelected()),BE(2),Og(e.name),BE(),jw(e.pattern?5:e.grantedByPattern?6:e.unresolved?7:-1),BE(3),jw(e.unresolved?8:-1);}}function $t(n,t){if(n&1&&Hw(0,Bt,9,5,"div",32,qe),n&2){let e=Jw(2);Uw(e.subAgentRows());}}function Gt(n,t){if(n&1){let e=Zw();Ds(0,"div")(1,"button",56),mg("click",function(){df(e);let r=Jw(2);return ff(r.useDefaultDelegationTimeout())}),NC(2," Use server default "),pl()();}}function Ut(n,t){n&1&&(Ds(0,"ds-notice"),NC(1),pl()),n&2&&(BE(),Og(t));}function jt(n,t){if(n&1){let e=Zw();Ds(0,"button",57),mg("click",function(){df(e);let r=Jw(2);return ff(r.exportYaml())}),NC(1),pl();}if(n&2){let e=Jw(2);ug("disabled",e.isExporting()),BE(),vl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Kt(n,t){if(n&1){let e=Zw();Ds(0,"form",6),mg("ngSubmit",function(){df(e);let r=Jw();return ff(r.submit())}),Ds(1,"ds-fieldset",7)(2,"ds-form-field",8),lg(3,"input",9),_I(),pl(),Ds(4,"div",10)(5,"label",11),lg(6,"input",12),_I(),NC(7," Enabled "),pl(),Ds(8,"p",13),NC(9,"Disabled agents are excluded from namespace resolution."),pl()(),Ds(10,"ds-form-field",14),lg(11,"input",15),_I(),pl(),Ds(12,"ds-form-field",16),Lw(13,at,1,1,"input",17)(14,mt,6,5,"select",18),pl(),Ds(15,"ds-form-field",19),lg(16,"textarea",20),_I(),pl()(),Lw(17,ht,5,2,"ds-fieldset",21),Ds(18,"ds-fieldset",22)(19,"p",4),NC(20," Instruction bundles this agent can read on demand. Selecting at least one grants it the "),Ds(21,"code"),NC(22,"readSkill"),pl(),NC(23," and "),Ds(24,"code"),NC(25,"readSkillResource"),pl(),NC(26," tools; selecting none grants neither. "),Lw(27,yt,1,0),pl(),Ds(28,"label",11)(29,"input",23),mg("change",function(){df(e);let r=Jw();return ff(r.toggleAllSkills())}),pl(),Ds(30,"span",24),NC(31,"Every skill in the catalogue ("),Ds(32,"code",25),NC(33,"*"),pl(),NC(34,")"),pl()(),Ds(35,"p",13),NC(36," Resolved at run time, so skills added later are granted too, without editing this agent. "),pl(),Lw(37,vt,5,0,"ds-notice",26),Lw(38,xt,2,0,"ds-notice"),Lw(39,St,2,0,"p",4)(40,kt,2,0),pl(),Ds(41,"ds-form-field",27)(42,"select",28)(43,"option",29),NC(44,"SIMPLE \u2014 Standard agent (single LLM call)"),pl(),Ds(45,"option",29),NC(46,"ADVANCED \u2014 Multi-step reasoning loop"),pl(),Ds(47,"option",29),NC(48,"LOOP \u2014 Bulk loop agent (no LLM, experimental)"),pl()(),_I(),pl(),Lw(49,It,7,3,"ds-form-field",30),Ds(50,"ds-fieldset",31)(51,"p",4),NC(52," The agents this one may delegate to. Selecting at least one grants it the "),Ds(53,"code"),NC(54,"DELEGATE__delegate"),pl(),NC(55," tool; selecting none grants it no way to delegate. Entries are matched against agent names, never ids. "),Lw(56,Mt,1,0),pl(),Ds(57,"label",11)(58,"input",23),mg("change",function(){df(e);let r=Jw();return ff(r.toggleAllSubAgents())}),pl(),Ds(59,"span",24),NC(60,"Every agent it can reach ("),Ds(61,"code",25),NC(62,"*"),pl(),NC(63,")"),pl()(),Ds(64,"p",13),NC(65," Resolved at run time, so agents added later can be delegated to as well, without editing this agent. "),pl(),Lw(66,Ft,6,1,"ds-notice",26),Lw(67,Nt,2,0,"ds-notice"),Lw(68,Dt,2,0,"p",4)(69,$t,2,0),Ds(70,"p",4),NC(71," Advanced \u2014 add a glob instead of picking a name, for example "),Ds(72,"code"),NC(73,"*Fixer"),pl(),NC(74," to cover BugFixer and StoryFixer. "),pl(),Ds(75,"div",32)(76,"input",33),mg("keydown.enter",function(){df(e);let r=Jw();return ff(r.addSubAgent())}),pl(),_I(),Ds(77,"button",34),mg("click",function(){df(e);let r=Jw();return ff(r.addSubAgent())}),NC(78," + "),pl()(),Ds(79,"ds-form-field",35),lg(80,"input",36),_I(),Lw(81,Gt,3,0,"div"),pl()(),Lw(82,Ut,2,1,"ds-notice"),Ds(83,"ds-form-actions")(84,"button",37),NC(85),pl(),Lw(86,jt,2,2,"button",38),Ds(87,"button",39),mg("click",function(){df(e);let r=Jw();return ff(r.cancel())}),NC(88,"Cancel"),pl()()();}if(n&2){let e,o=Jw();ug("formGroup",o.form),BE(3),ug("formControl",o.nameControl),NI(),BE(3),ug("formControl",o.enabledControl),NI(),BE(5),ug("formControl",o.descriptionControl),NI(),BE(2),jw(o.modelAsFreeText()?13:14),BE(3),ug("formControl",o.instructionsControl),NI(),BE(),jw(o.integrationRows().length>0||o.builtInRows().length>0?17:-1),BE(10),jw(o.isPlatformMode?27:-1),BE(2),ug("checked",o.allSkillsSelected()),BE(8),jw(o.namedSkillSelectionDropped()?37:-1),BE(),jw(o.skillCatalogueUnavailable()?38:-1),BE(),jw(o.skillRows().length===0?39:40),BE(3),ug("formControl",o.executionModeControl),NI(),BE(),ug("value",o.ExecutionMode.SIMPLE),BE(2),ug("value",o.ExecutionMode.ADVANCED),BE(2),ug("value",o.ExecutionMode.LOOP),BE(2),jw(o.isLoopMode()?49:-1),BE(7),jw(o.isPlatformMode?56:-1),BE(2),ug("checked",o.allSubAgentsSelected()),BE(8),jw(o.namedSubAgentSelectionDropped()?66:-1),BE(),jw(o.subAgentCandidatesUnavailable()?67:-1),BE(),jw(o.subAgentRows().length===0?68:69),BE(8),ug("formControl",o.newSubAgentControl),NI(),BE(),ug("disabled",!o.newSubAgentControl.value.trim()),BE(2),ug("hint",o.delegationTimeoutHint())("error",o.delegationTimeoutControl.invalid?"Enter a valid positive whole number of seconds, or leave empty to inherit the server default.":null),BE(),ug("formControl",o.delegationTimeoutControl),cg("aria-invalid",o.delegationTimeoutControl.invalid),NI(),BE(),jw(o.delegationTimeoutControl.value!==null?81:-1),BE(),jw((e=o.submitError())?82:-1,e),BE(2),ug("disabled",o.form.invalid||o.isSubmitting()),BE(),vl(" ",o.isEditMode()?"Save changes":"Create"," "),BE(),jw(o.isEditMode()?86:-1);}}var Je=class n{route=g(W$1);router=g(F);destroyRef=g(Ie);agentConfigController=g(U);defaultsController=g(N);defaultDelegationTimeoutSeconds=Ui(null);exportService=g(K);integrationConfigState=g(O);integrationTypeController=g(_);skillState=g(o);aiModelState=g(W);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(o){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=XC(()=>{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$1(this.form.controls.executionMode.valueChanges,{initialValue:this.form.controls.executionMode.value});isLoopMode=XC(()=>this.executionModeValue()==="LOOP");subAgentRows=Ui([]);allSubAgentsSelected=Ui(false);subAgentCandidatesUnavailable=Ui(false);namedSubAgentSelectionDropped=XC(()=>this.allSubAgentsSelected()&&this.subAgentRows().some(t=>t.selected()));droppedUnresolvedSubAgents=XC(()=>this.allSubAgentsSelected()?this.subAgentRows().filter(t=>t.unresolved&&t.selected()).length:0);hasAnySubAgent=XC(()=>this.allSubAgentsSelected()||this.subAgentRows().some(t=>t.selected()));newSubAgentControl=new Te("",{nonNullable:true});isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);isExporting=Ui(false);submitError=Ui(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=Ui([]);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=XC(()=>Ke({configEnabled:this.builtInRows().some(t=>t.type===je&&t.state()==="on"),integrationTypes:this.integrationRows().filter(t=>t.enabled()).map(t=>t.config.integrationType),hasSubAgents:this.hasAnySubAgent()}));modelOptions=Ui({aliases:[],apiNames:[],current:null});modelCatalogueLoaded=Ui(false);modelAsFreeText=XC(()=>{let{aliases:t,apiNames:e}=this.modelOptions();return this.modelCatalogueLoaded()&&t.length+e.length===0});applyModelCatalogue(t,e){this.modelOptions.set(He(t,e)),this.modelCatalogueLoaded.set(true);}integrationRows=Ui([]);skillRows=Ui([]);allSkillsSelected=Ui(false);skillCatalogueUnavailable=Ui(false);namedSkillSelectionDropped=XC(()=>this.allSkillsSelected()&&this.skillRows().some(t=>t.selected()));existingConfig=null;ngOnInit(){this.defaultsController.getAgentConfigDefaults().pipe(U$1(this.destroyRef),da(()=>Tr(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),Ty({config:this.agentConfigController.getByIdAgentConfig(t),namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):Tr([]),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:o,platformIntegrations:r,builtInTypes:d,skillCatalogue:f,delegationCandidates:S,models:_})=>{this.existingConfig=e,this.applyModelCatalogue(_,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 m=e.executionMode??(e.advancedExecution?"ADVANCED":"SIMPLE");this.executionModeControl.setValue(m),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 I=[...r,...o];this.integrationRows.set(this.buildIntegrationRows(I,e.integrations??void 0)),this.builtInRows.set(this.buildBuiltInRows(d,e.integrations??void 0)),this.allSubAgentsSelected.set(Ge(e.subAgents)),this.subAgentRows.set(this.buildSubAgentRows(S,e.subAgents,e.name)),this.allSkillsSelected.set(o$1(e.skillSelectors)),this.skillRows.set(this.buildSkillRows(f,e.skillSelectors)),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadIntegrations(t){Ty({namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):Tr([]),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:o,builtInTypes:r,skillCatalogue:d,delegationCandidates:f,models:S})=>{this.applyModelCatalogue(S,null);let _=[...o,...e];this.integrationRows.set(this.buildIntegrationRows(_,t??void 0)),this.builtInRows.set(this.buildBuiltInRows(r,t??void 0)),this.allSubAgentsSelected.set(false),this.subAgentRows.set(this.buildSubAgentRows(f,void 0,null)),this.allSkillsSelected.set(false),this.skillRows.set(this.buildSkillRows(d,void 0));}});}loadSkillCatalogue(){return (this.namespaceId?this.skillState.listEffective(this.namespaceId):this.skillState.listPlatform().pipe(ne(e=>e.map(o=>({id:o.id??"",name:o.name,description:o.description,namespaceId:o.namespaceId??null,readOnly:o.readOnly===true}))))).pipe(da(e=>(console.error("[agent-config-form] failed to load the skill catalogue",e),this.skillCatalogueUnavailable.set(true),Tr([]))))}buildSkillRows(t,e){let r$1=(e??[]).map(m=>m.trim()).filter(m=>m.length>0).filter(m=>m!==r),d=i(r$1),f=new Set(t.map(m=>m.name.toLowerCase())),S=t.map(m=>({selector:m.name,name:m.name,description:m.description,platform:m.namespaceId==null,unresolved:false,selected:Ui(d.has(m.name.toLowerCase()))})),_=new Set;for(let m of r$1){let I=l(m).toLowerCase();f.has(I)||_.has(I)||(_.add(I),S.push({selector:m,name:m,description:"",platform:false,unresolved:true,selected:Ui(true)}));}return S}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()):Tr([]);return Ty({platform:t,namespace:e}).pipe(ne(({platform:o,namespace:r})=>[...o,...r]),ne(o=>o.map(r=>r.name).filter(r=>r.length>0)),ne(o=>n.dedupeByKey(o)))}orNoCandidates(){return da(t=>(console.error("[agent-config-form] failed to load the delegation candidates",t),this.subAgentCandidatesUnavailable.set(true),Tr([])))}static dedupeByKey(t){let e=new Set;return t.filter(o=>{let r=o.toLowerCase();return e.has(r)?false:(e.add(r),true)})}buildSubAgentRows(t,e,o){let r=Ue(e),d=o?.toLowerCase()??null,f=t.filter(b=>{let G=b.toLowerCase();return G!==d||r.has(G)}),S=new Set(f.map(b=>b.toLowerCase())),_=f.map(b=>({selector:b,name:b,unresolved:false,pattern:false,grantedByPattern:z(b,e),selected:Ui(r.has(b.toLowerCase()))})),m=new Set,I=(e??[]).map(b=>b.trim()).filter(b=>b.length>0&&b!==D);for(let b of I){let G=b.toLowerCase();S.has(G)||m.has(G)||(m.add(G),_.push({selector:b,name:b,unresolved:true,pattern:H(b),grantedByPattern:false,selected:Ui(true)}));}return _}loadBuiltInTypes(){return this.integrationTypeController.listTypesIntegrationType().pipe(ne(t=>t.filter(e=>!e.configSchema)),da(t=>(console.error("[agent-config-form] failed to load integration types",t),Tr([]))))}buildIntegrationRows(t,e){return t.map(o=>{let r=o.name??"",d=e?.[r],f=e!=null&&r in e,S=Array.isArray(d)?d.join(", "):"";return {config:o,enabled:Ui(f),toolsControl:new Te(S,{nonNullable:true})}})}buildBuiltInRows(t,e){return t.map(o=>{let r=e!=null&&o.type in e,d=e?.[o.type],f=r?Array.isArray(d)&&d.length===0?"off":"on":"default";return {type:o.type,displayName:o.displayName,description:o.description,enabledByDefault:o.enabledByDefault===true,state:Ui(f),restrictedTools:Array.isArray(d)&&d.length>0?d: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(o=>o.selector.toLowerCase()===t.toLowerCase());e?e.selected.set(true):t===D?this.allSubAgentsSelected.set(true):this.subAgentRows.update(o=>this.withPatternGrants([...o,{selector:t,name:t,unresolved:true,pattern:H(t),grantedByPattern:false,selected:Ui(true)}])),this.newSubAgentControl.reset("");}removeSubAgent(t){let e=t.selector.toLowerCase();this.subAgentRows.update(o=>this.withPatternGrants(o.filter(r=>r.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(o=>o.selected()).map(o=>o.selector);return t.map(o=>o.unresolved?o:x(w({},o),{grantedByPattern:z(o.name,e)}))}toggleAllSubAgents(){this.allSubAgentsSelected.update(t=>!t),this.subAgentRows.update(t=>this.withPatternGrants(t));}buildSubAgentsPayload(){if(this.allSubAgentsSelected())return [D];let t=this.subAgentRows().filter(e=>e.selected()).map(e=>e.selector);return t.length>0?t:void 0}buildIntegrationsPayload(){let t={};for(let o of this.integrationRows().filter(r=>r.enabled())){let r=o.config.name??"",d=o.toolsControl.value.trim();t[r]=d===""?null:d.split(",").map(f=>f.trim()).filter(f=>f.length>0);}for(let o of this.builtInRows()){let r=o.state();r==="on"?t[o.type]=o.restrictedTools??null:r==="off"&&(t[o.type]=[]);}let e=new Set([...this.integrationRows().map(o=>o.config.name??""),...this.builtInRows().map(o=>o.type)]);for(let[o,r]of Object.entries(this.existingConfig?.integrations??{}))e.has(o)||(t[o]=r);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:o=>{this.isSubmitting.set(false),this.submitError.set(n.serverMessage(o));}});}static serverMessage(t){let o=t?.error?.message;if(typeof o=="string"&&o.trim().length>0)return o;let r=t?.status;return r===0?"The server could not be reached. The agent was not saved.":typeof r=="number"&&r>=500?`The server failed to save the agent (HTTP ${r}). 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 o=new Blob([e],{type:"application/yaml"}),r=URL.createObjectURL(o),d=document.createElement("a");d.href=r,d.download=`${this.existingConfig?.name??"agent"}.yaml`,d.click(),URL.revokeObjectURL(r),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=yw({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,o){e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return o.cancel()}),NC(3," \u2190 Agent configs "),pl(),Lw(4,nt,2,1,"a",2),Lw(5,ot,2,0,"ds-tag",3),pl(),Lw(6,it,2,0,"p",4)(7,Kt,89,33,"form",5),pl()),e&2&&(BE(),ug("title",o.isEditMode()?"Edit agent config":"New agent config"),BE(3),jw(o.isEditMode()?4:-1),BE(),jw(o.isPlatformMode?5:-1),BE(),jw(o.isLoading()?6:7));},dependencies:[Ut$1,nd,bo,xo,Lt$1,kn,vn,Gt$1,mo,po,$r,qr,Vn,An,$t$1,pn,hn,cn,ln,dn,mn,at$1,an,rn,ko],encapsulation:2})};export{Je as AgentConfigFormComponent};
@@ -1 +1 @@
1
- import {O as O$1,g as at,h as hn,I as Io,j as ko,P}from'./chunk-D2BTEyR1.js';import {g,I as Ie,Y as W,$ as Cr,U as Ui,X as XC,a0 as $e,a1 as fa,a2 as da,a3 as nn,G as U$1,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,H as Hw,J as Jw,m as Uw,v as vl,O as Og}from'./main-FJXP2G5I.js';function q(e){if(e.sensitive)return e.configured?{status:"hidden",text:"set (hidden)"}:{status:"unset",text:"not set"};if(!e.configured)return {status:"unset",text:"unset"};let t=e.value??"",i=t.trim().toLowerCase();return i==="true"?{status:"on",text:"on"}:i==="false"?{status:"off",text:"off"}:{status:"value",text:t===""?"(empty)":t}}var U=(e,t)=>t.key;function B(e,t){e&1&&(Ds(0,"p",10),NC(1,"Loading the configuration failed. Try refreshing."),pl());}function V(e,t){e&1&&(Ds(0,"p",11),NC(1,"Loading configuration\u2026"),pl());}function j(e,t){e&1&&(Ds(0,"p",12),NC(1,"The service reported no settings."),pl());}function O(e,t){e&1&&(Ds(0,"p",11),NC(1,"No settings match the current filters."),pl());}function Y(e,t){e&1&&(Ds(0,"ds-tag",22),NC(1,"on"),pl());}function z(e,t){e&1&&(Ds(0,"ds-tag",20),NC(1,"off"),pl());}function H(e,t){if(e&1&&(Ds(0,"ds-tag",20),NC(1),pl()),e&2){let i=Jw().$implicit;BE(),Og(i.display.text);}}function G(e,t){if(e&1&&(Ds(0,"ds-tag",23),NC(1),pl()),e&2){let i=Jw().$implicit;BE(),Og(i.display.text);}}function J(e,t){if(e&1&&(Ds(0,"span",24),NC(1),pl()),e&2){let i=Jw().$implicit;BE(),Og(i.display.text);}}function K(e,t){if(e&1&&(Ds(0,"tr",16)(1,"td",18),NC(2),pl(),Ds(3,"td",19)(4,"ds-tag",20),NC(5),pl()(),Ds(6,"td",21),Lw(7,Y,2,0,"ds-tag",22)(8,z,2,0,"ds-tag",20)(9,H,2,1,"ds-tag",20)(10,G,2,1,"ds-tag",23)(11,J,2,1,"span",24),pl(),Ds(12,"td",25),NC(13),pl()()),e&2){let i,a=t.$implicit,m=Jw(2);BE(2),vl(" ",a.entry.key," "),BE(3),vl(" ",a.entry.source===m.Source.ENVIRONMENT?"Environment":"Property"," "),BE(2),jw((i=a.display.status)==="on"?7:i==="off"?8:i==="hidden"?9:i==="unset"?10:11),BE(6),vl(" ",a.entry.description||"\u2014"," ");}}function Q(e,t){if(e&1&&(Ds(0,"div",13)(1,"table",14)(2,"thead",15)(3,"tr",16)(4,"th",17),NC(5,"Setting"),pl(),Ds(6,"th",17),NC(7,"Source"),pl(),Ds(8,"th",17),NC(9,"Value"),pl(),Ds(10,"th",17),NC(11,"Description"),pl()()(),Ds(12,"tbody",15),Hw(13,K,14,4,"tr",16,U),pl()()()),e&2){let i=Jw();BE(13),Uw(i.visibleRows());}}var A=class e{destroyRef=g(Ie);configurationController=g(W);refresh$=new Cr(void 0);isLoading=Ui(true);loadError=Ui(false);rows=Ui([]);source=Ui("ALL");status=Ui("ALL");rowFilter=O$1(this.rows,t=>[t.entry.key,t.entry.description,t.entry.value].filter(Boolean).join(" "));visibleRows=XC(()=>this.rowFilter.filteredRows().filter(t=>{let i=this.source(),a=this.status();return i!=="ALL"&&t.entry.source!==i?false:a==="SET"?t.entry.configured:a==="UNSET"?!t.entry.configured:true}));Source=$e;constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.loadError.set(false),this.configurationController.listEffectiveConfiguration().pipe(da(()=>(this.loadError.set(true),this.isLoading.set(false),nn))))),U$1(this.destroyRef)).subscribe(t=>{this.rows.set(t.map(i=>({key:`${i.source}:${i.key}`,entry:i,display:q(i)}))),this.isLoading.set(false);});}reload(){this.refresh$.next();}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=yw({type:e,selectors:[["agentos-platform-configuration"]],decls:24,vars:6,consts:[["title","Configuration","description","Effective environment variables and Spring properties of the running service. Secrets are never shown, only whether they are set."],["label","Filter settings","placeholder","Filter settings\u2026",3,"queryChange","query"],["dsButton","","type","button",3,"click"],[1,"settings-table__toolbar"],["aria-label","Filter by source",1,"ds-control",2,"width","auto",3,"change","value"],["value","ALL"],[3,"value"],["aria-label","Filter by state",1,"ds-control",2,"width","auto",3,"change","value"],["value","SET"],["value","UNSET"],["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","Effective configuration"],["role","rowgroup"],["role","row"],["role","columnheader"],["role","cell","data-label","Setting","data-title","",1,"settings-table__name","ds-mono"],["role","cell","data-label","Source"],["variant","neutral"],["role","cell","data-label","Value"],["variant","accent"],["variant","outline"],[1,"ds-mono"],["role","cell","data-label","Description",1,"settings-table__secondary"]],template:function(i,a){i&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(c){return a.rowFilter.query.set(c)}),pl(),Ds(2,"button",2),mg("click",function(){return a.reload()}),NC(3,"Refresh"),pl()(),Ds(4,"div",3)(5,"select",4),mg("change",function(c){return a.source.set(c.target.value)}),Ds(6,"option",5),NC(7,"All sources"),pl(),Ds(8,"option",6),NC(9,"Environment variables"),pl(),Ds(10,"option",6),NC(11,"Spring properties"),pl()(),Ds(12,"select",7),mg("change",function(c){return a.status.set(c.target.value)}),Ds(13,"option",5),NC(14,"Set and unset"),pl(),Ds(15,"option",8),NC(16,"Set only"),pl(),Ds(17,"option",9),NC(18,"Unset only"),pl()()(),Lw(19,B,2,0,"p",10)(20,V,2,0,"p",11)(21,j,2,0,"p",12)(22,O,2,0,"p",11)(23,Q,15,0,"div",13)),i&2&&(BE(),ug("query",a.rowFilter.query()),BE(4),ug("value",a.source()),BE(3),ug("value",a.Source.ENVIRONMENT),BE(2),ug("value",a.Source.PROPERTY),BE(2),ug("value",a.status()),BE(7),jw(a.loadError()?19:a.isLoading()?20:a.rows().length===0?21:a.visibleRows().length===0?22:23));},dependencies:[at,hn,Io,ko,P],encapsulation:2})};export{A as PlatformConfigurationComponent};
1
+ import {O as O$1,g as at,h as hn,I as Io,j as ko,P}from'./chunk-DvqKcX7A.js';import {g,I as Ie,Y as W,$ as Cr,U as Ui,X as XC,a0 as $e,a1 as fa,a2 as da,a3 as nn,G as U$1,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,H as Hw,J as Jw,m as Uw,v as vl,O as Og}from'./main-BGDYOJBA.js';function q(e){if(e.sensitive)return e.configured?{status:"hidden",text:"set (hidden)"}:{status:"unset",text:"not set"};if(!e.configured)return {status:"unset",text:"unset"};let t=e.value??"",i=t.trim().toLowerCase();return i==="true"?{status:"on",text:"on"}:i==="false"?{status:"off",text:"off"}:{status:"value",text:t===""?"(empty)":t}}var U=(e,t)=>t.key;function B(e,t){e&1&&(Ds(0,"p",10),NC(1,"Loading the configuration failed. Try refreshing."),pl());}function V(e,t){e&1&&(Ds(0,"p",11),NC(1,"Loading configuration\u2026"),pl());}function j(e,t){e&1&&(Ds(0,"p",12),NC(1,"The service reported no settings."),pl());}function O(e,t){e&1&&(Ds(0,"p",11),NC(1,"No settings match the current filters."),pl());}function Y(e,t){e&1&&(Ds(0,"ds-tag",22),NC(1,"on"),pl());}function z(e,t){e&1&&(Ds(0,"ds-tag",20),NC(1,"off"),pl());}function H(e,t){if(e&1&&(Ds(0,"ds-tag",20),NC(1),pl()),e&2){let i=Jw().$implicit;BE(),Og(i.display.text);}}function G(e,t){if(e&1&&(Ds(0,"ds-tag",23),NC(1),pl()),e&2){let i=Jw().$implicit;BE(),Og(i.display.text);}}function J(e,t){if(e&1&&(Ds(0,"span",24),NC(1),pl()),e&2){let i=Jw().$implicit;BE(),Og(i.display.text);}}function K(e,t){if(e&1&&(Ds(0,"tr",16)(1,"td",18),NC(2),pl(),Ds(3,"td",19)(4,"ds-tag",20),NC(5),pl()(),Ds(6,"td",21),Lw(7,Y,2,0,"ds-tag",22)(8,z,2,0,"ds-tag",20)(9,H,2,1,"ds-tag",20)(10,G,2,1,"ds-tag",23)(11,J,2,1,"span",24),pl(),Ds(12,"td",25),NC(13),pl()()),e&2){let i,a=t.$implicit,m=Jw(2);BE(2),vl(" ",a.entry.key," "),BE(3),vl(" ",a.entry.source===m.Source.ENVIRONMENT?"Environment":"Property"," "),BE(2),jw((i=a.display.status)==="on"?7:i==="off"?8:i==="hidden"?9:i==="unset"?10:11),BE(6),vl(" ",a.entry.description||"\u2014"," ");}}function Q(e,t){if(e&1&&(Ds(0,"div",13)(1,"table",14)(2,"thead",15)(3,"tr",16)(4,"th",17),NC(5,"Setting"),pl(),Ds(6,"th",17),NC(7,"Source"),pl(),Ds(8,"th",17),NC(9,"Value"),pl(),Ds(10,"th",17),NC(11,"Description"),pl()()(),Ds(12,"tbody",15),Hw(13,K,14,4,"tr",16,U),pl()()()),e&2){let i=Jw();BE(13),Uw(i.visibleRows());}}var A=class e{destroyRef=g(Ie);configurationController=g(W);refresh$=new Cr(void 0);isLoading=Ui(true);loadError=Ui(false);rows=Ui([]);source=Ui("ALL");status=Ui("ALL");rowFilter=O$1(this.rows,t=>[t.entry.key,t.entry.description,t.entry.value].filter(Boolean).join(" "));visibleRows=XC(()=>this.rowFilter.filteredRows().filter(t=>{let i=this.source(),a=this.status();return i!=="ALL"&&t.entry.source!==i?false:a==="SET"?t.entry.configured:a==="UNSET"?!t.entry.configured:true}));Source=$e;constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.loadError.set(false),this.configurationController.listEffectiveConfiguration().pipe(da(()=>(this.loadError.set(true),this.isLoading.set(false),nn))))),U$1(this.destroyRef)).subscribe(t=>{this.rows.set(t.map(i=>({key:`${i.source}:${i.key}`,entry:i,display:q(i)}))),this.isLoading.set(false);});}reload(){this.refresh$.next();}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=yw({type:e,selectors:[["agentos-platform-configuration"]],decls:24,vars:6,consts:[["title","Configuration","description","Effective environment variables and Spring properties of the running service. Secrets are never shown, only whether they are set."],["label","Filter settings","placeholder","Filter settings\u2026",3,"queryChange","query"],["dsButton","","type","button",3,"click"],[1,"settings-table__toolbar"],["aria-label","Filter by source",1,"ds-control",2,"width","auto",3,"change","value"],["value","ALL"],[3,"value"],["aria-label","Filter by state",1,"ds-control",2,"width","auto",3,"change","value"],["value","SET"],["value","UNSET"],["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","Effective configuration"],["role","rowgroup"],["role","row"],["role","columnheader"],["role","cell","data-label","Setting","data-title","",1,"settings-table__name","ds-mono"],["role","cell","data-label","Source"],["variant","neutral"],["role","cell","data-label","Value"],["variant","accent"],["variant","outline"],[1,"ds-mono"],["role","cell","data-label","Description",1,"settings-table__secondary"]],template:function(i,a){i&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(c){return a.rowFilter.query.set(c)}),pl(),Ds(2,"button",2),mg("click",function(){return a.reload()}),NC(3,"Refresh"),pl()(),Ds(4,"div",3)(5,"select",4),mg("change",function(c){return a.source.set(c.target.value)}),Ds(6,"option",5),NC(7,"All sources"),pl(),Ds(8,"option",6),NC(9,"Environment variables"),pl(),Ds(10,"option",6),NC(11,"Spring properties"),pl()(),Ds(12,"select",7),mg("change",function(c){return a.status.set(c.target.value)}),Ds(13,"option",5),NC(14,"Set and unset"),pl(),Ds(15,"option",8),NC(16,"Set only"),pl(),Ds(17,"option",9),NC(18,"Unset only"),pl()()(),Lw(19,B,2,0,"p",10)(20,V,2,0,"p",11)(21,j,2,0,"p",12)(22,O,2,0,"p",11)(23,Q,15,0,"div",13)),i&2&&(BE(),ug("query",a.rowFilter.query()),BE(4),ug("value",a.source()),BE(3),ug("value",a.Source.ENVIRONMENT),BE(2),ug("value",a.Source.PROPERTY),BE(2),ug("value",a.status()),BE(7),jw(a.loadError()?19:a.isLoading()?20:a.rows().length===0?21:a.visibleRows().length===0?22:23));},dependencies:[at,hn,Io,ko,P],encapsulation:2})};export{A as PlatformConfigurationComponent};
@@ -1 +1 @@
1
- import {o}from'./chunk-CP4by4ZM.js';import {z as k,O as O$1,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-D2BTEyR1.js';import {g,F,I as Ie,$ as Cr,U as Ui,a1 as fa,G as U$1,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,H as Hw,m as Uw,v as vl,Z as Zw,r as df,s as ff,k as cg}from'./main-FJXP2G5I.js';var K=(i,e)=>e.id??e.name;function O(i,e){if(i&1&&(Ds(0,"p",3),NC(1),pl()),i&2){let t=Jw();BE(),Og(t.deletion.error());}}function A(i,e){i&1&&(Ds(0,"p",4),NC(1,"Loading skills\u2026"),pl());}function H(i,e){i&1&&(Ds(0,"p",5),NC(1,"No platform skills defined yet."),pl());}function U(i,e){i&1&&(Ds(0,"p",4),NC(1,"No skills match the current filter."),pl());}function z(i,e){i&1&&(Ds(0,"ds-tag",15),NC(1,"SKILL.md"),pl());}function G(i,e){if(i&1){let t=Zw();Ds(0,"button",21),mg("click",function(){df(t);let d=Jw(2).$implicit,m=Jw(2);return ff(m.edit(d))}),NC(1,"Edit"),pl();}if(i&2){let t=Jw(2).$implicit;cg("aria-label","Edit "+t.name);}}function J(i,e){if(i&1){let t=Zw();Ds(0,"button",21),mg("click",function(){df(t);let d=Jw().$implicit,m=Jw(2);return ff(m.inspect(d))}),NC(1,"View"),pl(),Lw(2,G,2,1,"button",22);}if(i&2){let t=Jw().$implicit;cg("aria-label","View "+t.name),BE(2),jw(t.readOnly?-1:2);}}function Q(i,e){if(i&1){let t=Zw();Ds(0,"agentos-row-delete-action",23),mg("deleteRequested",function(){df(t);let d=Jw().$implicit,m=Jw(2);return ff(m.deletion.request(d.id))})("deleteConfirmed",function(){df(t);let d=Jw().$implicit,m=Jw(2);return ff(m.confirmDelete(d))})("deleteCancelled",function(){df(t);let d=Jw(3);return ff(d.deletion.cancel())}),pl();}if(i&2){let t=Jw().$implicit,l=Jw(2);ug("rowKey",t.id)("rowLabel",t.name)("state",l.deletion);}}function W(i,e){if(i&1&&(Ds(0,"tr",9)(1,"td",12)(2,"div",13)(3,"span",14),NC(4),pl(),Lw(5,z,2,0,"ds-tag",15),pl()(),Ds(6,"td",16),NC(7),pl(),Ds(8,"td",17),NC(9),pl(),Ds(10,"td",18)(11,"div",19),Lw(12,J,3,2),Lw(13,Q,1,3,"agentos-row-delete-action",20),pl()()()),i&2){let t=e.$implicit,l=Jw(2);BE(4),Og(t.name),BE(),jw(t.readOnly?5:-1),BE(2),vl(" ",t.description||"\u2014"," "),BE(2),Og(l.resourceCount(t)),BE(3),jw(l.deletion.confirmingId()!==t.id?12:-1),BE(),jw(!t.readOnly&&t.id?13:-1);}}function X(i,e){if(i&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"Description"),pl(),Ds(8,"th",10),NC(9,"Resources"),pl(),Ds(10,"th",10)(11,"span",11),NC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Hw(14,W,14,6,"tr",9,K),pl()()()),i&2){let t=Jw();BE(14),Uw(t.rowFilter.filteredRows());}}var B=class i{router=g(F);destroyRef=g(Ie);skillState=g(o);refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k();skills=Ui([]);rowFilter=O$1(this.skills,e=>[e.name,e.description].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.skillState.listPlatform())),U$1(this.destroyRef)).subscribe({next:e=>{this.skills.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}resourceCount(e){return Object.keys(e.resources??{}).length}openCreateForm(){this.router.navigate(["/agentos","admin","skills","new"]);}inspect(e){e.id&&this.router.navigate(["/agentos","admin","skills",e.id,"inspect"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","skills",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.skillState.delete(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:t=>t.status===403?`Deleting "${e.name}" requires platform administrator rights.`:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-platform-skills"]],decls:9,vars:3,consts:[["title","Platform skills","description","Skills shared across every namespace."],["label","Filter skills","placeholder","Filter skills\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform skills"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__tags"],[1,"settings-table__name"],["variant","neutral"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Resources"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,l){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return l.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return l.openCreateForm()}),NC(3,"New skill"),pl()(),Lw(4,O,2,1,"p",3),Lw(5,A,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,X,16,0,"div",6)),t&2&&(BE(),ug("query",l.rowFilter.query()),BE(3),jw(l.deletion.error()?4:-1),BE(),jw(l.isLoading()?5:l.skills().length===0?6:l.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{B as PlatformSkillsComponent};
1
+ import {o}from'./chunk-B0IpC4Tx.js';import {z as k,O as O$1,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-DvqKcX7A.js';import {g,F,I as Ie,$ as Cr,U as Ui,a1 as fa,G as U$1,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,H as Hw,m as Uw,v as vl,Z as Zw,r as df,s as ff,k as cg}from'./main-BGDYOJBA.js';var K=(i,e)=>e.id??e.name;function O(i,e){if(i&1&&(Ds(0,"p",3),NC(1),pl()),i&2){let t=Jw();BE(),Og(t.deletion.error());}}function A(i,e){i&1&&(Ds(0,"p",4),NC(1,"Loading skills\u2026"),pl());}function H(i,e){i&1&&(Ds(0,"p",5),NC(1,"No platform skills defined yet."),pl());}function U(i,e){i&1&&(Ds(0,"p",4),NC(1,"No skills match the current filter."),pl());}function z(i,e){i&1&&(Ds(0,"ds-tag",15),NC(1,"SKILL.md"),pl());}function G(i,e){if(i&1){let t=Zw();Ds(0,"button",21),mg("click",function(){df(t);let d=Jw(2).$implicit,m=Jw(2);return ff(m.edit(d))}),NC(1,"Edit"),pl();}if(i&2){let t=Jw(2).$implicit;cg("aria-label","Edit "+t.name);}}function J(i,e){if(i&1){let t=Zw();Ds(0,"button",21),mg("click",function(){df(t);let d=Jw().$implicit,m=Jw(2);return ff(m.inspect(d))}),NC(1,"View"),pl(),Lw(2,G,2,1,"button",22);}if(i&2){let t=Jw().$implicit;cg("aria-label","View "+t.name),BE(2),jw(t.readOnly?-1:2);}}function Q(i,e){if(i&1){let t=Zw();Ds(0,"agentos-row-delete-action",23),mg("deleteRequested",function(){df(t);let d=Jw().$implicit,m=Jw(2);return ff(m.deletion.request(d.id))})("deleteConfirmed",function(){df(t);let d=Jw().$implicit,m=Jw(2);return ff(m.confirmDelete(d))})("deleteCancelled",function(){df(t);let d=Jw(3);return ff(d.deletion.cancel())}),pl();}if(i&2){let t=Jw().$implicit,l=Jw(2);ug("rowKey",t.id)("rowLabel",t.name)("state",l.deletion);}}function W(i,e){if(i&1&&(Ds(0,"tr",9)(1,"td",12)(2,"div",13)(3,"span",14),NC(4),pl(),Lw(5,z,2,0,"ds-tag",15),pl()(),Ds(6,"td",16),NC(7),pl(),Ds(8,"td",17),NC(9),pl(),Ds(10,"td",18)(11,"div",19),Lw(12,J,3,2),Lw(13,Q,1,3,"agentos-row-delete-action",20),pl()()()),i&2){let t=e.$implicit,l=Jw(2);BE(4),Og(t.name),BE(),jw(t.readOnly?5:-1),BE(2),vl(" ",t.description||"\u2014"," "),BE(2),Og(l.resourceCount(t)),BE(3),jw(l.deletion.confirmingId()!==t.id?12:-1),BE(),jw(!t.readOnly&&t.id?13:-1);}}function X(i,e){if(i&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"Description"),pl(),Ds(8,"th",10),NC(9,"Resources"),pl(),Ds(10,"th",10)(11,"span",11),NC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Hw(14,W,14,6,"tr",9,K),pl()()()),i&2){let t=Jw();BE(14),Uw(t.rowFilter.filteredRows());}}var B=class i{router=g(F);destroyRef=g(Ie);skillState=g(o);refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k();skills=Ui([]);rowFilter=O$1(this.skills,e=>[e.name,e.description].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.skillState.listPlatform())),U$1(this.destroyRef)).subscribe({next:e=>{this.skills.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}resourceCount(e){return Object.keys(e.resources??{}).length}openCreateForm(){this.router.navigate(["/agentos","admin","skills","new"]);}inspect(e){e.id&&this.router.navigate(["/agentos","admin","skills",e.id,"inspect"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","skills",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.skillState.delete(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:t=>t.status===403?`Deleting "${e.name}" requires platform administrator rights.`:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-platform-skills"]],decls:9,vars:3,consts:[["title","Platform skills","description","Skills shared across every namespace."],["label","Filter skills","placeholder","Filter skills\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform skills"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__tags"],[1,"settings-table__name"],["variant","neutral"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Resources"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,l){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return l.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return l.openCreateForm()}),NC(3,"New skill"),pl()(),Lw(4,O,2,1,"p",3),Lw(5,A,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,X,16,0,"div",6)),t&2&&(BE(),ug("query",l.rowFilter.query()),BE(3),jw(l.deletion.error()?4:-1),BE(),jw(l.isLoading()?5:l.skills().length===0?6:l.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{B as PlatformSkillsComponent};
@@ -1 +1 @@
1
- import {y,p as pt,T as Te,a as fn,U as Ut,n as nd,l as bo,x as xo,L as Lt,G as Gt,m as mo,b as po,A as An,v as va,c as pn,h as hn,d as cn,e as dn,o as on,g as at,i as an,q as sn,j as ko}from'./chunk-D2BTEyR1.js';import {g,I as Ie,W,E as J,U as Ui,G as U,y as yw,D as Ds,l as lg,Q as mg,L as Lw,p as pl,_ as _I,N as NC,a as BE,P as ug,j as jw,R as NI,v as vl,a4 as je,a5 as yd,a6 as x,J as Jw,Z as Zw,O as Og,a7 as kn,r as df,s as ff,H as Hw,m as Uw}from'./main-FJXP2G5I.js';var I=class e{api=g(je);isLoading=Ui(false);result=Ui(null);errorMessage=Ui(null);invoke(t,n,o,l){return this.isLoading.set(true),this.result.set(null),this.errorMessage.set(null),this.api.invoke({namespaceId:t,userId:n||void 0,toolName:o,payload:l||void 0}).pipe(yd({next:v=>{this.result.set(v),this.isLoading.set(false);},error:v=>{this.errorMessage.set(le(v)),this.isLoading.set(false);}}))}reset(){this.result.set(null),this.errorMessage.set(null);}static \u0275fac=function(n){return new(n||e)};static \u0275prov=x({token:e,factory:e.\u0275fac,providedIn:"root"})};function le(e){if(e instanceof kn){let t=e.error;return t&&typeof t=="object"&&"message"in t&&typeof t.message=="string"?t.message:typeof t=="string"&&t.trim().length>0?t:e.statusText||`HTTP ${e.status}`}return e instanceof Error?e.message:"Unknown error"}var de=(e,t)=>t.id;function me(e,t){e&1&&(Ds(0,"p",14),NC(1,"Loading namespaces\u2026"),pl());}function pe(e,t){if(e&1&&(Ds(0,"option",17),NC(1),pl()),e&2){let n=t.$implicit;ug("value",n.id),BE(),Og(n.name);}}function ce(e,t){if(e&1&&(Ds(0,"select",15)(1,"option",16),NC(2,"Select a namespace"),pl(),Hw(3,pe,2,2,"option",17,de),pl(),_I()),e&2){let n=Jw(2);NI(),BE(3),Uw(n.namespaces());}}function ue(e,t){if(e&1&&Lw(0,me,2,0,"p",14)(1,ce,5,0,"select",15),e&2){let n=Jw();jw(n.namespacesLoading()?0:1);}}function fe(e,t){if(e&1&&lg(0,"input",3),e&2){let n=Jw();ug("value",n.namespaceName()??n.namespaceId);}}function ge(e,t){if(e&1){let n=Zw();Ds(0,"button",18),mg("click",function(){df(n);let l=Jw();return ff(l.reset())}),NC(1,"Clear result"),pl();}}function ve(e,t){e&1&&(Ds(0,"ds-card",12)(1,"pre",19),NC(2),pl()()),e&2&&(BE(2),Og(t));}function ye(e,t){e&1&&(Ds(0,"span",21),NC(1,"Metadata"),pl(),Ds(2,"pre",19),NC(3),pl()),e&2&&(BE(3),Og(t));}function Ce(e,t){if(e&1&&(Ds(0,"dt"),NC(1,"Type"),pl(),Ds(2,"dd",23),NC(3),pl()),e&2){let n=Jw(2);BE(3),Og(n.errorType);}}function _e(e,t){if(e&1&&(Ds(0,"dt"),NC(1,"Message"),pl(),Ds(2,"dd"),NC(3),pl()),e&2){let n=Jw(2);BE(3),Og(n.errorMessage);}}function be(e,t){if(e&1&&(Ds(0,"span",21),NC(1,"Tool error details"),pl(),Ds(2,"dl",22),Lw(3,Ce,4,1),Lw(4,_e,4,1),pl()),e&2){let n=Jw();BE(3),jw(n.errorType?3:-1),BE(),jw(n.errorMessage?4:-1);}}function he(e,t){if(e&1&&(Ds(0,"ds-card",13)(1,"div")(2,"ds-tag",20),NC(3),pl()(),Ds(4,"span",21),NC(5,"Output"),pl(),Ds(6,"pre",19),NC(7),pl(),Lw(8,ye,4,1),Ds(9,"span",21),NC(10,"Structured output"),pl(),Ds(11,"pre",19),NC(12),pl(),Lw(13,be,5,2),pl()),e&2){let n,o=t,l=Jw();ug("heading","Result \u2014 "+o.toolName),BE(2),ug("variant",o.success?"accent":"outline"),BE(),Og(o.success?"Success":"Tool error"),BE(4),Og(o.output),BE(),jw((n=l.formatMetadata(o.metadata))?8:-1,n),BE(4),Og(l.formatStructuredOutput(o.structuredOutput)??"null"),BE(),jw(o.errorType||o.errorMessage?13:-1);}}var re=class e{destroyRef=g(Ie);route=g(W);namespaceController=g(J);userState=g(y);state=g(I);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;namespaces=Ui([]);namespacesLoading=Ui(true);namespaceName=Ui(null);form=new pt({namespaceId:new Te("",{nonNullable:true,validators:[fn.required]}),userId:new Te("",{nonNullable:true}),toolName:new Te("",{nonNullable:true,validators:[fn.required]}),payload:new Te("",{nonNullable:true})});ngOnInit(){let t=this.userState.currentUser()?.id;t?this.form.controls.userId.patchValue(t):this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:n=>{n.id&&this.form.controls.userId.patchValue(n.id);}}),this.isPlatformMode?this.namespaceController.listAllNamespace().pipe(U(this.destroyRef)).subscribe({next:n=>{this.namespaces.set(n.map(o=>({id:o.id,name:o.name}))),this.namespacesLoading.set(false);},error:()=>this.namespacesLoading.set(false)}):(this.form.controls.namespaceId.patchValue(this.namespaceId),this.namespacesLoading.set(false),this.namespaceController.getByIdNamespace(this.namespaceId).pipe(U(this.destroyRef)).subscribe({next:n=>this.namespaceName.set(n.name),error:()=>this.namespaceName.set(this.namespaceId)}));}submit(){if(this.form.invalid||this.state.isLoading())return;let{namespaceId:t,userId:n,toolName:o,payload:l}=this.form.getRawValue();this.state.invoke(t,n.trim()||void 0,o.trim(),l.trim()||void 0).pipe(U(this.destroyRef)).subscribe();}reset(){this.state.reset();}formatMetadata(t){return !t||Object.keys(t).length===0?null:JSON.stringify(t,null,2)}formatStructuredOutput(t){return t===void 0?null:JSON.stringify(t,null,2)}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=yw({type:e,selectors:[["agentos-tool-invoke"]],decls:18,vars:8,consts:[["title","Tool invoke",3,"description"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Namespace","controlId","ti-namespace","required",""],["dsControl","","id","ti-namespace","type","text","readonly","",3,"value"],["label","User ID","labelHint","optional","controlId","ti-user"],["dsControl","","id","ti-user","type","text","formControlName","userId","placeholder","UUID of the user \u2014 adds user-scoped overlay layers","autocomplete","off"],["label","Tool name","controlId","ti-tool","required","","hint","Exact tool name as returned by the agent definition inspect page. When not found, the error response lists all available tools for the selected namespace."],["dsControl","","mono","","id","ti-tool","type","text","formControlName","toolName","placeholder","e.g. MY_FILES__listFiles","autocomplete","off","spellcheck","false"],["label","Payload","labelHint","optional","controlId","ti-payload"],["dsControl","","mono","","id","ti-payload","formControlName","payload","rows","6","placeholder",'JSON arguments for the tool, e.g. {"path": "/some/dir"} \u2014 leave empty for tools with no input.',"spellcheck","false"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button"],["heading","Error"],[3,"heading"],[1,"ds-hint"],["dsControl","","id","ti-namespace","formControlName","namespaceId"],["value","","disabled",""],[3,"value"],["dsButton","","type","button",3,"click"],[1,"ds-pre"],[3,"variant"],[1,"ds-micro"],["dsDefinitionList",""],[1,"ds-mono"]],template:function(n,o){if(n&1&&(Ds(0,"ds-page"),lg(1,"ds-section-header",0),Ds(2,"form",1),mg("ngSubmit",function(){return o.submit()}),Ds(3,"ds-form-field",2),Lw(4,ue,2,1)(5,fe,1,1,"input",3),pl(),Ds(6,"ds-form-field",4),lg(7,"input",5),_I(),pl(),Ds(8,"ds-form-field",6),lg(9,"input",7),_I(),pl(),Ds(10,"ds-form-field",8),lg(11,"textarea",9),_I(),pl(),Ds(12,"ds-form-actions")(13,"button",10),NC(14),pl(),Lw(15,ge,2,0,"button",11),pl()(),Lw(16,ve,3,1,"ds-card",12),Lw(17,he,14,7,"ds-card",13),pl()),n&2){let l,v;BE(),ug("description",o.isPlatformMode?"Execute any registered tool directly \u2014 bypasses the normal agent-run pipeline. Restricted to super-admins.":"Execute a registered tool directly in this namespace \u2014 bypasses the normal agent-run pipeline."),BE(),ug("formGroup",o.form),BE(2),jw(o.isPlatformMode?4:5),BE(3),NI(),BE(2),NI(),BE(2),NI(),BE(2),ug("disabled",o.form.invalid||o.state.isLoading()),BE(),vl(" ",o.state.isLoading()?"Running\u2026":"Run tool"," "),BE(),jw(o.state.result()||o.state.errorMessage()?15:-1),BE(),jw((l=o.state.errorMessage())?16:-1,l),BE(),jw((v=o.state.result())?17:-1,v);}},dependencies:[Ut,nd,bo,xo,Lt,Gt,mo,po,An,va,pn,hn,cn,dn,on,at,an,sn,ko],encapsulation:2})};export{re as ToolInvokeComponent};
1
+ import {y,p as pt,T as Te,a as fn,U as Ut,n as nd,l as bo,x as xo,L as Lt,G as Gt,m as mo,b as po,A as An,v as va,c as pn,h as hn,d as cn,e as dn,o as on,g as at,i as an,q as sn,j as ko}from'./chunk-DvqKcX7A.js';import {g,I as Ie,W,E as J,U as Ui,G as U,y as yw,D as Ds,l as lg,Q as mg,L as Lw,p as pl,_ as _I,N as NC,a as BE,P as ug,j as jw,R as NI,v as vl,a4 as je,a5 as yd,a6 as x,J as Jw,Z as Zw,O as Og,a7 as kn,r as df,s as ff,H as Hw,m as Uw}from'./main-BGDYOJBA.js';var I=class e{api=g(je);isLoading=Ui(false);result=Ui(null);errorMessage=Ui(null);invoke(t,n,o,l){return this.isLoading.set(true),this.result.set(null),this.errorMessage.set(null),this.api.invoke({namespaceId:t,userId:n||void 0,toolName:o,payload:l||void 0}).pipe(yd({next:v=>{this.result.set(v),this.isLoading.set(false);},error:v=>{this.errorMessage.set(le(v)),this.isLoading.set(false);}}))}reset(){this.result.set(null),this.errorMessage.set(null);}static \u0275fac=function(n){return new(n||e)};static \u0275prov=x({token:e,factory:e.\u0275fac,providedIn:"root"})};function le(e){if(e instanceof kn){let t=e.error;return t&&typeof t=="object"&&"message"in t&&typeof t.message=="string"?t.message:typeof t=="string"&&t.trim().length>0?t:e.statusText||`HTTP ${e.status}`}return e instanceof Error?e.message:"Unknown error"}var de=(e,t)=>t.id;function me(e,t){e&1&&(Ds(0,"p",14),NC(1,"Loading namespaces\u2026"),pl());}function pe(e,t){if(e&1&&(Ds(0,"option",17),NC(1),pl()),e&2){let n=t.$implicit;ug("value",n.id),BE(),Og(n.name);}}function ce(e,t){if(e&1&&(Ds(0,"select",15)(1,"option",16),NC(2,"Select a namespace"),pl(),Hw(3,pe,2,2,"option",17,de),pl(),_I()),e&2){let n=Jw(2);NI(),BE(3),Uw(n.namespaces());}}function ue(e,t){if(e&1&&Lw(0,me,2,0,"p",14)(1,ce,5,0,"select",15),e&2){let n=Jw();jw(n.namespacesLoading()?0:1);}}function fe(e,t){if(e&1&&lg(0,"input",3),e&2){let n=Jw();ug("value",n.namespaceName()??n.namespaceId);}}function ge(e,t){if(e&1){let n=Zw();Ds(0,"button",18),mg("click",function(){df(n);let l=Jw();return ff(l.reset())}),NC(1,"Clear result"),pl();}}function ve(e,t){e&1&&(Ds(0,"ds-card",12)(1,"pre",19),NC(2),pl()()),e&2&&(BE(2),Og(t));}function ye(e,t){e&1&&(Ds(0,"span",21),NC(1,"Metadata"),pl(),Ds(2,"pre",19),NC(3),pl()),e&2&&(BE(3),Og(t));}function Ce(e,t){if(e&1&&(Ds(0,"dt"),NC(1,"Type"),pl(),Ds(2,"dd",23),NC(3),pl()),e&2){let n=Jw(2);BE(3),Og(n.errorType);}}function _e(e,t){if(e&1&&(Ds(0,"dt"),NC(1,"Message"),pl(),Ds(2,"dd"),NC(3),pl()),e&2){let n=Jw(2);BE(3),Og(n.errorMessage);}}function be(e,t){if(e&1&&(Ds(0,"span",21),NC(1,"Tool error details"),pl(),Ds(2,"dl",22),Lw(3,Ce,4,1),Lw(4,_e,4,1),pl()),e&2){let n=Jw();BE(3),jw(n.errorType?3:-1),BE(),jw(n.errorMessage?4:-1);}}function he(e,t){if(e&1&&(Ds(0,"ds-card",13)(1,"div")(2,"ds-tag",20),NC(3),pl()(),Ds(4,"span",21),NC(5,"Output"),pl(),Ds(6,"pre",19),NC(7),pl(),Lw(8,ye,4,1),Ds(9,"span",21),NC(10,"Structured output"),pl(),Ds(11,"pre",19),NC(12),pl(),Lw(13,be,5,2),pl()),e&2){let n,o=t,l=Jw();ug("heading","Result \u2014 "+o.toolName),BE(2),ug("variant",o.success?"accent":"outline"),BE(),Og(o.success?"Success":"Tool error"),BE(4),Og(o.output),BE(),jw((n=l.formatMetadata(o.metadata))?8:-1,n),BE(4),Og(l.formatStructuredOutput(o.structuredOutput)??"null"),BE(),jw(o.errorType||o.errorMessage?13:-1);}}var re=class e{destroyRef=g(Ie);route=g(W);namespaceController=g(J);userState=g(y);state=g(I);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;namespaces=Ui([]);namespacesLoading=Ui(true);namespaceName=Ui(null);form=new pt({namespaceId:new Te("",{nonNullable:true,validators:[fn.required]}),userId:new Te("",{nonNullable:true}),toolName:new Te("",{nonNullable:true,validators:[fn.required]}),payload:new Te("",{nonNullable:true})});ngOnInit(){let t=this.userState.currentUser()?.id;t?this.form.controls.userId.patchValue(t):this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:n=>{n.id&&this.form.controls.userId.patchValue(n.id);}}),this.isPlatformMode?this.namespaceController.listAllNamespace().pipe(U(this.destroyRef)).subscribe({next:n=>{this.namespaces.set(n.map(o=>({id:o.id,name:o.name}))),this.namespacesLoading.set(false);},error:()=>this.namespacesLoading.set(false)}):(this.form.controls.namespaceId.patchValue(this.namespaceId),this.namespacesLoading.set(false),this.namespaceController.getByIdNamespace(this.namespaceId).pipe(U(this.destroyRef)).subscribe({next:n=>this.namespaceName.set(n.name),error:()=>this.namespaceName.set(this.namespaceId)}));}submit(){if(this.form.invalid||this.state.isLoading())return;let{namespaceId:t,userId:n,toolName:o,payload:l}=this.form.getRawValue();this.state.invoke(t,n.trim()||void 0,o.trim(),l.trim()||void 0).pipe(U(this.destroyRef)).subscribe();}reset(){this.state.reset();}formatMetadata(t){return !t||Object.keys(t).length===0?null:JSON.stringify(t,null,2)}formatStructuredOutput(t){return t===void 0?null:JSON.stringify(t,null,2)}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=yw({type:e,selectors:[["agentos-tool-invoke"]],decls:18,vars:8,consts:[["title","Tool invoke",3,"description"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Namespace","controlId","ti-namespace","required",""],["dsControl","","id","ti-namespace","type","text","readonly","",3,"value"],["label","User ID","labelHint","optional","controlId","ti-user"],["dsControl","","id","ti-user","type","text","formControlName","userId","placeholder","UUID of the user \u2014 adds user-scoped overlay layers","autocomplete","off"],["label","Tool name","controlId","ti-tool","required","","hint","Exact tool name as returned by the agent definition inspect page. When not found, the error response lists all available tools for the selected namespace."],["dsControl","","mono","","id","ti-tool","type","text","formControlName","toolName","placeholder","e.g. MY_FILES__listFiles","autocomplete","off","spellcheck","false"],["label","Payload","labelHint","optional","controlId","ti-payload"],["dsControl","","mono","","id","ti-payload","formControlName","payload","rows","6","placeholder",'JSON arguments for the tool, e.g. {"path": "/some/dir"} \u2014 leave empty for tools with no input.',"spellcheck","false"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button"],["heading","Error"],[3,"heading"],[1,"ds-hint"],["dsControl","","id","ti-namespace","formControlName","namespaceId"],["value","","disabled",""],[3,"value"],["dsButton","","type","button",3,"click"],[1,"ds-pre"],[3,"variant"],[1,"ds-micro"],["dsDefinitionList",""],[1,"ds-mono"]],template:function(n,o){if(n&1&&(Ds(0,"ds-page"),lg(1,"ds-section-header",0),Ds(2,"form",1),mg("ngSubmit",function(){return o.submit()}),Ds(3,"ds-form-field",2),Lw(4,ue,2,1)(5,fe,1,1,"input",3),pl(),Ds(6,"ds-form-field",4),lg(7,"input",5),_I(),pl(),Ds(8,"ds-form-field",6),lg(9,"input",7),_I(),pl(),Ds(10,"ds-form-field",8),lg(11,"textarea",9),_I(),pl(),Ds(12,"ds-form-actions")(13,"button",10),NC(14),pl(),Lw(15,ge,2,0,"button",11),pl()(),Lw(16,ve,3,1,"ds-card",12),Lw(17,he,14,7,"ds-card",13),pl()),n&2){let l,v;BE(),ug("description",o.isPlatformMode?"Execute any registered tool directly \u2014 bypasses the normal agent-run pipeline. Restricted to super-admins.":"Execute a registered tool directly in this namespace \u2014 bypasses the normal agent-run pipeline."),BE(),ug("formGroup",o.form),BE(2),jw(o.isPlatformMode?4:5),BE(3),NI(),BE(2),NI(),BE(2),NI(),BE(2),ug("disabled",o.form.invalid||o.state.isLoading()),BE(),vl(" ",o.state.isLoading()?"Running\u2026":"Run tool"," "),BE(),jw(o.state.result()||o.state.errorMessage()?15:-1),BE(),jw((l=o.state.errorMessage())?16:-1,l),BE(),jw((v=o.state.result())?17:-1,v);}},dependencies:[Ut,nd,bo,xo,Lt,Gt,mo,po,An,va,pn,hn,cn,dn,on,at,an,sn,ko],encapsulation:2})};export{re as ToolInvokeComponent};
@@ -1,4 +1,4 @@
1
- import {aY as A,aZ as z$1}from'./main-FJXP2G5I.js';var ut=z$1(Xe=>{"use strict";(function(i){var n=/\S/,t=/\"/g,e=/\n/g,r=/\r/g,a=/\\/g,s=/\u2028/,u=/\u2029/;i.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},i.scan=function(h,g){var S=h.length,U=0,R=1,q=2,E=U,$=null,ee=null,B="",I=[],J=!1,O=0,C=0,L="{{",b="}}";function te(){B.length>0&&(I.push({tag:"_t",text:new String(B)}),B="");}function ge(){for(var A=!0,k=C;k<I.length;k++)if(A=i.tags[I[k].tag]<i.tags._v||I[k].tag=="_t"&&I[k].text.match(n)===null,!A)return !1;return A}function be(A,k){if(te(),A&&ge())for(var _=C,ie;_<I.length;_++)I[_].text&&((ie=I[_+1])&&ie.tag==">"&&(ie.indent=I[_].text.toString()),I.splice(_,1));else k||I.push({tag:`
1
+ import {aY as A,aZ as z$1}from'./main-BGDYOJBA.js';var ut=z$1(Xe=>{"use strict";(function(i){var n=/\S/,t=/\"/g,e=/\n/g,r=/\r/g,a=/\\/g,s=/\u2028/,u=/\u2029/;i.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},i.scan=function(h,g){var S=h.length,U=0,R=1,q=2,E=U,$=null,ee=null,B="",I=[],J=!1,O=0,C=0,L="{{",b="}}";function te(){B.length>0&&(I.push({tag:"_t",text:new String(B)}),B="");}function ge(){for(var A=!0,k=C;k<I.length;k++)if(A=i.tags[I[k].tag]<i.tags._v||I[k].tag=="_t"&&I[k].text.match(n)===null,!A)return !1;return A}function be(A,k){if(te(),A&&ge())for(var _=C,ie;_<I.length;_++)I[_].text&&((ie=I[_+1])&&ie.tag==">"&&(ie.indent=I[_].text.toString()),I.splice(_,1));else k||I.push({tag:`
2
2
  `});J=!1,C=I.length;}function ne(A,k){var _="="+b,ie=A.indexOf(_,k),De=f(A.substring(A.indexOf("=",k)+1,ie)).split(" ");return L=De[0],b=De[De.length-1],ie+_.length-1}for(g&&(g=g.split(" "),L=g[0],b=g[1]),O=0;O<S;O++)E==U?v(L,h,O)?(--O,te(),E=R):h.charAt(O)==`
3
3
  `?be(J):B+=h.charAt(O):E==R?(O+=L.length-1,ee=i.tags[h.charAt(O+1)],$=ee?h.charAt(O+1):"_v",$=="="?(O=ne(h,O),E=U):(ee&&O++,E=q),J=O):v(b,h,O)?(I.push({tag:$,n:f(B),otag:L,ctag:b,i:$=="/"?J-L.length:O+b.length}),B="",O+=b.length-1,E=U,$=="{"&&(b=="}}"?O++:d(I[I.length-1]))):B+=h.charAt(O);return be(J,!0),I};function d(l){l.n.substr(l.n.length-1)==="}"&&(l.n=l.n.substring(0,l.n.length-1));}function f(l){return l.trim?l.trim():l.replace(/^\s*|\s*$/g,"")}function v(l,h,g){if(h.charAt(g)!=l.charAt(0))return !1;for(var S=1,U=l.length;S<U;S++)if(h.charAt(g+S)!=l.charAt(S))return !1;return !0}var y={_t:!0,"\n":!0,$:!0,"/":!0};function o(l,h,g,S){var U=[],R=null,q=null,E=null;for(q=g[g.length-1];l.length>0;){if(E=l.shift(),q&&q.tag=="<"&&!(E.tag in y))throw new Error("Illegal content in < super tag.");if(i.tags[E.tag]<=i.tags.$||c(E,S))g.push(E),E.nodes=o(l,E.tag,g,S);else if(E.tag=="/"){if(g.length===0)throw new Error("Closing tag without opener: /"+E.n);if(R=g.pop(),E.n!=R.n&&!m(E.n,R.n,S))throw new Error("Nesting error: "+R.n+" vs. "+E.n);return R.end=E.i,U}else E.tag==`
4
4
  `&&(E.last=l.length==0||l[0].tag==`
@@ -1 +1 @@
1
- import {f,y,p as pt,T as Te,a as fn,U as Ut,n as nd,L as Lt,k as kn,m as mo,b as po,$ as $r,V as Vn,A as An,c as pn,h as hn,d as cn,e as dn,g as at,i as an}from'./chunk-D2BTEyR1.js';import {g,W,F,E as J,I as Ie,X as XC,U as Ui,q as Af,G as U,K as w,M as x,y as yw,D as Ds,l as lg,L as Lw,p as pl,P as ug,a as BE,j as jw,N as NC,Z as Zw,Q as mg,_ as _I,J as Jw,R as NI,k as cg,v as vl,r as df,s as ff}from'./main-FJXP2G5I.js';var ne=/^(\/|[A-Za-z]:[\\/]|\\\\)/;function re(i){return ne.test(i)}function ee(i=()=>true){return t=>{let e=(t.value??"").trim();return !i()||e===""||re(e)?null:{absolutePath:true}}}function ae(i,t){i&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function ie(i,t){if(i&1){let e=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let p=Jw();return ff(p.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),_I(),pl(),Ds(3,"ds-form-field",7),lg(4,"textarea",8),_I(),pl(),Ds(5,"ds-form-field",9),lg(6,"input",10),_I(),pl(),Ds(7,"ds-form-field",11),lg(8,"input",12),_I(),pl(),Ds(9,"ds-form-field",13),lg(10,"input",14),_I(),pl(),Ds(11,"ds-form-field",15),lg(12,"input",16),_I(),pl(),Ds(13,"ds-form-field",17),lg(14,"input",18),_I(),pl(),Ds(15,"ds-form-field",19)(16,"input",20),mg("input",function(p){df(e);let oe=Jw();return ff(oe.onMaxToolRoundsInput(p))}),pl(),_I(),pl(),Ds(17,"ds-form-actions")(18,"button",21),NC(19),pl(),Ds(20,"button",22),mg("click",function(){df(e);let p=Jw();return ff(p.cancel())}),NC(21,"Cancel"),pl()()();}if(i&2){let e=Jw();ug("formGroup",e.form),BE(2),ug("formControl",e.nameControl),NI(),BE(2),ug("formControl",e.descriptionControl),NI(),BE(2),ug("formControl",e.externalIdControl),NI(),BE(2),ug("formControl",e.defaultAgentNameControl),NI(),BE(2),ug("formControl",e.configPathControl),NI(),BE(),ug("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(),ug("readOnly",!e.canEditSharedExchangePath())("formControl",e.sharedExchangePathControl),cg("aria-invalid",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid),NI(),BE(),ug("hint",e.runCostThresholdHint()),BE(),ug("placeholder",e.runCostThresholdPlaceholder())("formControl",e.runCostThresholdControl),NI(),BE(),ug("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(),ug("formControl",e.maxToolRoundsControl),cg("aria-invalid",e.maxToolRoundsControl.invalid||e.maxToolRoundsUnparsable()),NI(),BE(2),ug("disabled",e.form.invalid||e.isSubmitting()),BE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var le=1,se=2147483647,te=class i{route=g(W);router=g(F);namespaceController=g(J);destroyRef=g(Ie);usageConfiguration=g(f);userState=g(y);canEditSharedExchangePath=XC(()=>this.userState.currentUser()?.isAdmin===true);sharedExchangePathHint=XC(()=>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=XC(()=>{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=XC(()=>{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:[ee(()=>this.canEditSharedExchangePath())]}),externalId:new Te("",{nonNullable:true}),defaultAgentName:new Te("",{nonNullable:true}),runCostThreshold:new Te(null),maxToolRounds:new Te(null,{validators:[fn.min(le),fn.max(se),fn.pattern(/^\d+$/)]})});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}maxToolRoundsUnparsable=Ui(false);onMaxToolRoundsInput(t){this.maxToolRoundsUnparsable.set(t.target.validity.badInput);}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);existingNamespace=null;constructor(){Af(()=>{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.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}),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=yw({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"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"]],template:function(e,u){e&1&&(Ds(0,"ds-page",0),lg(1,"ds-section-header",1),Lw(2,ae,2,0,"p",2)(3,ie,22,19,"form",3),pl()),e&2&&(ug("framed",!u.isEditMode()),BE(),ug("title",u.isEditMode()?"Edit namespace":"New namespace"),BE(),jw(u.isLoading()?2:3));},dependencies:[Ut,nd,Lt,kn,mo,po,$r,Vn,An,pn,hn,cn,dn,at,an],encapsulation:2})};export{te as NamespaceFormComponent};
1
+ import {f,y,p as pt,T as Te,a as fn,U as Ut,n as nd,L as Lt,k as kn,m as mo,b as po,$ as $r,V as Vn,A as An,c as pn,h as hn,d as cn,e as dn,g as at,i as an}from'./chunk-DvqKcX7A.js';import {g,W,F,E as J,I as Ie,X as XC,U as Ui,q as Af,G as U,K as w,M as x,y as yw,D as Ds,l as lg,L as Lw,p as pl,P as ug,a as BE,j as jw,N as NC,Z as Zw,Q as mg,_ as _I,J as Jw,R as NI,k as cg,v as vl,r as df,s as ff}from'./main-BGDYOJBA.js';var ne=/^(\/|[A-Za-z]:[\\/]|\\\\)/;function re(i){return ne.test(i)}function ee(i=()=>true){return t=>{let e=(t.value??"").trim();return !i()||e===""||re(e)?null:{absolutePath:true}}}function ae(i,t){i&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function ie(i,t){if(i&1){let e=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let p=Jw();return ff(p.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),_I(),pl(),Ds(3,"ds-form-field",7),lg(4,"textarea",8),_I(),pl(),Ds(5,"ds-form-field",9),lg(6,"input",10),_I(),pl(),Ds(7,"ds-form-field",11),lg(8,"input",12),_I(),pl(),Ds(9,"ds-form-field",13),lg(10,"input",14),_I(),pl(),Ds(11,"ds-form-field",15),lg(12,"input",16),_I(),pl(),Ds(13,"ds-form-field",17),lg(14,"input",18),_I(),pl(),Ds(15,"ds-form-field",19)(16,"input",20),mg("input",function(p){df(e);let oe=Jw();return ff(oe.onMaxToolRoundsInput(p))}),pl(),_I(),pl(),Ds(17,"ds-form-actions")(18,"button",21),NC(19),pl(),Ds(20,"button",22),mg("click",function(){df(e);let p=Jw();return ff(p.cancel())}),NC(21,"Cancel"),pl()()();}if(i&2){let e=Jw();ug("formGroup",e.form),BE(2),ug("formControl",e.nameControl),NI(),BE(2),ug("formControl",e.descriptionControl),NI(),BE(2),ug("formControl",e.externalIdControl),NI(),BE(2),ug("formControl",e.defaultAgentNameControl),NI(),BE(2),ug("formControl",e.configPathControl),NI(),BE(),ug("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(),ug("readOnly",!e.canEditSharedExchangePath())("formControl",e.sharedExchangePathControl),cg("aria-invalid",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid),NI(),BE(),ug("hint",e.runCostThresholdHint()),BE(),ug("placeholder",e.runCostThresholdPlaceholder())("formControl",e.runCostThresholdControl),NI(),BE(),ug("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(),ug("formControl",e.maxToolRoundsControl),cg("aria-invalid",e.maxToolRoundsControl.invalid||e.maxToolRoundsUnparsable()),NI(),BE(2),ug("disabled",e.form.invalid||e.isSubmitting()),BE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var le=1,se=2147483647,te=class i{route=g(W);router=g(F);namespaceController=g(J);destroyRef=g(Ie);usageConfiguration=g(f);userState=g(y);canEditSharedExchangePath=XC(()=>this.userState.currentUser()?.isAdmin===true);sharedExchangePathHint=XC(()=>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=XC(()=>{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=XC(()=>{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:[ee(()=>this.canEditSharedExchangePath())]}),externalId:new Te("",{nonNullable:true}),defaultAgentName:new Te("",{nonNullable:true}),runCostThreshold:new Te(null),maxToolRounds:new Te(null,{validators:[fn.min(le),fn.max(se),fn.pattern(/^\d+$/)]})});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}maxToolRoundsUnparsable=Ui(false);onMaxToolRoundsInput(t){this.maxToolRoundsUnparsable.set(t.target.validity.badInput);}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);existingNamespace=null;constructor(){Af(()=>{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.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}),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=yw({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"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"]],template:function(e,u){e&1&&(Ds(0,"ds-page",0),lg(1,"ds-section-header",1),Lw(2,ae,2,0,"p",2)(3,ie,22,19,"form",3),pl()),e&2&&(ug("framed",!u.isEditMode()),BE(),ug("title",u.isEditMode()?"Edit namespace":"New namespace"),BE(),jw(u.isLoading()?2:3));},dependencies:[Ut,nd,Lt,kn,mo,po,$r,Vn,An,pn,hn,cn,dn,at,an],encapsulation:2})};export{te as NamespaceFormComponent};
@@ -1 +1 @@
1
- import {v}from'./chunk-BiYZtMHe.js';import {I}from'./chunk-CJLkP_aL.js';import {O}from'./chunk-BYeNpjs5.js';import {g,W,F,I as Ie$1,a8 as _,a9 as F$1,aa as Tr,U as Ui,ab as le,X as XC,a1 as fa,G as U,q as Af,ac as Ty,y as yw,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,j as jw,a2 as da,ad as ne,Z as Zw,H as Hw,ae as Fw,_ as _I,l as lg,J as Jw,m as Uw,R as NI,v as vl,O as Og,r as df,s as ff}from'./main-FJXP2G5I.js';import {p as pt,T as Te$1,a as fn,c as pn,h as hn,d as cn,r as ln,e as dn,o as on,g as at,i as an,t as rn,U as Ut,n as nd,l as bo,x as xo,L as Lt,u as vn,G as Gt,w as pa,m as mo,b as po,V as Vn,A as An,W as Wt}from'./chunk-D2BTEyR1.js';import'./chunk-B5eEl07l.js';var be=(i,e)=>e.value;function _e(i,e){i&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function xe(i,e){if(i&1&&(Ds(0,"label",6),lg(1,"input",22),_I(),NC(2),pl()),i&2){let t=e.$implicit,n=Jw(2);BE(),ug("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),NI(),BE(),vl(" ",t.label," ");}}function Ie(i,e){if(i&1&&(Ds(0,"option",10),NC(1),pl()),i&2){let t=e.$implicit;ug("value",t.type),BE(),Og(t.displayName);}}function Ne(i,e){if(i&1&&(Ds(0,"option",10),NC(1),pl()),i&2){let t=e.$implicit;ug("value",t.value),BE(),Og(t.label);}}function Ae(i,e){if(i&1&&(Ds(0,"div",18)(1,"label",6),lg(2,"input",23),_I(),NC(3," Grant automatically "),pl(),Ds(4,"p",2),NC(5),pl()()),i&2){let t=Jw(2);BE(2),ug("formControl",t.autoGrantControl),NI(),BE(3),vl(" Give this integration to ",t.autoGrantReach(),", without each agent having to declare it. An agent can still opt out by mapping this configuration to an empty tool list. ");}}function Ee(i,e){if(i&1){let t=Zw();Ds(0,"ds-card")(1,"ds-json-schema-form",24),mg("valueChange",function(a){df(t);let p=Jw(2);return ff(p.onParamsChange(a))}),pl()();}if(i&2){let t=Jw(2);BE(),ug("schema",e)("value",t.initialParams());}}function Fe(i,e){if(i&1){let t=Zw();Ds(0,"button",25),mg("click",function(){df(t);let a=Jw(2);return ff(a.exportYaml())}),NC(1),pl();}if(i&2){let t=Jw(2);ug("disabled",t.isExporting()),BE(),vl(" ",t.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Te(i,e){if(i&1){let t=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(t);let a=Jw();return ff(a.submit())}),Ds(1,"ds-fieldset",5),Hw(2,xe,3,4,"label",6,Fw().trackByScope,true),pl(),Ds(4,"ds-form-field",7)(5,"select",8)(6,"option",9),NC(7,"Select type"),pl(),Hw(8,Ie,2,2,"option",10,Fw().trackByType,true),pl(),_I(),pl(),Ds(10,"ds-form-field",11),lg(11,"input",12),_I(),pl(),Ds(12,"ds-form-field",13),lg(13,"textarea",14),_I(),pl(),Ds(14,"ds-form-field",15)(15,"select",16)(16,"option",17),NC(17,"None"),pl(),Hw(18,Ne,2,2,"option",10,be),pl(),_I(),pl(),Lw(20,Ae,6,2,"div",18),Lw(21,Ee,2,2,"ds-card"),Ds(22,"ds-form-actions")(23,"button",19),NC(24),pl(),Lw(25,Fe,2,2,"button",20),Ds(26,"button",21),mg("click",function(){df(t);let a=Jw();return ff(a.cancel())}),NC(27,"Cancel"),pl()()();}if(i&2){let t,n=Jw();ug("formGroup",n.form),BE(),ug("disabled",n.isEditMode()),BE(),Uw(n.scopeOptions),BE(3),ug("formControl",n.typeControl),NI(),BE(3),Uw(n.integrationTypes()),BE(3),ug("formControl",n.nameControl),NI(),BE(2),ug("formControl",n.descriptionControl),NI(),BE(2),ug("formControl",n.authSettingNameControl),NI(),BE(),ug("ngValue",null),BE(2),Uw(n.authSettingOptions()),BE(2),jw(n.isAutoGrantable()?20:-1),BE(),jw((t=n.schema())?21:-1,t),BE(2),ug("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),BE(),vl(" ",n.isEditMode()?"Save changes":"Create"," "),BE(),jw(n.isEditMode()?25:-1);}}var Ve=new Set(["platform","namespace","userOnNs","userGlobal"]),w=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ve=class i{route=g(W);router=g(F);destroyRef=g(Ie$1);state=g(O);integrationTypeController=g(_);authSettingState=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?Tr(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new pt({name:new Te$1("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te$1(null),type:new Te$1("",{nonNullable:true,validators:[fn.required]}),scope:new Te$1("namespace",{nonNullable:true}),autoGrant:new Te$1(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);isExporting=Ui(false);scopeOptions=[{value:"platform",label:w.platform},{value:"namespace",label:w.namespace},{value:"userOnNs",label:w.userOnNs},{value:"userGlobal",label:w.userGlobal}];authSettingNameControl=new Te$1(null);loadedAuthSettings=Ui([]);authSettingsLoaded=Ui(false);savedAuthSettingName=Ui(null);authSettingsScope$=new le;authSettingOptions=XC(()=>{let e=this.loadedAuthSettings(),t=this.savedAuthSettingName();return !t||!this.authSettingsLoaded()||e.some(n=>n.value===t)?e:[...e,{value:t,label:`${t} (not found)`}]});paramsValue=Ui(null);initialParams=Ui(null);integrationTypes=F$1(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=F$1(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});scopeValue=F$1(this.form.controls.scope.valueChanges,{initialValue:this.form.controls.scope.value});schema=XC(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});isAutoGrantable=XC(()=>{let e=this.selectedType();return e?this.integrationTypes().find(t=>t.type===e)?.autoGrantable??false:false});autoGrantReach=XC(()=>{switch(this.scopeValue()){case "platform":return "every agent of this environment";case "namespace":return "every agent of this namespace";default:return "your own runs"}});existingConfig=null;constructor(){this.authSettingsScope$.pipe(fa(e=>this.loadAuthSettingLayers(e)),U(this.destroyRef)).subscribe(e=>{this.loadedAuthSettings.set(this.toAuthSettingOptions(e)),this.authSettingsLoaded.set(true);}),Af(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let e=this.route.snapshot.paramMap,t=this.route.snapshot.queryParamMap,n=e.get("integrationId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable(),this.loadAuthSettingsForScope("platform");return}let a=this.parseScope(t.get("scope"));this.scopeControl.setValue(a),this.loadAuthSettingsForScope(a),this.scopeControl.valueChanges.pipe(U(this.destroyRef)).subscribe(D=>{this.loadAuthSettingsForScope(D);});let p=t.get("template");p&&this.hydrateFromTemplate(p);}parseScope(e){return e&&Ve.has(e)?e:"namespace"}deriveScopeFromConfig(e){return !e.userId&&!e.namespaceId?"platform":e.userId?e.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.existingConfig=t;let n=this.deriveScopeFromConfig(t);this.scopeControl.setValue(n),this.applyConfigToForm(t),this.loadAuthSettingsForScope(n),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[IntegrationForm] Could not load config '${e}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.applyConfigToForm(t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:t=>{console.warn(`[IntegrationForm] Could not hydrate from template ${e}:`,t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(e){this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.typeControl.setValue(e.integrationType),this.initialParams.set(e.parameters),this.paramsValue.set(e.parameters),this.authSettingNameControl.setValue(e.authSettingName??null),this.savedAuthSettingName.set(e.authSettingName??null),this.autoGrantControl.setValue(e.autoGrant??false);}loadAuthSettingsForScope(e){this.authSettingsLoaded.set(false),this.authSettingsScope$.next(e);}loadAuthSettingLayers(e){let t=(p,D)=>D.pipe(da(()=>Tr([])),ne(Se=>({label:p,settings:Se}))),n=t("platform",this.authSettingState.loadPlatformSettings()),a=t("mine",this.authSettingState.loadUserSettings("global"));return e==="platform"||e==="userGlobal"?Ty([a,n]):Ty([t("mine",this.authSettingState.loadUserSettings(this.namespaceId)),t("namespace",this.authSettingState.loadNamespaceSettings(this.namespaceId)),a,n])}toAuthSettingOptions(e){let t=new Map;for(let{label:n,settings:a}of e)for(let{name:p}of a)p&&t.set(p,(t.get(p)??new Set).add(n));return [...t.entries()].sort(([n],[a])=>n.localeCompare(a)).map(([n,a])=>({value:n,label:`${n} (${[...a].join(", ")})`}))}onParamsChange(e){this.paramsValue.set(e);}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let e=this.descriptionControl.value?.trim(),t={name:this.nameControl.value.trim(),description:e||null,integrationType:this.typeControl.value,parameters:this.paramsValue(),authSettingName:this.authSettingNameControl.value||null,autoGrant:this.isAutoGrantable()&&this.autoGrantControl.value},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,t,n,this.existingConfig):this.state.create(t,n,this.namespaceId??null)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let e=this.existingConfig?.id;!e||this.isExporting()||(this.isExporting.set(true),this.state.exportAsYaml(e).pipe(U(this.destroyRef)).subscribe({next:t=>{let n=new Blob([t],{type:"application/yaml"}),a=URL.createObjectURL(n),p=document.createElement("a");p.href=a,p.download=`${this.existingConfig?.name??"integration"}.yaml`,p.click(),URL.revokeObjectURL(a),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"]);}trackByType(e,t){return t.type}trackByScope(e,t){return t.value}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-integration-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to integrations",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Scope",3,"disabled"],["dsCheck",""],["label","Type","controlId","integration-type","required",""],["dsControl","","id","integration-type",3,"formControl"],["value","","disabled",""],[3,"value"],["label","Name","controlId","integration-name","required",""],["dsControl","","id","integration-name","type","text","placeholder","Integration name","autocomplete","off",3,"formControl"],["label","Description","controlId","integration-description"],["dsControl","","id","integration-description","placeholder","Optional description","rows","3",3,"formControl"],["label","Auth Setting","controlId","integration-auth-setting","hint","Only the name is saved. It is resolved at run time for the user running the case, the most specific layer winning (user on this namespace > namespace > user > platform), so a shared integration can rely on each user's own auth setting of that name."],["dsControl","","id","integration-auth-setting",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-stack--sm"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["type","radio",3,"value","formControl","disabled"],["type","checkbox",3,"formControl"],[3,"valueChange","schema","value"],["dsButton","","type","button",3,"click","disabled"]],template:function(t,n){t&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return n.cancel()}),NC(3," \u2190 Integrations "),pl()(),Lw(4,_e,2,0,"p",2)(5,Te,28,12,"form",3),pl()),t&2&&(BE(),ug("title",n.isEditMode()?"Edit integration":"New integration"),BE(3),jw(n.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,on,at,an,rn,Ut,nd,bo,xo,Lt,vn,Gt,pa,mo,po,Vn,An,Wt],encapsulation:2})};export{ve as IntegrationFormComponent};
1
+ import {v}from'./chunk-2O1S906W.js';import {I}from'./chunk-Dn4mtCZo.js';import {O}from'./chunk-DueFkMuu.js';import {g,W,F,I as Ie$1,a8 as _,a9 as F$1,aa as Tr,U as Ui,ab as le,X as XC,a1 as fa,G as U,q as Af,ac as Ty,y as yw,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,j as jw,a2 as da,ad as ne,Z as Zw,H as Hw,ae as Fw,_ as _I,l as lg,J as Jw,m as Uw,R as NI,v as vl,O as Og,r as df,s as ff}from'./main-BGDYOJBA.js';import {p as pt,T as Te$1,a as fn,c as pn,h as hn,d as cn,r as ln,e as dn,o as on,g as at,i as an,t as rn,U as Ut,n as nd,l as bo,x as xo,L as Lt,u as vn,G as Gt,w as pa,m as mo,b as po,V as Vn,A as An,W as Wt}from'./chunk-DvqKcX7A.js';import'./chunk-AYvnGrVn.js';var be=(i,e)=>e.value;function _e(i,e){i&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function xe(i,e){if(i&1&&(Ds(0,"label",6),lg(1,"input",22),_I(),NC(2),pl()),i&2){let t=e.$implicit,n=Jw(2);BE(),ug("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),NI(),BE(),vl(" ",t.label," ");}}function Ie(i,e){if(i&1&&(Ds(0,"option",10),NC(1),pl()),i&2){let t=e.$implicit;ug("value",t.type),BE(),Og(t.displayName);}}function Ne(i,e){if(i&1&&(Ds(0,"option",10),NC(1),pl()),i&2){let t=e.$implicit;ug("value",t.value),BE(),Og(t.label);}}function Ae(i,e){if(i&1&&(Ds(0,"div",18)(1,"label",6),lg(2,"input",23),_I(),NC(3," Grant automatically "),pl(),Ds(4,"p",2),NC(5),pl()()),i&2){let t=Jw(2);BE(2),ug("formControl",t.autoGrantControl),NI(),BE(3),vl(" Give this integration to ",t.autoGrantReach(),", without each agent having to declare it. An agent can still opt out by mapping this configuration to an empty tool list. ");}}function Ee(i,e){if(i&1){let t=Zw();Ds(0,"ds-card")(1,"ds-json-schema-form",24),mg("valueChange",function(a){df(t);let p=Jw(2);return ff(p.onParamsChange(a))}),pl()();}if(i&2){let t=Jw(2);BE(),ug("schema",e)("value",t.initialParams());}}function Fe(i,e){if(i&1){let t=Zw();Ds(0,"button",25),mg("click",function(){df(t);let a=Jw(2);return ff(a.exportYaml())}),NC(1),pl();}if(i&2){let t=Jw(2);ug("disabled",t.isExporting()),BE(),vl(" ",t.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Te(i,e){if(i&1){let t=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(t);let a=Jw();return ff(a.submit())}),Ds(1,"ds-fieldset",5),Hw(2,xe,3,4,"label",6,Fw().trackByScope,true),pl(),Ds(4,"ds-form-field",7)(5,"select",8)(6,"option",9),NC(7,"Select type"),pl(),Hw(8,Ie,2,2,"option",10,Fw().trackByType,true),pl(),_I(),pl(),Ds(10,"ds-form-field",11),lg(11,"input",12),_I(),pl(),Ds(12,"ds-form-field",13),lg(13,"textarea",14),_I(),pl(),Ds(14,"ds-form-field",15)(15,"select",16)(16,"option",17),NC(17,"None"),pl(),Hw(18,Ne,2,2,"option",10,be),pl(),_I(),pl(),Lw(20,Ae,6,2,"div",18),Lw(21,Ee,2,2,"ds-card"),Ds(22,"ds-form-actions")(23,"button",19),NC(24),pl(),Lw(25,Fe,2,2,"button",20),Ds(26,"button",21),mg("click",function(){df(t);let a=Jw();return ff(a.cancel())}),NC(27,"Cancel"),pl()()();}if(i&2){let t,n=Jw();ug("formGroup",n.form),BE(),ug("disabled",n.isEditMode()),BE(),Uw(n.scopeOptions),BE(3),ug("formControl",n.typeControl),NI(),BE(3),Uw(n.integrationTypes()),BE(3),ug("formControl",n.nameControl),NI(),BE(2),ug("formControl",n.descriptionControl),NI(),BE(2),ug("formControl",n.authSettingNameControl),NI(),BE(),ug("ngValue",null),BE(2),Uw(n.authSettingOptions()),BE(2),jw(n.isAutoGrantable()?20:-1),BE(),jw((t=n.schema())?21:-1,t),BE(2),ug("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),BE(),vl(" ",n.isEditMode()?"Save changes":"Create"," "),BE(),jw(n.isEditMode()?25:-1);}}var Ve=new Set(["platform","namespace","userOnNs","userGlobal"]),w=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ve=class i{route=g(W);router=g(F);destroyRef=g(Ie$1);state=g(O);integrationTypeController=g(_);authSettingState=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?Tr(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new pt({name:new Te$1("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te$1(null),type:new Te$1("",{nonNullable:true,validators:[fn.required]}),scope:new Te$1("namespace",{nonNullable:true}),autoGrant:new Te$1(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);isExporting=Ui(false);scopeOptions=[{value:"platform",label:w.platform},{value:"namespace",label:w.namespace},{value:"userOnNs",label:w.userOnNs},{value:"userGlobal",label:w.userGlobal}];authSettingNameControl=new Te$1(null);loadedAuthSettings=Ui([]);authSettingsLoaded=Ui(false);savedAuthSettingName=Ui(null);authSettingsScope$=new le;authSettingOptions=XC(()=>{let e=this.loadedAuthSettings(),t=this.savedAuthSettingName();return !t||!this.authSettingsLoaded()||e.some(n=>n.value===t)?e:[...e,{value:t,label:`${t} (not found)`}]});paramsValue=Ui(null);initialParams=Ui(null);integrationTypes=F$1(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=F$1(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});scopeValue=F$1(this.form.controls.scope.valueChanges,{initialValue:this.form.controls.scope.value});schema=XC(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});isAutoGrantable=XC(()=>{let e=this.selectedType();return e?this.integrationTypes().find(t=>t.type===e)?.autoGrantable??false:false});autoGrantReach=XC(()=>{switch(this.scopeValue()){case "platform":return "every agent of this environment";case "namespace":return "every agent of this namespace";default:return "your own runs"}});existingConfig=null;constructor(){this.authSettingsScope$.pipe(fa(e=>this.loadAuthSettingLayers(e)),U(this.destroyRef)).subscribe(e=>{this.loadedAuthSettings.set(this.toAuthSettingOptions(e)),this.authSettingsLoaded.set(true);}),Af(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let e=this.route.snapshot.paramMap,t=this.route.snapshot.queryParamMap,n=e.get("integrationId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable(),this.loadAuthSettingsForScope("platform");return}let a=this.parseScope(t.get("scope"));this.scopeControl.setValue(a),this.loadAuthSettingsForScope(a),this.scopeControl.valueChanges.pipe(U(this.destroyRef)).subscribe(D=>{this.loadAuthSettingsForScope(D);});let p=t.get("template");p&&this.hydrateFromTemplate(p);}parseScope(e){return e&&Ve.has(e)?e:"namespace"}deriveScopeFromConfig(e){return !e.userId&&!e.namespaceId?"platform":e.userId?e.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.existingConfig=t;let n=this.deriveScopeFromConfig(t);this.scopeControl.setValue(n),this.applyConfigToForm(t),this.loadAuthSettingsForScope(n),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[IntegrationForm] Could not load config '${e}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.applyConfigToForm(t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:t=>{console.warn(`[IntegrationForm] Could not hydrate from template ${e}:`,t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(e){this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.typeControl.setValue(e.integrationType),this.initialParams.set(e.parameters),this.paramsValue.set(e.parameters),this.authSettingNameControl.setValue(e.authSettingName??null),this.savedAuthSettingName.set(e.authSettingName??null),this.autoGrantControl.setValue(e.autoGrant??false);}loadAuthSettingsForScope(e){this.authSettingsLoaded.set(false),this.authSettingsScope$.next(e);}loadAuthSettingLayers(e){let t=(p,D)=>D.pipe(da(()=>Tr([])),ne(Se=>({label:p,settings:Se}))),n=t("platform",this.authSettingState.loadPlatformSettings()),a=t("mine",this.authSettingState.loadUserSettings("global"));return e==="platform"||e==="userGlobal"?Ty([a,n]):Ty([t("mine",this.authSettingState.loadUserSettings(this.namespaceId)),t("namespace",this.authSettingState.loadNamespaceSettings(this.namespaceId)),a,n])}toAuthSettingOptions(e){let t=new Map;for(let{label:n,settings:a}of e)for(let{name:p}of a)p&&t.set(p,(t.get(p)??new Set).add(n));return [...t.entries()].sort(([n],[a])=>n.localeCompare(a)).map(([n,a])=>({value:n,label:`${n} (${[...a].join(", ")})`}))}onParamsChange(e){this.paramsValue.set(e);}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let e=this.descriptionControl.value?.trim(),t={name:this.nameControl.value.trim(),description:e||null,integrationType:this.typeControl.value,parameters:this.paramsValue(),authSettingName:this.authSettingNameControl.value||null,autoGrant:this.isAutoGrantable()&&this.autoGrantControl.value},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,t,n,this.existingConfig):this.state.create(t,n,this.namespaceId??null)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let e=this.existingConfig?.id;!e||this.isExporting()||(this.isExporting.set(true),this.state.exportAsYaml(e).pipe(U(this.destroyRef)).subscribe({next:t=>{let n=new Blob([t],{type:"application/yaml"}),a=URL.createObjectURL(n),p=document.createElement("a");p.href=a,p.download=`${this.existingConfig?.name??"integration"}.yaml`,p.click(),URL.revokeObjectURL(a),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"]);}trackByType(e,t){return t.type}trackByScope(e,t){return t.value}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-integration-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to integrations",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Scope",3,"disabled"],["dsCheck",""],["label","Type","controlId","integration-type","required",""],["dsControl","","id","integration-type",3,"formControl"],["value","","disabled",""],[3,"value"],["label","Name","controlId","integration-name","required",""],["dsControl","","id","integration-name","type","text","placeholder","Integration name","autocomplete","off",3,"formControl"],["label","Description","controlId","integration-description"],["dsControl","","id","integration-description","placeholder","Optional description","rows","3",3,"formControl"],["label","Auth Setting","controlId","integration-auth-setting","hint","Only the name is saved. It is resolved at run time for the user running the case, the most specific layer winning (user on this namespace > namespace > user > platform), so a shared integration can rely on each user's own auth setting of that name."],["dsControl","","id","integration-auth-setting",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-stack--sm"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["type","radio",3,"value","formControl","disabled"],["type","checkbox",3,"formControl"],[3,"valueChange","schema","value"],["dsButton","","type","button",3,"click","disabled"]],template:function(t,n){t&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return n.cancel()}),NC(3," \u2190 Integrations "),pl()(),Lw(4,_e,2,0,"p",2)(5,Te,28,12,"form",3),pl()),t&2&&(BE(),ug("title",n.isEditMode()?"Edit integration":"New integration"),BE(3),jw(n.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,on,at,an,rn,Ut,nd,bo,xo,Lt,vn,Gt,pa,mo,po,Vn,An,Wt],encapsulation:2})};export{ve as IntegrationFormComponent};
@@ -1 +1 @@
1
- import {z as k$1,O,g as at,h as hn,I as Io,P,B as P$1}from'./chunk-D2BTEyR1.js';import {g,F,I as Ie,ap as F$1,$ as Cr,U as Ui,a1 as fa,G as U$1,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,H as Hw,m as Uw,Z as Zw,k as cg,r as df,s as ff}from'./main-FJXP2G5I.js';var B=(i,e)=>e.id??e.name;function M(i,e){if(i&1&&(Ds(0,"p",3),NC(1),pl()),i&2){let t=Jw();BE(),Og(t.deletion.error());}}function U(i,e){i&1&&(Ds(0,"p",4),NC(1,"Loading AI providers\u2026"),pl());}function j(i,e){i&1&&(Ds(0,"p",5),NC(1,"No platform AI providers defined yet."),pl());}function K(i,e){i&1&&(Ds(0,"p",4),NC(1,"No AI providers match the current filter."),pl());}function H(i,e){if(i&1){let t=Zw();Ds(0,"button",19),mg("click",function(){df(t);let s=Jw().$implicit,m=Jw(2);return ff(m.edit(s))}),NC(1," Edit "),pl();}if(i&2){let t=Jw().$implicit;cg("aria-label","Edit "+t.name);}}function z(i,e){if(i&1){let t=Zw();Ds(0,"agentos-row-delete-action",20),mg("deleteRequested",function(){df(t);let s=Jw().$implicit,m=Jw(2);return ff(m.deletion.request(s.id))})("deleteConfirmed",function(){df(t);let s=Jw().$implicit,m=Jw(2);return ff(m.confirmDelete(s))})("deleteCancelled",function(){df(t);let s=Jw(3);return ff(s.deletion.cancel())}),pl();}if(i&2){let t=Jw().$implicit,r=Jw(2);ug("rowKey",t.id)("rowLabel",t.name)("state",r.deletion);}}function G(i,e){if(i&1&&(Ds(0,"tr",9)(1,"td",12),NC(2),pl(),Ds(3,"td",13),NC(4),pl(),Ds(5,"td",14),NC(6),pl(),Ds(7,"td",15)(8,"div",16),Lw(9,H,2,1,"button",17),Lw(10,z,1,3,"agentos-row-delete-action",18),pl()()()),i&2){let t=e.$implicit,r=Jw(2);BE(2),Og(t.name),BE(2),Og(t.apiType),BE(2),Og(t.baseUrl||"\u2014"),BE(3),jw(r.deletion.confirmingId()!==t.id?9:-1),BE(),jw(t.id?10:-1);}}function J(i,e){if(i&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"API type"),pl(),Ds(8,"th",10),NC(9,"Base URL"),pl(),Ds(10,"th",10)(11,"span",11),NC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Hw(14,G,11,5,"tr",9,B),pl()()()),i&2){let t=Jw();BE(14),Uw(t.rowFilter.filteredRows());}}var k=class i{router=g(F);destroyRef=g(Ie);aiProviderController=g(F$1);refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k$1();providers=Ui([]);rowFilter=O(this.providers,e=>[e.name,e.apiType,e.baseUrl].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.aiProviderController.listAiProvider("none"))),U$1(this.destroyRef)).subscribe({next:e=>{this.providers.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","ai-providers","new"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","ai-providers",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.aiProviderController.deleteAiProvider(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-platform-ai-providers"]],decls:9,vars:3,consts:[["title","Platform AI providers","description","AI providers shared across every namespace."],["label","Filter AI providers","placeholder","Filter AI providers\u2026",3,"queryChange","query"],["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 AI providers"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","API type"],["role","cell","data-label","Base URL",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,r){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return r.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return r.openCreateForm()}),NC(3,"New AI provider"),pl()(),Lw(4,M,2,1,"p",3),Lw(5,U,2,0,"p",4)(6,j,2,0,"p",5)(7,K,2,0,"p",4)(8,J,16,0,"div",6)),t&2&&(BE(),ug("query",r.rowFilter.query()),BE(3),jw(r.deletion.error()?4:-1),BE(),jw(r.isLoading()?5:r.providers().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{k as PlatformAiProvidersComponent};
1
+ import {z as k$1,O,g as at,h as hn,I as Io,P,B as P$1}from'./chunk-DvqKcX7A.js';import {g,F,I as Ie,ap as F$1,$ as Cr,U as Ui,a1 as fa,G as U$1,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,H as Hw,m as Uw,Z as Zw,k as cg,r as df,s as ff}from'./main-BGDYOJBA.js';var B=(i,e)=>e.id??e.name;function M(i,e){if(i&1&&(Ds(0,"p",3),NC(1),pl()),i&2){let t=Jw();BE(),Og(t.deletion.error());}}function U(i,e){i&1&&(Ds(0,"p",4),NC(1,"Loading AI providers\u2026"),pl());}function j(i,e){i&1&&(Ds(0,"p",5),NC(1,"No platform AI providers defined yet."),pl());}function K(i,e){i&1&&(Ds(0,"p",4),NC(1,"No AI providers match the current filter."),pl());}function H(i,e){if(i&1){let t=Zw();Ds(0,"button",19),mg("click",function(){df(t);let s=Jw().$implicit,m=Jw(2);return ff(m.edit(s))}),NC(1," Edit "),pl();}if(i&2){let t=Jw().$implicit;cg("aria-label","Edit "+t.name);}}function z(i,e){if(i&1){let t=Zw();Ds(0,"agentos-row-delete-action",20),mg("deleteRequested",function(){df(t);let s=Jw().$implicit,m=Jw(2);return ff(m.deletion.request(s.id))})("deleteConfirmed",function(){df(t);let s=Jw().$implicit,m=Jw(2);return ff(m.confirmDelete(s))})("deleteCancelled",function(){df(t);let s=Jw(3);return ff(s.deletion.cancel())}),pl();}if(i&2){let t=Jw().$implicit,r=Jw(2);ug("rowKey",t.id)("rowLabel",t.name)("state",r.deletion);}}function G(i,e){if(i&1&&(Ds(0,"tr",9)(1,"td",12),NC(2),pl(),Ds(3,"td",13),NC(4),pl(),Ds(5,"td",14),NC(6),pl(),Ds(7,"td",15)(8,"div",16),Lw(9,H,2,1,"button",17),Lw(10,z,1,3,"agentos-row-delete-action",18),pl()()()),i&2){let t=e.$implicit,r=Jw(2);BE(2),Og(t.name),BE(2),Og(t.apiType),BE(2),Og(t.baseUrl||"\u2014"),BE(3),jw(r.deletion.confirmingId()!==t.id?9:-1),BE(),jw(t.id?10:-1);}}function J(i,e){if(i&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"API type"),pl(),Ds(8,"th",10),NC(9,"Base URL"),pl(),Ds(10,"th",10)(11,"span",11),NC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Hw(14,G,11,5,"tr",9,B),pl()()()),i&2){let t=Jw();BE(14),Uw(t.rowFilter.filteredRows());}}var k=class i{router=g(F);destroyRef=g(Ie);aiProviderController=g(F$1);refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k$1();providers=Ui([]);rowFilter=O(this.providers,e=>[e.name,e.apiType,e.baseUrl].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.aiProviderController.listAiProvider("none"))),U$1(this.destroyRef)).subscribe({next:e=>{this.providers.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","ai-providers","new"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","ai-providers",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.aiProviderController.deleteAiProvider(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-platform-ai-providers"]],decls:9,vars:3,consts:[["title","Platform AI providers","description","AI providers shared across every namespace."],["label","Filter AI providers","placeholder","Filter AI providers\u2026",3,"queryChange","query"],["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 AI providers"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","API type"],["role","cell","data-label","Base URL",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,r){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return r.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return r.openCreateForm()}),NC(3,"New AI provider"),pl()(),Lw(4,M,2,1,"p",3),Lw(5,U,2,0,"p",4)(6,j,2,0,"p",5)(7,K,2,0,"p",4)(8,J,16,0,"div",6)),t&2&&(BE(),ug("query",r.rowFilter.query()),BE(3),jw(r.deletion.error()?4:-1),BE(),jw(r.isLoading()?5:r.providers().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{k as PlatformAiProvidersComponent};