@whoz-oss/coday-client 0.0.0-workstream-messaging.11 → 0.0.0-workstream-forge.280
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-0JbcW6XU.js +1 -0
- package/browser/chunk-BEjdqTuv.js +1 -0
- package/browser/{chunk-BE9_RSN2.js → chunk-BQrOLW8s.js} +1 -1
- package/browser/chunk-BXYAYYIa.js +1 -0
- package/browser/{chunk-B0uIZBmR.js → chunk-BYsAPdst.js} +1 -1
- package/browser/chunk-Bb-c0ROH.js +1 -0
- package/browser/chunk-BbXsFpeY.js +1 -0
- package/browser/chunk-BdGvps3l.js +1 -0
- package/browser/chunk-BiVIEQ9a.js +1 -0
- package/browser/chunk-BiZzqeAP.js +1 -0
- package/browser/chunk-BkYVWjXM.js +1 -0
- package/browser/{chunk-Cdc4bldZ.js → chunk-Bl2q9K-9.js} +1 -1
- package/browser/chunk-Bl_O73CB.js +1 -0
- package/browser/chunk-Bw6tipQO.js +1 -0
- package/browser/chunk-BxyolXEz.js +1 -0
- package/browser/{chunk-SMCp3GcF.js → chunk-C1XiLUJe.js} +1 -1
- package/browser/chunk-CCAHEyrn.js +1 -0
- package/browser/chunk-CK-0hHs3.js +1 -0
- package/browser/chunk-CKVl5Clw.js +1 -0
- package/browser/chunk-CMLKq_d1.js +1 -0
- package/browser/chunk-CUuUezdS.js +2 -0
- package/browser/chunk-Cfwcs5Kc.js +1 -0
- package/browser/chunk-Csvi_3to.js +1 -0
- package/browser/chunk-CxGh-OSF.js +1 -0
- package/browser/chunk-Cz-Jz4NK.js +1 -0
- package/browser/chunk-D4hFKIuc.js +1 -0
- package/browser/chunk-D8p-F6vy.js +1 -0
- package/browser/chunk-DB_JDbO5.js +1 -0
- package/browser/chunk-DCI35EBd.js +1 -0
- package/browser/chunk-DEGiKLCd.js +1 -0
- package/browser/chunk-DJVPAAOR.js +1 -0
- package/browser/chunk-DM86JaK-.js +1 -0
- package/browser/chunk-DNMiaqnS.js +2 -0
- package/browser/chunk-DQzepkz_.js +1 -0
- package/browser/chunk-DTUbUaG8.js +1 -0
- package/browser/chunk-DV9A52hr.js +2 -0
- package/browser/chunk-Dm98JW0v.js +1 -0
- package/browser/chunk-TljffFCf.js +1 -0
- package/browser/chunk-Yh9s3GFa.js +1 -0
- package/browser/chunk-YmtXKFPm.js +1 -0
- package/browser/chunk-gJxWDxbF.js +1 -0
- package/browser/chunk-idHJ_h4K.js +1 -0
- package/browser/chunk-iiXgVxfs.js +1 -0
- package/browser/chunk-qF4-8qpt.js +671 -0
- package/browser/chunk-rqfGv-7x.js +1 -0
- package/browser/chunk-tlmUd1Et.js +1 -0
- package/browser/index.html +1 -1
- package/browser/main-C2L5IBU7.js +1253 -0
- package/package.json +1 -1
- package/browser/chunk-3Gitpl_W.js +0 -1
- package/browser/chunk-3HWaG27c.js +0 -1
- package/browser/chunk-74ukJ4Xi.js +0 -1
- package/browser/chunk-B03vbh4f.js +0 -1
- package/browser/chunk-B3TB_PnM.js +0 -1
- package/browser/chunk-BYbk8T3K.js +0 -1
- package/browser/chunk-BlF0vroR.js +0 -1
- package/browser/chunk-Bn8HYTTM.js +0 -1
- package/browser/chunk-Bsqc_xnw.js +0 -1
- package/browser/chunk-Bvgg4-BU.js +0 -2
- package/browser/chunk-BxIVdFlW.js +0 -1
- package/browser/chunk-BzGzNc-T.js +0 -1
- package/browser/chunk-C1t3O1k4.js +0 -1
- package/browser/chunk-C40WwJqu.js +0 -1
- package/browser/chunk-C4i-jeuv.js +0 -1
- package/browser/chunk-CAAhkREQ.js +0 -1
- package/browser/chunk-CCKO622E.js +0 -1
- package/browser/chunk-CIHlLjrB.js +0 -1
- package/browser/chunk-CM0r-RA8.js +0 -1
- package/browser/chunk-CM6VQi9F.js +0 -1
- package/browser/chunk-CfX6vIYj.js +0 -1
- package/browser/chunk-Ch-yIotV.js +0 -1
- package/browser/chunk-CiRJa9KR.js +0 -1
- package/browser/chunk-Cmd42Ubi.js +0 -1
- package/browser/chunk-CrFtQd0x.js +0 -1
- package/browser/chunk-CxQaRSXz.js +0 -1
- package/browser/chunk-CzFv-twG.js +0 -1
- package/browser/chunk-D2mdz_SD.js +0 -1
- package/browser/chunk-D5QHsISQ.js +0 -1
- package/browser/chunk-DB_wGI-O.js +0 -1
- package/browser/chunk-DIF7cPtA.js +0 -1
- package/browser/chunk-DT39vMjm.js +0 -2
- package/browser/chunk-DX5hDq00.js +0 -1
- package/browser/chunk-DXtHX7ac.js +0 -1
- package/browser/chunk-DbK9IJQd.js +0 -1
- package/browser/chunk-Dg0rwtUo.js +0 -1
- package/browser/chunk-DqI0c9B5.js +0 -2
- package/browser/chunk-DwEcQtO1.js +0 -670
- package/browser/chunk-FY_ZYR73.js +0 -1
- package/browser/chunk-QpTN-Nr6.js +0 -1
- package/browser/chunk-axNMhn9i.js +0 -1
- package/browser/chunk-hp_96Xe0.js +0 -1
- package/browser/chunk-nLTwJihI.js +0 -1
- package/browser/chunk-vhSiFYge.js +0 -1
- package/browser/chunk-w7fu2Om4.js +0 -1
- package/browser/main-JXQYBZRK.js +0 -1254
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {r as k$1,O,i as at,d as yn,V as Vo,A as Ao,k as P,w as P$1}from'./chunk-DwEcQtO1.js';import {g,W as W$1,F,v as we,au as k,at as F$1,a3 as vr,M as Mi,a5 as Ys,ag as Gm,a6 as Zs,ae as Dr,x as U,a as ew,o as os,K as qh,z as zu,b as pC,I as Iw,c as IE,J as Vh,w as ww,L as Lw,l as lg,T as Tw,_ as _w,Y as Yu,R as Rw,P as Pd,n as Ld,h as Bh}from'./main-JXQYBZRK.js';var G=(i,e)=>e.key;function Q(i,e){if(i&1&&(os(0,"p",3),pC(1),zu()),i&2){let t=Lw();IE(),lg(t.deletion.error());}}function W(i,e){i&1&&(os(0,"p",4),pC(1,"Loading AI models\u2026"),zu());}function X(i,e){i&1&&(os(0,"p",5),pC(1,"No AI models configured."),zu());}function Y(i,e){i&1&&(os(0,"p",4),pC(1,"No AI models match the current filter."),zu());}function Z(i,e){i&1&&(os(0,"ds-tag",18),pC(1,"Read-only"),zu());}function ee(i,e){if(i&1){let t=Rw();os(0,"button",24),qh("click",function(){Pd(t);let s=Lw(2).$implicit,m=Lw(2);return Ld(m.edit(s))}),pC(1,"Edit"),zu();}if(i&2){let t=Lw(2).$implicit,n=Lw(2);Bh("aria-label","Edit "+n.title(t));}}function te(i,e){if(i&1){let t=Rw();Iw(0,ee,2,1,"button",22),os(1,"agentos-row-delete-action",23),qh("deleteRequested",function(){Pd(t);let s=Lw().$implicit,m=Lw(2);return Ld(m.deletion.request(s.key))})("deleteConfirmed",function(){Pd(t);let s=Lw().$implicit,m=Lw(2);return Ld(m.confirmDelete(s))})("deleteCancelled",function(){Pd(t);let s=Lw(3);return Ld(s.deletion.cancel())}),zu();}if(i&2){let t=Lw().$implicit,n=Lw(2);ww(n.deletion.confirmingId()!==t.key?0:-1),IE(),Vh("rowKey",t.key)("rowLabel",n.title(t))("state",n.deletion);}}function ie(i,e){i&1&&(os(0,"button",21),pC(1,"Inherited"),zu());}function ne(i,e){if(i&1&&(os(0,"tr",9)(1,"td",12),pC(2),zu(),os(3,"td",13),pC(4),zu(),os(5,"td",14),pC(6),zu(),os(7,"td",15)(8,"div",16)(9,"ds-tag",17),pC(10),zu(),Iw(11,Z,2,0,"ds-tag",18),zu()(),os(12,"td",19)(13,"div",20),Iw(14,te,2,4)(15,ie,2,0,"button",21),zu()()()),i&2){let t=e.$implicit,n=Lw(2);IE(2),lg(n.title(t)),IE(2),lg(t.providerName),IE(2),Yu(" ",t.model.apiModelName," "),IE(3),Vh("variant",t.scope==="platform"?"neutral":"accent"),IE(),lg(t.scope==="platform"?"Platform":"Namespace"),IE(),ww(t.scope==="platform"?11:-1),IE(3),ww(t.scope==="namespace"?14:15);}}function oe(i,e){if(i&1&&(os(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),pC(5,"Name"),zu(),os(6,"th",10),pC(7,"Provider"),zu(),os(8,"th",10),pC(9,"API model name"),zu(),os(10,"th",10),pC(11,"Scope"),zu(),os(12,"th",10)(13,"span",11),pC(14,"Actions"),zu()()()(),os(15,"tbody",8),Tw(16,ne,16,7,"tr",9,G),zu()()()),i&2){let t=Lw();IE(16),_w(t.rowFilter.filteredRows());}}var z=class i{route=g(W$1);router=g(F);destroyRef=g(we);aiModelController=g(k);aiProviderController=g(F$1);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new vr(void 0);isLoading=Mi(true);deletion=k$1();rows=Mi([]);rowFilter=O(this.rows,e=>[e.model.alias,e.model.apiModelName,e.providerName,e.scope].filter(Boolean).join(" "));data$=this.refresh$.pipe(Ys(()=>(this.isLoading.set(true),Gm({namespace:this.aiModelController.listByNamespaceIdAiModel(this.namespaceId),platform:this.aiModelController.listPlatformLevelAiModel().pipe(Zs(()=>Dr([]))),providers:this.aiProviderController.listAiProvider(this.namespaceId)}).pipe(Ys(({namespace:e,platform:t,providers:n})=>{let s=[...new Set([...t,...e].map(m=>m.aiProviderId))];return Gm({namespace:Dr(e),platform:Dr(t),providers:Dr(n),referencedProviders:this.aiProviderController.getByIdsAiProvider({ids:s,withRemoved:false}).pipe(Zs(()=>Dr([])))})})))));constructor(){this.data$.pipe(U(this.destroyRef)).subscribe({next:({namespace:e,platform:t,providers:n,referencedProviders:s})=>{let m=new Map([...s,...n].map(c=>[c.id??"",c.name]));this.rows.set([...t.map((c,g)=>({key:`platform:${c.id??g}`,model:c,providerName:m.get(c.aiProviderId)??c.aiProviderId,scope:"platform"})),...e.map((c,g)=>({key:`namespace:${c.id??g}`,model:c,providerName:m.get(c.aiProviderId)??c.aiProviderId,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-models","new"]);}edit(e){e.scope==="platform"||!e.model.id||this.router.navigate(["/agentos",this.namespaceId,"ai-models",e.model.id,"edit"]);}title(e){return e.model.alias??e.model.apiModelName}confirmDelete(e){e.scope==="platform"||!e.model.id||this.deletion.execute(e.key,{request$:this.aiModelController.deleteAiModel(e.model.id).pipe(U(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${this.title(e)}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=ew({type:i,selectors:[["agentos-namespace-ai-models"]],decls:9,vars:3,consts:[["title","AI models","description","AI models configured for this namespace, including models inherited from the platform."],["label","Filter AI models","placeholder","Filter AI models\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","AI models"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Provider"],["role","cell","data-label","API model name",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(t,n){t&1&&(os(0,"ds-section-header",0)(1,"agentos-table-filter",1),qh("queryChange",function(m){return n.rowFilter.query.set(m)}),zu(),os(2,"button",2),qh("click",function(){return n.openCreateForm()}),pC(3,"New AI model"),zu()(),Iw(4,Q,2,1,"p",3),Iw(5,W,2,0,"p",4)(6,X,2,0,"p",5)(7,Y,2,0,"p",4)(8,oe,18,0,"div",6)),t&2&&(IE(),Vh("query",n.rowFilter.query()),IE(3),ww(n.deletion.error()?4:-1),IE(),ww(n.isLoading()?5:n.rows().length===0?6:n.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{z as NamespaceAiModelsComponent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {O as O$1}from'./chunk-CfX6vIYj.js';import {g,F,v as we,aj as G$1,a3 as vr,M as Mi,a5 as Ys,x as U$1,a as ew,o as os,K as qh,z as zu,b as pC,I as Iw,c as IE,J as Vh,w as ww,L as Lw,l as lg,T as Tw,_ as _w,R as Rw,h as Bh,P as Pd,n as Ld}from'./main-JXQYBZRK.js';import {r as k,O as O$2,i as at,d as yn,V as Vo,k as P,w as P$1}from'./chunk-DwEcQtO1.js';import'./chunk-Dg0rwtUo.js';var j=(t,e)=>e.id??e.name;function A(t,e){if(t&1&&(os(0,"p",3),pC(1),zu()),t&2){let n=Lw();IE(),lg(n.deletion.error());}}function K(t,e){t&1&&(os(0,"p",4),pC(1,"Loading integrations\u2026"),zu());}function H(t,e){t&1&&(os(0,"p",5),pC(1,"No platform integrations defined yet."),zu());}function U(t,e){t&1&&(os(0,"p",4),pC(1,"No integrations match the current filter."),zu());}function z(t,e){if(t&1){let n=Rw();os(0,"button",18),qh("click",function(){Pd(n);let d=Lw().$implicit,m=Lw(2);return Ld(m.edit(d))}),pC(1,"Edit"),zu();}if(t&2){let n=Lw().$implicit;Bh("aria-label","Edit "+n.name);}}function G(t,e){if(t&1){let n=Rw();os(0,"agentos-row-delete-action",19),qh("deleteRequested",function(){Pd(n);let d=Lw().$implicit,m=Lw(2);return Ld(m.deletion.request(d.id))})("deleteConfirmed",function(){Pd(n);let d=Lw().$implicit,m=Lw(2);return Ld(m.confirmDelete(d))})("deleteCancelled",function(){Pd(n);let d=Lw(3);return Ld(d.deletion.cancel())}),zu();}if(t&2){let n=Lw().$implicit,r=Lw(2);Vh("rowKey",n.id)("rowLabel",n.name)("state",r.deletion);}}function J(t,e){if(t&1&&(os(0,"tr",9)(1,"td",12),pC(2),zu(),os(3,"td",13),pC(4),zu(),os(5,"td",14)(6,"div",15),Iw(7,z,2,1,"button",16),Iw(8,G,1,3,"agentos-row-delete-action",17),zu()()()),t&2){let n=e.$implicit,r=Lw(2);IE(2),lg(n.name),IE(2),lg(n.integrationType),IE(3),ww(r.deletion.confirmingId()!==n.id?7:-1),IE(),ww(n.id?8:-1);}}function O(t,e){if(t&1&&(os(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),pC(5,"Name"),zu(),os(6,"th",10),pC(7,"Type"),zu(),os(8,"th",10)(9,"span",11),pC(10,"Actions"),zu()()()(),os(11,"tbody",8),Tw(12,J,9,4,"tr",9,j),zu()()()),t&2){let n=Lw();IE(12),_w(n.rowFilter.filteredRows());}}var B=class t{router=g(F);destroyRef=g(we);state=g(O$1);integrationConfigController=g(G$1);refresh$=new vr(void 0);isLoading=Mi(true);deletion=k();configs=Mi([]);rowFilter=O$2(this.configs,e=>[e.name,e.integrationType].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(Ys(()=>(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=ew({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&&(os(0,"ds-section-header",0)(1,"agentos-table-filter",1),qh("queryChange",function(m){return r.rowFilter.query.set(m)}),zu(),os(2,"button",2),qh("click",function(){return r.openCreateForm()}),pC(3,"New integration"),zu()(),Iw(4,A,2,1,"p",3),Iw(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&&(IE(),Vh("query",r.rowFilter.query()),IE(3),ww(r.deletion.error()?4:-1),IE(),ww(r.isLoading()?5:r.configs().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,P,P$1],encapsulation:2})};export{B as PlatformIntegrationConfigsComponent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {O}from'./chunk-C4i-jeuv.js';import {v}from'./chunk-DbK9IJQd.js';import {g,W,F,v as we,M as Mi,ad as F$1,ar as Ue,s as sf,x as U,a as ew,o as os,K as qh,b as pC,z as zu,I as Iw,c as IE,J as Vh,w as ww,R as Rw,T as Tw,as as bw,N as lI,H as Hh,aq as Cw,L as Lw,Q as fI,_ as _w,Y as Yu,ai as Dw,l as lg,P as Pd,n as Ld}from'./main-JXQYBZRK.js';import {p as pt,W as Wt,T as Te,b as bn,v as vn,d as yn,e as fn,n as pn,h as hn,i as at,u as un,o as cn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,Q as Qt,C as Ca,c as fo,g as go,N as Nn,R as Rn,E as Ea,z as yo,B as bo}from'./chunk-DwEcQtO1.js';import'./chunk-Dg0rwtUo.js';function ge(o,t){o&1&&(os(0,"p",2),pC(1,"Loading\u2026"),zu());}function be(o,t){if(o&1&&(os(0,"label",23),Hh(1,"input",24),lI(),pC(2),zu()),o&2){let e=t.$implicit,r=Lw(3);IE(),Vh("formControl",r.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!r.isAdmin()),fI(),IE(),Yu(" ",e.label," ");}}function _e(o,t){if(o&1&&(os(0,"ds-fieldset",5),Tw(1,be,3,4,"label",23,Dw().trackByScope,true),zu()),o&2){let e=Lw(2);Vh("disabled",e.isEditMode()),IE(),_w(e.scopeOptions);}}function Ae(o,t){if(o&1&&(os(0,"option",8),pC(1),zu()),o&2){let e=t.$implicit;Vh("value",e),IE(),lg(e);}}function Se(o,t){if(o&1){let e=Rw();os(0,"div",19),Hh(1,"input",25),lI(),Hh(2,"input",26),lI(),os(3,"button",27),qh("click",function(){let l=Pd(e).$index,f=Lw(2);return Ld(f.removeHeader(l))}),pC(4," \xD7 "),zu()();}if(o&2){let e=t.$index;Vh("formGroupName",e),IE(),fI(),IE(),fI();}}function Pe(o,t){if(o&1){let e=Rw();os(0,"form",4),qh("ngSubmit",function(){Pd(e);let l=Lw();return Ld(l.submit())}),Iw(1,_e,3,1,"ds-fieldset",5),os(2,"ds-form-field",6)(3,"select",7),Tw(4,Ae,2,2,"option",8,bw),zu(),lI(),zu(),os(6,"ds-form-field",9),Hh(7,"input",10),lI(),zu(),os(8,"ds-form-field",11),Hh(9,"input",12),lI(),zu(),os(10,"ds-form-field",13),Hh(11,"input",14),lI(),zu(),os(12,"ds-form-field",15),Hh(13,"input",16),lI(),zu(),os(14,"ds-form-field",17)(15,"div",18),Tw(16,Se,5,1,"div",19,Cw),os(18,"div")(19,"button",20),qh("click",function(){Pd(e);let l=Lw();return Ld(l.addHeader())}),pC(20,"+ Add header"),zu()()()(),os(21,"ds-form-actions")(22,"button",21),pC(23),zu(),os(24,"button",22),qh("click",function(){Pd(e);let l=Lw();return Ld(l.cancel())}),pC(25,"Cancel"),zu()()();}if(o&2){let e=Lw();Vh("formGroup",e.form),IE(),ww(e.isPlatformMode?-1:1),IE(2),Vh("formControl",e.apiTypeControl),fI(),IE(),_w(e.apiTypeOptions),IE(3),Vh("formControl",e.nameControl),fI(),IE(2),Vh("formControl",e.descriptionControl),fI(),IE(2),Vh("formControl",e.baseUrlControl),fI(),IE(2),Vh("formControl",e.apiKeyControl),fI(),IE(2),Vh("formArrayName","headers"),IE(),_w(e.headersArray.controls),IE(6),Vh("disabled",e.form.invalid||e.isSubmitting()),IE(),Yu(" ",e.isEditMode()?"Save changes":"Create"," ");}}var xe=new Set(["namespace","userOnNs","userGlobal"]),E=Object.freeze({platform:"Configuration de niveau plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ye=class o{route=g(W);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?Mi(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});apiTypeOptions=Object.values(Ue);scopeOptions=[{value:"namespace",label:E.namespace},{value:"userOnNs",label:E.userOnNs},{value:"userGlobal",label:E.userGlobal}];form=new pt({name:new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te(null),apiType:new Te("OpenAI",{nonNullable:true,validators:[bn.required]}),baseUrl:new Te("",{nonNullable:true}),apiKey:new Te("",{nonNullable:true}),scope:new Te("namespace",{nonNullable:true}),headers:new Wt([],{validators:[]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get apiTypeControl(){return this.form.controls.apiType}get baseUrlControl(){return this.form.controls.baseUrl}get apiKeyControl(){return this.form.controls.apiKey}get scopeControl(){return this.form.controls.scope}get headersArray(){return this.form.controls.headers}addHeader(){this.headersArray.push(new pt({key:new Te("",{nonNullable:true,validators:[bn.required]}),value:new Te("",{nonNullable:true})}));}removeHeader(t){this.headersArray.removeAt(t);}isEditMode=Mi(false);isSubmitting=Mi(false);isLoading=Mi(false);existingConfig=null;initialApiKey="";constructor(){this.isPlatformMode||sf(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,r=t.get("aiProviderId"),l=this.isPlatformMode?"namespace":this.parseScope(e.get("scope"));if(r){this.isEditMode.set(true),this.scopeControl.disable(),this.apiTypeControl.disable(),this.loadConfig(r);return}this.scopeControl.setValue(l);let f=e.get("template");f&&this.hydrateFromTemplate(f);}parseScope(t){return t&&xe.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId?"namespace":t.namespaceId?"userOnNs":"userGlobal"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AiProviderForm] Could not load provider '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.apiTypeControl.setValue(e.apiType),this.baseUrlControl.setValue(e.baseUrl??""),this.apiKeyControl.setValue(""),this.initialApiKey="",this.apiKeyControl.markAsTouched(),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AiProviderForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.apiTypeControl.setValue(t.apiType),this.baseUrlControl.setValue(t.baseUrl??"");let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialApiKey=e,this.headersArray.clear();for(let[r,l]of Object.entries(t.headers??{}))this.headersArray.push(new pt({key:new Te(r,{nonNullable:true,validators:[bn.required]}),value:new Te(l,{nonNullable:true})}));}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.descriptionControl.value?.trim(),e=this.baseUrlControl.value.trim(),r=this.apiKeyControl.value,l=this.isEditMode()&&r===this.initialApiKey?null:r,f=this.headersArray.controls.filter(A=>A.controls.key.value.trim()).map(A=>[A.controls.key.value.trim(),A.controls.value.value]),Ce=f.length>0?Object.fromEntries(f):null,V={name:this.nameControl.value.trim(),apiType:this.apiTypeControl.value,description:t||null,baseUrl:e||null,apiKey:l,headers:Ce},w=this.form.getRawValue().scope,he=this.isPlatformMode?null:this.namespaceId??null;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,V,w,this.existingConfig):this.state.create(V,w,he)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-providers"]):this.router.navigate(["/agentos",this.namespaceId,"ai-providers"]);}trackByScope(t,e){return e.value}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=ew({type:o,selectors:[["agentos-ai-provider-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to AI providers",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Configuration scope",3,"disabled"],["label","API type","controlId","llm-api-type","required",""],["dsControl","","id","llm-api-type",3,"formControl"],[3,"value"],["label","Name","controlId","llm-name","required",""],["dsControl","","id","llm-name","type","text","placeholder","e.g. OpenAI prod","autocomplete","off",3,"formControl"],["label","Description","controlId","llm-description"],["dsControl","","id","llm-description","type","text","placeholder","Optional \u2014 short description of this provider","autocomplete","off",3,"formControl"],["label","Base URL","controlId","llm-base-url"],["dsControl","","id","llm-base-url","type","url","placeholder","Optional \u2014 leave empty for default endpoint","autocomplete","off",3,"formControl"],["label","API key","controlId","llm-api-key"],["dsControl","","id","llm-api-key","type","password","placeholder","sk-\u2026","autocomplete","new-password",3,"formControl"],["label","Custom headers"],[1,"ds-stack","ds-stack--sm",3,"formArrayName"],[1,"ds-inline",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsCheck",""],["type","radio",3,"formControl","value","disabled"],["dsControl","","type","text","placeholder","Header name","formControlName","key","autocomplete","off"],["dsControl","","type","text","placeholder","Value","formControlName","value","autocomplete","off"],["dsButton","","variant","icon-danger","type","button","title","Remove header","aria-label","Remove header",3,"click"]],template:function(e,r){e&1&&(os(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),qh("click",function(){return r.cancel()}),pC(3," \u2190 AI providers "),zu()(),Iw(4,ge,2,0,"p",2)(5,Pe,26,10,"form",3),zu()),e&2&&(IE(),Vh("title",r.isEditMode()?"Edit AI provider":"New AI provider"),IE(3),ww(r.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,at,un,cn,Kt,fd,Mo,Do,Ut,Qt,Ca,fo,go,Nn,Rn,Ea,yo,bo],encapsulation:2})};export{ye as AiProviderFormComponent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {s}from'./chunk-DwEcQtO1.js';import {g,W,D as Dm,y,a as ew,G as Gu,b as pC,d as Wu,c as IE,l as lg}from'./main-JXQYBZRK.js';var A=class r{route=g(W);http=g(Dm);config=g(y);message="Authentication in progress\u2026";ngOnInit(){let e=this.route.snapshot.queryParamMap.get("code"),t=this.route.snapshot.queryParamMap.get("state"),o=this.route.snapshot.queryParamMap.get("error"),i=this.route.snapshot.queryParamMap.get("error_description");if(o){console.warn("[AgentOS OAuth Callback] OAuth error:",o,i),this.notifyParentAndClose({success:false,error:i||o});return}if(!e){console.error("[AgentOS OAuth Callback] Missing authorization code"),this.message="OAuth callback error: missing authorization code.",this.notifyParentAndClose({success:false,error:"Missing authorization code"});return}this.http.post(`${this.config.basePath}/api/oauth/callback`,{code:e,state:t}).subscribe({next:()=>{console.log("[AgentOS OAuth Callback] Backend callback resolved"),this.notifyParentAndClose({success:true});},error:a=>{console.error("[AgentOS OAuth Callback] Backend callback failed:",a),this.notifyParentAndClose({success:false,error:a?.error?.message||a?.message||"Token exchange failed"});}});}notifyParentAndClose(e){if(this.message=e.success?"Authentication complete. You can close this window.":`Authentication failed: ${e.error??"unknown error"}. You can close this window.`,window.opener)try{window.opener.postMessage(e,window.location.origin);}catch(t){console.error("[AgentOS OAuth Callback] postMessage failed:",t),localStorage.setItem(s,JSON.stringify(e));}else console.warn("[AgentOS OAuth Callback] No window.opener \u2014 localStorage fallback"),localStorage.setItem(s,JSON.stringify(e));setTimeout(()=>window.close(),1e3);}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=ew({type:r,selectors:[["agentos-oauth-callback"]],decls:2,vars:1,consts:[[2,"font-family","sans-serif","padding","2rem","text-align","center"]],template:function(t,o){t&1&&(Gu(0,"p",0),pC(1),Wu()),t&2&&(IE(),lg(o.message));},encapsulation:2,changeDetection:1})};export{A as OAuthCallbackComponent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {i}from'./chunk-Dg0rwtUo.js';import {y}from'./chunk-DwEcQtO1.js';import {g,aj as G,aP as we,a3 as vr,aw as $m,a5 as Ys,a6 as Zs,ae as Dr,ah as te,aK as my,a9 as Hl,aa as k}from'./main-JXQYBZRK.js';var u=s=>s,N="none",w="me",O=class s{nsController=g(G);exportService=g(we);userState=g(y);refresh$=new vr(void 0);namespaceId$=new vr(null);vm$=$m([this.namespaceId$,this.refresh$]).pipe(Ys(([e])=>{let n=this.loadPlatformConfigs().pipe(Zs(()=>Dr([]))),t=this.loadUserConfigs("global").pipe(Zs(()=>Dr([])));return e?$m([n,this.loadNamespaceConfigs(e).pipe(Zs(()=>Dr([]))),this.loadUserConfigs(e).pipe(Zs(()=>Dr([]))),t]).pipe(te(([i,r,c,g])=>({platform:i,namespace:r,userOnNs:c,userGlobal:g}))):$m([n,t]).pipe(te(([i,r])=>({platform:i,namespace:[],userOnNs:[],userGlobal:r})))}),my({bufferSize:1,refCount:true}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e);}refresh(){this.refresh$.next();}loadPlatformConfigs(){return this.nsController.listIntegrationConfig(N)}loadUserConfigs(e){let n=e==="global"?N:e;return this.nsController.listIntegrationConfig(n,w)}userGlobal$=i(this.refresh$,()=>this.loadUserConfigs("global"),[]);loadNamespaceConfigs(e){return e?this.nsController.listIntegrationConfig(e):Dr([])}getById(e,n){return this.nsController.getByIdIntegrationConfig(e)}create(e,n,t){let r=this.userState.currentUser()?.id;if((n==="userOnNs"||n==="userGlobal")&&!r)throw new Error(`Cannot create ${n} config before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(n==="platform"){let g={name:e.name,integrationType:e.integrationType,description:e.description,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(g)).pipe(Hl(()=>this.refresh()))}if(n==="namespace"){if(!t)throw new Error("Cannot create namespace-scoped config without a namespaceId");let g={name:e.name,integrationType:e.integrationType,description:e.description,namespaceId:t,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(g)).pipe(Hl(()=>this.refresh()))}if(n==="userOnNs"&&!t)throw new Error("Cannot create userOnNs config without a namespaceId");let c={name:e.name,integrationType:e.integrationType,description:e.description,userId:r,namespaceId:n==="userOnNs"?t:void 0,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(c)).pipe(Hl(()=>this.refresh()))}update(e,n,t,i){let r={name:n.name,integrationType:n.integrationType,description:n.description,userId:i.userId,namespaceId:i.namespaceId,parameters:n.parameters,authSettingName:n.authSettingName??void 0,autoGrant:n.autoGrant??false};return this.nsController.updateIntegrationConfig(e,u(r)).pipe(Hl(()=>this.refresh()))}delete(e,n){return this.nsController.deleteIntegrationConfig(e).pipe(Hl(()=>this.refresh()))}exportAsYaml(e){return this.exportService.exportAsYaml(e)}static \u0275fac=function(n){return new(n||s)};static \u0275prov=k({token:s,factory:s.\u0275fac,providedIn:"root"})};export{O};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {f,a9 as gd,a as fd,U as Ut,c as fo,g as go,aa as uo,ab as _a,ac as pa,v as vn,d as yn,e as fn,_ as _n,i as at,u as un,V as Vo,ad as f$1}from'./chunk-DwEcQtO1.js';import {g,W,aU as Y,M as Mi,af as ue$1,s as sf,a as ew,aV as Jb,o as os,H as Hh,I as Iw,z as zu,c as IE,w as ww,ao as Vl,a5 as Ys,a7 as Kt,ag as Gm,a6 as Zs,b as pC,R as Rw,K as qh,aW as mg,N as lI,L as Lw,aX as gg,Q as fI,T as Tw,_ as _w,aY as SC,aZ as _C,l as lg,h as Bh,a0 as RC,ay as kC,$ as dg,Y as Yu,a1 as FC,P as Pd,n as Ld,a_ as DC}from'./main-JXQYBZRK.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&&(os(0,"p",2),pC(1,"Loading usage settings\u2026"),zu());}function fe(e,a){if(e&1){let t=Rw();os(0,"ds-notice"),pC(1,"Could not load usage settings. Please try again."),zu(),os(2,"div")(3,"button",3),qh("click",function(){Pd(t);let s=Lw();return Ld(s.configuration.retry())}),pC(4,"Retry usage settings"),zu()();}}function ye(e,a){e&1&&(os(0,"p",2),pC(1,"Usage tracking is disabled."),zu());}function be(e,a){e&1&&(os(0,"ds-notice"),pC(1),zu()),e&2&&(IE(),lg(a));}function xe(e,a){e&1&&(os(0,"p",2),pC(1,"Loading usage\u2026"),zu());}function he(e,a){e&1&&(os(0,"p",12),pC(1,"No recorded usage for this period."),zu());}function Se(e,a){if(e&1&&(os(0,"p",10),pC(1),zu()),e&2){let t=Lw().$implicit;IE(),Yu("",t.aggregate.unknownCostCount," record(s) with unknown cost");}}function we(e,a){if(e&1&&(os(0,"tr",16)(1,"td",18),pC(2),zu(),os(3,"td",19),pC(4),RC(5,"number"),zu(),os(6,"td",20),pC(7),RC(8,"number"),RC(9,"number"),zu(),os(10,"td",21),pC(11),RC(12,"number"),RC(13,"number"),zu(),os(14,"td",22),pC(15),RC(16,"agentosCost"),Iw(17,Se,2,1,"p",10),zu()()),e&2){let t=a.$implicit;IE(2),lg(t.key),IE(2),lg(kC(5,8,t.aggregate.totalTokens)),IE(3),dg(" ",kC(8,10,t.aggregate.inputTokens)," / ",kC(9,12,t.aggregate.outputTokens)," "),IE(4),dg(" ",kC(12,14,t.aggregate.cacheReadTokens)," / ",kC(13,16,t.aggregate.cacheWriteTokens)," "),IE(4),Yu(" ",FC(16,18,t.aggregate.cost,t.aggregate.unknownCostCount)," "),IE(2),ww(t.aggregate.unknownCostCount>0?17:-1);}}function ve(e,a){if(e&1&&(os(0,"div",13)(1,"table",14)(2,"thead",15)(3,"tr",16)(4,"th",17),pC(5,"Name"),zu(),os(6,"th",17),pC(7,"Tokens"),zu(),os(8,"th",17),pC(9,"Input / output"),zu(),os(10,"th",17),pC(11,"Cache read / write"),zu(),os(12,"th",17),pC(13,"Estimated cost"),zu()()(),os(14,"tbody",15),Tw(15,we,18,21,"tr",16,_e),zu()()()),e&2){let t=Lw().$implicit;IE(),Bh("aria-label","Usage "+t.title.toLowerCase()),IE(14),_w(t.rows);}}function Ne(e,a){if(e&1&&(os(0,"h3",11),pC(1),zu(),Iw(2,he,2,0,"p",12)(3,ve,17,1,"div",13)),e&2){let t=a.$implicit;IE(),lg(t.title),IE(),ww(t.rows.length===0?2:3);}}function Te(e,a){if(e&1&&(Tw(0,Ne,4,2,null,null,ue),os(2,"p",10),pC(3," Unpriced usage is kept separate from known costs. Active agent runs appear here after they finish. "),zu()),e&2){let t=Lw(2);_w(SC(4,ge,_C(0,ce,t.agents()),_C(2,pe,t.models())));}}function Ee(e,a){if(e&1){let t=Rw();os(0,"form",4),qh("ngSubmit",function(){Pd(t);let s=Lw();return Ld(s.load())}),os(1,"ds-form-field",5)(2,"input",6),mg("ngModelChange",function(s){Pd(t);let m=Lw();return DC(m.from,s)||(m.from=s),Ld(s)}),zu(),lI(),zu(),os(3,"ds-form-field",7)(4,"input",8),mg("ngModelChange",function(s){Pd(t);let m=Lw();return DC(m.to,s)||(m.to=s),Ld(s)}),zu(),lI(),zu(),os(5,"button",9),pC(6,"Refresh"),zu()(),Iw(7,be,2,1,"ds-notice"),Iw(8,xe,2,0,"p",2)(9,Te,4,7);}if(e&2){let t,r=Lw();IE(2),gg("ngModel",r.from),fI(),IE(2),gg("ngModel",r.to),fI(),IE(3),ww((t=r.error())?7:-1,t),IE(),ww(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=Mi([]);models=Mi([]);error=Mi(null);loading=Mi(false);from=new Date(Date.now()-30*864e5).toISOString().slice(0,10);to=new Date().toISOString().slice(0,10);refresh=new ue$1;constructor(){sf(a=>{if(!this.configuration.enabled())return;let t=this.refresh.pipe(Vl(void 0),Ys(()=>{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),Kt):(this.loading.set(true),Gm({agents:this.api.aggregateByAgentUsageRecord(this.namespaceId,r.toISOString(),s.toISOString()),models:this.api.aggregateByModelUsageRecord(this.namespaceId,r.toISOString(),s.toISOString())}).pipe(Zs(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."),Kt))))})).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=ew({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&&(os(0,"ds-page",0),Hh(1,"ds-section-header",1),Iw(2,Ce,2,0,"p",2)(3,fe,5,0)(4,ye,2,0,"p",2)(5,Ee,10,4),zu()),t&2&&(IE(2),ww(r.configuration.state()==="loading"?2:r.configuration.state()==="error"?3:r.configuration.state()==="disabled"?4:5));},dependencies:[gd,fd,Ut,fo,go,uo,_a,pa,vn,yn,fn,_n,at,un,Vo,Jb,f$1],encapsulation:2})};export{me as NamespaceUsageComponent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {ae as N,v as vn,d as yn,e as fn,h as hn,_ as _n,i as at,u as un}from'./chunk-DwEcQtO1.js';import {g,W,F,a$ as D,ak as U,v as we,M as Mi,x as U$1,B,b0 as Fm,a as ew,o as os,K as qh,b as pC,z as zu,H as Hh,I as Iw,c as IE,J as Vh,w as ww,Y as Yu,L as Lw,l as lg}from'./main-JXQYBZRK.js';function P(l,t){if(l&1&&(os(0,"ds-notice"),pC(1),zu()),l&2){let n=Lw();IE(),lg(n.launchError());}}var T=class l{route=g(W);router=g(F);caseController=g(D);caseState=g(N);agentConfigController=g(U);destroyRef=g(we);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.params.agentConfigId;resolvedAgentConfig=null;payloadJson=Mi("");launchError=Mi(null);isLaunching=Mi(false);isLoading=Mi(false);ngOnInit(){this.isLoading.set(true),this.agentConfigController.getByIdAgentConfig(this.agentConfigId).pipe(U$1(this.destroyRef)).subscribe({next:t=>{this.resolvedAgentConfig=t,t.loopConfig!=null&&this.payloadJson.set(JSON.stringify(t.loopConfig,null,2)),this.isLoading.set(false);},error:()=>{this.isLoading.set(false);}});}launch(){return B(this,null,function*(){this.launchError.set(null),this.isLaunching.set(true);try{let t=this.resolvedAgentConfig??(yield Fm(this.agentConfigController.getByIdAgentConfig(this.agentConfigId))),n=yield Fm(this.caseController.createCase({namespaceId:this.namespaceId}));this.caseState.addCase(n);let e=n.id??"",d={content:`@${t.name} start`};yield Fm(this.caseController.addMessageCase(e,d)),this.router.navigate(["/agentos/home"],{queryParams:{ns:this.namespaceId,case:e}});}catch(t){console.error("[AgentConfigLaunch] Failed to launch loop agent",t),this.launchError.set("Failed to launch the agent loop. Please check the console for details."),this.isLaunching.set(false);}})}back(){this.router.navigate(["/agentos",this.namespaceId,"agent-configs",this.agentConfigId,"edit"]);}static \u0275fac=function(n){return new(n||l)};static \u0275cmp=ew({type:l,selectors:[["agentos-agent-config-launch"]],decls:17,vars:6,consts:[["title","Launch loop agent"],["dsButton","","variant","ghost","type","button","title","Back to agent config",3,"click"],[1,"ds-hint"],["label","Loop configuration (read-only)","controlId","agent-loop-payload"],["dsControl","","mono","","id","agent-loop-payload","rows","15","readonly","","spellcheck","false","autocomplete","off",3,"value","disabled"],["dsButton","","variant","primary","type","button",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(n,e){n&1&&(os(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),qh("click",function(){return e.back()}),pC(3," \u2190 Edit agent config "),zu()(),os(4,"p",2),pC(5," The loop configuration below is read from "),os(6,"code"),pC(7,"AgentConfig.loopConfig"),zu(),pC(8," and will be used by the backend when the agent loop starts. A new Case will be created and one child case will be launched per entity found. "),zu(),os(9,"ds-form-field",3),Hh(10,"textarea",4),zu(),Iw(11,P,2,1,"ds-notice"),os(12,"ds-form-actions")(13,"button",5),qh("click",function(){return e.launch()}),pC(14),zu(),os(15,"button",6),qh("click",function(){return e.back()}),pC(16,"Cancel"),zu()()()),n&2&&(IE(10),Vh("value",e.payloadJson())("disabled",e.isLaunching()||e.isLoading()),IE(),ww(e.launchError()?11:-1),IE(2),Vh("disabled",e.isLaunching()),IE(),Yu(" ",e.isLaunching()?"Launching\u2026":"Launch"," "),IE(),Vh("disabled",e.isLaunching()));},dependencies:[vn,yn,fn,hn,_n,at,un],encapsulation:2})};export{T as AgentConfigLaunchComponent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {g as g$1}from'./chunk-hp_96Xe0.js';import {j as e}from'./chunk-DwEcQtO1.js';import {g,v as we,M as Mi,i as VC,x as U,a as ew,X as Kb,G as Gu,b as pC,d as Wu,I as Iw,c as IE,Y as Yu,$ as dg,w as ww,R as Rw,a0 as RC,U as Uh,Z as Zh,P as Pd,L as Lw,n as Ld,l as lg,a1 as FC,f as Gh}from'./main-JXQYBZRK.js';function R(r,n){if(r&1){let e=Rw();Gu(0,"span",11),pC(1,"Remove it? The bots it created stay."),Wu(),Gu(2,"button",15),Zh("click",function(){Pd(e);let t=Lw(2);return Ld(t.remove())}),pC(3," Remove "),Wu(),Gu(4,"button",13),Zh("click",function(){Pd(e);let t=Lw(2);return Ld(t.confirmingRemove.set(false))}),pC(5,"Cancel"),Wu();}if(r&2){let e=Lw(2);IE(2),Gh("disabled",e.busy());}}function I(r,n){if(r&1){let e=Rw();Gu(0,"button",13),Zh("click",function(){Pd(e);let t=Lw(2);return Ld(t.confirmingRemove.set(true))}),pC(1,"Remove"),Wu();}}function V(r,n){if(r&1){let e=Rw();Gu(0,"div",5)(1,"span",9),pC(2),Wu(),Gu(3,"span",10),pC(4),Wu(),Gu(5,"span",11),pC(6),RC(7,"date"),Wu(),Uh(8,"span",12),Gu(9,"button",13),Zh("click",function(){Pd(e);let t=Lw();return Ld(t.replacing.set(!t.replacing()))}),pC(10,"Replace"),Wu(),Iw(11,R,6,1)(12,I,2,0,"button",14),Wu();}if(r&2){let e=n,o=Lw();IE(2),Yu("@",e.username),IE(2),lg(o.statusLabel(e.status)),IE(2),Yu("since ",FC(7,4,e.createdAt,"mediumDate")),IE(5),ww(o.confirmingRemove()?11:12);}}function z(r,n){if(r&1&&(Gu(0,"ol",6)(1,"li"),pC(2),Wu(),Gu(3,"li"),pC(4,"In BotFather's Mini App, open the bot's settings and turn Bot Management Mode on."),Wu(),Gu(5,"li"),pC(6,"Paste the bot's token below. It is stored encrypted and never shown again."),Wu()()),r&2){let e=Lw();IE(2),Yu("In ",e.platformName,', create a bot with @BotFather (/newbot), for example "AgentOS".');}}function B(r,n){if(r&1){let e=Rw();Gu(0,"form",16),Zh("submit",function(t){Pd(e);let p=Lw();return t.preventDefault(),Ld(p.save())}),Gu(1,"label",17),pC(2,"Bot manager token"),Wu(),Gu(3,"input",18),Zh("input",function(t){Pd(e);let p=Lw();return Ld(p.token.set(t.target.value))}),Wu(),Gu(4,"button",19),pC(5),Wu()();}if(r&2){let e=Lw();IE(3),Gh("value",e.token()),IE(),Gh("disabled",e.busy()||!e.token().trim()),IE(),Yu(" ",e.manager()?"Replace":"Set"," ");}}function L(r,n){r&1&&(Gu(0,"p",8),pC(1),Wu()),r&2&&(IE(),lg(n));}var D=class r{botConfig=g(g$1);destroyRef=g(we);platform="TELEGRAM";platformName=e("TELEGRAM");managers=Mi([]);manager=VC(()=>this.managers().find(n=>n.platform===this.platform)??null);replacing=Mi(false);confirmingRemove=Mi(false);token=Mi("");busy=Mi(false);error=Mi(null);ngOnInit(){this.run(this.botConfig.managers(),n=>this.managers.set(n),"Could not load the bot managers.");}statusLabel(n){return n==="RUNNING"?"Running":n.replace("_"," ").toLowerCase()}save(){let n=this.token().trim();n&&this.run(this.botConfig.setManager(this.platform,n),e=>{this.token.set(""),this.replacing.set(false),this.managers.update(o=>[...o.filter(t=>t.platform!==e.platform),e]);},`${this.platformName} refused this token, or the bot cannot manage other bots yet.`);}remove(){this.confirmingRemove.set(false),this.run(this.botConfig.removeManager(this.platform),()=>this.managers.update(n=>n.filter(e=>e.platform!==this.platform)),"Could not remove the bot manager.");}run(n,e,o){this.error.set(null),this.busy.set(true),n.pipe(U(this.destroyRef)).subscribe({next:t=>{this.busy.set(false),e(t);},error:t=>{console.error("[AdminMessaging]",o,t),this.busy.set(false),this.error.set(t?.error?.message??o);}});}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=ew({type:r,selectors:[["agentos-admin-messaging"]],decls:12,vars:6,consts:[[1,"admin-messaging"],[1,"admin-messaging__title"],[1,"admin-messaging__section"],[1,"admin-messaging__section-title"],[1,"admin-messaging__hint"],[1,"admin-messaging__row"],[1,"admin-messaging__steps"],[1,"admin-messaging__token"],["role","alert",1,"admin-messaging__error"],[1,"admin-messaging__bot"],[1,"admin-messaging__status"],[1,"admin-messaging__note"],[1,"admin-messaging__spacer"],["type","button",1,"admin-messaging__btn",3,"click"],["type","button",1,"admin-messaging__btn"],["type","button",1,"admin-messaging__btn","admin-messaging__btn--danger",3,"click","disabled"],[1,"admin-messaging__token",3,"submit"],["for","admin-messaging-token",1,"admin-messaging__label"],["id","admin-messaging-token","type","password","name","token","autocomplete","off","placeholder","123456789:AA\u2026",1,"admin-messaging__input",3,"input","value"],["type","submit",1,"admin-messaging__btn","admin-messaging__btn--primary",3,"disabled"]],template:function(e,o){if(e&1&&(Gu(0,"div",0)(1,"h1",1),pC(2,"Messaging"),Wu(),Gu(3,"section",2)(4,"h2",3),pC(5),Wu(),Gu(6,"p",4),pC(7),Wu(),Iw(8,V,13,7,"div",5)(9,z,7,1,"ol",6),Iw(10,B,6,3,"form",7),Iw(11,L,2,1,"p",8),Wu()()),e&2){let t,p;IE(5),Yu("",o.platformName," bot manager"),IE(2),dg(" The bot manager creates the ",o.platformName," bots of agents for the admins of their namespace: on an agent's page, Create a bot opens ",o.platformName,", the admin confirms, and the bot answers as the agent. Nobody copies a token. Without a bot manager, an agent can still get a bot created with @BotFather, from its token. "),IE(),ww((t=o.manager())?8:9,t),IE(2),ww(!o.manager()||o.replacing()?10:-1),IE(),ww((p=o.error())?11:-1,p);}},dependencies:[Kb],styles:[".admin-messaging[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.admin-messaging__title[_ngcontent-%COMP%]{margin:0;font-family:var(--font-heading);font-size:1.25rem;font-weight:600;color:var(--color-text)}.admin-messaging__hint[_ngcontent-%COMP%], .admin-messaging__note[_ngcontent-%COMP%]{margin:0;font-size:.8125rem;color:var(--color-text-secondary)}.admin-messaging__warning[_ngcontent-%COMP%]{margin:0;font-size:.8125rem;color:var(--color-warning, #b26a00)}.admin-messaging__error[_ngcontent-%COMP%]{margin:0;font-size:.8125rem;color:var(--color-error, #c62828)}.admin-messaging__row[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.admin-messaging__spacer[_ngcontent-%COMP%]{flex:1}.admin-messaging__bot[_ngcontent-%COMP%]{font-family:var(--font-mono, monospace);font-size:.9375rem;color:var(--color-accent);text-decoration:none}.admin-messaging__bot[_ngcontent-%COMP%]:hover{text-decoration:underline}.admin-messaging__status[_ngcontent-%COMP%]{padding:.1rem .5rem;border:1px solid var(--color-divider);border-radius:var(--radius-sm, 0);font-size:.75rem;font-weight:600}.admin-messaging__status--ok[_ngcontent-%COMP%]{border-color:var(--color-success, #2e7d32);color:var(--color-success, #2e7d32)}.admin-messaging__status--off[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.admin-messaging__status--warn[_ngcontent-%COMP%]{border-color:var(--color-warning, #b26a00);color:var(--color-warning, #b26a00)}.admin-messaging__token[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.admin-messaging__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text-secondary)}.admin-messaging__input[_ngcontent-%COMP%]{flex:1;min-width:16rem;padding:.4rem .6rem;border:1px solid var(--color-divider);border-radius:var(--radius-sm, 0);background:var(--color-bg);color:var(--color-text);font-family:var(--font-mono, monospace);font-size:.875rem}.admin-messaging__btn[_ngcontent-%COMP%]{padding:.4rem .9rem;border:1px solid var(--color-divider);border-radius:var(--radius-sm, 0);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;text-decoration:none;cursor:pointer}.admin-messaging__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.admin-messaging__btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:default}.admin-messaging__btn--primary[_ngcontent-%COMP%]{border-color:var(--color-accent);color:var(--color-accent)}.admin-messaging__btn--danger[_ngcontent-%COMP%]{border-color:var(--color-error, #c62828);color:var(--color-error, #c62828)}.admin-messaging__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem}.admin-messaging__section-title[_ngcontent-%COMP%]{margin:0;font-family:var(--font-heading);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);border-bottom:1px solid var(--color-divider);padding-bottom:.5rem}.admin-messaging__steps[_ngcontent-%COMP%]{margin:0;padding-left:1.25rem;font-size:.875rem;color:var(--color-text);line-height:1.6}"]})};export{D as AdminMessagingComponent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {q as q$1}from'./chunk-B3TB_PnM.js';import'./chunk-hp_96Xe0.js';import'./chunk-DbK9IJQd.js';import {v as vn,d as yn,l as dn,_ as _n,i as at,m as mn,G as Ni,H as On}from'./chunk-DwEcQtO1.js';import {g,W as W$1,F,v as we,ak as U$1,M as Mi,i as VC,x as U$2,a as ew,ax as $t,o as os,K as qh,b as pC,z as zu,I as Iw,c as IE,J as Vh,w as ww,L as Lw,l as lg,r as rg,Y as Yu,T as Tw,_ as _w,H as Hh,R as Rw,a0 as RC,ay as kC,P as Pd,n as Ld,az as xD}from'./main-JXQYBZRK.js';var z=(t,n)=>n.id,q=(t,n)=>n.name;function Q(t,n){t&1&&(os(0,"p",3),pC(1,"Loading\u2026"),zu());}function W(t,n){t&1&&(os(0,"ds-notice"),pC(1,"Failed to load agent definition."),zu());}function X(t,n){if(t&1&&(os(0,"dt"),pC(1,"User context"),zu(),os(2,"dd",6),pC(3),zu()),t&2){let e=Lw();IE(3),lg(e.userId);}}function Y(t,n){if(t&1){let e=Rw();os(0,"ds-card")(1,"ds-disclosure",13),qh("toggled",function(){Pd(e);let m=Lw(2);return Ld(m.toggleSystemPrompt())}),os(2,"pre",14),pC(3),zu()()();}if(t&2){let e=Lw(),d=Lw();IE(),Vh("open",!d.systemPromptCollapsed()),IE(2),lg(e.systemPrompt);}}function Z(t,n){if(t&1){let e=Rw();os(0,"ds-card")(1,"ds-disclosure",15),qh("toggled",function(){Pd(e);let m=Lw(2);return Ld(m.toggleInstructions())}),os(2,"pre",14),pC(3),zu()()();}if(t&2){let e=Lw(),d=Lw();IE(),Vh("open",!d.instructionsCollapsed()),IE(2),lg(e.instructions);}}function ee(t,n){t&1&&(os(0,"p",3),pC(1," This agent declares no skill, so it gets no skill tools. Attach skills from the edit form. "),zu());}function te(t,n){t&1&&(os(0,"span",18),pC(1,"platform"),zu());}function ne(t,n){t&1&&(os(0,"span",18),pC(1,"SKILL.md"),zu());}function ie(t,n){if(t&1&&(os(0,"li",16)(1,"span")(2,"span",17),pC(3),zu(),Iw(4,te,2,0,"span",18),Iw(5,ne,2,0,"span",18),zu(),os(6,"p",3),pC(7),zu()()),t&2){let e=n.$implicit;IE(3),lg(e.name),IE(),ww(e.namespaceId?-1:4),IE(),ww(e.readOnly?5:-1),IE(2),lg(e.description);}}function oe(t,n){if(t&1&&(os(0,"ul",11),Tw(1,ie,8,4,"li",16,z),zu()),t&2){let e=Lw(2);IE(),_w(e.resolvedSkills());}}function ae(t,n){t&1&&(os(0,"p",3),pC(1,"No tools available for this agent."),zu());}function de(t,n){if(t&1&&(Hh(0,"div",20),RC(1,"agentosMarkdown")),t&2){let e=Lw().$implicit;Vh("innerHTML",kC(1,1,e.description),xD);}}function re(t,n){if(t&1){let e=Rw();os(0,"li")(1,"ds-disclosure",19),qh("toggled",function(){let m=Pd(e).$implicit,j=Lw(3);return Ld(j.toggleTool(m))}),Iw(2,de,2,3,"div",20),os(3,"pre",21),pC(4),zu()()();}if(t&2){let e=n.$implicit,d=Lw(3);IE(),Vh("heading",e.name)("open",d.isToolExpanded(e)),IE(),ww(e.description?2:-1),IE(2),lg(d.formatSchema(e.inputSchema));}}function se(t,n){if(t&1&&(os(0,"ul",11),Tw(1,re,5,4,"li",null,q),zu()),t&2){let e=Lw();IE(),_w(e.tools);}}function le(t,n){if(t&1&&Hh(0,"agentos-agent-messaging",12),t&2){let e=Lw(2);Vh("namespaceId",e.namespaceId)("agentId",e.agentConfigId);}}function ce(t,n){if(t&1&&(os(0,"ds-card",4)(1,"dl",5)(2,"dt"),pC(3,"Name"),zu(),os(4,"dd"),pC(5),zu(),os(6,"dt"),pC(7,"Resolved model"),zu(),os(8,"dd",6),pC(9),zu(),os(10,"dt"),pC(11,"Provider"),zu(),os(12,"dd"),pC(13),zu(),os(14,"dt",7),pC(15,"Execution mode"),zu(),os(16,"dd",8)(17,"span",9),pC(18),zu()(),Iw(19,X,4,1),zu()(),Iw(20,Y,4,2,"ds-card"),Iw(21,Z,4,2,"ds-card"),os(22,"ds-card",10),Iw(23,ee,2,0,"p",3)(24,oe,3,0,"ul",11),zu(),os(25,"ds-card",10),Iw(26,ae,2,0,"p",3)(27,se,3,0,"ul",11),zu(),Iw(28,le,1,2,"agentos-agent-messaging",12)),t&2){let e=n,d=Lw();IE(5),lg(e.name),IE(4),lg(e.resolvedModelApiName),IE(4),lg(e.resolvedProviderName),IE(4),rg("agent-config-inspect__badge--active",e.executionMode!=="SIMPLE"),IE(),Yu(" ",e.executionMode," "),IE(),ww(e.userId?19:-1),IE(),ww(e.systemPrompt?20:-1),IE(),ww(e.instructions?21:-1),IE(),Vh("heading","Skills ("+d.resolvedSkills().length+")"),IE(),ww(d.resolvedSkills().length===0?23:24),IE(2),Vh("heading","Tools ("+e.tools.length+")"),IE(),ww(e.tools.length===0?26:27),IE(2),ww(d.namespaceId?28:-1);}}var U=class t{route=g(W$1);router=g(F);destroyRef=g(we);agentConfigController=g(U$1);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.params.agentConfigId;isPlatformMode=!this.namespaceId;isLoading=Mi(true);hasError=Mi(false);definition=Mi(null);expandedTools=Mi(new Set);resolvedSkills=VC(()=>this.definition()?.skills??[]);systemPromptCollapsed=Mi(true);instructionsCollapsed=Mi(true);ngOnInit(){this.agentConfigController.getDefinitionAgentConfig(this.agentConfigId).pipe(U$2(this.destroyRef)).subscribe({next:n=>{this.definition.set(n),this.isLoading.set(false);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}toggleTool(n){this.expandedTools.update(e=>{let d=new Set(e);return d.has(n.name)?d.delete(n.name):d.add(n.name),d});}isToolExpanded(n){return this.expandedTools().has(n.name)}toggleSystemPrompt(){this.systemPromptCollapsed.update(n=>!n);}toggleInstructions(){this.instructionsCollapsed.update(n=>!n);}formatSchema(n){try{return JSON.stringify(JSON.parse(n),null,2)}catch(e){return n}}editRoute(){return this.isPlatformMode?["/agentos","admin","agent-configs",this.agentConfigId,"edit"]:["/agentos",this.namespaceId,"agent-configs",this.agentConfigId,"edit"]}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ew({type:t,selectors:[["agentos-agent-config-inspect"]],decls:9,vars:2,consts:[["title","Agent definition"],["dsButton","","variant","ghost","type","button","title","Back to agent configs",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],[1,"ds-hint"],["heading","General"],["dsDefinitionList",""],[1,"ds-mono"],[1,"agent-config-inspect__dt"],[1,"agent-config-inspect__dd"],[1,"agent-config-inspect__badge"],[3,"heading"],[1,"ds-list"],[3,"namespaceId","agentId"],["heading","System Prompt",3,"toggled","open"],[1,"ds-pre","ds-pre--prose"],["heading","Instructions",3,"toggled","open"],[1,"ds-stack","ds-stack--sm"],[1,"ds-strong"],[1,"ds-meta"],["bordered","","mono","",3,"toggled","heading","open"],[1,"ds-prose","ds-hint",3,"innerHTML"],[1,"ds-pre"]],template:function(e,d){if(e&1&&(os(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),qh("click",function(){return d.back()}),pC(3," \u2190 Agent configs "),zu(),os(4,"a",2),pC(5,"Edit config \u2192"),zu()(),Iw(6,Q,2,0,"p",3)(7,W,2,0,"ds-notice")(8,ce,29,14),zu()),e&2){let m;IE(4),Vh("routerLink",d.editRoute()),IE(2),ww(d.isLoading()?6:d.hasError()?7:(m=d.definition())?8:-1,m);}},dependencies:[$t,vn,yn,dn,_n,at,mn,Ni,q$1,On],encapsulation:2})};export{U as AgentConfigInspectComponent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-DbK9IJQd.js';import {I}from'./chunk-Bsqc_xnw.js';import {g,W,F,v as we,M as Mi,x as U,ah as te$1,a5 as Ys,ae as Dr,aT as qo,a6 as Zs,ag as Gm,a as ew,o as os,K as qh,z as zu,b as pC,I as Iw,c as IE,J as Vh,w as ww,L as Lw,l as lg,q as nC,h as Bh,Y as Yu,T as Tw,_ as _w,R as Rw,P as Pd,n as Ld}from'./main-JXQYBZRK.js';import {r as k,O,a8 as w,i as at,d as yn,V as Vo,A as Ao,k as P,w as P$1}from'./chunk-DwEcQtO1.js';import'./chunk-Dg0rwtUo.js';var Q=(i,t)=>t.key;function X(i,t){if(i&1&&(os(0,"p",3),pC(1),zu()),i&2){let e=Lw();IE(),lg(e.deletion.error());}}function Z(i,t){if(i&1&&(os(0,"p"),pC(1),zu()),i&2){let e=t;nC(e.kind==="error"?"settings-table__error":"settings-table__status"),Bh("role",e.kind==="error"?"alert":"status"),IE(),Yu(" ",e.text," ");}}function ee(i,t){i&1&&(os(0,"p",5),pC(1,"Loading auth settings\u2026"),zu());}function te(i,t){i&1&&(os(0,"p",6),pC(1,"No auth settings available."),zu());}function ne(i,t){i&1&&(os(0,"p",5),pC(1,"No auth settings match the current filter."),zu());}function ie(i,t){i&1&&(os(0,"ds-tag",18),pC(1,"Read-only"),zu());}function oe(i,t){i&1&&(os(0,"ds-tag",20),pC(1,"Connected"),zu());}function ae(i,t){i&1&&(os(0,"ds-tag",18),pC(1,"Not connected"),zu());}function se(i,t){i&1&&(os(0,"span",21),pC(1,"\u2014"),zu());}function re(i,t){if(i&1){let e=Rw();os(0,"span",26),pC(1,"Waiting for authorization\u2026"),zu(),os(2,"button",27),qh("click",function(){Pd(e);let r=Lw(4);return Ld(r.cancelConnect())}),pC(3," Cancel "),zu();}if(i&2){let e=Lw(2).$implicit;IE(2),Bh("aria-label","Stop waiting for the authorization of "+e.config.name);}}function le(i,t){if(i&1){let e=Rw();os(0,"span",28),pC(1,"Disconnect?"),zu(),os(2,"button",29),qh("click",function(){Pd(e);let r=Lw(2).$implicit,d=Lw(2);return Ld(d.confirmReset(r))}),pC(3),zu(),os(4,"button",29),qh("click",function(){Pd(e);let r=Lw(4);return Ld(r.cancelReset())}),pC(5," Cancel "),zu();}if(i&2){let e=Lw(2).$implicit,n=Lw(2);IE(2),Vh("disabled",n.resettingKey()===e.key),Bh("aria-label","Confirm disconnecting "+e.config.name),IE(),Yu(" ",n.resettingKey()===e.key?"Disconnecting\u2026":"Confirm"," "),IE(),Vh("disabled",n.resettingKey()===e.key),Bh("aria-label","Cancel disconnecting "+e.config.name);}}function ce(i,t){if(i&1){let e=Rw();os(0,"button",29),qh("click",function(){Pd(e);let r=Lw(3).$implicit,d=Lw(2);return Ld(d.requestReset(r))}),pC(1," Disconnect "),zu();}if(i&2){let e=Lw(3).$implicit,n=Lw(2);Vh("disabled",n.connectingKey()!==null),Bh("aria-label","Disconnect "+e.config.name);}}function de(i,t){if(i&1){let e=Rw();os(0,"button",29),qh("click",function(){Pd(e);let r=Lw(2).$implicit,d=Lw(2);return Ld(d.connect(r))}),pC(1),zu(),Iw(2,ce,2,2,"button",30);}if(i&2){let e=Lw(2).$implicit,n=Lw(2);Vh("disabled",n.connectingKey()!==null||n.resettingKey()!==null),Bh("aria-label",(n.connectionOf(e)==="connected"?"Reconnect ":"Connect ")+e.config.name),IE(),Yu(" ",n.connectionOf(e)==="connected"?"Reconnect":"Connect"," "),IE(),ww(n.connectionOf(e)==="connected"?2:-1);}}function pe(i,t){if(i&1&&Iw(0,re,4,1)(1,le,6,5)(2,de,3,4),i&2){let e=Lw().$implicit,n=Lw(2);ww(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=Rw();os(0,"button",27),qh("click",function(){Pd(e);let r=Lw().$implicit,d=Lw(2);return Ld(d.duplicate(r))}),pC(1," Duplicate "),zu();}if(i&2){let e=Lw().$implicit;Bh("aria-label","Duplicate "+e.config.name);}}function _e(i,t){if(i&1){let e=Rw();os(0,"button",27),qh("click",function(){Pd(e);let r=Lw(2).$implicit,d=Lw(2);return Ld(d.edit(r))}),pC(1," Edit "),zu();}if(i&2){let e=Lw(2).$implicit;Bh("aria-label","Edit "+e.config.name);}}function me(i,t){if(i&1){let e=Rw();Iw(0,_e,2,1,"button",24),os(1,"agentos-row-delete-action",31),qh("deleteRequested",function(){Pd(e);let r=Lw().$implicit,d=Lw(2);return Ld(d.deletion.request(r.key))})("deleteConfirmed",function(){Pd(e);let r=Lw().$implicit,d=Lw(2);return Ld(d.confirmDelete(r))})("deleteCancelled",function(){Pd(e);let r=Lw(3);return Ld(r.deletion.cancel())}),zu();}if(i&2){let e=Lw().$implicit,n=Lw(2);ww(n.deletion.confirmingId()!==e.key?0:-1),IE(),Vh("rowKey",e.key)("rowLabel",e.config.name)("state",n.deletion);}}function ge(i,t){i&1&&(os(0,"button",25),pC(1,"Inherited"),zu());}function he(i,t){if(i&1&&(os(0,"tr",10)(1,"td",13),pC(2),zu(),os(3,"td",14),pC(4),zu(),os(5,"td",15)(6,"div",16)(7,"ds-tag",17),pC(8),zu(),Iw(9,ie,2,0,"ds-tag",18),zu()(),os(10,"td",19),Iw(11,oe,2,0,"ds-tag",20)(12,ae,2,0,"ds-tag",18)(13,se,2,0,"span",21),zu(),os(14,"td",22)(15,"div",23),Iw(16,pe,3,1),Iw(17,ue,2,1,"button",24),Iw(18,me,2,4)(19,ge,2,0,"button",25),zu()()()),i&2){let e=t.$implicit,n=Lw(2);IE(2),lg(e.config.name),IE(2),Yu(" ",e.config.authType," "),IE(3),Vh("variant",e.scopeLabel==="Platform"?"neutral":e.scopeLabel==="Personal"?"outline":"accent"),IE(),lg(e.scopeLabel),IE(),ww(e.canMutate?-1:9),IE(2),ww(n.isOAuth(e)&&n.connectionOf(e)==="connected"?11:n.isOAuth(e)&&n.connectionOf(e)==="disconnected"?12:13),IE(5),ww(n.isOAuth(e)?16:-1),IE(),ww(n.deletion.confirmingId()!==e.key&&n.resetConfirmingKey()!==e.key&&n.connectingKey()!==e.key?17:-1),IE(),ww(e.canMutate?18:19);}}function Ce(i,t){if(i&1&&(os(0,"div",7)(1,"table",8)(2,"thead",9)(3,"tr",10)(4,"th",11),pC(5,"Name"),zu(),os(6,"th",11),pC(7,"Authentication type"),zu(),os(8,"th",11),pC(9,"Scope"),zu(),os(10,"th",11),pC(11,"Connection"),zu(),os(12,"th",11)(13,"span",12),pC(14,"Actions"),zu()()()(),os(15,"tbody",9),Tw(16,he,20,9,"tr",10,Q),zu()()()),i&2){let e=Lw();IE(16),_w(e.rowFilter.filteredRows());}}var fe=new Set(["OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"]),J=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=Mi(false);isLoading=Mi(true);rows=Mi([]);deletion=k();connections=Mi({});connectingKey=Mi(null);resetConfirmingKey=Mi(null);resettingKey=Mi(null);actionMessage=Mi(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(te$1(t=>t.get("namespaceId")??""),Ys(t=>t?this.namespaceRole.isAdminOfNamespace$(t):Dr(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(qo(()=>{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(te$1(n=>[e.key,n.connected?"connected":"disconnected"]),Zs(()=>Dr([e.key,"unknown"]))));if(t.length===0){this.connections.set({});return}this.connectionsLoad=Gm(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=ew({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&&(os(0,"ds-section-header",0)(1,"agentos-table-filter",1),qh("queryChange",function(d){return n.rowFilter.query.set(d)}),zu(),os(2,"button",2),qh("click",function(){return n.openCreateForm()}),pC(3,"New auth setting"),zu()(),Iw(4,X,2,1,"p",3),Iw(5,Z,2,4,"p",4),Iw(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;IE(),Vh("query",n.rowFilter.query()),IE(3),ww(n.deletion.error()?4:-1),IE(),ww((r=n.actionMessage())?5:-1,r),IE(),ww(n.isLoading()?6:n.rows().length===0?7:n.rowFilter.filteredRows().length===0?8:9);}},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{J as AuthSettingsAllScopesComponent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {O as O$1,i as at,d as yn,V as Vo,A as Ao,k as P}from'./chunk-DwEcQtO1.js';import {g,v as we,a2 as W,a3 as vr,M as Mi,i as VC,a4 as Ne,a5 as Ys,a6 as Zs,a7 as Kt,x as U$1,a as ew,o as os,K as qh,z as zu,b as pC,I as Iw,c as IE,J as Vh,w as ww,T as Tw,L as Lw,_ as _w,Y as Yu,l as lg}from'./main-JXQYBZRK.js';function q(e){if(e.sensitive)return e.configured?{status:"hidden",text:"set (hidden)"}:{status:"unset",text:"not set"};if(!e.configured)return {status:"unset",text:"unset"};let t=e.value??"",i=t.trim().toLowerCase();return i==="true"?{status:"on",text:"on"}:i==="false"?{status:"off",text:"off"}:{status:"value",text:t===""?"(empty)":t}}var U=(e,t)=>t.key;function B(e,t){e&1&&(os(0,"p",10),pC(1,"Loading the configuration failed. Try refreshing."),zu());}function V(e,t){e&1&&(os(0,"p",11),pC(1,"Loading configuration\u2026"),zu());}function j(e,t){e&1&&(os(0,"p",12),pC(1,"The service reported no settings."),zu());}function O(e,t){e&1&&(os(0,"p",11),pC(1,"No settings match the current filters."),zu());}function Y(e,t){e&1&&(os(0,"ds-tag",22),pC(1,"on"),zu());}function z(e,t){e&1&&(os(0,"ds-tag",20),pC(1,"off"),zu());}function H(e,t){if(e&1&&(os(0,"ds-tag",20),pC(1),zu()),e&2){let i=Lw().$implicit;IE(),lg(i.display.text);}}function G(e,t){if(e&1&&(os(0,"ds-tag",23),pC(1),zu()),e&2){let i=Lw().$implicit;IE(),lg(i.display.text);}}function J(e,t){if(e&1&&(os(0,"span",24),pC(1),zu()),e&2){let i=Lw().$implicit;IE(),lg(i.display.text);}}function K(e,t){if(e&1&&(os(0,"tr",16)(1,"td",18),pC(2),zu(),os(3,"td",19)(4,"ds-tag",20),pC(5),zu()(),os(6,"td",21),Iw(7,Y,2,0,"ds-tag",22)(8,z,2,0,"ds-tag",20)(9,H,2,1,"ds-tag",20)(10,G,2,1,"ds-tag",23)(11,J,2,1,"span",24),zu(),os(12,"td",25),pC(13),zu()()),e&2){let i,a=t.$implicit,m=Lw(2);IE(2),Yu(" ",a.entry.key," "),IE(3),Yu(" ",a.entry.source===m.Source.ENVIRONMENT?"Environment":"Property"," "),IE(2),ww((i=a.display.status)==="on"?7:i==="off"?8:i==="hidden"?9:i==="unset"?10:11),IE(6),Yu(" ",a.entry.description||"\u2014"," ");}}function Q(e,t){if(e&1&&(os(0,"div",13)(1,"table",14)(2,"thead",15)(3,"tr",16)(4,"th",17),pC(5,"Setting"),zu(),os(6,"th",17),pC(7,"Source"),zu(),os(8,"th",17),pC(9,"Value"),zu(),os(10,"th",17),pC(11,"Description"),zu()()(),os(12,"tbody",15),Tw(13,K,14,4,"tr",16,U),zu()()()),e&2){let i=Lw();IE(13),_w(i.visibleRows());}}var A=class e{destroyRef=g(we);configurationController=g(W);refresh$=new vr(void 0);isLoading=Mi(true);loadError=Mi(false);rows=Mi([]);source=Mi("ALL");status=Mi("ALL");rowFilter=O$1(this.rows,t=>[t.entry.key,t.entry.description,t.entry.value].filter(Boolean).join(" "));visibleRows=VC(()=>this.rowFilter.filteredRows().filter(t=>{let i=this.source(),a=this.status();return i!=="ALL"&&t.entry.source!==i?false:a==="SET"?t.entry.configured:a==="UNSET"?!t.entry.configured:true}));Source=Ne;constructor(){this.refresh$.pipe(Ys(()=>(this.isLoading.set(true),this.loadError.set(false),this.configurationController.listEffectiveConfiguration().pipe(Zs(()=>(this.loadError.set(true),this.isLoading.set(false),Kt))))),U$1(this.destroyRef)).subscribe(t=>{this.rows.set(t.map(i=>({key:`${i.source}:${i.key}`,entry:i,display:q(i)}))),this.isLoading.set(false);});}reload(){this.refresh$.next();}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=ew({type:e,selectors:[["agentos-platform-configuration"]],decls:24,vars:6,consts:[["title","Configuration","description","Effective environment variables and Spring properties of the running service. Secrets are never shown, only whether they are set."],["label","Filter settings","placeholder","Filter settings\u2026",3,"queryChange","query"],["dsButton","","type","button",3,"click"],[1,"settings-table__toolbar"],["aria-label","Filter by source",1,"ds-control",2,"width","auto",3,"change","value"],["value","ALL"],[3,"value"],["aria-label","Filter by state",1,"ds-control",2,"width","auto",3,"change","value"],["value","SET"],["value","UNSET"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Effective configuration"],["role","rowgroup"],["role","row"],["role","columnheader"],["role","cell","data-label","Setting","data-title","",1,"settings-table__name","ds-mono"],["role","cell","data-label","Source"],["variant","neutral"],["role","cell","data-label","Value"],["variant","accent"],["variant","outline"],[1,"ds-mono"],["role","cell","data-label","Description",1,"settings-table__secondary"]],template:function(i,a){i&1&&(os(0,"ds-section-header",0)(1,"agentos-table-filter",1),qh("queryChange",function(c){return a.rowFilter.query.set(c)}),zu(),os(2,"button",2),qh("click",function(){return a.reload()}),pC(3,"Refresh"),zu()(),os(4,"div",3)(5,"select",4),qh("change",function(c){return a.source.set(c.target.value)}),os(6,"option",5),pC(7,"All sources"),zu(),os(8,"option",6),pC(9,"Environment variables"),zu(),os(10,"option",6),pC(11,"Spring properties"),zu()(),os(12,"select",7),qh("change",function(c){return a.status.set(c.target.value)}),os(13,"option",5),pC(14,"Set and unset"),zu(),os(15,"option",8),pC(16,"Set only"),zu(),os(17,"option",9),pC(18,"Unset only"),zu()()(),Iw(19,B,2,0,"p",10)(20,V,2,0,"p",11)(21,j,2,0,"p",12)(22,O,2,0,"p",11)(23,Q,15,0,"div",13)),i&2&&(IE(),Vh("query",a.rowFilter.query()),IE(4),Vh("value",a.source()),IE(3),Vh("value",a.Source.ENVIRONMENT),IE(2),Vh("value",a.Source.PROPERTY),IE(2),Vh("value",a.status()),IE(7),ww(a.loadError()?19:a.isLoading()?20:a.rows().length===0?21:a.visibleRows().length===0?22:23));},dependencies:[at,yn,Vo,Ao,P],encapsulation:2})};export{A as PlatformConfigurationComponent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {e}from'./chunk-C6dIhkYp.js';import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-DbK9IJQd.js';import {O}from'./chunk-CfX6vIYj.js';import {g,W as W$1,F,v as we,u as L,M as Mi,x as U$1,ah as te$1,a5 as Ys,ae as Dr,a as ew,o as os,K as qh,z as zu,b as pC,I as Iw,J as Vh,c as IE,w as ww,L as Lw,l as lg,T as Tw,_ as _w,Y as Yu,R as Rw,h as Bh,P as Pd,n as Ld}from'./main-JXQYBZRK.js';import {r as k,O as O$1,i as at,d as yn,V as Vo,A as Ao,k as P,w as P$1}from'./chunk-DwEcQtO1.js';import'./chunk-Dg0rwtUo.js';var Q=(n,e)=>e.key;function W(n,e){if(n&1&&(os(0,"p",3),pC(1),zu()),n&2){let t=Lw();IE(),lg(t.deletion.error());}}function X(n,e){n&1&&(os(0,"p",4),pC(1,"Loading integrations\u2026"),zu());}function Z(n,e){n&1&&(os(0,"p",5),pC(1,"No integrations available."),zu());}function ee(n,e){n&1&&(os(0,"p",4),pC(1,"No integrations match the current filter."),zu());}function te(n,e){n&1&&(os(0,"ds-tag",20),pC(1,"YAML"),zu(),os(2,"ds-tag",21),pC(3,"Read-only"),zu());}function ne(n,e){if(n&1){let t=Rw();os(0,"button",22),qh("click",function(){Pd(t);let s=Lw().$implicit,c=Lw(2);return Ld(c.view(s))}),pC(1,"View"),zu();}if(n&2){let t=Lw().$implicit;Bh("aria-label","View "+t.config.name);}}function ie(n,e){if(n&1){let t=Rw();os(0,"button",22),qh("click",function(){Pd(t);let s=Lw(3).$implicit,c=Lw(2);return Ld(c.edit(s))}),pC(1," Edit "),zu();}if(n&2){let t=Lw(3).$implicit;Bh("aria-label","Edit "+t.config.name);}}function oe(n,e){if(n&1){let t=Rw();os(0,"button",22),qh("click",function(){Pd(t);let s=Lw(2).$implicit,c=Lw(2);return Ld(c.duplicate(s))}),pC(1," Duplicate "),zu(),Iw(2,ie,2,1,"button",19);}if(n&2){let t=Lw(2).$implicit;Bh("aria-label","Duplicate "+t.config.name),IE(2),ww(t.canEdit?2:-1);}}function ae(n,e){if(n&1){let t=Rw();os(0,"agentos-row-delete-action",25),qh("deleteRequested",function(){Pd(t);let s=Lw(2).$implicit,c=Lw(2);return Ld(c.deletion.request(s.key))})("deleteConfirmed",function(){Pd(t);let s=Lw(2).$implicit,c=Lw(2);return Ld(c.confirmDelete(s))})("deleteCancelled",function(){Pd(t);let s=Lw(4);return Ld(s.deletion.cancel())}),zu();}if(n&2){let t=Lw(2).$implicit,a=Lw(2);Vh("rowKey",t.key)("rowLabel",t.config.name)("state",a.deletion);}}function re(n,e){n&1&&(os(0,"button",24),pC(1,"Inherited"),zu());}function le(n,e){if(n&1&&(Iw(0,oe,3,2),Iw(1,ae,1,3,"agentos-row-delete-action",23),Iw(2,re,2,0,"button",24)),n&2){let t=Lw().$implicit,a=Lw(2);ww(a.deletion.confirmingId()!==t.key?0:-1),IE(),ww(t.canDelete?1:-1),IE(),ww(!t.canEdit&&!t.canDelete?2:-1);}}function se(n,e){if(n&1&&(os(0,"tr",9)(1,"td",12),pC(2),zu(),os(3,"td",13),pC(4),zu(),os(5,"td",14)(6,"div",15)(7,"ds-tag",16),pC(8),zu(),Iw(9,te,4,0),zu()(),os(10,"td",17)(11,"div",18),Iw(12,ne,2,1,"button",19)(13,le,3,3),zu()()()),n&2){let t=e.$implicit;IE(2),lg(t.config.name),IE(2),Yu(" ",t.config.integrationType," "),IE(3),Vh("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),IE(),Yu(" ",t.scopeLabel," "),IE(),ww(t.source==="FILESYSTEM"?9:-1),IE(3),ww(t.source==="FILESYSTEM"?12:13);}}function ce(n,e){if(n&1&&(os(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),pC(5,"Name"),zu(),os(6,"th",10),pC(7,"Type"),zu(),os(8,"th",10),pC(9,"Scope"),zu(),os(10,"th",10)(11,"span",11),pC(12,"Actions"),zu()()()(),os(13,"tbody",8),Tw(14,se,14,6,"tr",9,Q),zu()()()),n&2){let t=Lw();IE(14),_w(t.rowFilter.filteredRows());}}var U=class n$1{route=g(W$1);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceApi=g(L);namespaceId=this.route.snapshot.params.namespaceId;namespaceName=Mi("this namespace");isAdmin=Mi(false);isLoading=Mi(true);rows=Mi([]);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(te$1(e=>e.get("namespaceId")??""),Ys(e=>e?this.namespaceRole.isAdminOfNamespace$(e):Dr(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=ew({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&&(os(0,"ds-section-header",0)(1,"agentos-table-filter",1),qh("queryChange",function(c){return a.rowFilter.query.set(c)}),zu(),os(2,"button",2),qh("click",function(){return a.openCreateForm()}),pC(3,"New integration"),zu()(),Iw(4,W,2,1,"p",3),Iw(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&&(Vh("description","Integrations for "+a.namespaceName()+", including entries inherited from the platform."),IE(),Vh("query",a.rowFilter.query()),IE(3),ww(a.deletion.error()?4:-1),IE(),ww(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{U as IntegrationsAllScopesComponent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {y,p as pt,T as Te,b as bn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,Q as Qt,c as fo,g as go,R as Rn,E as Ea,v as vn,d as yn,e as fn,h as hn,l as dn,i as at,u as un,m as mn,A as Ao}from'./chunk-DwEcQtO1.js';import {g,v as we,W,u as L,M as Mi,x as U,a as ew,o as os,H as Hh,K as qh,I as Iw,z as zu,N as lI,b as pC,c as IE,J as Vh,w as ww,Q as fI,Y as Yu,a8 as Re,a9 as Hl,aa as k,L as Lw,R as Rw,l as lg,ab as Sn,P as Pd,n as Ld,T as Tw,_ as _w}from'./main-JXQYBZRK.js';var I=class e{api=g(Re);isLoading=Mi(false);result=Mi(null);errorMessage=Mi(null);invoke(t,n,o,l){return this.isLoading.set(true),this.result.set(null),this.errorMessage.set(null),this.api.invoke({namespaceId:t,userId:n||void 0,toolName:o,payload:l||void 0}).pipe(Hl({next:v=>{this.result.set(v),this.isLoading.set(false);},error:v=>{this.errorMessage.set(le(v)),this.isLoading.set(false);}}))}reset(){this.result.set(null),this.errorMessage.set(null);}static \u0275fac=function(n){return new(n||e)};static \u0275prov=k({token:e,factory:e.\u0275fac,providedIn:"root"})};function le(e){if(e instanceof Sn){let t=e.error;return t&&typeof t=="object"&&"message"in t&&typeof t.message=="string"?t.message:typeof t=="string"&&t.trim().length>0?t:e.statusText||`HTTP ${e.status}`}return e instanceof Error?e.message:"Unknown error"}var de=(e,t)=>t.id;function me(e,t){e&1&&(os(0,"p",14),pC(1,"Loading namespaces\u2026"),zu());}function pe(e,t){if(e&1&&(os(0,"option",17),pC(1),zu()),e&2){let n=t.$implicit;Vh("value",n.id),IE(),lg(n.name);}}function ce(e,t){if(e&1&&(os(0,"select",15)(1,"option",16),pC(2,"Select a namespace"),zu(),Tw(3,pe,2,2,"option",17,de),zu(),lI()),e&2){let n=Lw(2);fI(),IE(3),_w(n.namespaces());}}function ue(e,t){if(e&1&&Iw(0,me,2,0,"p",14)(1,ce,5,0,"select",15),e&2){let n=Lw();ww(n.namespacesLoading()?0:1);}}function fe(e,t){if(e&1&&Hh(0,"input",3),e&2){let n=Lw();Vh("value",n.namespaceName()??n.namespaceId);}}function ge(e,t){if(e&1){let n=Rw();os(0,"button",18),qh("click",function(){Pd(n);let l=Lw();return Ld(l.reset())}),pC(1,"Clear result"),zu();}}function ve(e,t){e&1&&(os(0,"ds-card",12)(1,"pre",19),pC(2),zu()()),e&2&&(IE(2),lg(t));}function ye(e,t){e&1&&(os(0,"span",21),pC(1,"Metadata"),zu(),os(2,"pre",19),pC(3),zu()),e&2&&(IE(3),lg(t));}function Ce(e,t){if(e&1&&(os(0,"dt"),pC(1,"Type"),zu(),os(2,"dd",23),pC(3),zu()),e&2){let n=Lw(2);IE(3),lg(n.errorType);}}function _e(e,t){if(e&1&&(os(0,"dt"),pC(1,"Message"),zu(),os(2,"dd"),pC(3),zu()),e&2){let n=Lw(2);IE(3),lg(n.errorMessage);}}function be(e,t){if(e&1&&(os(0,"span",21),pC(1,"Tool error details"),zu(),os(2,"dl",22),Iw(3,Ce,4,1),Iw(4,_e,4,1),zu()),e&2){let n=Lw();IE(3),ww(n.errorType?3:-1),IE(),ww(n.errorMessage?4:-1);}}function he(e,t){if(e&1&&(os(0,"ds-card",13)(1,"div")(2,"ds-tag",20),pC(3),zu()(),os(4,"span",21),pC(5,"Output"),zu(),os(6,"pre",19),pC(7),zu(),Iw(8,ye,4,1),os(9,"span",21),pC(10,"Structured output"),zu(),os(11,"pre",19),pC(12),zu(),Iw(13,be,5,2),zu()),e&2){let n,o=t,l=Lw();Vh("heading","Result \u2014 "+o.toolName),IE(2),Vh("variant",o.success?"accent":"outline"),IE(),lg(o.success?"Success":"Tool error"),IE(4),lg(o.output),IE(),ww((n=l.formatMetadata(o.metadata))?8:-1,n),IE(4),lg(l.formatStructuredOutput(o.structuredOutput)??"null"),IE(),ww(o.errorType||o.errorMessage?13:-1);}}var re=class e{destroyRef=g(we);route=g(W);namespaceController=g(L);userState=g(y);state=g(I);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;namespaces=Mi([]);namespacesLoading=Mi(true);namespaceName=Mi(null);form=new pt({namespaceId:new Te("",{nonNullable:true,validators:[bn.required]}),userId:new Te("",{nonNullable:true}),toolName:new Te("",{nonNullable:true,validators:[bn.required]}),payload:new Te("",{nonNullable:true})});ngOnInit(){let t=this.userState.currentUser()?.id;t?this.form.controls.userId.patchValue(t):this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:n=>{n.id&&this.form.controls.userId.patchValue(n.id);}}),this.isPlatformMode?this.namespaceController.listAllNamespace().pipe(U(this.destroyRef)).subscribe({next:n=>{this.namespaces.set(n.map(o=>({id:o.id,name:o.name}))),this.namespacesLoading.set(false);},error:()=>this.namespacesLoading.set(false)}):(this.form.controls.namespaceId.patchValue(this.namespaceId),this.namespacesLoading.set(false),this.namespaceController.getByIdNamespace(this.namespaceId).pipe(U(this.destroyRef)).subscribe({next:n=>this.namespaceName.set(n.name),error:()=>this.namespaceName.set(this.namespaceId)}));}submit(){if(this.form.invalid||this.state.isLoading())return;let{namespaceId:t,userId:n,toolName:o,payload:l}=this.form.getRawValue();this.state.invoke(t,n.trim()||void 0,o.trim(),l.trim()||void 0).pipe(U(this.destroyRef)).subscribe();}reset(){this.state.reset();}formatMetadata(t){return !t||Object.keys(t).length===0?null:JSON.stringify(t,null,2)}formatStructuredOutput(t){return t===void 0?null:JSON.stringify(t,null,2)}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=ew({type:e,selectors:[["agentos-tool-invoke"]],decls:18,vars:8,consts:[["title","Tool invoke",3,"description"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Namespace","controlId","ti-namespace","required",""],["dsControl","","id","ti-namespace","type","text","readonly","",3,"value"],["label","User ID","labelHint","optional","controlId","ti-user"],["dsControl","","id","ti-user","type","text","formControlName","userId","placeholder","UUID of the user \u2014 adds user-scoped overlay layers","autocomplete","off"],["label","Tool name","controlId","ti-tool","required","","hint","Exact tool name as returned by the agent definition inspect page. When not found, the error response lists all available tools for the selected namespace."],["dsControl","","mono","","id","ti-tool","type","text","formControlName","toolName","placeholder","e.g. MY_FILES__listFiles","autocomplete","off","spellcheck","false"],["label","Payload","labelHint","optional","controlId","ti-payload"],["dsControl","","mono","","id","ti-payload","formControlName","payload","rows","6","placeholder",'JSON arguments for the tool, e.g. {"path": "/some/dir"} \u2014 leave empty for tools with no input.',"spellcheck","false"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button"],["heading","Error"],[3,"heading"],[1,"ds-hint"],["dsControl","","id","ti-namespace","formControlName","namespaceId"],["value","","disabled",""],[3,"value"],["dsButton","","type","button",3,"click"],[1,"ds-pre"],[3,"variant"],[1,"ds-micro"],["dsDefinitionList",""],[1,"ds-mono"]],template:function(n,o){if(n&1&&(os(0,"ds-page"),Hh(1,"ds-section-header",0),os(2,"form",1),qh("ngSubmit",function(){return o.submit()}),os(3,"ds-form-field",2),Iw(4,ue,2,1)(5,fe,1,1,"input",3),zu(),os(6,"ds-form-field",4),Hh(7,"input",5),lI(),zu(),os(8,"ds-form-field",6),Hh(9,"input",7),lI(),zu(),os(10,"ds-form-field",8),Hh(11,"textarea",9),lI(),zu(),os(12,"ds-form-actions")(13,"button",10),pC(14),zu(),Iw(15,ge,2,0,"button",11),zu()(),Iw(16,ve,3,1,"ds-card",12),Iw(17,he,14,7,"ds-card",13),zu()),n&2){let l,v;IE(),Vh("description",o.isPlatformMode?"Execute any registered tool directly \u2014 bypasses the normal agent-run pipeline. Restricted to super-admins.":"Execute a registered tool directly in this namespace \u2014 bypasses the normal agent-run pipeline."),IE(),Vh("formGroup",o.form),IE(2),ww(o.isPlatformMode?4:5),IE(3),fI(),IE(2),fI(),IE(2),fI(),IE(2),Vh("disabled",o.form.invalid||o.state.isLoading()),IE(),Yu(" ",o.state.isLoading()?"Running\u2026":"Run tool"," "),IE(),ww(o.state.result()||o.state.errorMessage()?15:-1),IE(),ww((l=o.state.errorMessage())?16:-1,l),IE(),ww((v=o.state.result())?17:-1,v);}},dependencies:[Kt,fd,Mo,Do,Ut,Qt,fo,go,Rn,Ea,vn,yn,fn,hn,dn,at,un,mn,Ao],encapsulation:2})};export{re as ToolInvokeComponent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {n}from'./chunk-CfgXrte_.js';import {O}from'./chunk-C4i-jeuv.js';import {v}from'./chunk-DbK9IJQd.js';import {g,W as W$1,F,v as we,M as Mi,x as U$1,ah as te$1,a5 as Ys,ae as Dr,a as ew,o as os,K as qh,z as zu,b as pC,I as Iw,c as IE,J as Vh,w as ww,L as Lw,l as lg,T as Tw,_ as _w,R as Rw,h as Bh,P as Pd,n as Ld}from'./main-JXQYBZRK.js';import {r as k,O as O$1,i as at,d as yn,V as Vo,A as Ao,k as P,w as P$1}from'./chunk-DwEcQtO1.js';import'./chunk-Dg0rwtUo.js';var H=(i,e)=>e.key;function U(i,e){if(i&1&&(os(0,"p",3),pC(1),zu()),i&2){let t=Lw();IE(),lg(t.deletion.error());}}function z(i,e){i&1&&(os(0,"p",4),pC(1,"Loading AI providers\u2026"),zu());}function J(i,e){i&1&&(os(0,"p",5),pC(1,"No AI providers available."),zu());}function Q(i,e){i&1&&(os(0,"p",4),pC(1,"No AI providers match the current filter."),zu());}function W(i,e){i&1&&(os(0,"ds-tag",17),pC(1,"Read-only"),zu());}function X(i,e){if(i&1){let t=Rw();os(0,"button",22),qh("click",function(){Pd(t);let d=Lw().$implicit,c=Lw(2);return Ld(c.duplicate(d))}),pC(1," Duplicate "),zu();}if(i&2){let t=Lw().$implicit;Bh("aria-label","Duplicate "+t.config.name);}}function Y(i,e){if(i&1){let t=Rw();os(0,"button",22),qh("click",function(){Pd(t);let d=Lw(2).$implicit,c=Lw(2);return Ld(c.edit(d))}),pC(1," Edit "),zu();}if(i&2){let t=Lw(2).$implicit;Bh("aria-label","Edit "+t.config.name);}}function Z(i,e){if(i&1){let t=Rw();Iw(0,Y,2,1,"button",20),os(1,"agentos-row-delete-action",23),qh("deleteRequested",function(){Pd(t);let d=Lw().$implicit,c=Lw(2);return Ld(c.deletion.request(d.key))})("deleteConfirmed",function(){Pd(t);let d=Lw().$implicit,c=Lw(2);return Ld(c.confirmDelete(d))})("deleteCancelled",function(){Pd(t);let d=Lw(3);return Ld(d.deletion.cancel())}),zu();}if(i&2){let t=Lw().$implicit,r=Lw(2);ww(r.deletion.confirmingId()!==t.key?0:-1),IE(),Vh("rowKey",t.key)("rowLabel",t.config.name)("state",r.deletion);}}function ee(i,e){i&1&&(os(0,"button",21),pC(1,"Inherited"),zu());}function te(i,e){if(i&1&&(os(0,"tr",9)(1,"td",12),pC(2),zu(),os(3,"td",13),pC(4),zu(),os(5,"td",14)(6,"div",15)(7,"ds-tag",16),pC(8),zu(),Iw(9,W,2,0,"ds-tag",17),zu()(),os(10,"td",18)(11,"div",19),Iw(12,X,2,1,"button",20),Iw(13,Z,2,4)(14,ee,2,0,"button",21),zu()()()),i&2){let t=e.$implicit,r=Lw(2);IE(2),lg(t.config.name),IE(2),lg(t.config.apiType),IE(3),Vh("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),IE(),lg(t.scopeLabel),IE(),ww(t.canMutate?-1:9),IE(3),ww(r.deletion.confirmingId()!==t.key?12:-1),IE(),ww(t.canMutate?13:14);}}function ie(i,e){if(i&1&&(os(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),pC(5,"Name"),zu(),os(6,"th",10),pC(7,"API type"),zu(),os(8,"th",10),pC(9,"Scope"),zu(),os(10,"th",10)(11,"span",11),pC(12,"Actions"),zu()()()(),os(13,"tbody",8),Tw(14,te,15,7,"tr",9,H),zu()()()),i&2){let t=Lw();IE(14),_w(t.rowFilter.filteredRows());}}var G=class i{route=g(W$1);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=Mi(false);isLoading=Mi(true);rows=Mi([]);deletion=k();rowFilter=O$1(this.rows,e=>[e.config.name,e.config.apiType,e.scopeLabel].join(" "));ngOnInit(){this.route.paramMap.pipe(U$1(this.destroyRef)).subscribe(e=>{let t=e.get("namespaceId")??"";t&&t!==this.namespaceId&&(this.namespaceId=t),this.state.setNamespace(t);}),this.route.paramMap.pipe(te$1(e=>e.get("namespaceId")??""),Ys(e=>e?this.namespaceRole.isAdminOfNamespace$(e):Dr(false)),U$1(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.rows.set(this.toRows(e)),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-providers","new"],{queryParams:{scope:n(this.isAdmin())}});}edit(e){!e.canMutate||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"ai-providers",e.config.id,"edit"],{queryParams:{scope:e.scope}});}confirmDelete(e){!e.canMutate||!e.config.id||this.deletion.execute(e.key,{request$:this.state.delete(e.config.id,e.scope).pipe(U$1(this.destroyRef)),errorMessage:`Deleting "${e.config.name}" failed. Try again.`});}duplicate(e){if(!e.config.id)return;let t=e.scope==="platform"||e.scope==="namespace"&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"ai-providers","new"],{queryParams:{scope:t,template:e.config.id,templateScope:e.scope}});}toRows(e){return [...this.mapScope(e.platform,"platform","Platform",false),...this.mapScope(e.namespace,"namespace","Namespace",this.isAdmin()),...this.mapScope(e.userOnNs,"userOnNs","Personal",true),...this.mapScope(e.userGlobal,"userGlobal","Personal",true)]}mapScope(e,t,r,d){return e.map((c,K)=>({key:`${t}:${c.id??K}`,config:c,scope:t,scopeLabel:r,canMutate:d}))}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=ew({type:i,selectors:[["agentos-ai-providers-all-scopes"]],decls:9,vars:3,consts:[["title","AI providers","description","AI providers available in this namespace, including inherited platform and personal entries."],["label","Filter AI providers","placeholder","Filter AI providers\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","AI providers"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","API type",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["type","button","disabled",""],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,r){t&1&&(os(0,"ds-section-header",0)(1,"agentos-table-filter",1),qh("queryChange",function(c){return r.rowFilter.query.set(c)}),zu(),os(2,"button",2),qh("click",function(){return r.openCreateForm()}),pC(3,"New AI provider"),zu()(),Iw(4,U,2,1,"p",3),Iw(5,z,2,0,"p",4)(6,J,2,0,"p",5)(7,Q,2,0,"p",4)(8,ie,16,0,"div",6)),t&2&&(IE(),Vh("query",r.rowFilter.query()),IE(3),ww(r.deletion.error()?4:-1),IE(),ww(r.isLoading()?5:r.rows().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{G as AiProvidersAllScopesComponent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {x as m,p as pt,W as Wt,T as Te,b as bn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,Q as Qt,c as fo,g as go,N as Nn,R as Rn,E as Ea,z as yo,B as bo,v as vn,d as yn,e as fn,n as pn,h as hn,_ as _n,i as at,u as un}from'./chunk-DwEcQtO1.js';import {g,W,F,v as we,ak as U,M as Mi,x as U$1,a6 as Zs,ae as Dr,E as x,C as w,a as ew,o as os,K as qh,b as pC,z as zu,I as Iw,c as IE,J as Vh,Y as Yu,w as ww,R as Rw,H as Hh,N as lI,T as Tw,aq as Cw,L as Lw,Q as fI,l as lg,_ as _w,h as Bh,P as Pd,n as Ld}from'./main-JXQYBZRK.js';var ce=(o,t)=>t.id;function ue(o,t){o&1&&(os(0,"p",2),pC(1,"Loading\u2026"),zu());}function fe(o,t){if(o&1&&(os(0,"ds-form-field",20),Hh(1,"input",22),zu()),o&2){let e=Lw(3);IE(),Vh("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function ge(o,t){if(o&1&&(os(0,"option",24),pC(1),zu()),o&2){let e=t.$implicit;Vh("ngValue",e.id),IE(),lg(e.name);}}function Ce(o,t){if(o&1&&(os(0,"ds-form-field",21)(1,"select",23)(2,"option",24),pC(3,"\u2014 None \u2014"),zu(),Tw(4,ge,2,2,"option",24,ce),zu(),lI(),zu()),o&2){let e=Lw(3);IE(),Vh("formControl",e.agentConfigIdControl),fI(),IE(),Vh("ngValue",null),IE(2),_w(e.availableAgentConfigs());}}function ye(o,t){if(o&1&&Iw(0,fe,2,1,"ds-form-field",20)(1,Ce,6,2,"ds-form-field",21),o&2){let e=Lw(2);ww(e.isEditMode()&&e.agentConfigIdControl.value?0:e.isEditMode()?-1:1);}}function ve(o,t){o&1&&(os(0,"p",2),pC(1,"No parameters defined."),zu());}function he(o,t){if(o&1){let e=Rw();os(0,"div",11)(1,"div",25)(2,"ds-form-field",26),Hh(3,"input",27),lI(),zu(),os(4,"ds-form-field",28),Hh(5,"input",29),lI(),zu(),os(6,"ds-form-field",30),Hh(7,"input",31),lI(),zu()(),os(8,"button",32),qh("click",function(){let d=Pd(e).$index,m=Lw(2);return Ld(m.removeParameter(d))}),pC(9," \xD7 "),zu()();}if(o&2){let e=t.$implicit,r=t.$index;Vh("formGroupName",r),IE(2),Vh("controlId","param-name-"+r)("error",e.controls.name.invalid&&e.controls.name.touched?"Parameter name is required.":null),IE(),Vh("id","param-name-"+r),fI(),IE(),Vh("controlId","param-desc-"+r),IE(),Vh("id","param-desc-"+r),fI(),IE(),Vh("controlId","param-default-"+r),IE(),Vh("id","param-default-"+r),fI();}}function _e(o,t){if(o&1){let e=Rw();os(0,"div",14)(1,"span",33),pC(2),zu(),os(3,"ds-form-field",34),Hh(4,"textarea",35),lI(),zu(),os(5,"button",36),qh("click",function(){let d=Pd(e).$index,m=Lw(2);return Ld(m.removeContentEntry(d))}),pC(6," \xD7 "),zu()();}if(o&2){let e=t.$implicit,r=t.$index,d=Lw(2);IE(2),lg(r+1),IE(),Vh("error",e.invalid&&e.touched?"Content entry must not be blank.":null),IE(),Vh("formControlName",r),Bh("aria-label","Content entry "+(r+1)),fI(),IE(),Vh("disabled",d.contentArray.length===1);}}function xe(o,t){if(o&1&&(os(0,"ds-notice"),pC(1),zu()),o&2){let e=Lw(2);IE(),lg(e.errorMessage());}}function be(o,t){if(o&1){let e=Rw();os(0,"button",37),qh("click",function(){Pd(e);let d=Lw(2);return Ld(d.exportYaml())}),pC(1),zu();}if(o&2){let e=Lw(2);Vh("disabled",e.isExporting()),IE(),Yu(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ee(o,t){if(o&1){let e=Rw();os(0,"form",4),qh("ngSubmit",function(){Pd(e);let d=Lw();return Ld(d.submit())}),os(1,"ds-form-field",5),Hh(2,"input",6),lI(),zu(),os(3,"ds-form-field",7),Hh(4,"input",8),lI(),zu(),Iw(5,ye,2,1),os(6,"ds-fieldset",9)(7,"p",2),pC(8," Each parameter must have a name and a default value. Use "),os(9,"code"),pC(10),zu(),pC(11," in content entries to reference them. "),zu(),os(12,"div",10),Iw(13,ve,2,0,"p",2),Tw(14,he,10,8,"div",11,Cw),os(16,"div")(17,"button",12),qh("click",function(){Pd(e);let d=Lw();return Ld(d.addParameter())}),pC(18,"+ Add parameter"),zu()()()(),os(19,"ds-fieldset",13)(20,"p",2),pC(21," Each content entry is a command. Use "),os(22,"code"),pC(23,"@AgentName"),zu(),pC(24," to target an agent, "),os(25,"code"),pC(26,"/promptName param1 param2"),zu(),pC(27," to call another prompt, and "),os(28,"code"),pC(29),zu(),pC(30," for parameter placeholders. "),zu(),os(31,"div",10),Tw(32,_e,7,5,"div",14,Cw),os(34,"div")(35,"button",12),qh("click",function(){Pd(e);let d=Lw();return Ld(d.addContentEntry())}),pC(36,"+ Add content entry"),zu()()()(),Iw(37,xe,2,1,"ds-notice"),os(38,"ds-form-field",15),Hh(39,"textarea",16),lI(),zu(),os(40,"ds-form-actions")(41,"button",17),pC(42),zu(),Iw(43,be,2,2,"button",18),os(44,"button",19),qh("click",function(){Pd(e);let d=Lw();return Ld(d.cancel())}),pC(45,"Cancel"),zu()()();}if(o&2){let e=Lw();Vh("formGroup",e.form),IE(),Vh("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),IE(),Vh("formControl",e.nameControl),fI(),IE(2),Vh("formControl",e.descriptionControl),fI(),IE(),ww(e.availableAgentConfigs().length>0?5:-1),IE(5),lg(e.paramPlaceholderSyntax),IE(2),Vh("formArrayName","parameters"),IE(),ww(e.parametersArray.length===0?13:-1),IE(),_w(e.parametersArray.controls),IE(15),lg(e.paramPlaceholderSyntax),IE(2),Vh("formArrayName","content"),IE(),_w(e.contentArray.controls),IE(5),ww(e.errorMessage()?37:-1),IE(),Vh("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),IE(),Vh("formControl",e.externalMetadataJsonControl),fI(),IE(2),Vh("disabled",e.form.invalid||e.isSubmitting()),IE(),Yu(" ",e.isEditMode()?"Save changes":"Create"," "),IE(),ww(e.isEditMode()?43:-1);}}var pe=class o{route=g(W);router=g(F);destroyRef=g(we);promptState=g(m);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te(null),agentConfigId:new Te(null),externalMetadataJson:new Te("",{nonNullable:true,validators:[Pe]}),content:new Wt([this.createContentControl()],{validators:[bn.required]}),parameters:new Wt([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=Mi(false);isSubmitting=Mi(false);isLoading=Mi(false);isExporting=Mi(false);errorMessage=Mi(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=Mi([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(true),this.loadPrompt(t)),this.isPlatformMode?this.loadPlatformAgentConfigs():this.namespaceId&&this.loadAgentConfigs(this.namespaceId);}loadPrompt(t){this.isLoading.set(true),this.promptState.getById(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadAgentConfigs(t){this.agentConfigController.listByParentAgentConfig(t).pipe(U$1(this.destroyRef),Zs(()=>Dr([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U$1(this.destroyRef),Zs(()=>Dr([]))).subscribe(t=>this.agentConfigs.set(t));}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(r=>this.contentArray.push(this.createContentControl(r))),this.parametersArray.clear(),(t.parameters??[]).forEach(r=>this.parametersArray.push(this.createParameterGroup(r))),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}createContentControl(t=""){return new Te(t,{nonNullable:true,validators:[bn.required,bn.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl());}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t);}createParameterGroup(t){return new pt({name:new Te(t?.name??"",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te(t?.description??null),defaultValue:new Te(t?.defaultValue??"",{nonNullable:true,validators:[bn.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup());}removeParameter(t){this.parametersArray.removeAt(t);}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId,sourceLanguage:this.existingPrompt?.sourceLanguage??"en",name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(m=>m.value.trim()),parameters:this.parametersArray.controls.map(m=>({name:m.controls.name.value.trim(),description:m.controls.description.value?.trim()||void 0,defaultValue:m.controls.defaultValue.value.trim()}))});t||(e.agentConfigId=this.agentConfigIdControl.value||null);let r=this.externalMetadataJsonControl.value.trim();e.externalMetadata=r?JSON.parse(r):null;let d=t?this.promptState.update(this.existingPrompt.id,e):this.promptState.create(e);this.errorMessage.set(null),d.pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:m=>{this.isSubmitting.set(false),m.status===409?this.errorMessage.set(`A prompt named "${e.name}" already exists in this scope.`):m.status===400?this.errorMessage.set(m.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}exportYaml(){let t=this.existingPrompt?.id;!t||this.isExporting()||(this.isExporting.set(true),this.promptState.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let r=new Blob([e],{type:"application/yaml"}),d=URL.createObjectURL(r),m=document.createElement("a");m.href=d,m.download=`${this.existingPrompt?.name??"prompt"}.yaml`,m.click(),URL.revokeObjectURL(d),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"]);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=ew({type:o,selectors:[["agentos-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","prompt-name","required","",3,"error"],["dsControl","","id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",3,"formControl"],["label","Description","controlId","prompt-description"],["dsControl","","id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",3,"formControl"],["legend","Parameters","legendHint","Named placeholders used in content"],[1,"ds-stack",3,"formArrayName"],[1,"ds-panel","ds-inline","ds-inline--start",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["legend","Content","legendHint","Ordered list of text commands"],[1,"ds-inline","ds-inline--start"],["label","External Metadata","controlId","prompt-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["label","Agent Config","hint","Agent Config cannot be changed after creation."],["label","Agent Config","controlId","prompt-agent-config","hint","Optional. Links this prompt to an agent as a starter. Immutable after creation."],["dsControl","","type","text","readonly","",3,"value"],["dsControl","","id","prompt-agent-config",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-grow"],["label","Name","required","",3,"controlId","error"],["dsControl","","type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",3,"id"],["label","Description",3,"controlId"],["dsControl","","type","text","placeholder","Optional","formControlName","description","autocomplete","off",3,"id"],["label","Default value",3,"controlId"],["dsControl","","type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",3,"id"],["dsButton","","variant","icon-danger","type","button","title","Remove this parameter","aria-label","Remove this parameter",3,"click"],[1,"ds-index"],["grow","",3,"error"],["dsControl","","rows","4","placeholder","Enter a command\u2026",3,"formControlName"],["dsButton","","variant","icon-danger","type","button","title","Remove this entry","aria-label","Remove this entry",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,r){e&1&&(os(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),qh("click",function(){return r.cancel()}),pC(3),zu()(),Iw(4,ue,2,0,"p",2)(5,Ee,46,16,"form",3),zu()),e&2&&(IE(),Vh("title",r.isEditMode()?"Edit prompt":"New prompt"),IE(2),Yu(" \u2190 ",r.isPlatformMode?"Platform prompts":"Prompts"," "),IE(),ww(r.isLoading()?4:5));},dependencies:[Kt,fd,Mo,Do,Ut,Qt,fo,go,Nn,Rn,Ea,yo,bo,vn,yn,fn,pn,hn,_n,at,un],encapsulation:2})};function Pe(o){let t=o.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}export{pe as PromptFormComponent};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {v}from'./chunk-DbK9IJQd.js';import {I,n as nt,i as it}from'./chunk-Bsqc_xnw.js';import {g,W,F,v as we,M as Mi,ad as F$1,i as VC,s as sf,x as U,E as x,C as w,a as ew,o as os,K as qh,b as pC,z as zu,I as Iw,c as IE,J as Vh,w as ww,R as Rw,T as Tw,as as bw,N as lI,H as Hh,L as Lw,Q as fI,_ as _w,Y as Yu,ai as Dw,l as lg,h as Bh,P as Pd,n as Ld}from'./main-JXQYBZRK.js';import {T as Te,b as bn,p as pt,v as vn,d as yn,e as fn,n as pn,h as hn,i as at,u as un,o as cn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,Q as Qt,C as Ca,c as fo,g as go,N as Nn,R as Rn}from'./chunk-DwEcQtO1.js';import'./chunk-Dg0rwtUo.js';function Ce(i,t){i&1&&(os(0,"p",2),pC(1,"Loading\u2026"),zu());}function ye(i,t){if(i&1&&(os(0,"label",16),Hh(1,"input",17),lI(),pC(2),zu()),i&2){let e=t.$implicit,n=Lw(3);IE(),Vh("formControl",n.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!n.isAdmin()),fI(),IE(),Yu(" ",e.label," ");}}function ge(i,t){if(i&1&&(os(0,"ds-fieldset",5),Tw(1,ye,3,4,"label",16,Dw().trackByScope,true),zu()),i&2){let e=Lw(2);Vh("disabled",e.isEditMode()),IE(),_w(e.scopeOptions);}}function fe(i,t){if(i&1&&(os(0,"option",8),pC(1),zu()),i&2){let e=t.$implicit,n=Lw(2);Vh("value",e),IE(),lg(n.authTypeLabel[e]);}}function Se(i,t){if(i&1&&(os(0,"ds-form-field",18),Hh(1,"input",19),lI(),zu()),i&2){let e=Lw().$implicit;Vh("label",e.label)("controlId","as-cred-"+e.key)("required",e.required)("hint",e.hint??null)("hintId","as-hint-"+e.key),IE(),Vh("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),Bh("aria-describedby",e.hint?"as-hint-"+e.key:null),fI();}}function Ae(i,t){if(i&1&&Iw(0,Se,2,11,"ds-form-field",18),i&2){let e,n=t.$implicit,o=Lw(3);ww((e=o.controlForField(n.key))?0:-1,e);}}function ve(i,t){if(i&1&&(os(0,"ds-fieldset",13),Tw(1,Ae,1,1,null,null,Dw().trackByField,true),zu()),i&2){let e=Lw(2);Vh("hint","Values are stored encrypted and masked on read."+(e.isEditMode()?" Leave a field unchanged to keep the stored credential.":"")),IE(),_w(e.credentialFields());}}function be(i,t){if(i&1){let e=Rw();os(0,"form",4),qh("ngSubmit",function(){Pd(e);let o=Lw();return Ld(o.submit())}),Iw(1,ge,3,1,"ds-fieldset",5),os(2,"ds-form-field",6)(3,"select",7),Tw(4,fe,2,2,"option",8,bw),zu(),lI(),zu(),os(6,"ds-form-field",9),Hh(7,"input",10),lI(),zu(),os(8,"ds-form-field",11),Hh(9,"input",12),lI(),zu(),Iw(10,ve,3,1,"ds-fieldset",13),os(11,"ds-form-actions")(12,"button",14),pC(13),zu(),os(14,"button",15),qh("click",function(){Pd(e);let o=Lw();return Ld(o.cancel())}),pC(15,"Cancel"),zu()()();}if(i&2){let e=Lw();Vh("formGroup",e.form),IE(),ww(e.isPlatformMode?-1:1),IE(2),Vh("formControl",e.authTypeControl),fI(),IE(),_w(e.authTypeOptions),IE(3),Vh("formControl",e.nameControl),fI(),IE(2),Vh("formControl",e.descriptionControl),fI(),IE(),ww(e.credentialFields().length>0?10:-1),IE(2),Vh("disabled",e.form.invalid||e.isSubmitting()),IE(),Yu(" ",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(we);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?Mi(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:[bn.required,bn.minLength(1)]});descriptionControl=new Te(null);authTypeControl=new Te("ApiKeyAuthSetting",{nonNullable:true,validators:[bn.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=VC(()=>_e[this.selectedAuthType()]);isEditMode=Mi(false);isSubmitting=Mi(false);isLoading=Mi(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||sf(()=>{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=ew({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&&(os(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),qh("click",function(){return n.cancel()}),pC(3," \u2190 Auth settings "),zu()(),Iw(4,Ce,2,0,"p",2)(5,be,16,8,"form",3),zu()),e&2&&(IE(),Vh("title",n.isEditMode()?"Edit auth setting":"New auth setting"),IE(3),ww(n.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,at,un,cn,Kt,fd,Mo,Do,Ut,Qt,Ca,fo,go,Nn,Rn],encapsulation:2})};
|
|
2
|
-
export{me as AuthSettingFormComponent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {v}from'./chunk-DbK9IJQd.js';import {I}from'./chunk-Bsqc_xnw.js';import {O}from'./chunk-CfX6vIYj.js';import {g,W,F,v as we,ac as _,ad as F$1,ae as Dr,M as Mi,af as ue,i as VC,a5 as Ys,x as U,s as sf,ag as Gm,a as ew,o as os,K as qh,b as pC,z as zu,I as Iw,c as IE,J as Vh,w as ww,a6 as Zs,ah as te,R as Rw,T as Tw,ai as Dw,N as lI,H as Hh,L as Lw,_ as _w,Q as fI,Y as Yu,l as lg,P as Pd,n as Ld}from'./main-JXQYBZRK.js';import {p as pt,T as Te$1,b as bn,v as vn,d as yn,e as fn,n as pn,h as hn,l as dn,i as at,u as un,o as cn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,q as Mn,Q as Qt,C as Ca,c as fo,g as go,N as Nn,R as Rn,Y as Yt}from'./chunk-DwEcQtO1.js';import'./chunk-Dg0rwtUo.js';var be=(i,e)=>e.value;function _e(i,e){i&1&&(os(0,"p",2),pC(1,"Loading\u2026"),zu());}function xe(i,e){if(i&1&&(os(0,"label",6),Hh(1,"input",22),lI(),pC(2),zu()),i&2){let t=e.$implicit,n=Lw(2);IE(),Vh("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),fI(),IE(),Yu(" ",t.label," ");}}function Ie(i,e){if(i&1&&(os(0,"option",10),pC(1),zu()),i&2){let t=e.$implicit;Vh("value",t.type),IE(),lg(t.displayName);}}function Ne(i,e){if(i&1&&(os(0,"option",10),pC(1),zu()),i&2){let t=e.$implicit;Vh("value",t.value),IE(),lg(t.label);}}function Ae(i,e){if(i&1&&(os(0,"div",18)(1,"label",6),Hh(2,"input",23),lI(),pC(3," Grant automatically "),zu(),os(4,"p",2),pC(5),zu()()),i&2){let t=Lw(2);IE(2),Vh("formControl",t.autoGrantControl),fI(),IE(3),Yu(" Give this integration to ",t.autoGrantReach(),", without each agent having to declare it. An agent can still opt out by mapping this configuration to an empty tool list. ");}}function Ee(i,e){if(i&1){let t=Rw();os(0,"ds-card")(1,"ds-json-schema-form",24),qh("valueChange",function(a){Pd(t);let p=Lw(2);return Ld(p.onParamsChange(a))}),zu()();}if(i&2){let t=Lw(2);IE(),Vh("schema",e)("value",t.initialParams());}}function Fe(i,e){if(i&1){let t=Rw();os(0,"button",25),qh("click",function(){Pd(t);let a=Lw(2);return Ld(a.exportYaml())}),pC(1),zu();}if(i&2){let t=Lw(2);Vh("disabled",t.isExporting()),IE(),Yu(" ",t.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Te(i,e){if(i&1){let t=Rw();os(0,"form",4),qh("ngSubmit",function(){Pd(t);let a=Lw();return Ld(a.submit())}),os(1,"ds-fieldset",5),Tw(2,xe,3,4,"label",6,Dw().trackByScope,true),zu(),os(4,"ds-form-field",7)(5,"select",8)(6,"option",9),pC(7,"Select type"),zu(),Tw(8,Ie,2,2,"option",10,Dw().trackByType,true),zu(),lI(),zu(),os(10,"ds-form-field",11),Hh(11,"input",12),lI(),zu(),os(12,"ds-form-field",13),Hh(13,"textarea",14),lI(),zu(),os(14,"ds-form-field",15)(15,"select",16)(16,"option",17),pC(17,"None"),zu(),Tw(18,Ne,2,2,"option",10,be),zu(),lI(),zu(),Iw(20,Ae,6,2,"div",18),Iw(21,Ee,2,2,"ds-card"),os(22,"ds-form-actions")(23,"button",19),pC(24),zu(),Iw(25,Fe,2,2,"button",20),os(26,"button",21),qh("click",function(){Pd(t);let a=Lw();return Ld(a.cancel())}),pC(27,"Cancel"),zu()()();}if(i&2){let t,n=Lw();Vh("formGroup",n.form),IE(),Vh("disabled",n.isEditMode()),IE(),_w(n.scopeOptions),IE(3),Vh("formControl",n.typeControl),fI(),IE(3),_w(n.integrationTypes()),IE(3),Vh("formControl",n.nameControl),fI(),IE(2),Vh("formControl",n.descriptionControl),fI(),IE(2),Vh("formControl",n.authSettingNameControl),fI(),IE(),Vh("ngValue",null),IE(2),_w(n.authSettingOptions()),IE(2),ww(n.isAutoGrantable()?20:-1),IE(),ww((t=n.schema())?21:-1,t),IE(2),Vh("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),IE(),Yu(" ",n.isEditMode()?"Save changes":"Create"," "),IE(),ww(n.isEditMode()?25:-1);}}var Ve=new Set(["platform","namespace","userOnNs","userGlobal"]),w=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ve=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(O);integrationTypeController=g(_);authSettingState=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?Dr(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new pt({name:new Te$1("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te$1(null),type:new Te$1("",{nonNullable:true,validators:[bn.required]}),scope:new Te$1("namespace",{nonNullable:true}),autoGrant:new Te$1(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=Mi(false);isSubmitting=Mi(false);isLoading=Mi(false);isExporting=Mi(false);scopeOptions=[{value:"platform",label:w.platform},{value:"namespace",label:w.namespace},{value:"userOnNs",label:w.userOnNs},{value:"userGlobal",label:w.userGlobal}];authSettingNameControl=new Te$1(null);loadedAuthSettings=Mi([]);authSettingsLoaded=Mi(false);savedAuthSettingName=Mi(null);authSettingsScope$=new ue;authSettingOptions=VC(()=>{let e=this.loadedAuthSettings(),t=this.savedAuthSettingName();return !t||!this.authSettingsLoaded()||e.some(n=>n.value===t)?e:[...e,{value:t,label:`${t} (not found)`}]});paramsValue=Mi(null);initialParams=Mi(null);integrationTypes=F$1(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=F$1(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});scopeValue=F$1(this.form.controls.scope.valueChanges,{initialValue:this.form.controls.scope.value});schema=VC(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});isAutoGrantable=VC(()=>{let e=this.selectedType();return e?this.integrationTypes().find(t=>t.type===e)?.autoGrantable??false:false});autoGrantReach=VC(()=>{switch(this.scopeValue()){case "platform":return "every agent of this environment";case "namespace":return "every agent of this namespace";default:return "your own runs"}});existingConfig=null;constructor(){this.authSettingsScope$.pipe(Ys(e=>this.loadAuthSettingLayers(e)),U(this.destroyRef)).subscribe(e=>{this.loadedAuthSettings.set(this.toAuthSettingOptions(e)),this.authSettingsLoaded.set(true);}),sf(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let e=this.route.snapshot.paramMap,t=this.route.snapshot.queryParamMap,n=e.get("integrationId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable(),this.loadAuthSettingsForScope("platform");return}let a=this.parseScope(t.get("scope"));this.scopeControl.setValue(a),this.loadAuthSettingsForScope(a),this.scopeControl.valueChanges.pipe(U(this.destroyRef)).subscribe(D=>{this.loadAuthSettingsForScope(D);});let p=t.get("template");p&&this.hydrateFromTemplate(p);}parseScope(e){return e&&Ve.has(e)?e:"namespace"}deriveScopeFromConfig(e){return !e.userId&&!e.namespaceId?"platform":e.userId?e.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.existingConfig=t;let n=this.deriveScopeFromConfig(t);this.scopeControl.setValue(n),this.applyConfigToForm(t),this.loadAuthSettingsForScope(n),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[IntegrationForm] Could not load config '${e}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.applyConfigToForm(t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:t=>{console.warn(`[IntegrationForm] Could not hydrate from template ${e}:`,t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(e){this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.typeControl.setValue(e.integrationType),this.initialParams.set(e.parameters),this.paramsValue.set(e.parameters),this.authSettingNameControl.setValue(e.authSettingName??null),this.savedAuthSettingName.set(e.authSettingName??null),this.autoGrantControl.setValue(e.autoGrant??false);}loadAuthSettingsForScope(e){this.authSettingsLoaded.set(false),this.authSettingsScope$.next(e);}loadAuthSettingLayers(e){let t=(p,D)=>D.pipe(Zs(()=>Dr([])),te(Se=>({label:p,settings:Se}))),n=t("platform",this.authSettingState.loadPlatformSettings()),a=t("mine",this.authSettingState.loadUserSettings("global"));return e==="platform"||e==="userGlobal"?Gm([a,n]):Gm([t("mine",this.authSettingState.loadUserSettings(this.namespaceId)),t("namespace",this.authSettingState.loadNamespaceSettings(this.namespaceId)),a,n])}toAuthSettingOptions(e){let t=new Map;for(let{label:n,settings:a}of e)for(let{name:p}of a)p&&t.set(p,(t.get(p)??new Set).add(n));return [...t.entries()].sort(([n],[a])=>n.localeCompare(a)).map(([n,a])=>({value:n,label:`${n} (${[...a].join(", ")})`}))}onParamsChange(e){this.paramsValue.set(e);}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let e=this.descriptionControl.value?.trim(),t={name:this.nameControl.value.trim(),description:e||null,integrationType:this.typeControl.value,parameters:this.paramsValue(),authSettingName:this.authSettingNameControl.value||null,autoGrant:this.isAutoGrantable()&&this.autoGrantControl.value},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,t,n,this.existingConfig):this.state.create(t,n,this.namespaceId??null)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let e=this.existingConfig?.id;!e||this.isExporting()||(this.isExporting.set(true),this.state.exportAsYaml(e).pipe(U(this.destroyRef)).subscribe({next:t=>{let n=new Blob([t],{type:"application/yaml"}),a=URL.createObjectURL(n),p=document.createElement("a");p.href=a,p.download=`${this.existingConfig?.name??"integration"}.yaml`,p.click(),URL.revokeObjectURL(a),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"]);}trackByType(e,t){return t.type}trackByScope(e,t){return t.value}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=ew({type:i,selectors:[["agentos-integration-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to integrations",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Scope",3,"disabled"],["dsCheck",""],["label","Type","controlId","integration-type","required",""],["dsControl","","id","integration-type",3,"formControl"],["value","","disabled",""],[3,"value"],["label","Name","controlId","integration-name","required",""],["dsControl","","id","integration-name","type","text","placeholder","Integration name","autocomplete","off",3,"formControl"],["label","Description","controlId","integration-description"],["dsControl","","id","integration-description","placeholder","Optional description","rows","3",3,"formControl"],["label","Auth Setting","controlId","integration-auth-setting","hint","Only the name is saved. It is resolved at run time for the user running the case, the most specific layer winning (user on this namespace > namespace > user > platform), so a shared integration can rely on each user's own auth setting of that name."],["dsControl","","id","integration-auth-setting",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-stack--sm"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["type","radio",3,"value","formControl","disabled"],["type","checkbox",3,"formControl"],[3,"valueChange","schema","value"],["dsButton","","type","button",3,"click","disabled"]],template:function(t,n){t&1&&(os(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),qh("click",function(){return n.cancel()}),pC(3," \u2190 Integrations "),zu()(),Iw(4,_e,2,0,"p",2)(5,Te,28,12,"form",3),zu()),t&2&&(IE(),Vh("title",n.isEditMode()?"Edit integration":"New integration"),IE(3),ww(n.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,dn,at,un,cn,Kt,fd,Mo,Do,Ut,Mn,Qt,Ca,fo,go,Nn,Rn,Yt],encapsulation:2})};export{ve as IntegrationFormComponent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {x as m,r as k,O as O$1,i as at,d as yn,V as Vo,A as Ao,k as P,w as P$1}from'./chunk-DwEcQtO1.js';import {g,W as W$1,F,v as we,a3 as vr,M as Mi,a5 as Ys,ag as Gm,a6 as Zs,ae as Dr,x as U$1,a as ew,o as os,K as qh,z as zu,b as pC,I as Iw,c as IE,J as Vh,w as ww,L as Lw,l as lg,T as Tw,_ as _w,Y as Yu,R as Rw,P as Pd,n as Ld,h as Bh}from'./main-JXQYBZRK.js';var U=(n,e)=>e.key;function z(n,e){if(n&1&&(os(0,"p",3),pC(1),zu()),n&2){let t=Lw();IE(),lg(t.deletion.error());}}function G(n,e){n&1&&(os(0,"p",4),pC(1,"Loading prompts\u2026"),zu());}function O(n,e){n&1&&(os(0,"p",5),pC(1,"No prompts available."),zu());}function Q(n,e){n&1&&(os(0,"p",4),pC(1,"No prompts match the current filter."),zu());}function W(n,e){n&1&&(os(0,"ds-tag",17),pC(1,"Read-only"),zu());}function X(n,e){if(n&1){let t=Rw();os(0,"button",23),qh("click",function(){Pd(t);let l=Lw(2).$implicit,m=Lw(2);return Ld(m.edit(l))}),pC(1," Edit "),zu();}if(n&2){let t=Lw(2).$implicit;Bh("aria-label","Edit "+t.prompt.name);}}function Y(n,e){if(n&1){let t=Rw();Iw(0,X,2,1,"button",21),os(1,"agentos-row-delete-action",22),qh("deleteRequested",function(){Pd(t);let l=Lw().$implicit,m=Lw(2);return Ld(m.deletion.request(l.key))})("deleteConfirmed",function(){Pd(t);let l=Lw().$implicit,m=Lw(2);return Ld(m.confirmDelete(l))})("deleteCancelled",function(){Pd(t);let l=Lw(3);return Ld(l.deletion.cancel())}),zu();}if(n&2){let t=Lw().$implicit,i=Lw(2);ww(i.deletion.confirmingId()!==t.key?0:-1),IE(),Vh("rowKey",t.key)("rowLabel",t.prompt.name)("state",i.deletion);}}function Z(n,e){n&1&&(os(0,"button",20),pC(1,"Inherited"),zu());}function ee(n,e){if(n&1&&(os(0,"tr",9)(1,"td",12),pC(2),zu(),os(3,"td",13),pC(4),zu(),os(5,"td",14)(6,"div",15)(7,"ds-tag",16),pC(8),zu(),Iw(9,W,2,0,"ds-tag",17),zu()(),os(10,"td",18)(11,"div",19),Iw(12,Y,2,4)(13,Z,2,0,"button",20),zu()()()),n&2){let t=e.$implicit;IE(2),lg(t.prompt.name),IE(2),Yu(" ",t.prompt.description||"\u2014"," "),IE(3),Vh("variant",t.scope==="platform"?"neutral":"accent"),IE(),lg(t.scope==="platform"?"Platform":"Namespace"),IE(),ww(t.scope==="platform"?9:-1),IE(3),ww(t.scope==="namespace"?12:13);}}function te(n,e){if(n&1&&(os(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),pC(5,"Name"),zu(),os(6,"th",10),pC(7,"Description"),zu(),os(8,"th",10),pC(9,"Scope"),zu(),os(10,"th",10)(11,"span",11),pC(12,"Actions"),zu()()()(),os(13,"tbody",8),Tw(14,ee,14,6,"tr",9,U),zu()()()),n&2){let t=Lw();IE(14),_w(t.rowFilter.filteredRows());}}var J=class n{route=g(W$1);router=g(F);destroyRef=g(we);promptState=g(m);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new vr(void 0);isLoading=Mi(true);deletion=k();rows=Mi([]);rowFilter=O$1(this.rows,e=>[e.prompt.name,e.prompt.description,e.scope].filter(Boolean).join(" "));allPrompts$=this.refresh$.pipe(Ys(()=>(this.isLoading.set(true),Gm({platform:this.promptState.listPlatform().pipe(Zs(()=>Dr([]))),namespace:this.promptState.listByNamespace(this.namespaceId)}))));constructor(){this.allPrompts$.pipe(U$1(this.destroyRef)).subscribe({next:({platform:e,namespace:t})=>{this.rows.set([...e.map((i,l)=>({key:`platform:${i.id??l}`,prompt:i,scope:"platform"})),...t.map((i,l)=>({key:`namespace:${i.id??l}`,prompt:i,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"prompts","new"]);}edit(e){e.scope==="platform"||!e.prompt.id||this.router.navigate(["/agentos",this.namespaceId,"prompts",e.prompt.id,"edit"]);}confirmDelete(e){e.scope==="platform"||!e.prompt.id||this.deletion.execute(e.key,{request$:this.promptState.delete(e.prompt.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.prompt.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=ew({type:n,selectors:[["agentos-namespace-prompts"]],decls:9,vars:3,consts:[["title","Prompts","description","Prompts available in this namespace, including prompts inherited from the platform."],["label","Filter prompts","placeholder","Filter prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(t,i){t&1&&(os(0,"ds-section-header",0)(1,"agentos-table-filter",1),qh("queryChange",function(m){return i.rowFilter.query.set(m)}),zu(),os(2,"button",2),qh("click",function(){return i.openCreateForm()}),pC(3,"New prompt"),zu()(),Iw(4,z,2,1,"p",3),Iw(5,G,2,0,"p",4)(6,O,2,0,"p",5)(7,Q,2,0,"p",4)(8,te,16,0,"div",6)),t&2&&(IE(),Vh("query",i.rowFilter.query()),IE(3),ww(i.deletion.error()?4:-1),IE(),ww(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{J as NamespacePromptsComponent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {y}from'./chunk-DwEcQtO1.js';import {g,aI as ce,aJ as T,ae as Dr,a5 as Ys,ah as te,a6 as Zs,aK as my,aa as k}from'./main-JXQYBZRK.js';var v=class i{userState=g(y);membership=g(ce);currentUser$=T(this.userState.currentUser);cache=new Map;isAdminOfNamespace$(e){if(!e)return Dr(false);let t=this.cache.get(e);if(t)return t;let s=this.currentUser$.pipe(Ys(a=>a?a.isAdmin?Dr(true):this.membership.getMembersNamespaceMembership(e).pipe(te(d=>d.some(n=>n.id===a.id&&n.role==="ADMIN")),Zs(()=>Dr(false))):Dr(false)),my({bufferSize:1,refCount:false}));return this.cache.set(e,s),s}static \u0275fac=function(t){return new(t||i)};static \u0275prov=k({token:i,factory:i.\u0275fac,providedIn:"root"})};export{v};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a5 as Ys,a6 as Zs,ae as Dr,aK as my}from'./main-JXQYBZRK.js';function i(t,o,p){return t.pipe(Ys(()=>o().pipe(Zs(()=>Dr(p)))),my({bufferSize:1,refCount:true}))}export{i};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {I}from'./chunk-Bsqc_xnw.js';import {g,W,b1 as J,v as we,M as Mi,i as VC,b2 as ke,ag as Gm,x as U,a6 as Zs,ae as Dr,a as ew,o as os,H as Hh,I as Iw,z as zu,K as qh,c as IE,w as ww,J as Vh,b as pC,R as Rw,N as lI,T as Tw,L as Lw,Q as fI,_ as _w,Y as Yu,$ as dg,P as Pd,n as Ld,l as lg}from'./main-JXQYBZRK.js';import {a9 as gd,M as Mo,D as Do,U as Ut,q as Mn,Q as Qt,c as fo,ab as _a,af as Bi,v as vn,d as yn,e as fn,n as pn,h as hn,_ as _n,i as at,u as un,o as cn}from'./chunk-DwEcQtO1.js';import'./chunk-Dg0rwtUo.js';var oe=(i,t)=>t.id;function ae(i,t){i&1&&(os(0,"p",1),pC(1,"Loading\u2026"),zu());}function se(i,t){if(i&1&&(os(0,"ds-notice"),pC(1),zu()),i&2){let e=Lw(2);IE(),lg(e.errorMessage());}}function re(i,t){if(i&1){let e=Rw();os(0,"div")(1,"button",23),qh("click",function(){Pd(e);let s=Lw(2);return Ld(s.retryLoad())}),pC(2,"Retry loading"),zu()();}}function ce(i,t){if(i&1&&(Hh(0,"br"),pC(1)),i&2){let e=Lw(3);IE(),Yu("",e.association()?.checkoutFailureReason," ");}}function de(i,t){if(i&1&&(os(0,"ds-notice",3),pC(1),Iw(2,ce,2,1),zu()),i&2){let e=Lw(2);Vh("tone",e.checkoutStatus()===e.CheckoutStatus.FAILED?"error":e.checkoutStatus()===e.CheckoutStatus.READY?"success":"neutral"),IE(),Yu(" Repository: ",e.checkoutStatus()," "),IE(),ww(e.association()?.checkoutFailureReason?2:-1);}}function le(i,t){if(i&1&&(os(0,"option",12),pC(1),zu()),i&2){let e=t.$implicit,c=Lw(2);Vh("value",e.id),IE(),dg("",e.name," (",c.authTypeLabel(e.authType),")");}}function me(i,t){i&1&&(os(0,"p",13),pC(1," No usable auth setting in this namespace. Create a BEARER_TOKEN one first. "),zu());}function pe(i,t){if(i&1){let e=Rw();os(0,"button",24),qh("click",function(){Pd(e);let s=Lw(2);return Ld(s.remove())}),pC(1," Remove association "),zu();}if(i&2){let e=Lw(2);Vh("disabled",!e.associationLoaded()||e.isSaving());}}function ue(i,t){if(i&1){let e=Rw();Iw(0,se,2,1,"ds-notice"),Iw(1,re,3,0,"div"),Iw(2,de,3,3,"ds-notice",3),os(3,"ds-fieldset",4)(4,"ds-form-field",5)(5,"input",6),qh("ngModelChange",function(s){Pd(e);let u=Lw();return Ld(u.repositoryUrl.set(s))}),zu(),lI(),zu(),os(6,"ds-form-field",7)(7,"input",8),qh("ngModelChange",function(s){Pd(e);let u=Lw();return Ld(u.mainBranch.set(s))}),zu(),lI(),zu(),os(8,"ds-form-field",9)(9,"select",10),qh("ngModelChange",function(s){Pd(e);let u=Lw();return Ld(u.serviceAuthSettingId.set(s))}),os(10,"option",11),pC(11,"Select an auth setting\u2026"),zu(),Tw(12,le,2,3,"option",12,oe),zu(),lI(),Iw(14,me,2,0,"p",13),zu()(),os(15,"ds-fieldset",14)(16,"div",15)(17,"label",16)(18,"input",17),qh("ngModelChange",function(s){Pd(e);let u=Lw();return Ld(u.autoWorktree.set(s))}),zu(),lI(),pC(19," Offer a worktree to every new top-level case "),zu(),os(20,"p",18),pC(21," The creator checks the box when creating the case; it is unchecked by default, and a case created without it has no Git. Applies to cases created from now on: turning this on later never equips existing cases, and turning it off never removes a worktree already created. "),zu()(),os(22,"ds-form-field",19)(23,"input",20),qh("ngModelChange",function(s){Pd(e);let u=Lw();return Ld(u.setupCommand.set(s))}),zu(),lI(),os(24,"p",13),pC(25," Runs on the server, as the service user, in each new worktree. It executes code from the branch \u2014 prefer a command that disables lifecycle scripts. "),zu()()(),os(26,"ds-form-actions")(27,"button",21),qh("click",function(){Pd(e);let s=Lw();return Ld(s.save())}),pC(28),zu(),Iw(29,pe,2,1,"button",22),zu();}if(i&2){let e=Lw();ww(e.errorMessage()?0:-1),IE(),ww(e.associationLoaded()?-1:1),IE(),ww(e.isAssociated()&&e.checkoutStatus()?2:-1),IE(),Vh("disabled",!e.associationLoaded()||e.isSaving()),IE(2),Vh("ngModel",e.repositoryUrl()),fI(),IE(2),Vh("ngModel",e.mainBranch()),fI(),IE(2),Vh("ngModel",e.serviceAuthSettingId()),fI(),IE(3),_w(e.eligibleAuthSettings()),IE(2),ww(e.eligibleAuthSettings().length===0?14:-1),IE(),Vh("disabled",!e.associationLoaded()||e.isSaving()),IE(3),Vh("ngModel",e.autoWorktree()),fI(),IE(5),Vh("ngModel",e.setupCommand()),fI(),IE(4),Vh("disabled",!e.canSave()),IE(),Yu(" ",e.isSaving()?"Saving\u2026":e.isAssociated()?"Update":"Associate"," "),IE(),ww(e.isAssociated()?29:-1);}}var ge=["BearerTokenAuthSetting","BasicAuthAuthSetting","ApiKeyAuthSetting"],he={BearerTokenAuthSetting:"token",BasicAuthAuthSetting:"basic auth",ApiKeyAuthSetting:"API key"},ne=class i{route=g(W);gitApi=g(J);authSettingState=g(I);destroyRef=g(we);isLoading=Mi(true);isSaving=Mi(false);confirmingRemove=Mi(false);associationLoaded=Mi(false);errorMessage=Mi(null);association=Mi(null);authSettings=Mi([]);repositoryUrl=Mi("");mainBranch=Mi("main");serviceAuthSettingId=Mi("");autoWorktree=Mi(false);setupCommand=Mi("");namespaceId="";isAssociated=VC(()=>this.association()?.associated===true);eligibleAuthSettings=VC(()=>this.authSettings().filter(t=>ge.includes(t.authType)));authTypeLabel(t){return he[t??""]??t??"unknown"}canSave=VC(()=>this.associationLoaded()&&!this.isLoading()&&!this.isSaving()&&this.repositoryUrl().trim().length>0&&this.serviceAuthSettingId().length>0);checkoutStatus=VC(()=>this.association()?.checkoutStatus??null);CheckoutStatus=ke;ngOnInit(){this.namespaceId=this.route.snapshot.paramMap.get("namespaceId")??"",this.load();}retryLoad(){this.isLoading()||this.isSaving()||this.load();}load(){this.isLoading.set(true),this.associationLoaded.set(false),this.errorMessage.set(null),Gm({association:this.gitApi.getAssociationNamespaceGit(this.namespaceId),authSettings:this.authSettingState.loadNamespaceSettings(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({association:t,authSettings:e})=>{this.authSettings.set(e??[]),this.acceptAssociation(t),this.isLoading.set(false);},error:t=>{console.error("Failed to load the Git repository settings",t),this.errorMessage.set(this.messageOf(t)),this.isLoading.set(false);}});}acceptAssociation(t){this.association.set(t);let e=t?.associated===false||t?.associated===true&&typeof t.repositoryUrl=="string"&&typeof t.mainBranch=="string"&&typeof t.serviceAuthSettingId=="string"&&typeof t.autoWorktreeForRootCases=="boolean"&&(t.setupCommand==null||typeof t.setupCommand=="string");this.associationLoaded.set(e),e?this.applyToForm(t):this.errorMessage.set("The repository settings could not be loaded completely. Retry before making changes.");}applyToForm(t){this.repositoryUrl.set(t.repositoryUrl??""),this.mainBranch.set(t.mainBranch??"main"),this.serviceAuthSettingId.set(t.serviceAuthSettingId??""),this.autoWorktree.set(t.autoWorktreeForRootCases??false),this.setupCommand.set(t.setupCommand??"");}save(){this.canSave()&&(this.isSaving.set(true),this.errorMessage.set(null),this.gitApi.setAssociationNamespaceGit(this.namespaceId,{repositoryUrl:this.repositoryUrl().trim(),mainBranch:this.mainBranch().trim()||void 0,serviceAuthSettingId:this.serviceAuthSettingId(),autoWorktreeForRootCases:this.autoWorktree(),setupCommand:this.setupCommand().trim()||void 0}).pipe(U(this.destroyRef),Zs(t=>(console.error("Failed to save the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),Dr(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}remove(){!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated()||this.confirmingRemove.set(true);}confirmRemove(){this.confirmingRemove.set(false),!(!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated())&&(this.isSaving.set(true),this.gitApi.removeAssociationNamespaceGit(this.namespaceId).pipe(U(this.destroyRef),Zs(t=>(console.error("Failed to remove the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),Dr(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}messageOf(t){return t.error?.message??t.message??"Unexpected error"}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=ew({type:i,selectors:[["agentos-namespace-git"]],decls:5,vars:2,consts:[["title","Git repository","description","Associating a repository enables Git workspaces for this namespace. When worktree creation is enabled, the new-case form offers a worktree, and a case created with one gets a repo/ directory shared by its sub-cases. Namespace files remain shared documents outside Git. Agents create branches and pull requests in their workflows."],[1,"ds-hint"],["title","Remove the repository association?","message","Existing workspaces keep their worktree.","confirmLabel","Remove","cancelLabel","Cancel",3,"confirmed","cancelled","open"],[3,"tone"],["legend","Repository",3,"disabled"],["label","Repository URL","controlId","git-url","hint","HTTPS only, without credentials in the URL."],["dsControl","","id","git-url","type","url","placeholder","https://forge.example/org/project.git","name","repositoryUrl",3,"ngModelChange","ngModel"],["label","Main branch","controlId","git-branch","hint","New worktrees start at this branch\u2019s commit, without creating a branch."],["dsControl","","id","git-branch","type","text","placeholder","main","name","mainBranch",3,"ngModelChange","ngModel"],["label","Service account","controlId","git-auth","hint","Shared by the namespace. Every Git operation uses this identity, never the identity of whoever opened the case."],["dsControl","","id","git-auth","name","serviceAuthSettingId",3,"ngModelChange","ngModel"],["value",""],[3,"value"],[1,"ds-hint","ds-hint--warning"],["legend","Automation",3,"disabled"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox","name","autoWorktree",3,"ngModelChange","ngModel"],[1,"ds-hint","ds-indent"],["label","Setup command (optional)","controlId","git-setup"],["dsControl","","mono","","id","git-setup","type","text","placeholder","pnpm install --ignore-scripts","name","setupCommand",3,"ngModelChange","ngModel"],["id","git-save","dsButton","","variant","primary","type","button",3,"click","disabled"],["id","git-remove","dsButton","","variant","danger","type","button",3,"disabled"],["id","git-retry","dsButton","","type","button",3,"click"],["id","git-remove","dsButton","","variant","danger","type","button",3,"click","disabled"]],template:function(e,c){e&1&&(os(0,"ds-page"),Hh(1,"ds-section-header",0),Iw(2,ae,2,0,"p",1)(3,ue,30,14),zu(),os(4,"ds-confirm-dialog",2),qh("confirmed",function(){return c.confirmRemove()})("cancelled",function(){return c.confirmingRemove.set(false)}),zu()),e&2&&(IE(2),ww(c.isLoading()?2:3),IE(2),Vh("open",c.confirmingRemove()));},dependencies:[gd,Mo,Do,Ut,Mn,Qt,fo,_a,Bi,vn,yn,fn,pn,hn,_n,at,un,cn],encapsulation:2})};
|
|
2
|
-
export{ne as NamespaceGitComponent};
|