@whoz-oss/coday-client 0.0.0-workstream-forge.218 → 0.0.0-workstream-forge.219
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.
- package/browser/chunk-1X8ZDw_H.js +1 -0
- package/browser/{chunk-DyUPwDEV.js → chunk-B3QNuJq1.js} +1 -1
- package/browser/{chunk-TQFfWQ2A.js → chunk-BDdojIym.js} +1 -1
- package/browser/{chunk-CAw1vQcl.js → chunk-BF0rgnCC.js} +1 -1
- package/browser/{chunk-RUkEp-ED.js → chunk-BFX1lFnE.js} +1 -1
- package/browser/{chunk-BCzo9j9W.js → chunk-BHLww9JL.js} +1 -1
- package/browser/{chunk-Cq2-xloX.js → chunk-B_6ssAY5.js} +1 -1
- package/browser/{chunk-BJ563fIz.js → chunk-BoopuCIf.js} +1 -1
- package/browser/{chunk-CXYRkeNj.js → chunk-Btw49QAD.js} +1 -1
- package/browser/{chunk-CCKojbus.js → chunk-Bup68EDE.js} +1 -1
- package/browser/{chunk-fqKIQa08.js → chunk-BuvMHpJY.js} +1 -1
- package/browser/{chunk-CEwpNeBE.js → chunk-By6f_HEs.js} +1 -1
- package/browser/{chunk-qv7FKA2K.js → chunk-C4WQ3FwO.js} +4 -4
- package/browser/{chunk-mEq0rZYG.js → chunk-CBH9UdK-.js} +1 -1
- package/browser/{chunk-o2j8lyJa.js → chunk-CBdxzSbt.js} +1 -1
- package/browser/{chunk-Da7PJEUd.js → chunk-CCEk4l94.js} +1 -1
- package/browser/{chunk-Dkqh13sM.js → chunk-CGCKp92q.js} +1 -1
- package/browser/{chunk-D_OcLa_E.js → chunk-CIpZHS_8.js} +1 -1
- package/browser/{chunk-C83oay5Y.js → chunk-CNsHqmKp.js} +1 -1
- package/browser/{chunk-DPXNVO6U.js → chunk-CPpEY-Wg.js} +1 -1
- package/browser/{chunk-BCXx84GO.js → chunk-CRBr5Zr-.js} +1 -1
- package/browser/{chunk-DOyReEdW.js → chunk-CSSE5nqC.js} +1 -1
- package/browser/{chunk-DQuC5tUb.js → chunk-CXlRgw8a.js} +1 -1
- package/browser/{chunk-jgOJSUqj.js → chunk-C_wAFmSl.js} +1 -1
- package/browser/{chunk-BbMAGadY.js → chunk-CpoFgI-S.js} +1 -1
- package/browser/{chunk--dM4D-oL.js → chunk-CwMVpUi6.js} +1 -1
- package/browser/{chunk-DhUYxBri.js → chunk-DHanERfq.js} +1 -1
- package/browser/{chunk-D7GNFZQA.js → chunk-DJ_aysdT.js} +1 -1
- package/browser/{chunk-B4MBlO_b.js → chunk-DKEPmfQ1.js} +1 -1
- package/browser/{chunk-Cv9CJu7B.js → chunk-DN8msylG.js} +1 -1
- package/browser/{chunk-CN7I1CO9.js → chunk-DT7C7-dr.js} +1 -1
- package/browser/{chunk-CzmNxLJW.js → chunk-DXQ632Xp.js} +1 -1
- package/browser/{chunk-D2r8wuNb.js → chunk-DY9VMqVC.js} +1 -1
- package/browser/{chunk-BMLHuIpc.js → chunk-DYmnvP6h.js} +1 -1
- package/browser/{chunk-j5oQmb_U.js → chunk-DhWAUkBX.js} +1 -1
- package/browser/{chunk-DUteS8z6.js → chunk-DmbOQbMC.js} +1 -1
- package/browser/{chunk-B73pA5E_.js → chunk-Dt3T67Y5.js} +1 -1
- package/browser/{chunk-C1hG8h_Q.js → chunk-DuUsgvnb.js} +1 -1
- package/browser/{chunk-CyeY9oKH.js → chunk-QwmdeOUA.js} +1 -1
- package/browser/{chunk-Cfl9BJZg.js → chunk-YBMiTrwV.js} +1 -1
- package/browser/{chunk-TtebDFw9.js → chunk-ZSk328fF.js} +1 -1
- package/browser/{chunk-Dh6xEoGu.js → chunk-_YxNoFY7.js} +1 -1
- package/browser/{chunk-s6jxPP6f.js → chunk-iEurDA3z.js} +1 -1
- package/browser/{chunk-BYMHlvCD.js → chunk-m0YjSCOw.js} +1 -1
- package/browser/{chunk-DfgNJWb_.js → chunk-mijzc4gr.js} +1 -1
- package/browser/{chunk-CitKRB6u.js → chunk-opQcK-7m.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/{main-A7H5YZCD.js → main-CHNQJIYM.js} +1 -1
- package/package.json +1 -1
- package/browser/chunk-DrlG2odS.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a1 as fa,a2 as da,aa as Tr,aD as $y}from'./main-CHNQJIYM.js';function i(t,o,p){return t.pipe(fa(()=>o().pipe(da(()=>Tr(p)))),$y({bufferSize:1,refCount:true}))}export{i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {z as k$1,O as O$1,g as at,h as hn,I as Io,P,B as P$1}from'./chunk-
|
|
1
|
+
import {z as k$1,O as O$1,g as at,h as hn,I as Io,P,B as P$1}from'./chunk-C4WQ3FwO.js';import {g,F,I as Ie,aq as k,ap as F$1,$ as Cr,U as Ui,a1 as fa,at as wy,G as U$1,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,H as Hw,m as Uw,Z as Zw,r as df,s as ff,v as vl,k as cg}from'./main-CHNQJIYM.js';var K=(o,t)=>t.key;function H(o,t){if(o&1&&(Ds(0,"p",3),NC(1),pl()),o&2){let e=Jw();BE(),Og(e.deletion.error());}}function U(o,t){o&1&&(Ds(0,"p",4),NC(1,"Loading AI models\u2026"),pl());}function z(o,t){o&1&&(Ds(0,"p",5),NC(1,"No platform AI models defined yet."),pl());}function G(o,t){o&1&&(Ds(0,"p",4),NC(1,"No AI models match the current filter."),pl());}function J(o,t){if(o&1){let e=Zw();Ds(0,"button",21),mg("click",function(){df(e);let r=Jw().$implicit,m=Jw(2);return ff(m.edit(r))}),NC(1,"Edit"),pl();}if(o&2){let e=Jw().$implicit;cg("aria-label","Edit "+e.title);}}function O(o,t){if(o&1){let e=Zw();Ds(0,"tr",9)(1,"td",12),NC(2),pl(),Ds(3,"td",13),NC(4),pl(),Ds(5,"td",14),NC(6),pl(),Ds(7,"td",15),NC(8),pl(),Ds(9,"td",16),NC(10),pl(),Ds(11,"td",17)(12,"div",18),Lw(13,J,2,1,"button",19),Ds(14,"agentos-row-delete-action",20),mg("deleteRequested",function(){let r=df(e).$implicit,m=Jw(2);return ff(m.deletion.request(r.key))})("deleteConfirmed",function(){let r=df(e).$implicit,m=Jw(2);return ff(m.confirmDelete(r))})("deleteCancelled",function(){df(e);let r=Jw(2);return ff(r.deletion.cancel())}),pl()()()();}if(o&2){let e=t.$implicit,a=Jw(2);BE(2),Og(e.title),BE(2),Og(e.providerName),BE(2),vl(" ",e.model.apiModelName," "),BE(2),Og(e.model.priority),BE(2),vl(" ",e.model.reasoningEffort?e.model.reasoningEffort.toLowerCase():"\u2014"," "),BE(3),jw(a.deletion.confirmingId()!==e.key?13:-1),BE(),ug("rowKey",e.key)("rowLabel",e.title)("state",a.deletion);}}function Q(o,t){if(o&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"Provider"),pl(),Ds(8,"th",10),NC(9,"API model name"),pl(),Ds(10,"th",10),NC(11,"Priority"),pl(),Ds(12,"th",10),NC(13,"Reasoning effort"),pl(),Ds(14,"th",10)(15,"span",11),NC(16,"Actions"),pl()()()(),Ds(17,"tbody",8),Hw(18,O,15,9,"tr",9,K),pl()()()),o&2){let e=Jw();BE(18),Uw(e.rowFilter.filteredRows());}}var j=class o{router=g(F);destroyRef=g(Ie);aiModelController=g(k);aiProviderController=g(F$1);refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k$1();rows=Ui([]);rowFilter=O$1(this.rows,t=>[t.title,t.model.apiModelName,t.providerName].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),wy([this.aiModelController.listPlatformLevelAiModel(),this.aiProviderController.listAiProvider("none")]))),U$1(this.destroyRef)).subscribe({next:([t,e])=>{let a=new Map(e.map(r=>[r.id??"",r.name]));this.rows.set(t.map((r,m)=>({key:r.id??`model:${m}`,model:r,title:r.alias??r.apiModelName,providerName:a.get(r.aiProviderId)??r.aiProviderId}))),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","ai-models","new"]);}edit(t){t.model.id&&this.router.navigate(["/agentos","admin","ai-models",t.model.id,"edit"]);}confirmDelete(t){t.model.id&&this.deletion.execute(t.key,{request$:this.aiModelController.deleteAiModel(t.model.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${t.title}" failed. Try again.`});}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=yw({type:o,selectors:[["agentos-platform-ai-models"]],decls:9,vars:3,consts:[["title","Platform AI models","description","AI models shared across every namespace."],["label","Filter AI models","placeholder","Filter AI models\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform AI models"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Provider"],["role","cell","data-label","API model name",1,"settings-table__secondary"],["role","cell","data-label","Priority"],["role","cell","data-label","Reasoning effort"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(e,a){e&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return a.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return a.openCreateForm()}),NC(3,"New AI model"),pl()(),Lw(4,H,2,1,"p",3),Lw(5,U,2,0,"p",4)(6,z,2,0,"p",5)(7,G,2,0,"p",4)(8,Q,20,0,"div",6)),e&2&&(BE(),ug("query",a.rowFilter.query()),BE(3),jw(a.deletion.error()?4:-1),BE(),jw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{j as PlatformAiModelsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {O as O$1}from'./chunk-
|
|
1
|
+
import {O as O$1}from'./chunk-DN8msylG.js';import {g,F,I as Ie,af as G$1,$ as Cr,U as Ui,a1 as fa,G as U$1,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,H as Hw,m as Uw,Z as Zw,k as cg,r as df,s as ff}from'./main-CHNQJIYM.js';import {z as k,O as O$2,g as at,h as hn,I as Io,P,B as P$1}from'./chunk-C4WQ3FwO.js';import'./chunk-1X8ZDw_H.js';var j=(t,e)=>e.id??e.name;function A(t,e){if(t&1&&(Ds(0,"p",3),NC(1),pl()),t&2){let n=Jw();BE(),Og(n.deletion.error());}}function K(t,e){t&1&&(Ds(0,"p",4),NC(1,"Loading integrations\u2026"),pl());}function H(t,e){t&1&&(Ds(0,"p",5),NC(1,"No platform integrations defined yet."),pl());}function U(t,e){t&1&&(Ds(0,"p",4),NC(1,"No integrations match the current filter."),pl());}function z(t,e){if(t&1){let n=Zw();Ds(0,"button",18),mg("click",function(){df(n);let d=Jw().$implicit,m=Jw(2);return ff(m.edit(d))}),NC(1,"Edit"),pl();}if(t&2){let n=Jw().$implicit;cg("aria-label","Edit "+n.name);}}function G(t,e){if(t&1){let n=Zw();Ds(0,"agentos-row-delete-action",19),mg("deleteRequested",function(){df(n);let d=Jw().$implicit,m=Jw(2);return ff(m.deletion.request(d.id))})("deleteConfirmed",function(){df(n);let d=Jw().$implicit,m=Jw(2);return ff(m.confirmDelete(d))})("deleteCancelled",function(){df(n);let d=Jw(3);return ff(d.deletion.cancel())}),pl();}if(t&2){let n=Jw().$implicit,r=Jw(2);ug("rowKey",n.id)("rowLabel",n.name)("state",r.deletion);}}function J(t,e){if(t&1&&(Ds(0,"tr",9)(1,"td",12),NC(2),pl(),Ds(3,"td",13),NC(4),pl(),Ds(5,"td",14)(6,"div",15),Lw(7,z,2,1,"button",16),Lw(8,G,1,3,"agentos-row-delete-action",17),pl()()()),t&2){let n=e.$implicit,r=Jw(2);BE(2),Og(n.name),BE(2),Og(n.integrationType),BE(3),jw(r.deletion.confirmingId()!==n.id?7:-1),BE(),jw(n.id?8:-1);}}function O(t,e){if(t&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"Type"),pl(),Ds(8,"th",10)(9,"span",11),NC(10,"Actions"),pl()()()(),Ds(11,"tbody",8),Hw(12,J,9,4,"tr",9,j),pl()()()),t&2){let n=Jw();BE(12),Uw(n.rowFilter.filteredRows());}}var B=class t{router=g(F);destroyRef=g(Ie);state=g(O$1);integrationConfigController=g(G$1);refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k();configs=Ui([]);rowFilter=O$2(this.configs,e=>[e.name,e.integrationType].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.state.loadPlatformConfigs())),U$1(this.destroyRef)).subscribe({next:e=>{this.configs.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","integration-configs","new"]);}edit(e){this.router.navigate(["/agentos","admin","integration-configs",e.id??"","edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.integrationConfigController.deleteIntegrationConfig(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=yw({type:t,selectors:[["agentos-platform-integration-configs"]],decls:9,vars:3,consts:[["title","Platform integrations","description","Integration configurations shared across every namespace."],["label","Filter integrations","placeholder","Filter integrations\u2026",3,"queryChange","query"],["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 integrations"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Type",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(n,r){n&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return r.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return r.openCreateForm()}),NC(3,"New integration"),pl()(),Lw(4,A,2,1,"p",3),Lw(5,K,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,O,14,0,"div",6)),n&2&&(BE(),ug("query",r.rowFilter.query()),BE(3),jw(r.deletion.error()?4:-1),BE(),jw(r.isLoading()?5:r.configs().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{B as PlatformIntegrationConfigsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {S}from'./chunk-
|
|
1
|
+
import {S}from'./chunk-C4WQ3FwO.js';import {y as yw,T as br,D as Ds,N as NC,p as pl,l as lg,P as ug}from'./main-CHNQJIYM.js';var c=class a{groups=[{label:"Access",items:[{label:"Users & Groups",commands:["users"]},{label:"Auth settings",commands:["auth-settings"]}]},{label:"Connections",items:[{label:"Platform integrations",commands:["integration-configs"]}]},{label:"AI",items:[{label:"Platform agents",commands:["agent-configs"]},{label:"Platform AI providers",commands:["ai-providers"]},{label:"Platform AI models",commands:["ai-models"]},{label:"Platform skills",commands:["skills"]},{label:"Platform prompts",commands:["prompts"]}]},{label:"Automation",items:[{label:"Scheduled prompts",commands:["scheduled-prompts"]},{label:"Tool invoke",commands:["tool-invoke"]}]},{label:"System",items:[{label:"Configuration",commands:["configuration"]}]}];static \u0275fac=function(e){return new(e||a)};static \u0275cmp=yw({type:a,selectors:[["agentos-admin-settings-layout"]],decls:9,vars:1,consts:[["title","Admin \xB7 Configuration","mark","A","navigationLabel","Admin settings",3,"groups"],["settingsBreadcrumb","","aria-label","Breadcrumb"],["aria-hidden","true"]],template:function(e,g){e&1&&(Ds(0,"agentos-settings-layout",0)(1,"nav",1)(2,"span"),NC(3,"Platform"),pl(),Ds(4,"span",2),NC(5,"/"),pl(),Ds(6,"span"),NC(7,"Administration"),pl()(),lg(8,"router-outlet"),pl()),e&2&&ug("groups",g.groups);},dependencies:[br,S],styles:["nav[settingsBreadcrumb][_ngcontent-%COMP%]{display:flex;gap:8px;align-items:center}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-accent-700);text-decoration:none}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:2px}"]})};export{c as AdminSettingsLayoutComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {e}from'./chunk-C6dIhkYp.js';import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-
|
|
1
|
+
import {e}from'./chunk-C6dIhkYp.js';import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-CCEk4l94.js';import {O}from'./chunk-DN8msylG.js';import {g,W as W$1,F,I as Ie,E as J,U as Ui,G as U$1,ad as ne$1,a1 as fa,aa as Tr,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,P as ug,a as BE,j as jw,J as Jw,O as Og,H as Hw,m as Uw,v as vl,Z as Zw,k as cg,r as df,s as ff}from'./main-CHNQJIYM.js';import {z as k,O as O$1,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-C4WQ3FwO.js';import'./chunk-1X8ZDw_H.js';var Q=(n,e)=>e.key;function W(n,e){if(n&1&&(Ds(0,"p",3),NC(1),pl()),n&2){let t=Jw();BE(),Og(t.deletion.error());}}function X(n,e){n&1&&(Ds(0,"p",4),NC(1,"Loading integrations\u2026"),pl());}function Z(n,e){n&1&&(Ds(0,"p",5),NC(1,"No integrations available."),pl());}function ee(n,e){n&1&&(Ds(0,"p",4),NC(1,"No integrations match the current filter."),pl());}function te(n,e){n&1&&(Ds(0,"ds-tag",20),NC(1,"YAML"),pl(),Ds(2,"ds-tag",21),NC(3,"Read-only"),pl());}function ne(n,e){if(n&1){let t=Zw();Ds(0,"button",22),mg("click",function(){df(t);let s=Jw().$implicit,c=Jw(2);return ff(c.view(s))}),NC(1,"View"),pl();}if(n&2){let t=Jw().$implicit;cg("aria-label","View "+t.config.name);}}function ie(n,e){if(n&1){let t=Zw();Ds(0,"button",22),mg("click",function(){df(t);let s=Jw(3).$implicit,c=Jw(2);return ff(c.edit(s))}),NC(1," Edit "),pl();}if(n&2){let t=Jw(3).$implicit;cg("aria-label","Edit "+t.config.name);}}function oe(n,e){if(n&1){let t=Zw();Ds(0,"button",22),mg("click",function(){df(t);let s=Jw(2).$implicit,c=Jw(2);return ff(c.duplicate(s))}),NC(1," Duplicate "),pl(),Lw(2,ie,2,1,"button",19);}if(n&2){let t=Jw(2).$implicit;cg("aria-label","Duplicate "+t.config.name),BE(2),jw(t.canEdit?2:-1);}}function ae(n,e){if(n&1){let t=Zw();Ds(0,"agentos-row-delete-action",25),mg("deleteRequested",function(){df(t);let s=Jw(2).$implicit,c=Jw(2);return ff(c.deletion.request(s.key))})("deleteConfirmed",function(){df(t);let s=Jw(2).$implicit,c=Jw(2);return ff(c.confirmDelete(s))})("deleteCancelled",function(){df(t);let s=Jw(4);return ff(s.deletion.cancel())}),pl();}if(n&2){let t=Jw(2).$implicit,a=Jw(2);ug("rowKey",t.key)("rowLabel",t.config.name)("state",a.deletion);}}function re(n,e){n&1&&(Ds(0,"button",24),NC(1,"Inherited"),pl());}function le(n,e){if(n&1&&(Lw(0,oe,3,2),Lw(1,ae,1,3,"agentos-row-delete-action",23),Lw(2,re,2,0,"button",24)),n&2){let t=Jw().$implicit,a=Jw(2);jw(a.deletion.confirmingId()!==t.key?0:-1),BE(),jw(t.canDelete?1:-1),BE(),jw(!t.canEdit&&!t.canDelete?2:-1);}}function se(n,e){if(n&1&&(Ds(0,"tr",9)(1,"td",12),NC(2),pl(),Ds(3,"td",13),NC(4),pl(),Ds(5,"td",14)(6,"div",15)(7,"ds-tag",16),NC(8),pl(),Lw(9,te,4,0),pl()(),Ds(10,"td",17)(11,"div",18),Lw(12,ne,2,1,"button",19)(13,le,3,3),pl()()()),n&2){let t=e.$implicit;BE(2),Og(t.config.name),BE(2),vl(" ",t.config.integrationType," "),BE(3),ug("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),BE(),vl(" ",t.scopeLabel," "),BE(),jw(t.source==="FILESYSTEM"?9:-1),BE(3),jw(t.source==="FILESYSTEM"?12:13);}}function ce(n,e){if(n&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"Type"),pl(),Ds(8,"th",10),NC(9,"Scope"),pl(),Ds(10,"th",10)(11,"span",11),NC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Hw(14,se,14,6,"tr",9,Q),pl()()()),n&2){let t=Jw();BE(14),Uw(t.rowFilter.filteredRows());}}var U=class n$1{route=g(W$1);router=g(F);destroyRef=g(Ie);state=g(O);namespaceRole=g(v);namespaceApi=g(J);namespaceId=this.route.snapshot.params.namespaceId;namespaceName=Ui("this namespace");isAdmin=Ui(false);isLoading=Ui(true);rows=Ui([]);deletion=k();rowFilter=O$1(this.rows,e=>[e.config.name,e.config.integrationType,e.scopeLabel,e.source].join(" "));ngOnInit(){this.state.setNamespace(this.namespaceId),this.namespaceId&&this.namespaceApi.getByIdNamespace(this.namespaceId).pipe(U$1(this.destroyRef)).subscribe({next:e=>this.namespaceName.set(e.name)}),this.route.paramMap.pipe(ne$1(e=>e.get("namespaceId")??""),fa(e=>e?this.namespaceRole.isAdminOfNamespace$(e):Tr(false)),U$1(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.rows.set(this.toRows(e)),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:n(this.isAdmin())}});}view(e){e.config.id&&this.router.navigate(["/agentos",this.namespaceId,"integrations",e.config.id,"view"]);}edit(e){!e.canEdit||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"integrations",e.config.id,"edit"],{queryParams:{scope:e.scope}});}duplicate(e){if(e.source==="FILESYSTEM"||!e.config.id)return;let a=(e.scope==="platform"||e.scope==="namespace")&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:a,template:e.config.id,templateScope:e.scope}});}confirmDelete(e){!e.canDelete||!e.config.id||this.deletion.execute(e.key,{request$:this.state.delete(e.config.id,e.scope).pipe(U$1(this.destroyRef)),errorMessage:`Deleting "${e.config.name}" failed. Try again.`});}toRows(e){return [...this.mapScope(e.platform,"platform","Platform",true),...this.mapScope(e.namespace,"namespace","Namespace",!this.isAdmin()),...this.mapScope(e.userOnNs,"userOnNs","Personal",false),...this.mapScope(e.userGlobal,"userGlobal","Personal",false)]}mapScope(e$1,t,a,s){return e$1.map((c,z)=>{let h=e(c),w=h==="NEO4J"&&!s;return {key:`${t}:${c.id??z}`,config:c,scope:t,scopeLabel:a,source:h,canEdit:w,canDelete:w}})}static \u0275fac=function(t){return new(t||n$1)};static \u0275cmp=yw({type:n$1,selectors:[["agentos-integrations-all-scopes"]],decls:9,vars:4,consts:[["title","Integrations",3,"description"],["label","Filter integrations","placeholder","Filter integrations\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Integrations"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Type",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["variant","neutral"],["variant","outline"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button","disabled",""],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,a){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(c){return a.rowFilter.query.set(c)}),pl(),Ds(2,"button",2),mg("click",function(){return a.openCreateForm()}),NC(3,"New integration"),pl()(),Lw(4,W,2,1,"p",3),Lw(5,X,2,0,"p",4)(6,Z,2,0,"p",5)(7,ee,2,0,"p",4)(8,ce,16,0,"div",6)),t&2&&(ug("description","Integrations for "+a.namespaceName()+", including entries inherited from the platform."),BE(),ug("query",a.rowFilter.query()),BE(3),jw(a.deletion.error()?4:-1),BE(),jw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{U as IntegrationsAllScopesComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-
|
|
1
|
+
import {a}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-CSSE5nqC.js';import {J as s,z as k,O,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-C4WQ3FwO.js';import {g,W,F,I as Ie,$ as Cr,U as Ui,a1 as fa,ac as Ty,a2 as da,aa as Tr,ad as ne$1,G as U,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,H as Hw,m as Uw,v as vl,as as kg,Z as Zw,r as df,s as ff,k as cg}from'./main-CHNQJIYM.js';var Y=(n,e)=>e.key;function Z(n,e){if(n&1&&(Ds(0,"p",3),NC(1),pl()),n&2){let t=Jw();BE(),Og(t.deletion.error());}}function ee(n,e){n&1&&(Ds(0,"p",4),NC(1,"Loading skills\u2026"),pl());}function te(n,e){n&1&&(Ds(0,"p",5),NC(1," No skills defined yet. Add one above, or drop a SKILL.md under the namespace config path. "),pl());}function ne(n,e){n&1&&(Ds(0,"p",4),NC(1,"No skills match the current filter."),pl());}function ie(n,e){if(n&1&&(Ds(0,"span",14),NC(1),pl()),n&2){let t=Jw().$implicit;BE(),kg(" named by ",t.namedByAgents," ",t.namedByAgents===1?"agent":"agents"," ");}}function ae(n,e){n&1&&(Ds(0,"ds-tag",20),NC(1,"Read-only"),pl());}function oe(n,e){n&1&&(Ds(0,"ds-tag",21),NC(1,"SKILL.md"),pl());}function le(n,e){if(n&1){let t=Zw();Ds(0,"button",25),mg("click",function(){df(t);let d=Jw(2).$implicit,c=Jw(2);return ff(c.edit(d))}),NC(1,"Edit"),pl();}if(n&2){let t=Jw(2).$implicit;cg("aria-label","Edit "+t.skill.name);}}function re(n,e){if(n&1){let t=Zw();Ds(0,"button",25),mg("click",function(){df(t);let d=Jw().$implicit,c=Jw(2);return ff(c.inspect(d))}),NC(1," View "),pl(),Lw(2,le,2,1,"button",26);}if(n&2){let t=Jw().$implicit,a=Jw(2);cg("aria-label","View "+t.skill.name),BE(2),jw(a.isMutable(t)?2:-1);}}function se(n,e){if(n&1){let t=Zw();Ds(0,"agentos-row-delete-action",27),mg("deleteRequested",function(){df(t);let d=Jw().$implicit,c=Jw(2);return ff(c.requestDelete(d))})("deleteConfirmed",function(){df(t);let d=Jw().$implicit,c=Jw(2);return ff(c.confirmDelete(d))})("deleteCancelled",function(){df(t);let d=Jw(3);return ff(d.deletion.cancel())}),pl();}if(n&2){let t=Jw().$implicit,a=Jw(2);ug("rowKey",t.key)("rowLabel",t.skill.name)("state",a.deletion);}}function ce(n,e){if(n&1&&(Ds(0,"tr",9)(1,"td",12)(2,"span",13),NC(3),pl(),Lw(4,ie,2,2,"span",14),pl(),Ds(5,"td",15),NC(6),pl(),Ds(7,"td",16),NC(8),pl(),Ds(9,"td",17)(10,"div",18)(11,"ds-tag",19),NC(12),pl(),Lw(13,ae,2,0,"ds-tag",20),Lw(14,oe,2,0,"ds-tag",21),pl()(),Ds(15,"td",22)(16,"div",23),Lw(17,re,3,2),Lw(18,se,1,3,"agentos-row-delete-action",24),pl()()()),n&2){let t=e.$implicit,a=Jw(2);BE(3),Og(t.skill.name),BE(),jw(t.namedByAgents>0?4:-1),BE(2),vl(" ",t.skill.description||"\u2014"," "),BE(2),Og(a.resourceCount(t.skill)),BE(3),ug("variant",t.scope==="platform"?"neutral":"accent"),BE(),Og(t.scope==="platform"?"Platform":"Namespace"),BE(),jw(t.scope==="platform"?13:-1),BE(),jw(t.skill.readOnly?14:-1),BE(3),jw(a.deletion.confirmingId()!==t.key?17:-1),BE(),jw(a.isMutable(t)?18:-1);}}function de(n,e){if(n&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"Description"),pl(),Ds(8,"th",10),NC(9,"Resources"),pl(),Ds(10,"th",10),NC(11,"Scope"),pl(),Ds(12,"th",10)(13,"span",11),NC(14,"Actions"),pl()()()(),Ds(15,"tbody",8),Hw(16,ce,19,10,"tr",9,Y),pl()()()),n&2){let t=Jw();BE(16),Uw(t.rowFilter.filteredRows());}}var Q=class n{route=g(W);router=g(F);destroyRef=g(Ie);skillState=g(o);agentState=g(s);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k();rows=Ui([]);rowFilter=O(this.rows,e=>[e.skill.name,e.skill.description,e.scope].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),Ty({platform:this.skillState.listPlatform().pipe(da(()=>Tr([]))),namespace:this.skillState.listByNamespace(this.namespaceId),agents:Ty({namespace:this.agentState.listByNamespace(this.namespaceId),platform:this.agentState.listPlatform().pipe(da(()=>Tr([])))}).pipe(ne$1(({namespace:e,platform:t})=>[...e,...t]),da(()=>Tr([])))}))),U(this.destroyRef)).subscribe({next:({platform:e,namespace:t,agents:a$1})=>{let d=(c,_,W)=>({key:`${_}:${c.id??W}`,skill:c,scope:_,namedByAgents:a$1.filter(X=>a(X.skillSelectors,c.name)==="named").length});this.rows.set([...e.map((c,_)=>d(c,"platform",_)),...t.map((c,_)=>d(c,"namespace",_))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}resourceCount(e){return Object.keys(e.resources??{}).length}isMutable(e){return e.scope==="namespace"&&e.skill.readOnly!==true&&!!e.skill.id}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"skills","new"]);}inspect(e){e.skill.id&&this.router.navigate(e.scope==="platform"?["/agentos","admin","skills",e.skill.id,"inspect"]:["/agentos",this.namespaceId,"skills",e.skill.id,"inspect"]);}edit(e){!this.isMutable(e)||!e.skill.id||this.router.navigate(["/agentos",this.namespaceId,"skills",e.skill.id,"edit"]);}requestDelete(e){this.deletion.request(e.key);}confirmDelete(e){if(!this.isMutable(e)||!e.skill.id)return;let t=e.namedByAgents;this.deletion.execute(e.key,{request$:this.skillState.delete(e.skill.id).pipe(U(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:a=>a.status===400?`"${e.skill.name}" is defined by a SKILL.md file and cannot be deleted through the API.`:`Deleting "${e.skill.name}" failed.${t>0?` ${t} agent(s) still name it.`:""}`});}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=yw({type:n,selectors:[["agentos-namespace-skills"]],decls:9,vars:3,consts:[["title","Skills","description","Skills available in this namespace, including skills inherited from the platform."],["label","Filter skills","placeholder","Filter skills\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Skills"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Resources"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["variant","neutral"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,a){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(c){return a.rowFilter.query.set(c)}),pl(),Ds(2,"button",2),mg("click",function(){return a.openCreateForm()}),NC(3,"New skill"),pl()(),Lw(4,Z,2,1,"p",3),Lw(5,ee,2,0,"p",4)(6,te,2,0,"p",5)(7,ne,2,0,"p",4)(8,de,18,0,"div",6)),t&2&&(BE(),ug("query",a.rowFilter.query()),BE(3),jw(a.deletion.error()?4:-1),BE(),jw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{Q as NamespaceSkillsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-Da7PJEUd.js';import {I}from'./chunk-CEwpNeBE.js';import {g,W,F,I as Ie,U as Ui,G as U,ad as ne$1,a1 as fa,aa as Tr,aL as ci,a2 as da,ac as Ty,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,u as vC,k as cg,v as vl,H as Hw,m as Uw,Z as Zw,r as df,s as ff}from'./main-A7H5YZCD.js';import {z as k,O,a3 as w,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-qv7FKA2K.js';import'./chunk-DrlG2odS.js';var Q=(i,t)=>t.key;function X(i,t){if(i&1&&(Ds(0,"p",3),NC(1),pl()),i&2){let e=Jw();BE(),Og(e.deletion.error());}}function Z(i,t){if(i&1&&(Ds(0,"p"),NC(1),pl()),i&2){let e=t;vC(e.kind==="error"?"settings-table__error":"settings-table__status"),cg("role",e.kind==="error"?"alert":"status"),BE(),vl(" ",e.text," ");}}function ee(i,t){i&1&&(Ds(0,"p",5),NC(1,"Loading auth settings\u2026"),pl());}function te(i,t){i&1&&(Ds(0,"p",6),NC(1,"No auth settings available."),pl());}function ne(i,t){i&1&&(Ds(0,"p",5),NC(1,"No auth settings match the current filter."),pl());}function ie(i,t){i&1&&(Ds(0,"ds-tag",18),NC(1,"Read-only"),pl());}function oe(i,t){i&1&&(Ds(0,"ds-tag",20),NC(1,"Connected"),pl());}function ae(i,t){i&1&&(Ds(0,"ds-tag",18),NC(1,"Not connected"),pl());}function se(i,t){i&1&&(Ds(0,"span",21),NC(1,"\u2014"),pl());}function re(i,t){if(i&1){let e=Zw();Ds(0,"span",26),NC(1,"Waiting for authorization\u2026"),pl(),Ds(2,"button",27),mg("click",function(){df(e);let r=Jw(4);return ff(r.cancelConnect())}),NC(3," Cancel "),pl();}if(i&2){let e=Jw(2).$implicit;BE(2),cg("aria-label","Stop waiting for the authorization of "+e.config.name);}}function le(i,t){if(i&1){let e=Zw();Ds(0,"span",28),NC(1,"Disconnect?"),pl(),Ds(2,"button",29),mg("click",function(){df(e);let r=Jw(2).$implicit,d=Jw(2);return ff(d.confirmReset(r))}),NC(3),pl(),Ds(4,"button",29),mg("click",function(){df(e);let r=Jw(4);return ff(r.cancelReset())}),NC(5," Cancel "),pl();}if(i&2){let e=Jw(2).$implicit,n=Jw(2);BE(2),ug("disabled",n.resettingKey()===e.key),cg("aria-label","Confirm disconnecting "+e.config.name),BE(),vl(" ",n.resettingKey()===e.key?"Disconnecting\u2026":"Confirm"," "),BE(),ug("disabled",n.resettingKey()===e.key),cg("aria-label","Cancel disconnecting "+e.config.name);}}function ce(i,t){if(i&1){let e=Zw();Ds(0,"button",29),mg("click",function(){df(e);let r=Jw(3).$implicit,d=Jw(2);return ff(d.requestReset(r))}),NC(1," Disconnect "),pl();}if(i&2){let e=Jw(3).$implicit,n=Jw(2);ug("disabled",n.connectingKey()!==null),cg("aria-label","Disconnect "+e.config.name);}}function de(i,t){if(i&1){let e=Zw();Ds(0,"button",29),mg("click",function(){df(e);let r=Jw(2).$implicit,d=Jw(2);return ff(d.connect(r))}),NC(1),pl(),Lw(2,ce,2,2,"button",30);}if(i&2){let e=Jw(2).$implicit,n=Jw(2);ug("disabled",n.connectingKey()!==null||n.resettingKey()!==null),cg("aria-label",(n.connectionOf(e)==="connected"?"Reconnect ":"Connect ")+e.config.name),BE(),vl(" ",n.connectionOf(e)==="connected"?"Reconnect":"Connect"," "),BE(),jw(n.connectionOf(e)==="connected"?2:-1);}}function pe(i,t){if(i&1&&Lw(0,re,4,1)(1,le,6,5)(2,de,3,4),i&2){let e=Jw().$implicit,n=Jw(2);jw(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=Zw();Ds(0,"button",27),mg("click",function(){df(e);let r=Jw().$implicit,d=Jw(2);return ff(d.duplicate(r))}),NC(1," Duplicate "),pl();}if(i&2){let e=Jw().$implicit;cg("aria-label","Duplicate "+e.config.name);}}function _e(i,t){if(i&1){let e=Zw();Ds(0,"button",27),mg("click",function(){df(e);let r=Jw(2).$implicit,d=Jw(2);return ff(d.edit(r))}),NC(1," Edit "),pl();}if(i&2){let e=Jw(2).$implicit;cg("aria-label","Edit "+e.config.name);}}function me(i,t){if(i&1){let e=Zw();Lw(0,_e,2,1,"button",24),Ds(1,"agentos-row-delete-action",31),mg("deleteRequested",function(){df(e);let r=Jw().$implicit,d=Jw(2);return ff(d.deletion.request(r.key))})("deleteConfirmed",function(){df(e);let r=Jw().$implicit,d=Jw(2);return ff(d.confirmDelete(r))})("deleteCancelled",function(){df(e);let r=Jw(3);return ff(r.deletion.cancel())}),pl();}if(i&2){let e=Jw().$implicit,n=Jw(2);jw(n.deletion.confirmingId()!==e.key?0:-1),BE(),ug("rowKey",e.key)("rowLabel",e.config.name)("state",n.deletion);}}function ge(i,t){i&1&&(Ds(0,"button",25),NC(1,"Inherited"),pl());}function he(i,t){if(i&1&&(Ds(0,"tr",10)(1,"td",13),NC(2),pl(),Ds(3,"td",14),NC(4),pl(),Ds(5,"td",15)(6,"div",16)(7,"ds-tag",17),NC(8),pl(),Lw(9,ie,2,0,"ds-tag",18),pl()(),Ds(10,"td",19),Lw(11,oe,2,0,"ds-tag",20)(12,ae,2,0,"ds-tag",18)(13,se,2,0,"span",21),pl(),Ds(14,"td",22)(15,"div",23),Lw(16,pe,3,1),Lw(17,ue,2,1,"button",24),Lw(18,me,2,4)(19,ge,2,0,"button",25),pl()()()),i&2){let e=t.$implicit,n=Jw(2);BE(2),Og(e.config.name),BE(2),vl(" ",e.config.authType," "),BE(3),ug("variant",e.scopeLabel==="Platform"?"neutral":e.scopeLabel==="Personal"?"outline":"accent"),BE(),Og(e.scopeLabel),BE(),jw(e.canMutate?-1:9),BE(2),jw(n.isOAuth(e)&&n.connectionOf(e)==="connected"?11:n.isOAuth(e)&&n.connectionOf(e)==="disconnected"?12:13),BE(5),jw(n.isOAuth(e)?16:-1),BE(),jw(n.deletion.confirmingId()!==e.key&&n.resetConfirmingKey()!==e.key&&n.connectingKey()!==e.key?17:-1),BE(),jw(e.canMutate?18:19);}}function Ce(i,t){if(i&1&&(Ds(0,"div",7)(1,"table",8)(2,"thead",9)(3,"tr",10)(4,"th",11),NC(5,"Name"),pl(),Ds(6,"th",11),NC(7,"Authentication type"),pl(),Ds(8,"th",11),NC(9,"Scope"),pl(),Ds(10,"th",11),NC(11,"Connection"),pl(),Ds(12,"th",11)(13,"span",12),NC(14,"Actions"),pl()()()(),Ds(15,"tbody",9),Hw(16,he,20,9,"tr",10,Q),pl()()()),i&2){let e=Jw();BE(16),Uw(e.rowFilter.filteredRows());}}var fe=new Set(["OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"]),J=class i{route=g(W);router=g(F);destroyRef=g(Ie);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=Ui(false);isLoading=Ui(true);rows=Ui([]);deletion=k();connections=Ui({});connectingKey=Ui(null);resetConfirmingKey=Ui(null);resettingKey=Ui(null);actionMessage=Ui(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")??""),fa(t=>t?this.namespaceRole.isAdminOfNamespace$(t):Tr(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(ci(()=>{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"]),da(()=>Tr([e.key,"unknown"]))));if(t.length===0){this.connections.set({});return}this.connectionsLoad=Ty(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=yw({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&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(d){return n.rowFilter.query.set(d)}),pl(),Ds(2,"button",2),mg("click",function(){return n.openCreateForm()}),NC(3,"New auth setting"),pl()(),Lw(4,X,2,1,"p",3),Lw(5,Z,2,4,"p",4),Lw(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;BE(),ug("query",n.rowFilter.query()),BE(3),jw(n.deletion.error()?4:-1),BE(),jw((r=n.actionMessage())?5:-1,r),BE(),jw(n.isLoading()?6:n.rows().length===0?7:n.rowFilter.filteredRows().length===0?8:9);}},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{J as AuthSettingsAllScopesComponent};
|
|
1
|
+
import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-CCEk4l94.js';import {I}from'./chunk-By6f_HEs.js';import {g,W,F,I as Ie,U as Ui,G as U,ad as ne$1,a1 as fa,aa as Tr,aL as ci,a2 as da,ac as Ty,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,u as vC,k as cg,v as vl,H as Hw,m as Uw,Z as Zw,r as df,s as ff}from'./main-CHNQJIYM.js';import {z as k,O,a3 as w,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-C4WQ3FwO.js';import'./chunk-1X8ZDw_H.js';var Q=(i,t)=>t.key;function X(i,t){if(i&1&&(Ds(0,"p",3),NC(1),pl()),i&2){let e=Jw();BE(),Og(e.deletion.error());}}function Z(i,t){if(i&1&&(Ds(0,"p"),NC(1),pl()),i&2){let e=t;vC(e.kind==="error"?"settings-table__error":"settings-table__status"),cg("role",e.kind==="error"?"alert":"status"),BE(),vl(" ",e.text," ");}}function ee(i,t){i&1&&(Ds(0,"p",5),NC(1,"Loading auth settings\u2026"),pl());}function te(i,t){i&1&&(Ds(0,"p",6),NC(1,"No auth settings available."),pl());}function ne(i,t){i&1&&(Ds(0,"p",5),NC(1,"No auth settings match the current filter."),pl());}function ie(i,t){i&1&&(Ds(0,"ds-tag",18),NC(1,"Read-only"),pl());}function oe(i,t){i&1&&(Ds(0,"ds-tag",20),NC(1,"Connected"),pl());}function ae(i,t){i&1&&(Ds(0,"ds-tag",18),NC(1,"Not connected"),pl());}function se(i,t){i&1&&(Ds(0,"span",21),NC(1,"\u2014"),pl());}function re(i,t){if(i&1){let e=Zw();Ds(0,"span",26),NC(1,"Waiting for authorization\u2026"),pl(),Ds(2,"button",27),mg("click",function(){df(e);let r=Jw(4);return ff(r.cancelConnect())}),NC(3," Cancel "),pl();}if(i&2){let e=Jw(2).$implicit;BE(2),cg("aria-label","Stop waiting for the authorization of "+e.config.name);}}function le(i,t){if(i&1){let e=Zw();Ds(0,"span",28),NC(1,"Disconnect?"),pl(),Ds(2,"button",29),mg("click",function(){df(e);let r=Jw(2).$implicit,d=Jw(2);return ff(d.confirmReset(r))}),NC(3),pl(),Ds(4,"button",29),mg("click",function(){df(e);let r=Jw(4);return ff(r.cancelReset())}),NC(5," Cancel "),pl();}if(i&2){let e=Jw(2).$implicit,n=Jw(2);BE(2),ug("disabled",n.resettingKey()===e.key),cg("aria-label","Confirm disconnecting "+e.config.name),BE(),vl(" ",n.resettingKey()===e.key?"Disconnecting\u2026":"Confirm"," "),BE(),ug("disabled",n.resettingKey()===e.key),cg("aria-label","Cancel disconnecting "+e.config.name);}}function ce(i,t){if(i&1){let e=Zw();Ds(0,"button",29),mg("click",function(){df(e);let r=Jw(3).$implicit,d=Jw(2);return ff(d.requestReset(r))}),NC(1," Disconnect "),pl();}if(i&2){let e=Jw(3).$implicit,n=Jw(2);ug("disabled",n.connectingKey()!==null),cg("aria-label","Disconnect "+e.config.name);}}function de(i,t){if(i&1){let e=Zw();Ds(0,"button",29),mg("click",function(){df(e);let r=Jw(2).$implicit,d=Jw(2);return ff(d.connect(r))}),NC(1),pl(),Lw(2,ce,2,2,"button",30);}if(i&2){let e=Jw(2).$implicit,n=Jw(2);ug("disabled",n.connectingKey()!==null||n.resettingKey()!==null),cg("aria-label",(n.connectionOf(e)==="connected"?"Reconnect ":"Connect ")+e.config.name),BE(),vl(" ",n.connectionOf(e)==="connected"?"Reconnect":"Connect"," "),BE(),jw(n.connectionOf(e)==="connected"?2:-1);}}function pe(i,t){if(i&1&&Lw(0,re,4,1)(1,le,6,5)(2,de,3,4),i&2){let e=Jw().$implicit,n=Jw(2);jw(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=Zw();Ds(0,"button",27),mg("click",function(){df(e);let r=Jw().$implicit,d=Jw(2);return ff(d.duplicate(r))}),NC(1," Duplicate "),pl();}if(i&2){let e=Jw().$implicit;cg("aria-label","Duplicate "+e.config.name);}}function _e(i,t){if(i&1){let e=Zw();Ds(0,"button",27),mg("click",function(){df(e);let r=Jw(2).$implicit,d=Jw(2);return ff(d.edit(r))}),NC(1," Edit "),pl();}if(i&2){let e=Jw(2).$implicit;cg("aria-label","Edit "+e.config.name);}}function me(i,t){if(i&1){let e=Zw();Lw(0,_e,2,1,"button",24),Ds(1,"agentos-row-delete-action",31),mg("deleteRequested",function(){df(e);let r=Jw().$implicit,d=Jw(2);return ff(d.deletion.request(r.key))})("deleteConfirmed",function(){df(e);let r=Jw().$implicit,d=Jw(2);return ff(d.confirmDelete(r))})("deleteCancelled",function(){df(e);let r=Jw(3);return ff(r.deletion.cancel())}),pl();}if(i&2){let e=Jw().$implicit,n=Jw(2);jw(n.deletion.confirmingId()!==e.key?0:-1),BE(),ug("rowKey",e.key)("rowLabel",e.config.name)("state",n.deletion);}}function ge(i,t){i&1&&(Ds(0,"button",25),NC(1,"Inherited"),pl());}function he(i,t){if(i&1&&(Ds(0,"tr",10)(1,"td",13),NC(2),pl(),Ds(3,"td",14),NC(4),pl(),Ds(5,"td",15)(6,"div",16)(7,"ds-tag",17),NC(8),pl(),Lw(9,ie,2,0,"ds-tag",18),pl()(),Ds(10,"td",19),Lw(11,oe,2,0,"ds-tag",20)(12,ae,2,0,"ds-tag",18)(13,se,2,0,"span",21),pl(),Ds(14,"td",22)(15,"div",23),Lw(16,pe,3,1),Lw(17,ue,2,1,"button",24),Lw(18,me,2,4)(19,ge,2,0,"button",25),pl()()()),i&2){let e=t.$implicit,n=Jw(2);BE(2),Og(e.config.name),BE(2),vl(" ",e.config.authType," "),BE(3),ug("variant",e.scopeLabel==="Platform"?"neutral":e.scopeLabel==="Personal"?"outline":"accent"),BE(),Og(e.scopeLabel),BE(),jw(e.canMutate?-1:9),BE(2),jw(n.isOAuth(e)&&n.connectionOf(e)==="connected"?11:n.isOAuth(e)&&n.connectionOf(e)==="disconnected"?12:13),BE(5),jw(n.isOAuth(e)?16:-1),BE(),jw(n.deletion.confirmingId()!==e.key&&n.resetConfirmingKey()!==e.key&&n.connectingKey()!==e.key?17:-1),BE(),jw(e.canMutate?18:19);}}function Ce(i,t){if(i&1&&(Ds(0,"div",7)(1,"table",8)(2,"thead",9)(3,"tr",10)(4,"th",11),NC(5,"Name"),pl(),Ds(6,"th",11),NC(7,"Authentication type"),pl(),Ds(8,"th",11),NC(9,"Scope"),pl(),Ds(10,"th",11),NC(11,"Connection"),pl(),Ds(12,"th",11)(13,"span",12),NC(14,"Actions"),pl()()()(),Ds(15,"tbody",9),Hw(16,he,20,9,"tr",10,Q),pl()()()),i&2){let e=Jw();BE(16),Uw(e.rowFilter.filteredRows());}}var fe=new Set(["OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"]),J=class i{route=g(W);router=g(F);destroyRef=g(Ie);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=Ui(false);isLoading=Ui(true);rows=Ui([]);deletion=k();connections=Ui({});connectingKey=Ui(null);resetConfirmingKey=Ui(null);resettingKey=Ui(null);actionMessage=Ui(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")??""),fa(t=>t?this.namespaceRole.isAdminOfNamespace$(t):Tr(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(ci(()=>{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"]),da(()=>Tr([e.key,"unknown"]))));if(t.length===0){this.connections.set({});return}this.connectionsLoad=Ty(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=yw({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&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(d){return n.rowFilter.query.set(d)}),pl(),Ds(2,"button",2),mg("click",function(){return n.openCreateForm()}),NC(3,"New auth setting"),pl()(),Lw(4,X,2,1,"p",3),Lw(5,Z,2,4,"p",4),Lw(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;BE(),ug("query",n.rowFilter.query()),BE(3),jw(n.deletion.error()?4:-1),BE(),jw((r=n.actionMessage())?5:-1,r),BE(),jw(n.isLoading()?6:n.rows().length===0?7:n.rowFilter.filteredRows().length===0?8:9);}},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{J as AuthSettingsAllScopesComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {c}from'./chunk-D_OcLa_E.js';import {p as pt,T as Te$1,a as fn,U as Ut,n as nd,l as bo,x as xo,L as Lt,k as kn,u as vn,G as Gt,m as mo,b as po,$ as $r,V as Vn,A as An,c as pn,h as hn,d as cn,r as ln,e as dn,C as mn,g as at,i as an,t as rn}from'./chunk-qv7FKA2K.js';import {g,W,F,I as Ie$1,ag as U,ah as ke$1,ai as Ne$1,U as Ui,aj as Fe$1,a9 as F$1,ak as md,X as XC,ac as Ty,G as U$1,a2 as da,aa as Tr,M as x,K as w,y as yw,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,v as vl,j as jw,Z as Zw,l as lg,_ as _I,H as Hw,J as Jw,R as NI,m as Uw,O as Og,r as df,s as ff,t as oh}from'./main-A7H5YZCD.js';var V=(n,t)=>t.value,ve=(n,t)=>t.id;function be(n,t){n&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function _e(n,t){if(n&1&&(Ds(0,"ds-form-field",9),lg(1,"input",38),pl()),n&2){let e=Jw(2);BE(),ug("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function Se(n,t){if(n&1&&(Ds(0,"a",39),NC(1,"Add an agent config"),pl(),NC(2," first. ")),n&2){let e=Jw(3);ug("href","/agentos/"+e.namespaceId+"/agent-configs/new",oh);}}function xe(n,t){if(n&1&&(Ds(0,"ds-form-field",10)(1,"p",2),NC(2," No agent configs available in this scope yet. "),Lw(3,Se,3,1),pl()()),n&2){let e=Jw(2);BE(3),jw(e.isPlatformMode?-1:3);}}function Ee(n,t){if(n&1&&(Ds(0,"option",17),NC(1),pl()),n&2){let e=t.$implicit;ug("value",e.id),BE(),Og(e.name);}}function De(n,t){if(n&1&&(Ds(0,"ds-form-field",11)(1,"select",40)(2,"option",41),NC(3,"Select an agent config\u2026"),pl(),Hw(4,Ee,2,2,"option",17,ve),pl(),_I(),pl()),n&2){let e=Jw(2);ug("error",e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?"Agent Config is required.":null),BE(),ug("formControl",e.agentConfigIdControl),NI(),BE(3),Uw(e.availableAgentConfigs());}}function Te(n,t){if(n&1&&(Ds(0,"option",17),NC(1),pl()),n&2){let e=t.$implicit;ug("value",e.value),BE(),Og(e.label);}}function Ne(n,t){if(n&1){let e=Zw();Ds(0,"label",31)(1,"input",43),mg("change",function(){let f=df(e).$implicit,h=Jw(3);return ff(h.toggleDay(f.value))}),pl(),NC(2),pl();}if(n&2){let e=t.$implicit,l=Jw(3);BE(),ug("checked",l.isDaySelected(e.value)),BE(),vl(" ",e.label," ");}}function Ie(n,t){if(n&1&&(Ds(0,"ds-form-field",18)(1,"div",42),Hw(2,Ne,3,2,"label",31,V),pl()()),n&2){let e=Jw(2);BE(2),Uw(e.dayOptions);}}function Me(n,t){if(n&1&&(Ds(0,"option",17),NC(1),pl()),n&2){let e=t.$implicit;ug("value",e.value),BE(),Og(e.label);}}function Pe(n,t){if(n&1&&(Ds(0,"ds-form-field",28),lg(1,"input",44),_I(),pl()),n&2){let e=Jw(2);ug("error",e.form.hasError("endDateRequired")&&e.endDateControl.touched?"End date is required.":null),BE(),ug("formControl",e.endDateControl),NI();}}function we(n,t){if(n&1&&(Ds(0,"ds-form-field",29),lg(1,"input",45),_I(),pl()),n&2){let e=Jw(2);ug("error",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?"Must be at least 1.":null),BE(),ug("formControl",e.occurrenceCountControl),NI();}}function Fe(n,t){if(n&1&&(Ds(0,"ds-notice"),NC(1),pl()),n&2){let e=Jw(2);BE(),Og(e.errorMessage());}}function Oe(n,t){if(n&1){let e=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let f=Jw();return ff(f.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),_I(),pl(),Ds(3,"ds-form-field",7),lg(4,"input",8),_I(),pl(),Lw(5,_e,2,1,"ds-form-field",9)(6,xe,4,1,"ds-form-field",10)(7,De,6,2,"ds-form-field",11),Ds(8,"ds-form-field",12),lg(9,"textarea",13),_I(),pl(),Ds(10,"ds-fieldset",14)(11,"ds-form-field",15)(12,"select",16),Hw(13,Te,2,2,"option",17,V),pl(),_I(),pl(),Lw(15,Ie,4,0,"ds-form-field",18),Ds(16,"ds-form-field",19)(17,"div",20),lg(18,"input",21),_I(),Ds(19,"span",22),NC(20,"UTC"),pl()()()(),Ds(21,"ds-fieldset",23)(22,"ds-form-field",24),lg(23,"input",25),_I(),pl(),Ds(24,"ds-form-field",26)(25,"select",27),Hw(26,Me,2,2,"option",17,V),pl(),_I(),pl(),Lw(28,Pe,2,2,"ds-form-field",28),Lw(29,we,2,2,"ds-form-field",29),pl(),Ds(30,"div",30)(31,"label",31),lg(32,"input",32),_I(),NC(33," Enabled "),pl(),Ds(34,"p",33),NC(35,"When disabled, the scheduled prompt is saved but will not run on schedule."),pl()(),Ds(36,"ds-form-field",34),lg(37,"textarea",35),_I(),pl(),Lw(38,Fe,2,1,"ds-notice"),Ds(39,"ds-form-actions")(40,"button",36),NC(41),pl(),Ds(42,"button",37),mg("click",function(){df(e);let f=Jw();return ff(f.cancel())}),NC(43,"Cancel"),pl()()();}if(n&2){let e=Jw();ug("formGroup",e.form),BE(),ug("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),BE(),ug("formControl",e.nameControl),NI(),BE(2),ug("formControl",e.descriptionControl),NI(),BE(),jw(e.isEditMode()?5:e.availableAgentConfigs().length===0?6:7),BE(3),ug("error",e.promptContentControl.invalid&&e.promptContentControl.touched?"Opening message is required.":null),BE(),ug("formControl",e.promptContentControl),NI(),BE(3),ug("formControl",e.unitControl),NI(),BE(),Uw(e.schedulerUnits),BE(2),jw(e.showDayFilter()?15:-1),BE(),ug("error",e.timeUtcControl.invalid&&e.timeUtcControl.touched?"Valid time is required (HH:mm).":null),BE(2),ug("formControl",e.timeUtcControl),NI(),BE(4),ug("error",e.startDateControl.invalid&&e.startDateControl.touched?"Start date is required.":null),BE(),ug("formControl",e.startDateControl),NI(),BE(2),ug("formControl",e.endTypeControl),NI(),BE(),Uw(e.endTypes),BE(2),jw(e.showEndDate()?28:-1),BE(),jw(e.showOccurrenceCount()?29:-1),BE(3),ug("formControl",e.enabledControl),NI(),BE(4),ug("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),BE(),ug("formControl",e.externalMetadataJsonControl),NI(),BE(),jw(e.errorMessage()?38:-1),BE(2),ug("disabled",e.form.invalid||e.isSubmitting()),BE(),vl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var ye=class n{route=g(W);router=g(F);destroyRef=g(Ie$1);state=g(c);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te$1("",{nonNullable:true,validators:[fn.required]}),description:new Te$1(null),agentConfigId:new Te$1("",{nonNullable:true,validators:[fn.required]}),promptContent:new Te$1("",{nonNullable:true,validators:[fn.required]}),unit:new Te$1(Ne$1.WEEK,{nonNullable:true,validators:[fn.required]}),days:new Te$1([],{nonNullable:true}),timeUtc:new Te$1("09:00",{nonNullable:true,validators:[fn.required,fn.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new Te$1("",{nonNullable:true,validators:[fn.required]}),endType:new Te$1(ke$1.NEVER,{nonNullable:true,validators:[fn.required]}),endDate:new Te$1(null),occurrenceCount:new Te$1(null),enabled:new Te$1(true,{nonNullable:true}),externalMetadataJson:new Te$1("",{nonNullable:true,validators:[ke]})},{validators:[Ae,Ve]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);errorMessage=Ui(null);SchedulerUnit=Ne$1;SchedulerEndType=ke$1;schedulerUnits=[{value:Ne$1.WEEK,label:"Week(s)"},{value:Ne$1.MONTH,label:"Month(s)"}];endTypes=[{value:ke$1.NEVER,label:"Never"},{value:ke$1.ON_DATE,label:"On date"},{value:ke$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(Fe$1).map(([t,e])=>({value:t,label:e}));unitSignal=F$1(this.unitControl.valueChanges.pipe(md(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(md(this.endTypeControl.value)));showDayFilter=XC(()=>this.unitSignal()===Ne$1.WEEK);showEndDate=XC(()=>this.endTypeSignal()===ke$1.ON_DATE);showOccurrenceCount=XC(()=>this.endTypeSignal()===ke$1.OCCURRENCES);agentConfigs=Ui([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Re());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),Ty({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U$1(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U$1(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(da(()=>Tr([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,l=e.includes(t)?e.filter(f=>f!==t):[...e,t];this.daysControl.setValue(l);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===ke$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===ke$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let h=this.externalMetadataJsonControl.value.trim();return h?JSON.parse(h):null})()});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:h=>{this.isSubmitting.set(false),h.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):h.status===400?this.errorMessage.set(h.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=yw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to scheduled prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","sp-name","required","","hint",'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.',3,"error"],["dsControl","","id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",3,"formControl"],["label","Description","controlId","sp-description"],["dsControl","","id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",3,"formControl"],["label","Agent Config","required","","hint","Agent Config cannot be changed after creation."],["label","Agent Config","required",""],["label","Agent Config","controlId","sp-agent-config","required","","hint","Immutable after creation.",3,"error"],["label","Opening message","controlId","sp-prompt-content","required","","hint","The message sent to the agent when the scheduled prompt fires.",3,"error"],["dsControl","","id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",3,"formControl"],["legend","Recurrence"],["label","Unit","controlId","sp-unit","required",""],["dsControl","","id","sp-unit",3,"formControl"],[3,"value"],["label","Days of week","hint","Leave empty to run every day of the week."],["label","Time (UTC)","controlId","sp-time","required","",3,"error"],[1,"ds-inline"],["dsControl","","id","sp-time","type","time",3,"formControl"],[1,"ds-meta"],["legend","Planning"],["label","Start date","controlId","sp-start-date","required","",3,"error"],["dsControl","","id","sp-start-date","type","date",3,"formControl"],["label","Ends","controlId","sp-end-type","required",""],["dsControl","","id","sp-end-type",3,"formControl"],["label","End date","controlId","sp-end-date","required","",3,"error"],["label","Number of occurrences","controlId","sp-occurrence-count","required","",3,"error"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","External Metadata","controlId","sp-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsControl","","type","text","readonly","",3,"value"],[3,"href"],["dsControl","","id","sp-agent-config",3,"formControl"],["value","","disabled",""],[1,"ds-inline","ds-inline--wrap"],["type","checkbox",3,"change","checked"],["dsControl","","id","sp-end-date","type","date",3,"formControl"],["dsControl","","id","sp-occurrence-count","type","number","min","1",1,"ds-control--narrow",3,"formControl"]],template:function(e,l){e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return l.cancel()}),NC(3),pl()(),Lw(4,be,2,0,"p",2)(5,Oe,44,22,"form",3),pl()),e&2&&(BE(),ug("title",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"),BE(2),vl(" \u2190 ",l.isPlatformMode?"Platform scheduled prompts":"Scheduled prompts"," "),BE(),jw(l.isLoading()?4:5));},dependencies:[Ut,nd,bo,xo,Lt,kn,vn,Gt,mo,po,$r,Vn,An,pn,hn,cn,ln,dn,mn,at,an,rn],encapsulation:2})};function Ae(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===ke$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===ke$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function ke(n){let t=n.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}function Re(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${l}`}export{ye as ScheduledPromptFormComponent};
|
|
1
|
+
import {c}from'./chunk-CIpZHS_8.js';import {p as pt,T as Te$1,a as fn,U as Ut,n as nd,l as bo,x as xo,L as Lt,k as kn,u as vn,G as Gt,m as mo,b as po,$ as $r,V as Vn,A as An,c as pn,h as hn,d as cn,r as ln,e as dn,C as mn,g as at,i as an,t as rn}from'./chunk-C4WQ3FwO.js';import {g,W,F,I as Ie$1,ag as U,ah as ke$1,ai as Ne$1,U as Ui,aj as Fe$1,a9 as F$1,ak as md,X as XC,ac as Ty,G as U$1,a2 as da,aa as Tr,M as x,K as w,y as yw,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,v as vl,j as jw,Z as Zw,l as lg,_ as _I,H as Hw,J as Jw,R as NI,m as Uw,O as Og,r as df,s as ff,t as oh}from'./main-CHNQJIYM.js';var V=(n,t)=>t.value,ve=(n,t)=>t.id;function be(n,t){n&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function _e(n,t){if(n&1&&(Ds(0,"ds-form-field",9),lg(1,"input",38),pl()),n&2){let e=Jw(2);BE(),ug("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function Se(n,t){if(n&1&&(Ds(0,"a",39),NC(1,"Add an agent config"),pl(),NC(2," first. ")),n&2){let e=Jw(3);ug("href","/agentos/"+e.namespaceId+"/agent-configs/new",oh);}}function xe(n,t){if(n&1&&(Ds(0,"ds-form-field",10)(1,"p",2),NC(2," No agent configs available in this scope yet. "),Lw(3,Se,3,1),pl()()),n&2){let e=Jw(2);BE(3),jw(e.isPlatformMode?-1:3);}}function Ee(n,t){if(n&1&&(Ds(0,"option",17),NC(1),pl()),n&2){let e=t.$implicit;ug("value",e.id),BE(),Og(e.name);}}function De(n,t){if(n&1&&(Ds(0,"ds-form-field",11)(1,"select",40)(2,"option",41),NC(3,"Select an agent config\u2026"),pl(),Hw(4,Ee,2,2,"option",17,ve),pl(),_I(),pl()),n&2){let e=Jw(2);ug("error",e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?"Agent Config is required.":null),BE(),ug("formControl",e.agentConfigIdControl),NI(),BE(3),Uw(e.availableAgentConfigs());}}function Te(n,t){if(n&1&&(Ds(0,"option",17),NC(1),pl()),n&2){let e=t.$implicit;ug("value",e.value),BE(),Og(e.label);}}function Ne(n,t){if(n&1){let e=Zw();Ds(0,"label",31)(1,"input",43),mg("change",function(){let f=df(e).$implicit,h=Jw(3);return ff(h.toggleDay(f.value))}),pl(),NC(2),pl();}if(n&2){let e=t.$implicit,l=Jw(3);BE(),ug("checked",l.isDaySelected(e.value)),BE(),vl(" ",e.label," ");}}function Ie(n,t){if(n&1&&(Ds(0,"ds-form-field",18)(1,"div",42),Hw(2,Ne,3,2,"label",31,V),pl()()),n&2){let e=Jw(2);BE(2),Uw(e.dayOptions);}}function Me(n,t){if(n&1&&(Ds(0,"option",17),NC(1),pl()),n&2){let e=t.$implicit;ug("value",e.value),BE(),Og(e.label);}}function Pe(n,t){if(n&1&&(Ds(0,"ds-form-field",28),lg(1,"input",44),_I(),pl()),n&2){let e=Jw(2);ug("error",e.form.hasError("endDateRequired")&&e.endDateControl.touched?"End date is required.":null),BE(),ug("formControl",e.endDateControl),NI();}}function we(n,t){if(n&1&&(Ds(0,"ds-form-field",29),lg(1,"input",45),_I(),pl()),n&2){let e=Jw(2);ug("error",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?"Must be at least 1.":null),BE(),ug("formControl",e.occurrenceCountControl),NI();}}function Fe(n,t){if(n&1&&(Ds(0,"ds-notice"),NC(1),pl()),n&2){let e=Jw(2);BE(),Og(e.errorMessage());}}function Oe(n,t){if(n&1){let e=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let f=Jw();return ff(f.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),_I(),pl(),Ds(3,"ds-form-field",7),lg(4,"input",8),_I(),pl(),Lw(5,_e,2,1,"ds-form-field",9)(6,xe,4,1,"ds-form-field",10)(7,De,6,2,"ds-form-field",11),Ds(8,"ds-form-field",12),lg(9,"textarea",13),_I(),pl(),Ds(10,"ds-fieldset",14)(11,"ds-form-field",15)(12,"select",16),Hw(13,Te,2,2,"option",17,V),pl(),_I(),pl(),Lw(15,Ie,4,0,"ds-form-field",18),Ds(16,"ds-form-field",19)(17,"div",20),lg(18,"input",21),_I(),Ds(19,"span",22),NC(20,"UTC"),pl()()()(),Ds(21,"ds-fieldset",23)(22,"ds-form-field",24),lg(23,"input",25),_I(),pl(),Ds(24,"ds-form-field",26)(25,"select",27),Hw(26,Me,2,2,"option",17,V),pl(),_I(),pl(),Lw(28,Pe,2,2,"ds-form-field",28),Lw(29,we,2,2,"ds-form-field",29),pl(),Ds(30,"div",30)(31,"label",31),lg(32,"input",32),_I(),NC(33," Enabled "),pl(),Ds(34,"p",33),NC(35,"When disabled, the scheduled prompt is saved but will not run on schedule."),pl()(),Ds(36,"ds-form-field",34),lg(37,"textarea",35),_I(),pl(),Lw(38,Fe,2,1,"ds-notice"),Ds(39,"ds-form-actions")(40,"button",36),NC(41),pl(),Ds(42,"button",37),mg("click",function(){df(e);let f=Jw();return ff(f.cancel())}),NC(43,"Cancel"),pl()()();}if(n&2){let e=Jw();ug("formGroup",e.form),BE(),ug("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),BE(),ug("formControl",e.nameControl),NI(),BE(2),ug("formControl",e.descriptionControl),NI(),BE(),jw(e.isEditMode()?5:e.availableAgentConfigs().length===0?6:7),BE(3),ug("error",e.promptContentControl.invalid&&e.promptContentControl.touched?"Opening message is required.":null),BE(),ug("formControl",e.promptContentControl),NI(),BE(3),ug("formControl",e.unitControl),NI(),BE(),Uw(e.schedulerUnits),BE(2),jw(e.showDayFilter()?15:-1),BE(),ug("error",e.timeUtcControl.invalid&&e.timeUtcControl.touched?"Valid time is required (HH:mm).":null),BE(2),ug("formControl",e.timeUtcControl),NI(),BE(4),ug("error",e.startDateControl.invalid&&e.startDateControl.touched?"Start date is required.":null),BE(),ug("formControl",e.startDateControl),NI(),BE(2),ug("formControl",e.endTypeControl),NI(),BE(),Uw(e.endTypes),BE(2),jw(e.showEndDate()?28:-1),BE(),jw(e.showOccurrenceCount()?29:-1),BE(3),ug("formControl",e.enabledControl),NI(),BE(4),ug("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),BE(),ug("formControl",e.externalMetadataJsonControl),NI(),BE(),jw(e.errorMessage()?38:-1),BE(2),ug("disabled",e.form.invalid||e.isSubmitting()),BE(),vl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var ye=class n{route=g(W);router=g(F);destroyRef=g(Ie$1);state=g(c);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te$1("",{nonNullable:true,validators:[fn.required]}),description:new Te$1(null),agentConfigId:new Te$1("",{nonNullable:true,validators:[fn.required]}),promptContent:new Te$1("",{nonNullable:true,validators:[fn.required]}),unit:new Te$1(Ne$1.WEEK,{nonNullable:true,validators:[fn.required]}),days:new Te$1([],{nonNullable:true}),timeUtc:new Te$1("09:00",{nonNullable:true,validators:[fn.required,fn.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new Te$1("",{nonNullable:true,validators:[fn.required]}),endType:new Te$1(ke$1.NEVER,{nonNullable:true,validators:[fn.required]}),endDate:new Te$1(null),occurrenceCount:new Te$1(null),enabled:new Te$1(true,{nonNullable:true}),externalMetadataJson:new Te$1("",{nonNullable:true,validators:[ke]})},{validators:[Ae,Ve]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);errorMessage=Ui(null);SchedulerUnit=Ne$1;SchedulerEndType=ke$1;schedulerUnits=[{value:Ne$1.WEEK,label:"Week(s)"},{value:Ne$1.MONTH,label:"Month(s)"}];endTypes=[{value:ke$1.NEVER,label:"Never"},{value:ke$1.ON_DATE,label:"On date"},{value:ke$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(Fe$1).map(([t,e])=>({value:t,label:e}));unitSignal=F$1(this.unitControl.valueChanges.pipe(md(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(md(this.endTypeControl.value)));showDayFilter=XC(()=>this.unitSignal()===Ne$1.WEEK);showEndDate=XC(()=>this.endTypeSignal()===ke$1.ON_DATE);showOccurrenceCount=XC(()=>this.endTypeSignal()===ke$1.OCCURRENCES);agentConfigs=Ui([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Re());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),Ty({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U$1(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U$1(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(da(()=>Tr([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,l=e.includes(t)?e.filter(f=>f!==t):[...e,t];this.daysControl.setValue(l);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===ke$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===ke$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let h=this.externalMetadataJsonControl.value.trim();return h?JSON.parse(h):null})()});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:h=>{this.isSubmitting.set(false),h.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):h.status===400?this.errorMessage.set(h.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=yw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to scheduled prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","sp-name","required","","hint",'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.',3,"error"],["dsControl","","id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",3,"formControl"],["label","Description","controlId","sp-description"],["dsControl","","id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",3,"formControl"],["label","Agent Config","required","","hint","Agent Config cannot be changed after creation."],["label","Agent Config","required",""],["label","Agent Config","controlId","sp-agent-config","required","","hint","Immutable after creation.",3,"error"],["label","Opening message","controlId","sp-prompt-content","required","","hint","The message sent to the agent when the scheduled prompt fires.",3,"error"],["dsControl","","id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",3,"formControl"],["legend","Recurrence"],["label","Unit","controlId","sp-unit","required",""],["dsControl","","id","sp-unit",3,"formControl"],[3,"value"],["label","Days of week","hint","Leave empty to run every day of the week."],["label","Time (UTC)","controlId","sp-time","required","",3,"error"],[1,"ds-inline"],["dsControl","","id","sp-time","type","time",3,"formControl"],[1,"ds-meta"],["legend","Planning"],["label","Start date","controlId","sp-start-date","required","",3,"error"],["dsControl","","id","sp-start-date","type","date",3,"formControl"],["label","Ends","controlId","sp-end-type","required",""],["dsControl","","id","sp-end-type",3,"formControl"],["label","End date","controlId","sp-end-date","required","",3,"error"],["label","Number of occurrences","controlId","sp-occurrence-count","required","",3,"error"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","External Metadata","controlId","sp-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsControl","","type","text","readonly","",3,"value"],[3,"href"],["dsControl","","id","sp-agent-config",3,"formControl"],["value","","disabled",""],[1,"ds-inline","ds-inline--wrap"],["type","checkbox",3,"change","checked"],["dsControl","","id","sp-end-date","type","date",3,"formControl"],["dsControl","","id","sp-occurrence-count","type","number","min","1",1,"ds-control--narrow",3,"formControl"]],template:function(e,l){e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return l.cancel()}),NC(3),pl()(),Lw(4,be,2,0,"p",2)(5,Oe,44,22,"form",3),pl()),e&2&&(BE(),ug("title",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"),BE(2),vl(" \u2190 ",l.isPlatformMode?"Platform scheduled prompts":"Scheduled prompts"," "),BE(),jw(l.isLoading()?4:5));},dependencies:[Ut,nd,bo,xo,Lt,kn,vn,Gt,mo,po,$r,Vn,An,pn,hn,cn,ln,dn,mn,at,an,rn],encapsulation:2})};function Ae(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===ke$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===ke$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function ke(n){let t=n.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}function Re(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${l}`}export{ye as ScheduledPromptFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {f,a4 as id,n as nd,L as Lt,m as mo,b as po,a5 as so,a6 as da,a7 as ra,c as pn,h as hn,d as cn,C as mn,g as at,i as an,I as Io,a8 as f$1}from'./chunk-
|
|
1
|
+
import {f,a4 as id,n as nd,L as Lt,m as mo,b as po,a5 as so,a6 as da,a7 as ra,c as pn,h as hn,d as cn,C as mn,g as at,i as an,I as Io,a8 as f$1}from'./chunk-C4WQ3FwO.js';import {g,W,aM as Y,U as Ui,ab as le,q as Af,y as yw,aN as hb,D as Ds,l as lg,L as Lw,p as pl,a as BE,j as jw,ak as md,a1 as fa,a3 as nn,ac as Ty,a2 as da$1,N as NC,Z as Zw,Q as mg,aO as Bg,_ as _I,J as Jw,aP as jg,R as NI,H as Hw,m as Uw,aQ as $C,aR as UC,O as Og,k as cg,av as zC,aw as WC,as as kg,v as vl,aS as qC,r as df,s as ff,aT as FC}from'./main-CHNQJIYM.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&&(Ds(0,"p",2),NC(1,"Loading usage settings\u2026"),pl());}function fe(e,a){if(e&1){let t=Zw();Ds(0,"ds-notice"),NC(1,"Could not load usage settings. Please try again."),pl(),Ds(2,"div")(3,"button",3),mg("click",function(){df(t);let s=Jw();return ff(s.configuration.retry())}),NC(4,"Retry usage settings"),pl()();}}function ye(e,a){e&1&&(Ds(0,"p",2),NC(1,"Usage tracking is disabled."),pl());}function be(e,a){e&1&&(Ds(0,"ds-notice"),NC(1),pl()),e&2&&(BE(),Og(a));}function xe(e,a){e&1&&(Ds(0,"p",2),NC(1,"Loading usage\u2026"),pl());}function he(e,a){e&1&&(Ds(0,"p",12),NC(1,"No recorded usage for this period."),pl());}function Se(e,a){if(e&1&&(Ds(0,"p",10),NC(1),pl()),e&2){let t=Jw().$implicit;BE(),vl("",t.aggregate.unknownCostCount," record(s) with unknown cost");}}function we(e,a){if(e&1&&(Ds(0,"tr",16)(1,"td",18),NC(2),pl(),Ds(3,"td",19),NC(4),zC(5,"number"),pl(),Ds(6,"td",20),NC(7),zC(8,"number"),zC(9,"number"),pl(),Ds(10,"td",21),NC(11),zC(12,"number"),zC(13,"number"),pl(),Ds(14,"td",22),NC(15),zC(16,"agentosCost"),Lw(17,Se,2,1,"p",10),pl()()),e&2){let t=a.$implicit;BE(2),Og(t.key),BE(2),Og(WC(5,8,t.aggregate.totalTokens)),BE(3),kg(" ",WC(8,10,t.aggregate.inputTokens)," / ",WC(9,12,t.aggregate.outputTokens)," "),BE(4),kg(" ",WC(12,14,t.aggregate.cacheReadTokens)," / ",WC(13,16,t.aggregate.cacheWriteTokens)," "),BE(4),vl(" ",qC(16,18,t.aggregate.cost,t.aggregate.unknownCostCount)," "),BE(2),jw(t.aggregate.unknownCostCount>0?17:-1);}}function ve(e,a){if(e&1&&(Ds(0,"div",13)(1,"table",14)(2,"thead",15)(3,"tr",16)(4,"th",17),NC(5,"Name"),pl(),Ds(6,"th",17),NC(7,"Tokens"),pl(),Ds(8,"th",17),NC(9,"Input / output"),pl(),Ds(10,"th",17),NC(11,"Cache read / write"),pl(),Ds(12,"th",17),NC(13,"Estimated cost"),pl()()(),Ds(14,"tbody",15),Hw(15,we,18,21,"tr",16,_e),pl()()()),e&2){let t=Jw().$implicit;BE(),cg("aria-label","Usage "+t.title.toLowerCase()),BE(14),Uw(t.rows);}}function Ne(e,a){if(e&1&&(Ds(0,"h3",11),NC(1),pl(),Lw(2,he,2,0,"p",12)(3,ve,17,1,"div",13)),e&2){let t=a.$implicit;BE(),Og(t.title),BE(),jw(t.rows.length===0?2:3);}}function Te(e,a){if(e&1&&(Hw(0,Ne,4,2,null,null,ue),Ds(2,"p",10),NC(3," Unpriced usage is kept separate from known costs. Active agent runs appear here after they finish. "),pl()),e&2){let t=Jw(2);Uw($C(4,ge,UC(0,ce,t.agents()),UC(2,pe,t.models())));}}function Ee(e,a){if(e&1){let t=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(t);let s=Jw();return ff(s.load())}),Ds(1,"ds-form-field",5)(2,"input",6),Bg("ngModelChange",function(s){df(t);let m=Jw();return FC(m.from,s)||(m.from=s),ff(s)}),pl(),_I(),pl(),Ds(3,"ds-form-field",7)(4,"input",8),Bg("ngModelChange",function(s){df(t);let m=Jw();return FC(m.to,s)||(m.to=s),ff(s)}),pl(),_I(),pl(),Ds(5,"button",9),NC(6,"Refresh"),pl()(),Lw(7,be,2,1,"ds-notice"),Lw(8,xe,2,0,"p",2)(9,Te,4,7);}if(e&2){let t,r=Jw();BE(2),jg("ngModel",r.from),NI(),BE(2),jg("ngModel",r.to),NI(),BE(3),jw((t=r.error())?7:-1,t),BE(),jw(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=Ui([]);models=Ui([]);error=Ui(null);loading=Ui(false);from=new Date(Date.now()-30*864e5).toISOString().slice(0,10);to=new Date().toISOString().slice(0,10);refresh=new le;constructor(){Af(a=>{if(!this.configuration.enabled())return;let t=this.refresh.pipe(md(void 0),fa(()=>{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),nn):(this.loading.set(true),Ty({agents:this.api.aggregateByAgentUsageRecord(this.namespaceId,r.toISOString(),s.toISOString()),models:this.api.aggregateByModelUsageRecord(this.namespaceId,r.toISOString(),s.toISOString())}).pipe(da$1(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."),nn))))})).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=yw({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&&(Ds(0,"ds-page",0),lg(1,"ds-section-header",1),Lw(2,Ce,2,0,"p",2)(3,fe,5,0)(4,ye,2,0,"p",2)(5,Ee,10,4),pl()),t&2&&(BE(2),jw(r.configuration.state()==="loading"?2:r.configuration.state()==="error"?3:r.configuration.state()==="disabled"?4:5));},dependencies:[id,nd,Lt,mo,po,so,da,ra,pn,hn,cn,mn,at,an,Io,hb,f$1],encapsulation:2})};export{me as NamespaceUsageComponent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {v}from'./chunk-Da7PJEUd.js';import {I,n as nt,i as it}from'./chunk-CEwpNeBE.js';import {g,W,F,I as Ie,U as Ui,a9 as F$1,X as XC,q as Af,G as U,M as x,K as w,y as yw,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,j as jw,Z as Zw,H as Hw,ao as Vw,_ as _I,l as lg,J as Jw,R as NI,m as Uw,v as vl,ae as Fw,O as Og,k as cg,r as df,s as ff}from'./main-A7H5YZCD.js';import {T as Te,a as fn,p as pt,c as pn,h as hn,d as cn,r as ln,e as dn,g as at,i as an,t as rn,U as Ut,n as nd,l as bo,x as xo,L as Lt,G as Gt,w as pa,m as mo,b as po,V as Vn,A as An}from'./chunk-qv7FKA2K.js';import'./chunk-DrlG2odS.js';function Ce(i,t){i&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function ye(i,t){if(i&1&&(Ds(0,"label",16),lg(1,"input",17),_I(),NC(2),pl()),i&2){let e=t.$implicit,n=Jw(3);BE(),ug("formControl",n.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!n.isAdmin()),NI(),BE(),vl(" ",e.label," ");}}function ge(i,t){if(i&1&&(Ds(0,"ds-fieldset",5),Hw(1,ye,3,4,"label",16,Fw().trackByScope,true),pl()),i&2){let e=Jw(2);ug("disabled",e.isEditMode()),BE(),Uw(e.scopeOptions);}}function fe(i,t){if(i&1&&(Ds(0,"option",8),NC(1),pl()),i&2){let e=t.$implicit,n=Jw(2);ug("value",e),BE(),Og(n.authTypeLabel[e]);}}function Se(i,t){if(i&1&&(Ds(0,"ds-form-field",18),lg(1,"input",19),_I(),pl()),i&2){let e=Jw().$implicit;ug("label",e.label)("controlId","as-cred-"+e.key)("required",e.required)("hint",e.hint??null)("hintId","as-hint-"+e.key),BE(),ug("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),cg("aria-describedby",e.hint?"as-hint-"+e.key:null),NI();}}function Ae(i,t){if(i&1&&Lw(0,Se,2,11,"ds-form-field",18),i&2){let e,n=t.$implicit,o=Jw(3);jw((e=o.controlForField(n.key))?0:-1,e);}}function ve(i,t){if(i&1&&(Ds(0,"ds-fieldset",13),Hw(1,Ae,1,1,null,null,Fw().trackByField,true),pl()),i&2){let e=Jw(2);ug("hint","Values are stored encrypted and masked on read."+(e.isEditMode()?" Leave a field unchanged to keep the stored credential.":"")),BE(),Uw(e.credentialFields());}}function be(i,t){if(i&1){let e=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let o=Jw();return ff(o.submit())}),Lw(1,ge,3,1,"ds-fieldset",5),Ds(2,"ds-form-field",6)(3,"select",7),Hw(4,fe,2,2,"option",8,Vw),pl(),_I(),pl(),Ds(6,"ds-form-field",9),lg(7,"input",10),_I(),pl(),Ds(8,"ds-form-field",11),lg(9,"input",12),_I(),pl(),Lw(10,ve,3,1,"ds-fieldset",13),Ds(11,"ds-form-actions")(12,"button",14),NC(13),pl(),Ds(14,"button",15),mg("click",function(){df(e);let o=Jw();return ff(o.cancel())}),NC(15,"Cancel"),pl()()();}if(i&2){let e=Jw();ug("formGroup",e.form),BE(),jw(e.isPlatformMode?-1:1),BE(2),ug("formControl",e.authTypeControl),NI(),BE(),Uw(e.authTypeOptions),BE(3),ug("formControl",e.nameControl),NI(),BE(2),ug("formControl",e.descriptionControl),NI(),BE(),jw(e.credentialFields().length>0?10:-1),BE(2),ug("disabled",e.form.invalid||e.isSubmitting()),BE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var ke=new Set(["namespace","userOnNs","userGlobal"]),D=Object.freeze({platform:"Platform (read-only)",namespace:"Namespace configuration",userOnNs:"Personal \u2014 this namespace only",userGlobal:"Personal \u2014 all namespaces"}),_e={ApiKeyAuthSetting:[{key:"apiKey",label:"API Key",placeholder:"sk-\u2026",secret:true,required:false}],BasicAuthAuthSetting:[{key:"username",label:"Username",placeholder:"user@example.com",secret:false,required:false},{key:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",secret:true,required:false}],BearerTokenAuthSetting:[{key:"token",label:"Bearer token",placeholder:"eyJ\u2026",secret:true,required:false}],OAuthDiscoverableAuthSetting:[{key:"discoveryUrl",label:"Discovery URL",placeholder:"https://\u2026/.well-known/openid-configuration",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthCustomAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthRegisteredAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthMcpDiscoverableAuthSetting:[{key:"resourceUrl",label:"Resource URL",placeholder:"https://mcp.example.com",hint:"Use the base URL exactly as documented by your provider \u2014 do not append a path suffix. Examples: https://mcp.hubspot.com (HubSpot), https://mcp.atlassian.com/v1/mcp (Atlassian).",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",hint:"Leave empty to let the server register an OAuth client automatically (RFC 7591 dynamic registration). Fill in only if you have a pre-registered client ID from your provider.",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Leave empty in most cases \u2014 the MCP server declares the required scopes itself. Fill in only if your provider explicitly requires client-declared scopes.",secret:false,required:false}]},me=class i{route=g(W);router=g(F);destroyRef=g(Ie);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?Ui(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=nt;authTypeLabel=it;scopeOptions=[{value:"namespace",label:D.namespace},{value:"userOnNs",label:D.userOnNs},{value:"userGlobal",label:D.userGlobal}];nameControl=new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]});descriptionControl=new Te(null);authTypeControl=new Te("ApiKeyAuthSetting",{nonNullable:true,validators:[fn.required]});scopeControl=new Te("namespace",{nonNullable:true});form=new pt({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new Te("",{nonNullable:true});usernameControl=new Te("",{nonNullable:true});passwordControl=new Te("",{nonNullable:true});tokenControl=new Te("",{nonNullable:true});discoveryUrlControl=new Te("",{nonNullable:true});authorizationUrlControl=new Te("",{nonNullable:true});tokenUrlControl=new Te("",{nonNullable:true});clientIdControl=new Te("",{nonNullable:true});clientSecretControl=new Te("",{nonNullable:true});scopesControl=new Te("",{nonNullable:true});resourceUrlControl=new Te("",{nonNullable:true});selectedAuthType=F$1(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=XC(()=>_e[this.selectedAuthType()]);isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Af(()=>{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,n=t.get("authSettingId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let o=this.parseScope(e.get("scope"));this.scopeControl.setValue(o);let v=e.get("template");v&&this.hydrateFromTemplate(v);}parseScope(t){return t&&ke.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId&&!t.namespaceId?"platform":t.userId?t.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AuthSettingForm] Could not load auth setting '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.authTypeControl.setValue(e.authType),this.clearCredentialControls(),this.initialCredentials={},this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AuthSettingForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){switch(this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.authTypeControl.setValue(t.authType),this.clearCredentialControls(),this.initialCredentials={},t.authType){case "ApiKeyAuthSetting":{let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialCredentials.apiKey=e;break}case "BasicAuthAuthSetting":{let e=t,n=e.username??"",o=e.password??"";this.usernameControl.setValue(n),this.passwordControl.setValue(o),this.initialCredentials.username=n,this.initialCredentials.password=o;break}case "BearerTokenAuthSetting":{let e=t.token??"";this.tokenControl.setValue(e),this.initialCredentials.token=e;break}case "OAuthDiscoverableAuthSetting":{let e=t;this.discoveryUrlControl.setValue(e.discoveryUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.discoveryUrl=e.discoveryUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthCustomAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthRegisteredAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthMcpDiscoverableAuthSetting":{let e=t;this.resourceUrlControl.setValue(e.resourceUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.resourceUrl=e.resourceUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}}}clearCredentialControls(){this.apiKeyControl.setValue(""),this.usernameControl.setValue(""),this.passwordControl.setValue(""),this.tokenControl.setValue(""),this.discoveryUrlControl.setValue(""),this.authorizationUrlControl.setValue(""),this.tokenUrlControl.setValue(""),this.clientIdControl.setValue(""),this.clientSecretControl.setValue(""),this.scopesControl.setValue(""),this.resourceUrlControl.setValue("");}credentialValue(t,e){if(!(this.isEditMode()&&e===this.initialCredentials[t]))return e||void 0}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.nameControl.value.trim(),e=this.descriptionControl.value?.trim()||void 0,n=this.authTypeControl.value,o=this.form.getRawValue().scope,v=this.isPlatformMode?null:this.namespaceId??null,w=this.buildTypedPayload(n,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,this.existingConfig):this.state.create(w,o,v)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}buildTypedPayload(t,e,n){let o={name:e,description:n};switch(t){case "ApiKeyAuthSetting":return x(w({},o),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return x(w({},o),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return x(w({},o),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return x(w({},o),{authType:"OAuthDiscoverableAuthSetting",discoveryUrl:this.credentialValue("discoveryUrl",this.discoveryUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthCustomAuthSetting":return x(w({},o),{authType:"OAuthCustomAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthRegisteredAuthSetting":return x(w({},o),{authType:"OAuthRegisteredAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthMcpDiscoverableAuthSetting":return x(w({},o),{authType:"OAuthMcpDiscoverableAuthSetting",resourceUrl:this.credentialValue("resourceUrl",this.resourceUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)})}}controlForField(t){return {apiKey:this.apiKeyControl,username:this.usernameControl,password:this.passwordControl,token:this.tokenControl,discoveryUrl:this.discoveryUrlControl,authorizationUrl:this.authorizationUrlControl,tokenUrl:this.tokenUrlControl,clientId:this.clientIdControl,clientSecret:this.clientSecretControl,scopes:this.scopesControl,resourceUrl:this.resourceUrlControl}[t]}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","auth-settings"]):this.router.navigate(["/agentos",this.namespaceId,"auth-settings"]);}trackByScope(t,e){return e.value}trackByField(t,e){return e.key}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-auth-setting-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to auth settings",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Configuration scope",3,"disabled"],["label","Auth type","controlId","as-auth-type","required",""],["dsControl","","id","as-auth-type",3,"formControl"],[3,"value"],["label","Name","controlId","as-name","required",""],["dsControl","","id","as-name","type","text","placeholder","e.g. GitHub OAuth App","autocomplete","off",3,"formControl"],["label","Description","controlId","as-description"],["dsControl","","id","as-description","type","text","placeholder","Optional \u2014 short description of this auth setting","autocomplete","off",3,"formControl"],["legend","Credentials",3,"hint"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsCheck",""],["type","radio",3,"formControl","value","disabled"],[3,"label","controlId","required","hint","hintId"],["dsControl","",3,"id","type","placeholder","formControl","autocomplete"]],template:function(e,n){e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return n.cancel()}),NC(3," \u2190 Auth settings "),pl()(),Lw(4,Ce,2,0,"p",2)(5,be,16,8,"form",3),pl()),e&2&&(BE(),ug("title",n.isEditMode()?"Edit auth setting":"New auth setting"),BE(3),jw(n.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,at,an,rn,Ut,nd,bo,xo,Lt,Gt,pa,mo,po,Vn,An],encapsulation:2})};
|
|
1
|
+
import {v}from'./chunk-CCEk4l94.js';import {I,n as nt,i as it}from'./chunk-By6f_HEs.js';import {g,W,F,I as Ie,U as Ui,a9 as F$1,X as XC,q as Af,G as U,M as x,K as w,y as yw,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,j as jw,Z as Zw,H as Hw,ao as Vw,_ as _I,l as lg,J as Jw,R as NI,m as Uw,v as vl,ae as Fw,O as Og,k as cg,r as df,s as ff}from'./main-CHNQJIYM.js';import {T as Te,a as fn,p as pt,c as pn,h as hn,d as cn,r as ln,e as dn,g as at,i as an,t as rn,U as Ut,n as nd,l as bo,x as xo,L as Lt,G as Gt,w as pa,m as mo,b as po,V as Vn,A as An}from'./chunk-C4WQ3FwO.js';import'./chunk-1X8ZDw_H.js';function Ce(i,t){i&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function ye(i,t){if(i&1&&(Ds(0,"label",16),lg(1,"input",17),_I(),NC(2),pl()),i&2){let e=t.$implicit,n=Jw(3);BE(),ug("formControl",n.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!n.isAdmin()),NI(),BE(),vl(" ",e.label," ");}}function ge(i,t){if(i&1&&(Ds(0,"ds-fieldset",5),Hw(1,ye,3,4,"label",16,Fw().trackByScope,true),pl()),i&2){let e=Jw(2);ug("disabled",e.isEditMode()),BE(),Uw(e.scopeOptions);}}function fe(i,t){if(i&1&&(Ds(0,"option",8),NC(1),pl()),i&2){let e=t.$implicit,n=Jw(2);ug("value",e),BE(),Og(n.authTypeLabel[e]);}}function Se(i,t){if(i&1&&(Ds(0,"ds-form-field",18),lg(1,"input",19),_I(),pl()),i&2){let e=Jw().$implicit;ug("label",e.label)("controlId","as-cred-"+e.key)("required",e.required)("hint",e.hint??null)("hintId","as-hint-"+e.key),BE(),ug("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),cg("aria-describedby",e.hint?"as-hint-"+e.key:null),NI();}}function Ae(i,t){if(i&1&&Lw(0,Se,2,11,"ds-form-field",18),i&2){let e,n=t.$implicit,o=Jw(3);jw((e=o.controlForField(n.key))?0:-1,e);}}function ve(i,t){if(i&1&&(Ds(0,"ds-fieldset",13),Hw(1,Ae,1,1,null,null,Fw().trackByField,true),pl()),i&2){let e=Jw(2);ug("hint","Values are stored encrypted and masked on read."+(e.isEditMode()?" Leave a field unchanged to keep the stored credential.":"")),BE(),Uw(e.credentialFields());}}function be(i,t){if(i&1){let e=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let o=Jw();return ff(o.submit())}),Lw(1,ge,3,1,"ds-fieldset",5),Ds(2,"ds-form-field",6)(3,"select",7),Hw(4,fe,2,2,"option",8,Vw),pl(),_I(),pl(),Ds(6,"ds-form-field",9),lg(7,"input",10),_I(),pl(),Ds(8,"ds-form-field",11),lg(9,"input",12),_I(),pl(),Lw(10,ve,3,1,"ds-fieldset",13),Ds(11,"ds-form-actions")(12,"button",14),NC(13),pl(),Ds(14,"button",15),mg("click",function(){df(e);let o=Jw();return ff(o.cancel())}),NC(15,"Cancel"),pl()()();}if(i&2){let e=Jw();ug("formGroup",e.form),BE(),jw(e.isPlatformMode?-1:1),BE(2),ug("formControl",e.authTypeControl),NI(),BE(),Uw(e.authTypeOptions),BE(3),ug("formControl",e.nameControl),NI(),BE(2),ug("formControl",e.descriptionControl),NI(),BE(),jw(e.credentialFields().length>0?10:-1),BE(2),ug("disabled",e.form.invalid||e.isSubmitting()),BE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var ke=new Set(["namespace","userOnNs","userGlobal"]),D=Object.freeze({platform:"Platform (read-only)",namespace:"Namespace configuration",userOnNs:"Personal \u2014 this namespace only",userGlobal:"Personal \u2014 all namespaces"}),_e={ApiKeyAuthSetting:[{key:"apiKey",label:"API Key",placeholder:"sk-\u2026",secret:true,required:false}],BasicAuthAuthSetting:[{key:"username",label:"Username",placeholder:"user@example.com",secret:false,required:false},{key:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",secret:true,required:false}],BearerTokenAuthSetting:[{key:"token",label:"Bearer token",placeholder:"eyJ\u2026",secret:true,required:false}],OAuthDiscoverableAuthSetting:[{key:"discoveryUrl",label:"Discovery URL",placeholder:"https://\u2026/.well-known/openid-configuration",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthCustomAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthRegisteredAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthMcpDiscoverableAuthSetting:[{key:"resourceUrl",label:"Resource URL",placeholder:"https://mcp.example.com",hint:"Use the base URL exactly as documented by your provider \u2014 do not append a path suffix. Examples: https://mcp.hubspot.com (HubSpot), https://mcp.atlassian.com/v1/mcp (Atlassian).",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",hint:"Leave empty to let the server register an OAuth client automatically (RFC 7591 dynamic registration). Fill in only if you have a pre-registered client ID from your provider.",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Leave empty in most cases \u2014 the MCP server declares the required scopes itself. Fill in only if your provider explicitly requires client-declared scopes.",secret:false,required:false}]},me=class i{route=g(W);router=g(F);destroyRef=g(Ie);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?Ui(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=nt;authTypeLabel=it;scopeOptions=[{value:"namespace",label:D.namespace},{value:"userOnNs",label:D.userOnNs},{value:"userGlobal",label:D.userGlobal}];nameControl=new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]});descriptionControl=new Te(null);authTypeControl=new Te("ApiKeyAuthSetting",{nonNullable:true,validators:[fn.required]});scopeControl=new Te("namespace",{nonNullable:true});form=new pt({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new Te("",{nonNullable:true});usernameControl=new Te("",{nonNullable:true});passwordControl=new Te("",{nonNullable:true});tokenControl=new Te("",{nonNullable:true});discoveryUrlControl=new Te("",{nonNullable:true});authorizationUrlControl=new Te("",{nonNullable:true});tokenUrlControl=new Te("",{nonNullable:true});clientIdControl=new Te("",{nonNullable:true});clientSecretControl=new Te("",{nonNullable:true});scopesControl=new Te("",{nonNullable:true});resourceUrlControl=new Te("",{nonNullable:true});selectedAuthType=F$1(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=XC(()=>_e[this.selectedAuthType()]);isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Af(()=>{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,n=t.get("authSettingId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let o=this.parseScope(e.get("scope"));this.scopeControl.setValue(o);let v=e.get("template");v&&this.hydrateFromTemplate(v);}parseScope(t){return t&&ke.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId&&!t.namespaceId?"platform":t.userId?t.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AuthSettingForm] Could not load auth setting '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.authTypeControl.setValue(e.authType),this.clearCredentialControls(),this.initialCredentials={},this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AuthSettingForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){switch(this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.authTypeControl.setValue(t.authType),this.clearCredentialControls(),this.initialCredentials={},t.authType){case "ApiKeyAuthSetting":{let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialCredentials.apiKey=e;break}case "BasicAuthAuthSetting":{let e=t,n=e.username??"",o=e.password??"";this.usernameControl.setValue(n),this.passwordControl.setValue(o),this.initialCredentials.username=n,this.initialCredentials.password=o;break}case "BearerTokenAuthSetting":{let e=t.token??"";this.tokenControl.setValue(e),this.initialCredentials.token=e;break}case "OAuthDiscoverableAuthSetting":{let e=t;this.discoveryUrlControl.setValue(e.discoveryUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.discoveryUrl=e.discoveryUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthCustomAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthRegisteredAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthMcpDiscoverableAuthSetting":{let e=t;this.resourceUrlControl.setValue(e.resourceUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.resourceUrl=e.resourceUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}}}clearCredentialControls(){this.apiKeyControl.setValue(""),this.usernameControl.setValue(""),this.passwordControl.setValue(""),this.tokenControl.setValue(""),this.discoveryUrlControl.setValue(""),this.authorizationUrlControl.setValue(""),this.tokenUrlControl.setValue(""),this.clientIdControl.setValue(""),this.clientSecretControl.setValue(""),this.scopesControl.setValue(""),this.resourceUrlControl.setValue("");}credentialValue(t,e){if(!(this.isEditMode()&&e===this.initialCredentials[t]))return e||void 0}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.nameControl.value.trim(),e=this.descriptionControl.value?.trim()||void 0,n=this.authTypeControl.value,o=this.form.getRawValue().scope,v=this.isPlatformMode?null:this.namespaceId??null,w=this.buildTypedPayload(n,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,this.existingConfig):this.state.create(w,o,v)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}buildTypedPayload(t,e,n){let o={name:e,description:n};switch(t){case "ApiKeyAuthSetting":return x(w({},o),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return x(w({},o),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return x(w({},o),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return x(w({},o),{authType:"OAuthDiscoverableAuthSetting",discoveryUrl:this.credentialValue("discoveryUrl",this.discoveryUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthCustomAuthSetting":return x(w({},o),{authType:"OAuthCustomAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthRegisteredAuthSetting":return x(w({},o),{authType:"OAuthRegisteredAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthMcpDiscoverableAuthSetting":return x(w({},o),{authType:"OAuthMcpDiscoverableAuthSetting",resourceUrl:this.credentialValue("resourceUrl",this.resourceUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)})}}controlForField(t){return {apiKey:this.apiKeyControl,username:this.usernameControl,password:this.passwordControl,token:this.tokenControl,discoveryUrl:this.discoveryUrlControl,authorizationUrl:this.authorizationUrlControl,tokenUrl:this.tokenUrlControl,clientId:this.clientIdControl,clientSecret:this.clientSecretControl,scopes:this.scopesControl,resourceUrl:this.resourceUrlControl}[t]}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","auth-settings"]):this.router.navigate(["/agentos",this.namespaceId,"auth-settings"]);}trackByScope(t,e){return e.value}trackByField(t,e){return e.key}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-auth-setting-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to auth settings",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Configuration scope",3,"disabled"],["label","Auth type","controlId","as-auth-type","required",""],["dsControl","","id","as-auth-type",3,"formControl"],[3,"value"],["label","Name","controlId","as-name","required",""],["dsControl","","id","as-name","type","text","placeholder","e.g. GitHub OAuth App","autocomplete","off",3,"formControl"],["label","Description","controlId","as-description"],["dsControl","","id","as-description","type","text","placeholder","Optional \u2014 short description of this auth setting","autocomplete","off",3,"formControl"],["legend","Credentials",3,"hint"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsCheck",""],["type","radio",3,"formControl","value","disabled"],[3,"label","controlId","required","hint","hintId"],["dsControl","",3,"id","type","placeholder","formControl","autocomplete"]],template:function(e,n){e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return n.cancel()}),NC(3," \u2190 Auth settings "),pl()(),Lw(4,Ce,2,0,"p",2)(5,be,16,8,"form",3),pl()),e&2&&(BE(),ug("title",n.isEditMode()?"Edit auth setting":"New auth setting"),BE(3),jw(n.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,at,an,rn,Ut,nd,bo,xo,Lt,Gt,pa,mo,po,Vn,An],encapsulation:2})};
|
|
2
2
|
export{me as AuthSettingFormComponent};
|