@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 {z as k$1,O as O$1,g as at,h as hn,I as Io,P,B as P$1}from'./chunk-D2BTEyR1.js';import {g,F,I as Ie,aq as k,ap as F$1,$ as Cr,U as Ui,a1 as fa,at as wy,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,r as df,s as ff,v as vl,k as cg}from'./main-FJXP2G5I.js';var K=(o,t)=>t.key;function H(o,t){if(o&1&&(Ds(0,"p",3),NC(1),pl()),o&2){let e=Jw();BE(),Og(e.deletion.error());}}function U(o,t){o&1&&(Ds(0,"p",4),NC(1,"Loading AI models\u2026"),pl());}function z(o,t){o&1&&(Ds(0,"p",5),NC(1,"No platform AI models defined yet."),pl());}function G(o,t){o&1&&(Ds(0,"p",4),NC(1,"No AI models match the current filter."),pl());}function J(o,t){if(o&1){let e=Zw();Ds(0,"button",21),mg("click",function(){df(e);let r=Jw().$implicit,m=Jw(2);return ff(m.edit(r))}),NC(1,"Edit"),pl();}if(o&2){let e=Jw().$implicit;cg("aria-label","Edit "+e.title);}}function O(o,t){if(o&1){let e=Zw();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),NC(8),pl(),Ds(9,"td",16),NC(10),pl(),Ds(11,"td",17)(12,"div",18),Lw(13,J,2,1,"button",19),Ds(14,"agentos-row-delete-action",20),mg("deleteRequested",function(){let r=df(e).$implicit,m=Jw(2);return ff(m.deletion.request(r.key))})("deleteConfirmed",function(){let r=df(e).$implicit,m=Jw(2);return ff(m.confirmDelete(r))})("deleteCancelled",function(){df(e);let r=Jw(2);return ff(r.deletion.cancel())}),pl()()()();}if(o&2){let e=t.$implicit,a=Jw(2);BE(2),Og(e.title),BE(2),Og(e.providerName),BE(2),vl(" ",e.model.apiModelName," "),BE(2),Og(e.model.priority),BE(2),vl(" ",e.model.reasoningEffort?e.model.reasoningEffort.toLowerCase():"\u2014"," "),BE(3),jw(a.deletion.confirmingId()!==e.key?13:-1),BE(),ug("rowKey",e.key)("rowLabel",e.title)("state",a.deletion);}}function Q(o,t){if(o&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,"Provider"),pl(),Ds(8,"th",10),NC(9,"API model name"),pl(),Ds(10,"th",10),NC(11,"Priority"),pl(),Ds(12,"th",10),NC(13,"Reasoning effort"),pl(),Ds(14,"th",10)(15,"span",11),NC(16,"Actions"),pl()()()(),Ds(17,"tbody",8),Hw(18,O,15,9,"tr",9,K),pl()()()),o&2){let e=Jw();BE(18),Uw(e.rowFilter.filteredRows());}}var j=class o{router=g(F);destroyRef=g(Ie);aiModelController=g(k);aiProviderController=g(F$1);refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k$1();rows=Ui([]);rowFilter=O$1(this.rows,t=>[t.title,t.model.apiModelName,t.providerName].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),wy([this.aiModelController.listPlatformLevelAiModel(),this.aiProviderController.listAiProvider("none")]))),U$1(this.destroyRef)).subscribe({next:([t,e])=>{let a=new Map(e.map(r=>[r.id??"",r.name]));this.rows.set(t.map((r,m)=>({key:r.id??`model:${m}`,model:r,title:r.alias??r.apiModelName,providerName:a.get(r.aiProviderId)??r.aiProviderId}))),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","ai-models","new"]);}edit(t){t.model.id&&this.router.navigate(["/agentos","admin","ai-models",t.model.id,"edit"]);}confirmDelete(t){t.model.id&&this.deletion.execute(t.key,{request$:this.aiModelController.deleteAiModel(t.model.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${t.title}" failed. Try again.`});}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=yw({type:o,selectors:[["agentos-platform-ai-models"]],decls:9,vars:3,consts:[["title","Platform AI models","description","AI models shared across every namespace."],["label","Filter AI models","placeholder","Filter AI models\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 models"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Provider"],["role","cell","data-label","API model name",1,"settings-table__secondary"],["role","cell","data-label","Priority"],["role","cell","data-label","Reasoning effort"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(e,a){e&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return a.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return a.openCreateForm()}),NC(3,"New AI model"),pl()(),Lw(4,H,2,1,"p",3),Lw(5,U,2,0,"p",4)(6,z,2,0,"p",5)(7,G,2,0,"p",4)(8,Q,20,0,"div",6)),e&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,P,P$1],encapsulation:2})};export{j as PlatformAiModelsComponent};
1
+ import {z as k$1,O as O$1,g as at,h as hn,I as Io,P,B as P$1}from'./chunk-DvqKcX7A.js';import {g,F,I as Ie,aq as k,ap as F$1,$ as Cr,U as Ui,a1 as fa,at as wy,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,r as df,s as ff,v as vl,k as cg}from'./main-BGDYOJBA.js';var K=(o,t)=>t.key;function H(o,t){if(o&1&&(Ds(0,"p",3),NC(1),pl()),o&2){let e=Jw();BE(),Og(e.deletion.error());}}function U(o,t){o&1&&(Ds(0,"p",4),NC(1,"Loading AI models\u2026"),pl());}function z(o,t){o&1&&(Ds(0,"p",5),NC(1,"No platform AI models defined yet."),pl());}function G(o,t){o&1&&(Ds(0,"p",4),NC(1,"No AI models match the current filter."),pl());}function J(o,t){if(o&1){let e=Zw();Ds(0,"button",21),mg("click",function(){df(e);let r=Jw().$implicit,m=Jw(2);return ff(m.edit(r))}),NC(1,"Edit"),pl();}if(o&2){let e=Jw().$implicit;cg("aria-label","Edit "+e.title);}}function O(o,t){if(o&1){let e=Zw();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),NC(8),pl(),Ds(9,"td",16),NC(10),pl(),Ds(11,"td",17)(12,"div",18),Lw(13,J,2,1,"button",19),Ds(14,"agentos-row-delete-action",20),mg("deleteRequested",function(){let r=df(e).$implicit,m=Jw(2);return ff(m.deletion.request(r.key))})("deleteConfirmed",function(){let r=df(e).$implicit,m=Jw(2);return ff(m.confirmDelete(r))})("deleteCancelled",function(){df(e);let r=Jw(2);return ff(r.deletion.cancel())}),pl()()()();}if(o&2){let e=t.$implicit,a=Jw(2);BE(2),Og(e.title),BE(2),Og(e.providerName),BE(2),vl(" ",e.model.apiModelName," "),BE(2),Og(e.model.priority),BE(2),vl(" ",e.model.reasoningEffort?e.model.reasoningEffort.toLowerCase():"\u2014"," "),BE(3),jw(a.deletion.confirmingId()!==e.key?13:-1),BE(),ug("rowKey",e.key)("rowLabel",e.title)("state",a.deletion);}}function Q(o,t){if(o&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,"Provider"),pl(),Ds(8,"th",10),NC(9,"API model name"),pl(),Ds(10,"th",10),NC(11,"Priority"),pl(),Ds(12,"th",10),NC(13,"Reasoning effort"),pl(),Ds(14,"th",10)(15,"span",11),NC(16,"Actions"),pl()()()(),Ds(17,"tbody",8),Hw(18,O,15,9,"tr",9,K),pl()()()),o&2){let e=Jw();BE(18),Uw(e.rowFilter.filteredRows());}}var j=class o{router=g(F);destroyRef=g(Ie);aiModelController=g(k);aiProviderController=g(F$1);refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k$1();rows=Ui([]);rowFilter=O$1(this.rows,t=>[t.title,t.model.apiModelName,t.providerName].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),wy([this.aiModelController.listPlatformLevelAiModel(),this.aiProviderController.listAiProvider("none")]))),U$1(this.destroyRef)).subscribe({next:([t,e])=>{let a=new Map(e.map(r=>[r.id??"",r.name]));this.rows.set(t.map((r,m)=>({key:r.id??`model:${m}`,model:r,title:r.alias??r.apiModelName,providerName:a.get(r.aiProviderId)??r.aiProviderId}))),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","ai-models","new"]);}edit(t){t.model.id&&this.router.navigate(["/agentos","admin","ai-models",t.model.id,"edit"]);}confirmDelete(t){t.model.id&&this.deletion.execute(t.key,{request$:this.aiModelController.deleteAiModel(t.model.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${t.title}" failed. Try again.`});}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=yw({type:o,selectors:[["agentos-platform-ai-models"]],decls:9,vars:3,consts:[["title","Platform AI models","description","AI models shared across every namespace."],["label","Filter AI models","placeholder","Filter AI models\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 models"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Provider"],["role","cell","data-label","API model name",1,"settings-table__secondary"],["role","cell","data-label","Priority"],["role","cell","data-label","Reasoning effort"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(e,a){e&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return a.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return a.openCreateForm()}),NC(3,"New AI model"),pl()(),Lw(4,H,2,1,"p",3),Lw(5,U,2,0,"p",4)(6,z,2,0,"p",5)(7,G,2,0,"p",4)(8,Q,20,0,"div",6)),e&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,P,P$1],encapsulation:2})};export{j as PlatformAiModelsComponent};
@@ -1 +1 @@
1
- import {e}from'./chunk-C6dIhkYp.js';import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-BiYZtMHe.js';import {O}from'./chunk-BYeNpjs5.js';import {g,W as W$1,F,I as Ie,E as J,U as Ui,G as U$1,ad as ne$1,a1 as fa,aa as Tr,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,P as ug,a as BE,j as jw,J as Jw,O as Og,H as Hw,m as Uw,v as vl,Z as Zw,k as cg,r as df,s as ff}from'./main-FJXP2G5I.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'./chunk-B5eEl07l.js';var Q=(n,e)=>e.key;function W(n,e){if(n&1&&(Ds(0,"p",3),NC(1),pl()),n&2){let t=Jw();BE(),Og(t.deletion.error());}}function X(n,e){n&1&&(Ds(0,"p",4),NC(1,"Loading integrations\u2026"),pl());}function Z(n,e){n&1&&(Ds(0,"p",5),NC(1,"No integrations available."),pl());}function ee(n,e){n&1&&(Ds(0,"p",4),NC(1,"No integrations match the current filter."),pl());}function te(n,e){n&1&&(Ds(0,"ds-tag",20),NC(1,"YAML"),pl(),Ds(2,"ds-tag",21),NC(3,"Read-only"),pl());}function ne(n,e){if(n&1){let t=Zw();Ds(0,"button",22),mg("click",function(){df(t);let s=Jw().$implicit,c=Jw(2);return ff(c.view(s))}),NC(1,"View"),pl();}if(n&2){let t=Jw().$implicit;cg("aria-label","View "+t.config.name);}}function ie(n,e){if(n&1){let t=Zw();Ds(0,"button",22),mg("click",function(){df(t);let s=Jw(3).$implicit,c=Jw(2);return ff(c.edit(s))}),NC(1," Edit "),pl();}if(n&2){let t=Jw(3).$implicit;cg("aria-label","Edit "+t.config.name);}}function oe(n,e){if(n&1){let t=Zw();Ds(0,"button",22),mg("click",function(){df(t);let s=Jw(2).$implicit,c=Jw(2);return ff(c.duplicate(s))}),NC(1," Duplicate "),pl(),Lw(2,ie,2,1,"button",19);}if(n&2){let t=Jw(2).$implicit;cg("aria-label","Duplicate "+t.config.name),BE(2),jw(t.canEdit?2:-1);}}function ae(n,e){if(n&1){let t=Zw();Ds(0,"agentos-row-delete-action",25),mg("deleteRequested",function(){df(t);let s=Jw(2).$implicit,c=Jw(2);return ff(c.deletion.request(s.key))})("deleteConfirmed",function(){df(t);let s=Jw(2).$implicit,c=Jw(2);return ff(c.confirmDelete(s))})("deleteCancelled",function(){df(t);let s=Jw(4);return ff(s.deletion.cancel())}),pl();}if(n&2){let t=Jw(2).$implicit,a=Jw(2);ug("rowKey",t.key)("rowLabel",t.config.name)("state",a.deletion);}}function re(n,e){n&1&&(Ds(0,"button",24),NC(1,"Inherited"),pl());}function le(n,e){if(n&1&&(Lw(0,oe,3,2),Lw(1,ae,1,3,"agentos-row-delete-action",23),Lw(2,re,2,0,"button",24)),n&2){let t=Jw().$implicit,a=Jw(2);jw(a.deletion.confirmingId()!==t.key?0:-1),BE(),jw(t.canDelete?1:-1),BE(),jw(!t.canEdit&&!t.canDelete?2:-1);}}function se(n,e){if(n&1&&(Ds(0,"tr",9)(1,"td",12),NC(2),pl(),Ds(3,"td",13),NC(4),pl(),Ds(5,"td",14)(6,"div",15)(7,"ds-tag",16),NC(8),pl(),Lw(9,te,4,0),pl()(),Ds(10,"td",17)(11,"div",18),Lw(12,ne,2,1,"button",19)(13,le,3,3),pl()()()),n&2){let t=e.$implicit;BE(2),Og(t.config.name),BE(2),vl(" ",t.config.integrationType," "),BE(3),ug("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),BE(),vl(" ",t.scopeLabel," "),BE(),jw(t.source==="FILESYSTEM"?9:-1),BE(3),jw(t.source==="FILESYSTEM"?12:13);}}function ce(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,"Type"),pl(),Ds(8,"th",10),NC(9,"Scope"),pl(),Ds(10,"th",10)(11,"span",11),NC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Hw(14,se,14,6,"tr",9,Q),pl()()()),n&2){let t=Jw();BE(14),Uw(t.rowFilter.filteredRows());}}var U=class n$1{route=g(W$1);router=g(F);destroyRef=g(Ie);state=g(O);namespaceRole=g(v);namespaceApi=g(J);namespaceId=this.route.snapshot.params.namespaceId;namespaceName=Ui("this namespace");isAdmin=Ui(false);isLoading=Ui(true);rows=Ui([]);deletion=k();rowFilter=O$1(this.rows,e=>[e.config.name,e.config.integrationType,e.scopeLabel,e.source].join(" "));ngOnInit(){this.state.setNamespace(this.namespaceId),this.namespaceId&&this.namespaceApi.getByIdNamespace(this.namespaceId).pipe(U$1(this.destroyRef)).subscribe({next:e=>this.namespaceName.set(e.name)}),this.route.paramMap.pipe(ne$1(e=>e.get("namespaceId")??""),fa(e=>e?this.namespaceRole.isAdminOfNamespace$(e):Tr(false)),U$1(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.rows.set(this.toRows(e)),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:n(this.isAdmin())}});}view(e){e.config.id&&this.router.navigate(["/agentos",this.namespaceId,"integrations",e.config.id,"view"]);}edit(e){!e.canEdit||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"integrations",e.config.id,"edit"],{queryParams:{scope:e.scope}});}duplicate(e){if(e.source==="FILESYSTEM"||!e.config.id)return;let a=(e.scope==="platform"||e.scope==="namespace")&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:a,template:e.config.id,templateScope:e.scope}});}confirmDelete(e){!e.canDelete||!e.config.id||this.deletion.execute(e.key,{request$:this.state.delete(e.config.id,e.scope).pipe(U$1(this.destroyRef)),errorMessage:`Deleting "${e.config.name}" failed. Try again.`});}toRows(e){return [...this.mapScope(e.platform,"platform","Platform",true),...this.mapScope(e.namespace,"namespace","Namespace",!this.isAdmin()),...this.mapScope(e.userOnNs,"userOnNs","Personal",false),...this.mapScope(e.userGlobal,"userGlobal","Personal",false)]}mapScope(e$1,t,a,s){return e$1.map((c,z)=>{let h=e(c),w=h==="NEO4J"&&!s;return {key:`${t}:${c.id??z}`,config:c,scope:t,scopeLabel:a,source:h,canEdit:w,canDelete:w}})}static \u0275fac=function(t){return new(t||n$1)};static \u0275cmp=yw({type:n$1,selectors:[["agentos-integrations-all-scopes"]],decls:9,vars:4,consts:[["title","Integrations",3,"description"],["label","Filter integrations","placeholder","Filter integrations\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Integrations"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Type",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["variant","neutral"],["variant","outline"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button","disabled",""],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,a){t&1&&(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 integration"),pl()(),Lw(4,W,2,1,"p",3),Lw(5,X,2,0,"p",4)(6,Z,2,0,"p",5)(7,ee,2,0,"p",4)(8,ce,16,0,"div",6)),t&2&&(ug("description","Integrations for "+a.namespaceName()+", including entries inherited from the platform."),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{U as IntegrationsAllScopesComponent};
1
+ import {e}from'./chunk-C6dIhkYp.js';import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-2O1S906W.js';import {O}from'./chunk-DueFkMuu.js';import {g,W as W$1,F,I as Ie,E as J,U as Ui,G as U$1,ad as ne$1,a1 as fa,aa as Tr,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,P as ug,a as BE,j as jw,J as Jw,O as Og,H as Hw,m as Uw,v as vl,Z as Zw,k as cg,r as df,s as ff}from'./main-BGDYOJBA.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'./chunk-AYvnGrVn.js';var Q=(n,e)=>e.key;function W(n,e){if(n&1&&(Ds(0,"p",3),NC(1),pl()),n&2){let t=Jw();BE(),Og(t.deletion.error());}}function X(n,e){n&1&&(Ds(0,"p",4),NC(1,"Loading integrations\u2026"),pl());}function Z(n,e){n&1&&(Ds(0,"p",5),NC(1,"No integrations available."),pl());}function ee(n,e){n&1&&(Ds(0,"p",4),NC(1,"No integrations match the current filter."),pl());}function te(n,e){n&1&&(Ds(0,"ds-tag",20),NC(1,"YAML"),pl(),Ds(2,"ds-tag",21),NC(3,"Read-only"),pl());}function ne(n,e){if(n&1){let t=Zw();Ds(0,"button",22),mg("click",function(){df(t);let s=Jw().$implicit,c=Jw(2);return ff(c.view(s))}),NC(1,"View"),pl();}if(n&2){let t=Jw().$implicit;cg("aria-label","View "+t.config.name);}}function ie(n,e){if(n&1){let t=Zw();Ds(0,"button",22),mg("click",function(){df(t);let s=Jw(3).$implicit,c=Jw(2);return ff(c.edit(s))}),NC(1," Edit "),pl();}if(n&2){let t=Jw(3).$implicit;cg("aria-label","Edit "+t.config.name);}}function oe(n,e){if(n&1){let t=Zw();Ds(0,"button",22),mg("click",function(){df(t);let s=Jw(2).$implicit,c=Jw(2);return ff(c.duplicate(s))}),NC(1," Duplicate "),pl(),Lw(2,ie,2,1,"button",19);}if(n&2){let t=Jw(2).$implicit;cg("aria-label","Duplicate "+t.config.name),BE(2),jw(t.canEdit?2:-1);}}function ae(n,e){if(n&1){let t=Zw();Ds(0,"agentos-row-delete-action",25),mg("deleteRequested",function(){df(t);let s=Jw(2).$implicit,c=Jw(2);return ff(c.deletion.request(s.key))})("deleteConfirmed",function(){df(t);let s=Jw(2).$implicit,c=Jw(2);return ff(c.confirmDelete(s))})("deleteCancelled",function(){df(t);let s=Jw(4);return ff(s.deletion.cancel())}),pl();}if(n&2){let t=Jw(2).$implicit,a=Jw(2);ug("rowKey",t.key)("rowLabel",t.config.name)("state",a.deletion);}}function re(n,e){n&1&&(Ds(0,"button",24),NC(1,"Inherited"),pl());}function le(n,e){if(n&1&&(Lw(0,oe,3,2),Lw(1,ae,1,3,"agentos-row-delete-action",23),Lw(2,re,2,0,"button",24)),n&2){let t=Jw().$implicit,a=Jw(2);jw(a.deletion.confirmingId()!==t.key?0:-1),BE(),jw(t.canDelete?1:-1),BE(),jw(!t.canEdit&&!t.canDelete?2:-1);}}function se(n,e){if(n&1&&(Ds(0,"tr",9)(1,"td",12),NC(2),pl(),Ds(3,"td",13),NC(4),pl(),Ds(5,"td",14)(6,"div",15)(7,"ds-tag",16),NC(8),pl(),Lw(9,te,4,0),pl()(),Ds(10,"td",17)(11,"div",18),Lw(12,ne,2,1,"button",19)(13,le,3,3),pl()()()),n&2){let t=e.$implicit;BE(2),Og(t.config.name),BE(2),vl(" ",t.config.integrationType," "),BE(3),ug("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),BE(),vl(" ",t.scopeLabel," "),BE(),jw(t.source==="FILESYSTEM"?9:-1),BE(3),jw(t.source==="FILESYSTEM"?12:13);}}function ce(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,"Type"),pl(),Ds(8,"th",10),NC(9,"Scope"),pl(),Ds(10,"th",10)(11,"span",11),NC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Hw(14,se,14,6,"tr",9,Q),pl()()()),n&2){let t=Jw();BE(14),Uw(t.rowFilter.filteredRows());}}var U=class n$1{route=g(W$1);router=g(F);destroyRef=g(Ie);state=g(O);namespaceRole=g(v);namespaceApi=g(J);namespaceId=this.route.snapshot.params.namespaceId;namespaceName=Ui("this namespace");isAdmin=Ui(false);isLoading=Ui(true);rows=Ui([]);deletion=k();rowFilter=O$1(this.rows,e=>[e.config.name,e.config.integrationType,e.scopeLabel,e.source].join(" "));ngOnInit(){this.state.setNamespace(this.namespaceId),this.namespaceId&&this.namespaceApi.getByIdNamespace(this.namespaceId).pipe(U$1(this.destroyRef)).subscribe({next:e=>this.namespaceName.set(e.name)}),this.route.paramMap.pipe(ne$1(e=>e.get("namespaceId")??""),fa(e=>e?this.namespaceRole.isAdminOfNamespace$(e):Tr(false)),U$1(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.rows.set(this.toRows(e)),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:n(this.isAdmin())}});}view(e){e.config.id&&this.router.navigate(["/agentos",this.namespaceId,"integrations",e.config.id,"view"]);}edit(e){!e.canEdit||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"integrations",e.config.id,"edit"],{queryParams:{scope:e.scope}});}duplicate(e){if(e.source==="FILESYSTEM"||!e.config.id)return;let a=(e.scope==="platform"||e.scope==="namespace")&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:a,template:e.config.id,templateScope:e.scope}});}confirmDelete(e){!e.canDelete||!e.config.id||this.deletion.execute(e.key,{request$:this.state.delete(e.config.id,e.scope).pipe(U$1(this.destroyRef)),errorMessage:`Deleting "${e.config.name}" failed. Try again.`});}toRows(e){return [...this.mapScope(e.platform,"platform","Platform",true),...this.mapScope(e.namespace,"namespace","Namespace",!this.isAdmin()),...this.mapScope(e.userOnNs,"userOnNs","Personal",false),...this.mapScope(e.userGlobal,"userGlobal","Personal",false)]}mapScope(e$1,t,a,s){return e$1.map((c,z)=>{let h=e(c),w=h==="NEO4J"&&!s;return {key:`${t}:${c.id??z}`,config:c,scope:t,scopeLabel:a,source:h,canEdit:w,canDelete:w}})}static \u0275fac=function(t){return new(t||n$1)};static \u0275cmp=yw({type:n$1,selectors:[["agentos-integrations-all-scopes"]],decls:9,vars:4,consts:[["title","Integrations",3,"description"],["label","Filter integrations","placeholder","Filter integrations\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Integrations"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Type",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["variant","neutral"],["variant","outline"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button","disabled",""],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,a){t&1&&(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 integration"),pl()(),Lw(4,W,2,1,"p",3),Lw(5,X,2,0,"p",4)(6,Z,2,0,"p",5)(7,ee,2,0,"p",4)(8,ce,16,0,"div",6)),t&2&&(ug("description","Integrations for "+a.namespaceName()+", including entries inherited from the platform."),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{U as IntegrationsAllScopesComponent};
@@ -1 +1 @@
1
- import {s}from'./chunk-D2BTEyR1.js';import {g,W,z as Xm,C as y,y as yw,b as hl,N as NC,d as gl,a as BE,O as Og}from'./main-FJXP2G5I.js';var A=class r{route=g(W);http=g(Xm);config=g(y);message="Authentication in progress\u2026";ngOnInit(){let e=this.route.snapshot.queryParamMap.get("code"),t=this.route.snapshot.queryParamMap.get("state"),o=this.route.snapshot.queryParamMap.get("error"),i=this.route.snapshot.queryParamMap.get("error_description");if(o){console.warn("[AgentOS OAuth Callback] OAuth error:",o,i),this.notifyParentAndClose({success:false,error:i||o});return}if(!e){console.error("[AgentOS OAuth Callback] Missing authorization code"),this.message="OAuth callback error: missing authorization code.",this.notifyParentAndClose({success:false,error:"Missing authorization code"});return}this.http.post(`${this.config.basePath}/api/oauth/callback`,{code:e,state:t}).subscribe({next:()=>{console.log("[AgentOS OAuth Callback] Backend callback resolved"),this.notifyParentAndClose({success:true});},error:a=>{console.error("[AgentOS OAuth Callback] Backend callback failed:",a),this.notifyParentAndClose({success:false,error:a?.error?.message||a?.message||"Token exchange failed"});}});}notifyParentAndClose(e){if(this.message=e.success?"Authentication complete. You can close this window.":`Authentication failed: ${e.error??"unknown error"}. You can close this window.`,window.opener)try{window.opener.postMessage(e,window.location.origin);}catch(t){console.error("[AgentOS OAuth Callback] postMessage failed:",t),localStorage.setItem(s,JSON.stringify(e));}else console.warn("[AgentOS OAuth Callback] No window.opener \u2014 localStorage fallback"),localStorage.setItem(s,JSON.stringify(e));setTimeout(()=>window.close(),1e3);}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=yw({type:r,selectors:[["agentos-oauth-callback"]],decls:2,vars:1,consts:[[2,"font-family","sans-serif","padding","2rem","text-align","center"]],template:function(t,o){t&1&&(hl(0,"p",0),NC(1),gl()),t&2&&(BE(),Og(o.message));},encapsulation:2,changeDetection:1})};export{A as OAuthCallbackComponent};
1
+ import {s}from'./chunk-DvqKcX7A.js';import {g,W,z as Xm,C as y,y as yw,b as hl,N as NC,d as gl,a as BE,O as Og}from'./main-BGDYOJBA.js';var A=class r{route=g(W);http=g(Xm);config=g(y);message="Authentication in progress\u2026";ngOnInit(){let e=this.route.snapshot.queryParamMap.get("code"),t=this.route.snapshot.queryParamMap.get("state"),o=this.route.snapshot.queryParamMap.get("error"),i=this.route.snapshot.queryParamMap.get("error_description");if(o){console.warn("[AgentOS OAuth Callback] OAuth error:",o,i),this.notifyParentAndClose({success:false,error:i||o});return}if(!e){console.error("[AgentOS OAuth Callback] Missing authorization code"),this.message="OAuth callback error: missing authorization code.",this.notifyParentAndClose({success:false,error:"Missing authorization code"});return}this.http.post(`${this.config.basePath}/api/oauth/callback`,{code:e,state:t}).subscribe({next:()=>{console.log("[AgentOS OAuth Callback] Backend callback resolved"),this.notifyParentAndClose({success:true});},error:a=>{console.error("[AgentOS OAuth Callback] Backend callback failed:",a),this.notifyParentAndClose({success:false,error:a?.error?.message||a?.message||"Token exchange failed"});}});}notifyParentAndClose(e){if(this.message=e.success?"Authentication complete. You can close this window.":`Authentication failed: ${e.error??"unknown error"}. You can close this window.`,window.opener)try{window.opener.postMessage(e,window.location.origin);}catch(t){console.error("[AgentOS OAuth Callback] postMessage failed:",t),localStorage.setItem(s,JSON.stringify(e));}else console.warn("[AgentOS OAuth Callback] No window.opener \u2014 localStorage fallback"),localStorage.setItem(s,JSON.stringify(e));setTimeout(()=>window.close(),1e3);}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=yw({type:r,selectors:[["agentos-oauth-callback"]],decls:2,vars:1,consts:[[2,"font-family","sans-serif","padding","2rem","text-align","center"]],template:function(t,o){t&1&&(hl(0,"p",0),NC(1),gl()),t&2&&(BE(),Og(o.message));},encapsulation:2,changeDetection:1})};export{A as OAuthCallbackComponent};
@@ -1 +1 @@
1
- import {c}from'./chunk-BldpQhN_.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,W,F,I as Ie,U as Ui,ac as Ty,a2 as da,aa as Tr,G as U,M as x,K as w,ai as Ne,al as De,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,r as df,s as ff,k as cg}from'./main-FJXP2G5I.js';var J=(n,t)=>t.key;function O(n,t){if(n&1&&(Ds(0,"p",3),NC(1),pl()),n&2){let e=Jw();BE(),Og(e.deletion.error());}}function Y(n,t){n&1&&(Ds(0,"p",4),NC(1,"Loading scheduled prompts\u2026"),pl());}function z(n,t){n&1&&(Ds(0,"p",5),NC(1,"No scheduled prompts available."),pl());}function G(n,t){n&1&&(Ds(0,"p",4),NC(1,"No scheduled prompts match the current filter."),pl());}function Q(n,t){if(n&1&&(Ds(0,"span",14),NC(1),pl()),n&2){let e=Jw().$implicit;BE(),Og(e.prompt.description);}}function X(n,t){n&1&&(Ds(0,"ds-tag",20),NC(1,"Read-only"),pl());}function Z(n,t){if(n&1){let e=Zw();Ds(0,"button",25),mg("click",function(){df(e);let l=Jw(2).$implicit,p=Jw(2);return ff(p.toggle(l))}),NC(1),pl(),Ds(2,"button",25),mg("click",function(){df(e);let l=Jw(2).$implicit,p=Jw(2);return ff(p.edit(l))}),NC(3," Edit "),pl();}if(n&2){let e=Jw(2).$implicit;BE(),Og(e.prompt.enabled?"Disable":"Enable"),BE(),cg("aria-label","Edit "+e.prompt.name);}}function ee(n,t){if(n&1){let e=Zw();Lw(0,Z,4,2),Ds(1,"agentos-row-delete-action",24),mg("deleteRequested",function(){df(e);let l=Jw().$implicit,p=Jw(2);return ff(p.deletion.request(l.key))})("deleteConfirmed",function(){df(e);let l=Jw().$implicit,p=Jw(2);return ff(p.confirmDelete(l))})("deleteCancelled",function(){df(e);let l=Jw(3);return ff(l.deletion.cancel())}),pl();}if(n&2){let e=Jw().$implicit,i=Jw(2);jw(i.deletion.confirmingId()!==e.key?0:-1),BE(),ug("rowKey",e.key)("rowLabel",e.prompt.name)("state",i.deletion);}}function te(n,t){n&1&&(Ds(0,"button",23),NC(1,"Inherited"),pl());}function ne(n,t){if(n&1&&(Ds(0,"tr",9)(1,"td",12)(2,"span",13),NC(3),pl(),Lw(4,Q,2,1,"span",14),pl(),Ds(5,"td",15),NC(6),pl(),Ds(7,"td",16)(8,"ds-tag",17),NC(9),pl()(),Ds(10,"td",18)(11,"div",19)(12,"ds-tag",17),NC(13),pl(),Lw(14,X,2,0,"ds-tag",20),pl()(),Ds(15,"td",21)(16,"div",22),Lw(17,ee,2,4)(18,te,2,0,"button",23),pl()()()),n&2){let e=t.$implicit,i=Jw(2);BE(3),Og(e.prompt.name),BE(),jw(e.prompt.description?4:-1),BE(2),Og(i.scheduleLabel(e.prompt)),BE(2),ug("variant",e.prompt.enabled?"accent":"outline"),BE(),Og(e.prompt.enabled?"Enabled":"Disabled"),BE(3),ug("variant",e.scope==="platform"?"neutral":"accent"),BE(),Og(e.scope==="platform"?"Platform":"Namespace"),BE(),jw(e.scope==="platform"?14:-1),BE(3),jw(e.scope==="namespace"?17:18);}}function ie(n,t){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,"Schedule"),pl(),Ds(8,"th",10),NC(9,"Status"),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,ne,19,9,"tr",9,J),pl()()()),n&2){let e=Jw();BE(16),Uw(e.rowFilter.filteredRows());}}var H=class n{route=g(W);router=g(F);destroyRef=g(Ie);state=g(c);namespaceId=this.route.snapshot.params.namespaceId;rows=Ui([]);isLoading=Ui(true);deletion=k();rowFilter=O$1(this.rows,t=>[t.prompt.name,t.prompt.description,this.scheduleLabel(t.prompt),t.prompt.enabled?"Enabled":"Disabled",t.scope].filter(Boolean).join(" "));constructor(){Ty({platform:this.state.listPlatform().pipe(da(()=>Tr([]))),namespace:this.state.listByNamespace(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({platform:t,namespace:e})=>{this.rows.set([...t.map((i,l)=>({key:`platform:${i.id??l}`,prompt:i,scope:"platform"})),...e.map((i,l)=>({key:`namespace:${i.id??l}`,prompt:i,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts","new"]);}edit(t){t.scope==="platform"||!t.prompt.id||this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts",t.prompt.id,"edit"]);}toggle(t){if(t.scope==="platform")return;(t.prompt.enabled?this.state.disable(t.prompt.id??""):this.state.enable(t.prompt.id??"")).pipe(U(this.destroyRef)).subscribe(i=>this.rows.update(l=>l.map(p=>p.key===t.key?x(w({},p),{prompt:i}):p)));}confirmDelete(t){t.scope==="platform"||!t.prompt.id||this.deletion.execute(t.key,{request$:this.state.delete(t.prompt.id).pipe(U(this.destroyRef)),onSuccess:()=>this.rows.update(e=>e.filter(i=>i.key!==t.key)),errorMessage:`Deleting "${t.prompt.name}" failed. Try again.`});}scheduleLabel(t){let e=t.recurrence,i=e.unit===Ne.WEEK?"week":"month",l=e.unit===Ne.WEEK&&e.days?.length?` (${e.days.map(p=>De[p]??p).join(", ")})`:"";return `Every ${i}${l} at ${e.timeUtc} UTC`}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=yw({type:n,selectors:[["agentos-scheduled-prompt-list"]],decls:9,vars:3,consts:[["title","Scheduled prompts","description","Scheduled prompts for this namespace, including schedules inherited from the platform."],["label","Filter scheduled prompts","placeholder","Filter scheduled prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Scheduled prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Schedule"],["role","cell","data-label","Status"],[3,"variant"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(e,i){e&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(p){return i.rowFilter.query.set(p)}),pl(),Ds(2,"button",2),mg("click",function(){return i.openCreateForm()}),NC(3,"New scheduled prompt"),pl()(),Lw(4,O,2,1,"p",3),Lw(5,Y,2,0,"p",4)(6,z,2,0,"p",5)(7,G,2,0,"p",4)(8,ie,18,0,"div",6)),e&2&&(BE(),ug("query",i.rowFilter.query()),BE(3),jw(i.deletion.error()?4:-1),BE(),jw(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{H as ScheduledPromptListComponent};
1
+ import {c}from'./chunk-D526Porz.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,W,F,I as Ie,U as Ui,ac as Ty,a2 as da,aa as Tr,G as U,M as x,K as w,ai as Ne,al as De,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,r as df,s as ff,k as cg}from'./main-BGDYOJBA.js';var J=(n,t)=>t.key;function O(n,t){if(n&1&&(Ds(0,"p",3),NC(1),pl()),n&2){let e=Jw();BE(),Og(e.deletion.error());}}function Y(n,t){n&1&&(Ds(0,"p",4),NC(1,"Loading scheduled prompts\u2026"),pl());}function z(n,t){n&1&&(Ds(0,"p",5),NC(1,"No scheduled prompts available."),pl());}function G(n,t){n&1&&(Ds(0,"p",4),NC(1,"No scheduled prompts match the current filter."),pl());}function Q(n,t){if(n&1&&(Ds(0,"span",14),NC(1),pl()),n&2){let e=Jw().$implicit;BE(),Og(e.prompt.description);}}function X(n,t){n&1&&(Ds(0,"ds-tag",20),NC(1,"Read-only"),pl());}function Z(n,t){if(n&1){let e=Zw();Ds(0,"button",25),mg("click",function(){df(e);let l=Jw(2).$implicit,p=Jw(2);return ff(p.toggle(l))}),NC(1),pl(),Ds(2,"button",25),mg("click",function(){df(e);let l=Jw(2).$implicit,p=Jw(2);return ff(p.edit(l))}),NC(3," Edit "),pl();}if(n&2){let e=Jw(2).$implicit;BE(),Og(e.prompt.enabled?"Disable":"Enable"),BE(),cg("aria-label","Edit "+e.prompt.name);}}function ee(n,t){if(n&1){let e=Zw();Lw(0,Z,4,2),Ds(1,"agentos-row-delete-action",24),mg("deleteRequested",function(){df(e);let l=Jw().$implicit,p=Jw(2);return ff(p.deletion.request(l.key))})("deleteConfirmed",function(){df(e);let l=Jw().$implicit,p=Jw(2);return ff(p.confirmDelete(l))})("deleteCancelled",function(){df(e);let l=Jw(3);return ff(l.deletion.cancel())}),pl();}if(n&2){let e=Jw().$implicit,i=Jw(2);jw(i.deletion.confirmingId()!==e.key?0:-1),BE(),ug("rowKey",e.key)("rowLabel",e.prompt.name)("state",i.deletion);}}function te(n,t){n&1&&(Ds(0,"button",23),NC(1,"Inherited"),pl());}function ne(n,t){if(n&1&&(Ds(0,"tr",9)(1,"td",12)(2,"span",13),NC(3),pl(),Lw(4,Q,2,1,"span",14),pl(),Ds(5,"td",15),NC(6),pl(),Ds(7,"td",16)(8,"ds-tag",17),NC(9),pl()(),Ds(10,"td",18)(11,"div",19)(12,"ds-tag",17),NC(13),pl(),Lw(14,X,2,0,"ds-tag",20),pl()(),Ds(15,"td",21)(16,"div",22),Lw(17,ee,2,4)(18,te,2,0,"button",23),pl()()()),n&2){let e=t.$implicit,i=Jw(2);BE(3),Og(e.prompt.name),BE(),jw(e.prompt.description?4:-1),BE(2),Og(i.scheduleLabel(e.prompt)),BE(2),ug("variant",e.prompt.enabled?"accent":"outline"),BE(),Og(e.prompt.enabled?"Enabled":"Disabled"),BE(3),ug("variant",e.scope==="platform"?"neutral":"accent"),BE(),Og(e.scope==="platform"?"Platform":"Namespace"),BE(),jw(e.scope==="platform"?14:-1),BE(3),jw(e.scope==="namespace"?17:18);}}function ie(n,t){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,"Schedule"),pl(),Ds(8,"th",10),NC(9,"Status"),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,ne,19,9,"tr",9,J),pl()()()),n&2){let e=Jw();BE(16),Uw(e.rowFilter.filteredRows());}}var H=class n{route=g(W);router=g(F);destroyRef=g(Ie);state=g(c);namespaceId=this.route.snapshot.params.namespaceId;rows=Ui([]);isLoading=Ui(true);deletion=k();rowFilter=O$1(this.rows,t=>[t.prompt.name,t.prompt.description,this.scheduleLabel(t.prompt),t.prompt.enabled?"Enabled":"Disabled",t.scope].filter(Boolean).join(" "));constructor(){Ty({platform:this.state.listPlatform().pipe(da(()=>Tr([]))),namespace:this.state.listByNamespace(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({platform:t,namespace:e})=>{this.rows.set([...t.map((i,l)=>({key:`platform:${i.id??l}`,prompt:i,scope:"platform"})),...e.map((i,l)=>({key:`namespace:${i.id??l}`,prompt:i,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts","new"]);}edit(t){t.scope==="platform"||!t.prompt.id||this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts",t.prompt.id,"edit"]);}toggle(t){if(t.scope==="platform")return;(t.prompt.enabled?this.state.disable(t.prompt.id??""):this.state.enable(t.prompt.id??"")).pipe(U(this.destroyRef)).subscribe(i=>this.rows.update(l=>l.map(p=>p.key===t.key?x(w({},p),{prompt:i}):p)));}confirmDelete(t){t.scope==="platform"||!t.prompt.id||this.deletion.execute(t.key,{request$:this.state.delete(t.prompt.id).pipe(U(this.destroyRef)),onSuccess:()=>this.rows.update(e=>e.filter(i=>i.key!==t.key)),errorMessage:`Deleting "${t.prompt.name}" failed. Try again.`});}scheduleLabel(t){let e=t.recurrence,i=e.unit===Ne.WEEK?"week":"month",l=e.unit===Ne.WEEK&&e.days?.length?` (${e.days.map(p=>De[p]??p).join(", ")})`:"";return `Every ${i}${l} at ${e.timeUtc} UTC`}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=yw({type:n,selectors:[["agentos-scheduled-prompt-list"]],decls:9,vars:3,consts:[["title","Scheduled prompts","description","Scheduled prompts for this namespace, including schedules inherited from the platform."],["label","Filter scheduled prompts","placeholder","Filter scheduled prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Scheduled prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Schedule"],["role","cell","data-label","Status"],[3,"variant"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(e,i){e&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(p){return i.rowFilter.query.set(p)}),pl(),Ds(2,"button",2),mg("click",function(){return i.openCreateForm()}),NC(3,"New scheduled prompt"),pl()(),Lw(4,O,2,1,"p",3),Lw(5,Y,2,0,"p",4)(6,z,2,0,"p",5)(7,G,2,0,"p",4)(8,ie,18,0,"div",6)),e&2&&(BE(),ug("query",i.rowFilter.query()),BE(3),jw(i.deletion.error()?4:-1),BE(),jw(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{H as ScheduledPromptListComponent};
@@ -1 +1 @@
1
- import {z as k$1,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 as W$1,F,I as Ie,aq as k,ap as F$1,$ as Cr,U as Ui,a1 as fa,ac as Ty,a2 as da,aa as Tr,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,Z as Zw,r as df,s as ff,k as cg}from'./main-FJXP2G5I.js';var G=(i,e)=>e.key;function Q(i,e){if(i&1&&(Ds(0,"p",3),NC(1),pl()),i&2){let t=Jw();BE(),Og(t.deletion.error());}}function W(i,e){i&1&&(Ds(0,"p",4),NC(1,"Loading AI models\u2026"),pl());}function X(i,e){i&1&&(Ds(0,"p",5),NC(1,"No AI models configured."),pl());}function Y(i,e){i&1&&(Ds(0,"p",4),NC(1,"No AI models match the current filter."),pl());}function Z(i,e){i&1&&(Ds(0,"ds-tag",18),NC(1,"Read-only"),pl());}function ee(i,e){if(i&1){let t=Zw();Ds(0,"button",24),mg("click",function(){df(t);let s=Jw(2).$implicit,m=Jw(2);return ff(m.edit(s))}),NC(1,"Edit"),pl();}if(i&2){let t=Jw(2).$implicit,n=Jw(2);cg("aria-label","Edit "+n.title(t));}}function te(i,e){if(i&1){let t=Zw();Lw(0,ee,2,1,"button",22),Ds(1,"agentos-row-delete-action",23),mg("deleteRequested",function(){df(t);let s=Jw().$implicit,m=Jw(2);return ff(m.deletion.request(s.key))})("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,n=Jw(2);jw(n.deletion.confirmingId()!==t.key?0:-1),BE(),ug("rowKey",t.key)("rowLabel",n.title(t))("state",n.deletion);}}function ie(i,e){i&1&&(Ds(0,"button",21),NC(1,"Inherited"),pl());}function ne(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)(9,"ds-tag",17),NC(10),pl(),Lw(11,Z,2,0,"ds-tag",18),pl()(),Ds(12,"td",19)(13,"div",20),Lw(14,te,2,4)(15,ie,2,0,"button",21),pl()()()),i&2){let t=e.$implicit,n=Jw(2);BE(2),Og(n.title(t)),BE(2),Og(t.providerName),BE(2),vl(" ",t.model.apiModelName," "),BE(3),ug("variant",t.scope==="platform"?"neutral":"accent"),BE(),Og(t.scope==="platform"?"Platform":"Namespace"),BE(),jw(t.scope==="platform"?11:-1),BE(3),jw(t.scope==="namespace"?14:15);}}function oe(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,"Provider"),pl(),Ds(8,"th",10),NC(9,"API model name"),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,ne,16,7,"tr",9,G),pl()()()),i&2){let t=Jw();BE(16),Uw(t.rowFilter.filteredRows());}}var z=class i{route=g(W$1);router=g(F);destroyRef=g(Ie);aiModelController=g(k);aiProviderController=g(F$1);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k$1();rows=Ui([]);rowFilter=O(this.rows,e=>[e.model.alias,e.model.apiModelName,e.providerName,e.scope].filter(Boolean).join(" "));data$=this.refresh$.pipe(fa(()=>(this.isLoading.set(true),Ty({namespace:this.aiModelController.listByNamespaceIdAiModel(this.namespaceId),platform:this.aiModelController.listPlatformLevelAiModel().pipe(da(()=>Tr([]))),providers:this.aiProviderController.listAiProvider(this.namespaceId)}).pipe(fa(({namespace:e,platform:t,providers:n})=>{let s=[...new Set([...t,...e].map(m=>m.aiProviderId))];return Ty({namespace:Tr(e),platform:Tr(t),providers:Tr(n),referencedProviders:this.aiProviderController.getByIdsAiProvider({ids:s,withRemoved:false}).pipe(da(()=>Tr([])))})})))));constructor(){this.data$.pipe(U(this.destroyRef)).subscribe({next:({namespace:e,platform:t,providers:n,referencedProviders:s})=>{let m=new Map([...s,...n].map(c=>[c.id??"",c.name]));this.rows.set([...t.map((c,g)=>({key:`platform:${c.id??g}`,model:c,providerName:m.get(c.aiProviderId)??c.aiProviderId,scope:"platform"})),...e.map((c,g)=>({key:`namespace:${c.id??g}`,model:c,providerName:m.get(c.aiProviderId)??c.aiProviderId,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-models","new"]);}edit(e){e.scope==="platform"||!e.model.id||this.router.navigate(["/agentos",this.namespaceId,"ai-models",e.model.id,"edit"]);}title(e){return e.model.alias??e.model.apiModelName}confirmDelete(e){e.scope==="platform"||!e.model.id||this.deletion.execute(e.key,{request$:this.aiModelController.deleteAiModel(e.model.id).pipe(U(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${this.title(e)}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-namespace-ai-models"]],decls:9,vars:3,consts:[["title","AI models","description","AI models configured for this namespace, including models inherited from the platform."],["label","Filter AI models","placeholder","Filter AI models\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","AI models"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Provider"],["role","cell","data-label","API model name",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(t,n){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return n.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return n.openCreateForm()}),NC(3,"New AI model"),pl()(),Lw(4,Q,2,1,"p",3),Lw(5,W,2,0,"p",4)(6,X,2,0,"p",5)(7,Y,2,0,"p",4)(8,oe,18,0,"div",6)),t&2&&(BE(),ug("query",n.rowFilter.query()),BE(3),jw(n.deletion.error()?4:-1),BE(),jw(n.isLoading()?5:n.rows().length===0?6:n.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{z as NamespaceAiModelsComponent};
1
+ import {z as k$1,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 as W$1,F,I as Ie,aq as k,ap as F$1,$ as Cr,U as Ui,a1 as fa,ac as Ty,a2 as da,aa as Tr,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,Z as Zw,r as df,s as ff,k as cg}from'./main-BGDYOJBA.js';var G=(i,e)=>e.key;function Q(i,e){if(i&1&&(Ds(0,"p",3),NC(1),pl()),i&2){let t=Jw();BE(),Og(t.deletion.error());}}function W(i,e){i&1&&(Ds(0,"p",4),NC(1,"Loading AI models\u2026"),pl());}function X(i,e){i&1&&(Ds(0,"p",5),NC(1,"No AI models configured."),pl());}function Y(i,e){i&1&&(Ds(0,"p",4),NC(1,"No AI models match the current filter."),pl());}function Z(i,e){i&1&&(Ds(0,"ds-tag",18),NC(1,"Read-only"),pl());}function ee(i,e){if(i&1){let t=Zw();Ds(0,"button",24),mg("click",function(){df(t);let s=Jw(2).$implicit,m=Jw(2);return ff(m.edit(s))}),NC(1,"Edit"),pl();}if(i&2){let t=Jw(2).$implicit,n=Jw(2);cg("aria-label","Edit "+n.title(t));}}function te(i,e){if(i&1){let t=Zw();Lw(0,ee,2,1,"button",22),Ds(1,"agentos-row-delete-action",23),mg("deleteRequested",function(){df(t);let s=Jw().$implicit,m=Jw(2);return ff(m.deletion.request(s.key))})("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,n=Jw(2);jw(n.deletion.confirmingId()!==t.key?0:-1),BE(),ug("rowKey",t.key)("rowLabel",n.title(t))("state",n.deletion);}}function ie(i,e){i&1&&(Ds(0,"button",21),NC(1,"Inherited"),pl());}function ne(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)(9,"ds-tag",17),NC(10),pl(),Lw(11,Z,2,0,"ds-tag",18),pl()(),Ds(12,"td",19)(13,"div",20),Lw(14,te,2,4)(15,ie,2,0,"button",21),pl()()()),i&2){let t=e.$implicit,n=Jw(2);BE(2),Og(n.title(t)),BE(2),Og(t.providerName),BE(2),vl(" ",t.model.apiModelName," "),BE(3),ug("variant",t.scope==="platform"?"neutral":"accent"),BE(),Og(t.scope==="platform"?"Platform":"Namespace"),BE(),jw(t.scope==="platform"?11:-1),BE(3),jw(t.scope==="namespace"?14:15);}}function oe(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,"Provider"),pl(),Ds(8,"th",10),NC(9,"API model name"),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,ne,16,7,"tr",9,G),pl()()()),i&2){let t=Jw();BE(16),Uw(t.rowFilter.filteredRows());}}var z=class i{route=g(W$1);router=g(F);destroyRef=g(Ie);aiModelController=g(k);aiProviderController=g(F$1);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k$1();rows=Ui([]);rowFilter=O(this.rows,e=>[e.model.alias,e.model.apiModelName,e.providerName,e.scope].filter(Boolean).join(" "));data$=this.refresh$.pipe(fa(()=>(this.isLoading.set(true),Ty({namespace:this.aiModelController.listByNamespaceIdAiModel(this.namespaceId),platform:this.aiModelController.listPlatformLevelAiModel().pipe(da(()=>Tr([]))),providers:this.aiProviderController.listAiProvider(this.namespaceId)}).pipe(fa(({namespace:e,platform:t,providers:n})=>{let s=[...new Set([...t,...e].map(m=>m.aiProviderId))];return Ty({namespace:Tr(e),platform:Tr(t),providers:Tr(n),referencedProviders:this.aiProviderController.getByIdsAiProvider({ids:s,withRemoved:false}).pipe(da(()=>Tr([])))})})))));constructor(){this.data$.pipe(U(this.destroyRef)).subscribe({next:({namespace:e,platform:t,providers:n,referencedProviders:s})=>{let m=new Map([...s,...n].map(c=>[c.id??"",c.name]));this.rows.set([...t.map((c,g)=>({key:`platform:${c.id??g}`,model:c,providerName:m.get(c.aiProviderId)??c.aiProviderId,scope:"platform"})),...e.map((c,g)=>({key:`namespace:${c.id??g}`,model:c,providerName:m.get(c.aiProviderId)??c.aiProviderId,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-models","new"]);}edit(e){e.scope==="platform"||!e.model.id||this.router.navigate(["/agentos",this.namespaceId,"ai-models",e.model.id,"edit"]);}title(e){return e.model.alias??e.model.apiModelName}confirmDelete(e){e.scope==="platform"||!e.model.id||this.deletion.execute(e.key,{request$:this.aiModelController.deleteAiModel(e.model.id).pipe(U(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${this.title(e)}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-namespace-ai-models"]],decls:9,vars:3,consts:[["title","AI models","description","AI models configured for this namespace, including models inherited from the platform."],["label","Filter AI models","placeholder","Filter AI models\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","AI models"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Provider"],["role","cell","data-label","API model name",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(t,n){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return n.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return n.openCreateForm()}),NC(3,"New AI model"),pl()(),Lw(4,Q,2,1,"p",3),Lw(5,W,2,0,"p",4)(6,X,2,0,"p",5)(7,Y,2,0,"p",4)(8,oe,18,0,"div",6)),t&2&&(BE(),ug("query",n.rowFilter.query()),BE(3),jw(n.deletion.error()?4:-1),BE(),jw(n.isLoading()?5:n.rows().length===0?6:n.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{z as NamespaceAiModelsComponent};
@@ -1 +1 @@
1
- import {D as m,p as pt,E as Bt,T as Te,a as fn,U as Ut,n as nd,l as bo,x as xo,L as Lt,G as Gt,m as mo,b as po,V as Vn,A as An,v as va,F as go,_ as _o,c as pn,h as hn,d as cn,r as ln,e as dn,C as mn,g as at,i as an}from'./chunk-D2BTEyR1.js';import {g,W,F,I as Ie,ag as U,U as Ui,G as U$1,a2 as da,aa as Tr,M as x,K as w,y as yw,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,v as vl,j as jw,Z as Zw,l as lg,_ as _I,H as Hw,am as Bw,J as Jw,R as NI,O as Og,m as Uw,k as cg,r as df,s as ff}from'./main-FJXP2G5I.js';var ce=(o,t)=>t.id;function ue(o,t){o&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function fe(o,t){if(o&1&&(Ds(0,"ds-form-field",20),lg(1,"input",22),pl()),o&2){let e=Jw(3);BE(),ug("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function ge(o,t){if(o&1&&(Ds(0,"option",24),NC(1),pl()),o&2){let e=t.$implicit;ug("ngValue",e.id),BE(),Og(e.name);}}function Ce(o,t){if(o&1&&(Ds(0,"ds-form-field",21)(1,"select",23)(2,"option",24),NC(3,"\u2014 None \u2014"),pl(),Hw(4,ge,2,2,"option",24,ce),pl(),_I(),pl()),o&2){let e=Jw(3);BE(),ug("formControl",e.agentConfigIdControl),NI(),BE(),ug("ngValue",null),BE(2),Uw(e.availableAgentConfigs());}}function ye(o,t){if(o&1&&Lw(0,fe,2,1,"ds-form-field",20)(1,Ce,6,2,"ds-form-field",21),o&2){let e=Jw(2);jw(e.isEditMode()&&e.agentConfigIdControl.value?0:e.isEditMode()?-1:1);}}function ve(o,t){o&1&&(Ds(0,"p",2),NC(1,"No parameters defined."),pl());}function he(o,t){if(o&1){let e=Zw();Ds(0,"div",11)(1,"div",25)(2,"ds-form-field",26),lg(3,"input",27),_I(),pl(),Ds(4,"ds-form-field",28),lg(5,"input",29),_I(),pl(),Ds(6,"ds-form-field",30),lg(7,"input",31),_I(),pl()(),Ds(8,"button",32),mg("click",function(){let d=df(e).$index,m=Jw(2);return ff(m.removeParameter(d))}),NC(9," \xD7 "),pl()();}if(o&2){let e=t.$implicit,r=t.$index;ug("formGroupName",r),BE(2),ug("controlId","param-name-"+r)("error",e.controls.name.invalid&&e.controls.name.touched?"Parameter name is required.":null),BE(),ug("id","param-name-"+r),NI(),BE(),ug("controlId","param-desc-"+r),BE(),ug("id","param-desc-"+r),NI(),BE(),ug("controlId","param-default-"+r),BE(),ug("id","param-default-"+r),NI();}}function _e(o,t){if(o&1){let e=Zw();Ds(0,"div",14)(1,"span",33),NC(2),pl(),Ds(3,"ds-form-field",34),lg(4,"textarea",35),_I(),pl(),Ds(5,"button",36),mg("click",function(){let d=df(e).$index,m=Jw(2);return ff(m.removeContentEntry(d))}),NC(6," \xD7 "),pl()();}if(o&2){let e=t.$implicit,r=t.$index,d=Jw(2);BE(2),Og(r+1),BE(),ug("error",e.invalid&&e.touched?"Content entry must not be blank.":null),BE(),ug("formControlName",r),cg("aria-label","Content entry "+(r+1)),NI(),BE(),ug("disabled",d.contentArray.length===1);}}function xe(o,t){if(o&1&&(Ds(0,"ds-notice"),NC(1),pl()),o&2){let e=Jw(2);BE(),Og(e.errorMessage());}}function be(o,t){if(o&1){let e=Zw();Ds(0,"button",37),mg("click",function(){df(e);let d=Jw(2);return ff(d.exportYaml())}),NC(1),pl();}if(o&2){let e=Jw(2);ug("disabled",e.isExporting()),BE(),vl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ee(o,t){if(o&1){let e=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let d=Jw();return ff(d.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),_I(),pl(),Ds(3,"ds-form-field",7),lg(4,"input",8),_I(),pl(),Lw(5,ye,2,1),Ds(6,"ds-fieldset",9)(7,"p",2),NC(8," Each parameter must have a name and a default value. Use "),Ds(9,"code"),NC(10),pl(),NC(11," in content entries to reference them. "),pl(),Ds(12,"div",10),Lw(13,ve,2,0,"p",2),Hw(14,he,10,8,"div",11,Bw),Ds(16,"div")(17,"button",12),mg("click",function(){df(e);let d=Jw();return ff(d.addParameter())}),NC(18,"+ Add parameter"),pl()()()(),Ds(19,"ds-fieldset",13)(20,"p",2),NC(21," Each content entry is a command. Use "),Ds(22,"code"),NC(23,"@AgentName"),pl(),NC(24," to target an agent, "),Ds(25,"code"),NC(26,"/promptName param1 param2"),pl(),NC(27," to call another prompt, and "),Ds(28,"code"),NC(29),pl(),NC(30," for parameter placeholders. "),pl(),Ds(31,"div",10),Hw(32,_e,7,5,"div",14,Bw),Ds(34,"div")(35,"button",12),mg("click",function(){df(e);let d=Jw();return ff(d.addContentEntry())}),NC(36,"+ Add content entry"),pl()()()(),Lw(37,xe,2,1,"ds-notice"),Ds(38,"ds-form-field",15),lg(39,"textarea",16),_I(),pl(),Ds(40,"ds-form-actions")(41,"button",17),NC(42),pl(),Lw(43,be,2,2,"button",18),Ds(44,"button",19),mg("click",function(){df(e);let d=Jw();return ff(d.cancel())}),NC(45,"Cancel"),pl()()();}if(o&2){let e=Jw();ug("formGroup",e.form),BE(),ug("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),BE(),ug("formControl",e.nameControl),NI(),BE(2),ug("formControl",e.descriptionControl),NI(),BE(),jw(e.availableAgentConfigs().length>0?5:-1),BE(5),Og(e.paramPlaceholderSyntax),BE(2),ug("formArrayName","parameters"),BE(),jw(e.parametersArray.length===0?13:-1),BE(),Uw(e.parametersArray.controls),BE(15),Og(e.paramPlaceholderSyntax),BE(2),ug("formArrayName","content"),BE(),Uw(e.contentArray.controls),BE(5),jw(e.errorMessage()?37:-1),BE(),ug("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),BE(),ug("formControl",e.externalMetadataJsonControl),NI(),BE(2),ug("disabled",e.form.invalid||e.isSubmitting()),BE(),vl(" ",e.isEditMode()?"Save changes":"Create"," "),BE(),jw(e.isEditMode()?43:-1);}}var pe=class o{route=g(W);router=g(F);destroyRef=g(Ie);promptState=g(m);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(null),agentConfigId:new Te(null),externalMetadataJson:new Te("",{nonNullable:true,validators:[Pe]}),content:new Bt([this.createContentControl()],{validators:[fn.required]}),parameters:new Bt([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);isExporting=Ui(false);errorMessage=Ui(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=Ui([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(true),this.loadPrompt(t)),this.isPlatformMode?this.loadPlatformAgentConfigs():this.namespaceId&&this.loadAgentConfigs(this.namespaceId);}loadPrompt(t){this.isLoading.set(true),this.promptState.getById(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadAgentConfigs(t){this.agentConfigController.listByParentAgentConfig(t).pipe(U$1(this.destroyRef),da(()=>Tr([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U$1(this.destroyRef),da(()=>Tr([]))).subscribe(t=>this.agentConfigs.set(t));}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(r=>this.contentArray.push(this.createContentControl(r))),this.parametersArray.clear(),(t.parameters??[]).forEach(r=>this.parametersArray.push(this.createParameterGroup(r))),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}createContentControl(t=""){return new Te(t,{nonNullable:true,validators:[fn.required,fn.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl());}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t);}createParameterGroup(t){return new pt({name:new Te(t?.name??"",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(t?.description??null),defaultValue:new Te(t?.defaultValue??"",{nonNullable:true,validators:[fn.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup());}removeParameter(t){this.parametersArray.removeAt(t);}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId,sourceLanguage:this.existingPrompt?.sourceLanguage??"en",name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(m=>m.value.trim()),parameters:this.parametersArray.controls.map(m=>({name:m.controls.name.value.trim(),description:m.controls.description.value?.trim()||void 0,defaultValue:m.controls.defaultValue.value.trim()}))});t||(e.agentConfigId=this.agentConfigIdControl.value||null);let r=this.externalMetadataJsonControl.value.trim();e.externalMetadata=r?JSON.parse(r):null;let d=t?this.promptState.update(this.existingPrompt.id,e):this.promptState.create(e);this.errorMessage.set(null),d.pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:m=>{this.isSubmitting.set(false),m.status===409?this.errorMessage.set(`A prompt named "${e.name}" already exists in this scope.`):m.status===400?this.errorMessage.set(m.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}exportYaml(){let t=this.existingPrompt?.id;!t||this.isExporting()||(this.isExporting.set(true),this.promptState.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let r=new Blob([e],{type:"application/yaml"}),d=URL.createObjectURL(r),m=document.createElement("a");m.href=d,m.download=`${this.existingPrompt?.name??"prompt"}.yaml`,m.click(),URL.revokeObjectURL(d),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"]);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=yw({type:o,selectors:[["agentos-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","prompt-name","required","",3,"error"],["dsControl","","id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",3,"formControl"],["label","Description","controlId","prompt-description"],["dsControl","","id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",3,"formControl"],["legend","Parameters","legendHint","Named placeholders used in content"],[1,"ds-stack",3,"formArrayName"],[1,"ds-panel","ds-inline","ds-inline--start",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["legend","Content","legendHint","Ordered list of text commands"],[1,"ds-inline","ds-inline--start"],["label","External Metadata","controlId","prompt-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["label","Agent Config","hint","Agent Config cannot be changed after creation."],["label","Agent Config","controlId","prompt-agent-config","hint","Optional. Links this prompt to an agent as a starter. Immutable after creation."],["dsControl","","type","text","readonly","",3,"value"],["dsControl","","id","prompt-agent-config",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-grow"],["label","Name","required","",3,"controlId","error"],["dsControl","","type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",3,"id"],["label","Description",3,"controlId"],["dsControl","","type","text","placeholder","Optional","formControlName","description","autocomplete","off",3,"id"],["label","Default value",3,"controlId"],["dsControl","","type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",3,"id"],["dsButton","","variant","icon-danger","type","button","title","Remove this parameter","aria-label","Remove this parameter",3,"click"],[1,"ds-index"],["grow","",3,"error"],["dsControl","","rows","4","placeholder","Enter a command\u2026",3,"formControlName"],["dsButton","","variant","icon-danger","type","button","title","Remove this entry","aria-label","Remove this entry",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,r){e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return r.cancel()}),NC(3),pl()(),Lw(4,ue,2,0,"p",2)(5,Ee,46,16,"form",3),pl()),e&2&&(BE(),ug("title",r.isEditMode()?"Edit prompt":"New prompt"),BE(2),vl(" \u2190 ",r.isPlatformMode?"Platform prompts":"Prompts"," "),BE(),jw(r.isLoading()?4:5));},dependencies:[Ut,nd,bo,xo,Lt,Gt,mo,po,Vn,An,va,go,_o,pn,hn,cn,ln,dn,mn,at,an],encapsulation:2})};function Pe(o){let t=o.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}export{pe as PromptFormComponent};
1
+ import {D as m,p as pt,E as Bt,T as Te,a as fn,U as Ut,n as nd,l as bo,x as xo,L as Lt,G as Gt,m as mo,b as po,V as Vn,A as An,v as va,F as go,_ as _o,c as pn,h as hn,d as cn,r as ln,e as dn,C as mn,g as at,i as an}from'./chunk-DvqKcX7A.js';import {g,W,F,I as Ie,ag as U,U as Ui,G as U$1,a2 as da,aa as Tr,M as x,K as w,y as yw,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,v as vl,j as jw,Z as Zw,l as lg,_ as _I,H as Hw,am as Bw,J as Jw,R as NI,O as Og,m as Uw,k as cg,r as df,s as ff}from'./main-BGDYOJBA.js';var ce=(o,t)=>t.id;function ue(o,t){o&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function fe(o,t){if(o&1&&(Ds(0,"ds-form-field",20),lg(1,"input",22),pl()),o&2){let e=Jw(3);BE(),ug("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function ge(o,t){if(o&1&&(Ds(0,"option",24),NC(1),pl()),o&2){let e=t.$implicit;ug("ngValue",e.id),BE(),Og(e.name);}}function Ce(o,t){if(o&1&&(Ds(0,"ds-form-field",21)(1,"select",23)(2,"option",24),NC(3,"\u2014 None \u2014"),pl(),Hw(4,ge,2,2,"option",24,ce),pl(),_I(),pl()),o&2){let e=Jw(3);BE(),ug("formControl",e.agentConfigIdControl),NI(),BE(),ug("ngValue",null),BE(2),Uw(e.availableAgentConfigs());}}function ye(o,t){if(o&1&&Lw(0,fe,2,1,"ds-form-field",20)(1,Ce,6,2,"ds-form-field",21),o&2){let e=Jw(2);jw(e.isEditMode()&&e.agentConfigIdControl.value?0:e.isEditMode()?-1:1);}}function ve(o,t){o&1&&(Ds(0,"p",2),NC(1,"No parameters defined."),pl());}function he(o,t){if(o&1){let e=Zw();Ds(0,"div",11)(1,"div",25)(2,"ds-form-field",26),lg(3,"input",27),_I(),pl(),Ds(4,"ds-form-field",28),lg(5,"input",29),_I(),pl(),Ds(6,"ds-form-field",30),lg(7,"input",31),_I(),pl()(),Ds(8,"button",32),mg("click",function(){let d=df(e).$index,m=Jw(2);return ff(m.removeParameter(d))}),NC(9," \xD7 "),pl()();}if(o&2){let e=t.$implicit,r=t.$index;ug("formGroupName",r),BE(2),ug("controlId","param-name-"+r)("error",e.controls.name.invalid&&e.controls.name.touched?"Parameter name is required.":null),BE(),ug("id","param-name-"+r),NI(),BE(),ug("controlId","param-desc-"+r),BE(),ug("id","param-desc-"+r),NI(),BE(),ug("controlId","param-default-"+r),BE(),ug("id","param-default-"+r),NI();}}function _e(o,t){if(o&1){let e=Zw();Ds(0,"div",14)(1,"span",33),NC(2),pl(),Ds(3,"ds-form-field",34),lg(4,"textarea",35),_I(),pl(),Ds(5,"button",36),mg("click",function(){let d=df(e).$index,m=Jw(2);return ff(m.removeContentEntry(d))}),NC(6," \xD7 "),pl()();}if(o&2){let e=t.$implicit,r=t.$index,d=Jw(2);BE(2),Og(r+1),BE(),ug("error",e.invalid&&e.touched?"Content entry must not be blank.":null),BE(),ug("formControlName",r),cg("aria-label","Content entry "+(r+1)),NI(),BE(),ug("disabled",d.contentArray.length===1);}}function xe(o,t){if(o&1&&(Ds(0,"ds-notice"),NC(1),pl()),o&2){let e=Jw(2);BE(),Og(e.errorMessage());}}function be(o,t){if(o&1){let e=Zw();Ds(0,"button",37),mg("click",function(){df(e);let d=Jw(2);return ff(d.exportYaml())}),NC(1),pl();}if(o&2){let e=Jw(2);ug("disabled",e.isExporting()),BE(),vl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ee(o,t){if(o&1){let e=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let d=Jw();return ff(d.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),_I(),pl(),Ds(3,"ds-form-field",7),lg(4,"input",8),_I(),pl(),Lw(5,ye,2,1),Ds(6,"ds-fieldset",9)(7,"p",2),NC(8," Each parameter must have a name and a default value. Use "),Ds(9,"code"),NC(10),pl(),NC(11," in content entries to reference them. "),pl(),Ds(12,"div",10),Lw(13,ve,2,0,"p",2),Hw(14,he,10,8,"div",11,Bw),Ds(16,"div")(17,"button",12),mg("click",function(){df(e);let d=Jw();return ff(d.addParameter())}),NC(18,"+ Add parameter"),pl()()()(),Ds(19,"ds-fieldset",13)(20,"p",2),NC(21," Each content entry is a command. Use "),Ds(22,"code"),NC(23,"@AgentName"),pl(),NC(24," to target an agent, "),Ds(25,"code"),NC(26,"/promptName param1 param2"),pl(),NC(27," to call another prompt, and "),Ds(28,"code"),NC(29),pl(),NC(30," for parameter placeholders. "),pl(),Ds(31,"div",10),Hw(32,_e,7,5,"div",14,Bw),Ds(34,"div")(35,"button",12),mg("click",function(){df(e);let d=Jw();return ff(d.addContentEntry())}),NC(36,"+ Add content entry"),pl()()()(),Lw(37,xe,2,1,"ds-notice"),Ds(38,"ds-form-field",15),lg(39,"textarea",16),_I(),pl(),Ds(40,"ds-form-actions")(41,"button",17),NC(42),pl(),Lw(43,be,2,2,"button",18),Ds(44,"button",19),mg("click",function(){df(e);let d=Jw();return ff(d.cancel())}),NC(45,"Cancel"),pl()()();}if(o&2){let e=Jw();ug("formGroup",e.form),BE(),ug("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),BE(),ug("formControl",e.nameControl),NI(),BE(2),ug("formControl",e.descriptionControl),NI(),BE(),jw(e.availableAgentConfigs().length>0?5:-1),BE(5),Og(e.paramPlaceholderSyntax),BE(2),ug("formArrayName","parameters"),BE(),jw(e.parametersArray.length===0?13:-1),BE(),Uw(e.parametersArray.controls),BE(15),Og(e.paramPlaceholderSyntax),BE(2),ug("formArrayName","content"),BE(),Uw(e.contentArray.controls),BE(5),jw(e.errorMessage()?37:-1),BE(),ug("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),BE(),ug("formControl",e.externalMetadataJsonControl),NI(),BE(2),ug("disabled",e.form.invalid||e.isSubmitting()),BE(),vl(" ",e.isEditMode()?"Save changes":"Create"," "),BE(),jw(e.isEditMode()?43:-1);}}var pe=class o{route=g(W);router=g(F);destroyRef=g(Ie);promptState=g(m);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(null),agentConfigId:new Te(null),externalMetadataJson:new Te("",{nonNullable:true,validators:[Pe]}),content:new Bt([this.createContentControl()],{validators:[fn.required]}),parameters:new Bt([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);isExporting=Ui(false);errorMessage=Ui(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=Ui([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(true),this.loadPrompt(t)),this.isPlatformMode?this.loadPlatformAgentConfigs():this.namespaceId&&this.loadAgentConfigs(this.namespaceId);}loadPrompt(t){this.isLoading.set(true),this.promptState.getById(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadAgentConfigs(t){this.agentConfigController.listByParentAgentConfig(t).pipe(U$1(this.destroyRef),da(()=>Tr([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U$1(this.destroyRef),da(()=>Tr([]))).subscribe(t=>this.agentConfigs.set(t));}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(r=>this.contentArray.push(this.createContentControl(r))),this.parametersArray.clear(),(t.parameters??[]).forEach(r=>this.parametersArray.push(this.createParameterGroup(r))),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}createContentControl(t=""){return new Te(t,{nonNullable:true,validators:[fn.required,fn.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl());}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t);}createParameterGroup(t){return new pt({name:new Te(t?.name??"",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(t?.description??null),defaultValue:new Te(t?.defaultValue??"",{nonNullable:true,validators:[fn.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup());}removeParameter(t){this.parametersArray.removeAt(t);}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId,sourceLanguage:this.existingPrompt?.sourceLanguage??"en",name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(m=>m.value.trim()),parameters:this.parametersArray.controls.map(m=>({name:m.controls.name.value.trim(),description:m.controls.description.value?.trim()||void 0,defaultValue:m.controls.defaultValue.value.trim()}))});t||(e.agentConfigId=this.agentConfigIdControl.value||null);let r=this.externalMetadataJsonControl.value.trim();e.externalMetadata=r?JSON.parse(r):null;let d=t?this.promptState.update(this.existingPrompt.id,e):this.promptState.create(e);this.errorMessage.set(null),d.pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:m=>{this.isSubmitting.set(false),m.status===409?this.errorMessage.set(`A prompt named "${e.name}" already exists in this scope.`):m.status===400?this.errorMessage.set(m.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}exportYaml(){let t=this.existingPrompt?.id;!t||this.isExporting()||(this.isExporting.set(true),this.promptState.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let r=new Blob([e],{type:"application/yaml"}),d=URL.createObjectURL(r),m=document.createElement("a");m.href=d,m.download=`${this.existingPrompt?.name??"prompt"}.yaml`,m.click(),URL.revokeObjectURL(d),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"]);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=yw({type:o,selectors:[["agentos-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","prompt-name","required","",3,"error"],["dsControl","","id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",3,"formControl"],["label","Description","controlId","prompt-description"],["dsControl","","id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",3,"formControl"],["legend","Parameters","legendHint","Named placeholders used in content"],[1,"ds-stack",3,"formArrayName"],[1,"ds-panel","ds-inline","ds-inline--start",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["legend","Content","legendHint","Ordered list of text commands"],[1,"ds-inline","ds-inline--start"],["label","External Metadata","controlId","prompt-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["label","Agent Config","hint","Agent Config cannot be changed after creation."],["label","Agent Config","controlId","prompt-agent-config","hint","Optional. Links this prompt to an agent as a starter. Immutable after creation."],["dsControl","","type","text","readonly","",3,"value"],["dsControl","","id","prompt-agent-config",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-grow"],["label","Name","required","",3,"controlId","error"],["dsControl","","type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",3,"id"],["label","Description",3,"controlId"],["dsControl","","type","text","placeholder","Optional","formControlName","description","autocomplete","off",3,"id"],["label","Default value",3,"controlId"],["dsControl","","type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",3,"id"],["dsButton","","variant","icon-danger","type","button","title","Remove this parameter","aria-label","Remove this parameter",3,"click"],[1,"ds-index"],["grow","",3,"error"],["dsControl","","rows","4","placeholder","Enter a command\u2026",3,"formControlName"],["dsButton","","variant","icon-danger","type","button","title","Remove this entry","aria-label","Remove this entry",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,r){e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return r.cancel()}),NC(3),pl()(),Lw(4,ue,2,0,"p",2)(5,Ee,46,16,"form",3),pl()),e&2&&(BE(),ug("title",r.isEditMode()?"Edit prompt":"New prompt"),BE(2),vl(" \u2190 ",r.isPlatformMode?"Platform prompts":"Prompts"," "),BE(),jw(r.isLoading()?4:5));},dependencies:[Ut,nd,bo,xo,Lt,Gt,mo,po,Vn,An,va,go,_o,pn,hn,cn,ln,dn,mn,at,an],encapsulation:2})};function Pe(o){let t=o.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}export{pe as PromptFormComponent};
@@ -1,2 +1,2 @@
1
- import {I}from'./chunk-CJLkP_aL.js';import {g,W,aW as L,I as Ie,U as Ui,X as XC,aX as Be,ac as Ty,G as U,a2 as da,aa as Tr,y as yw,D as Ds,l as lg,L as Lw,p as pl,Q as mg,a as BE,j as jw,P as ug,N as NC,Z as Zw,_ as _I,H as Hw,J as Jw,R as NI,m as Uw,v as vl,as as kg,r as df,s as ff,O as Og}from'./main-FJXP2G5I.js';import {a4 as id,l as bo,x as xo,L as Lt,u as vn,G as Gt,m as mo,a6 as da$1,aa as Ni,c as pn,h as hn,d as cn,r as ln,e as dn,C as mn,g as at,i as an,t as rn}from'./chunk-D2BTEyR1.js';import'./chunk-B5eEl07l.js';var oe=(i,t)=>t.id;function ae(i,t){i&1&&(Ds(0,"p",1),NC(1,"Loading\u2026"),pl());}function se(i,t){if(i&1&&(Ds(0,"ds-notice"),NC(1),pl()),i&2){let e=Jw(2);BE(),Og(e.errorMessage());}}function re(i,t){if(i&1){let e=Zw();Ds(0,"div")(1,"button",23),mg("click",function(){df(e);let s=Jw(2);return ff(s.retryLoad())}),NC(2,"Retry loading"),pl()();}}function ce(i,t){if(i&1&&(lg(0,"br"),NC(1)),i&2){let e=Jw(3);BE(),vl("",e.association()?.checkoutFailureReason," ");}}function de(i,t){if(i&1&&(Ds(0,"ds-notice",3),NC(1),Lw(2,ce,2,1),pl()),i&2){let e=Jw(2);ug("tone",e.checkoutStatus()===e.CheckoutStatus.FAILED?"error":e.checkoutStatus()===e.CheckoutStatus.READY?"success":"neutral"),BE(),vl(" Repository: ",e.checkoutStatus()," "),BE(),jw(e.association()?.checkoutFailureReason?2:-1);}}function le(i,t){if(i&1&&(Ds(0,"option",12),NC(1),pl()),i&2){let e=t.$implicit,c=Jw(2);ug("value",e.id),BE(),kg("",e.name," (",c.authTypeLabel(e.authType),")");}}function me(i,t){i&1&&(Ds(0,"p",13),NC(1," No usable auth setting in this namespace. Create a BEARER_TOKEN one first. "),pl());}function pe(i,t){if(i&1){let e=Zw();Ds(0,"button",24),mg("click",function(){df(e);let s=Jw(2);return ff(s.remove())}),NC(1," Remove association "),pl();}if(i&2){let e=Jw(2);ug("disabled",!e.associationLoaded()||e.isSaving());}}function ue(i,t){if(i&1){let e=Zw();Lw(0,se,2,1,"ds-notice"),Lw(1,re,3,0,"div"),Lw(2,de,3,3,"ds-notice",3),Ds(3,"ds-fieldset",4)(4,"ds-form-field",5)(5,"input",6),mg("ngModelChange",function(s){df(e);let u=Jw();return ff(u.repositoryUrl.set(s))}),pl(),_I(),pl(),Ds(6,"ds-form-field",7)(7,"input",8),mg("ngModelChange",function(s){df(e);let u=Jw();return ff(u.mainBranch.set(s))}),pl(),_I(),pl(),Ds(8,"ds-form-field",9)(9,"select",10),mg("ngModelChange",function(s){df(e);let u=Jw();return ff(u.serviceAuthSettingId.set(s))}),Ds(10,"option",11),NC(11,"Select an auth setting\u2026"),pl(),Hw(12,le,2,3,"option",12,oe),pl(),_I(),Lw(14,me,2,0,"p",13),pl()(),Ds(15,"ds-fieldset",14)(16,"div",15)(17,"label",16)(18,"input",17),mg("ngModelChange",function(s){df(e);let u=Jw();return ff(u.autoWorktree.set(s))}),pl(),_I(),NC(19," Offer a worktree to every new top-level case "),pl(),Ds(20,"p",18),NC(21," The creator checks the box when creating the case; it is unchecked by default, and a case created without it has no Git. Applies to cases created from now on: turning this on later never equips existing cases, and turning it off never removes a worktree already created. "),pl()(),Ds(22,"ds-form-field",19)(23,"input",20),mg("ngModelChange",function(s){df(e);let u=Jw();return ff(u.setupCommand.set(s))}),pl(),_I(),Ds(24,"p",13),NC(25," Runs on the server, as the service user, in each new worktree. It executes code from the branch \u2014 prefer a command that disables lifecycle scripts. "),pl()()(),Ds(26,"ds-form-actions")(27,"button",21),mg("click",function(){df(e);let s=Jw();return ff(s.save())}),NC(28),pl(),Lw(29,pe,2,1,"button",22),pl();}if(i&2){let e=Jw();jw(e.errorMessage()?0:-1),BE(),jw(e.associationLoaded()?-1:1),BE(),jw(e.isAssociated()&&e.checkoutStatus()?2:-1),BE(),ug("disabled",!e.associationLoaded()||e.isSaving()),BE(2),ug("ngModel",e.repositoryUrl()),NI(),BE(2),ug("ngModel",e.mainBranch()),NI(),BE(2),ug("ngModel",e.serviceAuthSettingId()),NI(),BE(3),Uw(e.eligibleAuthSettings()),BE(2),jw(e.eligibleAuthSettings().length===0?14:-1),BE(),ug("disabled",!e.associationLoaded()||e.isSaving()),BE(3),ug("ngModel",e.autoWorktree()),NI(),BE(5),ug("ngModel",e.setupCommand()),NI(),BE(4),ug("disabled",!e.canSave()),BE(),vl(" ",e.isSaving()?"Saving\u2026":e.isAssociated()?"Update":"Associate"," "),BE(),jw(e.isAssociated()?29:-1);}}var ge=["BearerTokenAuthSetting","BasicAuthAuthSetting","ApiKeyAuthSetting"],he={BearerTokenAuthSetting:"token",BasicAuthAuthSetting:"basic auth",ApiKeyAuthSetting:"API key"},ne=class i{route=g(W);gitApi=g(L);authSettingState=g(I);destroyRef=g(Ie);isLoading=Ui(true);isSaving=Ui(false);confirmingRemove=Ui(false);associationLoaded=Ui(false);errorMessage=Ui(null);association=Ui(null);authSettings=Ui([]);repositoryUrl=Ui("");mainBranch=Ui("main");serviceAuthSettingId=Ui("");autoWorktree=Ui(false);setupCommand=Ui("");namespaceId="";isAssociated=XC(()=>this.association()?.associated===true);eligibleAuthSettings=XC(()=>this.authSettings().filter(t=>ge.includes(t.authType)));authTypeLabel(t){return he[t??""]??t??"unknown"}canSave=XC(()=>this.associationLoaded()&&!this.isLoading()&&!this.isSaving()&&this.repositoryUrl().trim().length>0&&this.serviceAuthSettingId().length>0);checkoutStatus=XC(()=>this.association()?.checkoutStatus??null);CheckoutStatus=Be;ngOnInit(){this.namespaceId=this.route.snapshot.paramMap.get("namespaceId")??"",this.load();}retryLoad(){this.isLoading()||this.isSaving()||this.load();}load(){this.isLoading.set(true),this.associationLoaded.set(false),this.errorMessage.set(null),Ty({association:this.gitApi.getAssociationNamespaceGit(this.namespaceId),authSettings:this.authSettingState.loadNamespaceSettings(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({association:t,authSettings:e})=>{this.authSettings.set(e??[]),this.acceptAssociation(t),this.isLoading.set(false);},error:t=>{console.error("Failed to load the Git repository settings",t),this.errorMessage.set(this.messageOf(t)),this.isLoading.set(false);}});}acceptAssociation(t){this.association.set(t);let e=t?.associated===false||t?.associated===true&&typeof t.repositoryUrl=="string"&&typeof t.mainBranch=="string"&&typeof t.serviceAuthSettingId=="string"&&typeof t.autoWorktreeForRootCases=="boolean"&&(t.setupCommand==null||typeof t.setupCommand=="string");this.associationLoaded.set(e),e?this.applyToForm(t):this.errorMessage.set("The repository settings could not be loaded completely. Retry before making changes.");}applyToForm(t){this.repositoryUrl.set(t.repositoryUrl??""),this.mainBranch.set(t.mainBranch??"main"),this.serviceAuthSettingId.set(t.serviceAuthSettingId??""),this.autoWorktree.set(t.autoWorktreeForRootCases??false),this.setupCommand.set(t.setupCommand??"");}save(){this.canSave()&&(this.isSaving.set(true),this.errorMessage.set(null),this.gitApi.setAssociationNamespaceGit(this.namespaceId,{repositoryUrl:this.repositoryUrl().trim(),mainBranch:this.mainBranch().trim()||void 0,serviceAuthSettingId:this.serviceAuthSettingId(),autoWorktreeForRootCases:this.autoWorktree(),setupCommand:this.setupCommand().trim()||void 0}).pipe(U(this.destroyRef),da(t=>(console.error("Failed to save the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),Tr(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}remove(){!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated()||this.confirmingRemove.set(true);}confirmRemove(){this.confirmingRemove.set(false),!(!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated())&&(this.isSaving.set(true),this.gitApi.removeAssociationNamespaceGit(this.namespaceId).pipe(U(this.destroyRef),da(t=>(console.error("Failed to remove the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),Tr(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}messageOf(t){return t.error?.message??t.message??"Unexpected error"}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-namespace-git"]],decls:5,vars:2,consts:[["title","Git repository","description","Associating a repository enables Git workspaces for this namespace. When worktree creation is enabled, the new-case form offers a worktree, and a case created with one gets a repo/ directory shared by its sub-cases. Namespace files remain shared documents outside Git. Agents create branches and pull requests in their workflows."],[1,"ds-hint"],["title","Remove the repository association?","message","Existing workspaces keep their worktree.","confirmLabel","Remove","cancelLabel","Cancel",3,"confirmed","cancelled","open"],[3,"tone"],["legend","Repository",3,"disabled"],["label","Repository URL","controlId","git-url","hint","HTTPS only, without credentials in the URL."],["dsControl","","id","git-url","type","url","placeholder","https://forge.example/org/project.git","name","repositoryUrl",3,"ngModelChange","ngModel"],["label","Main branch","controlId","git-branch","hint","New worktrees start at this branch\u2019s commit, without creating a branch."],["dsControl","","id","git-branch","type","text","placeholder","main","name","mainBranch",3,"ngModelChange","ngModel"],["label","Service account","controlId","git-auth","hint","Shared by the namespace. Every Git operation uses this identity, never the identity of whoever opened the case."],["dsControl","","id","git-auth","name","serviceAuthSettingId",3,"ngModelChange","ngModel"],["value",""],[3,"value"],[1,"ds-hint","ds-hint--warning"],["legend","Automation",3,"disabled"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox","name","autoWorktree",3,"ngModelChange","ngModel"],[1,"ds-hint","ds-indent"],["label","Setup command (optional)","controlId","git-setup"],["dsControl","","mono","","id","git-setup","type","text","placeholder","pnpm install --ignore-scripts","name","setupCommand",3,"ngModelChange","ngModel"],["id","git-save","dsButton","","variant","primary","type","button",3,"click","disabled"],["id","git-remove","dsButton","","variant","danger","type","button",3,"disabled"],["id","git-retry","dsButton","","type","button",3,"click"],["id","git-remove","dsButton","","variant","danger","type","button",3,"click","disabled"]],template:function(e,c){e&1&&(Ds(0,"ds-page"),lg(1,"ds-section-header",0),Lw(2,ae,2,0,"p",1)(3,ue,30,14),pl(),Ds(4,"ds-confirm-dialog",2),mg("confirmed",function(){return c.confirmRemove()})("cancelled",function(){return c.confirmingRemove.set(false)}),pl()),e&2&&(BE(2),jw(c.isLoading()?2:3),BE(2),ug("open",c.confirmingRemove()));},dependencies:[id,bo,xo,Lt,vn,Gt,mo,da$1,Ni,pn,hn,cn,ln,dn,mn,at,an,rn],encapsulation:2})};
1
+ import {I}from'./chunk-Dn4mtCZo.js';import {g,W,aW as L,I as Ie,U as Ui,X as XC,aX as Be,ac as Ty,G as U,a2 as da,aa as Tr,y as yw,D as Ds,l as lg,L as Lw,p as pl,Q as mg,a as BE,j as jw,P as ug,N as NC,Z as Zw,_ as _I,H as Hw,J as Jw,R as NI,m as Uw,v as vl,as as kg,r as df,s as ff,O as Og}from'./main-BGDYOJBA.js';import {a4 as id,l as bo,x as xo,L as Lt,u as vn,G as Gt,m as mo,a6 as da$1,aa as Ni,c as pn,h as hn,d as cn,r as ln,e as dn,C as mn,g as at,i as an,t as rn}from'./chunk-DvqKcX7A.js';import'./chunk-AYvnGrVn.js';var oe=(i,t)=>t.id;function ae(i,t){i&1&&(Ds(0,"p",1),NC(1,"Loading\u2026"),pl());}function se(i,t){if(i&1&&(Ds(0,"ds-notice"),NC(1),pl()),i&2){let e=Jw(2);BE(),Og(e.errorMessage());}}function re(i,t){if(i&1){let e=Zw();Ds(0,"div")(1,"button",23),mg("click",function(){df(e);let s=Jw(2);return ff(s.retryLoad())}),NC(2,"Retry loading"),pl()();}}function ce(i,t){if(i&1&&(lg(0,"br"),NC(1)),i&2){let e=Jw(3);BE(),vl("",e.association()?.checkoutFailureReason," ");}}function de(i,t){if(i&1&&(Ds(0,"ds-notice",3),NC(1),Lw(2,ce,2,1),pl()),i&2){let e=Jw(2);ug("tone",e.checkoutStatus()===e.CheckoutStatus.FAILED?"error":e.checkoutStatus()===e.CheckoutStatus.READY?"success":"neutral"),BE(),vl(" Repository: ",e.checkoutStatus()," "),BE(),jw(e.association()?.checkoutFailureReason?2:-1);}}function le(i,t){if(i&1&&(Ds(0,"option",12),NC(1),pl()),i&2){let e=t.$implicit,c=Jw(2);ug("value",e.id),BE(),kg("",e.name," (",c.authTypeLabel(e.authType),")");}}function me(i,t){i&1&&(Ds(0,"p",13),NC(1," No usable auth setting in this namespace. Create a BEARER_TOKEN one first. "),pl());}function pe(i,t){if(i&1){let e=Zw();Ds(0,"button",24),mg("click",function(){df(e);let s=Jw(2);return ff(s.remove())}),NC(1," Remove association "),pl();}if(i&2){let e=Jw(2);ug("disabled",!e.associationLoaded()||e.isSaving());}}function ue(i,t){if(i&1){let e=Zw();Lw(0,se,2,1,"ds-notice"),Lw(1,re,3,0,"div"),Lw(2,de,3,3,"ds-notice",3),Ds(3,"ds-fieldset",4)(4,"ds-form-field",5)(5,"input",6),mg("ngModelChange",function(s){df(e);let u=Jw();return ff(u.repositoryUrl.set(s))}),pl(),_I(),pl(),Ds(6,"ds-form-field",7)(7,"input",8),mg("ngModelChange",function(s){df(e);let u=Jw();return ff(u.mainBranch.set(s))}),pl(),_I(),pl(),Ds(8,"ds-form-field",9)(9,"select",10),mg("ngModelChange",function(s){df(e);let u=Jw();return ff(u.serviceAuthSettingId.set(s))}),Ds(10,"option",11),NC(11,"Select an auth setting\u2026"),pl(),Hw(12,le,2,3,"option",12,oe),pl(),_I(),Lw(14,me,2,0,"p",13),pl()(),Ds(15,"ds-fieldset",14)(16,"div",15)(17,"label",16)(18,"input",17),mg("ngModelChange",function(s){df(e);let u=Jw();return ff(u.autoWorktree.set(s))}),pl(),_I(),NC(19," Offer a worktree to every new top-level case "),pl(),Ds(20,"p",18),NC(21," The creator checks the box when creating the case; it is unchecked by default, and a case created without it has no Git. Applies to cases created from now on: turning this on later never equips existing cases, and turning it off never removes a worktree already created. "),pl()(),Ds(22,"ds-form-field",19)(23,"input",20),mg("ngModelChange",function(s){df(e);let u=Jw();return ff(u.setupCommand.set(s))}),pl(),_I(),Ds(24,"p",13),NC(25," Runs on the server, as the service user, in each new worktree. It executes code from the branch \u2014 prefer a command that disables lifecycle scripts. "),pl()()(),Ds(26,"ds-form-actions")(27,"button",21),mg("click",function(){df(e);let s=Jw();return ff(s.save())}),NC(28),pl(),Lw(29,pe,2,1,"button",22),pl();}if(i&2){let e=Jw();jw(e.errorMessage()?0:-1),BE(),jw(e.associationLoaded()?-1:1),BE(),jw(e.isAssociated()&&e.checkoutStatus()?2:-1),BE(),ug("disabled",!e.associationLoaded()||e.isSaving()),BE(2),ug("ngModel",e.repositoryUrl()),NI(),BE(2),ug("ngModel",e.mainBranch()),NI(),BE(2),ug("ngModel",e.serviceAuthSettingId()),NI(),BE(3),Uw(e.eligibleAuthSettings()),BE(2),jw(e.eligibleAuthSettings().length===0?14:-1),BE(),ug("disabled",!e.associationLoaded()||e.isSaving()),BE(3),ug("ngModel",e.autoWorktree()),NI(),BE(5),ug("ngModel",e.setupCommand()),NI(),BE(4),ug("disabled",!e.canSave()),BE(),vl(" ",e.isSaving()?"Saving\u2026":e.isAssociated()?"Update":"Associate"," "),BE(),jw(e.isAssociated()?29:-1);}}var ge=["BearerTokenAuthSetting","BasicAuthAuthSetting","ApiKeyAuthSetting"],he={BearerTokenAuthSetting:"token",BasicAuthAuthSetting:"basic auth",ApiKeyAuthSetting:"API key"},ne=class i{route=g(W);gitApi=g(L);authSettingState=g(I);destroyRef=g(Ie);isLoading=Ui(true);isSaving=Ui(false);confirmingRemove=Ui(false);associationLoaded=Ui(false);errorMessage=Ui(null);association=Ui(null);authSettings=Ui([]);repositoryUrl=Ui("");mainBranch=Ui("main");serviceAuthSettingId=Ui("");autoWorktree=Ui(false);setupCommand=Ui("");namespaceId="";isAssociated=XC(()=>this.association()?.associated===true);eligibleAuthSettings=XC(()=>this.authSettings().filter(t=>ge.includes(t.authType)));authTypeLabel(t){return he[t??""]??t??"unknown"}canSave=XC(()=>this.associationLoaded()&&!this.isLoading()&&!this.isSaving()&&this.repositoryUrl().trim().length>0&&this.serviceAuthSettingId().length>0);checkoutStatus=XC(()=>this.association()?.checkoutStatus??null);CheckoutStatus=Be;ngOnInit(){this.namespaceId=this.route.snapshot.paramMap.get("namespaceId")??"",this.load();}retryLoad(){this.isLoading()||this.isSaving()||this.load();}load(){this.isLoading.set(true),this.associationLoaded.set(false),this.errorMessage.set(null),Ty({association:this.gitApi.getAssociationNamespaceGit(this.namespaceId),authSettings:this.authSettingState.loadNamespaceSettings(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({association:t,authSettings:e})=>{this.authSettings.set(e??[]),this.acceptAssociation(t),this.isLoading.set(false);},error:t=>{console.error("Failed to load the Git repository settings",t),this.errorMessage.set(this.messageOf(t)),this.isLoading.set(false);}});}acceptAssociation(t){this.association.set(t);let e=t?.associated===false||t?.associated===true&&typeof t.repositoryUrl=="string"&&typeof t.mainBranch=="string"&&typeof t.serviceAuthSettingId=="string"&&typeof t.autoWorktreeForRootCases=="boolean"&&(t.setupCommand==null||typeof t.setupCommand=="string");this.associationLoaded.set(e),e?this.applyToForm(t):this.errorMessage.set("The repository settings could not be loaded completely. Retry before making changes.");}applyToForm(t){this.repositoryUrl.set(t.repositoryUrl??""),this.mainBranch.set(t.mainBranch??"main"),this.serviceAuthSettingId.set(t.serviceAuthSettingId??""),this.autoWorktree.set(t.autoWorktreeForRootCases??false),this.setupCommand.set(t.setupCommand??"");}save(){this.canSave()&&(this.isSaving.set(true),this.errorMessage.set(null),this.gitApi.setAssociationNamespaceGit(this.namespaceId,{repositoryUrl:this.repositoryUrl().trim(),mainBranch:this.mainBranch().trim()||void 0,serviceAuthSettingId:this.serviceAuthSettingId(),autoWorktreeForRootCases:this.autoWorktree(),setupCommand:this.setupCommand().trim()||void 0}).pipe(U(this.destroyRef),da(t=>(console.error("Failed to save the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),Tr(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}remove(){!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated()||this.confirmingRemove.set(true);}confirmRemove(){this.confirmingRemove.set(false),!(!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated())&&(this.isSaving.set(true),this.gitApi.removeAssociationNamespaceGit(this.namespaceId).pipe(U(this.destroyRef),da(t=>(console.error("Failed to remove the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),Tr(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}messageOf(t){return t.error?.message??t.message??"Unexpected error"}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-namespace-git"]],decls:5,vars:2,consts:[["title","Git repository","description","Associating a repository enables Git workspaces for this namespace. When worktree creation is enabled, the new-case form offers a worktree, and a case created with one gets a repo/ directory shared by its sub-cases. Namespace files remain shared documents outside Git. Agents create branches and pull requests in their workflows."],[1,"ds-hint"],["title","Remove the repository association?","message","Existing workspaces keep their worktree.","confirmLabel","Remove","cancelLabel","Cancel",3,"confirmed","cancelled","open"],[3,"tone"],["legend","Repository",3,"disabled"],["label","Repository URL","controlId","git-url","hint","HTTPS only, without credentials in the URL."],["dsControl","","id","git-url","type","url","placeholder","https://forge.example/org/project.git","name","repositoryUrl",3,"ngModelChange","ngModel"],["label","Main branch","controlId","git-branch","hint","New worktrees start at this branch\u2019s commit, without creating a branch."],["dsControl","","id","git-branch","type","text","placeholder","main","name","mainBranch",3,"ngModelChange","ngModel"],["label","Service account","controlId","git-auth","hint","Shared by the namespace. Every Git operation uses this identity, never the identity of whoever opened the case."],["dsControl","","id","git-auth","name","serviceAuthSettingId",3,"ngModelChange","ngModel"],["value",""],[3,"value"],[1,"ds-hint","ds-hint--warning"],["legend","Automation",3,"disabled"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox","name","autoWorktree",3,"ngModelChange","ngModel"],[1,"ds-hint","ds-indent"],["label","Setup command (optional)","controlId","git-setup"],["dsControl","","mono","","id","git-setup","type","text","placeholder","pnpm install --ignore-scripts","name","setupCommand",3,"ngModelChange","ngModel"],["id","git-save","dsButton","","variant","primary","type","button",3,"click","disabled"],["id","git-remove","dsButton","","variant","danger","type","button",3,"disabled"],["id","git-retry","dsButton","","type","button",3,"click"],["id","git-remove","dsButton","","variant","danger","type","button",3,"click","disabled"]],template:function(e,c){e&1&&(Ds(0,"ds-page"),lg(1,"ds-section-header",0),Lw(2,ae,2,0,"p",1)(3,ue,30,14),pl(),Ds(4,"ds-confirm-dialog",2),mg("confirmed",function(){return c.confirmRemove()})("cancelled",function(){return c.confirmingRemove.set(false)}),pl()),e&2&&(BE(2),jw(c.isLoading()?2:3),BE(2),ug("open",c.confirmingRemove()));},dependencies:[id,bo,xo,Lt,vn,Gt,mo,da$1,Ni,pn,hn,cn,ln,dn,mn,at,an,rn],encapsulation:2})};
2
2
  export{ne as NamespaceGitComponent};
@@ -1 +1 @@
1
- import {i}from'./chunk-B5eEl07l.js';import {y}from'./chunk-D2BTEyR1.js';import {g,aE as X,$ as Cr,at as wy,a1 as fa,a2 as da,aa as Tr,ad as ne,aD as $y,M as x,K as w$1,a5 as yd,aF as sn,aG as Ot,aH as an,a6 as x$1}from'./main-FJXP2G5I.js';var nt=["ApiKeyAuthSetting","BasicAuthAuthSetting","BearerTokenAuthSetting","OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"],it={ApiKeyAuthSetting:"API Key",BasicAuthAuthSetting:"Basic Auth (username / password)",BearerTokenAuthSetting:"Bearer Token",OAuthDiscoverableAuthSetting:"OAuth \u2014 Discovery URL",OAuthMcpDiscoverableAuthSetting:"OAuth \u2014 MCP Discoverable",OAuthCustomAuthSetting:"OAuth \u2014 Custom endpoints",OAuthRegisteredAuthSetting:"OAuth \u2014 Registered app"},R="none",w="me",b=2e3,M=15e4,P=3,L={ApiKeyAuthSetting:"API_KEY",BasicAuthAuthSetting:"BASIC_AUTH",BearerTokenAuthSetting:"BEARER_TOKEN",OAuthDiscoverableAuthSetting:"OAUTH_DISCOVERABLE",OAuthMcpDiscoverableAuthSetting:"OAUTH_MCP_DISCOVERABLE",OAuthCustomAuthSetting:"OAUTH_CUSTOM",OAuthRegisteredAuthSetting:"OAUTH_REGISTERED"},k={API_KEY:"ApiKeyAuthSetting",BASIC_AUTH:"BasicAuthAuthSetting",BEARER_TOKEN:"BearerTokenAuthSetting",OAUTH_DISCOVERABLE:"OAuthDiscoverableAuthSetting",OAUTH_MCP_DISCOVERABLE:"OAuthMcpDiscoverableAuthSetting",OAUTH_CUSTOM:"OAuthCustomAuthSetting",OAUTH_REGISTERED:"OAuthRegisteredAuthSetting"};function B(i){let t=L[i.authType];return t?x(w$1({},i),{authType:t}):i}function m(i){return U(i)}function f(i){return i.map(U)}function U(i){let t=i;if(typeof t.authType=="string"){let e=k[t.authType];if(e)return x(w$1({},t),{authType:e})}return i}function H(i,t){return t===null?true:i!==void 0&&Date.parse(i)>Date.parse(t)}var I=class i$1{controller=g(X);userState=g(y);refresh$=new Cr(void 0);namespaceId$=new Cr(null);vm$=wy([this.namespaceId$,this.refresh$]).pipe(fa(([t])=>{let e=this.loadPlatformSettings().pipe(da(()=>Tr([])));return t?wy([e,this.loadNamespaceSettings(t).pipe(da(()=>Tr([]))),this.loadUserSettings(t).pipe(da(()=>Tr([]))),this.loadUserSettings("global").pipe(da(()=>Tr([])))]).pipe(ne(([n,o,r,h])=>({platform:n,namespace:o,userOnNs:r,userGlobal:h}))):wy([e,this.loadNamespaceSettings("").pipe(da(()=>Tr([]))),this.loadUserSettings("global").pipe(da(()=>Tr([])))]).pipe(ne(([n,o,r])=>({platform:n,namespace:o,userOnNs:[],userGlobal:r})))}),$y({bufferSize:1,refCount:true}));setNamespace(t){this.namespaceId$.value!==t&&this.namespaceId$.next(t);}refresh(){this.refresh$.next();}loadUserSettings(t){let e=t==="global"?R:t;return this.controller.listAuthSetting(e,w).pipe(ne(n=>f(n)))}userGlobal$=i(this.refresh$,()=>this.loadUserSettings("global"),[]);loadPlatformSettings(){return this.controller.listAuthSetting(R).pipe(ne(t=>f(t)))}loadNamespaceSettings(t){return t?this.controller.listAuthSetting(t).pipe(ne(e=>f(e))):Tr([])}getById(t,e){return this.controller.getByIdAuthSetting(t).pipe(ne(n=>m(n)))}create(t,e,n){let r=this.userState.currentUser()?.id;if((e==="userOnNs"||e==="userGlobal")&&!r)throw new Error(`Cannot create ${e} auth setting before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(e==="namespace"&&(n===void 0||n===""))throw new Error("Cannot create namespace-scoped auth setting without a namespaceId");if(e==="userOnNs"&&!n)throw new Error("Cannot create userOnNs auth setting without a namespaceId");let h=B(x(w$1({},t),{namespaceId:e==="namespace"||e==="userOnNs"?n??void 0:void 0,userId:e==="userOnNs"||e==="userGlobal"?r:void 0}));return this.controller.createAuthSetting(h).pipe(ne(A=>m(A)),yd(()=>this.refresh()))}update(t,e,n){let o=B(x(w$1({},e),{namespaceId:n.namespaceId,userId:n.userId,authType:n.authType}));return this.controller.updateAuthSetting(t,o).pipe(ne(r=>m(r)),yd(()=>this.refresh()))}delete(t,e){return this.controller.deleteAuthSetting(t).pipe(yd(()=>this.refresh()))}getConnection(t,e){return this.controller.getConnectionAuthSetting(t,e)}resetCredential(t,e){return this.controller.resetMyCredentialAuthSetting(t,e)}connect(t,e,n,o){return this.getConnection(t,e).pipe(fa(r=>this.controller.connectAuthSetting(t,e).pipe(yd(h=>n(h.authorizationUrl)),fa(()=>this.awaitNewConnection(t,e,r.connected?r.connectedAt??null:null,o)))))}awaitNewConnection(t,e,n,o){let r=0,h=0;return sn(b,b).pipe(fa(()=>this.getConnection(t,e).pipe(da(()=>Tr(null)))),ne(A=>(r++,A?.connected&&H(A.connectedAt,n)?"connected":r*b>=M?"timeout":o()&&++h>=P?"abandoned":null)),Ot(A=>A!==null),an(1))}static \u0275fac=function(e){return new(e||i$1)};static \u0275prov=x$1({token:i$1,factory:i$1.\u0275fac,providedIn:"root"})};export{I,it as i,nt as n};
1
+ import {i}from'./chunk-AYvnGrVn.js';import {y}from'./chunk-DvqKcX7A.js';import {g,aE as X,$ as Cr,at as wy,a1 as fa,a2 as da,aa as Tr,ad as ne,aD as $y,M as x,K as w$1,a5 as yd,aF as sn,aG as Ot,aH as an,a6 as x$1}from'./main-BGDYOJBA.js';var nt=["ApiKeyAuthSetting","BasicAuthAuthSetting","BearerTokenAuthSetting","OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"],it={ApiKeyAuthSetting:"API Key",BasicAuthAuthSetting:"Basic Auth (username / password)",BearerTokenAuthSetting:"Bearer Token",OAuthDiscoverableAuthSetting:"OAuth \u2014 Discovery URL",OAuthMcpDiscoverableAuthSetting:"OAuth \u2014 MCP Discoverable",OAuthCustomAuthSetting:"OAuth \u2014 Custom endpoints",OAuthRegisteredAuthSetting:"OAuth \u2014 Registered app"},R="none",w="me",b=2e3,M=15e4,P=3,L={ApiKeyAuthSetting:"API_KEY",BasicAuthAuthSetting:"BASIC_AUTH",BearerTokenAuthSetting:"BEARER_TOKEN",OAuthDiscoverableAuthSetting:"OAUTH_DISCOVERABLE",OAuthMcpDiscoverableAuthSetting:"OAUTH_MCP_DISCOVERABLE",OAuthCustomAuthSetting:"OAUTH_CUSTOM",OAuthRegisteredAuthSetting:"OAUTH_REGISTERED"},k={API_KEY:"ApiKeyAuthSetting",BASIC_AUTH:"BasicAuthAuthSetting",BEARER_TOKEN:"BearerTokenAuthSetting",OAUTH_DISCOVERABLE:"OAuthDiscoverableAuthSetting",OAUTH_MCP_DISCOVERABLE:"OAuthMcpDiscoverableAuthSetting",OAUTH_CUSTOM:"OAuthCustomAuthSetting",OAUTH_REGISTERED:"OAuthRegisteredAuthSetting"};function B(i){let t=L[i.authType];return t?x(w$1({},i),{authType:t}):i}function m(i){return U(i)}function f(i){return i.map(U)}function U(i){let t=i;if(typeof t.authType=="string"){let e=k[t.authType];if(e)return x(w$1({},t),{authType:e})}return i}function H(i,t){return t===null?true:i!==void 0&&Date.parse(i)>Date.parse(t)}var I=class i$1{controller=g(X);userState=g(y);refresh$=new Cr(void 0);namespaceId$=new Cr(null);vm$=wy([this.namespaceId$,this.refresh$]).pipe(fa(([t])=>{let e=this.loadPlatformSettings().pipe(da(()=>Tr([])));return t?wy([e,this.loadNamespaceSettings(t).pipe(da(()=>Tr([]))),this.loadUserSettings(t).pipe(da(()=>Tr([]))),this.loadUserSettings("global").pipe(da(()=>Tr([])))]).pipe(ne(([n,o,r,h])=>({platform:n,namespace:o,userOnNs:r,userGlobal:h}))):wy([e,this.loadNamespaceSettings("").pipe(da(()=>Tr([]))),this.loadUserSettings("global").pipe(da(()=>Tr([])))]).pipe(ne(([n,o,r])=>({platform:n,namespace:o,userOnNs:[],userGlobal:r})))}),$y({bufferSize:1,refCount:true}));setNamespace(t){this.namespaceId$.value!==t&&this.namespaceId$.next(t);}refresh(){this.refresh$.next();}loadUserSettings(t){let e=t==="global"?R:t;return this.controller.listAuthSetting(e,w).pipe(ne(n=>f(n)))}userGlobal$=i(this.refresh$,()=>this.loadUserSettings("global"),[]);loadPlatformSettings(){return this.controller.listAuthSetting(R).pipe(ne(t=>f(t)))}loadNamespaceSettings(t){return t?this.controller.listAuthSetting(t).pipe(ne(e=>f(e))):Tr([])}getById(t,e){return this.controller.getByIdAuthSetting(t).pipe(ne(n=>m(n)))}create(t,e,n){let r=this.userState.currentUser()?.id;if((e==="userOnNs"||e==="userGlobal")&&!r)throw new Error(`Cannot create ${e} auth setting before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(e==="namespace"&&(n===void 0||n===""))throw new Error("Cannot create namespace-scoped auth setting without a namespaceId");if(e==="userOnNs"&&!n)throw new Error("Cannot create userOnNs auth setting without a namespaceId");let h=B(x(w$1({},t),{namespaceId:e==="namespace"||e==="userOnNs"?n??void 0:void 0,userId:e==="userOnNs"||e==="userGlobal"?r:void 0}));return this.controller.createAuthSetting(h).pipe(ne(A=>m(A)),yd(()=>this.refresh()))}update(t,e,n){let o=B(x(w$1({},e),{namespaceId:n.namespaceId,userId:n.userId,authType:n.authType}));return this.controller.updateAuthSetting(t,o).pipe(ne(r=>m(r)),yd(()=>this.refresh()))}delete(t,e){return this.controller.deleteAuthSetting(t).pipe(yd(()=>this.refresh()))}getConnection(t,e){return this.controller.getConnectionAuthSetting(t,e)}resetCredential(t,e){return this.controller.resetMyCredentialAuthSetting(t,e)}connect(t,e,n,o){return this.getConnection(t,e).pipe(fa(r=>this.controller.connectAuthSetting(t,e).pipe(yd(h=>n(h.authorizationUrl)),fa(()=>this.awaitNewConnection(t,e,r.connected?r.connectedAt??null:null,o)))))}awaitNewConnection(t,e,n,o){let r=0,h=0;return sn(b,b).pipe(fa(()=>this.getConnection(t,e).pipe(da(()=>Tr(null)))),ne(A=>(r++,A?.connected&&H(A.connectedAt,n)?"connected":r*b>=M?"timeout":o()&&++h>=P?"abandoned":null)),Ot(A=>A!==null),an(1))}static \u0275fac=function(e){return new(e||i$1)};static \u0275prov=x$1({token:i$1,factory:i$1.\u0275fac,providedIn:"root"})};export{I,it as i,nt as n};
@@ -1 +1 @@
1
- import {i}from'./chunk-B5eEl07l.js';import {y}from'./chunk-D2BTEyR1.js';import {g,af as G,aI as ve,$ as Cr,at as wy,a1 as fa,a2 as da,aa as Tr,ad as ne,aD as $y,a5 as yd,a6 as x}from'./main-FJXP2G5I.js';var u=s=>s,N="none",w="me",O=class s{nsController=g(G);exportService=g(ve);userState=g(y);refresh$=new Cr(void 0);namespaceId$=new Cr(null);vm$=wy([this.namespaceId$,this.refresh$]).pipe(fa(([e])=>{let n=this.loadPlatformConfigs().pipe(da(()=>Tr([]))),t=this.loadUserConfigs("global").pipe(da(()=>Tr([])));return e?wy([n,this.loadNamespaceConfigs(e).pipe(da(()=>Tr([]))),this.loadUserConfigs(e).pipe(da(()=>Tr([]))),t]).pipe(ne(([i,r,c,g])=>({platform:i,namespace:r,userOnNs:c,userGlobal:g}))):wy([n,t]).pipe(ne(([i,r])=>({platform:i,namespace:[],userOnNs:[],userGlobal:r})))}),$y({bufferSize:1,refCount:true}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e);}refresh(){this.refresh$.next();}loadPlatformConfigs(){return this.nsController.listIntegrationConfig(N)}loadUserConfigs(e){let n=e==="global"?N:e;return this.nsController.listIntegrationConfig(n,w)}userGlobal$=i(this.refresh$,()=>this.loadUserConfigs("global"),[]);loadNamespaceConfigs(e){return e?this.nsController.listIntegrationConfig(e):Tr([])}getById(e,n){return this.nsController.getByIdIntegrationConfig(e)}create(e,n,t){let r=this.userState.currentUser()?.id;if((n==="userOnNs"||n==="userGlobal")&&!r)throw new Error(`Cannot create ${n} config before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(n==="platform"){let g={name:e.name,integrationType:e.integrationType,description:e.description,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(g)).pipe(yd(()=>this.refresh()))}if(n==="namespace"){if(!t)throw new Error("Cannot create namespace-scoped config without a namespaceId");let g={name:e.name,integrationType:e.integrationType,description:e.description,namespaceId:t,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(g)).pipe(yd(()=>this.refresh()))}if(n==="userOnNs"&&!t)throw new Error("Cannot create userOnNs config without a namespaceId");let c={name:e.name,integrationType:e.integrationType,description:e.description,userId:r,namespaceId:n==="userOnNs"?t:void 0,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(c)).pipe(yd(()=>this.refresh()))}update(e,n,t,i){let r={name:n.name,integrationType:n.integrationType,description:n.description,userId:i.userId,namespaceId:i.namespaceId,parameters:n.parameters,authSettingName:n.authSettingName??void 0,autoGrant:n.autoGrant??false};return this.nsController.updateIntegrationConfig(e,u(r)).pipe(yd(()=>this.refresh()))}delete(e,n){return this.nsController.deleteIntegrationConfig(e).pipe(yd(()=>this.refresh()))}exportAsYaml(e){return this.exportService.exportAsYaml(e)}static \u0275fac=function(n){return new(n||s)};static \u0275prov=x({token:s,factory:s.\u0275fac,providedIn:"root"})};export{O};
1
+ import {i}from'./chunk-AYvnGrVn.js';import {y}from'./chunk-DvqKcX7A.js';import {g,af as G,aI as ve,$ as Cr,at as wy,a1 as fa,a2 as da,aa as Tr,ad as ne,aD as $y,a5 as yd,a6 as x}from'./main-BGDYOJBA.js';var u=s=>s,N="none",w="me",O=class s{nsController=g(G);exportService=g(ve);userState=g(y);refresh$=new Cr(void 0);namespaceId$=new Cr(null);vm$=wy([this.namespaceId$,this.refresh$]).pipe(fa(([e])=>{let n=this.loadPlatformConfigs().pipe(da(()=>Tr([]))),t=this.loadUserConfigs("global").pipe(da(()=>Tr([])));return e?wy([n,this.loadNamespaceConfigs(e).pipe(da(()=>Tr([]))),this.loadUserConfigs(e).pipe(da(()=>Tr([]))),t]).pipe(ne(([i,r,c,g])=>({platform:i,namespace:r,userOnNs:c,userGlobal:g}))):wy([n,t]).pipe(ne(([i,r])=>({platform:i,namespace:[],userOnNs:[],userGlobal:r})))}),$y({bufferSize:1,refCount:true}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e);}refresh(){this.refresh$.next();}loadPlatformConfigs(){return this.nsController.listIntegrationConfig(N)}loadUserConfigs(e){let n=e==="global"?N:e;return this.nsController.listIntegrationConfig(n,w)}userGlobal$=i(this.refresh$,()=>this.loadUserConfigs("global"),[]);loadNamespaceConfigs(e){return e?this.nsController.listIntegrationConfig(e):Tr([])}getById(e,n){return this.nsController.getByIdIntegrationConfig(e)}create(e,n,t){let r=this.userState.currentUser()?.id;if((n==="userOnNs"||n==="userGlobal")&&!r)throw new Error(`Cannot create ${n} config before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(n==="platform"){let g={name:e.name,integrationType:e.integrationType,description:e.description,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(g)).pipe(yd(()=>this.refresh()))}if(n==="namespace"){if(!t)throw new Error("Cannot create namespace-scoped config without a namespaceId");let g={name:e.name,integrationType:e.integrationType,description:e.description,namespaceId:t,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(g)).pipe(yd(()=>this.refresh()))}if(n==="userOnNs"&&!t)throw new Error("Cannot create userOnNs config without a namespaceId");let c={name:e.name,integrationType:e.integrationType,description:e.description,userId:r,namespaceId:n==="userOnNs"?t:void 0,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(c)).pipe(yd(()=>this.refresh()))}update(e,n,t,i){let r={name:n.name,integrationType:n.integrationType,description:n.description,userId:i.userId,namespaceId:i.namespaceId,parameters:n.parameters,authSettingName:n.authSettingName??void 0,autoGrant:n.autoGrant??false};return this.nsController.updateIntegrationConfig(e,u(r)).pipe(yd(()=>this.refresh()))}delete(e,n){return this.nsController.deleteIntegrationConfig(e).pipe(yd(()=>this.refresh()))}exportAsYaml(e){return this.exportService.exportAsYaml(e)}static \u0275fac=function(n){return new(n||s)};static \u0275prov=x({token:s,factory:s.\u0275fac,providedIn:"root"})};export{O};