@whoz-oss/coday-client 0.0.0-workstream-forge.325 → 0.0.0-workstream-forge.326
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-BnR0LAO8.js → chunk-B4QJcXnP.js} +1 -1
- package/browser/{chunk-BT5XTRqh.js → chunk-B6QDDnOW.js} +1 -1
- package/browser/{chunk-BGV30iCr.js → chunk-B6sYf1j_.js} +1 -1
- package/browser/{chunk-8I9n3lLn.js → chunk-BJB2wYDC.js} +1 -1
- package/browser/{chunk-BEFOXFc7.js → chunk-BKQaiiDm.js} +1 -1
- package/browser/chunk-BNW_UB32.js +1 -0
- package/browser/{chunk-BJWbTVL_.js → chunk-BNwyfYSr.js} +1 -1
- package/browser/chunk-BQgwuEVI.js +1 -0
- package/browser/{chunk-D-Fh__Rr.js → chunk-BX0TCJGF.js} +1 -1
- package/browser/chunk-B_HwXrtQ.js +1 -0
- package/browser/{chunk-B0CbpOrN.js → chunk-BiC6IJLJ.js} +1 -1
- package/browser/{chunk-PUAz3rec.js → chunk-Bmt85b9e.js} +1 -1
- package/browser/{chunk-BzmbXSRo.js → chunk-BtllBdOZ.js} +1 -1
- package/browser/{chunk-e4zJYzoL.js → chunk-BzCl7uMh.js} +1 -1
- package/browser/{chunk-BrfcY3tC.js → chunk-C0Lw7VMt.js} +1 -1
- package/browser/{chunk-D_CCZjeF.js → chunk-CDqiY5Rf.js} +1 -1
- package/browser/chunk-CG27SgJm.js +1 -0
- package/browser/{chunk-BrmadML0.js → chunk-CZPehjGB.js} +1 -1
- package/browser/chunk-C_tG-O6X.js +1 -0
- package/browser/chunk-Cdygrlhj.js +1 -0
- package/browser/{chunk-Bx9BfTbQ.js → chunk-ChwyhN7l.js} +1 -1
- package/browser/chunk-CjbU1hmS.js +1 -0
- package/browser/{chunk-CEwLL0y6.js → chunk-CoPRV7_K.js} +1 -1
- package/browser/chunk-Cp6XPrd_.js +1 -0
- package/browser/{chunk-3MZx6Kaj.js → chunk-CpC2V56W.js} +1 -1
- package/browser/{chunk-CWUT8BmF.js → chunk-CzNxwmwF.js} +1 -1
- package/browser/{chunk-v5ROMoP7.js → chunk-D0BRxefp.js} +1 -1
- package/browser/{chunk-C2vvMqUu.js → chunk-D0iMXAi6.js} +1 -1
- package/browser/{chunk-BLLdCsEy.js → chunk-D6j56Kh6.js} +1 -1
- package/browser/{chunk-Bucs_YQV.js → chunk-DGvA9EMF.js} +1 -1
- package/browser/{chunk-z_6fP4xn.js → chunk-DHPXIsXJ.js} +1 -1
- package/browser/{chunk-BIqKO9_X.js → chunk-DQ809zoB.js} +1 -1
- package/browser/{chunk-CxM3QN6m.js → chunk-DZp724cW.js} +1 -1
- package/browser/{chunk-j7CwKDfo.js → chunk-DiQNvMeR.js} +1 -1
- package/browser/{chunk-7TqeWvXK.js → chunk-Dt0eIaud.js} +1 -1
- package/browser/{chunk-B2dLmELH.js → chunk-EZsHLrVl.js} +1 -1
- package/browser/{chunk-BsmAqurT.js → chunk-GWxavAtB.js} +1 -1
- package/browser/{chunk-C9Lvnk2W.js → chunk-JrGCfHkP.js} +1 -1
- package/browser/chunk-NNFw4bVT.js +1 -0
- package/browser/{chunk-CIGX4h3f.js → chunk-NSyXB8Tu.js} +1 -1
- package/browser/{chunk-2vMDhSwg.js → chunk-V5vAYMRr.js} +1 -1
- package/browser/{chunk-Y0RP9yux.js → chunk-VbI0SYDI.js} +20 -20
- package/browser/{chunk-BXIfWVJs.js → chunk-YwnuVV6j.js} +1 -1
- package/browser/{chunk-kWYdxdb6.js → chunk-d7qpGlVe.js} +1 -1
- package/browser/{chunk-BeFguURn.js → chunk-e5qg27G2.js} +1 -1
- package/browser/{chunk-BiOlkBEs.js → chunk-mVP550cv.js} +1 -1
- package/browser/{chunk-Vsk0JW3A.js → chunk-rvd0XXmM.js} +1 -1
- package/browser/index.html +2 -2
- package/browser/{main-NUYYC27E.js → main-6TWWBEJW.js} +8 -8
- package/package.json +1 -1
- package/browser/chunk-BibZXPj5.js +0 -1
- package/browser/chunk-BufqW_U3.js +0 -1
- package/browser/chunk-CC8u54WZ.js +0 -1
- package/browser/chunk-CRV6iGhg.js +0 -1
- package/browser/chunk-D-pY3GeH.js +0 -1
- package/browser/chunk-DKYHSdHT.js +0 -1
- package/browser/chunk-NRJ3xkL0.js +0 -1
- package/browser/chunk-WDlf94_k.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import {O}from'./chunk-BXIfWVJs.js';import {I}from'./chunk-BIqKO9_X.js';import {v}from'./chunk-BGV30iCr.js';import {g,W,F,H as we,a8 as _,a9 as F$1,aa as _r,z as zi,ab as le,k as yT,a1 as ma,M as U,p as Ff,ac as Ny,x as xw,I as Is,S as Eg,U as UC,m as ml,Q as Qw,K as KE,R as pg,b as Kw,a2 as ga,ad as ne,s as aC,l as eC,ae as Zw,T as VI,a as hg,r as fC,t as tC,X as UI,q as Il,L as Lg,u as mf,w as yf}from'./main-NUYYC27E.js';import {p as pt,T as Te$1,b as bn,v as vn,d as yn,e as fn,l as pn,h as hn,k as dn,i as at,u as un,n as cn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,o as Mn,Q as Qt,C as Ca,c as fo,g as go,N as Nn,R as Rn,Y as Yt}from'./chunk-Y0RP9yux.js';import'./chunk-D-pY3GeH.js';var be=(i,e)=>e.value;function _e(i,e){i&1&&(Is(0,"p",2),UC(1,"Loading\u2026"),ml());}function xe(i,e){if(i&1&&(Is(0,"label",6),hg(1,"input",22),VI(),UC(2),ml()),i&2){let t=e.$implicit,n=fC(2);KE(),pg("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),UI(),KE(),Il(" ",t.label," ");}}function Ie(i,e){if(i&1&&(Is(0,"option",10),UC(1),ml()),i&2){let t=e.$implicit;pg("value",t.type),KE(),Lg(t.displayName);}}function Ne(i,e){if(i&1&&(Is(0,"option",10),UC(1),ml()),i&2){let t=e.$implicit;pg("value",t.value),KE(),Lg(t.label);}}function Ae(i,e){if(i&1&&(Is(0,"div",18)(1,"label",6),hg(2,"input",23),VI(),UC(3," Grant automatically "),ml(),Is(4,"p",2),UC(5),ml()()),i&2){let t=fC(2);KE(2),pg("formControl",t.autoGrantControl),UI(),KE(3),Il(" 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=aC();Is(0,"ds-card")(1,"ds-json-schema-form",24),Eg("valueChange",function(a){mf(t);let p=fC(2);return yf(p.onParamsChange(a))}),ml()();}if(i&2){let t=fC(2);KE(),pg("schema",e)("value",t.initialParams());}}function Fe(i,e){if(i&1){let t=aC();Is(0,"button",25),Eg("click",function(){mf(t);let a=fC(2);return yf(a.exportYaml())}),UC(1),ml();}if(i&2){let t=fC(2);pg("disabled",t.isExporting()),KE(),Il(" ",t.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Te(i,e){if(i&1){let t=aC();Is(0,"form",4),Eg("ngSubmit",function(){mf(t);let a=fC();return yf(a.submit())}),Is(1,"ds-fieldset",5),eC(2,xe,3,4,"label",6,Zw().trackByScope,true),ml(),Is(4,"ds-form-field",7)(5,"select",8)(6,"option",9),UC(7,"Select type"),ml(),eC(8,Ie,2,2,"option",10,Zw().trackByType,true),ml(),VI(),ml(),Is(10,"ds-form-field",11),hg(11,"input",12),VI(),ml(),Is(12,"ds-form-field",13),hg(13,"textarea",14),VI(),ml(),Is(14,"ds-form-field",15)(15,"select",16)(16,"option",17),UC(17,"None"),ml(),eC(18,Ne,2,2,"option",10,be),ml(),VI(),ml(),Qw(20,Ae,6,2,"div",18),Qw(21,Ee,2,2,"ds-card"),Is(22,"ds-form-actions")(23,"button",19),UC(24),ml(),Qw(25,Fe,2,2,"button",20),Is(26,"button",21),Eg("click",function(){mf(t);let a=fC();return yf(a.cancel())}),UC(27,"Cancel"),ml()()();}if(i&2){let t,n=fC();pg("formGroup",n.form),KE(),pg("disabled",n.isEditMode()),KE(),tC(n.scopeOptions),KE(3),pg("formControl",n.typeControl),UI(),KE(3),tC(n.integrationTypes()),KE(3),pg("formControl",n.nameControl),UI(),KE(2),pg("formControl",n.descriptionControl),UI(),KE(2),pg("formControl",n.authSettingNameControl),UI(),KE(),pg("ngValue",null),KE(2),tC(n.authSettingOptions()),KE(2),Kw(n.isAutoGrantable()?20:-1),KE(),Kw((t=n.schema())?21:-1,t),KE(2),pg("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),KE(),Il(" ",n.isEditMode()?"Save changes":"Create"," "),KE(),Kw(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?_r(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new pt({name:new Te$1("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te$1(null),type:new Te$1("",{nonNullable:true,validators:[bn.required]}),scope:new Te$1("namespace",{nonNullable:true}),autoGrant:new Te$1(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);isExporting=zi(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=zi([]);authSettingsLoaded=zi(false);savedAuthSettingName=zi(null);authSettingsScope$=new le;authSettingOptions=yT(()=>{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=zi(null);initialParams=zi(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=yT(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});isAutoGrantable=yT(()=>{let e=this.selectedType();return e?this.integrationTypes().find(t=>t.type===e)?.autoGrantable??false:false});autoGrantReach=yT(()=>{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(ma(e=>this.loadAuthSettingLayers(e)),U(this.destroyRef)).subscribe(e=>{this.loadedAuthSettings.set(this.toAuthSettingOptions(e)),this.authSettingsLoaded.set(true);}),Ff(()=>{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(ga(()=>_r([])),ne(Se=>({label:p,settings:Se}))),n=t("platform",this.authSettingState.loadPlatformSettings()),a=t("mine",this.authSettingState.loadUserSettings("global"));return e==="platform"||e==="userGlobal"?Ny([a,n]):Ny([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=xw({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&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return n.cancel()}),UC(3," \u2190 Integrations "),ml()(),Qw(4,_e,2,0,"p",2)(5,Te,28,12,"form",3),ml()),t&2&&(KE(),pg("title",n.isEditMode()?"Edit integration":"New integration"),KE(3),Kw(n.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,dn,at,un,cn,Kt,fd,Mo,Do,Ut,Mn,Qt,Ca,fo,go,Nn,Rn,Yt],encapsulation:2})};export{ve as IntegrationFormComponent};
|
|
1
|
+
import {I}from'./chunk-DQ809zoB.js';import {O}from'./chunk-YwnuVV6j.js';import {v}from'./chunk-B6sYf1j_.js';import {g,W,F,J as we,aa as J,ab as F$1,ac as _r,z as zi,ad as le,k as yT,a1 as ma,M as U,p as Ff,ae as Ny,x as xw,I as Is,S as Eg,U as UC,m as ml,Q as Qw,K as KE,R as pg,b as Kw,a2 as ga,af as ne,s as aC,l as eC,ag as Zw,T as VI,a as hg,r as fC,t as tC,X as UI,q as Il,L as Lg,u as mf,w as yf}from'./main-6TWWBEJW.js';import {p as pt,T as Te$1,b as bn,v as vn,d as yn,e as fn,l as pn,h as hn,k as dn,i as at,u as un,n as cn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,o as Mn,Q as Qt,C as Ca,c as fo,g as go,N as Nn,R as Rn,Y as Yt}from'./chunk-VbI0SYDI.js';import'./chunk-CG27SgJm.js';var be=(i,e)=>e.value;function _e(i,e){i&1&&(Is(0,"p",2),UC(1,"Loading\u2026"),ml());}function xe(i,e){if(i&1&&(Is(0,"label",6),hg(1,"input",22),VI(),UC(2),ml()),i&2){let t=e.$implicit,n=fC(2);KE(),pg("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),UI(),KE(),Il(" ",t.label," ");}}function Ie(i,e){if(i&1&&(Is(0,"option",10),UC(1),ml()),i&2){let t=e.$implicit;pg("value",t.type),KE(),Lg(t.displayName);}}function Ne(i,e){if(i&1&&(Is(0,"option",10),UC(1),ml()),i&2){let t=e.$implicit;pg("value",t.value),KE(),Lg(t.label);}}function Ae(i,e){if(i&1&&(Is(0,"div",18)(1,"label",6),hg(2,"input",23),VI(),UC(3," Grant automatically "),ml(),Is(4,"p",2),UC(5),ml()()),i&2){let t=fC(2);KE(2),pg("formControl",t.autoGrantControl),UI(),KE(3),Il(" 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=aC();Is(0,"ds-card")(1,"ds-json-schema-form",24),Eg("valueChange",function(a){mf(t);let p=fC(2);return yf(p.onParamsChange(a))}),ml()();}if(i&2){let t=fC(2);KE(),pg("schema",e)("value",t.initialParams());}}function Fe(i,e){if(i&1){let t=aC();Is(0,"button",25),Eg("click",function(){mf(t);let a=fC(2);return yf(a.exportYaml())}),UC(1),ml();}if(i&2){let t=fC(2);pg("disabled",t.isExporting()),KE(),Il(" ",t.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Te(i,e){if(i&1){let t=aC();Is(0,"form",4),Eg("ngSubmit",function(){mf(t);let a=fC();return yf(a.submit())}),Is(1,"ds-fieldset",5),eC(2,xe,3,4,"label",6,Zw().trackByScope,true),ml(),Is(4,"ds-form-field",7)(5,"select",8)(6,"option",9),UC(7,"Select type"),ml(),eC(8,Ie,2,2,"option",10,Zw().trackByType,true),ml(),VI(),ml(),Is(10,"ds-form-field",11),hg(11,"input",12),VI(),ml(),Is(12,"ds-form-field",13),hg(13,"textarea",14),VI(),ml(),Is(14,"ds-form-field",15)(15,"select",16)(16,"option",17),UC(17,"None"),ml(),eC(18,Ne,2,2,"option",10,be),ml(),VI(),ml(),Qw(20,Ae,6,2,"div",18),Qw(21,Ee,2,2,"ds-card"),Is(22,"ds-form-actions")(23,"button",19),UC(24),ml(),Qw(25,Fe,2,2,"button",20),Is(26,"button",21),Eg("click",function(){mf(t);let a=fC();return yf(a.cancel())}),UC(27,"Cancel"),ml()()();}if(i&2){let t,n=fC();pg("formGroup",n.form),KE(),pg("disabled",n.isEditMode()),KE(),tC(n.scopeOptions),KE(3),pg("formControl",n.typeControl),UI(),KE(3),tC(n.integrationTypes()),KE(3),pg("formControl",n.nameControl),UI(),KE(2),pg("formControl",n.descriptionControl),UI(),KE(2),pg("formControl",n.authSettingNameControl),UI(),KE(),pg("ngValue",null),KE(2),tC(n.authSettingOptions()),KE(2),Kw(n.isAutoGrantable()?20:-1),KE(),Kw((t=n.schema())?21:-1,t),KE(2),pg("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),KE(),Il(" ",n.isEditMode()?"Save changes":"Create"," "),KE(),Kw(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(J);authSettingState=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?_r(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new pt({name:new Te$1("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te$1(null),type:new Te$1("",{nonNullable:true,validators:[bn.required]}),scope:new Te$1("namespace",{nonNullable:true}),autoGrant:new Te$1(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);isExporting=zi(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=zi([]);authSettingsLoaded=zi(false);savedAuthSettingName=zi(null);authSettingsScope$=new le;authSettingOptions=yT(()=>{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=zi(null);initialParams=zi(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=yT(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});isAutoGrantable=yT(()=>{let e=this.selectedType();return e?this.integrationTypes().find(t=>t.type===e)?.autoGrantable??false:false});autoGrantReach=yT(()=>{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(ma(e=>this.loadAuthSettingLayers(e)),U(this.destroyRef)).subscribe(e=>{this.loadedAuthSettings.set(this.toAuthSettingOptions(e)),this.authSettingsLoaded.set(true);}),Ff(()=>{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(ga(()=>_r([])),ne(Se=>({label:p,settings:Se}))),n=t("platform",this.authSettingState.loadPlatformSettings()),a=t("mine",this.authSettingState.loadUserSettings("global"));return e==="platform"||e==="userGlobal"?Ny([a,n]):Ny([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=xw({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&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return n.cancel()}),UC(3," \u2190 Integrations "),ml()(),Qw(4,_e,2,0,"p",2)(5,Te,28,12,"form",3),ml()),t&2&&(KE(),pg("title",n.isEditMode()?"Edit integration":"New integration"),KE(3),Kw(n.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,dn,at,un,cn,Kt,fd,Mo,Do,Ut,Mn,Qt,Ca,fo,go,Nn,Rn,Yt],encapsulation:2})};export{ve as IntegrationFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {o}from'./chunk-
|
|
1
|
+
import {o}from'./chunk-B4QJcXnP.js';import {p as pt,T as Te,b as bn,K as Kt,a as fd,U as Ut,c as fo,g as go,N as Nn,R as Rn,v as vn,d as yn,e as fn,h as hn,_ as _n,i as at,u as un,A as Ao}from'./chunk-VbI0SYDI.js';import {g,W,F,J as we,z as zi,M as U,P as x,O as w,x as xw,av as $t,I as Is,S as Eg,U as UC,m as ml,Q as Qw,K as KE,R as pg,b as Kw,r as fC,s as aC,a as hg,T as VI,l as eC,ao as Xw,X as UI,t as tC,q as Il,u as mf,w as yf,L as Lg}from'./main-6TWWBEJW.js';function ie(i,t){if(i&1&&(Is(0,"a",2),UC(1,"View skill \u2192"),ml()),i&2){let e=fC();pg("routerLink",e.inspectRoute());}}function oe(i,t){i&1&&(Is(0,"ds-tag",3),UC(1,"Platform level"),ml());}function ne(i,t){i&1&&(Is(0,"p",4),UC(1,"Loading\u2026"),ml());}function re(i,t){if(i&1){let e=aC();Is(0,"div",15)(1,"div",19),hg(2,"input",20),VI(),Is(3,"button",21),Eg("click",function(){let l=mf(e).$implicit,te=fC(2);return yf(te.removeResource(l))}),UC(4," \xD7 "),ml()(),hg(5,"textarea",22),VI(),ml();}if(i&2){let e=t.$implicit;KE(2),pg("formControl",e.path),UI(),KE(3),pg("formControl",e.content),UI();}}function ae(i,t){if(i&1&&(Is(0,"ds-notice"),UC(1),ml()),i&2){let e=fC(2);KE(),Lg(e.errorMessage());}}function se(i,t){if(i&1){let e=aC();Is(0,"form",6),Eg("ngSubmit",function(){mf(e);let l=fC();return yf(l.submit())}),Is(1,"ds-form-field",7),hg(2,"input",8),VI(),ml(),Is(3,"ds-form-field",9),hg(4,"textarea",10),VI(),ml(),Is(5,"ds-form-field",11),hg(6,"textarea",12),VI(),ml(),Is(7,"ds-form-field",13)(8,"div",14),eC(9,re,6,2,"div",15,Xw),Is(11,"div")(12,"button",16),Eg("click",function(){mf(e);let l=fC();return yf(l.addResource())}),UC(13,"+ Add resource"),ml()()()(),Qw(14,ae,2,1,"ds-notice"),Is(15,"ds-form-actions")(16,"button",17),UC(17),ml(),Is(18,"button",18),Eg("click",function(){mf(e);let l=fC();return yf(l.cancel())}),UC(19,"Cancel"),ml()()();}if(i&2){let e=fC();pg("formGroup",e.form),KE(),pg("error",e.nameControl.invalid&&e.nameControl.touched?"A valid, non-empty name is required.":null),KE(),pg("formControl",e.nameControl),UI(),KE(2),pg("formControl",e.descriptionControl),UI(),KE(2),pg("formControl",e.bodyControl),UI(),KE(3),tC(e.resourceRows()),KE(5),Kw(e.errorMessage()?14:-1),KE(2),pg("disabled",e.form.invalid||e.isSubmitting()),KE(),Il(" ",e.isSubmitting()?"Saving\u2026":e.isEditMode()?"Save changes":"Create"," ");}}var ee=class i{route=g(W);router=g(F);destroyRef=g(we);skillState=g(o);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isEditMode=zi(false);isLoading=zi(false);isSubmitting=zi(false);errorMessage=zi(null);existingSkill=null;form=new pt({name:new Te("",{nonNullable:true,validators:[bn.required,bn.maxLength(100),bn.pattern(/^[a-zA-Z0-9_.-]+( [a-zA-Z0-9_.-]+)*$/)]}),description:new Te("",{nonNullable:true,validators:[bn.required,bn.maxLength(500),bn.pattern(/\S/)]}),body:new Te("",{nonNullable:true,validators:[bn.required,bn.pattern(/\S/)]})});resourceRows=zi([]);get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get bodyControl(){return this.form.controls.body}ngOnInit(){let t=this.route.snapshot.paramMap.get("skillId");t&&(this.isEditMode.set(true),this.isLoading.set(true),this.skillState.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{if(e.readOnly){this.router.navigate(this.inspectRoute());return}this.existingSkill=e,this.form.patchValue({name:e.name,description:e.description,body:e.body}),this.resourceRows.set(Object.entries(e.resources??{}).map(([o,l])=>({path:new Te(o,{nonNullable:true}),content:new Te(l,{nonNullable:true})}))),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}}));}addResource(){this.resourceRows.update(t=>[...t,{path:new Te("",{nonNullable:true}),content:new Te("",{nonNullable:true})}]);}removeResource(t){this.resourceRows.update(e=>e.filter(o=>o!==t));}buildResourcesPayload(){let t=this.resourceRows().map(e=>[e.path.value.trim(),e.content.value]).filter(([e])=>e.length>0);return Object.fromEntries(t)}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=x(w({},this.existingSkill??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value.trim(),body:this.bodyControl.value,resources:this.buildResourcesPayload()});(this.isEditMode()?this.skillState.update(this.existingSkill?.id??"",t):this.skillState.create(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:o=>{this.isSubmitting.set(false),o.status===409?this.errorMessage.set(`A skill named "${this.nameControl.value.trim()}" already exists in this scope.`):o.status===400?this.errorMessage.set("The server rejected this skill. A filesystem-backed skill cannot be modified."):this.errorMessage.set("Saving the skill failed.");}});}cancel(){this.navigateBack();}inspectRoute(){let t=this.route.snapshot.paramMap.get("skillId")??"";return this.isPlatformMode?["/agentos","admin","skills",t,"inspect"]:["/agentos",this.namespaceId,"skills",t,"inspect"]}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","skills"]):this.router.navigate(["/agentos",this.namespaceId,"skills"]);}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=xw({type:i,selectors:[["agentos-skill-form"]],decls:8,vars:4,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to skills",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],["headerMeta","","variant","outline"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","skill-name","hint","The value an agent's skillSelectors entry must match. Letters, digits, dash, dot, underscore and single spaces; 100 characters max.",3,"error"],["dsControl","","id","skill-name","type","text","autocomplete","off",3,"formControl"],["label","Description","controlId","skill-description","hint","This is what the agent sees in its skill catalog \u2014 it decides from this line alone whether to read the skill. 500 characters max."],["dsControl","","id","skill-description","rows","2",3,"formControl"],["label","Body","controlId","skill-body","hint","Markdown instructions returned verbatim by the readSkill tool when the agent asks for this skill."],["dsControl","","mono","","id","skill-body","rows","16",3,"formControl"],["label","Resources","hint","Optional files the agent can read with readSkillResource, by relative path."],[1,"ds-stack"],[1,"ds-stack","ds-stack--sm"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],[1,"ds-inline"],["dsControl","","mono","","type","text","placeholder","e.g. references/checklist.md","aria-label","Resource path","autocomplete","off",3,"formControl"],["dsButton","","variant","icon-danger","type","button","title","Remove","aria-label","Remove resource",3,"click"],["dsControl","","mono","","rows","4","aria-label","Resource content",3,"formControl"]],template:function(e,o){e&1&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return o.cancel()}),UC(3,"\u2190 Skills"),ml(),Qw(4,ie,2,1,"a",2),Qw(5,oe,2,0,"ds-tag",3),ml(),Qw(6,ne,2,0,"p",4)(7,se,20,8,"form",5),ml()),e&2&&(KE(),pg("title",o.isEditMode()?"Edit skill":"New skill"),KE(3),Kw(o.isEditMode()?4:-1),KE(),Kw(o.isPlatformMode?5:-1),KE(),Kw(o.isLoading()?6:7));},dependencies:[Kt,fd,Ut,fo,go,Nn,Rn,$t,vn,yn,fn,hn,_n,at,un,Ao],encapsulation:2})};export{ee as SkillFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {O}from'./chunk-BrfcY3tC.js';import {v}from'./chunk-BGV30iCr.js';import {g,W,F,H as we,z as zi,a9 as F$1,an as Ue,p as Ff,M as U,x as xw,I as Is,S as Eg,U as UC,m as ml,Q as Qw,K as KE,R as pg,b as Kw,s as aC,l as eC,ao as Jw,T as VI,a as hg,am as Xw,r as fC,X as UI,t as tC,q as Il,ae as Zw,L as Lg,u as mf,w as yf}from'./main-NUYYC27E.js';import {p as pt,W as Wt,T as Te,b as bn,v as vn,d as yn,e as fn,l as pn,h as hn,i as at,u as un,n as cn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,Q as Qt,C as Ca,c as fo,g as go,N as Nn,R as Rn,E as Ea,x as yo,z as bo}from'./chunk-Y0RP9yux.js';import'./chunk-D-pY3GeH.js';function ge(o,t){o&1&&(Is(0,"p",2),UC(1,"Loading\u2026"),ml());}function be(o,t){if(o&1&&(Is(0,"label",23),hg(1,"input",24),VI(),UC(2),ml()),o&2){let e=t.$implicit,r=fC(3);KE(),pg("formControl",r.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!r.isAdmin()),UI(),KE(),Il(" ",e.label," ");}}function _e(o,t){if(o&1&&(Is(0,"ds-fieldset",5),eC(1,be,3,4,"label",23,Zw().trackByScope,true),ml()),o&2){let e=fC(2);pg("disabled",e.isEditMode()),KE(),tC(e.scopeOptions);}}function Ae(o,t){if(o&1&&(Is(0,"option",8),UC(1),ml()),o&2){let e=t.$implicit;pg("value",e),KE(),Lg(e);}}function Se(o,t){if(o&1){let e=aC();Is(0,"div",19),hg(1,"input",25),VI(),hg(2,"input",26),VI(),Is(3,"button",27),Eg("click",function(){let l=mf(e).$index,f=fC(2);return yf(f.removeHeader(l))}),UC(4," \xD7 "),ml()();}if(o&2){let e=t.$index;pg("formGroupName",e),KE(),UI(),KE(),UI();}}function Pe(o,t){if(o&1){let e=aC();Is(0,"form",4),Eg("ngSubmit",function(){mf(e);let l=fC();return yf(l.submit())}),Qw(1,_e,3,1,"ds-fieldset",5),Is(2,"ds-form-field",6)(3,"select",7),eC(4,Ae,2,2,"option",8,Jw),ml(),VI(),ml(),Is(6,"ds-form-field",9),hg(7,"input",10),VI(),ml(),Is(8,"ds-form-field",11),hg(9,"input",12),VI(),ml(),Is(10,"ds-form-field",13),hg(11,"input",14),VI(),ml(),Is(12,"ds-form-field",15),hg(13,"input",16),VI(),ml(),Is(14,"ds-form-field",17)(15,"div",18),eC(16,Se,5,1,"div",19,Xw),Is(18,"div")(19,"button",20),Eg("click",function(){mf(e);let l=fC();return yf(l.addHeader())}),UC(20,"+ Add header"),ml()()()(),Is(21,"ds-form-actions")(22,"button",21),UC(23),ml(),Is(24,"button",22),Eg("click",function(){mf(e);let l=fC();return yf(l.cancel())}),UC(25,"Cancel"),ml()()();}if(o&2){let e=fC();pg("formGroup",e.form),KE(),Kw(e.isPlatformMode?-1:1),KE(2),pg("formControl",e.apiTypeControl),UI(),KE(),tC(e.apiTypeOptions),KE(3),pg("formControl",e.nameControl),UI(),KE(2),pg("formControl",e.descriptionControl),UI(),KE(2),pg("formControl",e.baseUrlControl),UI(),KE(2),pg("formControl",e.apiKeyControl),UI(),KE(2),pg("formArrayName","headers"),KE(),tC(e.headersArray.controls),KE(6),pg("disabled",e.form.invalid||e.isSubmitting()),KE(),Il(" ",e.isEditMode()?"Save changes":"Create"," ");}}var xe=new Set(["namespace","userOnNs","userGlobal"]),E=Object.freeze({platform:"Configuration de niveau plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ye=class o{route=g(W);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?zi(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});apiTypeOptions=Object.values(Ue);scopeOptions=[{value:"namespace",label:E.namespace},{value:"userOnNs",label:E.userOnNs},{value:"userGlobal",label:E.userGlobal}];form=new pt({name:new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te(null),apiType:new Te("OpenAI",{nonNullable:true,validators:[bn.required]}),baseUrl:new Te("",{nonNullable:true}),apiKey:new Te("",{nonNullable:true}),scope:new Te("namespace",{nonNullable:true}),headers:new Wt([],{validators:[]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get apiTypeControl(){return this.form.controls.apiType}get baseUrlControl(){return this.form.controls.baseUrl}get apiKeyControl(){return this.form.controls.apiKey}get scopeControl(){return this.form.controls.scope}get headersArray(){return this.form.controls.headers}addHeader(){this.headersArray.push(new pt({key:new Te("",{nonNullable:true,validators:[bn.required]}),value:new Te("",{nonNullable:true})}));}removeHeader(t){this.headersArray.removeAt(t);}isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);existingConfig=null;initialApiKey="";constructor(){this.isPlatformMode||Ff(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,r=t.get("aiProviderId"),l=this.isPlatformMode?"namespace":this.parseScope(e.get("scope"));if(r){this.isEditMode.set(true),this.scopeControl.disable(),this.apiTypeControl.disable(),this.loadConfig(r);return}this.scopeControl.setValue(l);let f=e.get("template");f&&this.hydrateFromTemplate(f);}parseScope(t){return t&&xe.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId?"namespace":t.namespaceId?"userOnNs":"userGlobal"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AiProviderForm] Could not load provider '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.apiTypeControl.setValue(e.apiType),this.baseUrlControl.setValue(e.baseUrl??""),this.apiKeyControl.setValue(""),this.initialApiKey="",this.apiKeyControl.markAsTouched(),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AiProviderForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.apiTypeControl.setValue(t.apiType),this.baseUrlControl.setValue(t.baseUrl??"");let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialApiKey=e,this.headersArray.clear();for(let[r,l]of Object.entries(t.headers??{}))this.headersArray.push(new pt({key:new Te(r,{nonNullable:true,validators:[bn.required]}),value:new Te(l,{nonNullable:true})}));}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.descriptionControl.value?.trim(),e=this.baseUrlControl.value.trim(),r=this.apiKeyControl.value,l=this.isEditMode()&&r===this.initialApiKey?null:r,f=this.headersArray.controls.filter(A=>A.controls.key.value.trim()).map(A=>[A.controls.key.value.trim(),A.controls.value.value]),Ce=f.length>0?Object.fromEntries(f):null,V={name:this.nameControl.value.trim(),apiType:this.apiTypeControl.value,description:t||null,baseUrl:e||null,apiKey:l,headers:Ce},w=this.form.getRawValue().scope,he=this.isPlatformMode?null:this.namespaceId??null;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,V,w,this.existingConfig):this.state.create(V,w,he)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-providers"]):this.router.navigate(["/agentos",this.namespaceId,"ai-providers"]);}trackByScope(t,e){return e.value}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=xw({type:o,selectors:[["agentos-ai-provider-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to AI providers",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Configuration scope",3,"disabled"],["label","API type","controlId","llm-api-type","required",""],["dsControl","","id","llm-api-type",3,"formControl"],[3,"value"],["label","Name","controlId","llm-name","required",""],["dsControl","","id","llm-name","type","text","placeholder","e.g. OpenAI prod","autocomplete","off",3,"formControl"],["label","Description","controlId","llm-description"],["dsControl","","id","llm-description","type","text","placeholder","Optional \u2014 short description of this provider","autocomplete","off",3,"formControl"],["label","Base URL","controlId","llm-base-url"],["dsControl","","id","llm-base-url","type","url","placeholder","Optional \u2014 leave empty for default endpoint","autocomplete","off",3,"formControl"],["label","API key","controlId","llm-api-key"],["dsControl","","id","llm-api-key","type","password","placeholder","sk-\u2026","autocomplete","new-password",3,"formControl"],["label","Custom headers"],[1,"ds-stack","ds-stack--sm",3,"formArrayName"],[1,"ds-inline",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsCheck",""],["type","radio",3,"formControl","value","disabled"],["dsControl","","type","text","placeholder","Header name","formControlName","key","autocomplete","off"],["dsControl","","type","text","placeholder","Value","formControlName","value","autocomplete","off"],["dsButton","","variant","icon-danger","type","button","title","Remove header","aria-label","Remove header",3,"click"]],template:function(e,r){e&1&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return r.cancel()}),UC(3," \u2190 AI providers "),ml()(),Qw(4,ge,2,0,"p",2)(5,Pe,26,10,"form",3),ml()),e&2&&(KE(),pg("title",r.isEditMode()?"Edit AI provider":"New AI provider"),KE(3),Kw(r.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,at,un,cn,Kt,fd,Mo,Do,Ut,Qt,Ca,fo,go,Nn,Rn,Ea,yo,bo],encapsulation:2})};export{ye as AiProviderFormComponent};
|
|
1
|
+
import {O}from'./chunk-C0Lw7VMt.js';import {v}from'./chunk-B6sYf1j_.js';import {g,W,F,J as we,z as zi,ab as F$1,ap as Ne,p as Ff,M as U,x as xw,I as Is,S as Eg,U as UC,m as ml,Q as Qw,K as KE,R as pg,b as Kw,s as aC,l as eC,aq as Jw,T as VI,a as hg,ao as Xw,r as fC,X as UI,t as tC,q as Il,ag as Zw,L as Lg,u as mf,w as yf}from'./main-6TWWBEJW.js';import {p as pt,W as Wt,T as Te,b as bn,v as vn,d as yn,e as fn,l as pn,h as hn,i as at,u as un,n as cn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,Q as Qt,C as Ca,c as fo,g as go,N as Nn,R as Rn,E as Ea,x as yo,z as bo}from'./chunk-VbI0SYDI.js';import'./chunk-CG27SgJm.js';function ge(o,t){o&1&&(Is(0,"p",2),UC(1,"Loading\u2026"),ml());}function be(o,t){if(o&1&&(Is(0,"label",23),hg(1,"input",24),VI(),UC(2),ml()),o&2){let e=t.$implicit,r=fC(3);KE(),pg("formControl",r.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!r.isAdmin()),UI(),KE(),Il(" ",e.label," ");}}function _e(o,t){if(o&1&&(Is(0,"ds-fieldset",5),eC(1,be,3,4,"label",23,Zw().trackByScope,true),ml()),o&2){let e=fC(2);pg("disabled",e.isEditMode()),KE(),tC(e.scopeOptions);}}function Ae(o,t){if(o&1&&(Is(0,"option",8),UC(1),ml()),o&2){let e=t.$implicit;pg("value",e),KE(),Lg(e);}}function Se(o,t){if(o&1){let e=aC();Is(0,"div",19),hg(1,"input",25),VI(),hg(2,"input",26),VI(),Is(3,"button",27),Eg("click",function(){let l=mf(e).$index,f=fC(2);return yf(f.removeHeader(l))}),UC(4," \xD7 "),ml()();}if(o&2){let e=t.$index;pg("formGroupName",e),KE(),UI(),KE(),UI();}}function Pe(o,t){if(o&1){let e=aC();Is(0,"form",4),Eg("ngSubmit",function(){mf(e);let l=fC();return yf(l.submit())}),Qw(1,_e,3,1,"ds-fieldset",5),Is(2,"ds-form-field",6)(3,"select",7),eC(4,Ae,2,2,"option",8,Jw),ml(),VI(),ml(),Is(6,"ds-form-field",9),hg(7,"input",10),VI(),ml(),Is(8,"ds-form-field",11),hg(9,"input",12),VI(),ml(),Is(10,"ds-form-field",13),hg(11,"input",14),VI(),ml(),Is(12,"ds-form-field",15),hg(13,"input",16),VI(),ml(),Is(14,"ds-form-field",17)(15,"div",18),eC(16,Se,5,1,"div",19,Xw),Is(18,"div")(19,"button",20),Eg("click",function(){mf(e);let l=fC();return yf(l.addHeader())}),UC(20,"+ Add header"),ml()()()(),Is(21,"ds-form-actions")(22,"button",21),UC(23),ml(),Is(24,"button",22),Eg("click",function(){mf(e);let l=fC();return yf(l.cancel())}),UC(25,"Cancel"),ml()()();}if(o&2){let e=fC();pg("formGroup",e.form),KE(),Kw(e.isPlatformMode?-1:1),KE(2),pg("formControl",e.apiTypeControl),UI(),KE(),tC(e.apiTypeOptions),KE(3),pg("formControl",e.nameControl),UI(),KE(2),pg("formControl",e.descriptionControl),UI(),KE(2),pg("formControl",e.baseUrlControl),UI(),KE(2),pg("formControl",e.apiKeyControl),UI(),KE(2),pg("formArrayName","headers"),KE(),tC(e.headersArray.controls),KE(6),pg("disabled",e.form.invalid||e.isSubmitting()),KE(),Il(" ",e.isEditMode()?"Save changes":"Create"," ");}}var xe=new Set(["namespace","userOnNs","userGlobal"]),E=Object.freeze({platform:"Configuration de niveau plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ye=class o{route=g(W);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?zi(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});apiTypeOptions=Object.values(Ne);scopeOptions=[{value:"namespace",label:E.namespace},{value:"userOnNs",label:E.userOnNs},{value:"userGlobal",label:E.userGlobal}];form=new pt({name:new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te(null),apiType:new Te("OpenAI",{nonNullable:true,validators:[bn.required]}),baseUrl:new Te("",{nonNullable:true}),apiKey:new Te("",{nonNullable:true}),scope:new Te("namespace",{nonNullable:true}),headers:new Wt([],{validators:[]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get apiTypeControl(){return this.form.controls.apiType}get baseUrlControl(){return this.form.controls.baseUrl}get apiKeyControl(){return this.form.controls.apiKey}get scopeControl(){return this.form.controls.scope}get headersArray(){return this.form.controls.headers}addHeader(){this.headersArray.push(new pt({key:new Te("",{nonNullable:true,validators:[bn.required]}),value:new Te("",{nonNullable:true})}));}removeHeader(t){this.headersArray.removeAt(t);}isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);existingConfig=null;initialApiKey="";constructor(){this.isPlatformMode||Ff(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,r=t.get("aiProviderId"),l=this.isPlatformMode?"namespace":this.parseScope(e.get("scope"));if(r){this.isEditMode.set(true),this.scopeControl.disable(),this.apiTypeControl.disable(),this.loadConfig(r);return}this.scopeControl.setValue(l);let f=e.get("template");f&&this.hydrateFromTemplate(f);}parseScope(t){return t&&xe.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId?"namespace":t.namespaceId?"userOnNs":"userGlobal"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AiProviderForm] Could not load provider '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.apiTypeControl.setValue(e.apiType),this.baseUrlControl.setValue(e.baseUrl??""),this.apiKeyControl.setValue(""),this.initialApiKey="",this.apiKeyControl.markAsTouched(),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AiProviderForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.apiTypeControl.setValue(t.apiType),this.baseUrlControl.setValue(t.baseUrl??"");let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialApiKey=e,this.headersArray.clear();for(let[r,l]of Object.entries(t.headers??{}))this.headersArray.push(new pt({key:new Te(r,{nonNullable:true,validators:[bn.required]}),value:new Te(l,{nonNullable:true})}));}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.descriptionControl.value?.trim(),e=this.baseUrlControl.value.trim(),r=this.apiKeyControl.value,l=this.isEditMode()&&r===this.initialApiKey?null:r,f=this.headersArray.controls.filter(A=>A.controls.key.value.trim()).map(A=>[A.controls.key.value.trim(),A.controls.value.value]),Ce=f.length>0?Object.fromEntries(f):null,V={name:this.nameControl.value.trim(),apiType:this.apiTypeControl.value,description:t||null,baseUrl:e||null,apiKey:l,headers:Ce},w=this.form.getRawValue().scope,he=this.isPlatformMode?null:this.namespaceId??null;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,V,w,this.existingConfig):this.state.create(V,w,he)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-providers"]):this.router.navigate(["/agentos",this.namespaceId,"ai-providers"]);}trackByScope(t,e){return e.value}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=xw({type:o,selectors:[["agentos-ai-provider-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to AI providers",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Configuration scope",3,"disabled"],["label","API type","controlId","llm-api-type","required",""],["dsControl","","id","llm-api-type",3,"formControl"],[3,"value"],["label","Name","controlId","llm-name","required",""],["dsControl","","id","llm-name","type","text","placeholder","e.g. OpenAI prod","autocomplete","off",3,"formControl"],["label","Description","controlId","llm-description"],["dsControl","","id","llm-description","type","text","placeholder","Optional \u2014 short description of this provider","autocomplete","off",3,"formControl"],["label","Base URL","controlId","llm-base-url"],["dsControl","","id","llm-base-url","type","url","placeholder","Optional \u2014 leave empty for default endpoint","autocomplete","off",3,"formControl"],["label","API key","controlId","llm-api-key"],["dsControl","","id","llm-api-key","type","password","placeholder","sk-\u2026","autocomplete","new-password",3,"formControl"],["label","Custom headers"],[1,"ds-stack","ds-stack--sm",3,"formArrayName"],[1,"ds-inline",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsCheck",""],["type","radio",3,"formControl","value","disabled"],["dsControl","","type","text","placeholder","Header name","formControlName","key","autocomplete","off"],["dsControl","","type","text","placeholder","Value","formControlName","value","autocomplete","off"],["dsButton","","variant","icon-danger","type","button","title","Remove header","aria-label","Remove header",3,"click"]],template:function(e,r){e&1&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return r.cancel()}),UC(3," \u2190 AI providers "),ml()(),Qw(4,ge,2,0,"p",2)(5,Pe,26,10,"form",3),ml()),e&2&&(KE(),pg("title",r.isEditMode()?"Edit AI provider":"New AI provider"),KE(3),Kw(r.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,at,un,cn,Kt,fd,Mo,Do,Ut,Qt,Ca,fo,go,Nn,Rn,Ea,yo,bo],encapsulation:2})};export{ye as AiProviderFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {i}from'./chunk-
|
|
1
|
+
import {i}from'./chunk-CG27SgJm.js';import {y}from'./chunk-VbI0SYDI.js';import {g,aF as Z,$ as Sr,au as _y,a1 as ma,a2 as ga,ac as _r,af as ne,aG as Jy,P as x,O as w$1,a7 as Ed,aH as an,aI as Ot,aJ as cn,a8 as A}from'./main-6TWWBEJW.js';var nt=["ApiKeyAuthSetting","BasicAuthAuthSetting","BearerTokenAuthSetting","OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"],it={ApiKeyAuthSetting:"API Key",BasicAuthAuthSetting:"Basic Auth (username / password)",BearerTokenAuthSetting:"Bearer Token",OAuthDiscoverableAuthSetting:"OAuth \u2014 Discovery URL",OAuthMcpDiscoverableAuthSetting:"OAuth \u2014 MCP Discoverable",OAuthCustomAuthSetting:"OAuth \u2014 Custom endpoints",OAuthRegisteredAuthSetting:"OAuth \u2014 Registered app"},R="none",w="me",b=2e3,M=15e4,P=3,L={ApiKeyAuthSetting:"API_KEY",BasicAuthAuthSetting:"BASIC_AUTH",BearerTokenAuthSetting:"BEARER_TOKEN",OAuthDiscoverableAuthSetting:"OAUTH_DISCOVERABLE",OAuthMcpDiscoverableAuthSetting:"OAUTH_MCP_DISCOVERABLE",OAuthCustomAuthSetting:"OAUTH_CUSTOM",OAuthRegisteredAuthSetting:"OAUTH_REGISTERED"},k={API_KEY:"ApiKeyAuthSetting",BASIC_AUTH:"BasicAuthAuthSetting",BEARER_TOKEN:"BearerTokenAuthSetting",OAUTH_DISCOVERABLE:"OAuthDiscoverableAuthSetting",OAUTH_MCP_DISCOVERABLE:"OAuthMcpDiscoverableAuthSetting",OAUTH_CUSTOM:"OAuthCustomAuthSetting",OAUTH_REGISTERED:"OAuthRegisteredAuthSetting"};function B(i){let t=L[i.authType];return t?x(w$1({},i),{authType:t}):i}function m(i){return U(i)}function f(i){return i.map(U)}function U(i){let t=i;if(typeof t.authType=="string"){let e=k[t.authType];if(e)return x(w$1({},t),{authType:e})}return i}function H(i,t){return t===null?true:i!==void 0&&Date.parse(i)>Date.parse(t)}var I=class i$1{controller=g(Z);userState=g(y);refresh$=new Sr(void 0);namespaceId$=new Sr(null);vm$=_y([this.namespaceId$,this.refresh$]).pipe(ma(([t])=>{let e=this.loadPlatformSettings().pipe(ga(()=>_r([])));return t?_y([e,this.loadNamespaceSettings(t).pipe(ga(()=>_r([]))),this.loadUserSettings(t).pipe(ga(()=>_r([]))),this.loadUserSettings("global").pipe(ga(()=>_r([])))]).pipe(ne(([n,o,r,h])=>({platform:n,namespace:o,userOnNs:r,userGlobal:h}))):_y([e,this.loadNamespaceSettings("").pipe(ga(()=>_r([]))),this.loadUserSettings("global").pipe(ga(()=>_r([])))]).pipe(ne(([n,o,r])=>({platform:n,namespace:o,userOnNs:[],userGlobal:r})))}),Jy({bufferSize:1,refCount:true}));setNamespace(t){this.namespaceId$.value!==t&&this.namespaceId$.next(t);}refresh(){this.refresh$.next();}loadUserSettings(t){let e=t==="global"?R:t;return this.controller.listAuthSetting(e,w).pipe(ne(n=>f(n)))}userGlobal$=i(this.refresh$,()=>this.loadUserSettings("global"),[]);loadPlatformSettings(){return this.controller.listAuthSetting(R).pipe(ne(t=>f(t)))}loadNamespaceSettings(t){return t?this.controller.listAuthSetting(t).pipe(ne(e=>f(e))):_r([])}getById(t,e){return this.controller.getByIdAuthSetting(t).pipe(ne(n=>m(n)))}create(t,e,n){let r=this.userState.currentUser()?.id;if((e==="userOnNs"||e==="userGlobal")&&!r)throw new Error(`Cannot create ${e} auth setting before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(e==="namespace"&&(n===void 0||n===""))throw new Error("Cannot create namespace-scoped auth setting without a namespaceId");if(e==="userOnNs"&&!n)throw new Error("Cannot create userOnNs auth setting without a namespaceId");let h=B(x(w$1({},t),{namespaceId:e==="namespace"||e==="userOnNs"?n??void 0:void 0,userId:e==="userOnNs"||e==="userGlobal"?r:void 0}));return this.controller.createAuthSetting(h).pipe(ne(A=>m(A)),Ed(()=>this.refresh()))}update(t,e,n){let o=B(x(w$1({},e),{namespaceId:n.namespaceId,userId:n.userId,authType:n.authType}));return this.controller.updateAuthSetting(t,o).pipe(ne(r=>m(r)),Ed(()=>this.refresh()))}delete(t,e){return this.controller.deleteAuthSetting(t).pipe(Ed(()=>this.refresh()))}getConnection(t,e){return this.controller.getConnectionAuthSetting(t,e)}resetCredential(t,e){return this.controller.resetMyCredentialAuthSetting(t,e)}connect(t,e,n,o){return this.getConnection(t,e).pipe(ma(r=>this.controller.connectAuthSetting(t,e).pipe(Ed(h=>n(h.authorizationUrl)),ma(()=>this.awaitNewConnection(t,e,r.connected?r.connectedAt??null:null,o)))))}awaitNewConnection(t,e,n,o){let r=0,h=0;return an(b,b).pipe(ma(()=>this.getConnection(t,e).pipe(ga(()=>_r(null)))),ne(A=>(r++,A?.connected&&H(A.connectedAt,n)?"connected":r*b>=M?"timeout":o()&&++h>=P?"abandoned":null)),Ot(A=>A!==null),cn(1))}static \u0275fac=function(e){return new(e||i$1)};static \u0275prov=A({token:i$1,factory:i$1.\u0275fac,providedIn:"root"})};export{I,it as i,nt as n};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {q as k$1,O,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-
|
|
1
|
+
import {q as k$1,O,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-VbI0SYDI.js';import {g,W as W$1,F,J as we,as as F$1,ar as k,$ as Sr,z as zi,a1 as ma,ae as Ny,a2 as ga,ac as _r,M as U,x as xw,I as Is,S as Eg,m as ml,U as UC,Q as Qw,K as KE,R as pg,b as Kw,r as fC,L as Lg,l as eC,t as tC,q as Il,s as aC,u as mf,w as yf,j as fg}from'./main-6TWWBEJW.js';var G=(i,e)=>e.key;function Q(i,e){if(i&1&&(Is(0,"p",3),UC(1),ml()),i&2){let t=fC();KE(),Lg(t.deletion.error());}}function W(i,e){i&1&&(Is(0,"p",4),UC(1,"Loading AI models\u2026"),ml());}function X(i,e){i&1&&(Is(0,"p",5),UC(1,"No AI models configured."),ml());}function Y(i,e){i&1&&(Is(0,"p",4),UC(1,"No AI models match the current filter."),ml());}function Z(i,e){i&1&&(Is(0,"ds-tag",18),UC(1,"Read-only"),ml());}function ee(i,e){if(i&1){let t=aC();Is(0,"button",24),Eg("click",function(){mf(t);let s=fC(2).$implicit,m=fC(2);return yf(m.edit(s))}),UC(1,"Edit"),ml();}if(i&2){let t=fC(2).$implicit,n=fC(2);fg("aria-label","Edit "+n.title(t));}}function te(i,e){if(i&1){let t=aC();Qw(0,ee,2,1,"button",22),Is(1,"agentos-row-delete-action",23),Eg("deleteRequested",function(){mf(t);let s=fC().$implicit,m=fC(2);return yf(m.deletion.request(s.key))})("deleteConfirmed",function(){mf(t);let s=fC().$implicit,m=fC(2);return yf(m.confirmDelete(s))})("deleteCancelled",function(){mf(t);let s=fC(3);return yf(s.deletion.cancel())}),ml();}if(i&2){let t=fC().$implicit,n=fC(2);Kw(n.deletion.confirmingId()!==t.key?0:-1),KE(),pg("rowKey",t.key)("rowLabel",n.title(t))("state",n.deletion);}}function ie(i,e){i&1&&(Is(0,"button",21),UC(1,"Inherited"),ml());}function ne(i,e){if(i&1&&(Is(0,"tr",9)(1,"td",12),UC(2),ml(),Is(3,"td",13),UC(4),ml(),Is(5,"td",14),UC(6),ml(),Is(7,"td",15)(8,"div",16)(9,"ds-tag",17),UC(10),ml(),Qw(11,Z,2,0,"ds-tag",18),ml()(),Is(12,"td",19)(13,"div",20),Qw(14,te,2,4)(15,ie,2,0,"button",21),ml()()()),i&2){let t=e.$implicit,n=fC(2);KE(2),Lg(n.title(t)),KE(2),Lg(t.providerName),KE(2),Il(" ",t.model.apiModelName," "),KE(3),pg("variant",t.scope==="platform"?"neutral":"accent"),KE(),Lg(t.scope==="platform"?"Platform":"Namespace"),KE(),Kw(t.scope==="platform"?11:-1),KE(3),Kw(t.scope==="namespace"?14:15);}}function oe(i,e){if(i&1&&(Is(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),UC(5,"Name"),ml(),Is(6,"th",10),UC(7,"Provider"),ml(),Is(8,"th",10),UC(9,"API model name"),ml(),Is(10,"th",10),UC(11,"Scope"),ml(),Is(12,"th",10)(13,"span",11),UC(14,"Actions"),ml()()()(),Is(15,"tbody",8),eC(16,ne,16,7,"tr",9,G),ml()()()),i&2){let t=fC();KE(16),tC(t.rowFilter.filteredRows());}}var z=class i{route=g(W$1);router=g(F);destroyRef=g(we);aiModelController=g(F$1);aiProviderController=g(k);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Sr(void 0);isLoading=zi(true);deletion=k$1();rows=zi([]);rowFilter=O(this.rows,e=>[e.model.alias,e.model.apiModelName,e.providerName,e.scope].filter(Boolean).join(" "));data$=this.refresh$.pipe(ma(()=>(this.isLoading.set(true),Ny({namespace:this.aiModelController.listByNamespaceIdAiModel(this.namespaceId),platform:this.aiModelController.listPlatformLevelAiModel().pipe(ga(()=>_r([]))),providers:this.aiProviderController.listAiProvider(this.namespaceId)}).pipe(ma(({namespace:e,platform:t,providers:n})=>{let s=[...new Set([...t,...e].map(m=>m.aiProviderId))];return Ny({namespace:_r(e),platform:_r(t),providers:_r(n),referencedProviders:this.aiProviderController.getByIdsAiProvider({ids:s,withRemoved:false}).pipe(ga(()=>_r([])))})})))));constructor(){this.data$.pipe(U(this.destroyRef)).subscribe({next:({namespace:e,platform:t,providers:n,referencedProviders:s})=>{let m=new Map([...s,...n].map(c=>[c.id??"",c.name]));this.rows.set([...t.map((c,g)=>({key:`platform:${c.id??g}`,model:c,providerName:m.get(c.aiProviderId)??c.aiProviderId,scope:"platform"})),...e.map((c,g)=>({key:`namespace:${c.id??g}`,model:c,providerName:m.get(c.aiProviderId)??c.aiProviderId,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-models","new"]);}edit(e){e.scope==="platform"||!e.model.id||this.router.navigate(["/agentos",this.namespaceId,"ai-models",e.model.id,"edit"]);}title(e){return e.model.alias??e.model.apiModelName}confirmDelete(e){e.scope==="platform"||!e.model.id||this.deletion.execute(e.key,{request$:this.aiModelController.deleteAiModel(e.model.id).pipe(U(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${this.title(e)}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=xw({type:i,selectors:[["agentos-namespace-ai-models"]],decls:9,vars:3,consts:[["title","AI models","description","AI models configured for this namespace, including models inherited from the platform."],["label","Filter AI models","placeholder","Filter AI models\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","AI models"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Provider"],["role","cell","data-label","API model name",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(t,n){t&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(m){return n.rowFilter.query.set(m)}),ml(),Is(2,"button",2),Eg("click",function(){return n.openCreateForm()}),UC(3,"New AI model"),ml()(),Qw(4,Q,2,1,"p",3),Qw(5,W,2,0,"p",4)(6,X,2,0,"p",5)(7,Y,2,0,"p",4)(8,oe,18,0,"div",6)),t&2&&(KE(),pg("query",n.rowFilter.query()),KE(3),Kw(n.deletion.error()?4:-1),KE(),Kw(n.isLoading()?5:n.rows().length===0?6:n.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{z as NamespaceAiModelsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {w as m,q as k,O as O$1,i as at,d as yn,V as Vo,j as P,r as P$1}from'./chunk-
|
|
1
|
+
import {w as m,q as k,O as O$1,i as at,d as yn,V as Vo,j as P,r as P$1}from'./chunk-VbI0SYDI.js';import {g,F,J as we,$ as Sr,z as zi,a1 as ma,M as U$1,x as xw,I as Is,S as Eg,m as ml,U as UC,Q as Qw,K as KE,R as pg,b as Kw,r as fC,L as Lg,l as eC,t as tC,q as Il,s as aC,j as fg,u as mf,w as yf}from'./main-6TWWBEJW.js';var j=(t,e)=>e.id??e.name;function A(t,e){if(t&1&&(Is(0,"p",3),UC(1),ml()),t&2){let n=fC();KE(),Lg(n.deletion.error());}}function K(t,e){t&1&&(Is(0,"p",4),UC(1,"Loading prompts\u2026"),ml());}function H(t,e){t&1&&(Is(0,"p",5),UC(1,"No platform prompts defined yet."),ml());}function U(t,e){t&1&&(Is(0,"p",4),UC(1,"No prompts match the current filter."),ml());}function z(t,e){if(t&1){let n=aC();Is(0,"button",18),Eg("click",function(){mf(n);let m=fC().$implicit,p=fC(2);return yf(p.edit(m))}),UC(1,"Edit"),ml();}if(t&2){let n=fC().$implicit;fg("aria-label","Edit "+n.name);}}function G(t,e){if(t&1){let n=aC();Is(0,"agentos-row-delete-action",19),Eg("deleteRequested",function(){mf(n);let m=fC().$implicit,p=fC(2);return yf(p.deletion.request(m.id))})("deleteConfirmed",function(){mf(n);let m=fC().$implicit,p=fC(2);return yf(p.confirmDelete(m))})("deleteCancelled",function(){mf(n);let m=fC(3);return yf(m.deletion.cancel())}),ml();}if(t&2){let n=fC().$implicit,r=fC(2);pg("rowKey",n.id)("rowLabel",n.name)("state",r.deletion);}}function J(t,e){if(t&1&&(Is(0,"tr",9)(1,"td",12),UC(2),ml(),Is(3,"td",13),UC(4),ml(),Is(5,"td",14)(6,"div",15),Qw(7,z,2,1,"button",16),Qw(8,G,1,3,"agentos-row-delete-action",17),ml()()()),t&2){let n=e.$implicit,r=fC(2);KE(2),Lg(n.name),KE(2),Il(" ",n.description||"\u2014"," "),KE(3),Kw(r.deletion.confirmingId()!==n.id?7:-1),KE(),Kw(n.id?8:-1);}}function O(t,e){if(t&1&&(Is(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),UC(5,"Name"),ml(),Is(6,"th",10),UC(7,"Description"),ml(),Is(8,"th",10)(9,"span",11),UC(10,"Actions"),ml()()()(),Is(11,"tbody",8),eC(12,J,9,4,"tr",9,j),ml()()()),t&2){let n=fC();KE(12),tC(n.rowFilter.filteredRows());}}var B=class t{router=g(F);destroyRef=g(we);promptState=g(m);refresh$=new Sr(void 0);isLoading=zi(true);deletion=k();prompts=zi([]);rowFilter=O$1(this.prompts,e=>[e.name,e.description].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ma(()=>(this.isLoading.set(true),this.promptState.listPlatform())),U$1(this.destroyRef)).subscribe({next:e=>{this.prompts.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","prompts","new"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","prompts",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.promptState.delete(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=xw({type:t,selectors:[["agentos-platform-prompts"]],decls:9,vars:3,consts:[["title","Platform prompts","description","Prompts shared across every namespace."],["label","Filter prompts","placeholder","Filter prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","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&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(p){return r.rowFilter.query.set(p)}),ml(),Is(2,"button",2),Eg("click",function(){return r.openCreateForm()}),UC(3,"New prompt"),ml()(),Qw(4,A,2,1,"p",3),Qw(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&&(KE(),pg("query",r.rowFilter.query()),KE(3),Kw(r.deletion.error()?4:-1),KE(),Kw(r.isLoading()?5:r.prompts().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,P,P$1],encapsulation:2})};export{B as PlatformPromptsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {o}from'./chunk-
|
|
1
|
+
import {o}from'./chunk-B4QJcXnP.js';import {q as k,O as O$1,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-VbI0SYDI.js';import {g,F,J as we,$ as Sr,z as zi,a1 as ma,M as U$1,x as xw,I as Is,S as Eg,m as ml,U as UC,Q as Qw,K as KE,R as pg,b as Kw,r as fC,L as Lg,l as eC,t as tC,q as Il,s as aC,u as mf,w as yf,j as fg}from'./main-6TWWBEJW.js';var K=(i,e)=>e.id??e.name;function O(i,e){if(i&1&&(Is(0,"p",3),UC(1),ml()),i&2){let t=fC();KE(),Lg(t.deletion.error());}}function A(i,e){i&1&&(Is(0,"p",4),UC(1,"Loading skills\u2026"),ml());}function H(i,e){i&1&&(Is(0,"p",5),UC(1,"No platform skills defined yet."),ml());}function U(i,e){i&1&&(Is(0,"p",4),UC(1,"No skills match the current filter."),ml());}function z(i,e){i&1&&(Is(0,"ds-tag",15),UC(1,"SKILL.md"),ml());}function G(i,e){if(i&1){let t=aC();Is(0,"button",21),Eg("click",function(){mf(t);let d=fC(2).$implicit,m=fC(2);return yf(m.edit(d))}),UC(1,"Edit"),ml();}if(i&2){let t=fC(2).$implicit;fg("aria-label","Edit "+t.name);}}function J(i,e){if(i&1){let t=aC();Is(0,"button",21),Eg("click",function(){mf(t);let d=fC().$implicit,m=fC(2);return yf(m.inspect(d))}),UC(1,"View"),ml(),Qw(2,G,2,1,"button",22);}if(i&2){let t=fC().$implicit;fg("aria-label","View "+t.name),KE(2),Kw(t.readOnly?-1:2);}}function Q(i,e){if(i&1){let t=aC();Is(0,"agentos-row-delete-action",23),Eg("deleteRequested",function(){mf(t);let d=fC().$implicit,m=fC(2);return yf(m.deletion.request(d.id))})("deleteConfirmed",function(){mf(t);let d=fC().$implicit,m=fC(2);return yf(m.confirmDelete(d))})("deleteCancelled",function(){mf(t);let d=fC(3);return yf(d.deletion.cancel())}),ml();}if(i&2){let t=fC().$implicit,l=fC(2);pg("rowKey",t.id)("rowLabel",t.name)("state",l.deletion);}}function W(i,e){if(i&1&&(Is(0,"tr",9)(1,"td",12)(2,"div",13)(3,"span",14),UC(4),ml(),Qw(5,z,2,0,"ds-tag",15),ml()(),Is(6,"td",16),UC(7),ml(),Is(8,"td",17),UC(9),ml(),Is(10,"td",18)(11,"div",19),Qw(12,J,3,2),Qw(13,Q,1,3,"agentos-row-delete-action",20),ml()()()),i&2){let t=e.$implicit,l=fC(2);KE(4),Lg(t.name),KE(),Kw(t.readOnly?5:-1),KE(2),Il(" ",t.description||"\u2014"," "),KE(2),Lg(l.resourceCount(t)),KE(3),Kw(l.deletion.confirmingId()!==t.id?12:-1),KE(),Kw(!t.readOnly&&t.id?13:-1);}}function X(i,e){if(i&1&&(Is(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),UC(5,"Name"),ml(),Is(6,"th",10),UC(7,"Description"),ml(),Is(8,"th",10),UC(9,"Resources"),ml(),Is(10,"th",10)(11,"span",11),UC(12,"Actions"),ml()()()(),Is(13,"tbody",8),eC(14,W,14,6,"tr",9,K),ml()()()),i&2){let t=fC();KE(14),tC(t.rowFilter.filteredRows());}}var B=class i{router=g(F);destroyRef=g(we);skillState=g(o);refresh$=new Sr(void 0);isLoading=zi(true);deletion=k();skills=zi([]);rowFilter=O$1(this.skills,e=>[e.name,e.description].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ma(()=>(this.isLoading.set(true),this.skillState.listPlatform())),U$1(this.destroyRef)).subscribe({next:e=>{this.skills.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}resourceCount(e){return Object.keys(e.resources??{}).length}openCreateForm(){this.router.navigate(["/agentos","admin","skills","new"]);}inspect(e){e.id&&this.router.navigate(["/agentos","admin","skills",e.id,"inspect"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","skills",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.skillState.delete(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:t=>t.status===403?`Deleting "${e.name}" requires platform administrator rights.`:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=xw({type:i,selectors:[["agentos-platform-skills"]],decls:9,vars:3,consts:[["title","Platform skills","description","Skills shared across every namespace."],["label","Filter skills","placeholder","Filter skills\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform skills"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__tags"],[1,"settings-table__name"],["variant","neutral"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Resources"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,l){t&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(m){return l.rowFilter.query.set(m)}),ml(),Is(2,"button",2),Eg("click",function(){return l.openCreateForm()}),UC(3,"New skill"),ml()(),Qw(4,O,2,1,"p",3),Qw(5,A,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,X,16,0,"div",6)),t&2&&(KE(),pg("query",l.rowFilter.query()),KE(3),Kw(l.deletion.error()?4:-1),KE(),Kw(l.isLoading()?5:l.skills().length===0?6:l.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{B as PlatformSkillsComponent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {I,n as nt,i as it}from'./chunk-BIqKO9_X.js';import {v}from'./chunk-BGV30iCr.js';import {g,W,F,H as we,z as zi,a9 as F$1,k as yT,p as Ff,M as U,P as x,O as w,x as xw,I as Is,S as Eg,U as UC,m as ml,Q as Qw,K as KE,R as pg,b as Kw,s as aC,l as eC,ao as Jw,T as VI,a as hg,r as fC,X as UI,t as tC,q as Il,ae as Zw,L as Lg,j as fg,u as mf,w as yf}from'./main-NUYYC27E.js';import {T as Te,b as bn,p as pt,v as vn,d as yn,e as fn,l as pn,h as hn,i as at,u as un,n as cn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,Q as Qt,C as Ca,c as fo,g as go,N as Nn,R as Rn}from'./chunk-Y0RP9yux.js';import'./chunk-D-pY3GeH.js';function Ce(i,t){i&1&&(Is(0,"p",2),UC(1,"Loading\u2026"),ml());}function ye(i,t){if(i&1&&(Is(0,"label",16),hg(1,"input",17),VI(),UC(2),ml()),i&2){let e=t.$implicit,n=fC(3);KE(),pg("formControl",n.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!n.isAdmin()),UI(),KE(),Il(" ",e.label," ");}}function ge(i,t){if(i&1&&(Is(0,"ds-fieldset",5),eC(1,ye,3,4,"label",16,Zw().trackByScope,true),ml()),i&2){let e=fC(2);pg("disabled",e.isEditMode()),KE(),tC(e.scopeOptions);}}function fe(i,t){if(i&1&&(Is(0,"option",8),UC(1),ml()),i&2){let e=t.$implicit,n=fC(2);pg("value",e),KE(),Lg(n.authTypeLabel[e]);}}function Se(i,t){if(i&1&&(Is(0,"ds-form-field",18),hg(1,"input",19),VI(),ml()),i&2){let e=fC().$implicit;pg("label",e.label)("controlId","as-cred-"+e.key)("required",e.required)("hint",e.hint??null)("hintId","as-hint-"+e.key),KE(),pg("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),fg("aria-describedby",e.hint?"as-hint-"+e.key:null),UI();}}function Ae(i,t){if(i&1&&Qw(0,Se,2,11,"ds-form-field",18),i&2){let e,n=t.$implicit,o=fC(3);Kw((e=o.controlForField(n.key))?0:-1,e);}}function ve(i,t){if(i&1&&(Is(0,"ds-fieldset",13),eC(1,Ae,1,1,null,null,Zw().trackByField,true),ml()),i&2){let e=fC(2);pg("hint","Values are stored encrypted and masked on read."+(e.isEditMode()?" Leave a field unchanged to keep the stored credential.":"")),KE(),tC(e.credentialFields());}}function be(i,t){if(i&1){let e=aC();Is(0,"form",4),Eg("ngSubmit",function(){mf(e);let o=fC();return yf(o.submit())}),Qw(1,ge,3,1,"ds-fieldset",5),Is(2,"ds-form-field",6)(3,"select",7),eC(4,fe,2,2,"option",8,Jw),ml(),VI(),ml(),Is(6,"ds-form-field",9),hg(7,"input",10),VI(),ml(),Is(8,"ds-form-field",11),hg(9,"input",12),VI(),ml(),Qw(10,ve,3,1,"ds-fieldset",13),Is(11,"ds-form-actions")(12,"button",14),UC(13),ml(),Is(14,"button",15),Eg("click",function(){mf(e);let o=fC();return yf(o.cancel())}),UC(15,"Cancel"),ml()()();}if(i&2){let e=fC();pg("formGroup",e.form),KE(),Kw(e.isPlatformMode?-1:1),KE(2),pg("formControl",e.authTypeControl),UI(),KE(),tC(e.authTypeOptions),KE(3),pg("formControl",e.nameControl),UI(),KE(2),pg("formControl",e.descriptionControl),UI(),KE(),Kw(e.credentialFields().length>0?10:-1),KE(2),pg("disabled",e.form.invalid||e.isSubmitting()),KE(),Il(" ",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?zi(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=nt;authTypeLabel=it;scopeOptions=[{value:"namespace",label:D.namespace},{value:"userOnNs",label:D.userOnNs},{value:"userGlobal",label:D.userGlobal}];nameControl=new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]});descriptionControl=new Te(null);authTypeControl=new Te("ApiKeyAuthSetting",{nonNullable:true,validators:[bn.required]});scopeControl=new Te("namespace",{nonNullable:true});form=new pt({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new Te("",{nonNullable:true});usernameControl=new Te("",{nonNullable:true});passwordControl=new Te("",{nonNullable:true});tokenControl=new Te("",{nonNullable:true});discoveryUrlControl=new Te("",{nonNullable:true});authorizationUrlControl=new Te("",{nonNullable:true});tokenUrlControl=new Te("",{nonNullable:true});clientIdControl=new Te("",{nonNullable:true});clientSecretControl=new Te("",{nonNullable:true});scopesControl=new Te("",{nonNullable:true});resourceUrlControl=new Te("",{nonNullable:true});selectedAuthType=F$1(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=yT(()=>_e[this.selectedAuthType()]);isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Ff(()=>{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=xw({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&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return n.cancel()}),UC(3," \u2190 Auth settings "),ml()(),Qw(4,Ce,2,0,"p",2)(5,be,16,8,"form",3),ml()),e&2&&(KE(),pg("title",n.isEditMode()?"Edit auth setting":"New auth setting"),KE(3),Kw(n.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,at,un,cn,Kt,fd,Mo,Do,Ut,Qt,Ca,fo,go,Nn,Rn],encapsulation:2})};
|
|
1
|
+
import {I,n as nt,i as it}from'./chunk-DQ809zoB.js';import {v}from'./chunk-B6sYf1j_.js';import {g,W,F,J as we,z as zi,ab as F$1,k as yT,p as Ff,M as U,P as x,O as w,x as xw,I as Is,S as Eg,U as UC,m as ml,Q as Qw,K as KE,R as pg,b as Kw,s as aC,l as eC,aq as Jw,T as VI,a as hg,r as fC,X as UI,t as tC,q as Il,ag as Zw,L as Lg,j as fg,u as mf,w as yf}from'./main-6TWWBEJW.js';import {T as Te,b as bn,p as pt,v as vn,d as yn,e as fn,l as pn,h as hn,i as at,u as un,n as cn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,Q as Qt,C as Ca,c as fo,g as go,N as Nn,R as Rn}from'./chunk-VbI0SYDI.js';import'./chunk-CG27SgJm.js';function Ce(i,t){i&1&&(Is(0,"p",2),UC(1,"Loading\u2026"),ml());}function ye(i,t){if(i&1&&(Is(0,"label",16),hg(1,"input",17),VI(),UC(2),ml()),i&2){let e=t.$implicit,n=fC(3);KE(),pg("formControl",n.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!n.isAdmin()),UI(),KE(),Il(" ",e.label," ");}}function ge(i,t){if(i&1&&(Is(0,"ds-fieldset",5),eC(1,ye,3,4,"label",16,Zw().trackByScope,true),ml()),i&2){let e=fC(2);pg("disabled",e.isEditMode()),KE(),tC(e.scopeOptions);}}function fe(i,t){if(i&1&&(Is(0,"option",8),UC(1),ml()),i&2){let e=t.$implicit,n=fC(2);pg("value",e),KE(),Lg(n.authTypeLabel[e]);}}function Se(i,t){if(i&1&&(Is(0,"ds-form-field",18),hg(1,"input",19),VI(),ml()),i&2){let e=fC().$implicit;pg("label",e.label)("controlId","as-cred-"+e.key)("required",e.required)("hint",e.hint??null)("hintId","as-hint-"+e.key),KE(),pg("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),fg("aria-describedby",e.hint?"as-hint-"+e.key:null),UI();}}function Ae(i,t){if(i&1&&Qw(0,Se,2,11,"ds-form-field",18),i&2){let e,n=t.$implicit,o=fC(3);Kw((e=o.controlForField(n.key))?0:-1,e);}}function ve(i,t){if(i&1&&(Is(0,"ds-fieldset",13),eC(1,Ae,1,1,null,null,Zw().trackByField,true),ml()),i&2){let e=fC(2);pg("hint","Values are stored encrypted and masked on read."+(e.isEditMode()?" Leave a field unchanged to keep the stored credential.":"")),KE(),tC(e.credentialFields());}}function be(i,t){if(i&1){let e=aC();Is(0,"form",4),Eg("ngSubmit",function(){mf(e);let o=fC();return yf(o.submit())}),Qw(1,ge,3,1,"ds-fieldset",5),Is(2,"ds-form-field",6)(3,"select",7),eC(4,fe,2,2,"option",8,Jw),ml(),VI(),ml(),Is(6,"ds-form-field",9),hg(7,"input",10),VI(),ml(),Is(8,"ds-form-field",11),hg(9,"input",12),VI(),ml(),Qw(10,ve,3,1,"ds-fieldset",13),Is(11,"ds-form-actions")(12,"button",14),UC(13),ml(),Is(14,"button",15),Eg("click",function(){mf(e);let o=fC();return yf(o.cancel())}),UC(15,"Cancel"),ml()()();}if(i&2){let e=fC();pg("formGroup",e.form),KE(),Kw(e.isPlatformMode?-1:1),KE(2),pg("formControl",e.authTypeControl),UI(),KE(),tC(e.authTypeOptions),KE(3),pg("formControl",e.nameControl),UI(),KE(2),pg("formControl",e.descriptionControl),UI(),KE(),Kw(e.credentialFields().length>0?10:-1),KE(2),pg("disabled",e.form.invalid||e.isSubmitting()),KE(),Il(" ",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?zi(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=nt;authTypeLabel=it;scopeOptions=[{value:"namespace",label:D.namespace},{value:"userOnNs",label:D.userOnNs},{value:"userGlobal",label:D.userGlobal}];nameControl=new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]});descriptionControl=new Te(null);authTypeControl=new Te("ApiKeyAuthSetting",{nonNullable:true,validators:[bn.required]});scopeControl=new Te("namespace",{nonNullable:true});form=new pt({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new Te("",{nonNullable:true});usernameControl=new Te("",{nonNullable:true});passwordControl=new Te("",{nonNullable:true});tokenControl=new Te("",{nonNullable:true});discoveryUrlControl=new Te("",{nonNullable:true});authorizationUrlControl=new Te("",{nonNullable:true});tokenUrlControl=new Te("",{nonNullable:true});clientIdControl=new Te("",{nonNullable:true});clientSecretControl=new Te("",{nonNullable:true});scopesControl=new Te("",{nonNullable:true});resourceUrlControl=new Te("",{nonNullable:true});selectedAuthType=F$1(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=yT(()=>_e[this.selectedAuthType()]);isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Ff(()=>{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=xw({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&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return n.cancel()}),UC(3," \u2190 Auth settings "),ml()(),Qw(4,Ce,2,0,"p",2)(5,be,16,8,"form",3),ml()),e&2&&(KE(),pg("title",n.isEditMode()?"Edit auth setting":"New auth setting"),KE(3),Kw(n.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,at,un,cn,Kt,fd,Mo,Do,Ut,Qt,Ca,fo,go,Nn,Rn],encapsulation:2})};
|
|
2
2
|
export{me as AuthSettingFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {w as m,q as k,O as O$1,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-
|
|
1
|
+
import {w as m,q as k,O as O$1,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-VbI0SYDI.js';import {g,W as W$1,F,J as we,$ as Sr,z as zi,a1 as ma,ae as Ny,a2 as ga,ac as _r,M as U$1,x as xw,I as Is,S as Eg,m as ml,U as UC,Q as Qw,K as KE,R as pg,b as Kw,r as fC,L as Lg,l as eC,t as tC,q as Il,s as aC,u as mf,w as yf,j as fg}from'./main-6TWWBEJW.js';var U=(n,e)=>e.key;function z(n,e){if(n&1&&(Is(0,"p",3),UC(1),ml()),n&2){let t=fC();KE(),Lg(t.deletion.error());}}function G(n,e){n&1&&(Is(0,"p",4),UC(1,"Loading prompts\u2026"),ml());}function O(n,e){n&1&&(Is(0,"p",5),UC(1,"No prompts available."),ml());}function Q(n,e){n&1&&(Is(0,"p",4),UC(1,"No prompts match the current filter."),ml());}function W(n,e){n&1&&(Is(0,"ds-tag",17),UC(1,"Read-only"),ml());}function X(n,e){if(n&1){let t=aC();Is(0,"button",23),Eg("click",function(){mf(t);let l=fC(2).$implicit,m=fC(2);return yf(m.edit(l))}),UC(1," Edit "),ml();}if(n&2){let t=fC(2).$implicit;fg("aria-label","Edit "+t.prompt.name);}}function Y(n,e){if(n&1){let t=aC();Qw(0,X,2,1,"button",21),Is(1,"agentos-row-delete-action",22),Eg("deleteRequested",function(){mf(t);let l=fC().$implicit,m=fC(2);return yf(m.deletion.request(l.key))})("deleteConfirmed",function(){mf(t);let l=fC().$implicit,m=fC(2);return yf(m.confirmDelete(l))})("deleteCancelled",function(){mf(t);let l=fC(3);return yf(l.deletion.cancel())}),ml();}if(n&2){let t=fC().$implicit,i=fC(2);Kw(i.deletion.confirmingId()!==t.key?0:-1),KE(),pg("rowKey",t.key)("rowLabel",t.prompt.name)("state",i.deletion);}}function Z(n,e){n&1&&(Is(0,"button",20),UC(1,"Inherited"),ml());}function ee(n,e){if(n&1&&(Is(0,"tr",9)(1,"td",12),UC(2),ml(),Is(3,"td",13),UC(4),ml(),Is(5,"td",14)(6,"div",15)(7,"ds-tag",16),UC(8),ml(),Qw(9,W,2,0,"ds-tag",17),ml()(),Is(10,"td",18)(11,"div",19),Qw(12,Y,2,4)(13,Z,2,0,"button",20),ml()()()),n&2){let t=e.$implicit;KE(2),Lg(t.prompt.name),KE(2),Il(" ",t.prompt.description||"\u2014"," "),KE(3),pg("variant",t.scope==="platform"?"neutral":"accent"),KE(),Lg(t.scope==="platform"?"Platform":"Namespace"),KE(),Kw(t.scope==="platform"?9:-1),KE(3),Kw(t.scope==="namespace"?12:13);}}function te(n,e){if(n&1&&(Is(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),UC(5,"Name"),ml(),Is(6,"th",10),UC(7,"Description"),ml(),Is(8,"th",10),UC(9,"Scope"),ml(),Is(10,"th",10)(11,"span",11),UC(12,"Actions"),ml()()()(),Is(13,"tbody",8),eC(14,ee,14,6,"tr",9,U),ml()()()),n&2){let t=fC();KE(14),tC(t.rowFilter.filteredRows());}}var J=class n{route=g(W$1);router=g(F);destroyRef=g(we);promptState=g(m);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Sr(void 0);isLoading=zi(true);deletion=k();rows=zi([]);rowFilter=O$1(this.rows,e=>[e.prompt.name,e.prompt.description,e.scope].filter(Boolean).join(" "));allPrompts$=this.refresh$.pipe(ma(()=>(this.isLoading.set(true),Ny({platform:this.promptState.listPlatform().pipe(ga(()=>_r([]))),namespace:this.promptState.listByNamespace(this.namespaceId)}))));constructor(){this.allPrompts$.pipe(U$1(this.destroyRef)).subscribe({next:({platform:e,namespace:t})=>{this.rows.set([...e.map((i,l)=>({key:`platform:${i.id??l}`,prompt:i,scope:"platform"})),...t.map((i,l)=>({key:`namespace:${i.id??l}`,prompt:i,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"prompts","new"]);}edit(e){e.scope==="platform"||!e.prompt.id||this.router.navigate(["/agentos",this.namespaceId,"prompts",e.prompt.id,"edit"]);}confirmDelete(e){e.scope==="platform"||!e.prompt.id||this.deletion.execute(e.key,{request$:this.promptState.delete(e.prompt.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.prompt.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=xw({type:n,selectors:[["agentos-namespace-prompts"]],decls:9,vars:3,consts:[["title","Prompts","description","Prompts available in this namespace, including prompts inherited from the platform."],["label","Filter prompts","placeholder","Filter prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(t,i){t&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(m){return i.rowFilter.query.set(m)}),ml(),Is(2,"button",2),Eg("click",function(){return i.openCreateForm()}),UC(3,"New prompt"),ml()(),Qw(4,z,2,1,"p",3),Qw(5,G,2,0,"p",4)(6,O,2,0,"p",5)(7,Q,2,0,"p",4)(8,te,16,0,"div",6)),t&2&&(KE(),pg("query",i.rowFilter.query()),KE(3),Kw(i.deletion.error()?4:-1),KE(),Kw(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{J as NamespacePromptsComponent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {I}from'./chunk-BIqKO9_X.js';import {g,W,a_ as L,H as we,z as zi,k as yT,a$ as Fe,ac as Ny,M as U,a2 as ga,aa as _r,x as xw,I as Is,a as hg,Q as Qw,m as ml,S as Eg,K as KE,b as Kw,R as pg,U as UC,s as aC,T as VI,l as eC,r as fC,X as UI,t as tC,q as Il,as as jg,u as mf,w as yf,L as Lg}from'./main-NUYYC27E.js';import {a6 as gd,M as Mo,D as Do,U as Ut,o as Mn,Q as Qt,c as fo,a8 as _a,ac as Bi,v as vn,d as yn,e as fn,l as pn,h as hn,_ as _n,i as at,u as un,n as cn}from'./chunk-Y0RP9yux.js';import'./chunk-D-pY3GeH.js';var oe=(i,t)=>t.id;function ae(i,t){i&1&&(Is(0,"p",1),UC(1,"Loading\u2026"),ml());}function se(i,t){if(i&1&&(Is(0,"ds-notice"),UC(1),ml()),i&2){let e=fC(2);KE(),Lg(e.errorMessage());}}function re(i,t){if(i&1){let e=aC();Is(0,"div")(1,"button",23),Eg("click",function(){mf(e);let s=fC(2);return yf(s.retryLoad())}),UC(2,"Retry loading"),ml()();}}function ce(i,t){if(i&1&&(hg(0,"br"),UC(1)),i&2){let e=fC(3);KE(),Il("",e.association()?.checkoutFailureReason," ");}}function de(i,t){if(i&1&&(Is(0,"ds-notice",3),UC(1),Qw(2,ce,2,1),ml()),i&2){let e=fC(2);pg("tone",e.checkoutStatus()===e.CheckoutStatus.FAILED?"error":e.checkoutStatus()===e.CheckoutStatus.READY?"success":"neutral"),KE(),Il(" Repository: ",e.checkoutStatus()," "),KE(),Kw(e.association()?.checkoutFailureReason?2:-1);}}function le(i,t){if(i&1&&(Is(0,"option",12),UC(1),ml()),i&2){let e=t.$implicit,c=fC(2);pg("value",e.id),KE(),jg("",e.name," (",c.authTypeLabel(e.authType),")");}}function me(i,t){i&1&&(Is(0,"p",13),UC(1," No usable auth setting in this namespace. Create a BEARER_TOKEN one first. "),ml());}function pe(i,t){if(i&1){let e=aC();Is(0,"button",24),Eg("click",function(){mf(e);let s=fC(2);return yf(s.remove())}),UC(1," Remove association "),ml();}if(i&2){let e=fC(2);pg("disabled",!e.associationLoaded()||e.isSaving());}}function ue(i,t){if(i&1){let e=aC();Qw(0,se,2,1,"ds-notice"),Qw(1,re,3,0,"div"),Qw(2,de,3,3,"ds-notice",3),Is(3,"ds-fieldset",4)(4,"ds-form-field",5)(5,"input",6),Eg("ngModelChange",function(s){mf(e);let u=fC();return yf(u.repositoryUrl.set(s))}),ml(),VI(),ml(),Is(6,"ds-form-field",7)(7,"input",8),Eg("ngModelChange",function(s){mf(e);let u=fC();return yf(u.mainBranch.set(s))}),ml(),VI(),ml(),Is(8,"ds-form-field",9)(9,"select",10),Eg("ngModelChange",function(s){mf(e);let u=fC();return yf(u.serviceAuthSettingId.set(s))}),Is(10,"option",11),UC(11,"Select an auth setting\u2026"),ml(),eC(12,le,2,3,"option",12,oe),ml(),VI(),Qw(14,me,2,0,"p",13),ml()(),Is(15,"ds-fieldset",14)(16,"div",15)(17,"label",16)(18,"input",17),Eg("ngModelChange",function(s){mf(e);let u=fC();return yf(u.autoWorktree.set(s))}),ml(),VI(),UC(19," Offer a worktree to every new top-level case "),ml(),Is(20,"p",18),UC(21," The creator checks the box when creating the case; it is unchecked by default, and a case created without it has no Git. Applies to cases created from now on: turning this on later never equips existing cases, and turning it off never removes a worktree already created. "),ml()(),Is(22,"ds-form-field",19)(23,"input",20),Eg("ngModelChange",function(s){mf(e);let u=fC();return yf(u.setupCommand.set(s))}),ml(),VI(),Is(24,"p",13),UC(25," Runs on the server, as the service user, in each new worktree. It executes code from the branch \u2014 prefer a command that disables lifecycle scripts. "),ml()()(),Is(26,"ds-form-actions")(27,"button",21),Eg("click",function(){mf(e);let s=fC();return yf(s.save())}),UC(28),ml(),Qw(29,pe,2,1,"button",22),ml();}if(i&2){let e=fC();Kw(e.errorMessage()?0:-1),KE(),Kw(e.associationLoaded()?-1:1),KE(),Kw(e.isAssociated()&&e.checkoutStatus()?2:-1),KE(),pg("disabled",!e.associationLoaded()||e.isSaving()),KE(2),pg("ngModel",e.repositoryUrl()),UI(),KE(2),pg("ngModel",e.mainBranch()),UI(),KE(2),pg("ngModel",e.serviceAuthSettingId()),UI(),KE(3),tC(e.eligibleAuthSettings()),KE(2),Kw(e.eligibleAuthSettings().length===0?14:-1),KE(),pg("disabled",!e.associationLoaded()||e.isSaving()),KE(3),pg("ngModel",e.autoWorktree()),UI(),KE(5),pg("ngModel",e.setupCommand()),UI(),KE(4),pg("disabled",!e.canSave()),KE(),Il(" ",e.isSaving()?"Saving\u2026":e.isAssociated()?"Update":"Associate"," "),KE(),Kw(e.isAssociated()?29:-1);}}var ge=["BearerTokenAuthSetting","BasicAuthAuthSetting","ApiKeyAuthSetting"],he={BearerTokenAuthSetting:"token",BasicAuthAuthSetting:"basic auth",ApiKeyAuthSetting:"API key"},ne=class i{route=g(W);gitApi=g(L);authSettingState=g(I);destroyRef=g(we);isLoading=zi(true);isSaving=zi(false);confirmingRemove=zi(false);associationLoaded=zi(false);errorMessage=zi(null);association=zi(null);authSettings=zi([]);repositoryUrl=zi("");mainBranch=zi("main");serviceAuthSettingId=zi("");autoWorktree=zi(false);setupCommand=zi("");namespaceId="";isAssociated=yT(()=>this.association()?.associated===true);eligibleAuthSettings=yT(()=>this.authSettings().filter(t=>ge.includes(t.authType)));authTypeLabel(t){return he[t??""]??t??"unknown"}canSave=yT(()=>this.associationLoaded()&&!this.isLoading()&&!this.isSaving()&&this.repositoryUrl().trim().length>0&&this.serviceAuthSettingId().length>0);checkoutStatus=yT(()=>this.association()?.checkoutStatus??null);CheckoutStatus=Fe;ngOnInit(){this.namespaceId=this.route.snapshot.paramMap.get("namespaceId")??"",this.load();}retryLoad(){this.isLoading()||this.isSaving()||this.load();}load(){this.isLoading.set(true),this.associationLoaded.set(false),this.errorMessage.set(null),Ny({association:this.gitApi.getAssociationNamespaceGit(this.namespaceId),authSettings:this.authSettingState.loadNamespaceSettings(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({association:t,authSettings:e})=>{this.authSettings.set(e??[]),this.acceptAssociation(t),this.isLoading.set(false);},error:t=>{console.error("Failed to load the Git repository settings",t),this.errorMessage.set(this.messageOf(t)),this.isLoading.set(false);}});}acceptAssociation(t){this.association.set(t);let e=t?.associated===false||t?.associated===true&&typeof t.repositoryUrl=="string"&&typeof t.mainBranch=="string"&&typeof t.serviceAuthSettingId=="string"&&typeof t.autoWorktreeForRootCases=="boolean"&&(t.setupCommand==null||typeof t.setupCommand=="string");this.associationLoaded.set(e),e?this.applyToForm(t):this.errorMessage.set("The repository settings could not be loaded completely. Retry before making changes.");}applyToForm(t){this.repositoryUrl.set(t.repositoryUrl??""),this.mainBranch.set(t.mainBranch??"main"),this.serviceAuthSettingId.set(t.serviceAuthSettingId??""),this.autoWorktree.set(t.autoWorktreeForRootCases??false),this.setupCommand.set(t.setupCommand??"");}save(){this.canSave()&&(this.isSaving.set(true),this.errorMessage.set(null),this.gitApi.setAssociationNamespaceGit(this.namespaceId,{repositoryUrl:this.repositoryUrl().trim(),mainBranch:this.mainBranch().trim()||void 0,serviceAuthSettingId:this.serviceAuthSettingId(),autoWorktreeForRootCases:this.autoWorktree(),setupCommand:this.setupCommand().trim()||void 0}).pipe(U(this.destroyRef),ga(t=>(console.error("Failed to save the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),_r(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}remove(){!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated()||this.confirmingRemove.set(true);}confirmRemove(){this.confirmingRemove.set(false),!(!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated())&&(this.isSaving.set(true),this.gitApi.removeAssociationNamespaceGit(this.namespaceId).pipe(U(this.destroyRef),ga(t=>(console.error("Failed to remove the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),_r(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}messageOf(t){return t.error?.message??t.message??"Unexpected error"}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=xw({type:i,selectors:[["agentos-namespace-git"]],decls:5,vars:2,consts:[["title","Git repository","description","Associating a repository enables Git workspaces for this namespace. When worktree creation is enabled, the new-case form offers a worktree, and a case created with one gets a repo/ directory shared by its sub-cases. Namespace files remain shared documents outside Git. Agents create branches and pull requests in their workflows."],[1,"ds-hint"],["title","Remove the repository association?","message","Existing workspaces keep their worktree.","confirmLabel","Remove","cancelLabel","Cancel",3,"confirmed","cancelled","open"],[3,"tone"],["legend","Repository",3,"disabled"],["label","Repository URL","controlId","git-url","hint","HTTPS only, without credentials in the URL."],["dsControl","","id","git-url","type","url","placeholder","https://forge.example/org/project.git","name","repositoryUrl",3,"ngModelChange","ngModel"],["label","Main branch","controlId","git-branch","hint","New worktrees start at this branch\u2019s commit, without creating a branch."],["dsControl","","id","git-branch","type","text","placeholder","main","name","mainBranch",3,"ngModelChange","ngModel"],["label","Service account","controlId","git-auth","hint","Shared by the namespace. Every Git operation uses this identity, never the identity of whoever opened the case."],["dsControl","","id","git-auth","name","serviceAuthSettingId",3,"ngModelChange","ngModel"],["value",""],[3,"value"],[1,"ds-hint","ds-hint--warning"],["legend","Automation",3,"disabled"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox","name","autoWorktree",3,"ngModelChange","ngModel"],[1,"ds-hint","ds-indent"],["label","Setup command (optional)","controlId","git-setup"],["dsControl","","mono","","id","git-setup","type","text","placeholder","pnpm install --ignore-scripts","name","setupCommand",3,"ngModelChange","ngModel"],["id","git-save","dsButton","","variant","primary","type","button",3,"click","disabled"],["id","git-remove","dsButton","","variant","danger","type","button",3,"disabled"],["id","git-retry","dsButton","","type","button",3,"click"],["id","git-remove","dsButton","","variant","danger","type","button",3,"click","disabled"]],template:function(e,c){e&1&&(Is(0,"ds-page"),hg(1,"ds-section-header",0),Qw(2,ae,2,0,"p",1)(3,ue,30,14),ml(),Is(4,"ds-confirm-dialog",2),Eg("confirmed",function(){return c.confirmRemove()})("cancelled",function(){return c.confirmingRemove.set(false)}),ml()),e&2&&(KE(2),Kw(c.isLoading()?2:3),KE(2),pg("open",c.confirmingRemove()));},dependencies:[gd,Mo,Do,Ut,Mn,Qt,fo,_a,Bi,vn,yn,fn,pn,hn,_n,at,un,cn],encapsulation:2})};
|
|
1
|
+
import {I}from'./chunk-DQ809zoB.js';import {g,W,a$ as Y,J as we,z as zi,k as yT,b0 as ke,ae as Ny,M as U,a2 as ga,ac as _r,x as xw,I as Is,a as hg,Q as Qw,m as ml,S as Eg,K as KE,b as Kw,R as pg,U as UC,s as aC,T as VI,l as eC,r as fC,X as UI,t as tC,q as Il,a5 as jg,u as mf,w as yf,L as Lg}from'./main-6TWWBEJW.js';import {a6 as gd,M as Mo,D as Do,U as Ut,o as Mn,Q as Qt,c as fo,a8 as _a,ac as Bi,v as vn,d as yn,e as fn,l as pn,h as hn,_ as _n,i as at,u as un,n as cn}from'./chunk-VbI0SYDI.js';import'./chunk-CG27SgJm.js';var oe=(i,t)=>t.id;function ae(i,t){i&1&&(Is(0,"p",1),UC(1,"Loading\u2026"),ml());}function se(i,t){if(i&1&&(Is(0,"ds-notice"),UC(1),ml()),i&2){let e=fC(2);KE(),Lg(e.errorMessage());}}function re(i,t){if(i&1){let e=aC();Is(0,"div")(1,"button",23),Eg("click",function(){mf(e);let s=fC(2);return yf(s.retryLoad())}),UC(2,"Retry loading"),ml()();}}function ce(i,t){if(i&1&&(hg(0,"br"),UC(1)),i&2){let e=fC(3);KE(),Il("",e.association()?.checkoutFailureReason," ");}}function de(i,t){if(i&1&&(Is(0,"ds-notice",3),UC(1),Qw(2,ce,2,1),ml()),i&2){let e=fC(2);pg("tone",e.checkoutStatus()===e.CheckoutStatus.FAILED?"error":e.checkoutStatus()===e.CheckoutStatus.READY?"success":"neutral"),KE(),Il(" Repository: ",e.checkoutStatus()," "),KE(),Kw(e.association()?.checkoutFailureReason?2:-1);}}function le(i,t){if(i&1&&(Is(0,"option",12),UC(1),ml()),i&2){let e=t.$implicit,c=fC(2);pg("value",e.id),KE(),jg("",e.name," (",c.authTypeLabel(e.authType),")");}}function me(i,t){i&1&&(Is(0,"p",13),UC(1," No usable auth setting in this namespace. Create a BEARER_TOKEN one first. "),ml());}function pe(i,t){if(i&1){let e=aC();Is(0,"button",24),Eg("click",function(){mf(e);let s=fC(2);return yf(s.remove())}),UC(1," Remove association "),ml();}if(i&2){let e=fC(2);pg("disabled",!e.associationLoaded()||e.isSaving());}}function ue(i,t){if(i&1){let e=aC();Qw(0,se,2,1,"ds-notice"),Qw(1,re,3,0,"div"),Qw(2,de,3,3,"ds-notice",3),Is(3,"ds-fieldset",4)(4,"ds-form-field",5)(5,"input",6),Eg("ngModelChange",function(s){mf(e);let u=fC();return yf(u.repositoryUrl.set(s))}),ml(),VI(),ml(),Is(6,"ds-form-field",7)(7,"input",8),Eg("ngModelChange",function(s){mf(e);let u=fC();return yf(u.mainBranch.set(s))}),ml(),VI(),ml(),Is(8,"ds-form-field",9)(9,"select",10),Eg("ngModelChange",function(s){mf(e);let u=fC();return yf(u.serviceAuthSettingId.set(s))}),Is(10,"option",11),UC(11,"Select an auth setting\u2026"),ml(),eC(12,le,2,3,"option",12,oe),ml(),VI(),Qw(14,me,2,0,"p",13),ml()(),Is(15,"ds-fieldset",14)(16,"div",15)(17,"label",16)(18,"input",17),Eg("ngModelChange",function(s){mf(e);let u=fC();return yf(u.autoWorktree.set(s))}),ml(),VI(),UC(19," Offer a worktree to every new top-level case "),ml(),Is(20,"p",18),UC(21," The creator checks the box when creating the case; it is unchecked by default, and a case created without it has no Git. Applies to cases created from now on: turning this on later never equips existing cases, and turning it off never removes a worktree already created. "),ml()(),Is(22,"ds-form-field",19)(23,"input",20),Eg("ngModelChange",function(s){mf(e);let u=fC();return yf(u.setupCommand.set(s))}),ml(),VI(),Is(24,"p",13),UC(25," Runs on the server, as the service user, in each new worktree. It executes code from the branch \u2014 prefer a command that disables lifecycle scripts. "),ml()()(),Is(26,"ds-form-actions")(27,"button",21),Eg("click",function(){mf(e);let s=fC();return yf(s.save())}),UC(28),ml(),Qw(29,pe,2,1,"button",22),ml();}if(i&2){let e=fC();Kw(e.errorMessage()?0:-1),KE(),Kw(e.associationLoaded()?-1:1),KE(),Kw(e.isAssociated()&&e.checkoutStatus()?2:-1),KE(),pg("disabled",!e.associationLoaded()||e.isSaving()),KE(2),pg("ngModel",e.repositoryUrl()),UI(),KE(2),pg("ngModel",e.mainBranch()),UI(),KE(2),pg("ngModel",e.serviceAuthSettingId()),UI(),KE(3),tC(e.eligibleAuthSettings()),KE(2),Kw(e.eligibleAuthSettings().length===0?14:-1),KE(),pg("disabled",!e.associationLoaded()||e.isSaving()),KE(3),pg("ngModel",e.autoWorktree()),UI(),KE(5),pg("ngModel",e.setupCommand()),UI(),KE(4),pg("disabled",!e.canSave()),KE(),Il(" ",e.isSaving()?"Saving\u2026":e.isAssociated()?"Update":"Associate"," "),KE(),Kw(e.isAssociated()?29:-1);}}var ge=["BearerTokenAuthSetting","BasicAuthAuthSetting","ApiKeyAuthSetting"],he={BearerTokenAuthSetting:"token",BasicAuthAuthSetting:"basic auth",ApiKeyAuthSetting:"API key"},ne=class i{route=g(W);gitApi=g(Y);authSettingState=g(I);destroyRef=g(we);isLoading=zi(true);isSaving=zi(false);confirmingRemove=zi(false);associationLoaded=zi(false);errorMessage=zi(null);association=zi(null);authSettings=zi([]);repositoryUrl=zi("");mainBranch=zi("main");serviceAuthSettingId=zi("");autoWorktree=zi(false);setupCommand=zi("");namespaceId="";isAssociated=yT(()=>this.association()?.associated===true);eligibleAuthSettings=yT(()=>this.authSettings().filter(t=>ge.includes(t.authType)));authTypeLabel(t){return he[t??""]??t??"unknown"}canSave=yT(()=>this.associationLoaded()&&!this.isLoading()&&!this.isSaving()&&this.repositoryUrl().trim().length>0&&this.serviceAuthSettingId().length>0);checkoutStatus=yT(()=>this.association()?.checkoutStatus??null);CheckoutStatus=ke;ngOnInit(){this.namespaceId=this.route.snapshot.paramMap.get("namespaceId")??"",this.load();}retryLoad(){this.isLoading()||this.isSaving()||this.load();}load(){this.isLoading.set(true),this.associationLoaded.set(false),this.errorMessage.set(null),Ny({association:this.gitApi.getAssociationNamespaceGit(this.namespaceId),authSettings:this.authSettingState.loadNamespaceSettings(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({association:t,authSettings:e})=>{this.authSettings.set(e??[]),this.acceptAssociation(t),this.isLoading.set(false);},error:t=>{console.error("Failed to load the Git repository settings",t),this.errorMessage.set(this.messageOf(t)),this.isLoading.set(false);}});}acceptAssociation(t){this.association.set(t);let e=t?.associated===false||t?.associated===true&&typeof t.repositoryUrl=="string"&&typeof t.mainBranch=="string"&&typeof t.serviceAuthSettingId=="string"&&typeof t.autoWorktreeForRootCases=="boolean"&&(t.setupCommand==null||typeof t.setupCommand=="string");this.associationLoaded.set(e),e?this.applyToForm(t):this.errorMessage.set("The repository settings could not be loaded completely. Retry before making changes.");}applyToForm(t){this.repositoryUrl.set(t.repositoryUrl??""),this.mainBranch.set(t.mainBranch??"main"),this.serviceAuthSettingId.set(t.serviceAuthSettingId??""),this.autoWorktree.set(t.autoWorktreeForRootCases??false),this.setupCommand.set(t.setupCommand??"");}save(){this.canSave()&&(this.isSaving.set(true),this.errorMessage.set(null),this.gitApi.setAssociationNamespaceGit(this.namespaceId,{repositoryUrl:this.repositoryUrl().trim(),mainBranch:this.mainBranch().trim()||void 0,serviceAuthSettingId:this.serviceAuthSettingId(),autoWorktreeForRootCases:this.autoWorktree(),setupCommand:this.setupCommand().trim()||void 0}).pipe(U(this.destroyRef),ga(t=>(console.error("Failed to save the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),_r(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}remove(){!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated()||this.confirmingRemove.set(true);}confirmRemove(){this.confirmingRemove.set(false),!(!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated())&&(this.isSaving.set(true),this.gitApi.removeAssociationNamespaceGit(this.namespaceId).pipe(U(this.destroyRef),ga(t=>(console.error("Failed to remove the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),_r(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}messageOf(t){return t.error?.message??t.message??"Unexpected error"}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=xw({type:i,selectors:[["agentos-namespace-git"]],decls:5,vars:2,consts:[["title","Git repository","description","Associating a repository enables Git workspaces for this namespace. When worktree creation is enabled, the new-case form offers a worktree, and a case created with one gets a repo/ directory shared by its sub-cases. Namespace files remain shared documents outside Git. Agents create branches and pull requests in their workflows."],[1,"ds-hint"],["title","Remove the repository association?","message","Existing workspaces keep their worktree.","confirmLabel","Remove","cancelLabel","Cancel",3,"confirmed","cancelled","open"],[3,"tone"],["legend","Repository",3,"disabled"],["label","Repository URL","controlId","git-url","hint","HTTPS only, without credentials in the URL."],["dsControl","","id","git-url","type","url","placeholder","https://forge.example/org/project.git","name","repositoryUrl",3,"ngModelChange","ngModel"],["label","Main branch","controlId","git-branch","hint","New worktrees start at this branch\u2019s commit, without creating a branch."],["dsControl","","id","git-branch","type","text","placeholder","main","name","mainBranch",3,"ngModelChange","ngModel"],["label","Service account","controlId","git-auth","hint","Shared by the namespace. Every Git operation uses this identity, never the identity of whoever opened the case."],["dsControl","","id","git-auth","name","serviceAuthSettingId",3,"ngModelChange","ngModel"],["value",""],[3,"value"],[1,"ds-hint","ds-hint--warning"],["legend","Automation",3,"disabled"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox","name","autoWorktree",3,"ngModelChange","ngModel"],[1,"ds-hint","ds-indent"],["label","Setup command (optional)","controlId","git-setup"],["dsControl","","mono","","id","git-setup","type","text","placeholder","pnpm install --ignore-scripts","name","setupCommand",3,"ngModelChange","ngModel"],["id","git-save","dsButton","","variant","primary","type","button",3,"click","disabled"],["id","git-remove","dsButton","","variant","danger","type","button",3,"disabled"],["id","git-retry","dsButton","","type","button",3,"click"],["id","git-remove","dsButton","","variant","danger","type","button",3,"click","disabled"]],template:function(e,c){e&1&&(Is(0,"ds-page"),hg(1,"ds-section-header",0),Qw(2,ae,2,0,"p",1)(3,ue,30,14),ml(),Is(4,"ds-confirm-dialog",2),Eg("confirmed",function(){return c.confirmRemove()})("cancelled",function(){return c.confirmingRemove.set(false)}),ml()),e&2&&(KE(2),Kw(c.isLoading()?2:3),KE(2),pg("open",c.confirmingRemove()));},dependencies:[gd,Mo,Do,Ut,Mn,Qt,fo,_a,Bi,vn,yn,fn,pn,hn,_n,at,un,cn],encapsulation:2})};
|
|
2
2
|
export{ne as NamespaceGitComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {O as O$1}from'./chunk-YwnuVV6j.js';import {g,F,J as we,ah as _,$ as Sr,z as zi,a1 as ma,M as U$1,x as xw,I as Is,S as Eg,m as ml,U as UC,Q as Qw,K as KE,R as pg,b as Kw,r as fC,L as Lg,l as eC,t as tC,s as aC,j as fg,u as mf,w as yf}from'./main-6TWWBEJW.js';import {q as k,O as O$2,i as at,d as yn,V as Vo,j as P,r as P$1}from'./chunk-VbI0SYDI.js';import'./chunk-CG27SgJm.js';var j=(t,e)=>e.id??e.name;function A(t,e){if(t&1&&(Is(0,"p",3),UC(1),ml()),t&2){let n=fC();KE(),Lg(n.deletion.error());}}function K(t,e){t&1&&(Is(0,"p",4),UC(1,"Loading integrations\u2026"),ml());}function H(t,e){t&1&&(Is(0,"p",5),UC(1,"No platform integrations defined yet."),ml());}function U(t,e){t&1&&(Is(0,"p",4),UC(1,"No integrations match the current filter."),ml());}function z(t,e){if(t&1){let n=aC();Is(0,"button",18),Eg("click",function(){mf(n);let d=fC().$implicit,m=fC(2);return yf(m.edit(d))}),UC(1,"Edit"),ml();}if(t&2){let n=fC().$implicit;fg("aria-label","Edit "+n.name);}}function G(t,e){if(t&1){let n=aC();Is(0,"agentos-row-delete-action",19),Eg("deleteRequested",function(){mf(n);let d=fC().$implicit,m=fC(2);return yf(m.deletion.request(d.id))})("deleteConfirmed",function(){mf(n);let d=fC().$implicit,m=fC(2);return yf(m.confirmDelete(d))})("deleteCancelled",function(){mf(n);let d=fC(3);return yf(d.deletion.cancel())}),ml();}if(t&2){let n=fC().$implicit,r=fC(2);pg("rowKey",n.id)("rowLabel",n.name)("state",r.deletion);}}function J(t,e){if(t&1&&(Is(0,"tr",9)(1,"td",12),UC(2),ml(),Is(3,"td",13),UC(4),ml(),Is(5,"td",14)(6,"div",15),Qw(7,z,2,1,"button",16),Qw(8,G,1,3,"agentos-row-delete-action",17),ml()()()),t&2){let n=e.$implicit,r=fC(2);KE(2),Lg(n.name),KE(2),Lg(n.integrationType),KE(3),Kw(r.deletion.confirmingId()!==n.id?7:-1),KE(),Kw(n.id?8:-1);}}function O(t,e){if(t&1&&(Is(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),UC(5,"Name"),ml(),Is(6,"th",10),UC(7,"Type"),ml(),Is(8,"th",10)(9,"span",11),UC(10,"Actions"),ml()()()(),Is(11,"tbody",8),eC(12,J,9,4,"tr",9,j),ml()()()),t&2){let n=fC();KE(12),tC(n.rowFilter.filteredRows());}}var B=class t{router=g(F);destroyRef=g(we);state=g(O$1);integrationConfigController=g(_);refresh$=new Sr(void 0);isLoading=zi(true);deletion=k();configs=zi([]);rowFilter=O$2(this.configs,e=>[e.name,e.integrationType].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ma(()=>(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=xw({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&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(m){return r.rowFilter.query.set(m)}),ml(),Is(2,"button",2),Eg("click",function(){return r.openCreateForm()}),UC(3,"New integration"),ml()(),Qw(4,A,2,1,"p",3),Qw(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&&(KE(),pg("query",r.rowFilter.query()),KE(3),Kw(r.deletion.error()?4:-1),KE(),Kw(r.isLoading()?5:r.configs().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,P,P$1],encapsulation:2})};export{B as PlatformIntegrationConfigsComponent};
|