@whoz-oss/coday-client 0.0.0-workstream-forge.250 → 0.0.0-workstream-forge.253

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/browser/{chunk-qAO_WS2x.js → chunk-0rWkqE7F.js} +14 -14
  2. package/browser/{chunk-Bw1EhndU.js → chunk-4QPnXZGI.js} +1 -1
  3. package/browser/{chunk-bs29fJzo.js → chunk-6PgBoN-T.js} +1 -1
  4. package/browser/{chunk-CKZuDwRH.js → chunk-B8id5BCX.js} +1 -1
  5. package/browser/{chunk-DFex7bTN.js → chunk-B9auxcFn.js} +1 -1
  6. package/browser/{chunk-H1lHRH9T.js → chunk-BFkNzGvf.js} +1 -1
  7. package/browser/{chunk-BOeKfMLQ.js → chunk-BGLIJwXG.js} +1 -1
  8. package/browser/{chunk-IobJmS5n.js → chunk-BHGXa4Jk.js} +1 -1
  9. package/browser/{chunk-CzE55g5c.js → chunk-BKdHqvrx.js} +1 -1
  10. package/browser/{chunk-C6QCrOzn.js → chunk-BNfS9gqG.js} +1 -1
  11. package/browser/{chunk-Be6W3TsR.js → chunk-BPiV6rjO.js} +1 -1
  12. package/browser/{chunk-BoNn3F1p.js → chunk-BXxiZ-ch.js} +1 -1
  13. package/browser/{chunk-7iOKe3sk.js → chunk-Bl4JILoJ.js} +1 -1
  14. package/browser/{chunk-BABBgQ8U.js → chunk-Bm5g68MQ.js} +1 -1
  15. package/browser/{chunk-CpV2kJbn.js → chunk-BrPYAXps.js} +1 -1
  16. package/browser/{chunk-DwBnbZ_M.js → chunk-C9tesIt3.js} +1 -1
  17. package/browser/{chunk-TCTz0Z6I.js → chunk-CF4gtYrV.js} +1 -1
  18. package/browser/{chunk-TODRaWW4.js → chunk-CIr1xkM7.js} +1 -1
  19. package/browser/{chunk-DlzuAZs2.js → chunk-CSKtdDpE.js} +1 -1
  20. package/browser/{chunk-CI4MRoOv.js → chunk-CUJxxcVR.js} +1 -1
  21. package/browser/{chunk-BvuZQAQ0.js → chunk-CfZRxQD1.js} +1 -1
  22. package/browser/{chunk-BzbDU55N.js → chunk-Cn01h5n9.js} +1 -1
  23. package/browser/{chunk-D6Jj7Ejx.js → chunk-CxA_xqW_.js} +1 -1
  24. package/browser/{chunk-CTDoIA2m.js → chunk-D4PKaYXM.js} +1 -1
  25. package/browser/{chunk-DQDO93fa.js → chunk-D4eJc3W1.js} +1 -1
  26. package/browser/{chunk-D9-ZBfAY.js → chunk-D7g02i9Y.js} +1 -1
  27. package/browser/{chunk-BmOgwWdt.js → chunk-D7hL0BBZ.js} +1 -1
  28. package/browser/{chunk-BlzNw99t.js → chunk-DI92LX4c.js} +1 -1
  29. package/browser/{chunk-Br_8ZFLi.js → chunk-Dm-C0-9-.js} +1 -1
  30. package/browser/{chunk-isv7OUlX.js → chunk-DoX_Nvew.js} +1 -1
  31. package/browser/{chunk-DvFBWfOh.js → chunk-DvRawlbU.js} +1 -1
  32. package/browser/{chunk-BuxuH9BP.js → chunk-Dwf5lQGo.js} +1 -1
  33. package/browser/{chunk-CQ560xmp.js → chunk-FWD9NFbg.js} +1 -1
  34. package/browser/{chunk-QzulhNzo.js → chunk-HtmwgODm.js} +1 -1
  35. package/browser/{chunk-DindqaXv.js → chunk-IHekMYOY.js} +1 -1
  36. package/browser/{chunk-3EDXMS-4.js → chunk-N28VXTjy.js} +1 -1
  37. package/browser/{chunk-DxEJ-WRR.js → chunk-OblIjDXe.js} +1 -1
  38. package/browser/{chunk-DSG-j5Fi.js → chunk-POnNwWp0.js} +1 -1
  39. package/browser/{chunk-e4ml3919.js → chunk-ROlDzTu9.js} +1 -1
  40. package/browser/{chunk-Co0vItak.js → chunk-TphGc3H4.js} +1 -1
  41. package/browser/{chunk-B0fXA2NX.js → chunk-UDd9uaqS.js} +1 -1
  42. package/browser/{chunk-CF-LwfxF.js → chunk-_oXbiQ1y.js} +1 -1
  43. package/browser/{chunk-CQks4NEB.js → chunk-a5BmxDG0.js} +1 -1
  44. package/browser/{chunk-BNa9R5xr.js → chunk-aycY_ip-.js} +1 -1
  45. package/browser/chunk-m1ylN0EP.js +1 -0
  46. package/browser/{chunk-CxzpsCxW.js → chunk-nTODHMVM.js} +1 -1
  47. package/browser/index.html +1 -1
  48. package/browser/{main-VSQLTBR6.js → main-PZMWRMRC.js} +1 -1
  49. package/package.json +1 -1
  50. package/browser/chunk-ABpRMh2B.js +0 -1
@@ -1 +1 @@
1
- import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-QzulhNzo.js';import {I}from'./chunk-DQDO93fa.js';import {g,W,t as F,K as we,$ as $i,U,ad as ne$1,a1 as ga,aa as br,aL as ui,a2 as ha,ac as by,D as Dw,E as Es,R as vg,c as hl,b as AC,a as Bw,d as VE,P as dg,i as Vw,v as tC,F as Fg,G as EC,n as lg,u as Dl,q as $w,z as zw,Q as Qw,w as pf,x as hf}from'./main-VSQLTBR6.js';import {z as k,j as O,a5 as w,e as at,c as fn,k as ko,l as Fo,P,B as P$1}from'./chunk-qAO_WS2x.js';import'./chunk-ABpRMh2B.js';var Q=(i,t)=>t.key;function X(i,t){if(i&1&&(Es(0,"p",3),AC(1),hl()),i&2){let e=tC();VE(),Fg(e.deletion.error());}}function Z(i,t){if(i&1&&(Es(0,"p"),AC(1),hl()),i&2){let e=t;EC(e.kind==="error"?"settings-table__error":"settings-table__status"),lg("role",e.kind==="error"?"alert":"status"),VE(),Dl(" ",e.text," ");}}function ee(i,t){i&1&&(Es(0,"p",5),AC(1,"Loading auth settings\u2026"),hl());}function te(i,t){i&1&&(Es(0,"p",6),AC(1,"No auth settings available."),hl());}function ne(i,t){i&1&&(Es(0,"p",5),AC(1,"No auth settings match the current filter."),hl());}function ie(i,t){i&1&&(Es(0,"ds-tag",18),AC(1,"Read-only"),hl());}function oe(i,t){i&1&&(Es(0,"ds-tag",20),AC(1,"Connected"),hl());}function ae(i,t){i&1&&(Es(0,"ds-tag",18),AC(1,"Not connected"),hl());}function se(i,t){i&1&&(Es(0,"span",21),AC(1,"\u2014"),hl());}function re(i,t){if(i&1){let e=Qw();Es(0,"span",26),AC(1,"Waiting for authorization\u2026"),hl(),Es(2,"button",27),vg("click",function(){pf(e);let r=tC(4);return hf(r.cancelConnect())}),AC(3," Cancel "),hl();}if(i&2){let e=tC(2).$implicit;VE(2),lg("aria-label","Stop waiting for the authorization of "+e.config.name);}}function le(i,t){if(i&1){let e=Qw();Es(0,"span",28),AC(1,"Disconnect?"),hl(),Es(2,"button",29),vg("click",function(){pf(e);let r=tC(2).$implicit,d=tC(2);return hf(d.confirmReset(r))}),AC(3),hl(),Es(4,"button",29),vg("click",function(){pf(e);let r=tC(4);return hf(r.cancelReset())}),AC(5," Cancel "),hl();}if(i&2){let e=tC(2).$implicit,n=tC(2);VE(2),dg("disabled",n.resettingKey()===e.key),lg("aria-label","Confirm disconnecting "+e.config.name),VE(),Dl(" ",n.resettingKey()===e.key?"Disconnecting\u2026":"Confirm"," "),VE(),dg("disabled",n.resettingKey()===e.key),lg("aria-label","Cancel disconnecting "+e.config.name);}}function ce(i,t){if(i&1){let e=Qw();Es(0,"button",29),vg("click",function(){pf(e);let r=tC(3).$implicit,d=tC(2);return hf(d.requestReset(r))}),AC(1," Disconnect "),hl();}if(i&2){let e=tC(3).$implicit,n=tC(2);dg("disabled",n.connectingKey()!==null),lg("aria-label","Disconnect "+e.config.name);}}function de(i,t){if(i&1){let e=Qw();Es(0,"button",29),vg("click",function(){pf(e);let r=tC(2).$implicit,d=tC(2);return hf(d.connect(r))}),AC(1),hl(),Bw(2,ce,2,2,"button",30);}if(i&2){let e=tC(2).$implicit,n=tC(2);dg("disabled",n.connectingKey()!==null||n.resettingKey()!==null),lg("aria-label",(n.connectionOf(e)==="connected"?"Reconnect ":"Connect ")+e.config.name),VE(),Dl(" ",n.connectionOf(e)==="connected"?"Reconnect":"Connect"," "),VE(),Vw(n.connectionOf(e)==="connected"?2:-1);}}function pe(i,t){if(i&1&&Bw(0,re,4,1)(1,le,6,5)(2,de,3,4),i&2){let e=tC().$implicit,n=tC(2);Vw(n.connectingKey()===e.key?0:n.resetConfirmingKey()===e.key?1:n.deletion.confirmingId()!==e.key?2:-1);}}function ue(i,t){if(i&1){let e=Qw();Es(0,"button",27),vg("click",function(){pf(e);let r=tC().$implicit,d=tC(2);return hf(d.duplicate(r))}),AC(1," Duplicate "),hl();}if(i&2){let e=tC().$implicit;lg("aria-label","Duplicate "+e.config.name);}}function _e(i,t){if(i&1){let e=Qw();Es(0,"button",27),vg("click",function(){pf(e);let r=tC(2).$implicit,d=tC(2);return hf(d.edit(r))}),AC(1," Edit "),hl();}if(i&2){let e=tC(2).$implicit;lg("aria-label","Edit "+e.config.name);}}function me(i,t){if(i&1){let e=Qw();Bw(0,_e,2,1,"button",24),Es(1,"agentos-row-delete-action",31),vg("deleteRequested",function(){pf(e);let r=tC().$implicit,d=tC(2);return hf(d.deletion.request(r.key))})("deleteConfirmed",function(){pf(e);let r=tC().$implicit,d=tC(2);return hf(d.confirmDelete(r))})("deleteCancelled",function(){pf(e);let r=tC(3);return hf(r.deletion.cancel())}),hl();}if(i&2){let e=tC().$implicit,n=tC(2);Vw(n.deletion.confirmingId()!==e.key?0:-1),VE(),dg("rowKey",e.key)("rowLabel",e.config.name)("state",n.deletion);}}function ge(i,t){i&1&&(Es(0,"button",25),AC(1,"Inherited"),hl());}function he(i,t){if(i&1&&(Es(0,"tr",10)(1,"td",13),AC(2),hl(),Es(3,"td",14),AC(4),hl(),Es(5,"td",15)(6,"div",16)(7,"ds-tag",17),AC(8),hl(),Bw(9,ie,2,0,"ds-tag",18),hl()(),Es(10,"td",19),Bw(11,oe,2,0,"ds-tag",20)(12,ae,2,0,"ds-tag",18)(13,se,2,0,"span",21),hl(),Es(14,"td",22)(15,"div",23),Bw(16,pe,3,1),Bw(17,ue,2,1,"button",24),Bw(18,me,2,4)(19,ge,2,0,"button",25),hl()()()),i&2){let e=t.$implicit,n=tC(2);VE(2),Fg(e.config.name),VE(2),Dl(" ",e.config.authType," "),VE(3),dg("variant",e.scopeLabel==="Platform"?"neutral":e.scopeLabel==="Personal"?"outline":"accent"),VE(),Fg(e.scopeLabel),VE(),Vw(e.canMutate?-1:9),VE(2),Vw(n.isOAuth(e)&&n.connectionOf(e)==="connected"?11:n.isOAuth(e)&&n.connectionOf(e)==="disconnected"?12:13),VE(5),Vw(n.isOAuth(e)?16:-1),VE(),Vw(n.deletion.confirmingId()!==e.key&&n.resetConfirmingKey()!==e.key&&n.connectingKey()!==e.key?17:-1),VE(),Vw(e.canMutate?18:19);}}function Ce(i,t){if(i&1&&(Es(0,"div",7)(1,"table",8)(2,"thead",9)(3,"tr",10)(4,"th",11),AC(5,"Name"),hl(),Es(6,"th",11),AC(7,"Authentication type"),hl(),Es(8,"th",11),AC(9,"Scope"),hl(),Es(10,"th",11),AC(11,"Connection"),hl(),Es(12,"th",11)(13,"span",12),AC(14,"Actions"),hl()()()(),Es(15,"tbody",9),$w(16,he,20,9,"tr",10,Q),hl()()()),i&2){let e=tC();VE(16),zw(e.rowFilter.filteredRows());}}var fe=new Set(["OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"]),J=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=$i(false);isLoading=$i(true);rows=$i([]);deletion=k();connections=$i({});connectingKey=$i(null);resetConfirmingKey=$i(null);resettingKey=$i(null);actionMessage=$i(null);connectAttempt=null;connectPopup=null;connectionsLoad=null;rowFilter=O(this.rows,t=>[t.config.name,t.config.authType,t.scopeLabel].join(" "));ngOnInit(){this.route.paramMap.pipe(U(this.destroyRef)).subscribe(t=>{let e=t.get("namespaceId")??"";e&&e!==this.namespaceId&&(this.namespaceId=e),this.state.setNamespace(e);}),this.route.paramMap.pipe(ne$1(t=>t.get("namespaceId")??""),ga(t=>t?this.namespaceRole.isAdminOfNamespace$(t):br(false)),U(this.destroyRef)).subscribe(t=>this.isAdmin.set(t)),this.state.vm$.pipe(U(this.destroyRef)).subscribe({next:t=>{this.rows.set(this.toRows(t)),this.isLoading.set(false),this.loadConnections();},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:n(this.isAdmin())}});}edit(t){!t.canMutate||!t.config.id||this.router.navigate(["/agentos",this.namespaceId,"auth-settings",t.config.id,"edit"],{queryParams:{scope:t.scope}});}confirmDelete(t){!t.canMutate||!t.config.id||this.deletion.execute(t.key,{request$:this.state.delete(t.config.id,t.scope).pipe(U(this.destroyRef)),errorMessage:`Deleting "${t.config.name}" failed. Try again.`});}isOAuth(t){return fe.has(t.config.authType)}connectionOf(t){return this.connections()[t.key]??"unknown"}connect(t){let e=t.config.id;if(!e||this.connectingKey()||this.resettingKey())return;let n=w();if(!n){this.actionMessage.set({kind:"error",text:"The browser blocked the authorization window. Allow pop-ups for this site and try again."});return}this.actionMessage.set(null),this.resetConfirmingKey.set(null),this.connectPopup=n,this.connectingKey.set(t.key),this.connectAttempt=this.state.connect(e,this.namespaceParam(),r=>n.location.href=r,()=>n.closed).pipe(ui(()=>{this.connectingKey.set(null),this.connectAttempt=null,this.connectPopup=null;}),U(this.destroyRef)).subscribe({next:r=>this.onConnectOutcome(t,r,n),error:()=>{n.close(),this.actionMessage.set({kind:"error",text:`Connecting "${t.config.name}" failed. Check that its OAuth settings are complete, then try again.`});}});}cancelConnect(){this.connectAttempt?.unsubscribe(),this.connectPopup?.close();}requestReset(t){this.resettingKey()||this.connectingKey()||(this.actionMessage.set(null),this.resetConfirmingKey.set(t.key));}cancelReset(){this.resettingKey()||this.resetConfirmingKey.set(null);}confirmReset(t){let e=t.config.id;!e||this.resettingKey()||this.resetConfirmingKey()!==t.key||(this.resettingKey.set(t.key),this.state.resetCredential(e,this.namespaceParam()).pipe(U(this.destroyRef)).subscribe({next:()=>{this.resettingKey.set(null),this.resetConfirmingKey.set(null),this.loadConnections();},error:()=>{this.resettingKey.set(null),this.actionMessage.set({kind:"error",text:`Disconnecting "${t.config.name}" failed. Try again.`});}}));}duplicate(t){if(!t.config.id)return;let e=t.scope==="platform"||t.scope==="namespace"&&!this.isAdmin()?"userOnNs":t.scope;this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:e,template:t.config.id,templateScope:t.scope}});}onConnectOutcome(t,e,n){n.close(),this.loadConnections(),e==="abandoned"?this.actionMessage.set({kind:"info",text:`The authorization window was closed before "${t.config.name}" got connected.`}):e==="timeout"&&this.actionMessage.set({kind:"info",text:`No authorization was received for "${t.config.name}" in time. Try again.`});}namespaceParam(){return this.namespaceId||void 0}loadConnections(){this.connectionsLoad?.unsubscribe();let t=this.rows().filter(e=>this.isOAuth(e)&&e.config.id).map(e=>this.state.getConnection(e.config.id,this.namespaceParam()).pipe(ne$1(n=>[e.key,n.connected?"connected":"disconnected"]),ha(()=>br([e.key,"unknown"]))));if(t.length===0){this.connections.set({});return}this.connectionsLoad=by(t).pipe(U(this.destroyRef)).subscribe(e=>this.connections.set(Object.fromEntries(e)));}toRows(t){return [...this.mapScope(t.platform,"platform","Platform",false),...this.mapScope(t.namespace,"namespace","Namespace",this.isAdmin()),...this.mapScope(t.userOnNs,"userOnNs","Personal",true),...this.mapScope(t.userGlobal,"userGlobal","Personal",true)]}mapScope(t,e,n,r){return t.map((d,Y)=>({key:`${e}:${d.id??Y}`,config:d,scope:e,scopeLabel:n,canMutate:r}))}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=Dw({type:i,selectors:[["agentos-auth-settings-all-scopes"]],decls:10,vars:4,consts:[["title","Auth settings","description","Authentication settings available in this namespace, including inherited platform and personal entries."],["label","Filter auth settings","placeholder","Filter auth settings\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],[3,"class"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Auth settings"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Authentication type",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Connection"],["variant","accent"],[1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["type","button","disabled",""],["role","status",1,"settings-table__confirm-label"],["type","button",3,"click"],[1,"settings-table__confirm-label"],["type","button",3,"click","disabled"],["type","button",3,"disabled"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(e,n){if(e&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(d){return n.rowFilter.query.set(d)}),hl(),Es(2,"button",2),vg("click",function(){return n.openCreateForm()}),AC(3,"New auth setting"),hl()(),Bw(4,X,2,1,"p",3),Bw(5,Z,2,4,"p",4),Bw(6,ee,2,0,"p",5)(7,te,2,0,"p",6)(8,ne,2,0,"p",5)(9,Ce,18,0,"div",7)),e&2){let r;VE(),dg("query",n.rowFilter.query()),VE(3),Vw(n.deletion.error()?4:-1),VE(),Vw((r=n.actionMessage())?5:-1,r),VE(),Vw(n.isLoading()?6:n.rows().length===0?7:n.rowFilter.filteredRows().length===0?8:9);}},dependencies:[at,fn,ko,Fo,P,P$1],encapsulation:2})};export{J as AuthSettingsAllScopesComponent};
1
+ import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-HtmwgODm.js';import {I}from'./chunk-D4eJc3W1.js';import {g,W,t as F,K as we,$ as $i,U,ad as ne$1,a1 as ga,aa as br,aL as ui,a2 as ha,ac as by,D as Dw,E as Es,R as vg,c as hl,b as AC,a as Bw,d as VE,P as dg,i as Vw,v as tC,F as Fg,G as EC,n as lg,u as Dl,q as $w,z as zw,Q as Qw,w as pf,x as hf}from'./main-PZMWRMRC.js';import {z as k,j as O,a5 as w,e as at,c as fn,k as ko,l as Fo,P,B as P$1}from'./chunk-0rWkqE7F.js';import'./chunk-m1ylN0EP.js';var Q=(i,t)=>t.key;function X(i,t){if(i&1&&(Es(0,"p",3),AC(1),hl()),i&2){let e=tC();VE(),Fg(e.deletion.error());}}function Z(i,t){if(i&1&&(Es(0,"p"),AC(1),hl()),i&2){let e=t;EC(e.kind==="error"?"settings-table__error":"settings-table__status"),lg("role",e.kind==="error"?"alert":"status"),VE(),Dl(" ",e.text," ");}}function ee(i,t){i&1&&(Es(0,"p",5),AC(1,"Loading auth settings\u2026"),hl());}function te(i,t){i&1&&(Es(0,"p",6),AC(1,"No auth settings available."),hl());}function ne(i,t){i&1&&(Es(0,"p",5),AC(1,"No auth settings match the current filter."),hl());}function ie(i,t){i&1&&(Es(0,"ds-tag",18),AC(1,"Read-only"),hl());}function oe(i,t){i&1&&(Es(0,"ds-tag",20),AC(1,"Connected"),hl());}function ae(i,t){i&1&&(Es(0,"ds-tag",18),AC(1,"Not connected"),hl());}function se(i,t){i&1&&(Es(0,"span",21),AC(1,"\u2014"),hl());}function re(i,t){if(i&1){let e=Qw();Es(0,"span",26),AC(1,"Waiting for authorization\u2026"),hl(),Es(2,"button",27),vg("click",function(){pf(e);let r=tC(4);return hf(r.cancelConnect())}),AC(3," Cancel "),hl();}if(i&2){let e=tC(2).$implicit;VE(2),lg("aria-label","Stop waiting for the authorization of "+e.config.name);}}function le(i,t){if(i&1){let e=Qw();Es(0,"span",28),AC(1,"Disconnect?"),hl(),Es(2,"button",29),vg("click",function(){pf(e);let r=tC(2).$implicit,d=tC(2);return hf(d.confirmReset(r))}),AC(3),hl(),Es(4,"button",29),vg("click",function(){pf(e);let r=tC(4);return hf(r.cancelReset())}),AC(5," Cancel "),hl();}if(i&2){let e=tC(2).$implicit,n=tC(2);VE(2),dg("disabled",n.resettingKey()===e.key),lg("aria-label","Confirm disconnecting "+e.config.name),VE(),Dl(" ",n.resettingKey()===e.key?"Disconnecting\u2026":"Confirm"," "),VE(),dg("disabled",n.resettingKey()===e.key),lg("aria-label","Cancel disconnecting "+e.config.name);}}function ce(i,t){if(i&1){let e=Qw();Es(0,"button",29),vg("click",function(){pf(e);let r=tC(3).$implicit,d=tC(2);return hf(d.requestReset(r))}),AC(1," Disconnect "),hl();}if(i&2){let e=tC(3).$implicit,n=tC(2);dg("disabled",n.connectingKey()!==null),lg("aria-label","Disconnect "+e.config.name);}}function de(i,t){if(i&1){let e=Qw();Es(0,"button",29),vg("click",function(){pf(e);let r=tC(2).$implicit,d=tC(2);return hf(d.connect(r))}),AC(1),hl(),Bw(2,ce,2,2,"button",30);}if(i&2){let e=tC(2).$implicit,n=tC(2);dg("disabled",n.connectingKey()!==null||n.resettingKey()!==null),lg("aria-label",(n.connectionOf(e)==="connected"?"Reconnect ":"Connect ")+e.config.name),VE(),Dl(" ",n.connectionOf(e)==="connected"?"Reconnect":"Connect"," "),VE(),Vw(n.connectionOf(e)==="connected"?2:-1);}}function pe(i,t){if(i&1&&Bw(0,re,4,1)(1,le,6,5)(2,de,3,4),i&2){let e=tC().$implicit,n=tC(2);Vw(n.connectingKey()===e.key?0:n.resetConfirmingKey()===e.key?1:n.deletion.confirmingId()!==e.key?2:-1);}}function ue(i,t){if(i&1){let e=Qw();Es(0,"button",27),vg("click",function(){pf(e);let r=tC().$implicit,d=tC(2);return hf(d.duplicate(r))}),AC(1," Duplicate "),hl();}if(i&2){let e=tC().$implicit;lg("aria-label","Duplicate "+e.config.name);}}function _e(i,t){if(i&1){let e=Qw();Es(0,"button",27),vg("click",function(){pf(e);let r=tC(2).$implicit,d=tC(2);return hf(d.edit(r))}),AC(1," Edit "),hl();}if(i&2){let e=tC(2).$implicit;lg("aria-label","Edit "+e.config.name);}}function me(i,t){if(i&1){let e=Qw();Bw(0,_e,2,1,"button",24),Es(1,"agentos-row-delete-action",31),vg("deleteRequested",function(){pf(e);let r=tC().$implicit,d=tC(2);return hf(d.deletion.request(r.key))})("deleteConfirmed",function(){pf(e);let r=tC().$implicit,d=tC(2);return hf(d.confirmDelete(r))})("deleteCancelled",function(){pf(e);let r=tC(3);return hf(r.deletion.cancel())}),hl();}if(i&2){let e=tC().$implicit,n=tC(2);Vw(n.deletion.confirmingId()!==e.key?0:-1),VE(),dg("rowKey",e.key)("rowLabel",e.config.name)("state",n.deletion);}}function ge(i,t){i&1&&(Es(0,"button",25),AC(1,"Inherited"),hl());}function he(i,t){if(i&1&&(Es(0,"tr",10)(1,"td",13),AC(2),hl(),Es(3,"td",14),AC(4),hl(),Es(5,"td",15)(6,"div",16)(7,"ds-tag",17),AC(8),hl(),Bw(9,ie,2,0,"ds-tag",18),hl()(),Es(10,"td",19),Bw(11,oe,2,0,"ds-tag",20)(12,ae,2,0,"ds-tag",18)(13,se,2,0,"span",21),hl(),Es(14,"td",22)(15,"div",23),Bw(16,pe,3,1),Bw(17,ue,2,1,"button",24),Bw(18,me,2,4)(19,ge,2,0,"button",25),hl()()()),i&2){let e=t.$implicit,n=tC(2);VE(2),Fg(e.config.name),VE(2),Dl(" ",e.config.authType," "),VE(3),dg("variant",e.scopeLabel==="Platform"?"neutral":e.scopeLabel==="Personal"?"outline":"accent"),VE(),Fg(e.scopeLabel),VE(),Vw(e.canMutate?-1:9),VE(2),Vw(n.isOAuth(e)&&n.connectionOf(e)==="connected"?11:n.isOAuth(e)&&n.connectionOf(e)==="disconnected"?12:13),VE(5),Vw(n.isOAuth(e)?16:-1),VE(),Vw(n.deletion.confirmingId()!==e.key&&n.resetConfirmingKey()!==e.key&&n.connectingKey()!==e.key?17:-1),VE(),Vw(e.canMutate?18:19);}}function Ce(i,t){if(i&1&&(Es(0,"div",7)(1,"table",8)(2,"thead",9)(3,"tr",10)(4,"th",11),AC(5,"Name"),hl(),Es(6,"th",11),AC(7,"Authentication type"),hl(),Es(8,"th",11),AC(9,"Scope"),hl(),Es(10,"th",11),AC(11,"Connection"),hl(),Es(12,"th",11)(13,"span",12),AC(14,"Actions"),hl()()()(),Es(15,"tbody",9),$w(16,he,20,9,"tr",10,Q),hl()()()),i&2){let e=tC();VE(16),zw(e.rowFilter.filteredRows());}}var fe=new Set(["OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"]),J=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=$i(false);isLoading=$i(true);rows=$i([]);deletion=k();connections=$i({});connectingKey=$i(null);resetConfirmingKey=$i(null);resettingKey=$i(null);actionMessage=$i(null);connectAttempt=null;connectPopup=null;connectionsLoad=null;rowFilter=O(this.rows,t=>[t.config.name,t.config.authType,t.scopeLabel].join(" "));ngOnInit(){this.route.paramMap.pipe(U(this.destroyRef)).subscribe(t=>{let e=t.get("namespaceId")??"";e&&e!==this.namespaceId&&(this.namespaceId=e),this.state.setNamespace(e);}),this.route.paramMap.pipe(ne$1(t=>t.get("namespaceId")??""),ga(t=>t?this.namespaceRole.isAdminOfNamespace$(t):br(false)),U(this.destroyRef)).subscribe(t=>this.isAdmin.set(t)),this.state.vm$.pipe(U(this.destroyRef)).subscribe({next:t=>{this.rows.set(this.toRows(t)),this.isLoading.set(false),this.loadConnections();},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:n(this.isAdmin())}});}edit(t){!t.canMutate||!t.config.id||this.router.navigate(["/agentos",this.namespaceId,"auth-settings",t.config.id,"edit"],{queryParams:{scope:t.scope}});}confirmDelete(t){!t.canMutate||!t.config.id||this.deletion.execute(t.key,{request$:this.state.delete(t.config.id,t.scope).pipe(U(this.destroyRef)),errorMessage:`Deleting "${t.config.name}" failed. Try again.`});}isOAuth(t){return fe.has(t.config.authType)}connectionOf(t){return this.connections()[t.key]??"unknown"}connect(t){let e=t.config.id;if(!e||this.connectingKey()||this.resettingKey())return;let n=w();if(!n){this.actionMessage.set({kind:"error",text:"The browser blocked the authorization window. Allow pop-ups for this site and try again."});return}this.actionMessage.set(null),this.resetConfirmingKey.set(null),this.connectPopup=n,this.connectingKey.set(t.key),this.connectAttempt=this.state.connect(e,this.namespaceParam(),r=>n.location.href=r,()=>n.closed).pipe(ui(()=>{this.connectingKey.set(null),this.connectAttempt=null,this.connectPopup=null;}),U(this.destroyRef)).subscribe({next:r=>this.onConnectOutcome(t,r,n),error:()=>{n.close(),this.actionMessage.set({kind:"error",text:`Connecting "${t.config.name}" failed. Check that its OAuth settings are complete, then try again.`});}});}cancelConnect(){this.connectAttempt?.unsubscribe(),this.connectPopup?.close();}requestReset(t){this.resettingKey()||this.connectingKey()||(this.actionMessage.set(null),this.resetConfirmingKey.set(t.key));}cancelReset(){this.resettingKey()||this.resetConfirmingKey.set(null);}confirmReset(t){let e=t.config.id;!e||this.resettingKey()||this.resetConfirmingKey()!==t.key||(this.resettingKey.set(t.key),this.state.resetCredential(e,this.namespaceParam()).pipe(U(this.destroyRef)).subscribe({next:()=>{this.resettingKey.set(null),this.resetConfirmingKey.set(null),this.loadConnections();},error:()=>{this.resettingKey.set(null),this.actionMessage.set({kind:"error",text:`Disconnecting "${t.config.name}" failed. Try again.`});}}));}duplicate(t){if(!t.config.id)return;let e=t.scope==="platform"||t.scope==="namespace"&&!this.isAdmin()?"userOnNs":t.scope;this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:e,template:t.config.id,templateScope:t.scope}});}onConnectOutcome(t,e,n){n.close(),this.loadConnections(),e==="abandoned"?this.actionMessage.set({kind:"info",text:`The authorization window was closed before "${t.config.name}" got connected.`}):e==="timeout"&&this.actionMessage.set({kind:"info",text:`No authorization was received for "${t.config.name}" in time. Try again.`});}namespaceParam(){return this.namespaceId||void 0}loadConnections(){this.connectionsLoad?.unsubscribe();let t=this.rows().filter(e=>this.isOAuth(e)&&e.config.id).map(e=>this.state.getConnection(e.config.id,this.namespaceParam()).pipe(ne$1(n=>[e.key,n.connected?"connected":"disconnected"]),ha(()=>br([e.key,"unknown"]))));if(t.length===0){this.connections.set({});return}this.connectionsLoad=by(t).pipe(U(this.destroyRef)).subscribe(e=>this.connections.set(Object.fromEntries(e)));}toRows(t){return [...this.mapScope(t.platform,"platform","Platform",false),...this.mapScope(t.namespace,"namespace","Namespace",this.isAdmin()),...this.mapScope(t.userOnNs,"userOnNs","Personal",true),...this.mapScope(t.userGlobal,"userGlobal","Personal",true)]}mapScope(t,e,n,r){return t.map((d,Y)=>({key:`${e}:${d.id??Y}`,config:d,scope:e,scopeLabel:n,canMutate:r}))}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=Dw({type:i,selectors:[["agentos-auth-settings-all-scopes"]],decls:10,vars:4,consts:[["title","Auth settings","description","Authentication settings available in this namespace, including inherited platform and personal entries."],["label","Filter auth settings","placeholder","Filter auth settings\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],[3,"class"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Auth settings"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Authentication type",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Connection"],["variant","accent"],[1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["type","button","disabled",""],["role","status",1,"settings-table__confirm-label"],["type","button",3,"click"],[1,"settings-table__confirm-label"],["type","button",3,"click","disabled"],["type","button",3,"disabled"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(e,n){if(e&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(d){return n.rowFilter.query.set(d)}),hl(),Es(2,"button",2),vg("click",function(){return n.openCreateForm()}),AC(3,"New auth setting"),hl()(),Bw(4,X,2,1,"p",3),Bw(5,Z,2,4,"p",4),Bw(6,ee,2,0,"p",5)(7,te,2,0,"p",6)(8,ne,2,0,"p",5)(9,Ce,18,0,"div",7)),e&2){let r;VE(),dg("query",n.rowFilter.query()),VE(3),Vw(n.deletion.error()?4:-1),VE(),Vw((r=n.actionMessage())?5:-1,r),VE(),Vw(n.isLoading()?6:n.rows().length===0?7:n.rowFilter.filteredRows().length===0?8:9);}},dependencies:[at,fn,ko,Fo,P,P$1],encapsulation:2})};export{J as AuthSettingsAllScopesComponent};
@@ -1 +1 @@
1
- import {y,p as pt,T as Te,g as gn,q as qt,m as md,C as Co,M as Mo,H as Ht,U as Ut,a as po,h as ho,O as On,w as wa,b as hn,c as fn,u as un,d as cn,r as rn,e as at,i as sn,n as ln,l as Fo}from'./chunk-qAO_WS2x.js';import {g,K as we,W,I as J,$ as $i,U,D as Dw,E as Es,f as fg,R as vg,a as Bw,c as hl,S as NI,b as AC,d as VE,P as dg,i as Vw,T as AI,u as Dl,a4 as we$1,a5 as vd,a6 as x,v as tC,Q as Qw,F as Fg,a7 as Fn,w as pf,x as hf,q as $w,z as zw}from'./main-VSQLTBR6.js';var I=class e{api=g(we$1);isLoading=$i(false);result=$i(null);errorMessage=$i(null);invoke(t,n,o,l){return this.isLoading.set(true),this.result.set(null),this.errorMessage.set(null),this.api.invoke({namespaceId:t,userId:n||void 0,toolName:o,payload:l||void 0}).pipe(vd({next:v=>{this.result.set(v),this.isLoading.set(false);},error:v=>{this.errorMessage.set(le(v)),this.isLoading.set(false);}}))}reset(){this.result.set(null),this.errorMessage.set(null);}static \u0275fac=function(n){return new(n||e)};static \u0275prov=x({token:e,factory:e.\u0275fac,providedIn:"root"})};function le(e){if(e instanceof Fn){let t=e.error;return t&&typeof t=="object"&&"message"in t&&typeof t.message=="string"?t.message:typeof t=="string"&&t.trim().length>0?t:e.statusText||`HTTP ${e.status}`}return e instanceof Error?e.message:"Unknown error"}var de=(e,t)=>t.id;function me(e,t){e&1&&(Es(0,"p",14),AC(1,"Loading namespaces\u2026"),hl());}function pe(e,t){if(e&1&&(Es(0,"option",17),AC(1),hl()),e&2){let n=t.$implicit;dg("value",n.id),VE(),Fg(n.name);}}function ce(e,t){if(e&1&&(Es(0,"select",15)(1,"option",16),AC(2,"Select a namespace"),hl(),$w(3,pe,2,2,"option",17,de),hl(),NI()),e&2){let n=tC(2);AI(),VE(3),zw(n.namespaces());}}function ue(e,t){if(e&1&&Bw(0,me,2,0,"p",14)(1,ce,5,0,"select",15),e&2){let n=tC();Vw(n.namespacesLoading()?0:1);}}function fe(e,t){if(e&1&&fg(0,"input",3),e&2){let n=tC();dg("value",n.namespaceName()??n.namespaceId);}}function ge(e,t){if(e&1){let n=Qw();Es(0,"button",18),vg("click",function(){pf(n);let l=tC();return hf(l.reset())}),AC(1,"Clear result"),hl();}}function ve(e,t){e&1&&(Es(0,"ds-card",12)(1,"pre",19),AC(2),hl()()),e&2&&(VE(2),Fg(t));}function ye(e,t){e&1&&(Es(0,"span",21),AC(1,"Metadata"),hl(),Es(2,"pre",19),AC(3),hl()),e&2&&(VE(3),Fg(t));}function Ce(e,t){if(e&1&&(Es(0,"dt"),AC(1,"Type"),hl(),Es(2,"dd",23),AC(3),hl()),e&2){let n=tC(2);VE(3),Fg(n.errorType);}}function _e(e,t){if(e&1&&(Es(0,"dt"),AC(1,"Message"),hl(),Es(2,"dd"),AC(3),hl()),e&2){let n=tC(2);VE(3),Fg(n.errorMessage);}}function be(e,t){if(e&1&&(Es(0,"span",21),AC(1,"Tool error details"),hl(),Es(2,"dl",22),Bw(3,Ce,4,1),Bw(4,_e,4,1),hl()),e&2){let n=tC();VE(3),Vw(n.errorType?3:-1),VE(),Vw(n.errorMessage?4:-1);}}function he(e,t){if(e&1&&(Es(0,"ds-card",13)(1,"div")(2,"ds-tag",20),AC(3),hl()(),Es(4,"span",21),AC(5,"Output"),hl(),Es(6,"pre",19),AC(7),hl(),Bw(8,ye,4,1),Es(9,"span",21),AC(10,"Structured output"),hl(),Es(11,"pre",19),AC(12),hl(),Bw(13,be,5,2),hl()),e&2){let n,o=t,l=tC();dg("heading","Result \u2014 "+o.toolName),VE(2),dg("variant",o.success?"accent":"outline"),VE(),Fg(o.success?"Success":"Tool error"),VE(4),Fg(o.output),VE(),Vw((n=l.formatMetadata(o.metadata))?8:-1,n),VE(4),Fg(l.formatStructuredOutput(o.structuredOutput)??"null"),VE(),Vw(o.errorType||o.errorMessage?13:-1);}}var re=class e{destroyRef=g(we);route=g(W);namespaceController=g(J);userState=g(y);state=g(I);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;namespaces=$i([]);namespacesLoading=$i(true);namespaceName=$i(null);form=new pt({namespaceId:new Te("",{nonNullable:true,validators:[gn.required]}),userId:new Te("",{nonNullable:true}),toolName:new Te("",{nonNullable:true,validators:[gn.required]}),payload:new Te("",{nonNullable:true})});ngOnInit(){let t=this.userState.currentUser()?.id;t?this.form.controls.userId.patchValue(t):this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:n=>{n.id&&this.form.controls.userId.patchValue(n.id);}}),this.isPlatformMode?this.namespaceController.listAllNamespace().pipe(U(this.destroyRef)).subscribe({next:n=>{this.namespaces.set(n.map(o=>({id:o.id,name:o.name}))),this.namespacesLoading.set(false);},error:()=>this.namespacesLoading.set(false)}):(this.form.controls.namespaceId.patchValue(this.namespaceId),this.namespacesLoading.set(false),this.namespaceController.getByIdNamespace(this.namespaceId).pipe(U(this.destroyRef)).subscribe({next:n=>this.namespaceName.set(n.name),error:()=>this.namespaceName.set(this.namespaceId)}));}submit(){if(this.form.invalid||this.state.isLoading())return;let{namespaceId:t,userId:n,toolName:o,payload:l}=this.form.getRawValue();this.state.invoke(t,n.trim()||void 0,o.trim(),l.trim()||void 0).pipe(U(this.destroyRef)).subscribe();}reset(){this.state.reset();}formatMetadata(t){return !t||Object.keys(t).length===0?null:JSON.stringify(t,null,2)}formatStructuredOutput(t){return t===void 0?null:JSON.stringify(t,null,2)}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=Dw({type:e,selectors:[["agentos-tool-invoke"]],decls:18,vars:8,consts:[["title","Tool invoke",3,"description"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Namespace","controlId","ti-namespace","required",""],["dsControl","","id","ti-namespace","type","text","readonly","",3,"value"],["label","User ID","labelHint","optional","controlId","ti-user"],["dsControl","","id","ti-user","type","text","formControlName","userId","placeholder","UUID of the user \u2014 adds user-scoped overlay layers","autocomplete","off"],["label","Tool name","controlId","ti-tool","required","","hint","Exact tool name as returned by the agent definition inspect page. When not found, the error response lists all available tools for the selected namespace."],["dsControl","","mono","","id","ti-tool","type","text","formControlName","toolName","placeholder","e.g. MY_FILES__listFiles","autocomplete","off","spellcheck","false"],["label","Payload","labelHint","optional","controlId","ti-payload"],["dsControl","","mono","","id","ti-payload","formControlName","payload","rows","6","placeholder",'JSON arguments for the tool, e.g. {"path": "/some/dir"} \u2014 leave empty for tools with no input.',"spellcheck","false"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button"],["heading","Error"],[3,"heading"],[1,"ds-hint"],["dsControl","","id","ti-namespace","formControlName","namespaceId"],["value","","disabled",""],[3,"value"],["dsButton","","type","button",3,"click"],[1,"ds-pre"],[3,"variant"],[1,"ds-micro"],["dsDefinitionList",""],[1,"ds-mono"]],template:function(n,o){if(n&1&&(Es(0,"ds-page"),fg(1,"ds-section-header",0),Es(2,"form",1),vg("ngSubmit",function(){return o.submit()}),Es(3,"ds-form-field",2),Bw(4,ue,2,1)(5,fe,1,1,"input",3),hl(),Es(6,"ds-form-field",4),fg(7,"input",5),NI(),hl(),Es(8,"ds-form-field",6),fg(9,"input",7),NI(),hl(),Es(10,"ds-form-field",8),fg(11,"textarea",9),NI(),hl(),Es(12,"ds-form-actions")(13,"button",10),AC(14),hl(),Bw(15,ge,2,0,"button",11),hl()(),Bw(16,ve,3,1,"ds-card",12),Bw(17,he,14,7,"ds-card",13),hl()),n&2){let l,v;VE(),dg("description",o.isPlatformMode?"Execute any registered tool directly \u2014 bypasses the normal agent-run pipeline. Restricted to super-admins.":"Execute a registered tool directly in this namespace \u2014 bypasses the normal agent-run pipeline."),VE(),dg("formGroup",o.form),VE(2),Vw(o.isPlatformMode?4:5),VE(3),AI(),VE(2),AI(),VE(2),AI(),VE(2),dg("disabled",o.form.invalid||o.state.isLoading()),VE(),Dl(" ",o.state.isLoading()?"Running\u2026":"Run tool"," "),VE(),Vw(o.state.result()||o.state.errorMessage()?15:-1),VE(),Vw((l=o.state.errorMessage())?16:-1,l),VE(),Vw((v=o.state.result())?17:-1,v);}},dependencies:[qt,md,Co,Mo,Ht,Ut,po,ho,On,wa,hn,fn,un,cn,rn,at,sn,ln,Fo],encapsulation:2})};export{re as ToolInvokeComponent};
1
+ import {y,p as pt,T as Te,g as gn,q as qt,m as md,C as Co,M as Mo,H as Ht,U as Ut,a as po,h as ho,O as On,w as wa,b as hn,c as fn,u as un,d as cn,r as rn,e as at,i as sn,n as ln,l as Fo}from'./chunk-0rWkqE7F.js';import {g,K as we,W,I as J,$ as $i,U,D as Dw,E as Es,f as fg,R as vg,a as Bw,c as hl,S as NI,b as AC,d as VE,P as dg,i as Vw,T as AI,u as Dl,a4 as we$1,a5 as vd,a6 as x,v as tC,Q as Qw,F as Fg,a7 as Fn,w as pf,x as hf,q as $w,z as zw}from'./main-PZMWRMRC.js';var I=class e{api=g(we$1);isLoading=$i(false);result=$i(null);errorMessage=$i(null);invoke(t,n,o,l){return this.isLoading.set(true),this.result.set(null),this.errorMessage.set(null),this.api.invoke({namespaceId:t,userId:n||void 0,toolName:o,payload:l||void 0}).pipe(vd({next:v=>{this.result.set(v),this.isLoading.set(false);},error:v=>{this.errorMessage.set(le(v)),this.isLoading.set(false);}}))}reset(){this.result.set(null),this.errorMessage.set(null);}static \u0275fac=function(n){return new(n||e)};static \u0275prov=x({token:e,factory:e.\u0275fac,providedIn:"root"})};function le(e){if(e instanceof Fn){let t=e.error;return t&&typeof t=="object"&&"message"in t&&typeof t.message=="string"?t.message:typeof t=="string"&&t.trim().length>0?t:e.statusText||`HTTP ${e.status}`}return e instanceof Error?e.message:"Unknown error"}var de=(e,t)=>t.id;function me(e,t){e&1&&(Es(0,"p",14),AC(1,"Loading namespaces\u2026"),hl());}function pe(e,t){if(e&1&&(Es(0,"option",17),AC(1),hl()),e&2){let n=t.$implicit;dg("value",n.id),VE(),Fg(n.name);}}function ce(e,t){if(e&1&&(Es(0,"select",15)(1,"option",16),AC(2,"Select a namespace"),hl(),$w(3,pe,2,2,"option",17,de),hl(),NI()),e&2){let n=tC(2);AI(),VE(3),zw(n.namespaces());}}function ue(e,t){if(e&1&&Bw(0,me,2,0,"p",14)(1,ce,5,0,"select",15),e&2){let n=tC();Vw(n.namespacesLoading()?0:1);}}function fe(e,t){if(e&1&&fg(0,"input",3),e&2){let n=tC();dg("value",n.namespaceName()??n.namespaceId);}}function ge(e,t){if(e&1){let n=Qw();Es(0,"button",18),vg("click",function(){pf(n);let l=tC();return hf(l.reset())}),AC(1,"Clear result"),hl();}}function ve(e,t){e&1&&(Es(0,"ds-card",12)(1,"pre",19),AC(2),hl()()),e&2&&(VE(2),Fg(t));}function ye(e,t){e&1&&(Es(0,"span",21),AC(1,"Metadata"),hl(),Es(2,"pre",19),AC(3),hl()),e&2&&(VE(3),Fg(t));}function Ce(e,t){if(e&1&&(Es(0,"dt"),AC(1,"Type"),hl(),Es(2,"dd",23),AC(3),hl()),e&2){let n=tC(2);VE(3),Fg(n.errorType);}}function _e(e,t){if(e&1&&(Es(0,"dt"),AC(1,"Message"),hl(),Es(2,"dd"),AC(3),hl()),e&2){let n=tC(2);VE(3),Fg(n.errorMessage);}}function be(e,t){if(e&1&&(Es(0,"span",21),AC(1,"Tool error details"),hl(),Es(2,"dl",22),Bw(3,Ce,4,1),Bw(4,_e,4,1),hl()),e&2){let n=tC();VE(3),Vw(n.errorType?3:-1),VE(),Vw(n.errorMessage?4:-1);}}function he(e,t){if(e&1&&(Es(0,"ds-card",13)(1,"div")(2,"ds-tag",20),AC(3),hl()(),Es(4,"span",21),AC(5,"Output"),hl(),Es(6,"pre",19),AC(7),hl(),Bw(8,ye,4,1),Es(9,"span",21),AC(10,"Structured output"),hl(),Es(11,"pre",19),AC(12),hl(),Bw(13,be,5,2),hl()),e&2){let n,o=t,l=tC();dg("heading","Result \u2014 "+o.toolName),VE(2),dg("variant",o.success?"accent":"outline"),VE(),Fg(o.success?"Success":"Tool error"),VE(4),Fg(o.output),VE(),Vw((n=l.formatMetadata(o.metadata))?8:-1,n),VE(4),Fg(l.formatStructuredOutput(o.structuredOutput)??"null"),VE(),Vw(o.errorType||o.errorMessage?13:-1);}}var re=class e{destroyRef=g(we);route=g(W);namespaceController=g(J);userState=g(y);state=g(I);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;namespaces=$i([]);namespacesLoading=$i(true);namespaceName=$i(null);form=new pt({namespaceId:new Te("",{nonNullable:true,validators:[gn.required]}),userId:new Te("",{nonNullable:true}),toolName:new Te("",{nonNullable:true,validators:[gn.required]}),payload:new Te("",{nonNullable:true})});ngOnInit(){let t=this.userState.currentUser()?.id;t?this.form.controls.userId.patchValue(t):this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:n=>{n.id&&this.form.controls.userId.patchValue(n.id);}}),this.isPlatformMode?this.namespaceController.listAllNamespace().pipe(U(this.destroyRef)).subscribe({next:n=>{this.namespaces.set(n.map(o=>({id:o.id,name:o.name}))),this.namespacesLoading.set(false);},error:()=>this.namespacesLoading.set(false)}):(this.form.controls.namespaceId.patchValue(this.namespaceId),this.namespacesLoading.set(false),this.namespaceController.getByIdNamespace(this.namespaceId).pipe(U(this.destroyRef)).subscribe({next:n=>this.namespaceName.set(n.name),error:()=>this.namespaceName.set(this.namespaceId)}));}submit(){if(this.form.invalid||this.state.isLoading())return;let{namespaceId:t,userId:n,toolName:o,payload:l}=this.form.getRawValue();this.state.invoke(t,n.trim()||void 0,o.trim(),l.trim()||void 0).pipe(U(this.destroyRef)).subscribe();}reset(){this.state.reset();}formatMetadata(t){return !t||Object.keys(t).length===0?null:JSON.stringify(t,null,2)}formatStructuredOutput(t){return t===void 0?null:JSON.stringify(t,null,2)}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=Dw({type:e,selectors:[["agentos-tool-invoke"]],decls:18,vars:8,consts:[["title","Tool invoke",3,"description"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Namespace","controlId","ti-namespace","required",""],["dsControl","","id","ti-namespace","type","text","readonly","",3,"value"],["label","User ID","labelHint","optional","controlId","ti-user"],["dsControl","","id","ti-user","type","text","formControlName","userId","placeholder","UUID of the user \u2014 adds user-scoped overlay layers","autocomplete","off"],["label","Tool name","controlId","ti-tool","required","","hint","Exact tool name as returned by the agent definition inspect page. When not found, the error response lists all available tools for the selected namespace."],["dsControl","","mono","","id","ti-tool","type","text","formControlName","toolName","placeholder","e.g. MY_FILES__listFiles","autocomplete","off","spellcheck","false"],["label","Payload","labelHint","optional","controlId","ti-payload"],["dsControl","","mono","","id","ti-payload","formControlName","payload","rows","6","placeholder",'JSON arguments for the tool, e.g. {"path": "/some/dir"} \u2014 leave empty for tools with no input.',"spellcheck","false"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button"],["heading","Error"],[3,"heading"],[1,"ds-hint"],["dsControl","","id","ti-namespace","formControlName","namespaceId"],["value","","disabled",""],[3,"value"],["dsButton","","type","button",3,"click"],[1,"ds-pre"],[3,"variant"],[1,"ds-micro"],["dsDefinitionList",""],[1,"ds-mono"]],template:function(n,o){if(n&1&&(Es(0,"ds-page"),fg(1,"ds-section-header",0),Es(2,"form",1),vg("ngSubmit",function(){return o.submit()}),Es(3,"ds-form-field",2),Bw(4,ue,2,1)(5,fe,1,1,"input",3),hl(),Es(6,"ds-form-field",4),fg(7,"input",5),NI(),hl(),Es(8,"ds-form-field",6),fg(9,"input",7),NI(),hl(),Es(10,"ds-form-field",8),fg(11,"textarea",9),NI(),hl(),Es(12,"ds-form-actions")(13,"button",10),AC(14),hl(),Bw(15,ge,2,0,"button",11),hl()(),Bw(16,ve,3,1,"ds-card",12),Bw(17,he,14,7,"ds-card",13),hl()),n&2){let l,v;VE(),dg("description",o.isPlatformMode?"Execute any registered tool directly \u2014 bypasses the normal agent-run pipeline. Restricted to super-admins.":"Execute a registered tool directly in this namespace \u2014 bypasses the normal agent-run pipeline."),VE(),dg("formGroup",o.form),VE(2),Vw(o.isPlatformMode?4:5),VE(3),AI(),VE(2),AI(),VE(2),AI(),VE(2),dg("disabled",o.form.invalid||o.state.isLoading()),VE(),Dl(" ",o.state.isLoading()?"Running\u2026":"Run tool"," "),VE(),Vw(o.state.result()||o.state.errorMessage()?15:-1),VE(),Vw((l=o.state.errorMessage())?16:-1,l),VE(),Vw((v=o.state.result())?17:-1,v);}},dependencies:[qt,md,Co,Mo,Ht,Ut,po,ho,On,wa,hn,fn,un,cn,rn,at,sn,ln,Fo],encapsulation:2})};export{re as ToolInvokeComponent};
@@ -1 +1 @@
1
- import {b as hn,c as fn,r as rn,D as pn,e as at,n as ln,J as Pi,K as On}from'./chunk-qAO_WS2x.js';import {g,W as W$1,t as F,K as we,ag as U,$ as $i,o as oT,U as U$1,D as Dw,au as $t,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,i as Vw,v as tC,F as Fg,M as Mg,u as Dl,q as $w,z as zw,Q as Qw,f as fg,av as QC,aw as XC,w as pf,x as hf,ax as YD}from'./main-VSQLTBR6.js';var j=(t,n)=>n.id,z=(t,n)=>n.name;function q(t,n){t&1&&(Es(0,"p",3),AC(1,"Loading\u2026"),hl());}function Q(t,n){t&1&&(Es(0,"ds-notice"),AC(1,"Failed to load agent definition."),hl());}function W(t,n){if(t&1&&(Es(0,"dt"),AC(1,"User context"),hl(),Es(2,"dd",6),AC(3),hl()),t&2){let e=tC();VE(3),Fg(e.userId);}}function X(t,n){if(t&1){let e=Qw();Es(0,"ds-card")(1,"ds-disclosure",12),vg("toggled",function(){pf(e);let m=tC(2);return hf(m.toggleSystemPrompt())}),Es(2,"pre",13),AC(3),hl()()();}if(t&2){let e=tC(),r=tC();VE(),dg("open",!r.systemPromptCollapsed()),VE(2),Fg(e.systemPrompt);}}function Y(t,n){if(t&1){let e=Qw();Es(0,"ds-card")(1,"ds-disclosure",14),vg("toggled",function(){pf(e);let m=tC(2);return hf(m.toggleInstructions())}),Es(2,"pre",13),AC(3),hl()()();}if(t&2){let e=tC(),r=tC();VE(),dg("open",!r.instructionsCollapsed()),VE(2),Fg(e.instructions);}}function Z(t,n){t&1&&(Es(0,"p",3),AC(1," This agent declares no skill, so it gets no skill tools. Attach skills from the edit form. "),hl());}function ee(t,n){t&1&&(Es(0,"span",17),AC(1,"platform"),hl());}function te(t,n){t&1&&(Es(0,"span",17),AC(1,"SKILL.md"),hl());}function ne(t,n){if(t&1&&(Es(0,"li",15)(1,"span")(2,"span",16),AC(3),hl(),Bw(4,ee,2,0,"span",17),Bw(5,te,2,0,"span",17),hl(),Es(6,"p",3),AC(7),hl()()),t&2){let e=n.$implicit;VE(3),Fg(e.name),VE(),Vw(e.namespaceId?-1:4),VE(),Vw(e.readOnly?5:-1),VE(2),Fg(e.description);}}function ie(t,n){if(t&1&&(Es(0,"ul",11),$w(1,ne,8,4,"li",15,j),hl()),t&2){let e=tC(2);VE(),zw(e.resolvedSkills());}}function oe(t,n){t&1&&(Es(0,"p",3),AC(1,"No tools available for this agent."),hl());}function ae(t,n){if(t&1&&(fg(0,"div",19),QC(1,"agentosMarkdown")),t&2){let e=tC().$implicit;dg("innerHTML",XC(1,1,e.description),YD);}}function de(t,n){if(t&1){let e=Qw();Es(0,"li")(1,"ds-disclosure",18),vg("toggled",function(){let m=pf(e).$implicit,U=tC(3);return hf(U.toggleTool(m))}),Bw(2,ae,2,3,"div",19),Es(3,"pre",20),AC(4),hl()()();}if(t&2){let e=n.$implicit,r=tC(3);VE(),dg("heading",e.name)("open",r.isToolExpanded(e)),VE(),Vw(e.description?2:-1),VE(2),Fg(r.formatSchema(e.inputSchema));}}function re(t,n){if(t&1&&(Es(0,"ul",11),$w(1,de,5,4,"li",null,z),hl()),t&2){let e=tC();VE(),zw(e.tools);}}function se(t,n){if(t&1&&(Es(0,"ds-card",4)(1,"dl",5)(2,"dt"),AC(3,"Name"),hl(),Es(4,"dd"),AC(5),hl(),Es(6,"dt"),AC(7,"Resolved model"),hl(),Es(8,"dd",6),AC(9),hl(),Es(10,"dt"),AC(11,"Provider"),hl(),Es(12,"dd"),AC(13),hl(),Es(14,"dt",7),AC(15,"Execution mode"),hl(),Es(16,"dd",8)(17,"span",9),AC(18),hl()(),Bw(19,W,4,1),hl()(),Bw(20,X,4,2,"ds-card"),Bw(21,Y,4,2,"ds-card"),Es(22,"ds-card",10),Bw(23,Z,2,0,"p",3)(24,ie,3,0,"ul",11),hl(),Es(25,"ds-card",10),Bw(26,oe,2,0,"p",3)(27,re,3,0,"ul",11),hl()),t&2){let e=n,r=tC();VE(5),Fg(e.name),VE(4),Fg(e.resolvedModelApiName),VE(4),Fg(e.resolvedProviderName),VE(4),Mg("agent-config-inspect__badge--active",e.executionMode!=="SIMPLE"),VE(),Dl(" ",e.executionMode," "),VE(),Vw(e.userId?19:-1),VE(),Vw(e.systemPrompt?20:-1),VE(),Vw(e.instructions?21:-1),VE(),dg("heading","Skills ("+r.resolvedSkills().length+")"),VE(),Vw(r.resolvedSkills().length===0?23:24),VE(2),dg("heading","Tools ("+e.tools.length+")"),VE(),Vw(e.tools.length===0?26:27);}}var K=class t{route=g(W$1);router=g(F);destroyRef=g(we);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.params.agentConfigId;isPlatformMode=!this.namespaceId;isLoading=$i(true);hasError=$i(false);definition=$i(null);expandedTools=$i(new Set);resolvedSkills=oT(()=>this.definition()?.skills??[]);systemPromptCollapsed=$i(true);instructionsCollapsed=$i(true);ngOnInit(){this.agentConfigController.getDefinitionAgentConfig(this.agentConfigId).pipe(U$1(this.destroyRef)).subscribe({next:n=>{this.definition.set(n),this.isLoading.set(false);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}toggleTool(n){this.expandedTools.update(e=>{let r=new Set(e);return r.has(n.name)?r.delete(n.name):r.add(n.name),r});}isToolExpanded(n){return this.expandedTools().has(n.name)}toggleSystemPrompt(){this.systemPromptCollapsed.update(n=>!n);}toggleInstructions(){this.instructionsCollapsed.update(n=>!n);}formatSchema(n){try{return JSON.stringify(JSON.parse(n),null,2)}catch(e){return n}}editRoute(){return this.isPlatformMode?["/agentos","admin","agent-configs",this.agentConfigId,"edit"]:["/agentos",this.namespaceId,"agent-configs",this.agentConfigId,"edit"]}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Dw({type:t,selectors:[["agentos-agent-config-inspect"]],decls:9,vars:2,consts:[["title","Agent definition"],["dsButton","","variant","ghost","type","button","title","Back to agent configs",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],[1,"ds-hint"],["heading","General"],["dsDefinitionList",""],[1,"ds-mono"],[1,"agent-config-inspect__dt"],[1,"agent-config-inspect__dd"],[1,"agent-config-inspect__badge"],[3,"heading"],[1,"ds-list"],["heading","System Prompt",3,"toggled","open"],[1,"ds-pre","ds-pre--prose"],["heading","Instructions",3,"toggled","open"],[1,"ds-stack","ds-stack--sm"],[1,"ds-strong"],[1,"ds-meta"],["bordered","","mono","",3,"toggled","heading","open"],[1,"ds-prose","ds-hint",3,"innerHTML"],[1,"ds-pre"]],template:function(e,r){if(e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return r.back()}),AC(3," \u2190 Agent configs "),hl(),Es(4,"a",2),AC(5,"Edit config \u2192"),hl()(),Bw(6,q,2,0,"p",3)(7,Q,2,0,"ds-notice")(8,se,28,13),hl()),e&2){let m;VE(4),dg("routerLink",r.editRoute()),VE(2),Vw(r.isLoading()?6:r.hasError()?7:(m=r.definition())?8:-1,m);}},dependencies:[$t,hn,fn,rn,pn,at,ln,Pi,On],encapsulation:2})};export{K as AgentConfigInspectComponent};
1
+ import {b as hn,c as fn,r as rn,D as pn,e as at,n as ln,J as Pi,K as On}from'./chunk-0rWkqE7F.js';import {g,W as W$1,t as F,K as we,ag as U,$ as $i,o as oT,U as U$1,D as Dw,au as $t,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,i as Vw,v as tC,F as Fg,M as Mg,u as Dl,q as $w,z as zw,Q as Qw,f as fg,av as QC,aw as XC,w as pf,x as hf,ax as YD}from'./main-PZMWRMRC.js';var j=(t,n)=>n.id,z=(t,n)=>n.name;function q(t,n){t&1&&(Es(0,"p",3),AC(1,"Loading\u2026"),hl());}function Q(t,n){t&1&&(Es(0,"ds-notice"),AC(1,"Failed to load agent definition."),hl());}function W(t,n){if(t&1&&(Es(0,"dt"),AC(1,"User context"),hl(),Es(2,"dd",6),AC(3),hl()),t&2){let e=tC();VE(3),Fg(e.userId);}}function X(t,n){if(t&1){let e=Qw();Es(0,"ds-card")(1,"ds-disclosure",12),vg("toggled",function(){pf(e);let m=tC(2);return hf(m.toggleSystemPrompt())}),Es(2,"pre",13),AC(3),hl()()();}if(t&2){let e=tC(),r=tC();VE(),dg("open",!r.systemPromptCollapsed()),VE(2),Fg(e.systemPrompt);}}function Y(t,n){if(t&1){let e=Qw();Es(0,"ds-card")(1,"ds-disclosure",14),vg("toggled",function(){pf(e);let m=tC(2);return hf(m.toggleInstructions())}),Es(2,"pre",13),AC(3),hl()()();}if(t&2){let e=tC(),r=tC();VE(),dg("open",!r.instructionsCollapsed()),VE(2),Fg(e.instructions);}}function Z(t,n){t&1&&(Es(0,"p",3),AC(1," This agent declares no skill, so it gets no skill tools. Attach skills from the edit form. "),hl());}function ee(t,n){t&1&&(Es(0,"span",17),AC(1,"platform"),hl());}function te(t,n){t&1&&(Es(0,"span",17),AC(1,"SKILL.md"),hl());}function ne(t,n){if(t&1&&(Es(0,"li",15)(1,"span")(2,"span",16),AC(3),hl(),Bw(4,ee,2,0,"span",17),Bw(5,te,2,0,"span",17),hl(),Es(6,"p",3),AC(7),hl()()),t&2){let e=n.$implicit;VE(3),Fg(e.name),VE(),Vw(e.namespaceId?-1:4),VE(),Vw(e.readOnly?5:-1),VE(2),Fg(e.description);}}function ie(t,n){if(t&1&&(Es(0,"ul",11),$w(1,ne,8,4,"li",15,j),hl()),t&2){let e=tC(2);VE(),zw(e.resolvedSkills());}}function oe(t,n){t&1&&(Es(0,"p",3),AC(1,"No tools available for this agent."),hl());}function ae(t,n){if(t&1&&(fg(0,"div",19),QC(1,"agentosMarkdown")),t&2){let e=tC().$implicit;dg("innerHTML",XC(1,1,e.description),YD);}}function de(t,n){if(t&1){let e=Qw();Es(0,"li")(1,"ds-disclosure",18),vg("toggled",function(){let m=pf(e).$implicit,U=tC(3);return hf(U.toggleTool(m))}),Bw(2,ae,2,3,"div",19),Es(3,"pre",20),AC(4),hl()()();}if(t&2){let e=n.$implicit,r=tC(3);VE(),dg("heading",e.name)("open",r.isToolExpanded(e)),VE(),Vw(e.description?2:-1),VE(2),Fg(r.formatSchema(e.inputSchema));}}function re(t,n){if(t&1&&(Es(0,"ul",11),$w(1,de,5,4,"li",null,z),hl()),t&2){let e=tC();VE(),zw(e.tools);}}function se(t,n){if(t&1&&(Es(0,"ds-card",4)(1,"dl",5)(2,"dt"),AC(3,"Name"),hl(),Es(4,"dd"),AC(5),hl(),Es(6,"dt"),AC(7,"Resolved model"),hl(),Es(8,"dd",6),AC(9),hl(),Es(10,"dt"),AC(11,"Provider"),hl(),Es(12,"dd"),AC(13),hl(),Es(14,"dt",7),AC(15,"Execution mode"),hl(),Es(16,"dd",8)(17,"span",9),AC(18),hl()(),Bw(19,W,4,1),hl()(),Bw(20,X,4,2,"ds-card"),Bw(21,Y,4,2,"ds-card"),Es(22,"ds-card",10),Bw(23,Z,2,0,"p",3)(24,ie,3,0,"ul",11),hl(),Es(25,"ds-card",10),Bw(26,oe,2,0,"p",3)(27,re,3,0,"ul",11),hl()),t&2){let e=n,r=tC();VE(5),Fg(e.name),VE(4),Fg(e.resolvedModelApiName),VE(4),Fg(e.resolvedProviderName),VE(4),Mg("agent-config-inspect__badge--active",e.executionMode!=="SIMPLE"),VE(),Dl(" ",e.executionMode," "),VE(),Vw(e.userId?19:-1),VE(),Vw(e.systemPrompt?20:-1),VE(),Vw(e.instructions?21:-1),VE(),dg("heading","Skills ("+r.resolvedSkills().length+")"),VE(),Vw(r.resolvedSkills().length===0?23:24),VE(2),dg("heading","Tools ("+e.tools.length+")"),VE(),Vw(e.tools.length===0?26:27);}}var K=class t{route=g(W$1);router=g(F);destroyRef=g(we);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.params.agentConfigId;isPlatformMode=!this.namespaceId;isLoading=$i(true);hasError=$i(false);definition=$i(null);expandedTools=$i(new Set);resolvedSkills=oT(()=>this.definition()?.skills??[]);systemPromptCollapsed=$i(true);instructionsCollapsed=$i(true);ngOnInit(){this.agentConfigController.getDefinitionAgentConfig(this.agentConfigId).pipe(U$1(this.destroyRef)).subscribe({next:n=>{this.definition.set(n),this.isLoading.set(false);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}toggleTool(n){this.expandedTools.update(e=>{let r=new Set(e);return r.has(n.name)?r.delete(n.name):r.add(n.name),r});}isToolExpanded(n){return this.expandedTools().has(n.name)}toggleSystemPrompt(){this.systemPromptCollapsed.update(n=>!n);}toggleInstructions(){this.instructionsCollapsed.update(n=>!n);}formatSchema(n){try{return JSON.stringify(JSON.parse(n),null,2)}catch(e){return n}}editRoute(){return this.isPlatformMode?["/agentos","admin","agent-configs",this.agentConfigId,"edit"]:["/agentos",this.namespaceId,"agent-configs",this.agentConfigId,"edit"]}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Dw({type:t,selectors:[["agentos-agent-config-inspect"]],decls:9,vars:2,consts:[["title","Agent definition"],["dsButton","","variant","ghost","type","button","title","Back to agent configs",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],[1,"ds-hint"],["heading","General"],["dsDefinitionList",""],[1,"ds-mono"],[1,"agent-config-inspect__dt"],[1,"agent-config-inspect__dd"],[1,"agent-config-inspect__badge"],[3,"heading"],[1,"ds-list"],["heading","System Prompt",3,"toggled","open"],[1,"ds-pre","ds-pre--prose"],["heading","Instructions",3,"toggled","open"],[1,"ds-stack","ds-stack--sm"],[1,"ds-strong"],[1,"ds-meta"],["bordered","","mono","",3,"toggled","heading","open"],[1,"ds-prose","ds-hint",3,"innerHTML"],[1,"ds-pre"]],template:function(e,r){if(e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return r.back()}),AC(3," \u2190 Agent configs "),hl(),Es(4,"a",2),AC(5,"Edit config \u2192"),hl()(),Bw(6,q,2,0,"p",3)(7,Q,2,0,"ds-notice")(8,se,28,13),hl()),e&2){let m;VE(4),dg("routerLink",r.editRoute()),VE(2),Vw(r.isLoading()?6:r.hasError()?7:(m=r.definition())?8:-1,m);}},dependencies:[$t,hn,fn,rn,pn,at,ln,Pi,On],encapsulation:2})};export{K as AgentConfigInspectComponent};
@@ -1 +1 @@
1
- import {O}from'./chunk-CzE55g5c.js';import {v}from'./chunk-QzulhNzo.js';import {g,W,t as F,K as we,$ as $i,a9 as F$1,an as $e,O as Of,U,D as Dw,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,i as Vw,Q as Qw,q as $w,ao as Uw,S as NI,f as fg,am as Hw,v as tC,T as AI,z as zw,u as Dl,ae as Lw,F as Fg,w as pf,x as hf}from'./main-VSQLTBR6.js';import {p as pt,L as Lt,T as Te,g as gn,b as hn,c as fn,u as un,o as dn,d as cn,e as at,i as sn,t as an,q as qt,m as md,C as Co,M as Mo,H as Ht,U as Ut,x as ya,a as po,h as ho,A as An,O as On,w as wa,_ as _o,G as vo}from'./chunk-qAO_WS2x.js';import'./chunk-ABpRMh2B.js';function ge(o,t){o&1&&(Es(0,"p",2),AC(1,"Loading\u2026"),hl());}function be(o,t){if(o&1&&(Es(0,"label",23),fg(1,"input",24),NI(),AC(2),hl()),o&2){let e=t.$implicit,r=tC(3);VE(),dg("formControl",r.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!r.isAdmin()),AI(),VE(),Dl(" ",e.label," ");}}function _e(o,t){if(o&1&&(Es(0,"ds-fieldset",5),$w(1,be,3,4,"label",23,Lw().trackByScope,true),hl()),o&2){let e=tC(2);dg("disabled",e.isEditMode()),VE(),zw(e.scopeOptions);}}function Ae(o,t){if(o&1&&(Es(0,"option",8),AC(1),hl()),o&2){let e=t.$implicit;dg("value",e),VE(),Fg(e);}}function Se(o,t){if(o&1){let e=Qw();Es(0,"div",19),fg(1,"input",25),NI(),fg(2,"input",26),NI(),Es(3,"button",27),vg("click",function(){let l=pf(e).$index,f=tC(2);return hf(f.removeHeader(l))}),AC(4," \xD7 "),hl()();}if(o&2){let e=t.$index;dg("formGroupName",e),VE(),AI(),VE(),AI();}}function Pe(o,t){if(o&1){let e=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let l=tC();return hf(l.submit())}),Bw(1,_e,3,1,"ds-fieldset",5),Es(2,"ds-form-field",6)(3,"select",7),$w(4,Ae,2,2,"option",8,Uw),hl(),NI(),hl(),Es(6,"ds-form-field",9),fg(7,"input",10),NI(),hl(),Es(8,"ds-form-field",11),fg(9,"input",12),NI(),hl(),Es(10,"ds-form-field",13),fg(11,"input",14),NI(),hl(),Es(12,"ds-form-field",15),fg(13,"input",16),NI(),hl(),Es(14,"ds-form-field",17)(15,"div",18),$w(16,Se,5,1,"div",19,Hw),Es(18,"div")(19,"button",20),vg("click",function(){pf(e);let l=tC();return hf(l.addHeader())}),AC(20,"+ Add header"),hl()()()(),Es(21,"ds-form-actions")(22,"button",21),AC(23),hl(),Es(24,"button",22),vg("click",function(){pf(e);let l=tC();return hf(l.cancel())}),AC(25,"Cancel"),hl()()();}if(o&2){let e=tC();dg("formGroup",e.form),VE(),Vw(e.isPlatformMode?-1:1),VE(2),dg("formControl",e.apiTypeControl),AI(),VE(),zw(e.apiTypeOptions),VE(3),dg("formControl",e.nameControl),AI(),VE(2),dg("formControl",e.descriptionControl),AI(),VE(2),dg("formControl",e.baseUrlControl),AI(),VE(2),dg("formControl",e.apiKeyControl),AI(),VE(2),dg("formArrayName","headers"),VE(),zw(e.headersArray.controls),VE(6),dg("disabled",e.form.invalid||e.isSubmitting()),VE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var xe=new Set(["namespace","userOnNs","userGlobal"]),E=Object.freeze({platform:"Configuration de niveau plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ye=class o{route=g(W);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?$i(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});apiTypeOptions=Object.values($e);scopeOptions=[{value:"namespace",label:E.namespace},{value:"userOnNs",label:E.userOnNs},{value:"userGlobal",label:E.userGlobal}];form=new pt({name:new Te("",{nonNullable:true,validators:[gn.required,gn.minLength(1)]}),description:new Te(null),apiType:new Te("OpenAI",{nonNullable:true,validators:[gn.required]}),baseUrl:new Te("",{nonNullable:true}),apiKey:new Te("",{nonNullable:true}),scope:new Te("namespace",{nonNullable:true}),headers:new Lt([],{validators:[]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get apiTypeControl(){return this.form.controls.apiType}get baseUrlControl(){return this.form.controls.baseUrl}get apiKeyControl(){return this.form.controls.apiKey}get scopeControl(){return this.form.controls.scope}get headersArray(){return this.form.controls.headers}addHeader(){this.headersArray.push(new pt({key:new Te("",{nonNullable:true,validators:[gn.required]}),value:new Te("",{nonNullable:true})}));}removeHeader(t){this.headersArray.removeAt(t);}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);existingConfig=null;initialApiKey="";constructor(){this.isPlatformMode||Of(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,r=t.get("aiProviderId"),l=this.isPlatformMode?"namespace":this.parseScope(e.get("scope"));if(r){this.isEditMode.set(true),this.scopeControl.disable(),this.apiTypeControl.disable(),this.loadConfig(r);return}this.scopeControl.setValue(l);let f=e.get("template");f&&this.hydrateFromTemplate(f);}parseScope(t){return t&&xe.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId?"namespace":t.namespaceId?"userOnNs":"userGlobal"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AiProviderForm] Could not load provider '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.apiTypeControl.setValue(e.apiType),this.baseUrlControl.setValue(e.baseUrl??""),this.apiKeyControl.setValue(""),this.initialApiKey="",this.apiKeyControl.markAsTouched(),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AiProviderForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.apiTypeControl.setValue(t.apiType),this.baseUrlControl.setValue(t.baseUrl??"");let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialApiKey=e,this.headersArray.clear();for(let[r,l]of Object.entries(t.headers??{}))this.headersArray.push(new pt({key:new Te(r,{nonNullable:true,validators:[gn.required]}),value:new Te(l,{nonNullable:true})}));}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.descriptionControl.value?.trim(),e=this.baseUrlControl.value.trim(),r=this.apiKeyControl.value,l=this.isEditMode()&&r===this.initialApiKey?null:r,f=this.headersArray.controls.filter(A=>A.controls.key.value.trim()).map(A=>[A.controls.key.value.trim(),A.controls.value.value]),Ce=f.length>0?Object.fromEntries(f):null,V={name:this.nameControl.value.trim(),apiType:this.apiTypeControl.value,description:t||null,baseUrl:e||null,apiKey:l,headers:Ce},w=this.form.getRawValue().scope,he=this.isPlatformMode?null:this.namespaceId??null;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,V,w,this.existingConfig):this.state.create(V,w,he)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-providers"]):this.router.navigate(["/agentos",this.namespaceId,"ai-providers"]);}trackByScope(t,e){return e.value}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=Dw({type:o,selectors:[["agentos-ai-provider-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to AI providers",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Configuration scope",3,"disabled"],["label","API type","controlId","llm-api-type","required",""],["dsControl","","id","llm-api-type",3,"formControl"],[3,"value"],["label","Name","controlId","llm-name","required",""],["dsControl","","id","llm-name","type","text","placeholder","e.g. OpenAI prod","autocomplete","off",3,"formControl"],["label","Description","controlId","llm-description"],["dsControl","","id","llm-description","type","text","placeholder","Optional \u2014 short description of this provider","autocomplete","off",3,"formControl"],["label","Base URL","controlId","llm-base-url"],["dsControl","","id","llm-base-url","type","url","placeholder","Optional \u2014 leave empty for default endpoint","autocomplete","off",3,"formControl"],["label","API key","controlId","llm-api-key"],["dsControl","","id","llm-api-key","type","password","placeholder","sk-\u2026","autocomplete","new-password",3,"formControl"],["label","Custom headers"],[1,"ds-stack","ds-stack--sm",3,"formArrayName"],[1,"ds-inline",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsCheck",""],["type","radio",3,"formControl","value","disabled"],["dsControl","","type","text","placeholder","Header name","formControlName","key","autocomplete","off"],["dsControl","","type","text","placeholder","Value","formControlName","value","autocomplete","off"],["dsButton","","variant","icon-danger","type","button","title","Remove header","aria-label","Remove header",3,"click"]],template:function(e,r){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return r.cancel()}),AC(3," \u2190 AI providers "),hl()(),Bw(4,ge,2,0,"p",2)(5,Pe,26,10,"form",3),hl()),e&2&&(VE(),dg("title",r.isEditMode()?"Edit AI provider":"New AI provider"),VE(3),Vw(r.isLoading()?4:5));},dependencies:[hn,fn,un,dn,cn,at,sn,an,qt,md,Co,Mo,Ht,Ut,ya,po,ho,An,On,wa,_o,vo],encapsulation:2})};export{ye as AiProviderFormComponent};
1
+ import {O}from'./chunk-BKdHqvrx.js';import {v}from'./chunk-HtmwgODm.js';import {g,W,t as F,K as we,$ as $i,a9 as F$1,an as $e,O as Of,U,D as Dw,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,i as Vw,Q as Qw,q as $w,ao as Uw,S as NI,f as fg,am as Hw,v as tC,T as AI,z as zw,u as Dl,ae as Lw,F as Fg,w as pf,x as hf}from'./main-PZMWRMRC.js';import {p as pt,L as Lt,T as Te,g as gn,b as hn,c as fn,u as un,o as dn,d as cn,e as at,i as sn,t as an,q as qt,m as md,C as Co,M as Mo,H as Ht,U as Ut,x as ya,a as po,h as ho,A as An,O as On,w as wa,_ as _o,G as vo}from'./chunk-0rWkqE7F.js';import'./chunk-m1ylN0EP.js';function ge(o,t){o&1&&(Es(0,"p",2),AC(1,"Loading\u2026"),hl());}function be(o,t){if(o&1&&(Es(0,"label",23),fg(1,"input",24),NI(),AC(2),hl()),o&2){let e=t.$implicit,r=tC(3);VE(),dg("formControl",r.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!r.isAdmin()),AI(),VE(),Dl(" ",e.label," ");}}function _e(o,t){if(o&1&&(Es(0,"ds-fieldset",5),$w(1,be,3,4,"label",23,Lw().trackByScope,true),hl()),o&2){let e=tC(2);dg("disabled",e.isEditMode()),VE(),zw(e.scopeOptions);}}function Ae(o,t){if(o&1&&(Es(0,"option",8),AC(1),hl()),o&2){let e=t.$implicit;dg("value",e),VE(),Fg(e);}}function Se(o,t){if(o&1){let e=Qw();Es(0,"div",19),fg(1,"input",25),NI(),fg(2,"input",26),NI(),Es(3,"button",27),vg("click",function(){let l=pf(e).$index,f=tC(2);return hf(f.removeHeader(l))}),AC(4," \xD7 "),hl()();}if(o&2){let e=t.$index;dg("formGroupName",e),VE(),AI(),VE(),AI();}}function Pe(o,t){if(o&1){let e=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let l=tC();return hf(l.submit())}),Bw(1,_e,3,1,"ds-fieldset",5),Es(2,"ds-form-field",6)(3,"select",7),$w(4,Ae,2,2,"option",8,Uw),hl(),NI(),hl(),Es(6,"ds-form-field",9),fg(7,"input",10),NI(),hl(),Es(8,"ds-form-field",11),fg(9,"input",12),NI(),hl(),Es(10,"ds-form-field",13),fg(11,"input",14),NI(),hl(),Es(12,"ds-form-field",15),fg(13,"input",16),NI(),hl(),Es(14,"ds-form-field",17)(15,"div",18),$w(16,Se,5,1,"div",19,Hw),Es(18,"div")(19,"button",20),vg("click",function(){pf(e);let l=tC();return hf(l.addHeader())}),AC(20,"+ Add header"),hl()()()(),Es(21,"ds-form-actions")(22,"button",21),AC(23),hl(),Es(24,"button",22),vg("click",function(){pf(e);let l=tC();return hf(l.cancel())}),AC(25,"Cancel"),hl()()();}if(o&2){let e=tC();dg("formGroup",e.form),VE(),Vw(e.isPlatformMode?-1:1),VE(2),dg("formControl",e.apiTypeControl),AI(),VE(),zw(e.apiTypeOptions),VE(3),dg("formControl",e.nameControl),AI(),VE(2),dg("formControl",e.descriptionControl),AI(),VE(2),dg("formControl",e.baseUrlControl),AI(),VE(2),dg("formControl",e.apiKeyControl),AI(),VE(2),dg("formArrayName","headers"),VE(),zw(e.headersArray.controls),VE(6),dg("disabled",e.form.invalid||e.isSubmitting()),VE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var xe=new Set(["namespace","userOnNs","userGlobal"]),E=Object.freeze({platform:"Configuration de niveau plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ye=class o{route=g(W);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?$i(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});apiTypeOptions=Object.values($e);scopeOptions=[{value:"namespace",label:E.namespace},{value:"userOnNs",label:E.userOnNs},{value:"userGlobal",label:E.userGlobal}];form=new pt({name:new Te("",{nonNullable:true,validators:[gn.required,gn.minLength(1)]}),description:new Te(null),apiType:new Te("OpenAI",{nonNullable:true,validators:[gn.required]}),baseUrl:new Te("",{nonNullable:true}),apiKey:new Te("",{nonNullable:true}),scope:new Te("namespace",{nonNullable:true}),headers:new Lt([],{validators:[]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get apiTypeControl(){return this.form.controls.apiType}get baseUrlControl(){return this.form.controls.baseUrl}get apiKeyControl(){return this.form.controls.apiKey}get scopeControl(){return this.form.controls.scope}get headersArray(){return this.form.controls.headers}addHeader(){this.headersArray.push(new pt({key:new Te("",{nonNullable:true,validators:[gn.required]}),value:new Te("",{nonNullable:true})}));}removeHeader(t){this.headersArray.removeAt(t);}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);existingConfig=null;initialApiKey="";constructor(){this.isPlatformMode||Of(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,r=t.get("aiProviderId"),l=this.isPlatformMode?"namespace":this.parseScope(e.get("scope"));if(r){this.isEditMode.set(true),this.scopeControl.disable(),this.apiTypeControl.disable(),this.loadConfig(r);return}this.scopeControl.setValue(l);let f=e.get("template");f&&this.hydrateFromTemplate(f);}parseScope(t){return t&&xe.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId?"namespace":t.namespaceId?"userOnNs":"userGlobal"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AiProviderForm] Could not load provider '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.apiTypeControl.setValue(e.apiType),this.baseUrlControl.setValue(e.baseUrl??""),this.apiKeyControl.setValue(""),this.initialApiKey="",this.apiKeyControl.markAsTouched(),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AiProviderForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.apiTypeControl.setValue(t.apiType),this.baseUrlControl.setValue(t.baseUrl??"");let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialApiKey=e,this.headersArray.clear();for(let[r,l]of Object.entries(t.headers??{}))this.headersArray.push(new pt({key:new Te(r,{nonNullable:true,validators:[gn.required]}),value:new Te(l,{nonNullable:true})}));}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.descriptionControl.value?.trim(),e=this.baseUrlControl.value.trim(),r=this.apiKeyControl.value,l=this.isEditMode()&&r===this.initialApiKey?null:r,f=this.headersArray.controls.filter(A=>A.controls.key.value.trim()).map(A=>[A.controls.key.value.trim(),A.controls.value.value]),Ce=f.length>0?Object.fromEntries(f):null,V={name:this.nameControl.value.trim(),apiType:this.apiTypeControl.value,description:t||null,baseUrl:e||null,apiKey:l,headers:Ce},w=this.form.getRawValue().scope,he=this.isPlatformMode?null:this.namespaceId??null;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,V,w,this.existingConfig):this.state.create(V,w,he)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-providers"]):this.router.navigate(["/agentos",this.namespaceId,"ai-providers"]);}trackByScope(t,e){return e.value}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=Dw({type:o,selectors:[["agentos-ai-provider-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to AI providers",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Configuration scope",3,"disabled"],["label","API type","controlId","llm-api-type","required",""],["dsControl","","id","llm-api-type",3,"formControl"],[3,"value"],["label","Name","controlId","llm-name","required",""],["dsControl","","id","llm-name","type","text","placeholder","e.g. OpenAI prod","autocomplete","off",3,"formControl"],["label","Description","controlId","llm-description"],["dsControl","","id","llm-description","type","text","placeholder","Optional \u2014 short description of this provider","autocomplete","off",3,"formControl"],["label","Base URL","controlId","llm-base-url"],["dsControl","","id","llm-base-url","type","url","placeholder","Optional \u2014 leave empty for default endpoint","autocomplete","off",3,"formControl"],["label","API key","controlId","llm-api-key"],["dsControl","","id","llm-api-key","type","password","placeholder","sk-\u2026","autocomplete","new-password",3,"formControl"],["label","Custom headers"],[1,"ds-stack","ds-stack--sm",3,"formArrayName"],[1,"ds-inline",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsCheck",""],["type","radio",3,"formControl","value","disabled"],["dsControl","","type","text","placeholder","Header name","formControlName","key","autocomplete","off"],["dsControl","","type","text","placeholder","Value","formControlName","value","autocomplete","off"],["dsButton","","variant","icon-danger","type","button","title","Remove header","aria-label","Remove header",3,"click"]],template:function(e,r){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return r.cancel()}),AC(3," \u2190 AI providers "),hl()(),Bw(4,ge,2,0,"p",2)(5,Pe,26,10,"form",3),hl()),e&2&&(VE(),dg("title",r.isEditMode()?"Edit AI provider":"New AI provider"),VE(3),Vw(r.isLoading()?4:5));},dependencies:[hn,fn,un,dn,cn,at,sn,an,qt,md,Co,Mo,Ht,Ut,ya,po,ho,An,On,wa,_o,vo],encapsulation:2})};export{ye as AiProviderFormComponent};
@@ -1 +1 @@
1
- import {f,a6 as pd,m as md,H as Ht,a as po,h as ho,a7 as lo,a8 as fa,a9 as ua,b as hn,c as fn,u as un,D as pn,e as at,i as sn,k as ko,aa as f$1}from'./chunk-qAO_WS2x.js';import {g,W,aM as Y,$ as $i,ab as le,O as Of,D as Dw,aN as Eb,E as Es,f as fg,a as Bw,c as hl,d as VE,i as Vw,ak as yd,a1 as ga,a3 as rn,ac as by,a2 as ha,b as AC,Q as Qw,R as vg,aO as Hg,S as NI,v as tC,aP as Vg,T as AI,q as $w,z as zw,aQ as GC,aR as zC,F as Fg,n as lg,av as QC,aw as XC,as as Pg,u as Dl,aS as JC,w as pf,x as hf,aT as LC}from'./main-VSQLTBR6.js';var ce=e=>({title:"By agent",rows:e}),pe=e=>({title:"By model",rows:e}),ge=(e,a)=>[e,a],ue=(e,a)=>a.title,_e=(e,a)=>a.key;function Ce(e,a){e&1&&(Es(0,"p",2),AC(1,"Loading usage settings\u2026"),hl());}function fe(e,a){if(e&1){let t=Qw();Es(0,"ds-notice"),AC(1,"Could not load usage settings. Please try again."),hl(),Es(2,"div")(3,"button",3),vg("click",function(){pf(t);let s=tC();return hf(s.configuration.retry())}),AC(4,"Retry usage settings"),hl()();}}function ye(e,a){e&1&&(Es(0,"p",2),AC(1,"Usage tracking is disabled."),hl());}function be(e,a){e&1&&(Es(0,"ds-notice"),AC(1),hl()),e&2&&(VE(),Fg(a));}function xe(e,a){e&1&&(Es(0,"p",2),AC(1,"Loading usage\u2026"),hl());}function he(e,a){e&1&&(Es(0,"p",12),AC(1,"No recorded usage for this period."),hl());}function Se(e,a){if(e&1&&(Es(0,"p",10),AC(1),hl()),e&2){let t=tC().$implicit;VE(),Dl("",t.aggregate.unknownCostCount," record(s) with unknown cost");}}function we(e,a){if(e&1&&(Es(0,"tr",16)(1,"td",18),AC(2),hl(),Es(3,"td",19),AC(4),QC(5,"number"),hl(),Es(6,"td",20),AC(7),QC(8,"number"),QC(9,"number"),hl(),Es(10,"td",21),AC(11),QC(12,"number"),QC(13,"number"),hl(),Es(14,"td",22),AC(15),QC(16,"agentosCost"),Bw(17,Se,2,1,"p",10),hl()()),e&2){let t=a.$implicit;VE(2),Fg(t.key),VE(2),Fg(XC(5,8,t.aggregate.totalTokens)),VE(3),Pg(" ",XC(8,10,t.aggregate.inputTokens)," / ",XC(9,12,t.aggregate.outputTokens)," "),VE(4),Pg(" ",XC(12,14,t.aggregate.cacheReadTokens)," / ",XC(13,16,t.aggregate.cacheWriteTokens)," "),VE(4),Dl(" ",JC(16,18,t.aggregate.cost,t.aggregate.unknownCostCount)," "),VE(2),Vw(t.aggregate.unknownCostCount>0?17:-1);}}function ve(e,a){if(e&1&&(Es(0,"div",13)(1,"table",14)(2,"thead",15)(3,"tr",16)(4,"th",17),AC(5,"Name"),hl(),Es(6,"th",17),AC(7,"Tokens"),hl(),Es(8,"th",17),AC(9,"Input / output"),hl(),Es(10,"th",17),AC(11,"Cache read / write"),hl(),Es(12,"th",17),AC(13,"Estimated cost"),hl()()(),Es(14,"tbody",15),$w(15,we,18,21,"tr",16,_e),hl()()()),e&2){let t=tC().$implicit;VE(),lg("aria-label","Usage "+t.title.toLowerCase()),VE(14),zw(t.rows);}}function Ne(e,a){if(e&1&&(Es(0,"h3",11),AC(1),hl(),Bw(2,he,2,0,"p",12)(3,ve,17,1,"div",13)),e&2){let t=a.$implicit;VE(),Fg(t.title),VE(),Vw(t.rows.length===0?2:3);}}function Te(e,a){if(e&1&&($w(0,Ne,4,2,null,null,ue),Es(2,"p",10),AC(3," Unpriced usage is kept separate from known costs. Active agent runs appear here after they finish. "),hl()),e&2){let t=tC(2);zw(GC(4,ge,zC(0,ce,t.agents()),zC(2,pe,t.models())));}}function Ee(e,a){if(e&1){let t=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(t);let s=tC();return hf(s.load())}),Es(1,"ds-form-field",5)(2,"input",6),Hg("ngModelChange",function(s){pf(t);let m=tC();return LC(m.from,s)||(m.from=s),hf(s)}),hl(),NI(),hl(),Es(3,"ds-form-field",7)(4,"input",8),Hg("ngModelChange",function(s){pf(t);let m=tC();return LC(m.to,s)||(m.to=s),hf(s)}),hl(),NI(),hl(),Es(5,"button",9),AC(6,"Refresh"),hl()(),Bw(7,be,2,1,"ds-notice"),Bw(8,xe,2,0,"p",2)(9,Te,4,7);}if(e&2){let t,r=tC();VE(2),Vg("ngModel",r.from),AI(),VE(2),Vg("ngModel",r.to),AI(),VE(3),Vw((t=r.error())?7:-1,t),VE(),Vw(r.loading()?8:r.error()?-1:9);}}var me=class e{route=g(W);api=g(Y);configuration=g(f);namespaceId=this.route.snapshot.params.namespaceId;agents=$i([]);models=$i([]);error=$i(null);loading=$i(false);from=new Date(Date.now()-30*864e5).toISOString().slice(0,10);to=new Date().toISOString().slice(0,10);refresh=new le;constructor(){Of(a=>{if(!this.configuration.enabled())return;let t=this.refresh.pipe(yd(void 0),ga(()=>{this.error.set(null),this.agents.set([]),this.models.set([]);let r=new Date(`${this.from}T00:00:00.000Z`),s=new Date(`${this.to}T23:59:59.999Z`);return !Number.isFinite(r.getTime())||!Number.isFinite(s.getTime())||r>s?(this.error.set("Select a valid date range."),this.loading.set(false),rn):(this.loading.set(true),by({agents:this.api.aggregateByAgentUsageRecord(this.namespaceId,r.toISOString(),s.toISOString()),models:this.api.aggregateByModelUsageRecord(this.namespaceId,r.toISOString(),s.toISOString())}).pipe(ha(m=>(this.loading.set(false),this.error.set(m.status===403?"Namespace admin permission is required to view this report.":"Could not load usage. Please try again."),rn))))})).subscribe(({agents:r,models:s})=>{this.agents.set(r),this.models.set(s),this.loading.set(false);});a(()=>t.unsubscribe());});}load(){this.configuration.enabled()&&this.refresh.next();}static \u0275fac=function(t){return new(t||e)};static \u0275cmp=Dw({type:e,selectors:[["agentos-namespace-usage"]],decls:6,vars:1,consts:[["full",""],["title","Usage and costs","description","Recorded LLM usage across this namespace. Costs are estimates in the platform currency."],["role","status",1,"settings-table__status"],["dsButton","","type","button",3,"click"],[1,"ds-inline","ds-inline--wrap","ds-inline--end",3,"ngSubmit"],["label","From (UTC)","controlId","usage-from"],["dsControl","","id","usage-from","type","date","name","from","required","",3,"ngModelChange","ngModel"],["label","To (UTC)","controlId","usage-to"],["dsControl","","id","usage-to","type","date","name","to","required","",3,"ngModelChange","ngModel"],["dsButton","","variant","primary","type","submit"],[1,"ds-hint"],[1,"ds-micro"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table"],["role","rowgroup"],["role","row"],["role","columnheader"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Tokens"],["role","cell","data-label","Input / output"],["role","cell","data-label","Cache read / write"],["role","cell","data-label","Estimated cost"]],template:function(t,r){t&1&&(Es(0,"ds-page",0),fg(1,"ds-section-header",1),Bw(2,Ce,2,0,"p",2)(3,fe,5,0)(4,ye,2,0,"p",2)(5,Ee,10,4),hl()),t&2&&(VE(2),Vw(r.configuration.state()==="loading"?2:r.configuration.state()==="error"?3:r.configuration.state()==="disabled"?4:5));},dependencies:[pd,md,Ht,po,ho,lo,fa,ua,hn,fn,un,pn,at,sn,ko,Eb,f$1],encapsulation:2})};export{me as NamespaceUsageComponent};
1
+ import {f,a6 as pd,m as md,H as Ht,a as po,h as ho,a7 as lo,a8 as fa,a9 as ua,b as hn,c as fn,u as un,D as pn,e as at,i as sn,k as ko,aa as f$1}from'./chunk-0rWkqE7F.js';import {g,W,aM as Y,$ as $i,ab as le,O as Of,D as Dw,aN as Eb,E as Es,f as fg,a as Bw,c as hl,d as VE,i as Vw,ak as yd,a1 as ga,a3 as rn,ac as by,a2 as ha,b as AC,Q as Qw,R as vg,aO as Hg,S as NI,v as tC,aP as Vg,T as AI,q as $w,z as zw,aQ as GC,aR as zC,F as Fg,n as lg,av as QC,aw as XC,as as Pg,u as Dl,aS as JC,w as pf,x as hf,aT as LC}from'./main-PZMWRMRC.js';var ce=e=>({title:"By agent",rows:e}),pe=e=>({title:"By model",rows:e}),ge=(e,a)=>[e,a],ue=(e,a)=>a.title,_e=(e,a)=>a.key;function Ce(e,a){e&1&&(Es(0,"p",2),AC(1,"Loading usage settings\u2026"),hl());}function fe(e,a){if(e&1){let t=Qw();Es(0,"ds-notice"),AC(1,"Could not load usage settings. Please try again."),hl(),Es(2,"div")(3,"button",3),vg("click",function(){pf(t);let s=tC();return hf(s.configuration.retry())}),AC(4,"Retry usage settings"),hl()();}}function ye(e,a){e&1&&(Es(0,"p",2),AC(1,"Usage tracking is disabled."),hl());}function be(e,a){e&1&&(Es(0,"ds-notice"),AC(1),hl()),e&2&&(VE(),Fg(a));}function xe(e,a){e&1&&(Es(0,"p",2),AC(1,"Loading usage\u2026"),hl());}function he(e,a){e&1&&(Es(0,"p",12),AC(1,"No recorded usage for this period."),hl());}function Se(e,a){if(e&1&&(Es(0,"p",10),AC(1),hl()),e&2){let t=tC().$implicit;VE(),Dl("",t.aggregate.unknownCostCount," record(s) with unknown cost");}}function we(e,a){if(e&1&&(Es(0,"tr",16)(1,"td",18),AC(2),hl(),Es(3,"td",19),AC(4),QC(5,"number"),hl(),Es(6,"td",20),AC(7),QC(8,"number"),QC(9,"number"),hl(),Es(10,"td",21),AC(11),QC(12,"number"),QC(13,"number"),hl(),Es(14,"td",22),AC(15),QC(16,"agentosCost"),Bw(17,Se,2,1,"p",10),hl()()),e&2){let t=a.$implicit;VE(2),Fg(t.key),VE(2),Fg(XC(5,8,t.aggregate.totalTokens)),VE(3),Pg(" ",XC(8,10,t.aggregate.inputTokens)," / ",XC(9,12,t.aggregate.outputTokens)," "),VE(4),Pg(" ",XC(12,14,t.aggregate.cacheReadTokens)," / ",XC(13,16,t.aggregate.cacheWriteTokens)," "),VE(4),Dl(" ",JC(16,18,t.aggregate.cost,t.aggregate.unknownCostCount)," "),VE(2),Vw(t.aggregate.unknownCostCount>0?17:-1);}}function ve(e,a){if(e&1&&(Es(0,"div",13)(1,"table",14)(2,"thead",15)(3,"tr",16)(4,"th",17),AC(5,"Name"),hl(),Es(6,"th",17),AC(7,"Tokens"),hl(),Es(8,"th",17),AC(9,"Input / output"),hl(),Es(10,"th",17),AC(11,"Cache read / write"),hl(),Es(12,"th",17),AC(13,"Estimated cost"),hl()()(),Es(14,"tbody",15),$w(15,we,18,21,"tr",16,_e),hl()()()),e&2){let t=tC().$implicit;VE(),lg("aria-label","Usage "+t.title.toLowerCase()),VE(14),zw(t.rows);}}function Ne(e,a){if(e&1&&(Es(0,"h3",11),AC(1),hl(),Bw(2,he,2,0,"p",12)(3,ve,17,1,"div",13)),e&2){let t=a.$implicit;VE(),Fg(t.title),VE(),Vw(t.rows.length===0?2:3);}}function Te(e,a){if(e&1&&($w(0,Ne,4,2,null,null,ue),Es(2,"p",10),AC(3," Unpriced usage is kept separate from known costs. Active agent runs appear here after they finish. "),hl()),e&2){let t=tC(2);zw(GC(4,ge,zC(0,ce,t.agents()),zC(2,pe,t.models())));}}function Ee(e,a){if(e&1){let t=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(t);let s=tC();return hf(s.load())}),Es(1,"ds-form-field",5)(2,"input",6),Hg("ngModelChange",function(s){pf(t);let m=tC();return LC(m.from,s)||(m.from=s),hf(s)}),hl(),NI(),hl(),Es(3,"ds-form-field",7)(4,"input",8),Hg("ngModelChange",function(s){pf(t);let m=tC();return LC(m.to,s)||(m.to=s),hf(s)}),hl(),NI(),hl(),Es(5,"button",9),AC(6,"Refresh"),hl()(),Bw(7,be,2,1,"ds-notice"),Bw(8,xe,2,0,"p",2)(9,Te,4,7);}if(e&2){let t,r=tC();VE(2),Vg("ngModel",r.from),AI(),VE(2),Vg("ngModel",r.to),AI(),VE(3),Vw((t=r.error())?7:-1,t),VE(),Vw(r.loading()?8:r.error()?-1:9);}}var me=class e{route=g(W);api=g(Y);configuration=g(f);namespaceId=this.route.snapshot.params.namespaceId;agents=$i([]);models=$i([]);error=$i(null);loading=$i(false);from=new Date(Date.now()-30*864e5).toISOString().slice(0,10);to=new Date().toISOString().slice(0,10);refresh=new le;constructor(){Of(a=>{if(!this.configuration.enabled())return;let t=this.refresh.pipe(yd(void 0),ga(()=>{this.error.set(null),this.agents.set([]),this.models.set([]);let r=new Date(`${this.from}T00:00:00.000Z`),s=new Date(`${this.to}T23:59:59.999Z`);return !Number.isFinite(r.getTime())||!Number.isFinite(s.getTime())||r>s?(this.error.set("Select a valid date range."),this.loading.set(false),rn):(this.loading.set(true),by({agents:this.api.aggregateByAgentUsageRecord(this.namespaceId,r.toISOString(),s.toISOString()),models:this.api.aggregateByModelUsageRecord(this.namespaceId,r.toISOString(),s.toISOString())}).pipe(ha(m=>(this.loading.set(false),this.error.set(m.status===403?"Namespace admin permission is required to view this report.":"Could not load usage. Please try again."),rn))))})).subscribe(({agents:r,models:s})=>{this.agents.set(r),this.models.set(s),this.loading.set(false);});a(()=>t.unsubscribe());});}load(){this.configuration.enabled()&&this.refresh.next();}static \u0275fac=function(t){return new(t||e)};static \u0275cmp=Dw({type:e,selectors:[["agentos-namespace-usage"]],decls:6,vars:1,consts:[["full",""],["title","Usage and costs","description","Recorded LLM usage across this namespace. Costs are estimates in the platform currency."],["role","status",1,"settings-table__status"],["dsButton","","type","button",3,"click"],[1,"ds-inline","ds-inline--wrap","ds-inline--end",3,"ngSubmit"],["label","From (UTC)","controlId","usage-from"],["dsControl","","id","usage-from","type","date","name","from","required","",3,"ngModelChange","ngModel"],["label","To (UTC)","controlId","usage-to"],["dsControl","","id","usage-to","type","date","name","to","required","",3,"ngModelChange","ngModel"],["dsButton","","variant","primary","type","submit"],[1,"ds-hint"],[1,"ds-micro"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table"],["role","rowgroup"],["role","row"],["role","columnheader"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Tokens"],["role","cell","data-label","Input / output"],["role","cell","data-label","Cache read / write"],["role","cell","data-label","Estimated cost"]],template:function(t,r){t&1&&(Es(0,"ds-page",0),fg(1,"ds-section-header",1),Bw(2,Ce,2,0,"p",2)(3,fe,5,0)(4,ye,2,0,"p",2)(5,Ee,10,4),hl()),t&2&&(VE(2),Vw(r.configuration.state()==="loading"?2:r.configuration.state()==="error"?3:r.configuration.state()==="disabled"?4:5));},dependencies:[pd,md,Ht,po,ho,lo,fa,ua,hn,fn,un,pn,at,sn,ko,Eb,f$1],encapsulation:2})};export{me as NamespaceUsageComponent};
@@ -1 +1 @@
1
- import {i}from'./chunk-ABpRMh2B.js';import {y}from'./chunk-qAO_WS2x.js';import {g,aE as X,Z as Tr,at as Cy,a1 as ga,a2 as ha,aa as br,ad as ne,aD as $y,N as x,L as w$1,a5 as vd,aF as an,aG as Ot,aH as cn,a6 as x$1}from'./main-VSQLTBR6.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 Tr(void 0);namespaceId$=new Tr(null);vm$=Cy([this.namespaceId$,this.refresh$]).pipe(ga(([t])=>{let e=this.loadPlatformSettings().pipe(ha(()=>br([])));return t?Cy([e,this.loadNamespaceSettings(t).pipe(ha(()=>br([]))),this.loadUserSettings(t).pipe(ha(()=>br([]))),this.loadUserSettings("global").pipe(ha(()=>br([])))]).pipe(ne(([n,o,r,h])=>({platform:n,namespace:o,userOnNs:r,userGlobal:h}))):Cy([e,this.loadNamespaceSettings("").pipe(ha(()=>br([]))),this.loadUserSettings("global").pipe(ha(()=>br([])))]).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))):br([])}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)),vd(()=>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)),vd(()=>this.refresh()))}delete(t,e){return this.controller.deleteAuthSetting(t).pipe(vd(()=>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(ga(r=>this.controller.connectAuthSetting(t,e).pipe(vd(h=>n(h.authorizationUrl)),ga(()=>this.awaitNewConnection(t,e,r.connected?r.connectedAt??null:null,o)))))}awaitNewConnection(t,e,n,o){let r=0,h=0;return an(b,b).pipe(ga(()=>this.getConnection(t,e).pipe(ha(()=>br(null)))),ne(A=>(r++,A?.connected&&H(A.connectedAt,n)?"connected":r*b>=M?"timeout":o()&&++h>=P?"abandoned":null)),Ot(A=>A!==null),cn(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-m1ylN0EP.js';import {y}from'./chunk-0rWkqE7F.js';import {g,aE as X,Z as Tr,at as Cy,a1 as ga,a2 as ha,aa as br,ad as ne,aD as $y,N as x,L as w$1,a5 as vd,aF as an,aG as Ot,aH as cn,a6 as x$1}from'./main-PZMWRMRC.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 Tr(void 0);namespaceId$=new Tr(null);vm$=Cy([this.namespaceId$,this.refresh$]).pipe(ga(([t])=>{let e=this.loadPlatformSettings().pipe(ha(()=>br([])));return t?Cy([e,this.loadNamespaceSettings(t).pipe(ha(()=>br([]))),this.loadUserSettings(t).pipe(ha(()=>br([]))),this.loadUserSettings("global").pipe(ha(()=>br([])))]).pipe(ne(([n,o,r,h])=>({platform:n,namespace:o,userOnNs:r,userGlobal:h}))):Cy([e,this.loadNamespaceSettings("").pipe(ha(()=>br([]))),this.loadUserSettings("global").pipe(ha(()=>br([])))]).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))):br([])}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)),vd(()=>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)),vd(()=>this.refresh()))}delete(t,e){return this.controller.deleteAuthSetting(t).pipe(vd(()=>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(ga(r=>this.controller.connectAuthSetting(t,e).pipe(vd(h=>n(h.authorizationUrl)),ga(()=>this.awaitNewConnection(t,e,r.connected?r.connectedAt??null:null,o)))))}awaitNewConnection(t,e,n,o){let r=0,h=0;return an(b,b).pipe(ga(()=>this.getConnection(t,e).pipe(ha(()=>br(null)))),ne(A=>(r++,A?.connected&&H(A.connectedAt,n)?"connected":r*b>=M?"timeout":o()&&++h>=P?"abandoned":null)),Ot(A=>A!==null),cn(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 {n}from'./chunk-CfgXrte_.js';import {O}from'./chunk-CzE55g5c.js';import {v}from'./chunk-QzulhNzo.js';import {g,W as W$1,t as F,K as we,$ as $i,U as U$1,ad as ne,a1 as ga,aa as br,D as Dw,E as Es,R as vg,c as hl,b as AC,a as Bw,d as VE,P as dg,i as Vw,v as tC,F as Fg,q as $w,z as zw,Q as Qw,n as lg,w as pf,x as hf}from'./main-VSQLTBR6.js';import {z as k,j as O$1,e as at,c as fn,k as ko,l as Fo,P,B as P$1}from'./chunk-qAO_WS2x.js';import'./chunk-ABpRMh2B.js';var H=(i,e)=>e.key;function U(i,e){if(i&1&&(Es(0,"p",3),AC(1),hl()),i&2){let t=tC();VE(),Fg(t.deletion.error());}}function z(i,e){i&1&&(Es(0,"p",4),AC(1,"Loading AI providers\u2026"),hl());}function J(i,e){i&1&&(Es(0,"p",5),AC(1,"No AI providers available."),hl());}function Q(i,e){i&1&&(Es(0,"p",4),AC(1,"No AI providers match the current filter."),hl());}function W(i,e){i&1&&(Es(0,"ds-tag",17),AC(1,"Read-only"),hl());}function X(i,e){if(i&1){let t=Qw();Es(0,"button",22),vg("click",function(){pf(t);let d=tC().$implicit,c=tC(2);return hf(c.duplicate(d))}),AC(1," Duplicate "),hl();}if(i&2){let t=tC().$implicit;lg("aria-label","Duplicate "+t.config.name);}}function Y(i,e){if(i&1){let t=Qw();Es(0,"button",22),vg("click",function(){pf(t);let d=tC(2).$implicit,c=tC(2);return hf(c.edit(d))}),AC(1," Edit "),hl();}if(i&2){let t=tC(2).$implicit;lg("aria-label","Edit "+t.config.name);}}function Z(i,e){if(i&1){let t=Qw();Bw(0,Y,2,1,"button",20),Es(1,"agentos-row-delete-action",23),vg("deleteRequested",function(){pf(t);let d=tC().$implicit,c=tC(2);return hf(c.deletion.request(d.key))})("deleteConfirmed",function(){pf(t);let d=tC().$implicit,c=tC(2);return hf(c.confirmDelete(d))})("deleteCancelled",function(){pf(t);let d=tC(3);return hf(d.deletion.cancel())}),hl();}if(i&2){let t=tC().$implicit,r=tC(2);Vw(r.deletion.confirmingId()!==t.key?0:-1),VE(),dg("rowKey",t.key)("rowLabel",t.config.name)("state",r.deletion);}}function ee(i,e){i&1&&(Es(0,"button",21),AC(1,"Inherited"),hl());}function te(i,e){if(i&1&&(Es(0,"tr",9)(1,"td",12),AC(2),hl(),Es(3,"td",13),AC(4),hl(),Es(5,"td",14)(6,"div",15)(7,"ds-tag",16),AC(8),hl(),Bw(9,W,2,0,"ds-tag",17),hl()(),Es(10,"td",18)(11,"div",19),Bw(12,X,2,1,"button",20),Bw(13,Z,2,4)(14,ee,2,0,"button",21),hl()()()),i&2){let t=e.$implicit,r=tC(2);VE(2),Fg(t.config.name),VE(2),Fg(t.config.apiType),VE(3),dg("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),VE(),Fg(t.scopeLabel),VE(),Vw(t.canMutate?-1:9),VE(3),Vw(r.deletion.confirmingId()!==t.key?12:-1),VE(),Vw(t.canMutate?13:14);}}function ie(i,e){if(i&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),AC(5,"Name"),hl(),Es(6,"th",10),AC(7,"API type"),hl(),Es(8,"th",10),AC(9,"Scope"),hl(),Es(10,"th",10)(11,"span",11),AC(12,"Actions"),hl()()()(),Es(13,"tbody",8),$w(14,te,15,7,"tr",9,H),hl()()()),i&2){let t=tC();VE(14),zw(t.rowFilter.filteredRows());}}var G=class i{route=g(W$1);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=$i(false);isLoading=$i(true);rows=$i([]);deletion=k();rowFilter=O$1(this.rows,e=>[e.config.name,e.config.apiType,e.scopeLabel].join(" "));ngOnInit(){this.route.paramMap.pipe(U$1(this.destroyRef)).subscribe(e=>{let t=e.get("namespaceId")??"";t&&t!==this.namespaceId&&(this.namespaceId=t),this.state.setNamespace(t);}),this.route.paramMap.pipe(ne(e=>e.get("namespaceId")??""),ga(e=>e?this.namespaceRole.isAdminOfNamespace$(e):br(false)),U$1(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.rows.set(this.toRows(e)),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-providers","new"],{queryParams:{scope:n(this.isAdmin())}});}edit(e){!e.canMutate||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"ai-providers",e.config.id,"edit"],{queryParams:{scope:e.scope}});}confirmDelete(e){!e.canMutate||!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.`});}duplicate(e){if(!e.config.id)return;let t=e.scope==="platform"||e.scope==="namespace"&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"ai-providers","new"],{queryParams:{scope:t,template:e.config.id,templateScope:e.scope}});}toRows(e){return [...this.mapScope(e.platform,"platform","Platform",false),...this.mapScope(e.namespace,"namespace","Namespace",this.isAdmin()),...this.mapScope(e.userOnNs,"userOnNs","Personal",true),...this.mapScope(e.userGlobal,"userGlobal","Personal",true)]}mapScope(e,t,r,d){return e.map((c,K)=>({key:`${t}:${c.id??K}`,config:c,scope:t,scopeLabel:r,canMutate:d}))}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=Dw({type:i,selectors:[["agentos-ai-providers-all-scopes"]],decls:9,vars:3,consts:[["title","AI providers","description","AI providers available in this namespace, including inherited platform and personal entries."],["label","Filter AI providers","placeholder","Filter AI providers\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","AI providers"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","API type",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"],["type","button","disabled",""],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,r){t&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return r.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return r.openCreateForm()}),AC(3,"New AI provider"),hl()(),Bw(4,U,2,1,"p",3),Bw(5,z,2,0,"p",4)(6,J,2,0,"p",5)(7,Q,2,0,"p",4)(8,ie,16,0,"div",6)),t&2&&(VE(),dg("query",r.rowFilter.query()),VE(3),Vw(r.deletion.error()?4:-1),VE(),Vw(r.isLoading()?5:r.rows().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,fn,ko,Fo,P,P$1],encapsulation:2})};export{G as AiProvidersAllScopesComponent};
1
+ import {n}from'./chunk-CfgXrte_.js';import {O}from'./chunk-BKdHqvrx.js';import {v}from'./chunk-HtmwgODm.js';import {g,W as W$1,t as F,K as we,$ as $i,U as U$1,ad as ne,a1 as ga,aa as br,D as Dw,E as Es,R as vg,c as hl,b as AC,a as Bw,d as VE,P as dg,i as Vw,v as tC,F as Fg,q as $w,z as zw,Q as Qw,n as lg,w as pf,x as hf}from'./main-PZMWRMRC.js';import {z as k,j as O$1,e as at,c as fn,k as ko,l as Fo,P,B as P$1}from'./chunk-0rWkqE7F.js';import'./chunk-m1ylN0EP.js';var H=(i,e)=>e.key;function U(i,e){if(i&1&&(Es(0,"p",3),AC(1),hl()),i&2){let t=tC();VE(),Fg(t.deletion.error());}}function z(i,e){i&1&&(Es(0,"p",4),AC(1,"Loading AI providers\u2026"),hl());}function J(i,e){i&1&&(Es(0,"p",5),AC(1,"No AI providers available."),hl());}function Q(i,e){i&1&&(Es(0,"p",4),AC(1,"No AI providers match the current filter."),hl());}function W(i,e){i&1&&(Es(0,"ds-tag",17),AC(1,"Read-only"),hl());}function X(i,e){if(i&1){let t=Qw();Es(0,"button",22),vg("click",function(){pf(t);let d=tC().$implicit,c=tC(2);return hf(c.duplicate(d))}),AC(1," Duplicate "),hl();}if(i&2){let t=tC().$implicit;lg("aria-label","Duplicate "+t.config.name);}}function Y(i,e){if(i&1){let t=Qw();Es(0,"button",22),vg("click",function(){pf(t);let d=tC(2).$implicit,c=tC(2);return hf(c.edit(d))}),AC(1," Edit "),hl();}if(i&2){let t=tC(2).$implicit;lg("aria-label","Edit "+t.config.name);}}function Z(i,e){if(i&1){let t=Qw();Bw(0,Y,2,1,"button",20),Es(1,"agentos-row-delete-action",23),vg("deleteRequested",function(){pf(t);let d=tC().$implicit,c=tC(2);return hf(c.deletion.request(d.key))})("deleteConfirmed",function(){pf(t);let d=tC().$implicit,c=tC(2);return hf(c.confirmDelete(d))})("deleteCancelled",function(){pf(t);let d=tC(3);return hf(d.deletion.cancel())}),hl();}if(i&2){let t=tC().$implicit,r=tC(2);Vw(r.deletion.confirmingId()!==t.key?0:-1),VE(),dg("rowKey",t.key)("rowLabel",t.config.name)("state",r.deletion);}}function ee(i,e){i&1&&(Es(0,"button",21),AC(1,"Inherited"),hl());}function te(i,e){if(i&1&&(Es(0,"tr",9)(1,"td",12),AC(2),hl(),Es(3,"td",13),AC(4),hl(),Es(5,"td",14)(6,"div",15)(7,"ds-tag",16),AC(8),hl(),Bw(9,W,2,0,"ds-tag",17),hl()(),Es(10,"td",18)(11,"div",19),Bw(12,X,2,1,"button",20),Bw(13,Z,2,4)(14,ee,2,0,"button",21),hl()()()),i&2){let t=e.$implicit,r=tC(2);VE(2),Fg(t.config.name),VE(2),Fg(t.config.apiType),VE(3),dg("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),VE(),Fg(t.scopeLabel),VE(),Vw(t.canMutate?-1:9),VE(3),Vw(r.deletion.confirmingId()!==t.key?12:-1),VE(),Vw(t.canMutate?13:14);}}function ie(i,e){if(i&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),AC(5,"Name"),hl(),Es(6,"th",10),AC(7,"API type"),hl(),Es(8,"th",10),AC(9,"Scope"),hl(),Es(10,"th",10)(11,"span",11),AC(12,"Actions"),hl()()()(),Es(13,"tbody",8),$w(14,te,15,7,"tr",9,H),hl()()()),i&2){let t=tC();VE(14),zw(t.rowFilter.filteredRows());}}var G=class i{route=g(W$1);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=$i(false);isLoading=$i(true);rows=$i([]);deletion=k();rowFilter=O$1(this.rows,e=>[e.config.name,e.config.apiType,e.scopeLabel].join(" "));ngOnInit(){this.route.paramMap.pipe(U$1(this.destroyRef)).subscribe(e=>{let t=e.get("namespaceId")??"";t&&t!==this.namespaceId&&(this.namespaceId=t),this.state.setNamespace(t);}),this.route.paramMap.pipe(ne(e=>e.get("namespaceId")??""),ga(e=>e?this.namespaceRole.isAdminOfNamespace$(e):br(false)),U$1(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.rows.set(this.toRows(e)),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-providers","new"],{queryParams:{scope:n(this.isAdmin())}});}edit(e){!e.canMutate||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"ai-providers",e.config.id,"edit"],{queryParams:{scope:e.scope}});}confirmDelete(e){!e.canMutate||!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.`});}duplicate(e){if(!e.config.id)return;let t=e.scope==="platform"||e.scope==="namespace"&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"ai-providers","new"],{queryParams:{scope:t,template:e.config.id,templateScope:e.scope}});}toRows(e){return [...this.mapScope(e.platform,"platform","Platform",false),...this.mapScope(e.namespace,"namespace","Namespace",this.isAdmin()),...this.mapScope(e.userOnNs,"userOnNs","Personal",true),...this.mapScope(e.userGlobal,"userGlobal","Personal",true)]}mapScope(e,t,r,d){return e.map((c,K)=>({key:`${t}:${c.id??K}`,config:c,scope:t,scopeLabel:r,canMutate:d}))}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=Dw({type:i,selectors:[["agentos-ai-providers-all-scopes"]],decls:9,vars:3,consts:[["title","AI providers","description","AI providers available in this namespace, including inherited platform and personal entries."],["label","Filter AI providers","placeholder","Filter AI providers\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","AI providers"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","API type",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"],["type","button","disabled",""],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,r){t&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return r.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return r.openCreateForm()}),AC(3,"New AI provider"),hl()(),Bw(4,U,2,1,"p",3),Bw(5,z,2,0,"p",4)(6,J,2,0,"p",5)(7,Q,2,0,"p",4)(8,ie,16,0,"div",6)),t&2&&(VE(),dg("query",r.rowFilter.query()),VE(3),Vw(r.deletion.error()?4:-1),VE(),Vw(r.isLoading()?5:r.rows().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,fn,ko,Fo,P,P$1],encapsulation:2})};export{G as AiProvidersAllScopesComponent};
@@ -1 +1 @@
1
- import {z as k$1,j as O$1,e as at,c as fn,k as ko,P,B as P$1}from'./chunk-qAO_WS2x.js';import {g,t as F,K as we,aq as k,ap as F$1,Z as Tr,$ as $i,a1 as ga,at as Cy,U as U$1,D as Dw,E as Es,R as vg,c as hl,b as AC,a as Bw,d as VE,P as dg,i as Vw,v as tC,F as Fg,q as $w,z as zw,Q as Qw,w as pf,x as hf,u as Dl,n as lg}from'./main-VSQLTBR6.js';var K=(o,t)=>t.key;function H(o,t){if(o&1&&(Es(0,"p",3),AC(1),hl()),o&2){let e=tC();VE(),Fg(e.deletion.error());}}function U(o,t){o&1&&(Es(0,"p",4),AC(1,"Loading AI models\u2026"),hl());}function z(o,t){o&1&&(Es(0,"p",5),AC(1,"No platform AI models defined yet."),hl());}function G(o,t){o&1&&(Es(0,"p",4),AC(1,"No AI models match the current filter."),hl());}function J(o,t){if(o&1){let e=Qw();Es(0,"button",21),vg("click",function(){pf(e);let r=tC().$implicit,m=tC(2);return hf(m.edit(r))}),AC(1,"Edit"),hl();}if(o&2){let e=tC().$implicit;lg("aria-label","Edit "+e.title);}}function O(o,t){if(o&1){let e=Qw();Es(0,"tr",9)(1,"td",12),AC(2),hl(),Es(3,"td",13),AC(4),hl(),Es(5,"td",14),AC(6),hl(),Es(7,"td",15),AC(8),hl(),Es(9,"td",16),AC(10),hl(),Es(11,"td",17)(12,"div",18),Bw(13,J,2,1,"button",19),Es(14,"agentos-row-delete-action",20),vg("deleteRequested",function(){let r=pf(e).$implicit,m=tC(2);return hf(m.deletion.request(r.key))})("deleteConfirmed",function(){let r=pf(e).$implicit,m=tC(2);return hf(m.confirmDelete(r))})("deleteCancelled",function(){pf(e);let r=tC(2);return hf(r.deletion.cancel())}),hl()()()();}if(o&2){let e=t.$implicit,a=tC(2);VE(2),Fg(e.title),VE(2),Fg(e.providerName),VE(2),Dl(" ",e.model.apiModelName," "),VE(2),Fg(e.model.priority),VE(2),Dl(" ",e.model.reasoningEffort?e.model.reasoningEffort.toLowerCase():"\u2014"," "),VE(3),Vw(a.deletion.confirmingId()!==e.key?13:-1),VE(),dg("rowKey",e.key)("rowLabel",e.title)("state",a.deletion);}}function Q(o,t){if(o&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),AC(5,"Name"),hl(),Es(6,"th",10),AC(7,"Provider"),hl(),Es(8,"th",10),AC(9,"API model name"),hl(),Es(10,"th",10),AC(11,"Priority"),hl(),Es(12,"th",10),AC(13,"Reasoning effort"),hl(),Es(14,"th",10)(15,"span",11),AC(16,"Actions"),hl()()()(),Es(17,"tbody",8),$w(18,O,15,9,"tr",9,K),hl()()()),o&2){let e=tC();VE(18),zw(e.rowFilter.filteredRows());}}var j=class o{router=g(F);destroyRef=g(we);aiModelController=g(k);aiProviderController=g(F$1);refresh$=new Tr(void 0);isLoading=$i(true);deletion=k$1();rows=$i([]);rowFilter=O$1(this.rows,t=>[t.title,t.model.apiModelName,t.providerName].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(this.isLoading.set(true),Cy([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=Dw({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&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(m){return a.rowFilter.query.set(m)}),hl(),Es(2,"button",2),vg("click",function(){return a.openCreateForm()}),AC(3,"New AI model"),hl()(),Bw(4,H,2,1,"p",3),Bw(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&&(VE(),dg("query",a.rowFilter.query()),VE(3),Vw(a.deletion.error()?4:-1),VE(),Vw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,fn,ko,P,P$1],encapsulation:2})};export{j as PlatformAiModelsComponent};
1
+ import {z as k$1,j as O$1,e as at,c as fn,k as ko,P,B as P$1}from'./chunk-0rWkqE7F.js';import {g,t as F,K as we,aq as k,ap as F$1,Z as Tr,$ as $i,a1 as ga,at as Cy,U as U$1,D as Dw,E as Es,R as vg,c as hl,b as AC,a as Bw,d as VE,P as dg,i as Vw,v as tC,F as Fg,q as $w,z as zw,Q as Qw,w as pf,x as hf,u as Dl,n as lg}from'./main-PZMWRMRC.js';var K=(o,t)=>t.key;function H(o,t){if(o&1&&(Es(0,"p",3),AC(1),hl()),o&2){let e=tC();VE(),Fg(e.deletion.error());}}function U(o,t){o&1&&(Es(0,"p",4),AC(1,"Loading AI models\u2026"),hl());}function z(o,t){o&1&&(Es(0,"p",5),AC(1,"No platform AI models defined yet."),hl());}function G(o,t){o&1&&(Es(0,"p",4),AC(1,"No AI models match the current filter."),hl());}function J(o,t){if(o&1){let e=Qw();Es(0,"button",21),vg("click",function(){pf(e);let r=tC().$implicit,m=tC(2);return hf(m.edit(r))}),AC(1,"Edit"),hl();}if(o&2){let e=tC().$implicit;lg("aria-label","Edit "+e.title);}}function O(o,t){if(o&1){let e=Qw();Es(0,"tr",9)(1,"td",12),AC(2),hl(),Es(3,"td",13),AC(4),hl(),Es(5,"td",14),AC(6),hl(),Es(7,"td",15),AC(8),hl(),Es(9,"td",16),AC(10),hl(),Es(11,"td",17)(12,"div",18),Bw(13,J,2,1,"button",19),Es(14,"agentos-row-delete-action",20),vg("deleteRequested",function(){let r=pf(e).$implicit,m=tC(2);return hf(m.deletion.request(r.key))})("deleteConfirmed",function(){let r=pf(e).$implicit,m=tC(2);return hf(m.confirmDelete(r))})("deleteCancelled",function(){pf(e);let r=tC(2);return hf(r.deletion.cancel())}),hl()()()();}if(o&2){let e=t.$implicit,a=tC(2);VE(2),Fg(e.title),VE(2),Fg(e.providerName),VE(2),Dl(" ",e.model.apiModelName," "),VE(2),Fg(e.model.priority),VE(2),Dl(" ",e.model.reasoningEffort?e.model.reasoningEffort.toLowerCase():"\u2014"," "),VE(3),Vw(a.deletion.confirmingId()!==e.key?13:-1),VE(),dg("rowKey",e.key)("rowLabel",e.title)("state",a.deletion);}}function Q(o,t){if(o&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),AC(5,"Name"),hl(),Es(6,"th",10),AC(7,"Provider"),hl(),Es(8,"th",10),AC(9,"API model name"),hl(),Es(10,"th",10),AC(11,"Priority"),hl(),Es(12,"th",10),AC(13,"Reasoning effort"),hl(),Es(14,"th",10)(15,"span",11),AC(16,"Actions"),hl()()()(),Es(17,"tbody",8),$w(18,O,15,9,"tr",9,K),hl()()()),o&2){let e=tC();VE(18),zw(e.rowFilter.filteredRows());}}var j=class o{router=g(F);destroyRef=g(we);aiModelController=g(k);aiProviderController=g(F$1);refresh$=new Tr(void 0);isLoading=$i(true);deletion=k$1();rows=$i([]);rowFilter=O$1(this.rows,t=>[t.title,t.model.apiModelName,t.providerName].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(this.isLoading.set(true),Cy([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=Dw({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&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(m){return a.rowFilter.query.set(m)}),hl(),Es(2,"button",2),vg("click",function(){return a.openCreateForm()}),AC(3,"New AI model"),hl()(),Bw(4,H,2,1,"p",3),Bw(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&&(VE(),dg("query",a.rowFilter.query()),VE(3),Vw(a.deletion.error()?4:-1),VE(),Vw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,fn,ko,P,P$1],encapsulation:2})};export{j as PlatformAiModelsComponent};
@@ -1 +1 @@
1
- import {v}from'./chunk-QzulhNzo.js';import {I}from'./chunk-DQDO93fa.js';import {O}from'./chunk-DxEJ-WRR.js';import {g,W,t as F,K as we,a8 as _,a9 as F$1,aa as br,$ as $i,ab as le,o as oT,a1 as ga,U,O as Of,ac as by,D as Dw,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,i as Vw,a2 as ha,ad as ne,Q as Qw,q as $w,ae as Lw,S as NI,f as fg,v as tC,z as zw,T as AI,u as Dl,F as Fg,w as pf,x as hf}from'./main-VSQLTBR6.js';import {p as pt,T as Te$1,g as gn,b as hn,c as fn,u as un,o as dn,d as cn,r as rn,e as at,i as sn,t as an,q as qt,m as md,C as Co,M as Mo,H as Ht,v as yn,U as Ut,x as ya,a as po,h as ho,A as An,O as On,W as Wt}from'./chunk-qAO_WS2x.js';import'./chunk-ABpRMh2B.js';var be=(i,e)=>e.value;function _e(i,e){i&1&&(Es(0,"p",2),AC(1,"Loading\u2026"),hl());}function xe(i,e){if(i&1&&(Es(0,"label",6),fg(1,"input",22),NI(),AC(2),hl()),i&2){let t=e.$implicit,n=tC(2);VE(),dg("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),AI(),VE(),Dl(" ",t.label," ");}}function Ie(i,e){if(i&1&&(Es(0,"option",10),AC(1),hl()),i&2){let t=e.$implicit;dg("value",t.type),VE(),Fg(t.displayName);}}function Ne(i,e){if(i&1&&(Es(0,"option",10),AC(1),hl()),i&2){let t=e.$implicit;dg("value",t.value),VE(),Fg(t.label);}}function Ae(i,e){if(i&1&&(Es(0,"div",18)(1,"label",6),fg(2,"input",23),NI(),AC(3," Grant automatically "),hl(),Es(4,"p",2),AC(5),hl()()),i&2){let t=tC(2);VE(2),dg("formControl",t.autoGrantControl),AI(),VE(3),Dl(" Give this integration to ",t.autoGrantReach(),", without each agent having to declare it. An agent can still opt out by mapping this configuration to an empty tool list. ");}}function Ee(i,e){if(i&1){let t=Qw();Es(0,"ds-card")(1,"ds-json-schema-form",24),vg("valueChange",function(a){pf(t);let p=tC(2);return hf(p.onParamsChange(a))}),hl()();}if(i&2){let t=tC(2);VE(),dg("schema",e)("value",t.initialParams());}}function Fe(i,e){if(i&1){let t=Qw();Es(0,"button",25),vg("click",function(){pf(t);let a=tC(2);return hf(a.exportYaml())}),AC(1),hl();}if(i&2){let t=tC(2);dg("disabled",t.isExporting()),VE(),Dl(" ",t.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Te(i,e){if(i&1){let t=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(t);let a=tC();return hf(a.submit())}),Es(1,"ds-fieldset",5),$w(2,xe,3,4,"label",6,Lw().trackByScope,true),hl(),Es(4,"ds-form-field",7)(5,"select",8)(6,"option",9),AC(7,"Select type"),hl(),$w(8,Ie,2,2,"option",10,Lw().trackByType,true),hl(),NI(),hl(),Es(10,"ds-form-field",11),fg(11,"input",12),NI(),hl(),Es(12,"ds-form-field",13),fg(13,"textarea",14),NI(),hl(),Es(14,"ds-form-field",15)(15,"select",16)(16,"option",17),AC(17,"None"),hl(),$w(18,Ne,2,2,"option",10,be),hl(),NI(),hl(),Bw(20,Ae,6,2,"div",18),Bw(21,Ee,2,2,"ds-card"),Es(22,"ds-form-actions")(23,"button",19),AC(24),hl(),Bw(25,Fe,2,2,"button",20),Es(26,"button",21),vg("click",function(){pf(t);let a=tC();return hf(a.cancel())}),AC(27,"Cancel"),hl()()();}if(i&2){let t,n=tC();dg("formGroup",n.form),VE(),dg("disabled",n.isEditMode()),VE(),zw(n.scopeOptions),VE(3),dg("formControl",n.typeControl),AI(),VE(3),zw(n.integrationTypes()),VE(3),dg("formControl",n.nameControl),AI(),VE(2),dg("formControl",n.descriptionControl),AI(),VE(2),dg("formControl",n.authSettingNameControl),AI(),VE(),dg("ngValue",null),VE(2),zw(n.authSettingOptions()),VE(2),Vw(n.isAutoGrantable()?20:-1),VE(),Vw((t=n.schema())?21:-1,t),VE(2),dg("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),VE(),Dl(" ",n.isEditMode()?"Save changes":"Create"," "),VE(),Vw(n.isEditMode()?25:-1);}}var Ve=new Set(["platform","namespace","userOnNs","userGlobal"]),w=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ve=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(O);integrationTypeController=g(_);authSettingState=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?br(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new pt({name:new Te$1("",{nonNullable:true,validators:[gn.required,gn.minLength(1)]}),description:new Te$1(null),type:new Te$1("",{nonNullable:true,validators:[gn.required]}),scope:new Te$1("namespace",{nonNullable:true}),autoGrant:new Te$1(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);isExporting=$i(false);scopeOptions=[{value:"platform",label:w.platform},{value:"namespace",label:w.namespace},{value:"userOnNs",label:w.userOnNs},{value:"userGlobal",label:w.userGlobal}];authSettingNameControl=new Te$1(null);loadedAuthSettings=$i([]);authSettingsLoaded=$i(false);savedAuthSettingName=$i(null);authSettingsScope$=new le;authSettingOptions=oT(()=>{let e=this.loadedAuthSettings(),t=this.savedAuthSettingName();return !t||!this.authSettingsLoaded()||e.some(n=>n.value===t)?e:[...e,{value:t,label:`${t} (not found)`}]});paramsValue=$i(null);initialParams=$i(null);integrationTypes=F$1(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=F$1(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});scopeValue=F$1(this.form.controls.scope.valueChanges,{initialValue:this.form.controls.scope.value});schema=oT(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});isAutoGrantable=oT(()=>{let e=this.selectedType();return e?this.integrationTypes().find(t=>t.type===e)?.autoGrantable??false:false});autoGrantReach=oT(()=>{switch(this.scopeValue()){case "platform":return "every agent of this environment";case "namespace":return "every agent of this namespace";default:return "your own runs"}});existingConfig=null;constructor(){this.authSettingsScope$.pipe(ga(e=>this.loadAuthSettingLayers(e)),U(this.destroyRef)).subscribe(e=>{this.loadedAuthSettings.set(this.toAuthSettingOptions(e)),this.authSettingsLoaded.set(true);}),Of(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let e=this.route.snapshot.paramMap,t=this.route.snapshot.queryParamMap,n=e.get("integrationId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable(),this.loadAuthSettingsForScope("platform");return}let a=this.parseScope(t.get("scope"));this.scopeControl.setValue(a),this.loadAuthSettingsForScope(a),this.scopeControl.valueChanges.pipe(U(this.destroyRef)).subscribe(D=>{this.loadAuthSettingsForScope(D);});let p=t.get("template");p&&this.hydrateFromTemplate(p);}parseScope(e){return e&&Ve.has(e)?e:"namespace"}deriveScopeFromConfig(e){return !e.userId&&!e.namespaceId?"platform":e.userId?e.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.existingConfig=t;let n=this.deriveScopeFromConfig(t);this.scopeControl.setValue(n),this.applyConfigToForm(t),this.loadAuthSettingsForScope(n),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[IntegrationForm] Could not load config '${e}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.applyConfigToForm(t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:t=>{console.warn(`[IntegrationForm] Could not hydrate from template ${e}:`,t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(e){this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.typeControl.setValue(e.integrationType),this.initialParams.set(e.parameters),this.paramsValue.set(e.parameters),this.authSettingNameControl.setValue(e.authSettingName??null),this.savedAuthSettingName.set(e.authSettingName??null),this.autoGrantControl.setValue(e.autoGrant??false);}loadAuthSettingsForScope(e){this.authSettingsLoaded.set(false),this.authSettingsScope$.next(e);}loadAuthSettingLayers(e){let t=(p,D)=>D.pipe(ha(()=>br([])),ne(Se=>({label:p,settings:Se}))),n=t("platform",this.authSettingState.loadPlatformSettings()),a=t("mine",this.authSettingState.loadUserSettings("global"));return e==="platform"||e==="userGlobal"?by([a,n]):by([t("mine",this.authSettingState.loadUserSettings(this.namespaceId)),t("namespace",this.authSettingState.loadNamespaceSettings(this.namespaceId)),a,n])}toAuthSettingOptions(e){let t=new Map;for(let{label:n,settings:a}of e)for(let{name:p}of a)p&&t.set(p,(t.get(p)??new Set).add(n));return [...t.entries()].sort(([n],[a])=>n.localeCompare(a)).map(([n,a])=>({value:n,label:`${n} (${[...a].join(", ")})`}))}onParamsChange(e){this.paramsValue.set(e);}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let e=this.descriptionControl.value?.trim(),t={name:this.nameControl.value.trim(),description:e||null,integrationType:this.typeControl.value,parameters:this.paramsValue(),authSettingName:this.authSettingNameControl.value||null,autoGrant:this.isAutoGrantable()&&this.autoGrantControl.value},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,t,n,this.existingConfig):this.state.create(t,n,this.namespaceId??null)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let e=this.existingConfig?.id;!e||this.isExporting()||(this.isExporting.set(true),this.state.exportAsYaml(e).pipe(U(this.destroyRef)).subscribe({next:t=>{let n=new Blob([t],{type:"application/yaml"}),a=URL.createObjectURL(n),p=document.createElement("a");p.href=a,p.download=`${this.existingConfig?.name??"integration"}.yaml`,p.click(),URL.revokeObjectURL(a),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"]);}trackByType(e,t){return t.type}trackByScope(e,t){return t.value}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=Dw({type:i,selectors:[["agentos-integration-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to integrations",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Scope",3,"disabled"],["dsCheck",""],["label","Type","controlId","integration-type","required",""],["dsControl","","id","integration-type",3,"formControl"],["value","","disabled",""],[3,"value"],["label","Name","controlId","integration-name","required",""],["dsControl","","id","integration-name","type","text","placeholder","Integration name","autocomplete","off",3,"formControl"],["label","Description","controlId","integration-description"],["dsControl","","id","integration-description","placeholder","Optional description","rows","3",3,"formControl"],["label","Auth Setting","controlId","integration-auth-setting","hint","Only the name is saved. It is resolved at run time for the user running the case, the most specific layer winning (user on this namespace > namespace > user > platform), so a shared integration can rely on each user's own auth setting of that name."],["dsControl","","id","integration-auth-setting",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-stack--sm"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["type","radio",3,"value","formControl","disabled"],["type","checkbox",3,"formControl"],[3,"valueChange","schema","value"],["dsButton","","type","button",3,"click","disabled"]],template:function(t,n){t&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return n.cancel()}),AC(3," \u2190 Integrations "),hl()(),Bw(4,_e,2,0,"p",2)(5,Te,28,12,"form",3),hl()),t&2&&(VE(),dg("title",n.isEditMode()?"Edit integration":"New integration"),VE(3),Vw(n.isLoading()?4:5));},dependencies:[hn,fn,un,dn,cn,rn,at,sn,an,qt,md,Co,Mo,Ht,yn,Ut,ya,po,ho,An,On,Wt],encapsulation:2})};export{ve as IntegrationFormComponent};
1
+ import {v}from'./chunk-HtmwgODm.js';import {I}from'./chunk-D4eJc3W1.js';import {O}from'./chunk-OblIjDXe.js';import {g,W,t as F,K as we,a8 as _,a9 as F$1,aa as br,$ as $i,ab as le,o as oT,a1 as ga,U,O as Of,ac as by,D as Dw,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,i as Vw,a2 as ha,ad as ne,Q as Qw,q as $w,ae as Lw,S as NI,f as fg,v as tC,z as zw,T as AI,u as Dl,F as Fg,w as pf,x as hf}from'./main-PZMWRMRC.js';import {p as pt,T as Te$1,g as gn,b as hn,c as fn,u as un,o as dn,d as cn,r as rn,e as at,i as sn,t as an,q as qt,m as md,C as Co,M as Mo,H as Ht,v as yn,U as Ut,x as ya,a as po,h as ho,A as An,O as On,W as Wt}from'./chunk-0rWkqE7F.js';import'./chunk-m1ylN0EP.js';var be=(i,e)=>e.value;function _e(i,e){i&1&&(Es(0,"p",2),AC(1,"Loading\u2026"),hl());}function xe(i,e){if(i&1&&(Es(0,"label",6),fg(1,"input",22),NI(),AC(2),hl()),i&2){let t=e.$implicit,n=tC(2);VE(),dg("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),AI(),VE(),Dl(" ",t.label," ");}}function Ie(i,e){if(i&1&&(Es(0,"option",10),AC(1),hl()),i&2){let t=e.$implicit;dg("value",t.type),VE(),Fg(t.displayName);}}function Ne(i,e){if(i&1&&(Es(0,"option",10),AC(1),hl()),i&2){let t=e.$implicit;dg("value",t.value),VE(),Fg(t.label);}}function Ae(i,e){if(i&1&&(Es(0,"div",18)(1,"label",6),fg(2,"input",23),NI(),AC(3," Grant automatically "),hl(),Es(4,"p",2),AC(5),hl()()),i&2){let t=tC(2);VE(2),dg("formControl",t.autoGrantControl),AI(),VE(3),Dl(" Give this integration to ",t.autoGrantReach(),", without each agent having to declare it. An agent can still opt out by mapping this configuration to an empty tool list. ");}}function Ee(i,e){if(i&1){let t=Qw();Es(0,"ds-card")(1,"ds-json-schema-form",24),vg("valueChange",function(a){pf(t);let p=tC(2);return hf(p.onParamsChange(a))}),hl()();}if(i&2){let t=tC(2);VE(),dg("schema",e)("value",t.initialParams());}}function Fe(i,e){if(i&1){let t=Qw();Es(0,"button",25),vg("click",function(){pf(t);let a=tC(2);return hf(a.exportYaml())}),AC(1),hl();}if(i&2){let t=tC(2);dg("disabled",t.isExporting()),VE(),Dl(" ",t.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Te(i,e){if(i&1){let t=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(t);let a=tC();return hf(a.submit())}),Es(1,"ds-fieldset",5),$w(2,xe,3,4,"label",6,Lw().trackByScope,true),hl(),Es(4,"ds-form-field",7)(5,"select",8)(6,"option",9),AC(7,"Select type"),hl(),$w(8,Ie,2,2,"option",10,Lw().trackByType,true),hl(),NI(),hl(),Es(10,"ds-form-field",11),fg(11,"input",12),NI(),hl(),Es(12,"ds-form-field",13),fg(13,"textarea",14),NI(),hl(),Es(14,"ds-form-field",15)(15,"select",16)(16,"option",17),AC(17,"None"),hl(),$w(18,Ne,2,2,"option",10,be),hl(),NI(),hl(),Bw(20,Ae,6,2,"div",18),Bw(21,Ee,2,2,"ds-card"),Es(22,"ds-form-actions")(23,"button",19),AC(24),hl(),Bw(25,Fe,2,2,"button",20),Es(26,"button",21),vg("click",function(){pf(t);let a=tC();return hf(a.cancel())}),AC(27,"Cancel"),hl()()();}if(i&2){let t,n=tC();dg("formGroup",n.form),VE(),dg("disabled",n.isEditMode()),VE(),zw(n.scopeOptions),VE(3),dg("formControl",n.typeControl),AI(),VE(3),zw(n.integrationTypes()),VE(3),dg("formControl",n.nameControl),AI(),VE(2),dg("formControl",n.descriptionControl),AI(),VE(2),dg("formControl",n.authSettingNameControl),AI(),VE(),dg("ngValue",null),VE(2),zw(n.authSettingOptions()),VE(2),Vw(n.isAutoGrantable()?20:-1),VE(),Vw((t=n.schema())?21:-1,t),VE(2),dg("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),VE(),Dl(" ",n.isEditMode()?"Save changes":"Create"," "),VE(),Vw(n.isEditMode()?25:-1);}}var Ve=new Set(["platform","namespace","userOnNs","userGlobal"]),w=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ve=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(O);integrationTypeController=g(_);authSettingState=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?br(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new pt({name:new Te$1("",{nonNullable:true,validators:[gn.required,gn.minLength(1)]}),description:new Te$1(null),type:new Te$1("",{nonNullable:true,validators:[gn.required]}),scope:new Te$1("namespace",{nonNullable:true}),autoGrant:new Te$1(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);isExporting=$i(false);scopeOptions=[{value:"platform",label:w.platform},{value:"namespace",label:w.namespace},{value:"userOnNs",label:w.userOnNs},{value:"userGlobal",label:w.userGlobal}];authSettingNameControl=new Te$1(null);loadedAuthSettings=$i([]);authSettingsLoaded=$i(false);savedAuthSettingName=$i(null);authSettingsScope$=new le;authSettingOptions=oT(()=>{let e=this.loadedAuthSettings(),t=this.savedAuthSettingName();return !t||!this.authSettingsLoaded()||e.some(n=>n.value===t)?e:[...e,{value:t,label:`${t} (not found)`}]});paramsValue=$i(null);initialParams=$i(null);integrationTypes=F$1(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=F$1(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});scopeValue=F$1(this.form.controls.scope.valueChanges,{initialValue:this.form.controls.scope.value});schema=oT(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});isAutoGrantable=oT(()=>{let e=this.selectedType();return e?this.integrationTypes().find(t=>t.type===e)?.autoGrantable??false:false});autoGrantReach=oT(()=>{switch(this.scopeValue()){case "platform":return "every agent of this environment";case "namespace":return "every agent of this namespace";default:return "your own runs"}});existingConfig=null;constructor(){this.authSettingsScope$.pipe(ga(e=>this.loadAuthSettingLayers(e)),U(this.destroyRef)).subscribe(e=>{this.loadedAuthSettings.set(this.toAuthSettingOptions(e)),this.authSettingsLoaded.set(true);}),Of(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let e=this.route.snapshot.paramMap,t=this.route.snapshot.queryParamMap,n=e.get("integrationId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable(),this.loadAuthSettingsForScope("platform");return}let a=this.parseScope(t.get("scope"));this.scopeControl.setValue(a),this.loadAuthSettingsForScope(a),this.scopeControl.valueChanges.pipe(U(this.destroyRef)).subscribe(D=>{this.loadAuthSettingsForScope(D);});let p=t.get("template");p&&this.hydrateFromTemplate(p);}parseScope(e){return e&&Ve.has(e)?e:"namespace"}deriveScopeFromConfig(e){return !e.userId&&!e.namespaceId?"platform":e.userId?e.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.existingConfig=t;let n=this.deriveScopeFromConfig(t);this.scopeControl.setValue(n),this.applyConfigToForm(t),this.loadAuthSettingsForScope(n),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[IntegrationForm] Could not load config '${e}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.applyConfigToForm(t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:t=>{console.warn(`[IntegrationForm] Could not hydrate from template ${e}:`,t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(e){this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.typeControl.setValue(e.integrationType),this.initialParams.set(e.parameters),this.paramsValue.set(e.parameters),this.authSettingNameControl.setValue(e.authSettingName??null),this.savedAuthSettingName.set(e.authSettingName??null),this.autoGrantControl.setValue(e.autoGrant??false);}loadAuthSettingsForScope(e){this.authSettingsLoaded.set(false),this.authSettingsScope$.next(e);}loadAuthSettingLayers(e){let t=(p,D)=>D.pipe(ha(()=>br([])),ne(Se=>({label:p,settings:Se}))),n=t("platform",this.authSettingState.loadPlatformSettings()),a=t("mine",this.authSettingState.loadUserSettings("global"));return e==="platform"||e==="userGlobal"?by([a,n]):by([t("mine",this.authSettingState.loadUserSettings(this.namespaceId)),t("namespace",this.authSettingState.loadNamespaceSettings(this.namespaceId)),a,n])}toAuthSettingOptions(e){let t=new Map;for(let{label:n,settings:a}of e)for(let{name:p}of a)p&&t.set(p,(t.get(p)??new Set).add(n));return [...t.entries()].sort(([n],[a])=>n.localeCompare(a)).map(([n,a])=>({value:n,label:`${n} (${[...a].join(", ")})`}))}onParamsChange(e){this.paramsValue.set(e);}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let e=this.descriptionControl.value?.trim(),t={name:this.nameControl.value.trim(),description:e||null,integrationType:this.typeControl.value,parameters:this.paramsValue(),authSettingName:this.authSettingNameControl.value||null,autoGrant:this.isAutoGrantable()&&this.autoGrantControl.value},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,t,n,this.existingConfig):this.state.create(t,n,this.namespaceId??null)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let e=this.existingConfig?.id;!e||this.isExporting()||(this.isExporting.set(true),this.state.exportAsYaml(e).pipe(U(this.destroyRef)).subscribe({next:t=>{let n=new Blob([t],{type:"application/yaml"}),a=URL.createObjectURL(n),p=document.createElement("a");p.href=a,p.download=`${this.existingConfig?.name??"integration"}.yaml`,p.click(),URL.revokeObjectURL(a),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"]);}trackByType(e,t){return t.type}trackByScope(e,t){return t.value}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=Dw({type:i,selectors:[["agentos-integration-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to integrations",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Scope",3,"disabled"],["dsCheck",""],["label","Type","controlId","integration-type","required",""],["dsControl","","id","integration-type",3,"formControl"],["value","","disabled",""],[3,"value"],["label","Name","controlId","integration-name","required",""],["dsControl","","id","integration-name","type","text","placeholder","Integration name","autocomplete","off",3,"formControl"],["label","Description","controlId","integration-description"],["dsControl","","id","integration-description","placeholder","Optional description","rows","3",3,"formControl"],["label","Auth Setting","controlId","integration-auth-setting","hint","Only the name is saved. It is resolved at run time for the user running the case, the most specific layer winning (user on this namespace > namespace > user > platform), so a shared integration can rely on each user's own auth setting of that name."],["dsControl","","id","integration-auth-setting",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-stack--sm"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["type","radio",3,"value","formControl","disabled"],["type","checkbox",3,"formControl"],[3,"valueChange","schema","value"],["dsButton","","type","button",3,"click","disabled"]],template:function(t,n){t&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return n.cancel()}),AC(3," \u2190 Integrations "),hl()(),Bw(4,_e,2,0,"p",2)(5,Te,28,12,"form",3),hl()),t&2&&(VE(),dg("title",n.isEditMode()?"Edit integration":"New integration"),VE(3),Vw(n.isLoading()?4:5));},dependencies:[hn,fn,un,dn,cn,rn,at,sn,an,qt,md,Co,Mo,Ht,yn,Ut,ya,po,ho,An,On,Wt],encapsulation:2})};export{ve as IntegrationFormComponent};
@@ -1 +1 @@
1
- import {c}from'./chunk-DvFBWfOh.js';import {z as k,j as O$1,e as at,c as fn,k as ko,l as Fo,P,B as P$1}from'./chunk-qAO_WS2x.js';import {g,t as F,K as we,$ as $i,U as U$1,ai as ke,al as We,D as Dw,E as Es,R as vg,c as hl,b as AC,a as Bw,d as VE,P as dg,i as Vw,v as tC,F as Fg,q as $w,z as zw,Q as Qw,w as pf,x as hf,n as lg}from'./main-VSQLTBR6.js';var M=(n,t)=>t.id??t.name;function U(n,t){if(n&1&&(Es(0,"p",3),AC(1),hl()),n&2){let e=tC();VE(),Fg(e.deletion.error());}}function B(n,t){n&1&&(Es(0,"p",4),AC(1,"Loading scheduled prompts\u2026"),hl());}function j(n,t){n&1&&(Es(0,"p",5),AC(1,"No platform scheduled prompts defined yet."),hl());}function W(n,t){n&1&&(Es(0,"p",4),AC(1,"No scheduled prompts match the current filter."),hl());}function H(n,t){if(n&1&&(Es(0,"span",14),AC(1),hl()),n&2){let e=tC().$implicit;VE(),Fg(e.description);}}function O(n,t){if(n&1){let e=Qw();Es(0,"button",21),vg("click",function(){pf(e);let s=tC().$implicit,c=tC(2);return hf(c.toggle(s))}),AC(1),hl(),Es(2,"button",21),vg("click",function(){pf(e);let s=tC().$implicit,c=tC(2);return hf(c.edit(s))}),AC(3,"Edit"),hl();}if(n&2){let e=tC().$implicit;VE(),Fg(e.enabled?"Disable":"Enable"),VE(),lg("aria-label","Edit "+e.name);}}function Y(n,t){if(n&1){let e=Qw();Es(0,"agentos-row-delete-action",22),vg("deleteRequested",function(){pf(e);let s=tC().$implicit,c=tC(2);return hf(c.deletion.request(s.id))})("deleteConfirmed",function(){pf(e);let s=tC().$implicit,c=tC(2);return hf(c.confirmDelete(s))})("deleteCancelled",function(){pf(e);let s=tC(3);return hf(s.deletion.cancel())}),hl();}if(n&2){let e=tC().$implicit,i=tC(2);dg("rowKey",e.id)("rowLabel",e.name)("state",i.deletion);}}function z(n,t){if(n&1&&(Es(0,"tr",9)(1,"td",12)(2,"span",13),AC(3),hl(),Bw(4,H,2,1,"span",14),hl(),Es(5,"td",15),AC(6),hl(),Es(7,"td",16)(8,"ds-tag",17),AC(9),hl()(),Es(10,"td",18)(11,"div",19),Bw(12,O,4,2),Bw(13,Y,1,3,"agentos-row-delete-action",20),hl()()()),n&2){let e=t.$implicit,i=tC(2);VE(3),Fg(e.name),VE(),Vw(e.description?4:-1),VE(2),Fg(i.scheduleLabel(e)),VE(2),dg("variant",e.enabled?"accent":"outline"),VE(),Fg(e.enabled?"Enabled":"Disabled"),VE(3),Vw(i.deletion.confirmingId()!==e.id?12:-1),VE(),Vw(e.id?13:-1);}}function G(n,t){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),AC(5,"Name"),hl(),Es(6,"th",10),AC(7,"Schedule"),hl(),Es(8,"th",10),AC(9,"Status"),hl(),Es(10,"th",10)(11,"span",11),AC(12,"Actions"),hl()()()(),Es(13,"tbody",8),$w(14,z,14,7,"tr",9,M),hl()()()),n&2){let e=tC();VE(14),zw(e.rowFilter.filteredRows());}}var A=class n{router=g(F);destroyRef=g(we);state=g(c);prompts=$i([]);isLoading=$i(true);deletion=k();rowFilter=O$1(this.prompts,t=>[t.name,t.description,this.scheduleLabel(t),t.enabled?"Enabled":"Disabled"].filter(Boolean).join(" "));constructor(){this.state.listPlatform().pipe(U$1(this.destroyRef)).subscribe({next:t=>{this.prompts.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}scheduleLabel(t){let{recurrence:e}=t,i=e.unit===ke.WEEK?"week":"month",s=e.unit===ke.WEEK&&e.days?.length?` (${e.days.map(c=>We[c]??c).join(", ")})`:"";return `Every ${i}${s} at ${e.timeUtc} UTC`}openCreateForm(){this.router.navigate(["/agentos","admin","scheduled-prompts","new"]);}edit(t){t.id&&this.router.navigate(["/agentos","admin","scheduled-prompts",t.id,"edit"]);}toggle(t){(t.enabled?this.state.disable(t.id??""):this.state.enable(t.id??"")).pipe(U$1(this.destroyRef)).subscribe(i=>this.patchPrompt(i));}confirmDelete(t){if(!t.id)return;let e=t.id;this.deletion.execute(e,{request$:this.state.delete(e).pipe(U$1(this.destroyRef)),onSuccess:()=>this.prompts.update(i=>i.filter(s=>s.id!==e)),errorMessage:`Deleting "${t.name}" failed. Try again.`});}patchPrompt(t){this.prompts.update(e=>e.map(i=>i.id===t.id?t:i));}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Dw({type:n,selectors:[["agentos-platform-scheduled-prompts"]],decls:9,vars:3,consts:[["title","Platform scheduled prompts","description","Scheduled prompts shared across every namespace."],["label","Filter scheduled prompts","placeholder","Filter scheduled prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform scheduled prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Schedule"],["role","cell","data-label","Status"],[3,"variant"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(e,i){e&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return i.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return i.openCreateForm()}),AC(3,"New scheduled prompt"),hl()(),Bw(4,U,2,1,"p",3),Bw(5,B,2,0,"p",4)(6,j,2,0,"p",5)(7,W,2,0,"p",4)(8,G,16,0,"div",6)),e&2&&(VE(),dg("query",i.rowFilter.query()),VE(3),Vw(i.deletion.error()?4:-1),VE(),Vw(i.isLoading()?5:i.prompts().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,fn,ko,Fo,P,P$1],encapsulation:2})};export{A as PlatformScheduledPromptsComponent};
1
+ import {c}from'./chunk-DvRawlbU.js';import {z as k,j as O$1,e as at,c as fn,k as ko,l as Fo,P,B as P$1}from'./chunk-0rWkqE7F.js';import {g,t as F,K as we,$ as $i,U as U$1,ai as ke,al as We,D as Dw,E as Es,R as vg,c as hl,b as AC,a as Bw,d as VE,P as dg,i as Vw,v as tC,F as Fg,q as $w,z as zw,Q as Qw,w as pf,x as hf,n as lg}from'./main-PZMWRMRC.js';var M=(n,t)=>t.id??t.name;function U(n,t){if(n&1&&(Es(0,"p",3),AC(1),hl()),n&2){let e=tC();VE(),Fg(e.deletion.error());}}function B(n,t){n&1&&(Es(0,"p",4),AC(1,"Loading scheduled prompts\u2026"),hl());}function j(n,t){n&1&&(Es(0,"p",5),AC(1,"No platform scheduled prompts defined yet."),hl());}function W(n,t){n&1&&(Es(0,"p",4),AC(1,"No scheduled prompts match the current filter."),hl());}function H(n,t){if(n&1&&(Es(0,"span",14),AC(1),hl()),n&2){let e=tC().$implicit;VE(),Fg(e.description);}}function O(n,t){if(n&1){let e=Qw();Es(0,"button",21),vg("click",function(){pf(e);let s=tC().$implicit,c=tC(2);return hf(c.toggle(s))}),AC(1),hl(),Es(2,"button",21),vg("click",function(){pf(e);let s=tC().$implicit,c=tC(2);return hf(c.edit(s))}),AC(3,"Edit"),hl();}if(n&2){let e=tC().$implicit;VE(),Fg(e.enabled?"Disable":"Enable"),VE(),lg("aria-label","Edit "+e.name);}}function Y(n,t){if(n&1){let e=Qw();Es(0,"agentos-row-delete-action",22),vg("deleteRequested",function(){pf(e);let s=tC().$implicit,c=tC(2);return hf(c.deletion.request(s.id))})("deleteConfirmed",function(){pf(e);let s=tC().$implicit,c=tC(2);return hf(c.confirmDelete(s))})("deleteCancelled",function(){pf(e);let s=tC(3);return hf(s.deletion.cancel())}),hl();}if(n&2){let e=tC().$implicit,i=tC(2);dg("rowKey",e.id)("rowLabel",e.name)("state",i.deletion);}}function z(n,t){if(n&1&&(Es(0,"tr",9)(1,"td",12)(2,"span",13),AC(3),hl(),Bw(4,H,2,1,"span",14),hl(),Es(5,"td",15),AC(6),hl(),Es(7,"td",16)(8,"ds-tag",17),AC(9),hl()(),Es(10,"td",18)(11,"div",19),Bw(12,O,4,2),Bw(13,Y,1,3,"agentos-row-delete-action",20),hl()()()),n&2){let e=t.$implicit,i=tC(2);VE(3),Fg(e.name),VE(),Vw(e.description?4:-1),VE(2),Fg(i.scheduleLabel(e)),VE(2),dg("variant",e.enabled?"accent":"outline"),VE(),Fg(e.enabled?"Enabled":"Disabled"),VE(3),Vw(i.deletion.confirmingId()!==e.id?12:-1),VE(),Vw(e.id?13:-1);}}function G(n,t){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),AC(5,"Name"),hl(),Es(6,"th",10),AC(7,"Schedule"),hl(),Es(8,"th",10),AC(9,"Status"),hl(),Es(10,"th",10)(11,"span",11),AC(12,"Actions"),hl()()()(),Es(13,"tbody",8),$w(14,z,14,7,"tr",9,M),hl()()()),n&2){let e=tC();VE(14),zw(e.rowFilter.filteredRows());}}var A=class n{router=g(F);destroyRef=g(we);state=g(c);prompts=$i([]);isLoading=$i(true);deletion=k();rowFilter=O$1(this.prompts,t=>[t.name,t.description,this.scheduleLabel(t),t.enabled?"Enabled":"Disabled"].filter(Boolean).join(" "));constructor(){this.state.listPlatform().pipe(U$1(this.destroyRef)).subscribe({next:t=>{this.prompts.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}scheduleLabel(t){let{recurrence:e}=t,i=e.unit===ke.WEEK?"week":"month",s=e.unit===ke.WEEK&&e.days?.length?` (${e.days.map(c=>We[c]??c).join(", ")})`:"";return `Every ${i}${s} at ${e.timeUtc} UTC`}openCreateForm(){this.router.navigate(["/agentos","admin","scheduled-prompts","new"]);}edit(t){t.id&&this.router.navigate(["/agentos","admin","scheduled-prompts",t.id,"edit"]);}toggle(t){(t.enabled?this.state.disable(t.id??""):this.state.enable(t.id??"")).pipe(U$1(this.destroyRef)).subscribe(i=>this.patchPrompt(i));}confirmDelete(t){if(!t.id)return;let e=t.id;this.deletion.execute(e,{request$:this.state.delete(e).pipe(U$1(this.destroyRef)),onSuccess:()=>this.prompts.update(i=>i.filter(s=>s.id!==e)),errorMessage:`Deleting "${t.name}" failed. Try again.`});}patchPrompt(t){this.prompts.update(e=>e.map(i=>i.id===t.id?t:i));}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Dw({type:n,selectors:[["agentos-platform-scheduled-prompts"]],decls:9,vars:3,consts:[["title","Platform scheduled prompts","description","Scheduled prompts shared across every namespace."],["label","Filter scheduled prompts","placeholder","Filter scheduled prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform scheduled prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Schedule"],["role","cell","data-label","Status"],[3,"variant"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(e,i){e&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return i.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return i.openCreateForm()}),AC(3,"New scheduled prompt"),hl()(),Bw(4,U,2,1,"p",3),Bw(5,B,2,0,"p",4)(6,j,2,0,"p",5)(7,W,2,0,"p",4)(8,G,16,0,"div",6)),e&2&&(VE(),dg("query",i.rowFilter.query()),VE(3),Vw(i.deletion.error()?4:-1),VE(),Vw(i.isLoading()?5:i.prompts().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,fn,ko,Fo,P,P$1],encapsulation:2})};export{A as PlatformScheduledPromptsComponent};