@whoz-oss/coday-client 0.0.0-workstream-forge.331 → 0.0.0-workstream-forge.333

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/browser/{chunk-DWek3Vvq.js → chunk-6mUiLq7J.js} +1 -1
  2. package/browser/{chunk-DkyYa4dP.js → chunk-B-OAcK88.js} +1 -1
  3. package/browser/{chunk-BKhg9cS8.js → chunk-B4TFcXLM.js} +1 -1
  4. package/browser/{chunk-BavZR8IQ.js → chunk-BHOnk9dZ.js} +1 -1
  5. package/browser/{chunk-C1_rbGUZ.js → chunk-BJmE-e06.js} +1 -1
  6. package/browser/{chunk-CIvkifuI.js → chunk-BNlIgcoJ.js} +1 -1
  7. package/browser/{chunk-e7Cu5bcW.js → chunk-BbV-6v9m.js} +1 -1
  8. package/browser/{chunk-DYliL6RV.js → chunk-Bcce-bFp.js} +1 -1
  9. package/browser/{chunk-BlUH8PiL.js → chunk-Beo5PU-L.js} +1 -1
  10. package/browser/{chunk-COjy9LwT.js → chunk-Bg57XyTu.js} +1 -1
  11. package/browser/{chunk-B6jlYkdc.js → chunk-BrHnLuhR.js} +1 -1
  12. package/browser/{chunk-BqhXRTE9.js → chunk-BwLbh1qu.js} +1 -1
  13. package/browser/{chunk-qDmjJRtz.js → chunk-C0YXwJjR.js} +1 -1
  14. package/browser/{chunk-CpG1Ps_f.js → chunk-C9tPnPS4.js} +1 -1
  15. package/browser/{chunk-D3RGHIPo.js → chunk-CCh_OPVX.js} +1 -1
  16. package/browser/{chunk-CQ2iuB3y.js → chunk-CDBtestp.js} +1 -1
  17. package/browser/chunk-CDHKd9K7.js +1 -0
  18. package/browser/{chunk-B1OueUuF.js → chunk-COOSrT79.js} +1 -1
  19. package/browser/{chunk-D_M6An-F.js → chunk-CQHpkwQM.js} +1 -1
  20. package/browser/{chunk-Ckqsw6_o.js → chunk-CSx6JB9H.js} +1 -1
  21. package/browser/{chunk-Dcb_-BFl.js → chunk-Ccyz6wFl.js} +1 -1
  22. package/browser/chunk-CfOL-lBl.js +1 -0
  23. package/browser/{chunk-AhABNqjK.js → chunk-CgeaInf7.js} +1 -1
  24. package/browser/chunk-CgqBKCnj.js +1 -0
  25. package/browser/{chunk-CDX2y9HT.js → chunk-Ch2iBggu.js} +1 -1
  26. package/browser/{chunk-BMIorvab.js → chunk-Cm318Wo9.js} +1 -1
  27. package/browser/{chunk-B5p0JRDM.js → chunk-CpI8ncwF.js} +3 -3
  28. package/browser/{chunk-5OWiGx2T.js → chunk-Cuqd2uDM.js} +1 -1
  29. package/browser/{chunk-iK8_dXTN.js → chunk-DB2bxpGQ.js} +1 -1
  30. package/browser/{chunk-YF5daR1e.js → chunk-DMs5vJQk.js} +1 -1
  31. package/browser/{chunk-BlzRRx1g.js → chunk-DeqenSfb.js} +1 -1
  32. package/browser/{chunk-UAQkvwE0.js → chunk-Dkj7Qoc6.js} +1 -1
  33. package/browser/{chunk-DLcXOMHn.js → chunk-DpVoIhsX.js} +1 -1
  34. package/browser/chunk-DtU71v04.js +1 -0
  35. package/browser/{chunk-j4fMa8e9.js → chunk-FlY1WFmu.js} +1 -1
  36. package/browser/chunk-HF1eX5Ac.js +1 -0
  37. package/browser/{chunk-Cyw_OgWI.js → chunk-Q2UK3YgL.js} +1 -1
  38. package/browser/{chunk-BBuC4eJi.js → chunk-Y2mmZKGJ.js} +1 -1
  39. package/browser/{chunk-DWmkj7eC.js → chunk-a2QnJZlG.js} +1 -1
  40. package/browser/{chunk-B7gZ0xoB.js → chunk-dtQD_YKT.js} +1 -1
  41. package/browser/{chunk-DFVMmbfW.js → chunk-iMU-ddhD.js} +1 -1
  42. package/browser/{chunk-BmUmjEM2.js → chunk-kV38ck51.js} +1 -1
  43. package/browser/{chunk-CHST_8Lf.js → chunk-ksmj50i0.js} +1 -1
  44. package/browser/{chunk-CA7j6SPL.js → chunk-kz1EiKNu.js} +1 -1
  45. package/browser/{chunk-B_4KQf9A.js → chunk-qXoQpHGN.js} +1 -1
  46. package/browser/chunk-sndqhEYj.js +2 -0
  47. package/browser/{chunk-DDr6qrWp.js → chunk-t8DlZ_sM.js} +1 -1
  48. package/browser/{chunk-_l0MlYG9.js → chunk-tB22Lge-.js} +1 -1
  49. package/browser/index.html +1 -1
  50. package/browser/{main-TMKGPCQB.js → main-GL65UOL7.js} +1 -1
  51. package/package.json +1 -1
  52. package/browser/chunk-CNX2FHwM.js +0 -2
  53. package/browser/chunk-CcQh1J7A.js +0 -1
  54. package/browser/chunk-DrR3Ei-n.js +0 -1
  55. package/browser/chunk-GHoS5IMW.js +0 -1
  56. package/browser/chunk-aP6s6v6i.js +0 -1
@@ -1,2 +0,0 @@
1
- import {I,n as nt,i as it}from'./chunk-AhABNqjK.js';import {v}from'./chunk-DkyYa4dP.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,ar 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-TMKGPCQB.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-B5p0JRDM.js';import'./chunk-aP6s6v6i.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
- export{me as AuthSettingFormComponent};
@@ -1 +0,0 @@
1
- import {o as o$1,r,i,l}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-5OWiGx2T.js';import {O}from'./chunk-BavZR8IQ.js';import {g,W,F,J as we,ai as U,aA as N,z as zi,aB as K$1,aa as J,k as yT,ab as F$1,aC as QB,aD as Ne,M as U$1,a2 as ga,ac as _r,ae as Ny,af as ne,P as x,O as w,x as xw,aw as $t$1,I as Is,S as Eg,U as UC,m as ml,Q as Qw,K as KE,R as pg,b as Kw,aE as Sg,aF as DC,r as fC,s as aC,a as hg,T as VI,u as mf,w as yf,X as UI,c as xg,j as fg,q as Il,l as eC,t as tC,L as Lg,a5 as jg}from'./main-TMKGPCQB.js';import {H as A,p as pt$1,T as Te,b as bn,I as E,K as Kt$1,a as fd,M as Mo,D as Do,U as Ut$1,P as Pn,o as Mn,Q as Qt,c as fo,g as go,t as ta,Z as Zr,N as Nn,R as Rn,v as vn,d as yn,e as fn,l as pn,h as hn,_ as _n,i as at$1,u as un,n as cn,A as Ao}from'./chunk-B5p0JRDM.js';import'./chunk-aP6s6v6i.js';var D="*";function Ke(i){return (i??[]).some(t=>t.trim()===D)}function He(i){let t=(i??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==D).map(e=>e.toLowerCase());return new Set(t)}function K(i){return i.includes(D)}function Qe(i){let t=i.replace(/[\\.[\]{}()^$|]/g,"\\$&").replace(/\*/g,".*");try{return new RegExp(`^${t}$`,"i")}catch(e){return null}}function Y(i,t){return (t??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==D&&K(e)).some(e=>Qe(e)?.test(i)??false)}var We="AGENTOS_CONFIG",Xe=new Set(["HTTP_API","MCP_HTTP","MCP_STDIO","BASH","TMUX","GIT"]);function Je(i){return i.configEnabled&&(i.hasSubAgents||i.integrationTypes.some(t=>Xe.has(t)))}var Ze=["instructionsTextarea"],Ye=(i,t)=>t.value,et=(i,t)=>t.config.id,tt=(i,t)=>t.type,ze=(i,t)=>t.selector;function nt(i,t){if(i&1&&(Is(0,"a",3),UC(1,"View resolved definition \u2192"),ml()),i&2){let e=fC();pg("routerLink",e.inspectRoute());}}function it(i,t){i&1&&(Is(0,"ds-tag",4),UC(1,"Platform level"),ml());}function ot(i,t){i&1&&(Is(0,"p",5),UC(1,"Loading\u2026"),ml());}function at(i,t){if(i&1&&(hg(0,"input",18),VI()),i&2){let e=fC(2);pg("formControl",e.modelNameControl),UI();}}function lt(i,t){if(i&1&&(Is(0,"option",45),UC(1),ml()),i&2){let e=t;pg("ngValue",e.value),KE(),Lg(e.label);}}function rt(i,t){if(i&1&&(Is(0,"option",45),UC(1),ml()),i&2){let e=t.$implicit;pg("ngValue",e.value),KE(),Lg(e.label);}}function st(i,t){if(i&1&&(Is(0,"optgroup",46),eC(1,rt,2,2,"option",45,Ye),ml()),i&2){let e=fC(3);KE(),tC(e.modelOptions().aliases);}}function dt(i,t){if(i&1&&(Is(0,"option",45),UC(1),ml()),i&2){let e=t.$implicit;pg("ngValue",e.value),KE(),Lg(e.label);}}function ct(i,t){if(i&1&&(Is(0,"optgroup",47),eC(1,dt,2,2,"option",45,Ye),ml()),i&2){let e=fC(3);KE(),tC(e.modelOptions().apiNames);}}function ut(i,t){if(i&1&&(Is(0,"select",19)(1,"option",44),UC(2,"Select a model"),ml(),Qw(3,lt,2,2,"option",45),Qw(4,st,3,0,"optgroup",46),Qw(5,ct,3,0,"optgroup",47),ml(),VI()),i&2){let e,n=fC(2);pg("formControl",n.modelNameControl),UI(),KE(),pg("ngValue",null),KE(2),Kw((e=n.modelOptions().current)?3:-1,e),KE(),Kw(n.modelOptions().aliases.length>0?4:-1),KE(),Kw(n.modelOptions().apiNames.length>0?5:-1);}}function gt(i,t){if(i&1&&(Is(0,"span",48),UC(1),ml()),i&2){let e=fC().$implicit;KE(),Lg(e.config.integrationType);}}function mt(i,t){if(i&1&&(hg(0,"input",49),VI()),i&2){let e=fC().$implicit;pg("formControl",e.toolsControl),fg("aria-label","Tools of "+e.config.name),UI();}}function pt(i,t){if(i&1){let e=aC();Is(0,"div",11)(1,"label",12)(2,"input",27),Eg("change",function(){let s=mf(e).$implicit,u=fC(3);return yf(u.toggleIntegration(s))}),ml(),Is(3,"span",28),UC(4),ml(),Qw(5,gt,2,1,"span",48),ml(),Qw(6,mt,1,2,"input",49),ml();}if(i&2){let e=t.$implicit;KE(2),pg("checked",e.enabled()),KE(2),Lg(e.config.name),KE(),Kw(e.config.integrationType?5:-1),KE(),Kw(e.enabled()?6:-1);}}function ft(i,t){if(i&1&&(Is(0,"p",14),UC(1),ml()),i&2){let e=fC().$implicit;KE(),Il(" Restricted to: ",e.restrictedTools.join(", ")," (set outside this form, preserved on save) ");}}function Ct(i,t){if(i&1){let e=aC();Is(0,"div",11)(1,"label",28),UC(2),Is(3,"span",48),UC(4,"built-in"),ml()(),Is(5,"select",51),Eg("change",function(s){let u=mf(e).$implicit,C=fC(4);return yf(C.setBuiltInState(u,s.target.value))}),Is(6,"option",52),UC(7),ml(),Is(8,"option",53),UC(9,"Enabled"),ml(),Is(10,"option",54),UC(11,"Disabled"),ml()(),Qw(12,ft,2,1,"p",14),Is(13,"p",14),UC(14),ml()();}if(i&2){let e=t.$implicit,n=fC(4);KE(),fg("for","built-in-"+e.type),KE(),Il(" ",e.displayName," "),KE(3),pg("id","built-in-"+e.type)("value",e.state()),KE(2),Lg(n.builtInDefaultLabel(e)),KE(5),Kw(e.state()==="on"&&e.restrictedTools?12:-1),KE(2),Lg(e.description);}}function _t(i,t){if(i&1&&(Is(0,"span",50),UC(1,"Built-in integrations"),ml(),eC(2,Ct,15,7,"div",11,tt)),i&2){let e=fC(3);KE(2),tC(e.builtInRows());}}function bt(i,t){i&1&&(Is(0,"ds-notice",30),UC(1," This agent can read the AgentOS configuration and also has a network integration or sub-agents: what it reads could be sent outside without any confirmation. Prefer a dedicated configuration agent without them. "),ml());}function ht(i,t){if(i&1&&(Is(0,"ds-fieldset",25),eC(1,pt,7,4,"div",11,et),Qw(3,_t,4,0),Qw(4,bt,2,0,"ds-notice",30),ml()),i&2){let e=fC(2);KE(),tC(e.integrationRows()),KE(2),Kw(e.builtInRows().length>0?3:-1),KE(),Kw(e.configAgentExposureWarning()?4:-1);}}function yt(i,t){i&1&&UC(0," A platform config can only list platform skills here: namespace skills are resolved per namespace when the agent runs. ");}function xt(i,t){i&1&&(Is(0,"ds-notice",30),UC(1," Saving with this on replaces the selection below with "),Is(2,"code",29),UC(3,"*"),ml(),UC(4,". "),ml());}function vt(i,t){i&1&&(Is(0,"ds-notice"),UC(1," The skill catalogue could not be loaded. What this agent already declares is listed below and preserved on save. "),ml());}function St(i,t){i&1&&(Is(0,"p",5),UC(1,"No skill available in this scope yet."),ml());}function At(i,t){i&1&&(Is(0,"span",48),UC(1,"platform"),ml());}function wt(i,t){if(i&1&&(Is(0,"span",48),UC(1),ml()),i&2){let e=fC(4);KE(),Il(" ",e.skillCatalogueUnavailable()?"not verified":"no matching skill"," ");}}function Et(i,t){if(i&1&&(Is(0,"p",14),UC(1),ml()),i&2){let e=fC().$implicit;KE(),Lg(e.description);}}function Tt(i,t){if(i&1){let e=aC();Is(0,"div",11)(1,"label",12)(2,"input",55),Eg("change",function(){let s=mf(e).$implicit,u=fC(3);return yf(u.toggleSkill(s))}),ml(),Is(3,"span",28),UC(4),ml(),Qw(5,At,2,0,"span",48),Qw(6,wt,2,1,"span",48),ml(),Qw(7,Et,2,1,"p",14),ml();}if(i&2){let e=t.$implicit,n=fC(3);KE(2),pg("checked",e.selected())("disabled",n.allSkillsSelected()),KE(2),Lg(e.name),KE(),Kw(e.platform?5:-1),KE(),Kw(e.unresolved?6:-1),KE(),Kw(e.description?7:-1);}}function kt(i,t){if(i&1&&eC(0,Tt,8,6,"div",11,ze),i&2){let e=fC(2);tC(e.skillRows());}}function It(i,t){if(i&1&&(Is(0,"ds-form-field",34),hg(1,"textarea",56),VI(),Is(2,"p",5),UC(3," Default payload for this loop agent. Overridden at launch time if the first message contains a valid "),Is(4,"code"),UC(5,"AgentLoopPayload"),ml(),UC(6,". Leave empty if you always provide the payload at launch. "),ml()()),i&2){let e=fC(2);pg("error",e.loopConfigControl.invalid&&e.loopConfigControl.touched?"Invalid JSON \u2014 please fix the syntax.":null),KE(),pg("placeholder",e.loopConfigPlaceholder)("formControl",e.loopConfigControl),UI();}}function Mt(i,t){i&1&&UC(0," A platform config can only list platform agents here: a namespace's agents are resolved per namespace when the agent runs. ");}function Ft(i,t){if(i&1&&UC(0),i&2){let e=fC(3);jg(" That deletes ",e.droppedUnresolvedSubAgents()," flagged ",e.droppedUnresolvedSubAgents()===1?"selector":"selectors"," nothing matched, which this form cannot restore. ");}}function Rt(i,t){if(i&1&&(Is(0,"ds-notice",30),UC(1," Saving with this on replaces the selection below with "),Is(2,"code",29),UC(3,"*"),ml(),UC(4,". "),Qw(5,Ft,1,2),ml()),i&2){let e=fC(2);KE(5),Kw(e.droppedUnresolvedSubAgents()>0?5:-1);}}function Nt(i,t){i&1&&(Is(0,"ds-notice"),UC(1," The list of agents could not be loaded. What this agent already declares is listed below and preserved on save. "),ml());}function Dt(i,t){i&1&&(Is(0,"p",5),UC(1,"No other agent is available in this scope yet."),ml());}function Lt(i,t){i&1&&(Is(0,"span",48),UC(1,"pattern"),ml());}function Vt(i,t){i&1&&(Is(0,"span",48),UC(1,"via pattern"),ml());}function Pt(i,t){if(i&1&&(Is(0,"span",48),UC(1),ml()),i&2){let e=fC(4);KE(),Il(" ",e.subAgentCandidatesUnavailable()?"not verified":"no matching agent"," ");}}function Ot(i,t){if(i&1){let e=aC();Is(0,"button",59),Eg("click",function(){mf(e);let s=fC().$implicit,u=fC(3);return yf(u.removeSubAgent(s))}),UC(1," \xD7 "),ml();}if(i&2){let e=fC().$implicit;fg("aria-label","Remove "+e.selector);}}function Bt(i,t){if(i&1){let e=aC();Is(0,"div",36)(1,"label",57)(2,"input",55),Eg("change",function(){let s=mf(e).$implicit,u=fC(3);return yf(u.toggleSubAgent(s))}),ml(),Is(3,"span",28),UC(4),ml(),Qw(5,Lt,2,0,"span",48)(6,Vt,2,0,"span",48)(7,Pt,2,1,"span",48),ml(),Qw(8,Ot,2,1,"button",58),ml();}if(i&2){let e=t.$implicit,n=fC(3);KE(2),pg("checked",e.selected())("disabled",n.allSubAgentsSelected()),KE(2),Lg(e.name),KE(),Kw(e.pattern?5:e.grantedByPattern?6:e.unresolved?7:-1),KE(3),Kw(e.unresolved?8:-1);}}function $t(i,t){if(i&1&&eC(0,Bt,9,5,"div",36,ze),i&2){let e=fC(2);tC(e.subAgentRows());}}function Ut(i,t){if(i&1){let e=aC();Is(0,"div")(1,"button",60),Eg("click",function(){mf(e);let s=fC(2);return yf(s.useDefaultDelegationTimeout())}),UC(2," Use server default "),ml()();}}function Gt(i,t){i&1&&(Is(0,"ds-notice"),UC(1),ml()),i&2&&(KE(),Lg(t));}function jt(i,t){if(i&1){let e=aC();Is(0,"button",61),Eg("click",function(){mf(e);let s=fC(2);return yf(s.exportYaml())}),UC(1),ml();}if(i&2){let e=fC(2);pg("disabled",e.isExporting()),KE(),Il(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Kt(i,t){if(i&1){let e=aC();Is(0,"form",7),Eg("ngSubmit",function(){mf(e);let s=fC();return yf(s.submit())}),Is(1,"ds-fieldset",8)(2,"ds-form-field",9),hg(3,"input",10),VI(),ml(),Is(4,"div",11)(5,"label",12),hg(6,"input",13),VI(),UC(7," Enabled "),ml(),Is(8,"p",14),UC(9,"Disabled agents are excluded from namespace resolution."),ml()(),Is(10,"ds-form-field",15),hg(11,"input",16),VI(),ml(),Is(12,"ds-form-field",17),Qw(13,at,1,1,"input",18)(14,ut,6,5,"select",19),ml(),Is(15,"div",20)(16,"div",21)(17,"button",22),Eg("click",function(){mf(e);let s=fC();return yf(s.toggleInstructionsFullscreen())})("keydown.escape",function(){mf(e);let s=fC();return yf(s.closeInstructionsFullscreen())}),UC(18),ml()(),Is(19,"ds-form-field",23)(20,"textarea",24,0),Eg("keydown.escape",function(){mf(e);let s=fC();return yf(s.closeInstructionsFullscreen())}),ml(),VI(),ml()()(),Qw(22,ht,5,2,"ds-fieldset",25),Is(23,"ds-fieldset",26)(24,"p",5),UC(25," Instruction bundles this agent can read on demand. Selecting at least one grants it the "),Is(26,"code"),UC(27,"readSkill"),ml(),UC(28," and "),Is(29,"code"),UC(30,"readSkillResource"),ml(),UC(31," tools; selecting none grants neither. "),Qw(32,yt,1,0),ml(),Is(33,"label",12)(34,"input",27),Eg("change",function(){mf(e);let s=fC();return yf(s.toggleAllSkills())}),ml(),Is(35,"span",28),UC(36,"Every skill in the catalogue ("),Is(37,"code",29),UC(38,"*"),ml(),UC(39,")"),ml()(),Is(40,"p",14),UC(41," Resolved at run time, so skills added later are granted too, without editing this agent. "),ml(),Qw(42,xt,5,0,"ds-notice",30),Qw(43,vt,2,0,"ds-notice"),Qw(44,St,2,0,"p",5)(45,kt,2,0),ml(),Is(46,"ds-form-field",31)(47,"select",32)(48,"option",33),UC(49,"SIMPLE \u2014 Standard agent (single LLM call)"),ml(),Is(50,"option",33),UC(51,"ADVANCED \u2014 Multi-step reasoning loop"),ml(),Is(52,"option",33),UC(53,"LOOP \u2014 Bulk loop agent (no LLM, experimental)"),ml()(),VI(),ml(),Qw(54,It,7,3,"ds-form-field",34),Is(55,"ds-fieldset",35)(56,"p",5),UC(57," The agents this one may delegate to. Selecting at least one grants it the "),Is(58,"code"),UC(59,"DELEGATE__delegate"),ml(),UC(60," tool; selecting none grants it no way to delegate. Entries are matched against agent names, never ids. "),Qw(61,Mt,1,0),ml(),Is(62,"label",12)(63,"input",27),Eg("change",function(){mf(e);let s=fC();return yf(s.toggleAllSubAgents())}),ml(),Is(64,"span",28),UC(65,"Every agent it can reach ("),Is(66,"code",29),UC(67,"*"),ml(),UC(68,")"),ml()(),Is(69,"p",14),UC(70," Resolved at run time, so agents added later can be delegated to as well, without editing this agent. "),ml(),Qw(71,Rt,6,1,"ds-notice",30),Qw(72,Nt,2,0,"ds-notice"),Qw(73,Dt,2,0,"p",5)(74,$t,2,0),Is(75,"p",5),UC(76," Advanced \u2014 add a glob instead of picking a name, for example "),Is(77,"code"),UC(78,"*Fixer"),ml(),UC(79," to cover BugFixer and StoryFixer. "),ml(),Is(80,"div",36)(81,"input",37),Eg("keydown.enter",function(){mf(e);let s=fC();return yf(s.addSubAgent())}),ml(),VI(),Is(82,"button",38),Eg("click",function(){mf(e);let s=fC();return yf(s.addSubAgent())}),UC(83," + "),ml()(),Is(84,"ds-form-field",39),hg(85,"input",40),VI(),Qw(86,Ut,3,0,"div"),ml()(),Qw(87,Gt,2,1,"ds-notice"),Is(88,"ds-form-actions")(89,"button",41),UC(90),ml(),Qw(91,jt,2,2,"button",42),Is(92,"button",43),Eg("click",function(){mf(e);let s=fC();return yf(s.cancel())}),UC(93,"Cancel"),ml()()();}if(i&2){let e,n=fC();pg("formGroup",n.form),KE(3),pg("formControl",n.nameControl),UI(),KE(3),pg("formControl",n.enabledControl),UI(),KE(5),pg("formControl",n.descriptionControl),UI(),KE(2),Kw(n.modelAsFreeText()?13:14),KE(2),xg("agent-config-instructions--fullscreen",n.instructionsFullscreen()),KE(2),fg("aria-pressed",n.instructionsFullscreen()),KE(),Il(" ",n.instructionsFullscreen()?"Exit full screen":"Full screen"," "),KE(),pg("hint",n.instructionsCounter())("error",n.instructionsError()),KE(),pg("formControl",n.instructionsControl),fg("aria-invalid",n.instructionsControl.invalid),UI(),KE(2),Kw(n.integrationRows().length>0||n.builtInRows().length>0?22:-1),KE(10),Kw(n.isPlatformMode?32:-1),KE(2),pg("checked",n.allSkillsSelected()),KE(8),Kw(n.namedSkillSelectionDropped()?42:-1),KE(),Kw(n.skillCatalogueUnavailable()?43:-1),KE(),Kw(n.skillRows().length===0?44:45),KE(3),pg("formControl",n.executionModeControl),UI(),KE(),pg("value",n.ExecutionMode.SIMPLE),KE(2),pg("value",n.ExecutionMode.ADVANCED),KE(2),pg("value",n.ExecutionMode.LOOP),KE(2),Kw(n.isLoopMode()?54:-1),KE(7),Kw(n.isPlatformMode?61:-1),KE(2),pg("checked",n.allSubAgentsSelected()),KE(8),Kw(n.namedSubAgentSelectionDropped()?71:-1),KE(),Kw(n.subAgentCandidatesUnavailable()?72:-1),KE(),Kw(n.subAgentRows().length===0?73:74),KE(8),pg("formControl",n.newSubAgentControl),UI(),KE(),pg("disabled",!n.newSubAgentControl.value.trim()),KE(2),pg("hint",n.delegationTimeoutHint())("error",n.delegationTimeoutControl.invalid?"Enter a valid positive whole number of seconds, or leave empty to inherit the server default.":null),KE(),pg("formControl",n.delegationTimeoutControl),fg("aria-invalid",n.delegationTimeoutControl.invalid),UI(),KE(),Kw(n.delegationTimeoutControl.value!==null?86:-1),KE(),Kw((e=n.submitError())?87:-1,e),KE(2),pg("disabled",n.form.invalid||n.isSubmitting()),KE(),Il(" ",n.isEditMode()?"Save changes":"Create"," "),KE(),Kw(n.isEditMode()?91:-1);}}var z=2e4,qe=class i$1{route=g(W);router=g(F);destroyRef=g(we);agentConfigController=g(U);defaultsController=g(N);defaultDelegationTimeoutSeconds=zi(null);exportService=g(K$1);integrationConfigState=g(O);integrationTypeController=g(J);skillState=g(o);aiModelState=g(A);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt$1({name:new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te(null),modelName:new Te(null,{validators:[bn.required,i$1.notBlankValidator]}),instructions:new Te(null,{validators:[bn.maxLength(z)]}),executionMode:new Te("SIMPLE",{nonNullable:true}),delegationTimeoutSeconds:new Te(null,{validators:[bn.min(1),bn.max(2147483647),bn.pattern(/^\d+$/)]}),enabled:new Te(true,{nonNullable:true}),loopConfig:new Te(null,{validators:[i$1.jsonValidator]})});static notBlankValidator(t){let e=t.value;return typeof e=="string"&&e.length>0&&e.trim().length===0?{required:true}:null}static jsonValidator(t){let e=t.value?.trim();if(!e)return null;try{return JSON.parse(e),null}catch(n){return {invalidJson:true}}}get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get modelNameControl(){return this.form.controls.modelName}get instructionsControl(){return this.form.controls.instructions}get executionModeControl(){return this.form.controls.executionMode}get delegationTimeoutControl(){return this.form.controls.delegationTimeoutSeconds}useDefaultDelegationTimeout(){this.delegationTimeoutControl.setValue(null),this.delegationTimeoutControl.markAsDirty();}delegationTimeoutHint=yT(()=>{let t=this.defaultDelegationTimeoutSeconds();return `How long each delegation launched by this agent waits without activity from the sub-agent, including its own delegations. When it runs out, the sub-agent and its active descendants are stopped and can be resumed. Leave empty to use the server default${t!==null?`: ${t} s (${t/60} min)`:""}.`});get enabledControl(){return this.form.controls.enabled}get loopConfigControl(){return this.form.controls.loopConfig}executionModeValue=F$1(this.form.controls.executionMode.valueChanges,{initialValue:this.form.controls.executionMode.value});isLoopMode=yT(()=>this.executionModeValue()==="LOOP");static maxInstructionsLabel=z.toLocaleString("en-US");instructionsValue=F$1(this.form.controls.instructions.valueChanges,{initialValue:this.form.controls.instructions.value});instructionsLength=yT(()=>(this.instructionsValue()??"").length);instructionsCounter=yT(()=>`${this.instructionsLength().toLocaleString("en-US")} / ${i$1.maxInstructionsLabel} characters`);instructionsError=yT(()=>{let t=this.instructionsLength();return t<=z?null:`Instructions must not exceed ${i$1.maxInstructionsLabel} characters (currently ${t.toLocaleString("en-US")}).`});instructionsFullscreen=zi(false);instructionsTextarea=QB("instructionsTextarea");toggleInstructionsFullscreen(){this.instructionsFullscreen.update(t=>!t),this.instructionsTextarea()?.nativeElement.focus();}closeInstructionsFullscreen(){this.instructionsFullscreen()&&(this.instructionsFullscreen.set(false),this.instructionsTextarea()?.nativeElement.focus());}subAgentRows=zi([]);allSubAgentsSelected=zi(false);subAgentCandidatesUnavailable=zi(false);namedSubAgentSelectionDropped=yT(()=>this.allSubAgentsSelected()&&this.subAgentRows().some(t=>t.selected()));droppedUnresolvedSubAgents=yT(()=>this.allSubAgentsSelected()?this.subAgentRows().filter(t=>t.unresolved&&t.selected()).length:0);hasAnySubAgent=yT(()=>this.allSubAgentsSelected()||this.subAgentRows().some(t=>t.selected()));newSubAgentControl=new Te("",{nonNullable:true});isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);isExporting=zi(false);submitError=zi(null);ExecutionMode=Ne;loopConfigPlaceholder=JSON.stringify({search:{tool:"SearchTalents",params:{talentId:["6ac76692a909eaaae0b078d6"],resolveTargets:["MANAGER"],next:null}},act:{agentName:"ProfileCaretaker",promptTemplate:"This talent has not completed their profile. As their manager, I need you to help me review and improve it."}},null,2);builtInRows=zi([]);inspectRoute(){let t=this.route.snapshot.paramMap.get("agentConfigId")??"";return this.isPlatformMode?["/agentos","admin","agent-configs",t,"inspect"]:["/agentos",this.namespaceId,"agent-configs",t,"inspect"]}configAgentExposureWarning=yT(()=>Je({configEnabled:this.builtInRows().some(t=>t.type===We&&t.state()==="on"),integrationTypes:this.integrationRows().filter(t=>t.enabled()).map(t=>t.config.integrationType),hasSubAgents:this.hasAnySubAgent()}));modelOptions=zi({aliases:[],apiNames:[],current:null});modelCatalogueLoaded=zi(false);modelAsFreeText=yT(()=>{let{aliases:t,apiNames:e}=this.modelOptions();return this.modelCatalogueLoaded()&&t.length+e.length===0});applyModelCatalogue(t,e){this.modelOptions.set(E(t,e)),this.modelCatalogueLoaded.set(true);}integrationRows=zi([]);skillRows=zi([]);allSkillsSelected=zi(false);skillCatalogueUnavailable=zi(false);namedSkillSelectionDropped=yT(()=>this.allSkillsSelected()&&this.skillRows().some(t=>t.selected()));existingConfig=null;ngOnInit(){this.defaultsController.getAgentConfigDefaults().pipe(U$1(this.destroyRef),ga(()=>_r(null))).subscribe(e=>this.defaultDelegationTimeoutSeconds.set(e?.delegationTimeoutSeconds??null));let t=this.route.snapshot.paramMap.get("agentConfigId");t?(this.isEditMode.set(true),this.loadConfigAndIntegrations(t)):this.loadIntegrations(void 0);}loadConfigAndIntegrations(t){this.isLoading.set(true),Ny({config:this.agentConfigController.getByIdAgentConfig(t),namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):_r([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes(),skillCatalogue:this.loadSkillCatalogue(),delegationCandidates:this.loadDelegationCandidates(),models:this.aiModelState.listAvailable(this.namespaceId)}).pipe(U$1(this.destroyRef)).subscribe({next:({config:e,namespaceIntegrations:n,platformIntegrations:s,builtInTypes:u,skillCatalogue:C,delegationCandidates:T,models:k})=>{this.existingConfig=e,this.applyModelCatalogue(k,e.modelName??null),this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.modelNameControl.setValue(e.modelName??null),this.instructionsControl.setValue(e.instructions??null);let f=e.executionMode??(e.advancedExecution?"ADVANCED":"SIMPLE");this.executionModeControl.setValue(f),this.delegationTimeoutControl.setValue(e.delegationTimeoutSeconds??null),this.enabledControl.setValue(e.enabled??true),this.loopConfigControl.setValue(e.loopConfig!=null?JSON.stringify(e.loopConfig,null,2):null);let L=[...s,...n];this.integrationRows.set(this.buildIntegrationRows(L,e.integrations??void 0)),this.builtInRows.set(this.buildBuiltInRows(u,e.integrations??void 0)),this.allSubAgentsSelected.set(Ke(e.subAgents)),this.subAgentRows.set(this.buildSubAgentRows(T,e.subAgents,e.name)),this.allSkillsSelected.set(o$1(e.skillSelectors)),this.skillRows.set(this.buildSkillRows(C,e.skillSelectors)),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadIntegrations(t){Ny({namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):_r([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes(),skillCatalogue:this.loadSkillCatalogue(),delegationCandidates:this.loadDelegationCandidates(),models:this.aiModelState.listAvailable(this.namespaceId)}).pipe(U$1(this.destroyRef)).subscribe({next:({namespaceIntegrations:e,platformIntegrations:n,builtInTypes:s,skillCatalogue:u,delegationCandidates:C,models:T})=>{this.applyModelCatalogue(T,null);let k=[...n,...e];this.integrationRows.set(this.buildIntegrationRows(k,t??void 0)),this.builtInRows.set(this.buildBuiltInRows(s,t??void 0)),this.allSubAgentsSelected.set(false),this.subAgentRows.set(this.buildSubAgentRows(C,void 0,null)),this.allSkillsSelected.set(false),this.skillRows.set(this.buildSkillRows(u,void 0));}});}loadSkillCatalogue(){return (this.namespaceId?this.skillState.listEffective(this.namespaceId):this.skillState.listPlatform().pipe(ne(e=>e.map(n=>({id:n.id??"",name:n.name,description:n.description,namespaceId:n.namespaceId??null,readOnly:n.readOnly===true}))))).pipe(ga(e=>(console.error("[agent-config-form] failed to load the skill catalogue",e),this.skillCatalogueUnavailable.set(true),_r([]))))}buildSkillRows(t,e){let s=(e??[]).map(f=>f.trim()).filter(f=>f.length>0).filter(f=>f!==r),u=i(s),C=new Set(t.map(f=>f.name.toLowerCase())),T=t.map(f=>({selector:f.name,name:f.name,description:f.description,platform:f.namespaceId==null,unresolved:false,selected:zi(u.has(f.name.toLowerCase()))})),k=new Set;for(let f of s){let L=l(f).toLowerCase();C.has(L)||k.has(L)||(k.add(L),T.push({selector:f,name:f,description:"",platform:false,unresolved:true,selected:zi(true)}));}return T}toggleSkill(t){t.selected.update(e=>!e);}toggleAllSkills(){this.allSkillsSelected.update(t=>!t);}buildSkillSelectorsPayload(){if(this.allSkillsSelected())return [r];let t=this.skillRows().filter(e=>e.selected()).map(e=>e.selector);return t.length>0?t:void 0}loadDelegationCandidates(){let t=this.agentConfigController.listPlatformAgentsAgentConfig(false).pipe(this.orNoCandidates()),e=this.namespaceId?this.agentConfigController.listByParentAgentConfig(this.namespaceId,false).pipe(this.orNoCandidates()):_r([]);return Ny({platform:t,namespace:e}).pipe(ne(({platform:n,namespace:s})=>[...n,...s]),ne(n=>n.map(s=>s.name).filter(s=>s.length>0)),ne(n=>i$1.dedupeByKey(n)))}orNoCandidates(){return ga(t=>(console.error("[agent-config-form] failed to load the delegation candidates",t),this.subAgentCandidatesUnavailable.set(true),_r([])))}static dedupeByKey(t){let e=new Set;return t.filter(n=>{let s=n.toLowerCase();return e.has(s)?false:(e.add(s),true)})}buildSubAgentRows(t,e,n){let s=He(e),u=n?.toLowerCase()??null,C=t.filter(_=>{let B=_.toLowerCase();return B!==u||s.has(B)}),T=new Set(C.map(_=>_.toLowerCase())),k=C.map(_=>({selector:_,name:_,unresolved:false,pattern:false,grantedByPattern:Y(_,e),selected:zi(s.has(_.toLowerCase()))})),f=new Set,L=(e??[]).map(_=>_.trim()).filter(_=>_.length>0&&_!==D);for(let _ of L){let B=_.toLowerCase();T.has(B)||f.has(B)||(f.add(B),k.push({selector:_,name:_,unresolved:true,pattern:K(_),grantedByPattern:false,selected:zi(true)}));}return k}loadBuiltInTypes(){return this.integrationTypeController.listTypesIntegrationType().pipe(ne(t=>t.filter(e=>!e.configSchema)),ga(t=>(console.error("[agent-config-form] failed to load integration types",t),_r([]))))}buildIntegrationRows(t,e){return t.map(n=>{let s=n.name??"",u=e?.[s],C=e!=null&&s in e,T=Array.isArray(u)?u.join(", "):"";return {config:n,enabled:zi(C),toolsControl:new Te(T,{nonNullable:true})}})}buildBuiltInRows(t,e){return t.map(n=>{let s=e!=null&&n.type in e,u=e?.[n.type],C=s?Array.isArray(u)&&u.length===0?"off":"on":"default";return {type:n.type,displayName:n.displayName,description:n.description,enabledByDefault:n.enabledByDefault===true,state:zi(C),restrictedTools:Array.isArray(u)&&u.length>0?u:null}})}toggleIntegration(t){t.enabled.update(e=>!e);}setBuiltInState(t,e){t.state.set(e);}builtInDefaultLabel(t){return t.enabledByDefault?"Platform default (enabled)":"Platform default (disabled)"}addSubAgent(){let t=this.newSubAgentControl.value.trim();if(!t)return;let e=this.subAgentRows().find(n=>n.selector.toLowerCase()===t.toLowerCase());e?e.selected.set(true):t===D?this.allSubAgentsSelected.set(true):this.subAgentRows.update(n=>this.withPatternGrants([...n,{selector:t,name:t,unresolved:true,pattern:K(t),grantedByPattern:false,selected:zi(true)}])),this.newSubAgentControl.reset("");}removeSubAgent(t){let e=t.selector.toLowerCase();this.subAgentRows.update(n=>this.withPatternGrants(n.filter(s=>s.selector.toLowerCase()!==e)));}toggleSubAgent(t){t.selected.update(e=>!e),t.pattern&&this.subAgentRows.update(e=>this.withPatternGrants(e));}withPatternGrants(t){let e=this.allSubAgentsSelected()?[]:t.filter(n=>n.selected()).map(n=>n.selector);return t.map(n=>n.unresolved?n:x(w({},n),{grantedByPattern:Y(n.name,e)}))}toggleAllSubAgents(){this.allSubAgentsSelected.update(t=>!t),this.subAgentRows.update(t=>this.withPatternGrants(t));}buildSubAgentsPayload(){if(this.allSubAgentsSelected())return [D];let t=this.subAgentRows().filter(e=>e.selected()).map(e=>e.selector);return t.length>0?t:void 0}buildIntegrationsPayload(){let t={};for(let n of this.integrationRows().filter(s=>s.enabled())){let s=n.config.name??"",u=n.toolsControl.value.trim();t[s]=u===""?null:u.split(",").map(C=>C.trim()).filter(C=>C.length>0);}for(let n of this.builtInRows()){let s=n.state();s==="on"?t[n.type]=n.restrictedTools??null:s==="off"&&(t[n.type]=[]);}let e=new Set([...this.integrationRows().map(n=>n.config.name??""),...this.builtInRows().map(n=>n.type)]);for(let[n,s]of Object.entries(this.existingConfig?.integrations??{}))e.has(n)||(t[n]=s);return Object.keys(t).length>0?t:void 0}submit(){if(this.form.invalid||this.isSubmitting())return;this.addSubAgent(),this.submitError.set(null),this.isSubmitting.set(true);let t=x(w({},this.existingConfig??{}),{createdOn:this.existingConfig?.createdOn,updatedOn:this.existingConfig?.updatedOn,namespaceId:this.namespaceId,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,modelName:this.modelNameControl.value?.trim()||void 0,instructions:this.instructionsControl.value?.trim()||void 0,integrations:this.buildIntegrationsPayload(),executionMode:this.executionModeControl.value,advancedExecution:this.executionModeControl.value==="ADVANCED",enabled:this.enabledControl.value,subAgents:this.buildSubAgentsPayload(),skillSelectors:this.buildSkillSelectorsPayload(),delegationTimeoutSeconds:this.delegationTimeoutControl.value,loopConfig:this.buildLoopConfigPayload()});(this.isEditMode()?this.agentConfigController.updateAgentConfig(this.existingConfig.id??"",t):this.agentConfigController.createAgentConfig(t)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:n=>{this.isSubmitting.set(false),this.submitError.set(i$1.serverMessage(n));}});}static serverMessage(t){let n=t?.error?.message;if(typeof n=="string"&&n.trim().length>0)return n;let s=t?.status;return s===0?"The server could not be reached. The agent was not saved.":typeof s=="number"&&s>=500?`The server failed to save the agent (HTTP ${s}). Nothing was changed.`:"The server refused the save and gave no reason. Check the values and try again."}exportYaml(){let t=this.existingConfig?.id;!t||this.isExporting()||(this.isExporting.set(true),this.exportService.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let n=new Blob([e],{type:"application/yaml"}),s=URL.createObjectURL(n),u=document.createElement("a");u.href=s,u.download=`${this.existingConfig?.name??"agent"}.yaml`,u.click(),URL.revokeObjectURL(s),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}buildLoopConfigPayload(){let t=this.loopConfigControl.value?.trim();if(!t)return this.existingConfig?.loopConfig!=null?null:void 0;try{return JSON.parse(t)}catch(e){return}}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||i$1)};static \u0275cmp=xw({type:i$1,selectors:[["agentos-agent-config-form"]],viewQuery:function(e,n){e&1&&Sg(n.instructionsTextarea,Ze,5),e&2&&DC();},decls:8,vars:4,consts:[["instructionsTextarea",""],[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to agent configs",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"],["legend","Agent"],["label","Name","controlId","agent-config-name","required",""],["dsControl","","id","agent-config-name","type","text","placeholder","e.g. Support agent","autocomplete","off",3,"formControl"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","Description","controlId","agent-config-description"],["dsControl","","id","agent-config-description","type","text","placeholder","Optional \u2014 short description of this agent","autocomplete","off",3,"formControl"],["label","Model","controlId","agent-config-model-name","required","","hint","Aliases are matched first, then API model names. Resolved when the agent runs."],["dsControl","","id","agent-config-model-name","type","text","placeholder","Model alias or name to use, e.g. BIG","autocomplete","off",3,"formControl"],["dsControl","","id","agent-config-model-name",3,"formControl"],[1,"agent-config-instructions"],[1,"agent-config-instructions__toolbar"],["dsButton","","variant","ghost","type","button",3,"click","keydown.escape"],["label","Instructions","controlId","agent-config-instructions","hintId","agent-config-instructions-hint","errorId","agent-config-instructions-error",3,"hint","error"],["dsControl","","id","agent-config-instructions","rows","20","placeholder","Optional \u2014 system instructions for this agent","aria-describedby","agent-config-instructions-hint agent-config-instructions-error",3,"keydown.escape","formControl"],["legend","Integrations","hint","Select which integrations this agent can use. Leave tool names empty to allow all tools from an integration."],["legend","Skills"],["type","checkbox",3,"change","checked"],[1,"ds-strong"],[1,"ds-code"],["tone","warning"],["label","Execution mode","controlId","agent-config-execution-mode","hint",'SIMPLE runs a single LLM pass. ADVANCED uses an intention loop for complex tasks and requires a model that supports advanced execution, otherwise the agent fails to run. LOOP (experimental) starts one case per result of a tool, without an LLM \u2014 run it with "Launch loop" in the agent list menu.'],["dsControl","","id","agent-config-execution-mode",3,"formControl"],[3,"value"],["label","Loop configuration (JSON)","controlId","agent-config-loop-config",3,"error"],["legend","Sub-agents"],[1,"ds-inline"],["dsControl","","type","text","aria-label","New sub-agent pattern","placeholder","e.g. *Fixer","autocomplete","off",3,"keydown.enter","formControl"],["dsButton","","variant","icon","type","button","title","Add pattern","aria-label","Add pattern",3,"click","disabled"],["label","Delegation timeout (seconds)","controlId","delegation-timeout","hintId","delegation-timeout-hint","errorId","delegation-timeout-error",3,"hint","error"],["dsControl","","id","delegation-timeout","type","number","min","1","max","2147483647","step","1","placeholder","Server default","aria-describedby","delegation-timeout-hint delegation-timeout-error",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["disabled","",3,"ngValue"],[3,"ngValue"],["label","Aliases"],["label","API model names"],[1,"ds-meta"],["dsControl","","type","text","placeholder","Tool names, comma-separated (empty = all tools)","autocomplete","off",1,"ds-indent",3,"formControl"],[1,"ds-micro"],["dsControl","",1,"ds-indent","ds-control--auto",3,"change","id","value"],["value","default"],["value","on"],["value","off"],["type","checkbox",3,"change","checked","disabled"],["dsControl","","mono","","id","agent-config-loop-config","rows","10","spellcheck","false","autocomplete","off",3,"placeholder","formControl"],["dsCheck","",1,"ds-grow"],["dsButton","","variant","icon-danger","type","button","title","Remove"],["dsButton","","variant","icon-danger","type","button","title","Remove",3,"click"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,n){e&1&&(Is(0,"ds-page")(1,"ds-section-header",1)(2,"button",2),Eg("click",function(){return n.cancel()}),UC(3," \u2190 Agent configs "),ml(),Qw(4,nt,2,1,"a",3),Qw(5,it,2,0,"ds-tag",4),ml(),Qw(6,ot,2,0,"p",5)(7,Kt,94,40,"form",6),ml()),e&2&&(KE(),pg("title",n.isEditMode()?"Edit agent config":"New agent config"),KE(3),Kw(n.isEditMode()?4:-1),KE(),Kw(n.isPlatformMode?5:-1),KE(),Kw(n.isLoading()?6:7));},dependencies:[Kt$1,fd,Mo,Do,Ut$1,Pn,Mn,Qt,fo,go,ta,Zr,Nn,Rn,$t$1,vn,yn,fn,pn,hn,_n,at$1,un,cn,Ao],styles:[".agent-config-instructions[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.25rem;min-width:0}.agent-config-instructions[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%]{min-height:24rem}.agent-config-instructions__toolbar[_ngcontent-%COMP%]{display:flex;justify-content:flex-end}.agent-config-instructions--fullscreen[_ngcontent-%COMP%]{position:fixed;inset:0;z-index:1000;box-sizing:border-box;padding:1.5rem;background:var(--color-bg, #fff)}.agent-config-instructions--fullscreen[_ngcontent-%COMP%] ds-form-field[_ngcontent-%COMP%]{flex:1;min-height:0}.agent-config-instructions--fullscreen[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%]{flex:1;min-height:0;resize:none}@media(max-width:760px){.agent-config-instructions--fullscreen[_ngcontent-%COMP%]{padding:.75rem}}"]})};export{qe as AgentConfigFormComponent,z as MAX_INSTRUCTIONS_LENGTH};
@@ -1 +0,0 @@
1
- import {p as pt,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,K as Kt,a as fd,M as Mo,D as Do,U as Ut,P as Pn,o as Mn,Q as Qt,c as fo,g as go,t as ta,Z as Zr,N as Nn,R as Rn,E as Ea}from'./chunk-B5p0JRDM.js';import {g,W,F,J as we,at as F$1,as as k,ab as F$2,a2 as ga,ac as _r,au as We,k as yT,z as zi,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,a as hg,T as VI,l as eC,ar as Jw,r as fC,X as UI,t as tC,q as Il,ag as Zw,L as Lg,a5 as jg,u as mf,w as yf}from'./main-TMKGPCQB.js';function he(r,t){r&1&&(Is(0,"p",2),UC(1,"Loading\u2026"),ml());}function ve(r,t){if(r&1&&hg(0,"input",6),r&2){let e=fC(2);pg("value",e.selectedProviderLabel());}}function ye(r,t){if(r&1&&(Is(0,"option",44),UC(1),ml()),r&2){let e=t.$implicit;pg("value",e.id),KE(),jg("",e.name," (",e.apiType,")");}}function be(r,t){if(r&1&&(Is(0,"select",7)(1,"option",43),UC(2,"Select provider"),ml(),eC(3,ye,2,3,"option",44,Zw().trackByProvider,true),ml(),VI()),r&2){let e=fC(2);pg("formControl",e.aiProviderIdControl),UI(),KE(3),tC(e.providers());}}function xe(r,t){if(r&1&&(Is(0,"option",25),UC(1),ml()),r&2){let e=t.$implicit;pg("ngValue",e),KE(),Lg(e.toLowerCase());}}function _e(r,t){r&1&&(Is(0,"p",2),UC(1,"Not supported yet for Anthropic and Gemini providers."),ml());}function Me(r,t){r&1&&(Is(0,"p",2),UC(1," Sent as is to OpenAI-compatible providers, which reject levels the model does not support. Through Requesty, Claude models do not apply it faithfully. "),ml());}function Ee(r,t){r&1&&(Is(0,"p",26),UC(1," OpenAI reasoning models (GPT-5.1 and later) reject a temperature other than 1 with an effort: leave Temperature empty or set it to 1. "),ml());}function Ae(r,t){if(r&1){let e=aC();Is(0,"form",4),Eg("ngSubmit",function(){mf(e);let u=fC();return yf(u.submit())}),Is(1,"ds-form-field",5),Qw(2,ve,1,1,"input",6)(3,be,5,1,"select",7),ml(),Is(4,"ds-form-field",8),hg(5,"input",9),VI(),ml(),Is(6,"ds-form-field",10),hg(7,"input",11),VI(),ml(),Is(8,"ds-form-field",12),hg(9,"input",13),VI(),ml(),Is(10,"ds-form-field",14),hg(11,"input",15),VI(),ml(),Is(12,"div",16)(13,"ds-form-field",17),hg(14,"input",18),VI(),ml(),Is(15,"ds-form-field",19),hg(16,"input",20),VI(),ml()(),Is(17,"ds-form-field",21),hg(18,"input",22),VI(),ml(),Is(19,"ds-form-field",23)(20,"select",24)(21,"option",25),UC(22,"Provider default"),ml(),eC(23,xe,2,2,"option",25,Jw),ml(),VI(),Qw(25,_e,2,0,"p",2)(26,Me,2,0,"p",2),Qw(27,Ee,2,0,"p",26),ml(),Is(28,"div",27)(29,"label",28),hg(30,"input",29),VI(),Is(31,"span",30),UC(32,"Supports advanced execution"),ml()(),Is(33,"p",31),UC(34," Agents configured in ADVANCED execution mode fail to run on a model that does not support it. SIMPLE agents are not concerned. "),ml()(),Is(35,"ds-fieldset",32)(36,"div",16)(37,"ds-form-field",33),hg(38,"input",34),VI(),ml(),Is(39,"ds-form-field",35),hg(40,"input",36),VI(),ml()(),Is(41,"div",16)(42,"ds-form-field",37),hg(43,"input",38),VI(),ml(),Is(44,"ds-form-field",39),hg(45,"input",40),VI(),ml()()(),Is(46,"ds-form-actions")(47,"button",41),UC(48),ml(),Is(49,"button",42),Eg("click",function(){mf(e);let u=fC();return yf(u.cancel())}),UC(50,"Cancel"),ml()()();}if(r&2){let e=fC();pg("formGroup",e.form),KE(2),Kw(e.isEditMode()?2:3),KE(3),pg("formControl",e.apiModelNameControl),UI(),KE(2),pg("formControl",e.descriptionControl),UI(),KE(2),pg("formControl",e.aliasControl),UI(),KE(2),pg("formControl",e.priorityControl),UI(),KE(3),pg("formControl",e.temperatureControl),UI(),KE(2),pg("formControl",e.contextWindowControl),UI(),KE(2),pg("formControl",e.maxCompletionTokensControl),UI(),KE(2),pg("formControl",e.reasoningEffortControl),UI(),KE(),pg("ngValue",null),KE(2),tC(e.reasoningEffortOptions),KE(2),Kw(e.reasoningEffortUnsupported()?25:26),KE(2),Kw(e.temperatureMayConflictWithEffort()?27:-1),KE(3),pg("formControl",e.supportsAdvancedExecutionControl),UI(),KE(5),pg("formGroup",e.pricingGroup),KE(3),UI(),KE(2),UI(),KE(3),UI(),KE(2),UI(),KE(2),pg("disabled",e.form.invalid||e.isSubmitting()),KE(),Il(" ",e.isEditMode()?"Save changes":"Create"," ");}}var Ie=["Anthropic","Gemini"],ge=class r{route=g(W);router=g(F);destroyRef=g(we);aiModelController=g(F$1);aiProviderController=g(k);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;providers=F$2(this.aiProviderController.listAiProvider(this.isPlatformMode?"none":this.namespaceId).pipe(ga(()=>_r([]))),{initialValue:[]});form=new pt({aiProviderId:new Te("",{nonNullable:true,validators:[bn.required]}),apiModelName:new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te(null),alias:new Te("",{nonNullable:true}),priority:new Te(0,{nonNullable:true}),temperature:new Te(null),contextWindow:new Te(null),maxCompletionTokens:new Te(null),reasoningEffort:new Te(null),supportsAdvancedExecution:new Te(false,{nonNullable:true}),pricing:new pt({inputMTokens:new Te(null),outputMTokens:new Te(null),cacheWrite:new Te(null),cacheRead:new Te(null)})});get aiProviderIdControl(){return this.form.controls.aiProviderId}get apiModelNameControl(){return this.form.controls.apiModelName}get descriptionControl(){return this.form.controls.description}get aliasControl(){return this.form.controls.alias}get priorityControl(){return this.form.controls.priority}get temperatureControl(){return this.form.controls.temperature}get contextWindowControl(){return this.form.controls.contextWindow}get maxCompletionTokensControl(){return this.form.controls.maxCompletionTokens}get reasoningEffortControl(){return this.form.controls.reasoningEffort}get supportsAdvancedExecutionControl(){return this.form.controls.supportsAdvancedExecution}get pricingGroup(){return this.form.controls.pricing}reasoningEffortOptions=Object.values(We);selectedProviderId=F$2(this.form.controls.aiProviderId.valueChanges,{initialValue:this.form.controls.aiProviderId.value});reasoningEffortUnsupported=yT(()=>{let t=this.providers().find(e=>e.id===this.selectedProviderId())?.apiType;return t!==void 0&&Ie.includes(t)});temperatureValue=F$2(this.form.controls.temperature.valueChanges,{initialValue:this.form.controls.temperature.value});reasoningEffortValue=F$2(this.form.controls.reasoningEffort.valueChanges,{initialValue:this.form.controls.reasoningEffort.value});temperatureMayConflictWithEffort=yT(()=>{let t=this.temperatureValue();return this.reasoningEffortValue()!=null&&t!=null&&t!==1});isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);selectedProviderLabel=yT(()=>{let t=this.aiProviderIdControl.value,e=this.providers().find(c=>c.id===t);return e?`${e.name} (${e.apiType})`:t});existingModel=null;constructor(){Ff(()=>{this.reasoningEffortUnsupported()?(this.reasoningEffortControl.setValue(null),this.reasoningEffortControl.disable()):this.reasoningEffortControl.enable();});}ngOnInit(){let t=this.route.snapshot.paramMap.get("modelId");t&&(this.isEditMode.set(true),this.loadModel(t));}loadModel(t){this.isLoading.set(true),this.aiModelController.getByIdAiModel(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingModel=e,this.aiProviderIdControl.setValue(e.aiProviderId),this.aiProviderIdControl.disable(),this.apiModelNameControl.setValue(e.apiModelName),this.descriptionControl.setValue(e.description??null),this.aliasControl.setValue(e.alias??""),this.priorityControl.setValue(e.priority??0),this.temperatureControl.setValue(e.temperature??null),this.contextWindowControl.setValue(e.contextWindow??null),this.maxCompletionTokensControl.setValue(e.maxCompletionTokens??null),this.reasoningEffortControl.setValue(e.reasoningEffort??null),this.supportsAdvancedExecutionControl.setValue(e.supportsAdvancedExecution??false),this.pricingGroup.setValue({inputMTokens:e.pricing?.inputMTokens??null,outputMTokens:e.pricing?.outputMTokens??null,cacheWrite:e.pricing?.cacheWrite??null,cacheRead:e.pricing?.cacheRead??null}),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.form.getRawValue(),e=t.pricing,u=e.inputMTokens!=null||e.outputMTokens!=null||e.cacheWrite!=null||e.cacheRead!=null?{isEmpty:false,inputMTokens:e.inputMTokens??void 0,outputMTokens:e.outputMTokens??void 0,cacheWrite:e.cacheWrite??void 0,cacheRead:e.cacheRead??void 0}:void 0,w$1=x(w({},this.existingModel??{}),{aiProviderId:t.aiProviderId,namespaceId:this.isPlatformMode?void 0:this.existingModel?.namespaceId??this.namespaceId,apiModelName:t.apiModelName.trim(),description:t.description?.trim()||void 0,alias:t.alias.trim()||void 0,priority:t.priority,temperature:t.temperature??void 0,contextWindow:t.contextWindow??void 0,maxCompletionTokens:t.maxCompletionTokens??void 0,reasoningEffort:t.reasoningEffort??void 0,supportsAdvancedExecution:t.supportsAdvancedExecution,pricing:u});(this.isEditMode()?this.aiModelController.updateAiModel(this.existingModel.id??"",w$1):this.aiModelController.createAiModel(w$1)).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-models"]):this.router.navigate(["/agentos",this.namespaceId,"ai-models"]);}trackByProvider(t,e){return e.id??""}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=xw({type:r,selectors:[["agentos-ai-model-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to AI models",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Provider","controlId","model-provider","required",""],["dsControl","","id","model-provider","type","text","readonly","","tabindex","-1",3,"value"],["dsControl","","id","model-provider",3,"formControl"],["label","API name","controlId","model-api-name","required",""],["dsControl","","mono","","id","model-api-name","type","text","placeholder","e.g. gpt-4o, claude-3-5-sonnet-20241022","autocomplete","off",3,"formControl"],["label","Description","controlId","model-description"],["dsControl","","id","model-description","type","text","placeholder","Optional \u2014 short description of this model config","autocomplete","off",3,"formControl"],["label","Alias","controlId","model-alias"],["dsControl","","id","model-alias","type","text","placeholder","e.g. fast, smart \u2014 short identifier used internally","autocomplete","off",3,"formControl"],["label","Priority","controlId","model-priority"],["dsControl","","id","model-priority","type","number","placeholder","0 \u2014 higher wins when multiple configs share the same alias","min","0","step","1",3,"formControl"],[1,"ds-grid-2"],["label","Temperature","controlId","model-temperature"],["dsControl","","id","model-temperature","type","number","placeholder","0 \u2013 2","min","0","max","2","step","0.1",3,"formControl"],["label","Context window","controlId","model-context-window"],["dsControl","","id","model-context-window","type","number","placeholder","e.g. 128000","min","1","step","1",3,"formControl"],["label","Max completion tokens","controlId","model-max-completion-tokens"],["dsControl","","id","model-max-completion-tokens","type","number","placeholder","e.g. 4096","min","1","step","1",3,"formControl"],["label","Reasoning effort","controlId","model-reasoning-effort"],["dsControl","","id","model-reasoning-effort",3,"formControl"],[3,"ngValue"],[1,"ds-hint","ds-hint--warning"],[1,"ai-model-form__field"],[1,"ai-model-form__toggle-label"],["type","checkbox",1,"ai-model-form__toggle-checkbox",3,"formControl"],[1,"ai-model-form__toggle-text"],[1,"ai-model-form__toggle-hint"],["legend","Pricing","legendHint","per million tokens \u2014 leave blank to skip cost monitoring",3,"formGroup"],["label","Input","controlId","pricing-input"],["dsControl","","id","pricing-input","type","number","placeholder","e.g. 2.50","min","0","step","0.01","formControlName","inputMTokens"],["label","Output","controlId","pricing-output"],["dsControl","","id","pricing-output","type","number","placeholder","e.g. 10.00","min","0","step","0.01","formControlName","outputMTokens"],["label","Cache write","controlId","pricing-cache-write"],["dsControl","","id","pricing-cache-write","type","number","placeholder","e.g. 3.75","min","0","step","0.01","formControlName","cacheWrite"],["label","Cache read","controlId","pricing-cache-read"],["dsControl","","id","pricing-cache-read","type","number","placeholder","e.g. 0.30","min","0","step","0.01","formControlName","cacheRead"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["value","","disabled",""],[3,"value"]],template:function(e,c){e&1&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return c.cancel()}),UC(3," \u2190 AI models "),ml()(),Qw(4,he,2,0,"p",2)(5,Ae,51,17,"form",3),ml()),e&2&&(KE(),pg("title",c.isEditMode()?"Edit AI model":"New AI model"),KE(3),Kw(c.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,at,un,Kt,fd,Mo,Do,Ut,Pn,Mn,Qt,fo,go,ta,Zr,Nn,Rn,Ea],encapsulation:2})};export{ge as AiModelFormComponent};
@@ -1 +0,0 @@
1
- import {I}from'./chunk-AhABNqjK.js';import {O}from'./chunk-BavZR8IQ.js';import {v}from'./chunk-DkyYa4dP.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-TMKGPCQB.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-B5p0JRDM.js';import'./chunk-aP6s6v6i.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 +0,0 @@
1
- import {a1 as ma,a2 as ga,ac as _r,aH as Jy}from'./main-TMKGPCQB.js';function i(t,o,p){return t.pipe(ma(()=>o().pipe(ga(()=>_r(p)))),Jy({bufferSize:1,refCount:true}))}export{i};