@whoz-oss/coday-client 0.0.0-workstream-forge.234 → 0.0.0-workstream-forge.235
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-DMaZtyPG.js → chunk-1eRn_62f.js} +1 -1
- package/browser/{chunk-iEPxdwNo.js → chunk-2_zz7NAC.js} +1 -1
- package/browser/{chunk-D5fiBKR6.js → chunk-AyHTO4Sx.js} +1 -1
- package/browser/{chunk-6YBD0GhT.js → chunk-B-B5NvWL.js} +1 -1
- package/browser/{chunk-CWww3DEx.js → chunk-B1vEKrz_.js} +1 -1
- package/browser/{chunk-BwLhUg85.js → chunk-B6qP3Hvp.js} +1 -1
- package/browser/{chunk-BtAgB7lp.js → chunk-BRida568.js} +1 -1
- package/browser/{chunk-C57r8bJB.js → chunk-BXNum5Uv.js} +1 -1
- package/browser/{chunk-CjEtYpc7.js → chunk-BXWcQ9nJ.js} +1 -1
- package/browser/{chunk-D2h70wlj.js → chunk-BiTjjS7f.js} +1 -1
- package/browser/{chunk-Cii8kID2.js → chunk-BmA5vDQy.js} +1 -1
- package/browser/{chunk-BZQ9JxtK.js → chunk-BxmI0rEJ.js} +1 -1
- package/browser/{chunk-CHLgsXpc.js → chunk-BzHtPq4J.js} +1 -1
- package/browser/{chunk-paKwZTsF.js → chunk-C9uCCw8u.js} +1 -1
- package/browser/{chunk-C4CShhcg.js → chunk-CFbt2W-4.js} +1 -1
- package/browser/{chunk-NuH8shYm.js → chunk-CJA7LP9I.js} +1 -1
- package/browser/{chunk-BUfak7ZR.js → chunk-CMTE1K7b.js} +1 -1
- package/browser/{chunk-CyEpqhHA.js → chunk-CQe9V6Kx.js} +1 -1
- package/browser/{chunk-AtCYApei.js → chunk-CRTm3TW7.js} +1 -1
- package/browser/{chunk-TWv3ObgU.js → chunk-CWVqBlP_.js} +1 -1
- package/browser/{chunk-BlPBulzu.js → chunk-Ck42W3Td.js} +1 -1
- package/browser/{chunk-DRUw-4Lk.js → chunk-ClfOew6l.js} +1 -1
- package/browser/{chunk-OhgFuyjp.js → chunk-CuBq-gTP.js} +1 -1
- package/browser/{chunk-C4FZ3_Nh.js → chunk-CxGrMAsv.js} +1 -1
- package/browser/{chunk-Dz39nB4A.js → chunk-D0VIctP9.js} +1 -1
- package/browser/{chunk-Bqg4NsQw.js → chunk-D4dSdxUc.js} +1 -1
- package/browser/{chunk-BLevlpuu.js → chunk-D6Jd9h9a.js} +1 -1
- package/browser/{chunk-B1xRCZ-V.js → chunk-DGjD1lCO.js} +1 -1
- package/browser/{chunk-DKN9kTwu.js → chunk-DHNEs7J8.js} +1 -1
- package/browser/{chunk-CYwBGwuM.js → chunk-DKozzs8J.js} +1 -1
- package/browser/{chunk-CrvFTHbA.js → chunk-DWhB9E6K.js} +1 -1
- package/browser/{chunk-BHKhFWCm.js → chunk-DZLxIPvO.js} +1 -1
- package/browser/chunk-DbZbECFq.js +1 -0
- package/browser/{chunk-DFkt8tY0.js → chunk-DdQVnFkx.js} +1 -1
- package/browser/{chunk-58tiRI-H.js → chunk-DgjvisKR.js} +1 -1
- package/browser/{chunk-KQaRB5fZ.js → chunk-DrL2kj2Q.js} +1 -1
- package/browser/{chunk-XnJGN0OJ.js → chunk-Dsli5F3b.js} +1 -1
- package/browser/{chunk-BjniM4kn.js → chunk-Dv--4A7A.js} +1 -1
- package/browser/{chunk-DKkNMT3S.js → chunk-HNne7KzG.js} +1 -1
- package/browser/{chunk-bCI6skcH.js → chunk-Ncao0R2n.js} +16 -16
- package/browser/{chunk-CseRCWgR.js → chunk-Xi-gu1fS.js} +1 -1
- package/browser/{chunk-B97Q0PCu.js → chunk-h4Ucvwue.js} +1 -1
- package/browser/{chunk-BRekDeCw.js → chunk-jbtuI0D4.js} +1 -1
- package/browser/{chunk-pbgW0Sdk.js → chunk-kgDzsPcI.js} +1 -1
- package/browser/{chunk-Ct896VFa.js → chunk-ldd-YZJ3.js} +1 -1
- package/browser/{chunk-d7XsX4kM.js → chunk-pTZfve8g.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/{main-PUOSMZMX.js → main-6MVJZWGK.js} +1 -1
- package/package.json +1 -1
- package/browser/chunk-2gGq060a.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import {z as k$1,O,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-
|
|
1
|
+
import {z as k$1,O,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-Ncao0R2n.js';import {g,q as F,I as we,ap as F$1,Z as Tr,$ as $i,a1 as ga,K as U$1,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,Y as Yw,l as lg,u as pf,w as hf}from'./main-6MVJZWGK.js';var B=(i,e)=>e.id??e.name;function M(i,e){if(i&1&&(Es(0,"p",3),xC(1),hl()),i&2){let t=eC();BE(),Fg(t.deletion.error());}}function U(i,e){i&1&&(Es(0,"p",4),xC(1,"Loading AI providers\u2026"),hl());}function j(i,e){i&1&&(Es(0,"p",5),xC(1,"No platform AI providers defined yet."),hl());}function K(i,e){i&1&&(Es(0,"p",4),xC(1,"No AI providers match the current filter."),hl());}function H(i,e){if(i&1){let t=Yw();Es(0,"button",19),vg("click",function(){pf(t);let s=eC().$implicit,m=eC(2);return hf(m.edit(s))}),xC(1," Edit "),hl();}if(i&2){let t=eC().$implicit;lg("aria-label","Edit "+t.name);}}function z(i,e){if(i&1){let t=Yw();Es(0,"agentos-row-delete-action",20),vg("deleteRequested",function(){pf(t);let s=eC().$implicit,m=eC(2);return hf(m.deletion.request(s.id))})("deleteConfirmed",function(){pf(t);let s=eC().$implicit,m=eC(2);return hf(m.confirmDelete(s))})("deleteCancelled",function(){pf(t);let s=eC(3);return hf(s.deletion.cancel())}),hl();}if(i&2){let t=eC().$implicit,r=eC(2);dg("rowKey",t.id)("rowLabel",t.name)("state",r.deletion);}}function G(i,e){if(i&1&&(Es(0,"tr",9)(1,"td",12),xC(2),hl(),Es(3,"td",13),xC(4),hl(),Es(5,"td",14),xC(6),hl(),Es(7,"td",15)(8,"div",16),jw(9,H,2,1,"button",17),jw(10,z,1,3,"agentos-row-delete-action",18),hl()()()),i&2){let t=e.$implicit,r=eC(2);BE(2),Fg(t.name),BE(2),Fg(t.apiType),BE(2),Fg(t.baseUrl||"\u2014"),BE(3),Bw(r.deletion.confirmingId()!==t.id?9:-1),BE(),Bw(t.id?10:-1);}}function J(i,e){if(i&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"API type"),hl(),Es(8,"th",10),xC(9,"Base URL"),hl(),Es(10,"th",10)(11,"span",11),xC(12,"Actions"),hl()()()(),Es(13,"tbody",8),Uw(14,G,11,5,"tr",9,B),hl()()()),i&2){let t=eC();BE(14),$w(t.rowFilter.filteredRows());}}var k=class i{router=g(F);destroyRef=g(we);aiProviderController=g(F$1);refresh$=new Tr(void 0);isLoading=$i(true);deletion=k$1();providers=$i([]);rowFilter=O(this.providers,e=>[e.name,e.apiType,e.baseUrl].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(this.isLoading.set(true),this.aiProviderController.listAiProvider("none"))),U$1(this.destroyRef)).subscribe({next:e=>{this.providers.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","ai-providers","new"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","ai-providers",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.aiProviderController.deleteAiProvider(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=vw({type:i,selectors:[["agentos-platform-ai-providers"]],decls:9,vars:3,consts:[["title","Platform AI providers","description","AI providers shared across every namespace."],["label","Filter AI providers","placeholder","Filter AI providers\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform AI providers"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","API type"],["role","cell","data-label","Base URL",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,r){t&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(m){return r.rowFilter.query.set(m)}),hl(),Es(2,"button",2),vg("click",function(){return r.openCreateForm()}),xC(3,"New AI provider"),hl()(),jw(4,M,2,1,"p",3),jw(5,U,2,0,"p",4)(6,j,2,0,"p",5)(7,K,2,0,"p",4)(8,J,16,0,"div",6)),t&2&&(BE(),dg("query",r.rowFilter.query()),BE(3),Bw(r.deletion.error()?4:-1),BE(),Bw(r.isLoading()?5:r.providers().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{k as PlatformAiProvidersComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,aK as fe,a6 as x}from'./main-
|
|
1
|
+
import {g,aK as fe,a6 as x}from'./main-6MVJZWGK.js';var o=class r{skillController=g(fe);getById(l){return this.skillController.getByIdSkill(l)}listPlatform(){return this.skillController.listPlatformSkill()}listByNamespace(l){return this.skillController.listByParentSkill(l)}listEffective(l){return this.skillController.listEffectiveSkill(l)}create(l){return this.skillController.createSkill(l)}update(l,e){return this.skillController.updateSkill(l,e)}delete(l){return this.skillController.deleteSkill(l)}static \u0275fac=function(e){return new(e||r)};static \u0275prov=x({token:r,factory:r.\u0275fac,providedIn:"root"})};export{o};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {O as O$1}from'./chunk-
|
|
1
|
+
import {O as O$1}from'./chunk-Xi-gu1fS.js';import {g,q as F,I as we,af as G$1,Z as Tr,$ as $i,a1 as ga,K as U$1,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,Y as Yw,l as lg,u as pf,w as hf}from'./main-6MVJZWGK.js';import {z as k,O as O$2,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-Ncao0R2n.js';import'./chunk-DbZbECFq.js';var j=(t,e)=>e.id??e.name;function A(t,e){if(t&1&&(Es(0,"p",3),xC(1),hl()),t&2){let n=eC();BE(),Fg(n.deletion.error());}}function K(t,e){t&1&&(Es(0,"p",4),xC(1,"Loading integrations\u2026"),hl());}function H(t,e){t&1&&(Es(0,"p",5),xC(1,"No platform integrations defined yet."),hl());}function U(t,e){t&1&&(Es(0,"p",4),xC(1,"No integrations match the current filter."),hl());}function z(t,e){if(t&1){let n=Yw();Es(0,"button",18),vg("click",function(){pf(n);let d=eC().$implicit,m=eC(2);return hf(m.edit(d))}),xC(1,"Edit"),hl();}if(t&2){let n=eC().$implicit;lg("aria-label","Edit "+n.name);}}function G(t,e){if(t&1){let n=Yw();Es(0,"agentos-row-delete-action",19),vg("deleteRequested",function(){pf(n);let d=eC().$implicit,m=eC(2);return hf(m.deletion.request(d.id))})("deleteConfirmed",function(){pf(n);let d=eC().$implicit,m=eC(2);return hf(m.confirmDelete(d))})("deleteCancelled",function(){pf(n);let d=eC(3);return hf(d.deletion.cancel())}),hl();}if(t&2){let n=eC().$implicit,r=eC(2);dg("rowKey",n.id)("rowLabel",n.name)("state",r.deletion);}}function J(t,e){if(t&1&&(Es(0,"tr",9)(1,"td",12),xC(2),hl(),Es(3,"td",13),xC(4),hl(),Es(5,"td",14)(6,"div",15),jw(7,z,2,1,"button",16),jw(8,G,1,3,"agentos-row-delete-action",17),hl()()()),t&2){let n=e.$implicit,r=eC(2);BE(2),Fg(n.name),BE(2),Fg(n.integrationType),BE(3),Bw(r.deletion.confirmingId()!==n.id?7:-1),BE(),Bw(n.id?8:-1);}}function O(t,e){if(t&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Type"),hl(),Es(8,"th",10)(9,"span",11),xC(10,"Actions"),hl()()()(),Es(11,"tbody",8),Uw(12,J,9,4,"tr",9,j),hl()()()),t&2){let n=eC();BE(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 Tr(void 0);isLoading=$i(true);deletion=k();configs=$i([]);rowFilter=O$2(this.configs,e=>[e.name,e.integrationType].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(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=vw({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&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(m){return r.rowFilter.query.set(m)}),hl(),Es(2,"button",2),vg("click",function(){return r.openCreateForm()}),xC(3,"New integration"),hl()(),jw(4,A,2,1,"p",3),jw(5,K,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,O,14,0,"div",6)),n&2&&(BE(),dg("query",r.rowFilter.query()),BE(3),Bw(r.deletion.error()?4:-1),BE(),Bw(r.isLoading()?5:r.configs().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{B as PlatformIntegrationConfigsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {ab as N,d as pn,h as hn,e as cn,g as dn,C as mn,i as at,j as an}from'./chunk-
|
|
1
|
+
import {ab as N,d as pn,h as hn,e as cn,g as dn,C as mn,i as at,j as an}from'./chunk-Ncao0R2n.js';import {g,W,q as F,aU as D,ag as U,I as we,$ as $i,K as U$1,B,aV as gy,v as vw,E as Es,Q as vg,x as xC,a as hl,f as fg,j as jw,b as BE,P as dg,c as Bw,s as Dl,t as eC,F as Fg}from'./main-6MVJZWGK.js';function P(l,t){if(l&1&&(Es(0,"ds-notice"),xC(1),hl()),l&2){let n=eC();BE(),Fg(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=$i("");launchError=$i(null);isLaunching=$i(false);isLoading=$i(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 gy(this.agentConfigController.getByIdAgentConfig(this.agentConfigId))),n=yield gy(this.caseController.createCase({namespaceId:this.namespaceId}));this.caseState.addCase(n);let e=n.id??"",d={content:`@${t.name} start`};yield gy(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=vw({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&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return e.back()}),xC(3," \u2190 Edit agent config "),hl()(),Es(4,"p",2),xC(5," The loop configuration below is read from "),Es(6,"code"),xC(7,"AgentConfig.loopConfig"),hl(),xC(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. "),hl(),Es(9,"ds-form-field",3),fg(10,"textarea",4),hl(),jw(11,P,2,1,"ds-notice"),Es(12,"ds-form-actions")(13,"button",5),vg("click",function(){return e.launch()}),xC(14),hl(),Es(15,"button",6),vg("click",function(){return e.back()}),xC(16,"Cancel"),hl()()()),n&2&&(BE(10),dg("value",e.payloadJson())("disabled",e.isLaunching()||e.isLoading()),BE(),Bw(e.launchError()?11:-1),BE(2),dg("disabled",e.isLaunching()),BE(),Dl(" ",e.isLaunching()?"Launching\u2026":"Launch"," "),BE(),dg("disabled",e.isLaunching()));},dependencies:[pn,hn,cn,dn,mn,at,an],encapsulation:2})};export{T as AgentConfigLaunchComponent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {v}from'./chunk-BwLhUg85.js';import {I,n as nt,i as it}from'./chunk-DFkt8tY0.js';import {g,W,q as F,I as we,$ as $i,a9 as F$1,r as rT,O as Of,K as U,N as x,L as w,v as vw,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,c as Bw,Y as Yw,U as Uw,ao as Hw,R as MI,f as fg,t as eC,S as xI,k as $w,s as Dl,ae as Pw,F as Fg,l as lg,u as pf,w as hf}from'./main-PUOSMZMX.js';import {T as Te,a as fn,p as pt,d as pn,h as hn,e as cn,r as ln,g as dn,i as at,j as an,t as rn,U as Ut,n as nd,b as bo,x as xo,L as Lt,G as Gt,w as pa,m as mo,c as po,V as Vn,A as An}from'./chunk-bCI6skcH.js';import'./chunk-2gGq060a.js';function Ce(i,t){i&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function ye(i,t){if(i&1&&(Es(0,"label",16),fg(1,"input",17),MI(),xC(2),hl()),i&2){let e=t.$implicit,n=eC(3);BE(),dg("formControl",n.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!n.isAdmin()),xI(),BE(),Dl(" ",e.label," ");}}function ge(i,t){if(i&1&&(Es(0,"ds-fieldset",5),Uw(1,ye,3,4,"label",16,Pw().trackByScope,true),hl()),i&2){let e=eC(2);dg("disabled",e.isEditMode()),BE(),$w(e.scopeOptions);}}function fe(i,t){if(i&1&&(Es(0,"option",8),xC(1),hl()),i&2){let e=t.$implicit,n=eC(2);dg("value",e),BE(),Fg(n.authTypeLabel[e]);}}function Se(i,t){if(i&1&&(Es(0,"ds-form-field",18),fg(1,"input",19),MI(),hl()),i&2){let e=eC().$implicit;dg("label",e.label)("controlId","as-cred-"+e.key)("required",e.required)("hint",e.hint??null)("hintId","as-hint-"+e.key),BE(),dg("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),lg("aria-describedby",e.hint?"as-hint-"+e.key:null),xI();}}function Ae(i,t){if(i&1&&jw(0,Se,2,11,"ds-form-field",18),i&2){let e,n=t.$implicit,o=eC(3);Bw((e=o.controlForField(n.key))?0:-1,e);}}function ve(i,t){if(i&1&&(Es(0,"ds-fieldset",13),Uw(1,Ae,1,1,null,null,Pw().trackByField,true),hl()),i&2){let e=eC(2);dg("hint","Values are stored encrypted and masked on read."+(e.isEditMode()?" Leave a field unchanged to keep the stored credential.":"")),BE(),$w(e.credentialFields());}}function be(i,t){if(i&1){let e=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let o=eC();return hf(o.submit())}),jw(1,ge,3,1,"ds-fieldset",5),Es(2,"ds-form-field",6)(3,"select",7),Uw(4,fe,2,2,"option",8,Hw),hl(),MI(),hl(),Es(6,"ds-form-field",9),fg(7,"input",10),MI(),hl(),Es(8,"ds-form-field",11),fg(9,"input",12),MI(),hl(),jw(10,ve,3,1,"ds-fieldset",13),Es(11,"ds-form-actions")(12,"button",14),xC(13),hl(),Es(14,"button",15),vg("click",function(){pf(e);let o=eC();return hf(o.cancel())}),xC(15,"Cancel"),hl()()();}if(i&2){let e=eC();dg("formGroup",e.form),BE(),Bw(e.isPlatformMode?-1:1),BE(2),dg("formControl",e.authTypeControl),xI(),BE(),$w(e.authTypeOptions),BE(3),dg("formControl",e.nameControl),xI(),BE(2),dg("formControl",e.descriptionControl),xI(),BE(),Bw(e.credentialFields().length>0?10:-1),BE(2),dg("disabled",e.form.invalid||e.isSubmitting()),BE(),Dl(" ",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?$i(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=nt;authTypeLabel=it;scopeOptions=[{value:"namespace",label:D.namespace},{value:"userOnNs",label:D.userOnNs},{value:"userGlobal",label:D.userGlobal}];nameControl=new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]});descriptionControl=new Te(null);authTypeControl=new Te("ApiKeyAuthSetting",{nonNullable:true,validators:[fn.required]});scopeControl=new Te("namespace",{nonNullable:true});form=new pt({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new Te("",{nonNullable:true});usernameControl=new Te("",{nonNullable:true});passwordControl=new Te("",{nonNullable:true});tokenControl=new Te("",{nonNullable:true});discoveryUrlControl=new Te("",{nonNullable:true});authorizationUrlControl=new Te("",{nonNullable:true});tokenUrlControl=new Te("",{nonNullable:true});clientIdControl=new Te("",{nonNullable:true});clientSecretControl=new Te("",{nonNullable:true});scopesControl=new Te("",{nonNullable:true});resourceUrlControl=new Te("",{nonNullable:true});selectedAuthType=F$1(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=rT(()=>_e[this.selectedAuthType()]);isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Of(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,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=vw({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&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return n.cancel()}),xC(3," \u2190 Auth settings "),hl()(),jw(4,Ce,2,0,"p",2)(5,be,16,8,"form",3),hl()),e&2&&(BE(),dg("title",n.isEditMode()?"Edit auth setting":"New auth setting"),BE(3),Bw(n.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,at,an,rn,Ut,nd,bo,xo,Lt,Gt,pa,mo,po,Vn,An],encapsulation:2})};
|
|
1
|
+
import {v}from'./chunk-B6qP3Hvp.js';import {I,n as nt,i as it}from'./chunk-DdQVnFkx.js';import {g,W,q as F,I as we,$ as $i,a9 as F$1,r as rT,O as Of,K as U,N as x,L as w,v as vw,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,c as Bw,Y as Yw,U as Uw,ao as Hw,R as MI,f as fg,t as eC,S as xI,k as $w,s as Dl,ae as Pw,F as Fg,l as lg,u as pf,w as hf}from'./main-6MVJZWGK.js';import {T as Te,a as fn,p as pt,d as pn,h as hn,e as cn,r as ln,g as dn,i as at,j as an,t as rn,U as Ut,n as nd,b as bo,x as xo,L as Lt,G as Gt,w as pa,m as mo,c as po,V as Vn,A as An}from'./chunk-Ncao0R2n.js';import'./chunk-DbZbECFq.js';function Ce(i,t){i&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function ye(i,t){if(i&1&&(Es(0,"label",16),fg(1,"input",17),MI(),xC(2),hl()),i&2){let e=t.$implicit,n=eC(3);BE(),dg("formControl",n.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!n.isAdmin()),xI(),BE(),Dl(" ",e.label," ");}}function ge(i,t){if(i&1&&(Es(0,"ds-fieldset",5),Uw(1,ye,3,4,"label",16,Pw().trackByScope,true),hl()),i&2){let e=eC(2);dg("disabled",e.isEditMode()),BE(),$w(e.scopeOptions);}}function fe(i,t){if(i&1&&(Es(0,"option",8),xC(1),hl()),i&2){let e=t.$implicit,n=eC(2);dg("value",e),BE(),Fg(n.authTypeLabel[e]);}}function Se(i,t){if(i&1&&(Es(0,"ds-form-field",18),fg(1,"input",19),MI(),hl()),i&2){let e=eC().$implicit;dg("label",e.label)("controlId","as-cred-"+e.key)("required",e.required)("hint",e.hint??null)("hintId","as-hint-"+e.key),BE(),dg("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),lg("aria-describedby",e.hint?"as-hint-"+e.key:null),xI();}}function Ae(i,t){if(i&1&&jw(0,Se,2,11,"ds-form-field",18),i&2){let e,n=t.$implicit,o=eC(3);Bw((e=o.controlForField(n.key))?0:-1,e);}}function ve(i,t){if(i&1&&(Es(0,"ds-fieldset",13),Uw(1,Ae,1,1,null,null,Pw().trackByField,true),hl()),i&2){let e=eC(2);dg("hint","Values are stored encrypted and masked on read."+(e.isEditMode()?" Leave a field unchanged to keep the stored credential.":"")),BE(),$w(e.credentialFields());}}function be(i,t){if(i&1){let e=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let o=eC();return hf(o.submit())}),jw(1,ge,3,1,"ds-fieldset",5),Es(2,"ds-form-field",6)(3,"select",7),Uw(4,fe,2,2,"option",8,Hw),hl(),MI(),hl(),Es(6,"ds-form-field",9),fg(7,"input",10),MI(),hl(),Es(8,"ds-form-field",11),fg(9,"input",12),MI(),hl(),jw(10,ve,3,1,"ds-fieldset",13),Es(11,"ds-form-actions")(12,"button",14),xC(13),hl(),Es(14,"button",15),vg("click",function(){pf(e);let o=eC();return hf(o.cancel())}),xC(15,"Cancel"),hl()()();}if(i&2){let e=eC();dg("formGroup",e.form),BE(),Bw(e.isPlatformMode?-1:1),BE(2),dg("formControl",e.authTypeControl),xI(),BE(),$w(e.authTypeOptions),BE(3),dg("formControl",e.nameControl),xI(),BE(2),dg("formControl",e.descriptionControl),xI(),BE(),Bw(e.credentialFields().length>0?10:-1),BE(2),dg("disabled",e.form.invalid||e.isSubmitting()),BE(),Dl(" ",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?$i(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=nt;authTypeLabel=it;scopeOptions=[{value:"namespace",label:D.namespace},{value:"userOnNs",label:D.userOnNs},{value:"userGlobal",label:D.userGlobal}];nameControl=new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]});descriptionControl=new Te(null);authTypeControl=new Te("ApiKeyAuthSetting",{nonNullable:true,validators:[fn.required]});scopeControl=new Te("namespace",{nonNullable:true});form=new pt({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new Te("",{nonNullable:true});usernameControl=new Te("",{nonNullable:true});passwordControl=new Te("",{nonNullable:true});tokenControl=new Te("",{nonNullable:true});discoveryUrlControl=new Te("",{nonNullable:true});authorizationUrlControl=new Te("",{nonNullable:true});tokenUrlControl=new Te("",{nonNullable:true});clientIdControl=new Te("",{nonNullable:true});clientSecretControl=new Te("",{nonNullable:true});scopesControl=new Te("",{nonNullable:true});resourceUrlControl=new Te("",{nonNullable:true});selectedAuthType=F$1(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=rT(()=>_e[this.selectedAuthType()]);isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Of(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,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=vw({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&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return n.cancel()}),xC(3," \u2190 Auth settings "),hl()(),jw(4,Ce,2,0,"p",2)(5,be,16,8,"form",3),hl()),e&2&&(BE(),dg("title",n.isEditMode()?"Edit auth setting":"New auth setting"),BE(3),Bw(n.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,at,an,rn,Ut,nd,bo,xo,Lt,Gt,pa,mo,po,Vn,An],encapsulation:2})};
|
|
2
2
|
export{me as AuthSettingFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {y}from'./chunk-
|
|
1
|
+
import {y}from'./chunk-Ncao0R2n.js';import {g,aB as se,aC as T,aa as br,a1 as ga,ad as ne,a2 as ha,aD as $y,a6 as x}from'./main-6MVJZWGK.js';var v=class i{userState=g(y);membership=g(se);currentUser$=T(this.userState.currentUser);cache=new Map;isAdminOfNamespace$(e){if(!e)return br(false);let t=this.cache.get(e);if(t)return t;let s=this.currentUser$.pipe(ga(a=>a?a.isAdmin?br(true):this.membership.getMembersNamespaceMembership(e).pipe(ne(d=>d.some(n=>n.id===a.id&&n.role==="ADMIN")),ha(()=>br(false))):br(false)),$y({bufferSize:1,refCount:false}));return this.cache.set(e,s),s}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};export{v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {y,p as pt,T as Te,a as fn,U as Ut,n as nd,b as bo,x as xo,L as Lt,G as Gt,m as mo,c as po,A as An,v as va,d as pn,h as hn,e as cn,g as dn,o as on,i as at,j as an,q as sn,l as ko}from'./chunk-
|
|
1
|
+
import {y,p as pt,T as Te,a as fn,U as Ut,n as nd,b as bo,x as xo,L as Lt,G as Gt,m as mo,c as po,A as An,v as va,d as pn,h as hn,e as cn,g as dn,o as on,i as at,j as an,q as sn,l as ko}from'./chunk-Ncao0R2n.js';import {g,I as we,W,H as J,$ as $i,K as U,v as vw,E as Es,f as fg,Q as vg,j as jw,a as hl,R as MI,x as xC,b as BE,P as dg,c as Bw,S as xI,s as Dl,a4 as je,a5 as vd,a6 as x,t as eC,Y as Yw,F as Fg,a7 as Fn,u as pf,w as hf,U as Uw,k as $w}from'./main-6MVJZWGK.js';var I=class e{api=g(je);isLoading=$i(false);result=$i(null);errorMessage=$i(null);invoke(t,n,o,l){return this.isLoading.set(true),this.result.set(null),this.errorMessage.set(null),this.api.invoke({namespaceId:t,userId:n||void 0,toolName:o,payload:l||void 0}).pipe(vd({next:v=>{this.result.set(v),this.isLoading.set(false);},error:v=>{this.errorMessage.set(le(v)),this.isLoading.set(false);}}))}reset(){this.result.set(null),this.errorMessage.set(null);}static \u0275fac=function(n){return new(n||e)};static \u0275prov=x({token:e,factory:e.\u0275fac,providedIn:"root"})};function le(e){if(e instanceof Fn){let t=e.error;return t&&typeof t=="object"&&"message"in t&&typeof t.message=="string"?t.message:typeof t=="string"&&t.trim().length>0?t:e.statusText||`HTTP ${e.status}`}return e instanceof Error?e.message:"Unknown error"}var de=(e,t)=>t.id;function me(e,t){e&1&&(Es(0,"p",14),xC(1,"Loading namespaces\u2026"),hl());}function pe(e,t){if(e&1&&(Es(0,"option",17),xC(1),hl()),e&2){let n=t.$implicit;dg("value",n.id),BE(),Fg(n.name);}}function ce(e,t){if(e&1&&(Es(0,"select",15)(1,"option",16),xC(2,"Select a namespace"),hl(),Uw(3,pe,2,2,"option",17,de),hl(),MI()),e&2){let n=eC(2);xI(),BE(3),$w(n.namespaces());}}function ue(e,t){if(e&1&&jw(0,me,2,0,"p",14)(1,ce,5,0,"select",15),e&2){let n=eC();Bw(n.namespacesLoading()?0:1);}}function fe(e,t){if(e&1&&fg(0,"input",3),e&2){let n=eC();dg("value",n.namespaceName()??n.namespaceId);}}function ge(e,t){if(e&1){let n=Yw();Es(0,"button",18),vg("click",function(){pf(n);let l=eC();return hf(l.reset())}),xC(1,"Clear result"),hl();}}function ve(e,t){e&1&&(Es(0,"ds-card",12)(1,"pre",19),xC(2),hl()()),e&2&&(BE(2),Fg(t));}function ye(e,t){e&1&&(Es(0,"span",21),xC(1,"Metadata"),hl(),Es(2,"pre",19),xC(3),hl()),e&2&&(BE(3),Fg(t));}function Ce(e,t){if(e&1&&(Es(0,"dt"),xC(1,"Type"),hl(),Es(2,"dd",23),xC(3),hl()),e&2){let n=eC(2);BE(3),Fg(n.errorType);}}function _e(e,t){if(e&1&&(Es(0,"dt"),xC(1,"Message"),hl(),Es(2,"dd"),xC(3),hl()),e&2){let n=eC(2);BE(3),Fg(n.errorMessage);}}function be(e,t){if(e&1&&(Es(0,"span",21),xC(1,"Tool error details"),hl(),Es(2,"dl",22),jw(3,Ce,4,1),jw(4,_e,4,1),hl()),e&2){let n=eC();BE(3),Bw(n.errorType?3:-1),BE(),Bw(n.errorMessage?4:-1);}}function he(e,t){if(e&1&&(Es(0,"ds-card",13)(1,"div")(2,"ds-tag",20),xC(3),hl()(),Es(4,"span",21),xC(5,"Output"),hl(),Es(6,"pre",19),xC(7),hl(),jw(8,ye,4,1),Es(9,"span",21),xC(10,"Structured output"),hl(),Es(11,"pre",19),xC(12),hl(),jw(13,be,5,2),hl()),e&2){let n,o=t,l=eC();dg("heading","Result \u2014 "+o.toolName),BE(2),dg("variant",o.success?"accent":"outline"),BE(),Fg(o.success?"Success":"Tool error"),BE(4),Fg(o.output),BE(),Bw((n=l.formatMetadata(o.metadata))?8:-1,n),BE(4),Fg(l.formatStructuredOutput(o.structuredOutput)??"null"),BE(),Bw(o.errorType||o.errorMessage?13:-1);}}var re=class e{destroyRef=g(we);route=g(W);namespaceController=g(J);userState=g(y);state=g(I);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;namespaces=$i([]);namespacesLoading=$i(true);namespaceName=$i(null);form=new pt({namespaceId:new Te("",{nonNullable:true,validators:[fn.required]}),userId:new Te("",{nonNullable:true}),toolName:new Te("",{nonNullable:true,validators:[fn.required]}),payload:new Te("",{nonNullable:true})});ngOnInit(){let t=this.userState.currentUser()?.id;t?this.form.controls.userId.patchValue(t):this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:n=>{n.id&&this.form.controls.userId.patchValue(n.id);}}),this.isPlatformMode?this.namespaceController.listAllNamespace().pipe(U(this.destroyRef)).subscribe({next:n=>{this.namespaces.set(n.map(o=>({id:o.id,name:o.name}))),this.namespacesLoading.set(false);},error:()=>this.namespacesLoading.set(false)}):(this.form.controls.namespaceId.patchValue(this.namespaceId),this.namespacesLoading.set(false),this.namespaceController.getByIdNamespace(this.namespaceId).pipe(U(this.destroyRef)).subscribe({next:n=>this.namespaceName.set(n.name),error:()=>this.namespaceName.set(this.namespaceId)}));}submit(){if(this.form.invalid||this.state.isLoading())return;let{namespaceId:t,userId:n,toolName:o,payload:l}=this.form.getRawValue();this.state.invoke(t,n.trim()||void 0,o.trim(),l.trim()||void 0).pipe(U(this.destroyRef)).subscribe();}reset(){this.state.reset();}formatMetadata(t){return !t||Object.keys(t).length===0?null:JSON.stringify(t,null,2)}formatStructuredOutput(t){return t===void 0?null:JSON.stringify(t,null,2)}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=vw({type:e,selectors:[["agentos-tool-invoke"]],decls:18,vars:8,consts:[["title","Tool invoke",3,"description"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Namespace","controlId","ti-namespace","required",""],["dsControl","","id","ti-namespace","type","text","readonly","",3,"value"],["label","User ID","labelHint","optional","controlId","ti-user"],["dsControl","","id","ti-user","type","text","formControlName","userId","placeholder","UUID of the user \u2014 adds user-scoped overlay layers","autocomplete","off"],["label","Tool name","controlId","ti-tool","required","","hint","Exact tool name as returned by the agent definition inspect page. When not found, the error response lists all available tools for the selected namespace."],["dsControl","","mono","","id","ti-tool","type","text","formControlName","toolName","placeholder","e.g. MY_FILES__listFiles","autocomplete","off","spellcheck","false"],["label","Payload","labelHint","optional","controlId","ti-payload"],["dsControl","","mono","","id","ti-payload","formControlName","payload","rows","6","placeholder",'JSON arguments for the tool, e.g. {"path": "/some/dir"} \u2014 leave empty for tools with no input.',"spellcheck","false"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button"],["heading","Error"],[3,"heading"],[1,"ds-hint"],["dsControl","","id","ti-namespace","formControlName","namespaceId"],["value","","disabled",""],[3,"value"],["dsButton","","type","button",3,"click"],[1,"ds-pre"],[3,"variant"],[1,"ds-micro"],["dsDefinitionList",""],[1,"ds-mono"]],template:function(n,o){if(n&1&&(Es(0,"ds-page"),fg(1,"ds-section-header",0),Es(2,"form",1),vg("ngSubmit",function(){return o.submit()}),Es(3,"ds-form-field",2),jw(4,ue,2,1)(5,fe,1,1,"input",3),hl(),Es(6,"ds-form-field",4),fg(7,"input",5),MI(),hl(),Es(8,"ds-form-field",6),fg(9,"input",7),MI(),hl(),Es(10,"ds-form-field",8),fg(11,"textarea",9),MI(),hl(),Es(12,"ds-form-actions")(13,"button",10),xC(14),hl(),jw(15,ge,2,0,"button",11),hl()(),jw(16,ve,3,1,"ds-card",12),jw(17,he,14,7,"ds-card",13),hl()),n&2){let l,v;BE(),dg("description",o.isPlatformMode?"Execute any registered tool directly \u2014 bypasses the normal agent-run pipeline. Restricted to super-admins.":"Execute a registered tool directly in this namespace \u2014 bypasses the normal agent-run pipeline."),BE(),dg("formGroup",o.form),BE(2),Bw(o.isPlatformMode?4:5),BE(3),xI(),BE(2),xI(),BE(2),xI(),BE(2),dg("disabled",o.form.invalid||o.state.isLoading()),BE(),Dl(" ",o.state.isLoading()?"Running\u2026":"Run tool"," "),BE(),Bw(o.state.result()||o.state.errorMessage()?15:-1),BE(),Bw((l=o.state.errorMessage())?16:-1,l),BE(),Bw((v=o.state.result())?17:-1,v);}},dependencies:[Ut,nd,bo,xo,Lt,Gt,mo,po,An,va,pn,hn,cn,dn,on,at,an,sn,ko],encapsulation:2})};export{re as ToolInvokeComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {v}from'./chunk-BwLhUg85.js';import {I}from'./chunk-DFkt8tY0.js';import {O}from'./chunk-CseRCWgR.js';import {g,W,q as F,I as we,a8 as _,a9 as F$1,aa as br,$ as $i,ab as le,r as rT,a1 as ga,K as U,O as Of,ac as by,v as vw,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,c as Bw,a2 as ha,ad as ne,Y as Yw,U as Uw,ae as Pw,R as MI,f as fg,t as eC,k as $w,S as xI,s as Dl,F as Fg,u as pf,w as hf}from'./main-PUOSMZMX.js';import {p as pt,T as Te$1,a as fn,d as pn,h as hn,e as cn,r as ln,g as dn,o as on,i as at,j as an,t as rn,U as Ut,n as nd,b as bo,x as xo,L as Lt,u as vn,G as Gt,w as pa,m as mo,c as po,V as Vn,A as An,W as Wt}from'./chunk-bCI6skcH.js';import'./chunk-2gGq060a.js';var be=(i,e)=>e.value;function _e(i,e){i&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function xe(i,e){if(i&1&&(Es(0,"label",6),fg(1,"input",22),MI(),xC(2),hl()),i&2){let t=e.$implicit,n=eC(2);BE(),dg("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),xI(),BE(),Dl(" ",t.label," ");}}function Ie(i,e){if(i&1&&(Es(0,"option",10),xC(1),hl()),i&2){let t=e.$implicit;dg("value",t.type),BE(),Fg(t.displayName);}}function Ne(i,e){if(i&1&&(Es(0,"option",10),xC(1),hl()),i&2){let t=e.$implicit;dg("value",t.value),BE(),Fg(t.label);}}function Ae(i,e){if(i&1&&(Es(0,"div",18)(1,"label",6),fg(2,"input",23),MI(),xC(3," Grant automatically "),hl(),Es(4,"p",2),xC(5),hl()()),i&2){let t=eC(2);BE(2),dg("formControl",t.autoGrantControl),xI(),BE(3),Dl(" Give this integration to ",t.autoGrantReach(),", without each agent having to declare it. An agent can still opt out by mapping this configuration to an empty tool list. ");}}function Ee(i,e){if(i&1){let t=Yw();Es(0,"ds-card")(1,"ds-json-schema-form",24),vg("valueChange",function(a){pf(t);let p=eC(2);return hf(p.onParamsChange(a))}),hl()();}if(i&2){let t=eC(2);BE(),dg("schema",e)("value",t.initialParams());}}function Fe(i,e){if(i&1){let t=Yw();Es(0,"button",25),vg("click",function(){pf(t);let a=eC(2);return hf(a.exportYaml())}),xC(1),hl();}if(i&2){let t=eC(2);dg("disabled",t.isExporting()),BE(),Dl(" ",t.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Te(i,e){if(i&1){let t=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(t);let a=eC();return hf(a.submit())}),Es(1,"ds-fieldset",5),Uw(2,xe,3,4,"label",6,Pw().trackByScope,true),hl(),Es(4,"ds-form-field",7)(5,"select",8)(6,"option",9),xC(7,"Select type"),hl(),Uw(8,Ie,2,2,"option",10,Pw().trackByType,true),hl(),MI(),hl(),Es(10,"ds-form-field",11),fg(11,"input",12),MI(),hl(),Es(12,"ds-form-field",13),fg(13,"textarea",14),MI(),hl(),Es(14,"ds-form-field",15)(15,"select",16)(16,"option",17),xC(17,"None"),hl(),Uw(18,Ne,2,2,"option",10,be),hl(),MI(),hl(),jw(20,Ae,6,2,"div",18),jw(21,Ee,2,2,"ds-card"),Es(22,"ds-form-actions")(23,"button",19),xC(24),hl(),jw(25,Fe,2,2,"button",20),Es(26,"button",21),vg("click",function(){pf(t);let a=eC();return hf(a.cancel())}),xC(27,"Cancel"),hl()()();}if(i&2){let t,n=eC();dg("formGroup",n.form),BE(),dg("disabled",n.isEditMode()),BE(),$w(n.scopeOptions),BE(3),dg("formControl",n.typeControl),xI(),BE(3),$w(n.integrationTypes()),BE(3),dg("formControl",n.nameControl),xI(),BE(2),dg("formControl",n.descriptionControl),xI(),BE(2),dg("formControl",n.authSettingNameControl),xI(),BE(),dg("ngValue",null),BE(2),$w(n.authSettingOptions()),BE(2),Bw(n.isAutoGrantable()?20:-1),BE(),Bw((t=n.schema())?21:-1,t),BE(2),dg("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),BE(),Dl(" ",n.isEditMode()?"Save changes":"Create"," "),BE(),Bw(n.isEditMode()?25:-1);}}var Ve=new Set(["platform","namespace","userOnNs","userGlobal"]),w=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ve=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(O);integrationTypeController=g(_);authSettingState=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?br(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new pt({name:new Te$1("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te$1(null),type:new Te$1("",{nonNullable:true,validators:[fn.required]}),scope:new Te$1("namespace",{nonNullable:true}),autoGrant:new Te$1(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);isExporting=$i(false);scopeOptions=[{value:"platform",label:w.platform},{value:"namespace",label:w.namespace},{value:"userOnNs",label:w.userOnNs},{value:"userGlobal",label:w.userGlobal}];authSettingNameControl=new Te$1(null);loadedAuthSettings=$i([]);authSettingsLoaded=$i(false);savedAuthSettingName=$i(null);authSettingsScope$=new le;authSettingOptions=rT(()=>{let e=this.loadedAuthSettings(),t=this.savedAuthSettingName();return !t||!this.authSettingsLoaded()||e.some(n=>n.value===t)?e:[...e,{value:t,label:`${t} (not found)`}]});paramsValue=$i(null);initialParams=$i(null);integrationTypes=F$1(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=F$1(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});scopeValue=F$1(this.form.controls.scope.valueChanges,{initialValue:this.form.controls.scope.value});schema=rT(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});isAutoGrantable=rT(()=>{let e=this.selectedType();return e?this.integrationTypes().find(t=>t.type===e)?.autoGrantable??false:false});autoGrantReach=rT(()=>{switch(this.scopeValue()){case "platform":return "every agent of this environment";case "namespace":return "every agent of this namespace";default:return "your own runs"}});existingConfig=null;constructor(){this.authSettingsScope$.pipe(ga(e=>this.loadAuthSettingLayers(e)),U(this.destroyRef)).subscribe(e=>{this.loadedAuthSettings.set(this.toAuthSettingOptions(e)),this.authSettingsLoaded.set(true);}),Of(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let e=this.route.snapshot.paramMap,t=this.route.snapshot.queryParamMap,n=e.get("integrationId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable(),this.loadAuthSettingsForScope("platform");return}let a=this.parseScope(t.get("scope"));this.scopeControl.setValue(a),this.loadAuthSettingsForScope(a),this.scopeControl.valueChanges.pipe(U(this.destroyRef)).subscribe(D=>{this.loadAuthSettingsForScope(D);});let p=t.get("template");p&&this.hydrateFromTemplate(p);}parseScope(e){return e&&Ve.has(e)?e:"namespace"}deriveScopeFromConfig(e){return !e.userId&&!e.namespaceId?"platform":e.userId?e.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.existingConfig=t;let n=this.deriveScopeFromConfig(t);this.scopeControl.setValue(n),this.applyConfigToForm(t),this.loadAuthSettingsForScope(n),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[IntegrationForm] Could not load config '${e}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.applyConfigToForm(t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:t=>{console.warn(`[IntegrationForm] Could not hydrate from template ${e}:`,t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(e){this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.typeControl.setValue(e.integrationType),this.initialParams.set(e.parameters),this.paramsValue.set(e.parameters),this.authSettingNameControl.setValue(e.authSettingName??null),this.savedAuthSettingName.set(e.authSettingName??null),this.autoGrantControl.setValue(e.autoGrant??false);}loadAuthSettingsForScope(e){this.authSettingsLoaded.set(false),this.authSettingsScope$.next(e);}loadAuthSettingLayers(e){let t=(p,D)=>D.pipe(ha(()=>br([])),ne(Se=>({label:p,settings:Se}))),n=t("platform",this.authSettingState.loadPlatformSettings()),a=t("mine",this.authSettingState.loadUserSettings("global"));return e==="platform"||e==="userGlobal"?by([a,n]):by([t("mine",this.authSettingState.loadUserSettings(this.namespaceId)),t("namespace",this.authSettingState.loadNamespaceSettings(this.namespaceId)),a,n])}toAuthSettingOptions(e){let t=new Map;for(let{label:n,settings:a}of e)for(let{name:p}of a)p&&t.set(p,(t.get(p)??new Set).add(n));return [...t.entries()].sort(([n],[a])=>n.localeCompare(a)).map(([n,a])=>({value:n,label:`${n} (${[...a].join(", ")})`}))}onParamsChange(e){this.paramsValue.set(e);}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let e=this.descriptionControl.value?.trim(),t={name:this.nameControl.value.trim(),description:e||null,integrationType:this.typeControl.value,parameters:this.paramsValue(),authSettingName:this.authSettingNameControl.value||null,autoGrant:this.isAutoGrantable()&&this.autoGrantControl.value},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,t,n,this.existingConfig):this.state.create(t,n,this.namespaceId??null)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let e=this.existingConfig?.id;!e||this.isExporting()||(this.isExporting.set(true),this.state.exportAsYaml(e).pipe(U(this.destroyRef)).subscribe({next:t=>{let n=new Blob([t],{type:"application/yaml"}),a=URL.createObjectURL(n),p=document.createElement("a");p.href=a,p.download=`${this.existingConfig?.name??"integration"}.yaml`,p.click(),URL.revokeObjectURL(a),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"]);}trackByType(e,t){return t.type}trackByScope(e,t){return t.value}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=vw({type:i,selectors:[["agentos-integration-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to integrations",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Scope",3,"disabled"],["dsCheck",""],["label","Type","controlId","integration-type","required",""],["dsControl","","id","integration-type",3,"formControl"],["value","","disabled",""],[3,"value"],["label","Name","controlId","integration-name","required",""],["dsControl","","id","integration-name","type","text","placeholder","Integration name","autocomplete","off",3,"formControl"],["label","Description","controlId","integration-description"],["dsControl","","id","integration-description","placeholder","Optional description","rows","3",3,"formControl"],["label","Auth Setting","controlId","integration-auth-setting","hint","Only the name is saved. It is resolved at run time for the user running the case, the most specific layer winning (user on this namespace > namespace > user > platform), so a shared integration can rely on each user's own auth setting of that name."],["dsControl","","id","integration-auth-setting",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-stack--sm"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["type","radio",3,"value","formControl","disabled"],["type","checkbox",3,"formControl"],[3,"valueChange","schema","value"],["dsButton","","type","button",3,"click","disabled"]],template:function(t,n){t&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return n.cancel()}),xC(3," \u2190 Integrations "),hl()(),jw(4,_e,2,0,"p",2)(5,Te,28,12,"form",3),hl()),t&2&&(BE(),dg("title",n.isEditMode()?"Edit integration":"New integration"),BE(3),Bw(n.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,on,at,an,rn,Ut,nd,bo,xo,Lt,vn,Gt,pa,mo,po,Vn,An,Wt],encapsulation:2})};export{ve as IntegrationFormComponent};
|
|
1
|
+
import {v}from'./chunk-B6qP3Hvp.js';import {I}from'./chunk-DdQVnFkx.js';import {O}from'./chunk-Xi-gu1fS.js';import {g,W,q as F,I as we,a8 as _,a9 as F$1,aa as br,$ as $i,ab as le,r as rT,a1 as ga,K as U,O as Of,ac as by,v as vw,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,c as Bw,a2 as ha,ad as ne,Y as Yw,U as Uw,ae as Pw,R as MI,f as fg,t as eC,k as $w,S as xI,s as Dl,F as Fg,u as pf,w as hf}from'./main-6MVJZWGK.js';import {p as pt,T as Te$1,a as fn,d as pn,h as hn,e as cn,r as ln,g as dn,o as on,i as at,j as an,t as rn,U as Ut,n as nd,b as bo,x as xo,L as Lt,u as vn,G as Gt,w as pa,m as mo,c as po,V as Vn,A as An,W as Wt}from'./chunk-Ncao0R2n.js';import'./chunk-DbZbECFq.js';var be=(i,e)=>e.value;function _e(i,e){i&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function xe(i,e){if(i&1&&(Es(0,"label",6),fg(1,"input",22),MI(),xC(2),hl()),i&2){let t=e.$implicit,n=eC(2);BE(),dg("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),xI(),BE(),Dl(" ",t.label," ");}}function Ie(i,e){if(i&1&&(Es(0,"option",10),xC(1),hl()),i&2){let t=e.$implicit;dg("value",t.type),BE(),Fg(t.displayName);}}function Ne(i,e){if(i&1&&(Es(0,"option",10),xC(1),hl()),i&2){let t=e.$implicit;dg("value",t.value),BE(),Fg(t.label);}}function Ae(i,e){if(i&1&&(Es(0,"div",18)(1,"label",6),fg(2,"input",23),MI(),xC(3," Grant automatically "),hl(),Es(4,"p",2),xC(5),hl()()),i&2){let t=eC(2);BE(2),dg("formControl",t.autoGrantControl),xI(),BE(3),Dl(" Give this integration to ",t.autoGrantReach(),", without each agent having to declare it. An agent can still opt out by mapping this configuration to an empty tool list. ");}}function Ee(i,e){if(i&1){let t=Yw();Es(0,"ds-card")(1,"ds-json-schema-form",24),vg("valueChange",function(a){pf(t);let p=eC(2);return hf(p.onParamsChange(a))}),hl()();}if(i&2){let t=eC(2);BE(),dg("schema",e)("value",t.initialParams());}}function Fe(i,e){if(i&1){let t=Yw();Es(0,"button",25),vg("click",function(){pf(t);let a=eC(2);return hf(a.exportYaml())}),xC(1),hl();}if(i&2){let t=eC(2);dg("disabled",t.isExporting()),BE(),Dl(" ",t.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Te(i,e){if(i&1){let t=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(t);let a=eC();return hf(a.submit())}),Es(1,"ds-fieldset",5),Uw(2,xe,3,4,"label",6,Pw().trackByScope,true),hl(),Es(4,"ds-form-field",7)(5,"select",8)(6,"option",9),xC(7,"Select type"),hl(),Uw(8,Ie,2,2,"option",10,Pw().trackByType,true),hl(),MI(),hl(),Es(10,"ds-form-field",11),fg(11,"input",12),MI(),hl(),Es(12,"ds-form-field",13),fg(13,"textarea",14),MI(),hl(),Es(14,"ds-form-field",15)(15,"select",16)(16,"option",17),xC(17,"None"),hl(),Uw(18,Ne,2,2,"option",10,be),hl(),MI(),hl(),jw(20,Ae,6,2,"div",18),jw(21,Ee,2,2,"ds-card"),Es(22,"ds-form-actions")(23,"button",19),xC(24),hl(),jw(25,Fe,2,2,"button",20),Es(26,"button",21),vg("click",function(){pf(t);let a=eC();return hf(a.cancel())}),xC(27,"Cancel"),hl()()();}if(i&2){let t,n=eC();dg("formGroup",n.form),BE(),dg("disabled",n.isEditMode()),BE(),$w(n.scopeOptions),BE(3),dg("formControl",n.typeControl),xI(),BE(3),$w(n.integrationTypes()),BE(3),dg("formControl",n.nameControl),xI(),BE(2),dg("formControl",n.descriptionControl),xI(),BE(2),dg("formControl",n.authSettingNameControl),xI(),BE(),dg("ngValue",null),BE(2),$w(n.authSettingOptions()),BE(2),Bw(n.isAutoGrantable()?20:-1),BE(),Bw((t=n.schema())?21:-1,t),BE(2),dg("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),BE(),Dl(" ",n.isEditMode()?"Save changes":"Create"," "),BE(),Bw(n.isEditMode()?25:-1);}}var Ve=new Set(["platform","namespace","userOnNs","userGlobal"]),w=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ve=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(O);integrationTypeController=g(_);authSettingState=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?br(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new pt({name:new Te$1("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te$1(null),type:new Te$1("",{nonNullable:true,validators:[fn.required]}),scope:new Te$1("namespace",{nonNullable:true}),autoGrant:new Te$1(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);isExporting=$i(false);scopeOptions=[{value:"platform",label:w.platform},{value:"namespace",label:w.namespace},{value:"userOnNs",label:w.userOnNs},{value:"userGlobal",label:w.userGlobal}];authSettingNameControl=new Te$1(null);loadedAuthSettings=$i([]);authSettingsLoaded=$i(false);savedAuthSettingName=$i(null);authSettingsScope$=new le;authSettingOptions=rT(()=>{let e=this.loadedAuthSettings(),t=this.savedAuthSettingName();return !t||!this.authSettingsLoaded()||e.some(n=>n.value===t)?e:[...e,{value:t,label:`${t} (not found)`}]});paramsValue=$i(null);initialParams=$i(null);integrationTypes=F$1(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=F$1(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});scopeValue=F$1(this.form.controls.scope.valueChanges,{initialValue:this.form.controls.scope.value});schema=rT(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});isAutoGrantable=rT(()=>{let e=this.selectedType();return e?this.integrationTypes().find(t=>t.type===e)?.autoGrantable??false:false});autoGrantReach=rT(()=>{switch(this.scopeValue()){case "platform":return "every agent of this environment";case "namespace":return "every agent of this namespace";default:return "your own runs"}});existingConfig=null;constructor(){this.authSettingsScope$.pipe(ga(e=>this.loadAuthSettingLayers(e)),U(this.destroyRef)).subscribe(e=>{this.loadedAuthSettings.set(this.toAuthSettingOptions(e)),this.authSettingsLoaded.set(true);}),Of(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let e=this.route.snapshot.paramMap,t=this.route.snapshot.queryParamMap,n=e.get("integrationId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable(),this.loadAuthSettingsForScope("platform");return}let a=this.parseScope(t.get("scope"));this.scopeControl.setValue(a),this.loadAuthSettingsForScope(a),this.scopeControl.valueChanges.pipe(U(this.destroyRef)).subscribe(D=>{this.loadAuthSettingsForScope(D);});let p=t.get("template");p&&this.hydrateFromTemplate(p);}parseScope(e){return e&&Ve.has(e)?e:"namespace"}deriveScopeFromConfig(e){return !e.userId&&!e.namespaceId?"platform":e.userId?e.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.existingConfig=t;let n=this.deriveScopeFromConfig(t);this.scopeControl.setValue(n),this.applyConfigToForm(t),this.loadAuthSettingsForScope(n),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[IntegrationForm] Could not load config '${e}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.applyConfigToForm(t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:t=>{console.warn(`[IntegrationForm] Could not hydrate from template ${e}:`,t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(e){this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.typeControl.setValue(e.integrationType),this.initialParams.set(e.parameters),this.paramsValue.set(e.parameters),this.authSettingNameControl.setValue(e.authSettingName??null),this.savedAuthSettingName.set(e.authSettingName??null),this.autoGrantControl.setValue(e.autoGrant??false);}loadAuthSettingsForScope(e){this.authSettingsLoaded.set(false),this.authSettingsScope$.next(e);}loadAuthSettingLayers(e){let t=(p,D)=>D.pipe(ha(()=>br([])),ne(Se=>({label:p,settings:Se}))),n=t("platform",this.authSettingState.loadPlatformSettings()),a=t("mine",this.authSettingState.loadUserSettings("global"));return e==="platform"||e==="userGlobal"?by([a,n]):by([t("mine",this.authSettingState.loadUserSettings(this.namespaceId)),t("namespace",this.authSettingState.loadNamespaceSettings(this.namespaceId)),a,n])}toAuthSettingOptions(e){let t=new Map;for(let{label:n,settings:a}of e)for(let{name:p}of a)p&&t.set(p,(t.get(p)??new Set).add(n));return [...t.entries()].sort(([n],[a])=>n.localeCompare(a)).map(([n,a])=>({value:n,label:`${n} (${[...a].join(", ")})`}))}onParamsChange(e){this.paramsValue.set(e);}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let e=this.descriptionControl.value?.trim(),t={name:this.nameControl.value.trim(),description:e||null,integrationType:this.typeControl.value,parameters:this.paramsValue(),authSettingName:this.authSettingNameControl.value||null,autoGrant:this.isAutoGrantable()&&this.autoGrantControl.value},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,t,n,this.existingConfig):this.state.create(t,n,this.namespaceId??null)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let e=this.existingConfig?.id;!e||this.isExporting()||(this.isExporting.set(true),this.state.exportAsYaml(e).pipe(U(this.destroyRef)).subscribe({next:t=>{let n=new Blob([t],{type:"application/yaml"}),a=URL.createObjectURL(n),p=document.createElement("a");p.href=a,p.download=`${this.existingConfig?.name??"integration"}.yaml`,p.click(),URL.revokeObjectURL(a),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"]);}trackByType(e,t){return t.type}trackByScope(e,t){return t.value}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=vw({type:i,selectors:[["agentos-integration-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to integrations",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Scope",3,"disabled"],["dsCheck",""],["label","Type","controlId","integration-type","required",""],["dsControl","","id","integration-type",3,"formControl"],["value","","disabled",""],[3,"value"],["label","Name","controlId","integration-name","required",""],["dsControl","","id","integration-name","type","text","placeholder","Integration name","autocomplete","off",3,"formControl"],["label","Description","controlId","integration-description"],["dsControl","","id","integration-description","placeholder","Optional description","rows","3",3,"formControl"],["label","Auth Setting","controlId","integration-auth-setting","hint","Only the name is saved. It is resolved at run time for the user running the case, the most specific layer winning (user on this namespace > namespace > user > platform), so a shared integration can rely on each user's own auth setting of that name."],["dsControl","","id","integration-auth-setting",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-stack--sm"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["type","radio",3,"value","formControl","disabled"],["type","checkbox",3,"formControl"],[3,"valueChange","schema","value"],["dsButton","","type","button",3,"click","disabled"]],template:function(t,n){t&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return n.cancel()}),xC(3," \u2190 Integrations "),hl()(),jw(4,_e,2,0,"p",2)(5,Te,28,12,"form",3),hl()),t&2&&(BE(),dg("title",n.isEditMode()?"Edit integration":"New integration"),BE(3),Bw(n.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,on,at,an,rn,Ut,nd,bo,xo,Lt,vn,Gt,pa,mo,po,Vn,An,Wt],encapsulation:2})};export{ve as IntegrationFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {z as k$1,O as O$1,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-
|
|
1
|
+
import {z as k$1,O as O$1,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-Ncao0R2n.js';import {g,q as F,I as we,aq as k,ap as F$1,Z as Tr,$ as $i,a1 as ga,at as Cy,K as U$1,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,Y as Yw,u as pf,w as hf,s as Dl,l as lg}from'./main-6MVJZWGK.js';var K=(o,t)=>t.key;function H(o,t){if(o&1&&(Es(0,"p",3),xC(1),hl()),o&2){let e=eC();BE(),Fg(e.deletion.error());}}function U(o,t){o&1&&(Es(0,"p",4),xC(1,"Loading AI models\u2026"),hl());}function z(o,t){o&1&&(Es(0,"p",5),xC(1,"No platform AI models defined yet."),hl());}function G(o,t){o&1&&(Es(0,"p",4),xC(1,"No AI models match the current filter."),hl());}function J(o,t){if(o&1){let e=Yw();Es(0,"button",21),vg("click",function(){pf(e);let r=eC().$implicit,m=eC(2);return hf(m.edit(r))}),xC(1,"Edit"),hl();}if(o&2){let e=eC().$implicit;lg("aria-label","Edit "+e.title);}}function O(o,t){if(o&1){let e=Yw();Es(0,"tr",9)(1,"td",12),xC(2),hl(),Es(3,"td",13),xC(4),hl(),Es(5,"td",14),xC(6),hl(),Es(7,"td",15),xC(8),hl(),Es(9,"td",16),xC(10),hl(),Es(11,"td",17)(12,"div",18),jw(13,J,2,1,"button",19),Es(14,"agentos-row-delete-action",20),vg("deleteRequested",function(){let r=pf(e).$implicit,m=eC(2);return hf(m.deletion.request(r.key))})("deleteConfirmed",function(){let r=pf(e).$implicit,m=eC(2);return hf(m.confirmDelete(r))})("deleteCancelled",function(){pf(e);let r=eC(2);return hf(r.deletion.cancel())}),hl()()()();}if(o&2){let e=t.$implicit,a=eC(2);BE(2),Fg(e.title),BE(2),Fg(e.providerName),BE(2),Dl(" ",e.model.apiModelName," "),BE(2),Fg(e.model.priority),BE(2),Dl(" ",e.model.reasoningEffort?e.model.reasoningEffort.toLowerCase():"\u2014"," "),BE(3),Bw(a.deletion.confirmingId()!==e.key?13:-1),BE(),dg("rowKey",e.key)("rowLabel",e.title)("state",a.deletion);}}function Q(o,t){if(o&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Provider"),hl(),Es(8,"th",10),xC(9,"API model name"),hl(),Es(10,"th",10),xC(11,"Priority"),hl(),Es(12,"th",10),xC(13,"Reasoning effort"),hl(),Es(14,"th",10)(15,"span",11),xC(16,"Actions"),hl()()()(),Es(17,"tbody",8),Uw(18,O,15,9,"tr",9,K),hl()()()),o&2){let e=eC();BE(18),$w(e.rowFilter.filteredRows());}}var j=class o{router=g(F);destroyRef=g(we);aiModelController=g(k);aiProviderController=g(F$1);refresh$=new Tr(void 0);isLoading=$i(true);deletion=k$1();rows=$i([]);rowFilter=O$1(this.rows,t=>[t.title,t.model.apiModelName,t.providerName].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(this.isLoading.set(true),Cy([this.aiModelController.listPlatformLevelAiModel(),this.aiProviderController.listAiProvider("none")]))),U$1(this.destroyRef)).subscribe({next:([t,e])=>{let a=new Map(e.map(r=>[r.id??"",r.name]));this.rows.set(t.map((r,m)=>({key:r.id??`model:${m}`,model:r,title:r.alias??r.apiModelName,providerName:a.get(r.aiProviderId)??r.aiProviderId}))),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","ai-models","new"]);}edit(t){t.model.id&&this.router.navigate(["/agentos","admin","ai-models",t.model.id,"edit"]);}confirmDelete(t){t.model.id&&this.deletion.execute(t.key,{request$:this.aiModelController.deleteAiModel(t.model.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${t.title}" failed. Try again.`});}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=vw({type:o,selectors:[["agentos-platform-ai-models"]],decls:9,vars:3,consts:[["title","Platform AI models","description","AI models shared across every namespace."],["label","Filter AI models","placeholder","Filter AI models\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform AI models"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Provider"],["role","cell","data-label","API model name",1,"settings-table__secondary"],["role","cell","data-label","Priority"],["role","cell","data-label","Reasoning effort"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(e,a){e&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(m){return a.rowFilter.query.set(m)}),hl(),Es(2,"button",2),vg("click",function(){return a.openCreateForm()}),xC(3,"New AI model"),hl()(),jw(4,H,2,1,"p",3),jw(5,U,2,0,"p",4)(6,z,2,0,"p",5)(7,G,2,0,"p",4)(8,Q,20,0,"div",6)),e&2&&(BE(),dg("query",a.rowFilter.query()),BE(3),Bw(a.deletion.error()?4:-1),BE(),Bw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{j as PlatformAiModelsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {i}from'./chunk-
|
|
1
|
+
import {i}from'./chunk-DbZbECFq.js';import {y}from'./chunk-Ncao0R2n.js';import {g as g$1,ap as F,Z as Tr,at as Cy,a1 as ga,a2 as ha,aa as br,ad as ne,aD as $y,a5 as vd,L as w,a6 as x}from'./main-6MVJZWGK.js';var g="none",N="me",O=class p{nsController=g$1(F);userState=g$1(y);refresh$=new Tr(void 0);namespaceId$=new Tr(null);vm$=Cy([this.namespaceId$,this.refresh$]).pipe(ga(([e])=>{let r=this.loadPlatformProviders().pipe(ha(()=>br([])));return e?Cy([r,this.loadNamespaceProviders(e).pipe(ha(()=>br([]))),this.loadUserProviders(e).pipe(ha(()=>br([]))),this.loadUserProviders("global").pipe(ha(()=>br([])))]).pipe(ne(([i,n,s,t])=>({platform:i,namespace:n,userOnNs:s,userGlobal:t}))):Cy([r,this.loadNamespaceProviders("").pipe(ha(()=>br([]))),this.loadUserProviders("global").pipe(ha(()=>br([])))]).pipe(ne(([i,n,s])=>({platform:i,namespace:n,userOnNs:[],userGlobal:s})))}),$y({bufferSize:1,refCount:true}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e);}refresh(){this.refresh$.next();}loadUserProviders(e){let r=e==="global"?g:e;return this.nsController.listAiProvider(r,N)}userGlobal$=i(this.refresh$,()=>this.loadUserProviders("global"),[]);loadPlatformProviders(){return this.nsController.listAiProvider(g)}loadNamespaceProviders(e){return e?this.nsController.listAiProvider(e):br([])}getById(e,r){return this.nsController.getByIdAiProvider(e)}create(e,r,i){let s=this.userState.currentUser()?.id;if((r==="userOnNs"||r==="userGlobal")&&!s)throw new Error(`Cannot create ${r} provider before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(r==="namespace"){if(i===void 0||i==="")throw new Error("Cannot create namespace-scoped provider without a namespaceId");let S={name:e.name,apiType:e.apiType,description:e.description,baseUrl:e.baseUrl,apiKey:e.apiKey,headers:e.headers??void 0,namespaceId:i??void 0};return this.nsController.createAiProvider(S).pipe(vd(()=>this.refresh()))}if(r==="userOnNs"&&!i)throw new Error("Cannot create userOnNs provider without a namespaceId");let t={name:e.name,apiType:e.apiType,description:e.description,baseUrl:e.baseUrl,apiKey:e.apiKey,headers:e.headers??void 0,userId:s,namespaceId:r==="userOnNs"?i:void 0};return this.nsController.createAiProvider(t).pipe(vd(()=>this.refresh()))}update(e,r,i,n){let s=r.apiKey===null?{}:{apiKey:r.apiKey},t=w({name:r.name,apiType:r.apiType,description:r.description,baseUrl:r.baseUrl,headers:r.headers??void 0,namespaceId:n.namespaceId,userId:n.userId},s);return this.nsController.updateAiProvider(e,t).pipe(vd(()=>this.refresh()))}delete(e,r){return this.nsController.deleteAiProvider(e).pipe(vd(()=>this.refresh()))}static \u0275fac=function(r){return new(r||p)};static \u0275prov=x({token:p,factory:p.\u0275fac,providedIn:"root"})};export{O};
|