@whoz-oss/coday-client 0.0.0-workstream-forge.138 → 0.0.0-workstream-forge.140

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 (59) hide show
  1. package/browser/{chunk-6kWS1PKC.js → chunk-1sx-9Z9O.js} +1 -1
  2. package/browser/chunk-9rCCQKbG.js +1 -0
  3. package/browser/{chunk-BVOcWKcm.js → chunk-B1oZLvYo.js} +1 -1
  4. package/browser/{chunk-CCPzQvRS.js → chunk-BA83JJVN.js} +1 -1
  5. package/browser/{chunk-ClQMX6bw.js → chunk-B_smRVhE.js} +1 -1
  6. package/browser/{chunk-D-8GVHj3.js → chunk-Bifk5UQz.js} +1 -1
  7. package/browser/{chunk-B4Q_0g-_.js → chunk-Bj1nkbC_.js} +1 -1
  8. package/browser/{chunk-bxHREu_g.js → chunk-BjOaUfwg.js} +1 -1
  9. package/browser/{chunk-7EDhMjxV.js → chunk-Brs6LzdA.js} +1 -1
  10. package/browser/{chunk-CCPF4zpr.js → chunk-C-2d7P1K.js} +1 -1
  11. package/browser/chunk-C-LRWCHD.js +1 -0
  12. package/browser/chunk-C4x-IssO.js +1 -0
  13. package/browser/chunk-CLlhcPBC.js +1 -0
  14. package/browser/{chunk-rnKKv5g9.js → chunk-CNvZR2y8.js} +1 -1
  15. package/browser/{chunk-OqGh4aos.js → chunk-CQjTWi6b.js} +1 -1
  16. package/browser/{chunk-CcsUcQox.js → chunk-CRjIGo4M.js} +1 -1
  17. package/browser/{chunk-CVfmLw44.js → chunk-CRyAV14Q.js} +1 -1
  18. package/browser/{chunk-BaCpXzDJ.js → chunk-CWBypdCc.js} +1 -1
  19. package/browser/{chunk-zkmCarCb.js → chunk-Cdyh12u6.js} +1 -1
  20. package/browser/{chunk-BT2woRcT.js → chunk-CfUdNGtm.js} +1 -1
  21. package/browser/{chunk-BZREGKOc.js → chunk-CfnGpLDM.js} +1 -1
  22. package/browser/{chunk-BYL05SsW.js → chunk-ClIWAAgy.js} +1 -1
  23. package/browser/{chunk-C3JOi0i0.js → chunk-Cs6sLGRk.js} +1 -1
  24. package/browser/{chunk-FeSXFPLM.js → chunk-CwrNimvr.js} +1 -1
  25. package/browser/chunk-Czd3dRvO.js +1 -0
  26. package/browser/{chunk-DrDV_l0f.js → chunk-D6-kqpoj.js} +1 -1
  27. package/browser/{chunk-5ODubWrb.js → chunk-D71cjRVb.js} +1 -1
  28. package/browser/{chunk-ZTumpdaw.js → chunk-DKj7xyAl.js} +1 -1
  29. package/browser/{chunk-hl_Gv2mE.js → chunk-DPwIOZ78.js} +1 -1
  30. package/browser/{chunk-DerJId7r.js → chunk-DQOKbLAz.js} +1 -1
  31. package/browser/chunk-DSVQ7s9Y.js +1 -0
  32. package/browser/{chunk-BEMVRmeG.js → chunk-DaxcKFzm.js} +4 -4
  33. package/browser/{chunk-BGMKyXoF.js → chunk-DbHoCmh3.js} +1 -1
  34. package/browser/chunk-Dd6KfLsM.js +1 -0
  35. package/browser/{chunk-CzFnZmcR.js → chunk-Dj9m1vIF.js} +1 -1
  36. package/browser/chunk-DstphnMf.js +1 -0
  37. package/browser/chunk-DxliN0E7.js +1 -0
  38. package/browser/chunk-P4wpNoAC.js +1 -0
  39. package/browser/chunk-W_pCCl79.js +1 -0
  40. package/browser/chunk-WvMIqBRM.js +1 -0
  41. package/browser/{chunk-BrXPglDw.js → chunk-dLi7RUdr.js} +1 -1
  42. package/browser/{chunk-B2dk_vmo.js → chunk-gvU-Gwhh.js} +1 -1
  43. package/browser/{chunk-oNzbGo7J.js → chunk-huytiog9.js} +1 -1
  44. package/browser/{chunk-oPG6SPli.js → chunk-jDmyV-gc.js} +1 -1
  45. package/browser/index.html +1 -1
  46. package/browser/{main-NXEJVT36.js → main-NRMJZZ5V.js} +1 -1
  47. package/package.json +1 -1
  48. package/browser/chunk-BLSh2_0D.js +0 -1
  49. package/browser/chunk-B__5UOxD.js +0 -1
  50. package/browser/chunk-BeXKfCoD.js +0 -1
  51. package/browser/chunk-BgRvD3oM.js +0 -1
  52. package/browser/chunk-By9FfxYH.js +0 -1
  53. package/browser/chunk-CD4sWYKU.js +0 -1
  54. package/browser/chunk-D0p3V78J.js +0 -1
  55. package/browser/chunk-D4zMOvBN.js +0 -1
  56. package/browser/chunk-DhuTTWMZ.js +0 -1
  57. package/browser/chunk-Ty1QbSFW.js +0 -1
  58. package/browser/chunk-nk841vhl.js +0 -1
  59. package/browser/chunk-tJcOqYO8.js +0 -1
@@ -1,2 +1,2 @@
1
- import {v}from'./chunk-6kWS1PKC.js';import {R,q,J}from'./chunk-BrXPglDw.js';import {p,$ as $t,c as It,M as Me,i as ie,E as Mi,F as Sg,x,w,v as vf,z as za,f as dc,r as r_,C as Cf,h as hT,a as yb,I as Iv,d as pT,e as bT,B as yT,J as mT,s as sS,l as lc,N as NT,t as tv,g as cS,D as vT,R as Rf,H as dT,k as ig,m as sg,a6 as WT,u as uc}from'./main-NXEJVT36.js';import {F,v as vt,a as ve,$,U,K as Kn,z as zn,Z as Zn,X as Xn,Y as Ye,c as bt,f as fn,L as Ln,W as Wn,b as pn,V as Vn}from'./chunk-BEMVRmeG.js';import'./chunk-tJcOqYO8.js';function se(i,t){i&1&&(za(0,"p",5),r_(1,"Loading\u2026"),Cf());}function ce(i,t){if(i&1&&(za(0,"label",23),lc(1,"input",24),sS(),za(2,"span"),r_(3),Cf()()),i&2){let e=t.$implicit,o=NT(3);yb(),tv("formControl",o.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!o.isAdmin()),cS(),yb(2),Iv(e.label);}}function de(i,t){if(i&1&&(za(0,"fieldset",8)(1,"legend",22),r_(2,"Configuration scope"),Cf(),yT(3,ce,4,4,"label",23,dT().trackByScope,true),Cf()),i&2){let e=NT(2);tv("disabled",e.isEditMode()),yb(3),vT(e.scopeOptions);}}function ue(i,t){if(i&1&&(za(0,"option",13),r_(1),Cf()),i&2){let e=t.$implicit,o=NT(2);tv("value",e),yb(),Iv(o.authTypeLabel[e]);}}function pe(i,t){i&1&&r_(0," Leave a field unchanged to keep the stored credential. ");}function he(i,t){i&1&&(za(0,"span",11),r_(1,"*"),Cf());}function me(i,t){if(i&1&&(za(0,"p",28),r_(1),Cf()),i&2){let e=NT(2).$implicit;tv("id","as-hint-"+e.key),yb(),Iv(e.hint);}}function ge(i,t){if(i&1&&(lc(0,"input",27),sS(),hT(1,me,2,2,"p",28)),i&2){let e=NT().$implicit;WT("auth-setting-form__input"+(e.secret?" auth-setting-form__input--secret":"")),tv("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),uc("aria-describedby",e.hint?"as-hint-"+e.key:null),cS(),yb(),pT(e.hint?1:-1);}}function Ce(i,t){if(i&1&&(za(0,"div",9)(1,"label",26),r_(2),hT(3,he,2,0,"span",11),Cf(),hT(4,ge,2,9),Cf()),i&2){let e,o=t.$implicit,l=NT(3);yb(),tv("for","as-cred-"+o.key),yb(),Rf(" ",o.label," "),yb(),pT(o.required?3:-1),yb(),pT((e=l.controlForField(o.key))?4:-1,e);}}function fe(i,t){if(i&1&&(za(0,"fieldset",18)(1,"legend",22),r_(2,"Credentials"),Cf(),za(3,"p",25),r_(4," Values are stored encrypted and masked on read. "),hT(5,pe,1,0),Cf(),yT(6,Ce,5,4,"div",9,dT().trackByField,true),Cf()),i&2){let e=NT(2);yb(5),pT(e.isEditMode()?5:-1),yb(),vT(e.credentialFields());}}function ye(i,t){if(i&1){let e=bT();za(0,"form",7),dc("ngSubmit",function(){ig(e);let l=NT();return sg(l.submit())}),hT(1,de,5,1,"fieldset",8),za(2,"div",9)(3,"label",10),r_(4,"Auth type "),za(5,"span",11),r_(6,"*"),Cf()(),za(7,"select",12),yT(8,ue,2,2,"option",13,mT),Cf(),sS(),Cf(),za(10,"div",9)(11,"label",14),r_(12,"Name "),za(13,"span",11),r_(14,"*"),Cf()(),lc(15,"input",15),sS(),Cf(),za(16,"div",9)(17,"label",16),r_(18,"Description"),Cf(),lc(19,"input",17),sS(),Cf(),hT(20,fe,8,1,"fieldset",18),za(21,"div",19)(22,"button",20),r_(23),Cf(),za(24,"button",21),dc("click",function(){ig(e);let l=NT();return sg(l.cancel())}),r_(25,"Cancel"),Cf()()();}if(i&2){let e=NT();tv("formGroup",e.form),yb(),pT(e.isPlatformMode?-1:1),yb(6),tv("formControl",e.authTypeControl),cS(),yb(),vT(e.authTypeOptions),yb(7),tv("formControl",e.nameControl),cS(),yb(4),tv("formControl",e.descriptionControl),cS(),yb(),pT(e.credentialFields().length>0?20:-1),yb(2),tv("disabled",e.form.invalid||e.isSubmitting()),yb(),Rf(" ",e.isEditMode()?"Save changes":"Create"," ");}}var _e=new Set(["namespace","userOnNs","userGlobal"]),P=Object.freeze({platform:"Platform (read-only)",namespace:"Namespace configuration",userOnNs:"Personal \u2014 this namespace only",userGlobal:"Personal \u2014 all namespaces"}),Se={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}]},le=class i{route=p($t);router=p(It);destroyRef=p(Me);state=p(R);namespaceRole=p(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?ie(true):F(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=q;authTypeLabel=J;scopeOptions=[{value:"namespace",label:P.namespace},{value:"userOnNs",label:P.userOnNs},{value:"userGlobal",label:P.userGlobal}];nameControl=new vt("",{nonNullable:true,validators:[ve.required,ve.minLength(1)]});descriptionControl=new vt(null);authTypeControl=new vt("ApiKeyAuthSetting",{nonNullable:true,validators:[ve.required]});scopeControl=new vt("namespace",{nonNullable:true});form=new $({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new vt("",{nonNullable:true});usernameControl=new vt("",{nonNullable:true});passwordControl=new vt("",{nonNullable:true});tokenControl=new vt("",{nonNullable:true});discoveryUrlControl=new vt("",{nonNullable:true});authorizationUrlControl=new vt("",{nonNullable:true});tokenUrlControl=new vt("",{nonNullable:true});clientIdControl=new vt("",{nonNullable:true});clientSecretControl=new vt("",{nonNullable:true});scopesControl=new vt("",{nonNullable:true});resourceUrlControl=new vt("",{nonNullable:true});selectedAuthType=F(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=Mi(()=>Se[this.selectedAuthType()]);isEditMode=ie(false);isSubmitting=ie(false);isLoading=ie(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Sg(()=>{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,o=t.get("authSettingId");if(o){this.isEditMode.set(true),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(o);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let l=this.parseScope(e.get("scope"));this.scopeControl.setValue(l);let v=e.get("template");v&&this.hydrateFromTemplate(v);}parseScope(t){return t&&_e.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,o=e.username??"",l=e.password??"";this.usernameControl.setValue(o),this.passwordControl.setValue(l),this.initialCredentials.username=o,this.initialCredentials.password=l;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,o=this.authTypeControl.value,l=this.form.getRawValue().scope,v=this.isPlatformMode?null:this.namespaceId??null,w=this.buildTypedPayload(o,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,this.existingConfig):this.state.create(w,l,v)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}buildTypedPayload(t,e,o){let l={name:e,description:o};switch(t){case "ApiKeyAuthSetting":return x(w({},l),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return x(w({},l),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return x(w({},l),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return x(w({},l),{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({},l),{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({},l),{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({},l),{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=vf({type:i,selectors:[["agentos-auth-setting-form"]],decls:10,vars:2,consts:[[1,"auth-setting-form"],[1,"auth-setting-form__header"],["type","button","title","Back to auth settings",1,"auth-setting-form__back",3,"click"],[1,"auth-setting-form__back-icon"],[1,"auth-setting-form__title"],[1,"auth-setting-form__loading"],[1,"auth-setting-form__form",3,"formGroup"],[1,"auth-setting-form__form",3,"ngSubmit","formGroup"],[1,"auth-setting-form__scope",3,"disabled"],[1,"auth-setting-form__field"],["for","as-auth-type",1,"auth-setting-form__label"],["aria-hidden","true"],["id","as-auth-type",1,"auth-setting-form__select",3,"formControl"],[3,"value"],["for","as-name",1,"auth-setting-form__label"],["id","as-name","type","text","placeholder","e.g. GitHub OAuth App","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],["for","as-description",1,"auth-setting-form__label"],["id","as-description","type","text","placeholder","Optional \u2014 short description of this auth setting","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],[1,"auth-setting-form__credentials"],[1,"auth-setting-form__actions"],["type","submit",1,"auth-setting-form__btn","auth-setting-form__btn--primary",3,"disabled"],["type","button",1,"auth-setting-form__btn",3,"click"],[1,"auth-setting-form__label"],[1,"auth-setting-form__scope-option"],["type","radio",3,"formControl","value","disabled"],[1,"auth-setting-form__credentials-hint"],[1,"auth-setting-form__label",3,"for"],[3,"id","type","placeholder","formControl","autocomplete"],[1,"auth-setting-form__field-hint",3,"id"]],template:function(e,o){e&1&&(za(0,"div",0)(1,"header",1)(2,"button",2),dc("click",function(){return o.cancel()}),za(3,"span",3),r_(4,"\u2190"),Cf(),r_(5," Auth Settings "),Cf(),za(6,"h1",4),r_(7),Cf()(),hT(8,se,2,0,"p",5)(9,ye,26,8,"form",6),Cf()),e&2&&(yb(7),Iv(o.isEditMode()?"Edit auth setting":"New auth setting"),yb(),pT(o.isLoading()?8:9));},dependencies:[Kn,zn,Zn,Xn,Ye,bt,fn,Ln,Wn,pn,Vn],styles:[".auth-setting-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem;padding:1.5rem;max-width:640px}.auth-setting-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.4rem;background:none;border:none;cursor:pointer;color:var(--color-text-secondary);font-size:.85rem;padding:0}.auth-setting-form__back[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.auth-setting-form__back-icon[_ngcontent-%COMP%]{font-size:1rem}.auth-setting-form__title[_ngcontent-%COMP%]{font-size:1.4rem;font-weight:600;color:var(--color-text);margin:0}.auth-setting-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem}.auth-setting-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.auth-setting-form__scope[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem;display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__scope[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__scope-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;font-size:.9rem;color:var(--color-text)}.auth-setting-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem}.auth-setting-form__field-hint[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);margin:0;line-height:1.4}.auth-setting-form__label[_ngcontent-%COMP%]{font-size:.85rem;font-weight:500;color:var(--color-text-secondary)}.auth-setting-form__input[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;transition:border-color .15s ease;width:100%;box-sizing:border-box}.auth-setting-form__input[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__input--secret[_ngcontent-%COMP%]{font-family:monospace;letter-spacing:.05em}.auth-setting-form__select[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;cursor:pointer;transition:border-color .15s ease}.auth-setting-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__credentials[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem 1rem;display:flex;flex-direction:column;gap:.75rem;margin:0}.auth-setting-form__credentials[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__credentials-hint[_ngcontent-%COMP%]{font-size:.78rem;color:var(--color-text-secondary);margin:0}.auth-setting-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center;padding-top:.5rem}.auth-setting-form__btn[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem 1.25rem;cursor:pointer;font-size:.9rem;font-weight:500;background:var(--color-bg-secondary);color:var(--color-text);transition:background .15s ease}.auth-setting-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover)}.auth-setting-form__btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.auth-setting-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-on-primary, #fff);border-color:var(--color-primary)}.auth-setting-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, var(--color-primary))}"]})};
1
+ import {v}from'./chunk-1sx-9Z9O.js';import {R,q,J}from'./chunk-dLi7RUdr.js';import {p,$ as $t,c as It,M as Me,i as ie,E as Mi,F as Sg,x,w,v as vf,z as za,f as dc,r as r_,C as Cf,h as hT,a as yb,I as Iv,d as pT,e as bT,B as yT,J as mT,s as sS,l as lc,N as NT,t as tv,g as cS,D as vT,R as Rf,H as dT,k as ig,m as sg,a6 as WT,u as uc}from'./main-NRMJZZ5V.js';import {F,v as vt,a as ve,$,U,K as Kn,z as zn,Z as Zn,X as Xn,Y as Ye,c as bt,f as fn,L as Ln,W as Wn,b as pn,V as Vn}from'./chunk-DaxcKFzm.js';import'./chunk-C-LRWCHD.js';function se(i,t){i&1&&(za(0,"p",5),r_(1,"Loading\u2026"),Cf());}function ce(i,t){if(i&1&&(za(0,"label",23),lc(1,"input",24),sS(),za(2,"span"),r_(3),Cf()()),i&2){let e=t.$implicit,o=NT(3);yb(),tv("formControl",o.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!o.isAdmin()),cS(),yb(2),Iv(e.label);}}function de(i,t){if(i&1&&(za(0,"fieldset",8)(1,"legend",22),r_(2,"Configuration scope"),Cf(),yT(3,ce,4,4,"label",23,dT().trackByScope,true),Cf()),i&2){let e=NT(2);tv("disabled",e.isEditMode()),yb(3),vT(e.scopeOptions);}}function ue(i,t){if(i&1&&(za(0,"option",13),r_(1),Cf()),i&2){let e=t.$implicit,o=NT(2);tv("value",e),yb(),Iv(o.authTypeLabel[e]);}}function pe(i,t){i&1&&r_(0," Leave a field unchanged to keep the stored credential. ");}function he(i,t){i&1&&(za(0,"span",11),r_(1,"*"),Cf());}function me(i,t){if(i&1&&(za(0,"p",28),r_(1),Cf()),i&2){let e=NT(2).$implicit;tv("id","as-hint-"+e.key),yb(),Iv(e.hint);}}function ge(i,t){if(i&1&&(lc(0,"input",27),sS(),hT(1,me,2,2,"p",28)),i&2){let e=NT().$implicit;WT("auth-setting-form__input"+(e.secret?" auth-setting-form__input--secret":"")),tv("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),uc("aria-describedby",e.hint?"as-hint-"+e.key:null),cS(),yb(),pT(e.hint?1:-1);}}function Ce(i,t){if(i&1&&(za(0,"div",9)(1,"label",26),r_(2),hT(3,he,2,0,"span",11),Cf(),hT(4,ge,2,9),Cf()),i&2){let e,o=t.$implicit,l=NT(3);yb(),tv("for","as-cred-"+o.key),yb(),Rf(" ",o.label," "),yb(),pT(o.required?3:-1),yb(),pT((e=l.controlForField(o.key))?4:-1,e);}}function fe(i,t){if(i&1&&(za(0,"fieldset",18)(1,"legend",22),r_(2,"Credentials"),Cf(),za(3,"p",25),r_(4," Values are stored encrypted and masked on read. "),hT(5,pe,1,0),Cf(),yT(6,Ce,5,4,"div",9,dT().trackByField,true),Cf()),i&2){let e=NT(2);yb(5),pT(e.isEditMode()?5:-1),yb(),vT(e.credentialFields());}}function ye(i,t){if(i&1){let e=bT();za(0,"form",7),dc("ngSubmit",function(){ig(e);let l=NT();return sg(l.submit())}),hT(1,de,5,1,"fieldset",8),za(2,"div",9)(3,"label",10),r_(4,"Auth type "),za(5,"span",11),r_(6,"*"),Cf()(),za(7,"select",12),yT(8,ue,2,2,"option",13,mT),Cf(),sS(),Cf(),za(10,"div",9)(11,"label",14),r_(12,"Name "),za(13,"span",11),r_(14,"*"),Cf()(),lc(15,"input",15),sS(),Cf(),za(16,"div",9)(17,"label",16),r_(18,"Description"),Cf(),lc(19,"input",17),sS(),Cf(),hT(20,fe,8,1,"fieldset",18),za(21,"div",19)(22,"button",20),r_(23),Cf(),za(24,"button",21),dc("click",function(){ig(e);let l=NT();return sg(l.cancel())}),r_(25,"Cancel"),Cf()()();}if(i&2){let e=NT();tv("formGroup",e.form),yb(),pT(e.isPlatformMode?-1:1),yb(6),tv("formControl",e.authTypeControl),cS(),yb(),vT(e.authTypeOptions),yb(7),tv("formControl",e.nameControl),cS(),yb(4),tv("formControl",e.descriptionControl),cS(),yb(),pT(e.credentialFields().length>0?20:-1),yb(2),tv("disabled",e.form.invalid||e.isSubmitting()),yb(),Rf(" ",e.isEditMode()?"Save changes":"Create"," ");}}var _e=new Set(["namespace","userOnNs","userGlobal"]),P=Object.freeze({platform:"Platform (read-only)",namespace:"Namespace configuration",userOnNs:"Personal \u2014 this namespace only",userGlobal:"Personal \u2014 all namespaces"}),Se={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}]},le=class i{route=p($t);router=p(It);destroyRef=p(Me);state=p(R);namespaceRole=p(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?ie(true):F(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=q;authTypeLabel=J;scopeOptions=[{value:"namespace",label:P.namespace},{value:"userOnNs",label:P.userOnNs},{value:"userGlobal",label:P.userGlobal}];nameControl=new vt("",{nonNullable:true,validators:[ve.required,ve.minLength(1)]});descriptionControl=new vt(null);authTypeControl=new vt("ApiKeyAuthSetting",{nonNullable:true,validators:[ve.required]});scopeControl=new vt("namespace",{nonNullable:true});form=new $({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new vt("",{nonNullable:true});usernameControl=new vt("",{nonNullable:true});passwordControl=new vt("",{nonNullable:true});tokenControl=new vt("",{nonNullable:true});discoveryUrlControl=new vt("",{nonNullable:true});authorizationUrlControl=new vt("",{nonNullable:true});tokenUrlControl=new vt("",{nonNullable:true});clientIdControl=new vt("",{nonNullable:true});clientSecretControl=new vt("",{nonNullable:true});scopesControl=new vt("",{nonNullable:true});resourceUrlControl=new vt("",{nonNullable:true});selectedAuthType=F(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=Mi(()=>Se[this.selectedAuthType()]);isEditMode=ie(false);isSubmitting=ie(false);isLoading=ie(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Sg(()=>{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,o=t.get("authSettingId");if(o){this.isEditMode.set(true),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(o);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let l=this.parseScope(e.get("scope"));this.scopeControl.setValue(l);let v=e.get("template");v&&this.hydrateFromTemplate(v);}parseScope(t){return t&&_e.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,o=e.username??"",l=e.password??"";this.usernameControl.setValue(o),this.passwordControl.setValue(l),this.initialCredentials.username=o,this.initialCredentials.password=l;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,o=this.authTypeControl.value,l=this.form.getRawValue().scope,v=this.isPlatformMode?null:this.namespaceId??null,w=this.buildTypedPayload(o,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,this.existingConfig):this.state.create(w,l,v)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}buildTypedPayload(t,e,o){let l={name:e,description:o};switch(t){case "ApiKeyAuthSetting":return x(w({},l),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return x(w({},l),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return x(w({},l),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return x(w({},l),{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({},l),{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({},l),{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({},l),{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=vf({type:i,selectors:[["agentos-auth-setting-form"]],decls:10,vars:2,consts:[[1,"auth-setting-form"],[1,"auth-setting-form__header"],["type","button","title","Back to auth settings",1,"auth-setting-form__back",3,"click"],[1,"auth-setting-form__back-icon"],[1,"auth-setting-form__title"],[1,"auth-setting-form__loading"],[1,"auth-setting-form__form",3,"formGroup"],[1,"auth-setting-form__form",3,"ngSubmit","formGroup"],[1,"auth-setting-form__scope",3,"disabled"],[1,"auth-setting-form__field"],["for","as-auth-type",1,"auth-setting-form__label"],["aria-hidden","true"],["id","as-auth-type",1,"auth-setting-form__select",3,"formControl"],[3,"value"],["for","as-name",1,"auth-setting-form__label"],["id","as-name","type","text","placeholder","e.g. GitHub OAuth App","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],["for","as-description",1,"auth-setting-form__label"],["id","as-description","type","text","placeholder","Optional \u2014 short description of this auth setting","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],[1,"auth-setting-form__credentials"],[1,"auth-setting-form__actions"],["type","submit",1,"auth-setting-form__btn","auth-setting-form__btn--primary",3,"disabled"],["type","button",1,"auth-setting-form__btn",3,"click"],[1,"auth-setting-form__label"],[1,"auth-setting-form__scope-option"],["type","radio",3,"formControl","value","disabled"],[1,"auth-setting-form__credentials-hint"],[1,"auth-setting-form__label",3,"for"],[3,"id","type","placeholder","formControl","autocomplete"],[1,"auth-setting-form__field-hint",3,"id"]],template:function(e,o){e&1&&(za(0,"div",0)(1,"header",1)(2,"button",2),dc("click",function(){return o.cancel()}),za(3,"span",3),r_(4,"\u2190"),Cf(),r_(5," Auth Settings "),Cf(),za(6,"h1",4),r_(7),Cf()(),hT(8,se,2,0,"p",5)(9,ye,26,8,"form",6),Cf()),e&2&&(yb(7),Iv(o.isEditMode()?"Edit auth setting":"New auth setting"),yb(),pT(o.isLoading()?8:9));},dependencies:[Kn,zn,Zn,Xn,Ye,bt,fn,Ln,Wn,pn,Vn],styles:[".auth-setting-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem;padding:1.5rem;max-width:640px}.auth-setting-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.4rem;background:none;border:none;cursor:pointer;color:var(--color-text-secondary);font-size:.85rem;padding:0}.auth-setting-form__back[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.auth-setting-form__back-icon[_ngcontent-%COMP%]{font-size:1rem}.auth-setting-form__title[_ngcontent-%COMP%]{font-size:1.4rem;font-weight:600;color:var(--color-text);margin:0}.auth-setting-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem}.auth-setting-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.auth-setting-form__scope[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem;display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__scope[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__scope-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;font-size:.9rem;color:var(--color-text)}.auth-setting-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem}.auth-setting-form__field-hint[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);margin:0;line-height:1.4}.auth-setting-form__label[_ngcontent-%COMP%]{font-size:.85rem;font-weight:500;color:var(--color-text-secondary)}.auth-setting-form__input[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;transition:border-color .15s ease;width:100%;box-sizing:border-box}.auth-setting-form__input[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__input--secret[_ngcontent-%COMP%]{font-family:monospace;letter-spacing:.05em}.auth-setting-form__select[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;cursor:pointer;transition:border-color .15s ease}.auth-setting-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__credentials[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem 1rem;display:flex;flex-direction:column;gap:.75rem;margin:0}.auth-setting-form__credentials[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__credentials-hint[_ngcontent-%COMP%]{font-size:.78rem;color:var(--color-text-secondary);margin:0}.auth-setting-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center;padding-top:.5rem}.auth-setting-form__btn[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem 1.25rem;cursor:pointer;font-size:.9rem;font-weight:500;background:var(--color-bg-secondary);color:var(--color-text);transition:background .15s ease}.auth-setting-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover)}.auth-setting-form__btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.auth-setting-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-on-primary, #fff);border-color:var(--color-primary)}.auth-setting-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, var(--color-primary))}"]})};
2
2
  export{le as AuthSettingFormComponent};
@@ -1 +1 @@
1
- import {l,$,v as vt,a as ve$1,U,K as Kn,z as zn,Z as Zn,X as Xn,Y as Ye,c as bt,L as Ln,W as Wn,V as Vn,y as yn}from'./chunk-BEMVRmeG.js';import {p,M as Me,$ as $t,G,i as ie$1,v as vf,A as Ae,L as Le,n as R,o as wr,z as za,r as r_,C as Cf,h as hT,f as dc,l as lc,s as sS,a as yb,d as pT,t as tv,g as cS,N as NT,R as Rf,e as bT,I as Iv,q as gv,k as ig,m as sg,B as yT,D as vT}from'./main-NXEJVT36.js';var h=class e{api=p(Ae);isLoading=ie$1(false);result=ie$1(null);errorMessage=ie$1(null);invoke(t,o,a,s){return this.isLoading.set(true),this.result.set(null),this.errorMessage.set(null),this.api.invoke({namespaceId:t,userId:o||void 0,toolName:a,payload:s||void 0}).pipe(Le({next:f=>{this.result.set(f),this.isLoading.set(false);},error:f=>{this.errorMessage.set(ee(f)),this.isLoading.set(false);}}))}reset(){this.result.set(null),this.errorMessage.set(null);}static \u0275fac=function(o){return new(o||e)};static \u0275prov=R({token:e,factory:e.\u0275fac,providedIn:"root"})};function ee(e){if(e instanceof wr){let t=e.error;return t&&typeof t=="object"&&"message"in t&&typeof t.message=="string"?t.message:typeof t=="string"&&t.trim().length>0?t:e.statusText||`HTTP ${e.status}`}return e instanceof Error?e.message:"Unknown error"}var te=(e,t)=>t.id;function oe(e,t){e&1&&r_(0," Execute any registered tool directly \u2014 bypasses the normal agent-run pipeline. Restricted to super-admins. ");}function ne(e,t){e&1&&r_(0," Execute a registered tool directly in this namespace \u2014 bypasses the normal agent-run pipeline. ");}function ie(e,t){e&1&&(za(0,"p",14),r_(1,"Loading namespaces\u2026"),Cf());}function re(e,t){if(e&1&&(za(0,"option",24),r_(1),Cf()),e&2){let o=t.$implicit;tv("value",o.id),yb(),Iv(o.name);}}function ae(e,t){if(e&1&&(za(0,"select",22)(1,"option",23),r_(2,"Select a namespace"),Cf(),yT(3,re,2,2,"option",24,te),Cf(),sS()),e&2){let o=NT(2);cS(),yb(3),vT(o.namespaces());}}function le(e,t){if(e&1&&hT(0,ie,2,0,"p",14)(1,ae,5,0,"select",22),e&2){let o=NT();pT(o.namespacesLoading()?0:1);}}function se(e,t){if(e&1&&(za(0,"p",8),r_(1),Cf()),e&2){let o=NT();yb(),Rf(" ",o.namespaceName()??o.namespaceId," ");}}function de(e,t){e&1&&r_(0," Running\u2026 ");}function ce(e,t){e&1&&r_(0," Run tool ");}function me(e,t){if(e&1){let o=bT();za(0,"button",25),dc("click",function(){ig(o);let s=NT();return sg(s.reset())}),r_(1,"Clear result"),Cf();}}function pe(e,t){e&1&&(za(0,"section",20)(1,"h2",26),r_(2,"Error"),Cf(),za(3,"pre",27),r_(4),Cf()()),e&2&&(yb(4),Iv(t));}function _e(e,t){e&1&&(za(0,"h3",31),r_(1,"Metadata"),Cf(),za(2,"pre",27),r_(3),Cf()),e&2&&(yb(3),Iv(t));}function ue(e,t){if(e&1&&(za(0,"dt",33),r_(1,"Type"),Cf(),za(2,"dd",34),r_(3),Cf()),e&2){let o=NT(2);yb(3),Iv(o.errorType);}}function fe(e,t){if(e&1&&(za(0,"dt",33),r_(1,"Message"),Cf(),za(2,"dd",35),r_(3),Cf()),e&2){let o=NT(2);yb(3),Iv(o.errorMessage);}}function ve(e,t){if(e&1&&(za(0,"h3",31),r_(1,"Tool error details"),Cf(),za(2,"dl",32),hT(3,ue,4,1),hT(4,fe,4,1),Cf()),e&2){let o=NT();yb(3),pT(o.errorType?3:-1),yb(),pT(o.errorMessage?4:-1);}}function ge(e,t){if(e&1&&(za(0,"section",28)(1,"header",29)(2,"h2",26),r_(3),Cf(),za(4,"span",30),r_(5),Cf()(),za(6,"h3",31),r_(7,"Output"),Cf(),za(8,"pre",27),r_(9),Cf(),hT(10,_e,4,1),za(11,"h3",31),r_(12,"Structured output"),Cf(),za(13,"pre",27),r_(14),Cf(),hT(15,ve,5,2),Cf()),e&2){let o,a=t,s=NT();gv("tool-invoke__result--failure",!a.success),yb(3),Rf("Result \u2014 ",a.toolName),yb(),gv("tool-invoke__badge--success",a.success)("tool-invoke__badge--failure",!a.success),yb(),Rf(" ",a.success?"Success":"Tool error"," "),yb(4),Iv(a.output),yb(),pT((o=s.formatMetadata(a.metadata))?10:-1,o),yb(4),Iv(s.formatStructuredOutput(a.structuredOutput)??"null"),yb(),pT(a.errorType||a.errorMessage?15:-1);}}var X=class e{destroyRef=p(Me);route=p($t);namespaceController=p(G);userState=p(l);state=p(h);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;namespaces=ie$1([]);namespacesLoading=ie$1(true);namespaceName=ie$1(null);form=new $({namespaceId:new vt("",{nonNullable:true,validators:[ve$1.required]}),userId:new vt("",{nonNullable:true}),toolName:new vt("",{nonNullable:true,validators:[ve$1.required]}),payload:new vt("",{nonNullable:true})});ngOnInit(){let t=this.userState.currentUser()?.id;t?this.form.controls.userId.patchValue(t):this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:o=>{o.id&&this.form.controls.userId.patchValue(o.id);}}),this.isPlatformMode?this.namespaceController.listAllNamespace().pipe(U(this.destroyRef)).subscribe({next:o=>{this.namespaces.set(o.map(a=>({id:a.id,name:a.name}))),this.namespacesLoading.set(false);},error:()=>this.namespacesLoading.set(false)}):(this.form.controls.namespaceId.patchValue(this.namespaceId),this.namespacesLoading.set(false),this.namespaceController.getByIdNamespace(this.namespaceId).pipe(U(this.destroyRef)).subscribe({next:o=>this.namespaceName.set(o.name),error:()=>this.namespaceName.set(this.namespaceId)}));}submit(){if(this.form.invalid||this.state.isLoading())return;let{namespaceId:t,userId:o,toolName:a,payload:s}=this.form.getRawValue();this.state.invoke(t,o.trim()||void 0,a.trim(),s.trim()||void 0).pipe(U(this.destroyRef)).subscribe();}reset(){this.state.reset();}formatMetadata(t){return !t||Object.keys(t).length===0?null:JSON.stringify(t,null,2)}formatStructuredOutput(t){return t===void 0?null:JSON.stringify(t,null,2)}static \u0275fac=function(o){return new(o||e)};static \u0275cmp=vf({type:e,selectors:[["agentos-tool-invoke"]],decls:42,vars:8,consts:[[1,"tool-invoke"],[1,"tool-invoke__header"],[1,"tool-invoke__title"],[1,"tool-invoke__subtitle"],[1,"tool-invoke__form",3,"ngSubmit","formGroup"],[1,"tool-invoke__field"],["for","ti-namespace",1,"tool-invoke__label"],[1,"tool-invoke__required"],["id","ti-namespace",1,"tool-invoke__namespace-static"],["for","ti-user",1,"tool-invoke__label"],[1,"tool-invoke__optional"],["id","ti-user","type","text","formControlName","userId","placeholder","UUID of the user \u2014 adds user-scoped overlay layers","autocomplete","off",1,"tool-invoke__input"],["for","ti-tool",1,"tool-invoke__label"],["id","ti-tool","type","text","formControlName","toolName","placeholder","e.g. MY_FILES__listFiles","autocomplete","off","spellcheck","false",1,"tool-invoke__input","tool-invoke__input--mono"],[1,"tool-invoke__hint"],["for","ti-payload",1,"tool-invoke__label"],["id","ti-payload","formControlName","payload","rows","6","placeholder",'JSON arguments for the tool, e.g. {"path": "/some/dir"}\\nLeave empty for tools with no input.',"spellcheck","false",1,"tool-invoke__textarea","tool-invoke__input--mono"],[1,"tool-invoke__actions"],["type","submit",1,"tool-invoke__submit",3,"disabled"],["type","button",1,"tool-invoke__reset"],[1,"tool-invoke__result","tool-invoke__result--error"],[1,"tool-invoke__result",3,"tool-invoke__result--failure"],["id","ti-namespace","formControlName","namespaceId",1,"tool-invoke__select"],["value","","disabled",""],[3,"value"],["type","button",1,"tool-invoke__reset",3,"click"],[1,"tool-invoke__result-title"],[1,"tool-invoke__output"],[1,"tool-invoke__result"],[1,"tool-invoke__result-header"],[1,"tool-invoke__badge"],[1,"tool-invoke__section-label"],[1,"tool-invoke__dl"],[1,"tool-invoke__dt"],[1,"tool-invoke__dd","tool-invoke__dd--mono"],[1,"tool-invoke__dd"]],template:function(o,a){if(o&1&&(za(0,"div",0)(1,"header",1)(2,"h1",2),r_(3,"Tool invoke"),Cf(),za(4,"p",3),hT(5,oe,1,0)(6,ne,1,0),Cf()(),za(7,"form",4),dc("ngSubmit",function(){return a.submit()}),za(8,"div",5)(9,"label",6),r_(10,"Namespace "),za(11,"span",7),r_(12,"*"),Cf()(),hT(13,le,2,1)(14,se,2,1,"p",8),Cf(),za(15,"div",5)(16,"label",9),r_(17,"User ID "),za(18,"span",10),r_(19,"(optional)"),Cf()(),lc(20,"input",11),sS(),Cf(),za(21,"div",5)(22,"label",12),r_(23,"Tool name "),za(24,"span",7),r_(25,"*"),Cf()(),lc(26,"input",13),sS(),za(27,"p",14),r_(28," Exact tool name as returned by the agent definition inspect page. When not found, the error response lists all available tools for the selected namespace. "),Cf()(),za(29,"div",5)(30,"label",15),r_(31,"Payload "),za(32,"span",10),r_(33,"(optional)"),Cf()(),lc(34,"textarea",16),sS(),Cf(),za(35,"div",17)(36,"button",18),hT(37,de,1,0)(38,ce,1,0),Cf(),hT(39,me,2,0,"button",19),Cf()(),hT(40,pe,5,1,"section",20),hT(41,ge,16,12,"section",21),Cf()),o&2){let s,f;yb(5),pT(a.isPlatformMode?5:6),yb(2),tv("formGroup",a.form),yb(6),pT(a.isPlatformMode?13:14),yb(7),cS(),yb(6),cS(),yb(8),cS(),yb(2),tv("disabled",a.form.invalid||a.state.isLoading()),yb(),pT(a.state.isLoading()?37:38),yb(2),pT(a.state.result()||a.state.errorMessage()?39:-1),yb(),pT((s=a.state.errorMessage())?40:-1,s),yb(),pT((f=a.state.result())?41:-1,f);}},dependencies:[Kn,zn,Zn,Xn,Ye,bt,Ln,Wn,Vn,yn],styles:[".tool-invoke[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:720px;margin:0 auto;padding:2rem 1rem}.tool-invoke__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.tool-invoke__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.3rem;padding:0;border:none;background:transparent;color:var(--color-text-secondary, #6e6e73);font-size:.875rem;font-family:inherit;cursor:pointer;align-self:flex-start}.tool-invoke__back[_ngcontent-%COMP%]:hover{color:var(--color-text, #1d1d1f)}.tool-invoke__namespace-static[_ngcontent-%COMP%]{margin:0;padding:.5rem .75rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .12));background:var(--color-surface-muted, rgba(0, 0, 0, .04));color:var(--color-text, #1d1d1f);font-size:.9375rem}.tool-invoke__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.tool-invoke__subtitle[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6e6e73);line-height:1.5}.tool-invoke__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem;padding:1.5rem;border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:12px}.tool-invoke__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.4rem}.tool-invoke__label[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:500;color:var(--color-text-secondary, #6e6e73)}.tool-invoke__required[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30);margin-left:.1em}.tool-invoke__optional[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary, #6e6e73);font-size:.75rem}.tool-invoke__hint[_ngcontent-%COMP%]{margin:0;font-size:.75rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.tool-invoke__input[_ngcontent-%COMP%], .tool-invoke__select[_ngcontent-%COMP%], .tool-invoke__textarea[_ngcontent-%COMP%]{padding:.5rem .75rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .12));background:var(--color-surface, #fff);color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;transition:border-color .15s ease}.tool-invoke__input[_ngcontent-%COMP%]:focus, .tool-invoke__select[_ngcontent-%COMP%]:focus, .tool-invoke__textarea[_ngcontent-%COMP%]:focus{outline:none;border-color:var(--color-primary, #007aff)}.tool-invoke__input--mono[_ngcontent-%COMP%], .tool-invoke__select--mono[_ngcontent-%COMP%], .tool-invoke__textarea--mono[_ngcontent-%COMP%]{font-family:monospace;font-size:.875rem}.tool-invoke__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:120px}.tool-invoke__select[_ngcontent-%COMP%]{cursor:pointer}.tool-invoke__actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.75rem;flex-wrap:wrap;padding-top:.25rem}.tool-invoke__submit[_ngcontent-%COMP%]{padding:.55rem 1.25rem;border-radius:8px;border:none;background:var(--color-primary, #007aff);color:#fff;font-size:.9375rem;font-weight:500;font-family:inherit;cursor:pointer;transition:opacity .15s ease}.tool-invoke__submit[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.tool-invoke__submit[_ngcontent-%COMP%]:not(:disabled):hover{opacity:.88}.tool-invoke__reset[_ngcontent-%COMP%]{padding:.55rem 1rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .12));background:transparent;color:var(--color-text-secondary, #6e6e73);font-size:.875rem;font-family:inherit;cursor:pointer}.tool-invoke__reset[_ngcontent-%COMP%]:hover{background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.tool-invoke__result[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem;padding:1.25rem;border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:12px}.tool-invoke__result--error[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30);background:var(--color-error-bg, #fff5f5)}.tool-invoke__result--failure[_ngcontent-%COMP%]{border-color:var(--color-warning, #ff9500);background:var(--color-warning-bg, #fffaf0)}.tool-invoke__result-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.75rem;flex-wrap:wrap}.tool-invoke__result-title[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;font-weight:600;color:var(--color-text, #1d1d1f)}.tool-invoke__badge[_ngcontent-%COMP%]{display:inline-block;padding:.2em .6em;border-radius:4px;font-size:.75rem;font-weight:500}.tool-invoke__badge--success[_ngcontent-%COMP%]{background:var(--color-success-bg, #e3f5e1);color:var(--color-success, #34c759)}.tool-invoke__badge--failure[_ngcontent-%COMP%]{background:var(--color-warning-bg, #fff3cd);color:var(--color-warning, #ff9500)}.tool-invoke__section-label[_ngcontent-%COMP%]{margin:.5rem 0 0;font-size:.8125rem;font-weight:500;color:var(--color-text-secondary, #6e6e73);text-transform:uppercase;letter-spacing:.04em}.tool-invoke__output[_ngcontent-%COMP%]{margin:0;padding:.875rem 1rem;border-radius:6px;background:var(--color-surface-muted, rgba(0, 0, 0, .04));font-size:.875rem;font-family:monospace;color:var(--color-text, #1d1d1f);white-space:pre-wrap;word-break:break-word;line-height:1.6;max-height:500px;overflow-y:auto}.tool-invoke__dl[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content 1fr;gap:.4rem 1rem;margin:0}.tool-invoke__dt[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:500;color:var(--color-text-secondary, #6e6e73);align-self:start}.tool-invoke__dd[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text, #1d1d1f);word-break:break-word}.tool-invoke__dd--mono[_ngcontent-%COMP%]{font-family:monospace}"]})};export{X as ToolInvokeComponent};
1
+ import {l,$,v as vt,a as ve$1,U,K as Kn,z as zn,Z as Zn,X as Xn,Y as Ye,c as bt,L as Ln,W as Wn,V as Vn,y as yn}from'./chunk-DaxcKFzm.js';import {p,M as Me,$ as $t,G,i as ie$1,v as vf,A as Ae,L as Le,n as R,o as wr,z as za,r as r_,C as Cf,h as hT,f as dc,l as lc,s as sS,a as yb,d as pT,t as tv,g as cS,N as NT,R as Rf,e as bT,I as Iv,q as gv,k as ig,m as sg,B as yT,D as vT}from'./main-NRMJZZ5V.js';var h=class e{api=p(Ae);isLoading=ie$1(false);result=ie$1(null);errorMessage=ie$1(null);invoke(t,o,a,s){return this.isLoading.set(true),this.result.set(null),this.errorMessage.set(null),this.api.invoke({namespaceId:t,userId:o||void 0,toolName:a,payload:s||void 0}).pipe(Le({next:f=>{this.result.set(f),this.isLoading.set(false);},error:f=>{this.errorMessage.set(ee(f)),this.isLoading.set(false);}}))}reset(){this.result.set(null),this.errorMessage.set(null);}static \u0275fac=function(o){return new(o||e)};static \u0275prov=R({token:e,factory:e.\u0275fac,providedIn:"root"})};function ee(e){if(e instanceof wr){let t=e.error;return t&&typeof t=="object"&&"message"in t&&typeof t.message=="string"?t.message:typeof t=="string"&&t.trim().length>0?t:e.statusText||`HTTP ${e.status}`}return e instanceof Error?e.message:"Unknown error"}var te=(e,t)=>t.id;function oe(e,t){e&1&&r_(0," Execute any registered tool directly \u2014 bypasses the normal agent-run pipeline. Restricted to super-admins. ");}function ne(e,t){e&1&&r_(0," Execute a registered tool directly in this namespace \u2014 bypasses the normal agent-run pipeline. ");}function ie(e,t){e&1&&(za(0,"p",14),r_(1,"Loading namespaces\u2026"),Cf());}function re(e,t){if(e&1&&(za(0,"option",24),r_(1),Cf()),e&2){let o=t.$implicit;tv("value",o.id),yb(),Iv(o.name);}}function ae(e,t){if(e&1&&(za(0,"select",22)(1,"option",23),r_(2,"Select a namespace"),Cf(),yT(3,re,2,2,"option",24,te),Cf(),sS()),e&2){let o=NT(2);cS(),yb(3),vT(o.namespaces());}}function le(e,t){if(e&1&&hT(0,ie,2,0,"p",14)(1,ae,5,0,"select",22),e&2){let o=NT();pT(o.namespacesLoading()?0:1);}}function se(e,t){if(e&1&&(za(0,"p",8),r_(1),Cf()),e&2){let o=NT();yb(),Rf(" ",o.namespaceName()??o.namespaceId," ");}}function de(e,t){e&1&&r_(0," Running\u2026 ");}function ce(e,t){e&1&&r_(0," Run tool ");}function me(e,t){if(e&1){let o=bT();za(0,"button",25),dc("click",function(){ig(o);let s=NT();return sg(s.reset())}),r_(1,"Clear result"),Cf();}}function pe(e,t){e&1&&(za(0,"section",20)(1,"h2",26),r_(2,"Error"),Cf(),za(3,"pre",27),r_(4),Cf()()),e&2&&(yb(4),Iv(t));}function _e(e,t){e&1&&(za(0,"h3",31),r_(1,"Metadata"),Cf(),za(2,"pre",27),r_(3),Cf()),e&2&&(yb(3),Iv(t));}function ue(e,t){if(e&1&&(za(0,"dt",33),r_(1,"Type"),Cf(),za(2,"dd",34),r_(3),Cf()),e&2){let o=NT(2);yb(3),Iv(o.errorType);}}function fe(e,t){if(e&1&&(za(0,"dt",33),r_(1,"Message"),Cf(),za(2,"dd",35),r_(3),Cf()),e&2){let o=NT(2);yb(3),Iv(o.errorMessage);}}function ve(e,t){if(e&1&&(za(0,"h3",31),r_(1,"Tool error details"),Cf(),za(2,"dl",32),hT(3,ue,4,1),hT(4,fe,4,1),Cf()),e&2){let o=NT();yb(3),pT(o.errorType?3:-1),yb(),pT(o.errorMessage?4:-1);}}function ge(e,t){if(e&1&&(za(0,"section",28)(1,"header",29)(2,"h2",26),r_(3),Cf(),za(4,"span",30),r_(5),Cf()(),za(6,"h3",31),r_(7,"Output"),Cf(),za(8,"pre",27),r_(9),Cf(),hT(10,_e,4,1),za(11,"h3",31),r_(12,"Structured output"),Cf(),za(13,"pre",27),r_(14),Cf(),hT(15,ve,5,2),Cf()),e&2){let o,a=t,s=NT();gv("tool-invoke__result--failure",!a.success),yb(3),Rf("Result \u2014 ",a.toolName),yb(),gv("tool-invoke__badge--success",a.success)("tool-invoke__badge--failure",!a.success),yb(),Rf(" ",a.success?"Success":"Tool error"," "),yb(4),Iv(a.output),yb(),pT((o=s.formatMetadata(a.metadata))?10:-1,o),yb(4),Iv(s.formatStructuredOutput(a.structuredOutput)??"null"),yb(),pT(a.errorType||a.errorMessage?15:-1);}}var X=class e{destroyRef=p(Me);route=p($t);namespaceController=p(G);userState=p(l);state=p(h);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;namespaces=ie$1([]);namespacesLoading=ie$1(true);namespaceName=ie$1(null);form=new $({namespaceId:new vt("",{nonNullable:true,validators:[ve$1.required]}),userId:new vt("",{nonNullable:true}),toolName:new vt("",{nonNullable:true,validators:[ve$1.required]}),payload:new vt("",{nonNullable:true})});ngOnInit(){let t=this.userState.currentUser()?.id;t?this.form.controls.userId.patchValue(t):this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:o=>{o.id&&this.form.controls.userId.patchValue(o.id);}}),this.isPlatformMode?this.namespaceController.listAllNamespace().pipe(U(this.destroyRef)).subscribe({next:o=>{this.namespaces.set(o.map(a=>({id:a.id,name:a.name}))),this.namespacesLoading.set(false);},error:()=>this.namespacesLoading.set(false)}):(this.form.controls.namespaceId.patchValue(this.namespaceId),this.namespacesLoading.set(false),this.namespaceController.getByIdNamespace(this.namespaceId).pipe(U(this.destroyRef)).subscribe({next:o=>this.namespaceName.set(o.name),error:()=>this.namespaceName.set(this.namespaceId)}));}submit(){if(this.form.invalid||this.state.isLoading())return;let{namespaceId:t,userId:o,toolName:a,payload:s}=this.form.getRawValue();this.state.invoke(t,o.trim()||void 0,a.trim(),s.trim()||void 0).pipe(U(this.destroyRef)).subscribe();}reset(){this.state.reset();}formatMetadata(t){return !t||Object.keys(t).length===0?null:JSON.stringify(t,null,2)}formatStructuredOutput(t){return t===void 0?null:JSON.stringify(t,null,2)}static \u0275fac=function(o){return new(o||e)};static \u0275cmp=vf({type:e,selectors:[["agentos-tool-invoke"]],decls:42,vars:8,consts:[[1,"tool-invoke"],[1,"tool-invoke__header"],[1,"tool-invoke__title"],[1,"tool-invoke__subtitle"],[1,"tool-invoke__form",3,"ngSubmit","formGroup"],[1,"tool-invoke__field"],["for","ti-namespace",1,"tool-invoke__label"],[1,"tool-invoke__required"],["id","ti-namespace",1,"tool-invoke__namespace-static"],["for","ti-user",1,"tool-invoke__label"],[1,"tool-invoke__optional"],["id","ti-user","type","text","formControlName","userId","placeholder","UUID of the user \u2014 adds user-scoped overlay layers","autocomplete","off",1,"tool-invoke__input"],["for","ti-tool",1,"tool-invoke__label"],["id","ti-tool","type","text","formControlName","toolName","placeholder","e.g. MY_FILES__listFiles","autocomplete","off","spellcheck","false",1,"tool-invoke__input","tool-invoke__input--mono"],[1,"tool-invoke__hint"],["for","ti-payload",1,"tool-invoke__label"],["id","ti-payload","formControlName","payload","rows","6","placeholder",'JSON arguments for the tool, e.g. {"path": "/some/dir"}\\nLeave empty for tools with no input.',"spellcheck","false",1,"tool-invoke__textarea","tool-invoke__input--mono"],[1,"tool-invoke__actions"],["type","submit",1,"tool-invoke__submit",3,"disabled"],["type","button",1,"tool-invoke__reset"],[1,"tool-invoke__result","tool-invoke__result--error"],[1,"tool-invoke__result",3,"tool-invoke__result--failure"],["id","ti-namespace","formControlName","namespaceId",1,"tool-invoke__select"],["value","","disabled",""],[3,"value"],["type","button",1,"tool-invoke__reset",3,"click"],[1,"tool-invoke__result-title"],[1,"tool-invoke__output"],[1,"tool-invoke__result"],[1,"tool-invoke__result-header"],[1,"tool-invoke__badge"],[1,"tool-invoke__section-label"],[1,"tool-invoke__dl"],[1,"tool-invoke__dt"],[1,"tool-invoke__dd","tool-invoke__dd--mono"],[1,"tool-invoke__dd"]],template:function(o,a){if(o&1&&(za(0,"div",0)(1,"header",1)(2,"h1",2),r_(3,"Tool invoke"),Cf(),za(4,"p",3),hT(5,oe,1,0)(6,ne,1,0),Cf()(),za(7,"form",4),dc("ngSubmit",function(){return a.submit()}),za(8,"div",5)(9,"label",6),r_(10,"Namespace "),za(11,"span",7),r_(12,"*"),Cf()(),hT(13,le,2,1)(14,se,2,1,"p",8),Cf(),za(15,"div",5)(16,"label",9),r_(17,"User ID "),za(18,"span",10),r_(19,"(optional)"),Cf()(),lc(20,"input",11),sS(),Cf(),za(21,"div",5)(22,"label",12),r_(23,"Tool name "),za(24,"span",7),r_(25,"*"),Cf()(),lc(26,"input",13),sS(),za(27,"p",14),r_(28," Exact tool name as returned by the agent definition inspect page. When not found, the error response lists all available tools for the selected namespace. "),Cf()(),za(29,"div",5)(30,"label",15),r_(31,"Payload "),za(32,"span",10),r_(33,"(optional)"),Cf()(),lc(34,"textarea",16),sS(),Cf(),za(35,"div",17)(36,"button",18),hT(37,de,1,0)(38,ce,1,0),Cf(),hT(39,me,2,0,"button",19),Cf()(),hT(40,pe,5,1,"section",20),hT(41,ge,16,12,"section",21),Cf()),o&2){let s,f;yb(5),pT(a.isPlatformMode?5:6),yb(2),tv("formGroup",a.form),yb(6),pT(a.isPlatformMode?13:14),yb(7),cS(),yb(6),cS(),yb(8),cS(),yb(2),tv("disabled",a.form.invalid||a.state.isLoading()),yb(),pT(a.state.isLoading()?37:38),yb(2),pT(a.state.result()||a.state.errorMessage()?39:-1),yb(),pT((s=a.state.errorMessage())?40:-1,s),yb(),pT((f=a.state.result())?41:-1,f);}},dependencies:[Kn,zn,Zn,Xn,Ye,bt,Ln,Wn,Vn,yn],styles:[".tool-invoke[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:720px;margin:0 auto;padding:2rem 1rem}.tool-invoke__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.tool-invoke__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.3rem;padding:0;border:none;background:transparent;color:var(--color-text-secondary, #6e6e73);font-size:.875rem;font-family:inherit;cursor:pointer;align-self:flex-start}.tool-invoke__back[_ngcontent-%COMP%]:hover{color:var(--color-text, #1d1d1f)}.tool-invoke__namespace-static[_ngcontent-%COMP%]{margin:0;padding:.5rem .75rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .12));background:var(--color-surface-muted, rgba(0, 0, 0, .04));color:var(--color-text, #1d1d1f);font-size:.9375rem}.tool-invoke__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.tool-invoke__subtitle[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6e6e73);line-height:1.5}.tool-invoke__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem;padding:1.5rem;border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:12px}.tool-invoke__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.4rem}.tool-invoke__label[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:500;color:var(--color-text-secondary, #6e6e73)}.tool-invoke__required[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30);margin-left:.1em}.tool-invoke__optional[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary, #6e6e73);font-size:.75rem}.tool-invoke__hint[_ngcontent-%COMP%]{margin:0;font-size:.75rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.tool-invoke__input[_ngcontent-%COMP%], .tool-invoke__select[_ngcontent-%COMP%], .tool-invoke__textarea[_ngcontent-%COMP%]{padding:.5rem .75rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .12));background:var(--color-surface, #fff);color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;transition:border-color .15s ease}.tool-invoke__input[_ngcontent-%COMP%]:focus, .tool-invoke__select[_ngcontent-%COMP%]:focus, .tool-invoke__textarea[_ngcontent-%COMP%]:focus{outline:none;border-color:var(--color-primary, #007aff)}.tool-invoke__input--mono[_ngcontent-%COMP%], .tool-invoke__select--mono[_ngcontent-%COMP%], .tool-invoke__textarea--mono[_ngcontent-%COMP%]{font-family:monospace;font-size:.875rem}.tool-invoke__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:120px}.tool-invoke__select[_ngcontent-%COMP%]{cursor:pointer}.tool-invoke__actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.75rem;flex-wrap:wrap;padding-top:.25rem}.tool-invoke__submit[_ngcontent-%COMP%]{padding:.55rem 1.25rem;border-radius:8px;border:none;background:var(--color-primary, #007aff);color:#fff;font-size:.9375rem;font-weight:500;font-family:inherit;cursor:pointer;transition:opacity .15s ease}.tool-invoke__submit[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.tool-invoke__submit[_ngcontent-%COMP%]:not(:disabled):hover{opacity:.88}.tool-invoke__reset[_ngcontent-%COMP%]{padding:.55rem 1rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .12));background:transparent;color:var(--color-text-secondary, #6e6e73);font-size:.875rem;font-family:inherit;cursor:pointer}.tool-invoke__reset[_ngcontent-%COMP%]:hover{background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.tool-invoke__result[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem;padding:1.25rem;border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:12px}.tool-invoke__result--error[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30);background:var(--color-error-bg, #fff5f5)}.tool-invoke__result--failure[_ngcontent-%COMP%]{border-color:var(--color-warning, #ff9500);background:var(--color-warning-bg, #fffaf0)}.tool-invoke__result-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.75rem;flex-wrap:wrap}.tool-invoke__result-title[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;font-weight:600;color:var(--color-text, #1d1d1f)}.tool-invoke__badge[_ngcontent-%COMP%]{display:inline-block;padding:.2em .6em;border-radius:4px;font-size:.75rem;font-weight:500}.tool-invoke__badge--success[_ngcontent-%COMP%]{background:var(--color-success-bg, #e3f5e1);color:var(--color-success, #34c759)}.tool-invoke__badge--failure[_ngcontent-%COMP%]{background:var(--color-warning-bg, #fff3cd);color:var(--color-warning, #ff9500)}.tool-invoke__section-label[_ngcontent-%COMP%]{margin:.5rem 0 0;font-size:.8125rem;font-weight:500;color:var(--color-text-secondary, #6e6e73);text-transform:uppercase;letter-spacing:.04em}.tool-invoke__output[_ngcontent-%COMP%]{margin:0;padding:.875rem 1rem;border-radius:6px;background:var(--color-surface-muted, rgba(0, 0, 0, .04));font-size:.875rem;font-family:monospace;color:var(--color-text, #1d1d1f);white-space:pre-wrap;word-break:break-word;line-height:1.6;max-height:500px;overflow-y:auto}.tool-invoke__dl[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content 1fr;gap:.4rem 1rem;margin:0}.tool-invoke__dt[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:500;color:var(--color-text-secondary, #6e6e73);align-self:start}.tool-invoke__dd[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text, #1d1d1f);word-break:break-word}.tool-invoke__dd--mono[_ngcontent-%COMP%]{font-family:monospace}"]})};export{X as ToolInvokeComponent};
@@ -1 +1 @@
1
- import {a}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-oPG6SPli.js';import {u as s,U,o as Vi,r as qe,s as gi}from'./chunk-BEMVRmeG.js';import {p,$ as $t,c as It,M as Me,P as De,i as ie$1,Q as Ae,aq as gw,an as j,v as vf,a7 as mc,a8 as N$,E as Mi,z as za,r as r_,C as Cf,h as hT,q as gv,a as yb,I as Iv,d as pT,Z as pw,a0 as Wn,_,aF as kM,ah as v_,f as dc,a9 as Jy,aa as PT,t as tv,ai as E_,aG as g_,N as NT,ae as Cv,e as bT,k as ig,m as sg,ab as I_}from'./main-NXEJVT36.js';function ne(n,t){n&1&&(za(0,"span",4),r_(1,"SKILL.md"),Cf());}function ie(n,t){if(n&1&&(za(0,"span",5),r_(1),Cf()),n&2){let e=NT();yb(),Iv(e.skill().description);}}function ae(n,t){if(n&1&&(za(0,"span",6),r_(1),Cf()),n&2){let e=NT();yb(),Cv(" ",e.resourceCount()," ",e.resourceCount()===1?"resource":"resources"," ");}}function oe(n,t){if(n&1&&(za(0,"span",6),r_(1),Cf()),n&2){let e=NT();yb(),Cv(" named by ",e.namedByAgents()," ",e.namedByAgents()===1?"agent":"agents"," ");}}function le(n,t){if(n&1&&r_(0),n&2){let e=NT(2);Cv(" Delete? ",e.namedByAgents()," ",e.namedByAgents()===1?"agent":"agents"," would be left naming it. ");}}function re(n,t){n&1&&r_(0," Delete? ");}function se(n,t){if(n&1){let e=bT();za(0,"span",9),hT(1,le,1,2)(2,re,1,0),Cf(),za(3,"ds-icon-button",10),dc("action",function(){ig(e);let a=NT();return sg(a.onDeleteConfirmed())}),Cf(),za(4,"ds-icon-button",11),dc("action",function(){ig(e);let a=NT();return sg(a.onDeleteCancelled())}),Cf();}if(n&2){let e=NT();yb(),pT(e.namedByAgents()>0?1:2);}}function me(n,t){if(n&1){let e=bT();za(0,"ds-kebab-menu",12),dc("itemSelected",function(a){ig(e);let g=NT();return sg(g.onMenuAction(a))}),Cf();}if(n&2){let e=NT();tv("items",e.isImmutable()?e.readOnlyMenuItems:e.menuItems);}}var w=class n{router=p(It);skill=mc.required();namespaceId=mc(void 0);platformMode=mc(false);readOnly=mc(false);namedByAgents=mc(0);deleteRequested=N$();pendingDelete=ie$1(false);isImmutable=Mi(()=>this.readOnly()||this.skill().readOnly===true);resourceCount=Mi(()=>Object.keys(this.skill().resources??{}).length);menuItems=[{key:"inspect",label:"View skill",icon:"search"},{key:"edit",label:"Edit skill",icon:"edit"},{key:"delete",label:"Delete skill",icon:"delete",variant:"danger"}];readOnlyMenuItems=[{key:"inspect",label:"View skill",icon:"search"}];onMenuAction(t){switch(t){case "inspect":this.router.navigate(this.route("inspect"));break;case "edit":this.router.navigate(this.route("edit"));break;case "delete":this.pendingDelete.set(true);break}}onDeleteConfirmed(){this.pendingDelete.set(false),this.deleteRequested.emit(this.skill());}onDeleteCancelled(){this.pendingDelete.set(false);}route(t){let e=this.skill().id??"";return this.platformMode()?["/agentos","admin","skills",e,t]:["/agentos",this.namespaceId()??"","skills",e,t]}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=vf({type:n,selectors:[["agentos-skill-item"]],inputs:{skill:[1,"skill"],namespaceId:[1,"namespaceId"],platformMode:[1,"platformMode"],readOnly:[1,"readOnly"],namedByAgents:[1,"namedByAgents"]},outputs:{deleteRequested:"deleteRequested"},decls:12,vars:8,consts:[["role","listitem",1,"skill-item"],[1,"skill-item__body"],[1,"skill-item__name-row"],[1,"skill-item__name"],["data-variant","neutral","aria-label","Skill defined by a SKILL.md file, read-only through the API",1,"skill-item__badge"],[1,"skill-item__description"],[1,"skill-item__meta"],[1,"skill-item__actions"],[3,"items"],[1,"skill-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],[3,"itemSelected","items"]],template:function(e,i){e&1&&(za(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),r_(4),Cf(),hT(5,ne,2,0,"span",4),Cf(),hT(6,ie,2,1,"span",5),hT(7,ae,2,2,"span",6),hT(8,oe,2,2,"span",6),Cf(),za(9,"div",7),hT(10,se,5,1)(11,me,1,1,"ds-kebab-menu",8),Cf()()),e&2&&(gv("skill-item--pending-delete",i.pendingDelete()),yb(4),Iv(i.skill().name),yb(),pT(i.skill().readOnly?5:-1),yb(),pT(i.skill().description?6:-1),yb(),pT(i.resourceCount()>0?7:-1),yb(),pT(i.namedByAgents()>0?8:-1),yb(2),pT(i.pendingDelete()?10:11));},dependencies:[Vi,qe],styles:[".skill-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem 1rem;border-radius:10px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--glass-bg, rgba(255, 255, 255, .72));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));backdrop-filter:var(--glass-backdrop-blur, blur(20px));transition:background .15s ease,border-color .15s ease}.skill-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-color:var(--color-primary, #007aff)}.skill-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.skill-item__name-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;min-width:0}.skill-item__name[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text, #1d1d1f);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.skill-item__badge[_ngcontent-%COMP%]{flex-shrink:0;font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:none;border-radius:0;padding:.15rem .5rem;white-space:nowrap}.skill-item__badge[data-variant=neutral][_ngcontent-%COMP%]{border:1px solid var(--color-divider, rgba(0, 0, 0, .12));color:var(--color-neutral-600, #6e6e73);background:transparent}.skill-item__description[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary, #6e6e73);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.skill-item__meta[_ngcontent-%COMP%]{font-size:.7rem;color:var(--color-text-tertiary, #8e8e93)}.skill-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.skill-item[_ngcontent-%COMP%]:hover .skill-item__actions[_ngcontent-%COMP%], .skill-item[_ngcontent-%COMP%]:focus-within .skill-item__actions[_ngcontent-%COMP%], .skill-item--pending-delete[_ngcontent-%COMP%] .skill-item__actions[_ngcontent-%COMP%]{opacity:1}.skill-item__confirm-label[_ngcontent-%COMP%]{font-size:.8rem;font-weight:500;color:var(--color-error, #ff3b30);margin-right:.25rem;white-space:nowrap}"]})};var de=()=>[];function ce(n,t){if(n&1&&(za(0,"p",1),r_(1),Cf()),n&2){let e=NT();yb(),Iv(e.errorMessage());}}function pe(n,t){if(n&1){let e=bT();za(0,"agentos-skill-item",5),dc("deleteRequested",function(a){ig(e);let g=NT(2);return sg(g.deleteSkill(a))}),Cf();}if(n&2){let e=t,i=NT().$implicit,a=NT();tv("skill",e)("namespaceId",a.namespaceId)("readOnly",a.isPlatformSkill(i.id))("namedByAgents",a.namedByAgents(e));}}function ue(n,t){if(n&1&&hT(0,pe,1,4,"agentos-skill-item",4),n&2){let e,i=t.$implicit,a=NT();pT((e=a.resolveSkill(i.id))?0:-1,e);}}var ge="platform",_e="namespace",Y=class n{route=p($t);router=p(It);destroyRef=p(Me);skillState=p(o);agentState=p(s);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new De(void 0);isLoading=ie$1(true);errorMessage=ie$1(null);allSkills$=this.refresh$.pipe(Ae(()=>(this.isLoading.set(true),pw({platform:this.skillState.listPlatform().pipe(Wn(()=>_([]))),namespace:this.skillState.listByNamespace(this.namespaceId),agents:pw({namespace:this.agentState.listByNamespace(this.namespaceId),platform:this.agentState.listPlatform().pipe(Wn(()=>_([])))}).pipe(j(({namespace:t,platform:e})=>[...t,...e]),Wn(()=>_([])))}))),gw({bufferSize:1,refCount:true}));skillItems$=this.allSkills$.pipe(j(({platform:t,namespace:e})=>[...t.map(i=>({id:i.id??"",name:i.name,description:i.description,groupKey:ge,groupLabel:"Platform (read-only)"})),...e.map(i=>({id:i.id??"",name:i.name,description:i.description,groupKey:_e,groupLabel:"Namespace"}))]));namespaceSkillsById=new Map;platformSkillsById=new Map;namedByAgentsByName=new Map;constructor(){this.allSkills$.pipe(U(this.destroyRef)).subscribe({next:({platform:t,namespace:e,agents:i})=>{this.platformSkillsById=new Map(t.map(a=>[a.id??"",a])),this.namespaceSkillsById=new Map(e.map(a=>[a.id??"",a])),this.namedByAgentsByName=this.countNamedBy([...t,...e],i),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}countNamedBy(t,e){let i=new Map;for(let a$1 of t){let g=e.filter(Z=>a(Z.skillSelectors,a$1.name)==="named").length;g>0&&i.set(a$1.name.toLowerCase(),g);}return i}namedByAgents(t){return this.namedByAgentsByName.get(t.name.toLowerCase())??0}goBack(){this.router.navigate(["/agentos","namespaces"]);}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"skills","new"]);}deleteSkill(t){this.errorMessage.set(null),this.skillState.delete(t.id??"").pipe(U(this.destroyRef)).subscribe({next:()=>this.refresh$.next(),error:e=>this.errorMessage.set(e.status===400?`"${t.name}" is defined by a SKILL.md file and cannot be deleted through the API.`:`Deleting "${t.name}" failed.`)});}resolveSkill(t){return this.platformSkillsById.get(t)??this.namespaceSkillsById.get(t)??null}isPlatformSkill(t){return this.platformSkillsById.has(t)}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=vf({type:n,selectors:[["agentos-namespace-skills"]],decls:7,vars:8,consts:[["skillItemTpl",""],["role","alert",1,"namespace-skills__error"],["title","Skills","emptyMessage","No skills defined yet. Add one above, or drop a SKILL.md under the namespace config path.","cardMinWidth","400px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","type","button",1,"namespace-skills__back",3,"click"],[3,"skill","namespaceId","readOnly","namedByAgents"],[3,"deleteRequested","skill","namespaceId","readOnly","namedByAgents"]],template:function(e,i){if(e&1&&(hT(0,ce,2,1,"p",1),za(1,"ds-entity-list",2),v_(2,"async"),dc("createRequested",function(){return i.openCreateForm()}),za(3,"button",3),dc("click",function(){return i.goBack()}),r_(4,"\u2190 Namespaces"),Cf()(),Jy(5,ue,1,1,"ng-template",null,0,I_)),e&2){let a=PT(6);pT(i.errorMessage()?0:-1),yb(),tv("items",E_(2,5,i.skillItems$)??g_(7,de))("loading",i.isLoading())("showCreate",true)("itemTemplate",a);}},dependencies:[gi,w,kM],styles:[".namespace-skills__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.namespace-skills__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.namespace-skills__error[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:.875rem;color:var(--color-error, var(--red, #dc2626))}"]})};export{Y as NamespaceSkillsComponent};
1
+ import {a}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-jDmyV-gc.js';import {u as s,U,o as Vi,r as qe,s as gi}from'./chunk-DaxcKFzm.js';import {p,$ as $t,c as It,M as Me,P as De,i as ie$1,Q as Ae,aq as gw,an as j,v as vf,a7 as mc,a8 as N$,E as Mi,z as za,r as r_,C as Cf,h as hT,q as gv,a as yb,I as Iv,d as pT,Z as pw,a0 as Wn,_,aF as kM,ah as v_,f as dc,a9 as Jy,aa as PT,t as tv,ai as E_,aG as g_,N as NT,ae as Cv,e as bT,k as ig,m as sg,ab as I_}from'./main-NRMJZZ5V.js';function ne(n,t){n&1&&(za(0,"span",4),r_(1,"SKILL.md"),Cf());}function ie(n,t){if(n&1&&(za(0,"span",5),r_(1),Cf()),n&2){let e=NT();yb(),Iv(e.skill().description);}}function ae(n,t){if(n&1&&(za(0,"span",6),r_(1),Cf()),n&2){let e=NT();yb(),Cv(" ",e.resourceCount()," ",e.resourceCount()===1?"resource":"resources"," ");}}function oe(n,t){if(n&1&&(za(0,"span",6),r_(1),Cf()),n&2){let e=NT();yb(),Cv(" named by ",e.namedByAgents()," ",e.namedByAgents()===1?"agent":"agents"," ");}}function le(n,t){if(n&1&&r_(0),n&2){let e=NT(2);Cv(" Delete? ",e.namedByAgents()," ",e.namedByAgents()===1?"agent":"agents"," would be left naming it. ");}}function re(n,t){n&1&&r_(0," Delete? ");}function se(n,t){if(n&1){let e=bT();za(0,"span",9),hT(1,le,1,2)(2,re,1,0),Cf(),za(3,"ds-icon-button",10),dc("action",function(){ig(e);let a=NT();return sg(a.onDeleteConfirmed())}),Cf(),za(4,"ds-icon-button",11),dc("action",function(){ig(e);let a=NT();return sg(a.onDeleteCancelled())}),Cf();}if(n&2){let e=NT();yb(),pT(e.namedByAgents()>0?1:2);}}function me(n,t){if(n&1){let e=bT();za(0,"ds-kebab-menu",12),dc("itemSelected",function(a){ig(e);let g=NT();return sg(g.onMenuAction(a))}),Cf();}if(n&2){let e=NT();tv("items",e.isImmutable()?e.readOnlyMenuItems:e.menuItems);}}var w=class n{router=p(It);skill=mc.required();namespaceId=mc(void 0);platformMode=mc(false);readOnly=mc(false);namedByAgents=mc(0);deleteRequested=N$();pendingDelete=ie$1(false);isImmutable=Mi(()=>this.readOnly()||this.skill().readOnly===true);resourceCount=Mi(()=>Object.keys(this.skill().resources??{}).length);menuItems=[{key:"inspect",label:"View skill",icon:"search"},{key:"edit",label:"Edit skill",icon:"edit"},{key:"delete",label:"Delete skill",icon:"delete",variant:"danger"}];readOnlyMenuItems=[{key:"inspect",label:"View skill",icon:"search"}];onMenuAction(t){switch(t){case "inspect":this.router.navigate(this.route("inspect"));break;case "edit":this.router.navigate(this.route("edit"));break;case "delete":this.pendingDelete.set(true);break}}onDeleteConfirmed(){this.pendingDelete.set(false),this.deleteRequested.emit(this.skill());}onDeleteCancelled(){this.pendingDelete.set(false);}route(t){let e=this.skill().id??"";return this.platformMode()?["/agentos","admin","skills",e,t]:["/agentos",this.namespaceId()??"","skills",e,t]}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=vf({type:n,selectors:[["agentos-skill-item"]],inputs:{skill:[1,"skill"],namespaceId:[1,"namespaceId"],platformMode:[1,"platformMode"],readOnly:[1,"readOnly"],namedByAgents:[1,"namedByAgents"]},outputs:{deleteRequested:"deleteRequested"},decls:12,vars:8,consts:[["role","listitem",1,"skill-item"],[1,"skill-item__body"],[1,"skill-item__name-row"],[1,"skill-item__name"],["data-variant","neutral","aria-label","Skill defined by a SKILL.md file, read-only through the API",1,"skill-item__badge"],[1,"skill-item__description"],[1,"skill-item__meta"],[1,"skill-item__actions"],[3,"items"],[1,"skill-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],[3,"itemSelected","items"]],template:function(e,i){e&1&&(za(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),r_(4),Cf(),hT(5,ne,2,0,"span",4),Cf(),hT(6,ie,2,1,"span",5),hT(7,ae,2,2,"span",6),hT(8,oe,2,2,"span",6),Cf(),za(9,"div",7),hT(10,se,5,1)(11,me,1,1,"ds-kebab-menu",8),Cf()()),e&2&&(gv("skill-item--pending-delete",i.pendingDelete()),yb(4),Iv(i.skill().name),yb(),pT(i.skill().readOnly?5:-1),yb(),pT(i.skill().description?6:-1),yb(),pT(i.resourceCount()>0?7:-1),yb(),pT(i.namedByAgents()>0?8:-1),yb(2),pT(i.pendingDelete()?10:11));},dependencies:[Vi,qe],styles:[".skill-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem 1rem;border-radius:10px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--glass-bg, rgba(255, 255, 255, .72));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));backdrop-filter:var(--glass-backdrop-blur, blur(20px));transition:background .15s ease,border-color .15s ease}.skill-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-color:var(--color-primary, #007aff)}.skill-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.skill-item__name-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;min-width:0}.skill-item__name[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text, #1d1d1f);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.skill-item__badge[_ngcontent-%COMP%]{flex-shrink:0;font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:none;border-radius:0;padding:.15rem .5rem;white-space:nowrap}.skill-item__badge[data-variant=neutral][_ngcontent-%COMP%]{border:1px solid var(--color-divider, rgba(0, 0, 0, .12));color:var(--color-neutral-600, #6e6e73);background:transparent}.skill-item__description[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary, #6e6e73);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.skill-item__meta[_ngcontent-%COMP%]{font-size:.7rem;color:var(--color-text-tertiary, #8e8e93)}.skill-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.skill-item[_ngcontent-%COMP%]:hover .skill-item__actions[_ngcontent-%COMP%], .skill-item[_ngcontent-%COMP%]:focus-within .skill-item__actions[_ngcontent-%COMP%], .skill-item--pending-delete[_ngcontent-%COMP%] .skill-item__actions[_ngcontent-%COMP%]{opacity:1}.skill-item__confirm-label[_ngcontent-%COMP%]{font-size:.8rem;font-weight:500;color:var(--color-error, #ff3b30);margin-right:.25rem;white-space:nowrap}"]})};var de=()=>[];function ce(n,t){if(n&1&&(za(0,"p",1),r_(1),Cf()),n&2){let e=NT();yb(),Iv(e.errorMessage());}}function pe(n,t){if(n&1){let e=bT();za(0,"agentos-skill-item",5),dc("deleteRequested",function(a){ig(e);let g=NT(2);return sg(g.deleteSkill(a))}),Cf();}if(n&2){let e=t,i=NT().$implicit,a=NT();tv("skill",e)("namespaceId",a.namespaceId)("readOnly",a.isPlatformSkill(i.id))("namedByAgents",a.namedByAgents(e));}}function ue(n,t){if(n&1&&hT(0,pe,1,4,"agentos-skill-item",4),n&2){let e,i=t.$implicit,a=NT();pT((e=a.resolveSkill(i.id))?0:-1,e);}}var ge="platform",_e="namespace",Y=class n{route=p($t);router=p(It);destroyRef=p(Me);skillState=p(o);agentState=p(s);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new De(void 0);isLoading=ie$1(true);errorMessage=ie$1(null);allSkills$=this.refresh$.pipe(Ae(()=>(this.isLoading.set(true),pw({platform:this.skillState.listPlatform().pipe(Wn(()=>_([]))),namespace:this.skillState.listByNamespace(this.namespaceId),agents:pw({namespace:this.agentState.listByNamespace(this.namespaceId),platform:this.agentState.listPlatform().pipe(Wn(()=>_([])))}).pipe(j(({namespace:t,platform:e})=>[...t,...e]),Wn(()=>_([])))}))),gw({bufferSize:1,refCount:true}));skillItems$=this.allSkills$.pipe(j(({platform:t,namespace:e})=>[...t.map(i=>({id:i.id??"",name:i.name,description:i.description,groupKey:ge,groupLabel:"Platform (read-only)"})),...e.map(i=>({id:i.id??"",name:i.name,description:i.description,groupKey:_e,groupLabel:"Namespace"}))]));namespaceSkillsById=new Map;platformSkillsById=new Map;namedByAgentsByName=new Map;constructor(){this.allSkills$.pipe(U(this.destroyRef)).subscribe({next:({platform:t,namespace:e,agents:i})=>{this.platformSkillsById=new Map(t.map(a=>[a.id??"",a])),this.namespaceSkillsById=new Map(e.map(a=>[a.id??"",a])),this.namedByAgentsByName=this.countNamedBy([...t,...e],i),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}countNamedBy(t,e){let i=new Map;for(let a$1 of t){let g=e.filter(Z=>a(Z.skillSelectors,a$1.name)==="named").length;g>0&&i.set(a$1.name.toLowerCase(),g);}return i}namedByAgents(t){return this.namedByAgentsByName.get(t.name.toLowerCase())??0}goBack(){this.router.navigate(["/agentos","namespaces"]);}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"skills","new"]);}deleteSkill(t){this.errorMessage.set(null),this.skillState.delete(t.id??"").pipe(U(this.destroyRef)).subscribe({next:()=>this.refresh$.next(),error:e=>this.errorMessage.set(e.status===400?`"${t.name}" is defined by a SKILL.md file and cannot be deleted through the API.`:`Deleting "${t.name}" failed.`)});}resolveSkill(t){return this.platformSkillsById.get(t)??this.namespaceSkillsById.get(t)??null}isPlatformSkill(t){return this.platformSkillsById.has(t)}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=vf({type:n,selectors:[["agentos-namespace-skills"]],decls:7,vars:8,consts:[["skillItemTpl",""],["role","alert",1,"namespace-skills__error"],["title","Skills","emptyMessage","No skills defined yet. Add one above, or drop a SKILL.md under the namespace config path.","cardMinWidth","400px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","type","button",1,"namespace-skills__back",3,"click"],[3,"skill","namespaceId","readOnly","namedByAgents"],[3,"deleteRequested","skill","namespaceId","readOnly","namedByAgents"]],template:function(e,i){if(e&1&&(hT(0,ce,2,1,"p",1),za(1,"ds-entity-list",2),v_(2,"async"),dc("createRequested",function(){return i.openCreateForm()}),za(3,"button",3),dc("click",function(){return i.goBack()}),r_(4,"\u2190 Namespaces"),Cf()(),Jy(5,ue,1,1,"ng-template",null,0,I_)),e&2){let a=PT(6);pT(i.errorMessage()?0:-1),yb(),tv("items",E_(2,5,i.skillItems$)??g_(7,de))("loading",i.isLoading())("showCreate",true)("itemTemplate",a);}},dependencies:[gi,w,kM],styles:[".namespace-skills__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.namespace-skills__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.namespace-skills__error[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:.875rem;color:var(--color-error, var(--red, #dc2626))}"]})};export{Y as NamespaceSkillsComponent};
@@ -1 +1 @@
1
- import {m,$ as $$1,j as ze,v as vt,a as ve$1,U,K as Kn,z as zn,Z as Zn,X as Xn,Y as Ye,c as bt,L as Ln,W as Wn$1,b as pn,V as Vn,y as yn,k as yt,n as Ct}from'./chunk-BEMVRmeG.js';import {p,$ as $t,c as It,M as Me,T as $,i as ie$1,a0 as Wn,_,x,w,v as vf,z as za,f as dc,r as r_,C as Cf,h as hT,a as yb,R as Rf,I as Iv,d as pT,e as bT,l as lc,s as sS,B as yT,a3 as gT,N as NT,t as tv,q as gv,g as cS,D as vT,k as ig,m as sg}from'./main-NXEJVT36.js';var ne=(i,t)=>t.id;function ie(i,t){i&1&&(za(0,"p",5),r_(1,"Loading\u2026"),Cf());}function ae(i,t){i&1&&(za(0,"span",12),r_(1,"Name is required."),Cf());}function le(i,t){if(i&1&&(za(0,"p",32),r_(1),Cf(),za(2,"span",26),r_(3,"Agent Config cannot be changed after creation."),Cf()),i&2){let e=NT(3);yb(),Iv(e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function me(i,t){if(i&1&&(za(0,"option",34),r_(1),Cf()),i&2){let e=t.$implicit;tv("ngValue",e.id),yb(),Iv(e.name);}}function pe(i,t){if(i&1&&(za(0,"select",33)(1,"option",34),r_(2,"\u2014 None \u2014"),Cf(),yT(3,me,2,2,"option",34,ne),Cf(),sS(),za(5,"span",26),r_(6,"Optional. Links this prompt to an agent as a starter. Immutable after creation."),Cf()),i&2){let e=NT(3);tv("formControl",e.agentConfigIdControl),cS(),yb(),tv("ngValue",null),yb(2),vT(e.availableAgentConfigs());}}function de(i,t){if(i&1&&(za(0,"div",8)(1,"label",31),r_(2,"Agent Config"),Cf(),hT(3,le,4,1)(4,pe,7,2),Cf()),i&2){let e=NT(2);yb(3),pT(e.isEditMode()&&e.agentConfigIdControl.value?3:e.isEditMode()?-1:4);}}function ce(i,t){i&1&&(za(0,"p",19),r_(1,"No parameters defined."),Cf());}function se(i,t){i&1&&(za(0,"span",12),r_(1,"Parameter name is required."),Cf());}function _e(i,t){if(i&1){let e=bT();za(0,"div",20)(1,"div",35)(2,"div",36)(3,"label",37),r_(4,"Name "),za(5,"span",10),r_(6,"*"),Cf()(),lc(7,"input",38),sS(),hT(8,se,2,0,"span",12),Cf(),za(9,"div",36)(10,"label",37),r_(11,"Description"),Cf(),lc(12,"input",39),sS(),Cf(),za(13,"div",36)(14,"label",37),r_(15,"Default value"),Cf(),lc(16,"input",40),sS(),Cf()(),za(17,"button",41),dc("click",function(){let m=ig(e).$index,d=NT(2);return sg(d.removeParameter(m))}),r_(18," \xD7 "),Cf()();}if(i&2){let e=t.$implicit,l=t.$index;tv("formGroupName",l),yb(3),tv("for","param-name-"+l),yb(4),gv("prompt-form__input--invalid",e.controls.name.invalid&&e.controls.name.touched),tv("id","param-name-"+l),cS(),yb(),pT(e.controls.name.invalid&&e.controls.name.touched?8:-1),yb(2),tv("for","param-desc-"+l),yb(2),tv("id","param-desc-"+l),cS(),yb(2),tv("for","param-default-"+l),yb(2),tv("id","param-default-"+l),cS();}}function fe(i,t){i&1&&(za(0,"span",12),r_(1,"Content entry must not be blank."),Cf());}function ue(i,t){if(i&1){let e=bT();za(0,"div",22)(1,"span",42),r_(2),Cf(),za(3,"div",43),lc(4,"textarea",44),sS(),hT(5,fe,2,0,"span",12),Cf(),za(6,"button",45),dc("click",function(){let m=ig(e).$index,d=NT(2);return sg(d.removeContentEntry(m))}),r_(7," \xD7 "),Cf()();}if(i&2){let e=t.$implicit,l=t.$index,m=NT(2);yb(2),Iv(l+1),yb(2),gv("prompt-form__textarea--invalid",e.invalid&&e.touched),tv("formControlName",l),cS(),yb(),pT(e.invalid&&e.touched?5:-1),yb(),tv("disabled",m.contentArray.length===1);}}function ge(i,t){if(i&1&&(za(0,"p",23),r_(1),Cf()),i&2){let e=NT(2);yb(),Iv(e.errorMessage());}}function Ce(i,t){i&1&&(za(0,"span",12),r_(1,"Invalid JSON."),Cf());}function xe(i,t){if(i&1){let e=bT();za(0,"button",46),dc("click",function(){ig(e);let m=NT(2);return sg(m.exportYaml())}),r_(1),Cf();}if(i&2){let e=NT(2);tv("disabled",e.isExporting()),yb(),Rf(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function ve(i,t){if(i&1){let e=bT();za(0,"form",7),dc("ngSubmit",function(){ig(e);let m=NT();return sg(m.submit())}),za(1,"div",8)(2,"label",9),r_(3,"Name "),za(4,"span",10),r_(5,"*"),Cf()(),lc(6,"input",11),sS(),hT(7,ae,2,0,"span",12),Cf(),za(8,"div",8)(9,"label",13),r_(10,"Description"),Cf(),lc(11,"input",14),sS(),Cf(),hT(12,de,5,1,"div",8),za(13,"fieldset",15)(14,"legend",16),r_(15," Parameters "),za(16,"span",17),r_(17,"Named placeholders used in content"),Cf()(),za(18,"p",18),r_(19," Each parameter must have a name and a default value. Use "),za(20,"code"),r_(21),Cf(),r_(22," in content entries to reference them. "),Cf(),hT(23,ce,2,0,"p",19),yT(24,_e,19,10,"div",20,gT),za(26,"button",21),dc("click",function(){ig(e);let m=NT();return sg(m.addParameter())}),r_(27,"+ Add parameter"),Cf()(),za(28,"fieldset",15)(29,"legend",16),r_(30," Content "),za(31,"span",10),r_(32,"*"),Cf(),za(33,"span",17),r_(34,"Ordered list of text commands"),Cf()(),za(35,"p",18),r_(36," Each content entry is a command. Use "),za(37,"code"),r_(38,"@AgentName"),Cf(),r_(39," to target an agent, "),za(40,"code"),r_(41,"/promptName param1 param2"),Cf(),r_(42," to call another prompt, and "),za(43,"code"),r_(44),Cf(),r_(45," for parameter placeholders. "),Cf(),yT(46,ue,8,6,"div",22,gT),za(48,"button",21),dc("click",function(){ig(e);let m=NT();return sg(m.addContentEntry())}),r_(49,"+ Add content entry"),Cf()(),hT(50,ge,2,1,"p",23),za(51,"div",8)(52,"label",24),r_(53,"External Metadata"),Cf(),lc(54,"textarea",25),sS(),hT(55,Ce,2,0,"span",12),za(56,"span",26),r_(57,"Optional. Opaque JSON object stored as-is. Leave empty to clear."),Cf()(),za(58,"div",27)(59,"button",28),r_(60),Cf(),hT(61,xe,2,2,"button",29),za(62,"button",30),dc("click",function(){ig(e);let m=NT();return sg(m.cancel())}),r_(63,"Cancel"),Cf()()();}if(i&2){let e=NT();tv("formGroup",e.form),yb(6),gv("prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),tv("formControl",e.nameControl),cS(),yb(),pT(e.nameControl.invalid&&e.nameControl.touched?7:-1),yb(4),tv("formControl",e.descriptionControl),cS(),yb(),pT(e.availableAgentConfigs().length>0?12:-1),yb(),tv("formArrayName","parameters"),yb(8),Iv(e.paramPlaceholderSyntax),yb(2),pT(e.parametersArray.length===0?23:-1),yb(),vT(e.parametersArray.controls),yb(4),tv("formArrayName","content"),yb(16),Iv(e.paramPlaceholderSyntax),yb(2),vT(e.contentArray.controls),yb(4),pT(e.errorMessage()?50:-1),yb(4),tv("formControl",e.externalMetadataJsonControl),cS(),yb(),pT(e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?55:-1),yb(4),tv("disabled",e.form.invalid||e.isSubmitting()),yb(),Rf(" ",e.isEditMode()?"Save changes":"Create"," "),yb(),pT(e.isEditMode()?61:-1);}}var re=class i{route=p($t);router=p(It);destroyRef=p(Me);promptState=p(m);agentConfigController=p($);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new $$1({name:new vt("",{nonNullable:true,validators:[ve$1.required,ve$1.minLength(1)]}),description:new vt(null),agentConfigId:new vt(null),externalMetadataJson:new vt("",{nonNullable:true,validators:[be]}),content:new ze([this.createContentControl()],{validators:[ve$1.required]}),parameters:new ze([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=ie$1(false);isSubmitting=ie$1(false);isLoading=ie$1(false);isExporting=ie$1(false);errorMessage=ie$1(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=ie$1([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(true),this.loadPrompt(t)),this.isPlatformMode?this.loadPlatformAgentConfigs():this.namespaceId&&this.loadAgentConfigs(this.namespaceId);}loadPrompt(t){this.isLoading.set(true),this.promptState.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadAgentConfigs(t){this.agentConfigController.listByParentAgentConfig(t).pipe(U(this.destroyRef),Wn(()=>_([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U(this.destroyRef),Wn(()=>_([]))).subscribe(t=>this.agentConfigs.set(t));}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(l=>this.contentArray.push(this.createContentControl(l))),this.parametersArray.clear(),(t.parameters??[]).forEach(l=>this.parametersArray.push(this.createParameterGroup(l))),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}createContentControl(t=""){return new vt(t,{nonNullable:true,validators:[ve$1.required,ve$1.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl());}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t);}createParameterGroup(t){return new $$1({name:new vt(t?.name??"",{nonNullable:true,validators:[ve$1.required,ve$1.minLength(1)]}),description:new vt(t?.description??null),defaultValue:new vt(t?.defaultValue??"",{nonNullable:true,validators:[ve$1.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup());}removeParameter(t){this.parametersArray.removeAt(t);}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId,sourceLanguage:this.existingPrompt?.sourceLanguage??"en",name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(d=>d.value.trim()),parameters:this.parametersArray.controls.map(d=>({name:d.controls.name.value.trim(),description:d.controls.description.value?.trim()||void 0,defaultValue:d.controls.defaultValue.value.trim()}))});t||(e.agentConfigId=this.agentConfigIdControl.value||null);let l=this.externalMetadataJsonControl.value.trim();e.externalMetadata=l?JSON.parse(l):null;let m=t?this.promptState.update(this.existingPrompt.id,e):this.promptState.create(e);this.errorMessage.set(null),m.pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:d=>{this.isSubmitting.set(false),d.status===409?this.errorMessage.set(`A prompt named "${e.name}" already exists in this scope.`):d.status===400?this.errorMessage.set(d.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}exportYaml(){let t=this.existingPrompt?.id;!t||this.isExporting()||(this.isExporting.set(true),this.promptState.exportAsYaml(t).pipe(U(this.destroyRef)).subscribe({next:e=>{let l=new Blob([e],{type:"application/yaml"}),m=URL.createObjectURL(l),d=document.createElement("a");d.href=m,d.download=`${this.existingPrompt?.name??"prompt"}.yaml`,d.click(),URL.revokeObjectURL(m),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"]);}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=vf({type:i,selectors:[["agentos-prompt-form"]],decls:10,vars:3,consts:[[1,"prompt-form"],[1,"prompt-form__header"],["type","button","title","Back to prompts",1,"prompt-form__back",3,"click"],[1,"prompt-form__back-icon"],[1,"prompt-form__title"],[1,"prompt-form__loading"],[1,"prompt-form__form",3,"formGroup"],[1,"prompt-form__form",3,"ngSubmit","formGroup"],[1,"prompt-form__field"],["for","prompt-name",1,"prompt-form__label"],["aria-hidden","true"],["id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",1,"prompt-form__input",3,"formControl"],[1,"prompt-form__field-error"],["for","prompt-description",1,"prompt-form__label"],["id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",1,"prompt-form__input",3,"formControl"],[1,"prompt-form__section",3,"formArrayName"],[1,"prompt-form__label"],[1,"prompt-form__label-hint"],[1,"prompt-form__section-hint"],[1,"prompt-form__empty-hint"],[1,"prompt-form__param-row",3,"formGroupName"],["type","button",1,"prompt-form__add-btn",3,"click"],[1,"prompt-form__content-row"],[1,"prompt-form__error"],["for","prompt-external-metadata",1,"prompt-form__label"],["id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",1,"prompt-form__textarea","prompt-form__textarea--code",3,"formControl"],[1,"prompt-form__field-hint"],[1,"prompt-form__actions"],["type","submit",1,"prompt-form__btn","prompt-form__btn--primary",3,"disabled"],["type","button",1,"prompt-form__btn","prompt-form__btn--export",3,"disabled"],["type","button",1,"prompt-form__btn",3,"click"],["for","prompt-agent-config",1,"prompt-form__label"],[1,"prompt-form__readonly-value"],["id","prompt-agent-config",1,"prompt-form__select",3,"formControl"],[3,"ngValue"],[1,"prompt-form__param-fields"],[1,"prompt-form__field","prompt-form__field--inline"],[1,"prompt-form__label",3,"for"],["type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",1,"prompt-form__input",3,"id"],["type","text","placeholder","Optional","formControlName","description","autocomplete","off",1,"prompt-form__input",3,"id"],["type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",1,"prompt-form__input",3,"id"],["type","button","title","Remove this parameter",1,"prompt-form__remove-btn",3,"click"],[1,"prompt-form__content-index"],[1,"prompt-form__content-field"],["rows","4","placeholder","Enter a command\u2026",1,"prompt-form__textarea",3,"formControlName"],["type","button","title","Remove this entry",1,"prompt-form__remove-btn",3,"click","disabled"],["type","button",1,"prompt-form__btn","prompt-form__btn--export",3,"click","disabled"]],template:function(e,l){e&1&&(za(0,"div",0)(1,"header",1)(2,"button",2),dc("click",function(){return l.cancel()}),za(3,"span",3),r_(4,"\u2190"),Cf(),r_(5),Cf(),za(6,"h1",4),r_(7),Cf()(),hT(8,ie,2,0,"p",5)(9,ve,64,18,"form",6),Cf()),e&2&&(yb(5),Rf(" ",l.isPlatformMode?"Platform prompts":"Prompts"," "),yb(2),Iv(l.isEditMode()?"Edit prompt":"New prompt"),yb(),pT(l.isLoading()?8:9));},dependencies:[Kn,zn,Zn,Xn,Ye,bt,Ln,Wn$1,pn,Vn,yn,yt,Ct],styles:[".prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.prompt-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.prompt-form__field--inline[_ngcontent-%COMP%]{flex:1}.prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.prompt-form__label-hint[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary);margin-left:.375rem}.prompt-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;cursor:pointer;appearance:auto;transition:border-color .15s ease}.prompt-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;padding:.5rem .875rem;border-radius:0;background:var(--color-bg-hover);border:1px solid var(--color-divider);color:var(--color-text);font-size:.9375rem}.prompt-form__input[_ngcontent-%COMP%], .prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.prompt-form__input[_ngcontent-%COMP%]:focus, .prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.prompt-form__input[_ngcontent-%COMP%]::placeholder, .prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.prompt-form__textarea--code[_ngcontent-%COMP%]{font-family:monospace;font-size:.85rem;resize:vertical}.prompt-form__section[_ngcontent-%COMP%]{border:1px solid var(--color-divider);border-radius:0;padding:1rem;margin:0;display:flex;flex-direction:column;gap:.75rem}.prompt-form__section-hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.prompt-form__empty-hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}.prompt-form__content-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-start}.prompt-form__content-field[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.25rem}.prompt-form__content-index[_ngcontent-%COMP%]{flex-shrink:0;width:1.5rem;padding-top:.6rem;font-size:.8rem;font-weight:600;color:var(--color-text-secondary);text-align:right;-webkit-user-select:none;user-select:none}.prompt-form__param-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-end;padding:.75rem;border-radius:0;background:var(--color-bg-hover)}.prompt-form__param-fields[_ngcontent-%COMP%]{flex:1;display:flex;gap:.75rem;flex-wrap:wrap}.prompt-form__add-btn[_ngcontent-%COMP%]{align-self:flex-start;padding:.4rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-accent);font-size:.875rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.prompt-form__add-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-accent)}.prompt-form__remove-btn[_ngcontent-%COMP%]{flex-shrink:0;width:1.75rem;height:1.75rem;display:flex;align-items:center;justify-content:center;border-radius:0;border:1px solid transparent;background:transparent;color:var(--color-neutral-500);font-size:1rem;line-height:1;cursor:pointer;transition:background .15s ease,color .15s ease,border-color .15s ease}.prompt-form__remove-btn[_ngcontent-%COMP%]:hover:not(:disabled){background:color-mix(in srgb,var(--red) 10%,transparent);color:var(--red);border-color:var(--red)}.prompt-form__remove-btn[_ngcontent-%COMP%]:disabled{opacity:.3;cursor:not-allowed}.prompt-form__error[_ngcontent-%COMP%]{margin:0;padding:.625rem .875rem;border-radius:0;background:color-mix(in srgb,var(--red) 10%,transparent);border:1px solid var(--red);color:var(--red);font-size:.875rem;line-height:1.4}.prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--red);line-height:1.3}.prompt-form__input--invalid[_ngcontent-%COMP%], .prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--red)}.prompt-form__input--invalid[_ngcontent-%COMP%]:focus, .prompt-form__textarea--invalid[_ngcontent-%COMP%]:focus{border-color:var(--red)}.prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}.prompt-form__btn--export[_ngcontent-%COMP%]{border-color:var(--color-divider);color:var(--color-text-secondary)}.prompt-form__btn--export[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--color-accent);color:var(--color-accent)}"]})};function be(i){let t=i.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}export{re as PromptFormComponent};
1
+ import {m,$ as $$1,j as ze,v as vt,a as ve$1,U,K as Kn,z as zn,Z as Zn,X as Xn,Y as Ye,c as bt,L as Ln,W as Wn$1,b as pn,V as Vn,y as yn,k as yt,n as Ct}from'./chunk-DaxcKFzm.js';import {p,$ as $t,c as It,M as Me,T as $,i as ie$1,a0 as Wn,_,x,w,v as vf,z as za,f as dc,r as r_,C as Cf,h as hT,a as yb,R as Rf,I as Iv,d as pT,e as bT,l as lc,s as sS,B as yT,a3 as gT,N as NT,t as tv,q as gv,g as cS,D as vT,k as ig,m as sg}from'./main-NRMJZZ5V.js';var ne=(i,t)=>t.id;function ie(i,t){i&1&&(za(0,"p",5),r_(1,"Loading\u2026"),Cf());}function ae(i,t){i&1&&(za(0,"span",12),r_(1,"Name is required."),Cf());}function le(i,t){if(i&1&&(za(0,"p",32),r_(1),Cf(),za(2,"span",26),r_(3,"Agent Config cannot be changed after creation."),Cf()),i&2){let e=NT(3);yb(),Iv(e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function me(i,t){if(i&1&&(za(0,"option",34),r_(1),Cf()),i&2){let e=t.$implicit;tv("ngValue",e.id),yb(),Iv(e.name);}}function pe(i,t){if(i&1&&(za(0,"select",33)(1,"option",34),r_(2,"\u2014 None \u2014"),Cf(),yT(3,me,2,2,"option",34,ne),Cf(),sS(),za(5,"span",26),r_(6,"Optional. Links this prompt to an agent as a starter. Immutable after creation."),Cf()),i&2){let e=NT(3);tv("formControl",e.agentConfigIdControl),cS(),yb(),tv("ngValue",null),yb(2),vT(e.availableAgentConfigs());}}function de(i,t){if(i&1&&(za(0,"div",8)(1,"label",31),r_(2,"Agent Config"),Cf(),hT(3,le,4,1)(4,pe,7,2),Cf()),i&2){let e=NT(2);yb(3),pT(e.isEditMode()&&e.agentConfigIdControl.value?3:e.isEditMode()?-1:4);}}function ce(i,t){i&1&&(za(0,"p",19),r_(1,"No parameters defined."),Cf());}function se(i,t){i&1&&(za(0,"span",12),r_(1,"Parameter name is required."),Cf());}function _e(i,t){if(i&1){let e=bT();za(0,"div",20)(1,"div",35)(2,"div",36)(3,"label",37),r_(4,"Name "),za(5,"span",10),r_(6,"*"),Cf()(),lc(7,"input",38),sS(),hT(8,se,2,0,"span",12),Cf(),za(9,"div",36)(10,"label",37),r_(11,"Description"),Cf(),lc(12,"input",39),sS(),Cf(),za(13,"div",36)(14,"label",37),r_(15,"Default value"),Cf(),lc(16,"input",40),sS(),Cf()(),za(17,"button",41),dc("click",function(){let m=ig(e).$index,d=NT(2);return sg(d.removeParameter(m))}),r_(18," \xD7 "),Cf()();}if(i&2){let e=t.$implicit,l=t.$index;tv("formGroupName",l),yb(3),tv("for","param-name-"+l),yb(4),gv("prompt-form__input--invalid",e.controls.name.invalid&&e.controls.name.touched),tv("id","param-name-"+l),cS(),yb(),pT(e.controls.name.invalid&&e.controls.name.touched?8:-1),yb(2),tv("for","param-desc-"+l),yb(2),tv("id","param-desc-"+l),cS(),yb(2),tv("for","param-default-"+l),yb(2),tv("id","param-default-"+l),cS();}}function fe(i,t){i&1&&(za(0,"span",12),r_(1,"Content entry must not be blank."),Cf());}function ue(i,t){if(i&1){let e=bT();za(0,"div",22)(1,"span",42),r_(2),Cf(),za(3,"div",43),lc(4,"textarea",44),sS(),hT(5,fe,2,0,"span",12),Cf(),za(6,"button",45),dc("click",function(){let m=ig(e).$index,d=NT(2);return sg(d.removeContentEntry(m))}),r_(7," \xD7 "),Cf()();}if(i&2){let e=t.$implicit,l=t.$index,m=NT(2);yb(2),Iv(l+1),yb(2),gv("prompt-form__textarea--invalid",e.invalid&&e.touched),tv("formControlName",l),cS(),yb(),pT(e.invalid&&e.touched?5:-1),yb(),tv("disabled",m.contentArray.length===1);}}function ge(i,t){if(i&1&&(za(0,"p",23),r_(1),Cf()),i&2){let e=NT(2);yb(),Iv(e.errorMessage());}}function Ce(i,t){i&1&&(za(0,"span",12),r_(1,"Invalid JSON."),Cf());}function xe(i,t){if(i&1){let e=bT();za(0,"button",46),dc("click",function(){ig(e);let m=NT(2);return sg(m.exportYaml())}),r_(1),Cf();}if(i&2){let e=NT(2);tv("disabled",e.isExporting()),yb(),Rf(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function ve(i,t){if(i&1){let e=bT();za(0,"form",7),dc("ngSubmit",function(){ig(e);let m=NT();return sg(m.submit())}),za(1,"div",8)(2,"label",9),r_(3,"Name "),za(4,"span",10),r_(5,"*"),Cf()(),lc(6,"input",11),sS(),hT(7,ae,2,0,"span",12),Cf(),za(8,"div",8)(9,"label",13),r_(10,"Description"),Cf(),lc(11,"input",14),sS(),Cf(),hT(12,de,5,1,"div",8),za(13,"fieldset",15)(14,"legend",16),r_(15," Parameters "),za(16,"span",17),r_(17,"Named placeholders used in content"),Cf()(),za(18,"p",18),r_(19," Each parameter must have a name and a default value. Use "),za(20,"code"),r_(21),Cf(),r_(22," in content entries to reference them. "),Cf(),hT(23,ce,2,0,"p",19),yT(24,_e,19,10,"div",20,gT),za(26,"button",21),dc("click",function(){ig(e);let m=NT();return sg(m.addParameter())}),r_(27,"+ Add parameter"),Cf()(),za(28,"fieldset",15)(29,"legend",16),r_(30," Content "),za(31,"span",10),r_(32,"*"),Cf(),za(33,"span",17),r_(34,"Ordered list of text commands"),Cf()(),za(35,"p",18),r_(36," Each content entry is a command. Use "),za(37,"code"),r_(38,"@AgentName"),Cf(),r_(39," to target an agent, "),za(40,"code"),r_(41,"/promptName param1 param2"),Cf(),r_(42," to call another prompt, and "),za(43,"code"),r_(44),Cf(),r_(45," for parameter placeholders. "),Cf(),yT(46,ue,8,6,"div",22,gT),za(48,"button",21),dc("click",function(){ig(e);let m=NT();return sg(m.addContentEntry())}),r_(49,"+ Add content entry"),Cf()(),hT(50,ge,2,1,"p",23),za(51,"div",8)(52,"label",24),r_(53,"External Metadata"),Cf(),lc(54,"textarea",25),sS(),hT(55,Ce,2,0,"span",12),za(56,"span",26),r_(57,"Optional. Opaque JSON object stored as-is. Leave empty to clear."),Cf()(),za(58,"div",27)(59,"button",28),r_(60),Cf(),hT(61,xe,2,2,"button",29),za(62,"button",30),dc("click",function(){ig(e);let m=NT();return sg(m.cancel())}),r_(63,"Cancel"),Cf()()();}if(i&2){let e=NT();tv("formGroup",e.form),yb(6),gv("prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),tv("formControl",e.nameControl),cS(),yb(),pT(e.nameControl.invalid&&e.nameControl.touched?7:-1),yb(4),tv("formControl",e.descriptionControl),cS(),yb(),pT(e.availableAgentConfigs().length>0?12:-1),yb(),tv("formArrayName","parameters"),yb(8),Iv(e.paramPlaceholderSyntax),yb(2),pT(e.parametersArray.length===0?23:-1),yb(),vT(e.parametersArray.controls),yb(4),tv("formArrayName","content"),yb(16),Iv(e.paramPlaceholderSyntax),yb(2),vT(e.contentArray.controls),yb(4),pT(e.errorMessage()?50:-1),yb(4),tv("formControl",e.externalMetadataJsonControl),cS(),yb(),pT(e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?55:-1),yb(4),tv("disabled",e.form.invalid||e.isSubmitting()),yb(),Rf(" ",e.isEditMode()?"Save changes":"Create"," "),yb(),pT(e.isEditMode()?61:-1);}}var re=class i{route=p($t);router=p(It);destroyRef=p(Me);promptState=p(m);agentConfigController=p($);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new $$1({name:new vt("",{nonNullable:true,validators:[ve$1.required,ve$1.minLength(1)]}),description:new vt(null),agentConfigId:new vt(null),externalMetadataJson:new vt("",{nonNullable:true,validators:[be]}),content:new ze([this.createContentControl()],{validators:[ve$1.required]}),parameters:new ze([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=ie$1(false);isSubmitting=ie$1(false);isLoading=ie$1(false);isExporting=ie$1(false);errorMessage=ie$1(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=ie$1([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(true),this.loadPrompt(t)),this.isPlatformMode?this.loadPlatformAgentConfigs():this.namespaceId&&this.loadAgentConfigs(this.namespaceId);}loadPrompt(t){this.isLoading.set(true),this.promptState.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadAgentConfigs(t){this.agentConfigController.listByParentAgentConfig(t).pipe(U(this.destroyRef),Wn(()=>_([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U(this.destroyRef),Wn(()=>_([]))).subscribe(t=>this.agentConfigs.set(t));}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(l=>this.contentArray.push(this.createContentControl(l))),this.parametersArray.clear(),(t.parameters??[]).forEach(l=>this.parametersArray.push(this.createParameterGroup(l))),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}createContentControl(t=""){return new vt(t,{nonNullable:true,validators:[ve$1.required,ve$1.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl());}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t);}createParameterGroup(t){return new $$1({name:new vt(t?.name??"",{nonNullable:true,validators:[ve$1.required,ve$1.minLength(1)]}),description:new vt(t?.description??null),defaultValue:new vt(t?.defaultValue??"",{nonNullable:true,validators:[ve$1.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup());}removeParameter(t){this.parametersArray.removeAt(t);}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId,sourceLanguage:this.existingPrompt?.sourceLanguage??"en",name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(d=>d.value.trim()),parameters:this.parametersArray.controls.map(d=>({name:d.controls.name.value.trim(),description:d.controls.description.value?.trim()||void 0,defaultValue:d.controls.defaultValue.value.trim()}))});t||(e.agentConfigId=this.agentConfigIdControl.value||null);let l=this.externalMetadataJsonControl.value.trim();e.externalMetadata=l?JSON.parse(l):null;let m=t?this.promptState.update(this.existingPrompt.id,e):this.promptState.create(e);this.errorMessage.set(null),m.pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:d=>{this.isSubmitting.set(false),d.status===409?this.errorMessage.set(`A prompt named "${e.name}" already exists in this scope.`):d.status===400?this.errorMessage.set(d.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}exportYaml(){let t=this.existingPrompt?.id;!t||this.isExporting()||(this.isExporting.set(true),this.promptState.exportAsYaml(t).pipe(U(this.destroyRef)).subscribe({next:e=>{let l=new Blob([e],{type:"application/yaml"}),m=URL.createObjectURL(l),d=document.createElement("a");d.href=m,d.download=`${this.existingPrompt?.name??"prompt"}.yaml`,d.click(),URL.revokeObjectURL(m),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"]);}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=vf({type:i,selectors:[["agentos-prompt-form"]],decls:10,vars:3,consts:[[1,"prompt-form"],[1,"prompt-form__header"],["type","button","title","Back to prompts",1,"prompt-form__back",3,"click"],[1,"prompt-form__back-icon"],[1,"prompt-form__title"],[1,"prompt-form__loading"],[1,"prompt-form__form",3,"formGroup"],[1,"prompt-form__form",3,"ngSubmit","formGroup"],[1,"prompt-form__field"],["for","prompt-name",1,"prompt-form__label"],["aria-hidden","true"],["id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",1,"prompt-form__input",3,"formControl"],[1,"prompt-form__field-error"],["for","prompt-description",1,"prompt-form__label"],["id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",1,"prompt-form__input",3,"formControl"],[1,"prompt-form__section",3,"formArrayName"],[1,"prompt-form__label"],[1,"prompt-form__label-hint"],[1,"prompt-form__section-hint"],[1,"prompt-form__empty-hint"],[1,"prompt-form__param-row",3,"formGroupName"],["type","button",1,"prompt-form__add-btn",3,"click"],[1,"prompt-form__content-row"],[1,"prompt-form__error"],["for","prompt-external-metadata",1,"prompt-form__label"],["id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",1,"prompt-form__textarea","prompt-form__textarea--code",3,"formControl"],[1,"prompt-form__field-hint"],[1,"prompt-form__actions"],["type","submit",1,"prompt-form__btn","prompt-form__btn--primary",3,"disabled"],["type","button",1,"prompt-form__btn","prompt-form__btn--export",3,"disabled"],["type","button",1,"prompt-form__btn",3,"click"],["for","prompt-agent-config",1,"prompt-form__label"],[1,"prompt-form__readonly-value"],["id","prompt-agent-config",1,"prompt-form__select",3,"formControl"],[3,"ngValue"],[1,"prompt-form__param-fields"],[1,"prompt-form__field","prompt-form__field--inline"],[1,"prompt-form__label",3,"for"],["type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",1,"prompt-form__input",3,"id"],["type","text","placeholder","Optional","formControlName","description","autocomplete","off",1,"prompt-form__input",3,"id"],["type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",1,"prompt-form__input",3,"id"],["type","button","title","Remove this parameter",1,"prompt-form__remove-btn",3,"click"],[1,"prompt-form__content-index"],[1,"prompt-form__content-field"],["rows","4","placeholder","Enter a command\u2026",1,"prompt-form__textarea",3,"formControlName"],["type","button","title","Remove this entry",1,"prompt-form__remove-btn",3,"click","disabled"],["type","button",1,"prompt-form__btn","prompt-form__btn--export",3,"click","disabled"]],template:function(e,l){e&1&&(za(0,"div",0)(1,"header",1)(2,"button",2),dc("click",function(){return l.cancel()}),za(3,"span",3),r_(4,"\u2190"),Cf(),r_(5),Cf(),za(6,"h1",4),r_(7),Cf()(),hT(8,ie,2,0,"p",5)(9,ve,64,18,"form",6),Cf()),e&2&&(yb(5),Rf(" ",l.isPlatformMode?"Platform prompts":"Prompts"," "),yb(2),Iv(l.isEditMode()?"Edit prompt":"New prompt"),yb(),pT(l.isLoading()?8:9));},dependencies:[Kn,zn,Zn,Xn,Ye,bt,Ln,Wn$1,pn,Vn,yn,yt,Ct],styles:[".prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.prompt-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.prompt-form__field--inline[_ngcontent-%COMP%]{flex:1}.prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.prompt-form__label-hint[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary);margin-left:.375rem}.prompt-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;cursor:pointer;appearance:auto;transition:border-color .15s ease}.prompt-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;padding:.5rem .875rem;border-radius:0;background:var(--color-bg-hover);border:1px solid var(--color-divider);color:var(--color-text);font-size:.9375rem}.prompt-form__input[_ngcontent-%COMP%], .prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.prompt-form__input[_ngcontent-%COMP%]:focus, .prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.prompt-form__input[_ngcontent-%COMP%]::placeholder, .prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.prompt-form__textarea--code[_ngcontent-%COMP%]{font-family:monospace;font-size:.85rem;resize:vertical}.prompt-form__section[_ngcontent-%COMP%]{border:1px solid var(--color-divider);border-radius:0;padding:1rem;margin:0;display:flex;flex-direction:column;gap:.75rem}.prompt-form__section-hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.prompt-form__empty-hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}.prompt-form__content-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-start}.prompt-form__content-field[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.25rem}.prompt-form__content-index[_ngcontent-%COMP%]{flex-shrink:0;width:1.5rem;padding-top:.6rem;font-size:.8rem;font-weight:600;color:var(--color-text-secondary);text-align:right;-webkit-user-select:none;user-select:none}.prompt-form__param-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-end;padding:.75rem;border-radius:0;background:var(--color-bg-hover)}.prompt-form__param-fields[_ngcontent-%COMP%]{flex:1;display:flex;gap:.75rem;flex-wrap:wrap}.prompt-form__add-btn[_ngcontent-%COMP%]{align-self:flex-start;padding:.4rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-accent);font-size:.875rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.prompt-form__add-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-accent)}.prompt-form__remove-btn[_ngcontent-%COMP%]{flex-shrink:0;width:1.75rem;height:1.75rem;display:flex;align-items:center;justify-content:center;border-radius:0;border:1px solid transparent;background:transparent;color:var(--color-neutral-500);font-size:1rem;line-height:1;cursor:pointer;transition:background .15s ease,color .15s ease,border-color .15s ease}.prompt-form__remove-btn[_ngcontent-%COMP%]:hover:not(:disabled){background:color-mix(in srgb,var(--red) 10%,transparent);color:var(--red);border-color:var(--red)}.prompt-form__remove-btn[_ngcontent-%COMP%]:disabled{opacity:.3;cursor:not-allowed}.prompt-form__error[_ngcontent-%COMP%]{margin:0;padding:.625rem .875rem;border-radius:0;background:color-mix(in srgb,var(--red) 10%,transparent);border:1px solid var(--red);color:var(--red);font-size:.875rem;line-height:1.4}.prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--red);line-height:1.3}.prompt-form__input--invalid[_ngcontent-%COMP%], .prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--red)}.prompt-form__input--invalid[_ngcontent-%COMP%]:focus, .prompt-form__textarea--invalid[_ngcontent-%COMP%]:focus{border-color:var(--red)}.prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}.prompt-form__btn--export[_ngcontent-%COMP%]{border-color:var(--color-divider);color:var(--color-text-secondary)}.prompt-form__btn--export[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--color-accent);color:var(--color-accent)}"]})};function be(i){let t=i.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}export{re as PromptFormComponent};
@@ -1 +1 @@
1
- import {R}from'./chunk-BrXPglDw.js';import {p,c as It,M as Me,P as De,i as ie,Q as Ae,E as Mi,v as vf,a7 as mc,a8 as N$,z as za,r as r_,C as Cf,h as hT,a as yb,I as Iv,d as pT,f as dc,a9 as Jy,t as tv,N as NT,u as uc,R as Rf,e as bT,l as lc,aa as PT,k as ig,m as sg,ab as I_}from'./main-NXEJVT36.js';import {i,O,U,o as Vi,r as qe,s as gi,h as vi,P as P$1}from'./chunk-BEMVRmeG.js';import'./chunk-tJcOqYO8.js';function W(n,e){if(n&1&&(za(0,"span",4),r_(1),Cf()),n&2){let t=NT();uc("data-variant",t.badge().variant)("aria-label",t.badge().ariaLabel),yb(),Rf(" ",t.badge().label," ");}}function J(n,e){if(n&1){let t=bT();za(0,"span",7),r_(1,"Delete?"),Cf(),za(2,"ds-icon-button",8),dc("action",function(){ig(t);let l=NT();return sg(l.onDeleteConfirmed())}),Cf(),za(3,"ds-icon-button",9),dc("action",function(){ig(t);let l=NT();return sg(l.onDeleteCancelled())}),Cf();}if(n&2){let t=NT();yb(2),tv("title",t.isDeleting()?"Deleting\u2026":"Confirm deletion")("disabled",t.isDeleting()),yb(),tv("disabled",t.isDeleting());}}function Q(n,e){if(n&1){let t=bT();za(0,"ds-kebab-menu",12),dc("itemSelected",function(l){ig(t);let b=NT(2);return sg(b.onMenuAction(l))}),Cf();}if(n&2){let t=NT(2);tv("items",t.menuItems());}}function X(n,e){if(n&1){let t=bT();za(0,"ds-icon-button",10),dc("action",function(){ig(t);let l=NT();return sg(l.onDuplicate())}),Cf(),hT(1,Q,1,1,"ds-kebab-menu",11);}if(n&2){let t=NT();yb(),pT(t.readOnly()?-1:1);}}var Y=Object.freeze({platform:{label:"PLATFORM",ariaLabel:"Configuration plateforme (lecture seule)",variant:"neutral"},namespace:{label:"NS",ariaLabel:"Configuration partag\xE9e du namespace",variant:"neutral"},userOnNs:{label:"USER \xD7 NS",ariaLabel:"Configuration utilisateur sur ce namespace",variant:"info"},userGlobal:{label:"USER GLOBAL",ariaLabel:"Configuration utilisateur globale",variant:"warning"}}),P=class n{config=mc.required();scope=mc.required();readOnly=mc(false);showBadge=mc(true);deleteState=mc(null);editRequested=N$();deleteRequested=N$();duplicateRequested=N$();pendingDelete=ie(false);isConfirmingDelete=Mi(()=>this.deleteState()?this.deleteState().confirmingId()===this.config().id:this.pendingDelete());isDeleting=Mi(()=>this.deleteState()?.deletingId()===this.config().id);badge=Mi(()=>Y[this.scope()]);menuItems=Mi(()=>[{key:"edit",label:"Edit auth setting",icon:"edit"},{key:"delete",label:"Delete auth setting",icon:"delete",variant:"danger"}]);onMenuAction(e){switch(e){case "edit":this.editRequested.emit(this.config());break;case "delete":{let t=this.deleteState(),i=this.config().id;t&&i?t.request(i):this.pendingDelete.set(true);break}}}onDuplicate(){this.duplicateRequested.emit(this.config());}onDeleteConfirmed(){this.deleteState()||this.pendingDelete.set(false),this.deleteRequested.emit(this.config());}onDeleteCancelled(){this.deleteState()?this.deleteState().cancel():this.pendingDelete.set(false);}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=vf({type:n,selectors:[["agentos-auth-setting-item"]],inputs:{config:[1,"config"],scope:[1,"scope"],readOnly:[1,"readOnly"],showBadge:[1,"showBadge"],deleteState:[1,"deleteState"]},outputs:{editRequested:"editRequested",deleteRequested:"deleteRequested",duplicateRequested:"duplicateRequested"},decls:11,vars:4,consts:[["role","listitem",1,"auth-setting-item"],[1,"auth-setting-item__body"],[1,"auth-setting-item__heading"],[1,"auth-setting-item__name"],[1,"auth-setting-item__badge"],[1,"auth-setting-item__type"],[1,"auth-setting-item__actions"],[1,"auth-setting-item__confirm-label"],["icon","check","variant","danger",3,"action","title","disabled"],["icon","close","title","Cancel deletion",3,"action","disabled"],["icon","content_copy","title","Duplicate this auth setting",3,"action"],[3,"items"],[3,"itemSelected","items"]],template:function(t,i){t&1&&(za(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),r_(4),Cf(),hT(5,W,2,3,"span",4),Cf(),za(6,"span",5),r_(7),Cf()(),za(8,"div",6),hT(9,J,4,3)(10,X,2,1),Cf()()),t&2&&(yb(4),Iv(i.config().name),yb(),pT(i.showBadge()?5:-1),yb(2),Iv(i.config().authType),yb(2),pT(i.isConfirmingDelete()?9:10));},dependencies:[Vi,qe],styles:[".auth-setting-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem 1rem;border-radius:10px;border:1px solid var(--color-border);background:var(--glass-bg);-webkit-backdrop-filter:var(--glass-backdrop-blur);backdrop-filter:var(--glass-backdrop-blur);transition:background .15s ease,border-color .15s ease}.auth-setting-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-primary)}.auth-setting-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.auth-setting-item__heading[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;min-width:0}.auth-setting-item__name[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}.auth-setting-item__badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.65rem;font-weight:600;letter-spacing:.04em;text-transform:uppercase;padding:.1rem .4rem;border-radius:4px;line-height:1.2}.auth-setting-item__badge[data-variant=neutral][_ngcontent-%COMP%]{background:var(--color-bg-secondary);color:var(--color-text-secondary)}.auth-setting-item__badge[data-variant=info][_ngcontent-%COMP%]{background:color-mix(in srgb,var(--color-info) 15%,transparent);color:var(--color-info)}.auth-setting-item__badge[data-variant=warning][_ngcontent-%COMP%]{background:color-mix(in srgb,var(--color-warning) 15%,transparent);color:var(--color-warning)}.auth-setting-item__type[_ngcontent-%COMP%]{font-size:.78rem;color:var(--color-text-secondary);font-family:monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.auth-setting-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.auth-setting-item[_ngcontent-%COMP%]:hover .auth-setting-item__actions[_ngcontent-%COMP%], .auth-setting-item[_ngcontent-%COMP%]:focus-within .auth-setting-item__actions[_ngcontent-%COMP%]{opacity:1}.auth-setting-item__confirm-label[_ngcontent-%COMP%]{font-size:.8rem;font-weight:500;color:var(--color-error);margin-right:.25rem;white-space:nowrap}"]})};function Z(n,e){if(n&1&&(za(0,"p",4),r_(1),Cf()),n&2){let t=NT();yb(),Iv(t.deletion.error());}}function tt(n,e){n&1&&(za(0,"p",5),r_(1,"No auth settings match the current filter."),Cf());}function et(n,e){if(n&1&&lc(0,"ds-entity-list",6),n&2){let t=NT(),i=PT(8);tv("hideTitle",true)("hideToolbar",true)("items",t.settingItems())("loading",t.isLoading())("showCreate",false)("itemTemplate",i);}}function nt(n,e){if(n&1){let t=bT();za(0,"agentos-auth-setting-item",8),dc("editRequested",function(l){ig(t);let b=NT(2);return sg(b.onEdit(l))})("deleteRequested",function(l){ig(t);let b=NT(2);return sg(b.onDelete(l))}),Cf();}if(n&2){let t=NT(2);tv("config",e)("showBadge",false)("deleteState",t.deletion);}}function it(n,e){if(n&1&&hT(0,nt,1,3,"agentos-auth-setting-item",7),n&2){let t,i=e.$implicit,l=NT();pT((t=l.resolveSetting(i.id))?0:-1,t);}}var K=class n{router=p(It);destroyRef=p(Me);state=p(R);refresh$=new De(void 0);isLoading=ie(true);deletion=i();settings$=this.refresh$.pipe(Ae(()=>(this.isLoading.set(true),this.state.loadPlatformSettings())));settings=ie([]);rowFilter=O(this.settings,e=>[e.name,e.authType].filter(Boolean).join(" "));settingItems=Mi(()=>this.rowFilter.filteredRows().map(e=>({id:e.id??"",name:e.name,description:e.authType})));settingsById=new Map;constructor(){this.settings$.pipe(U(this.destroyRef)).subscribe({next:e=>{this.settings.set(e),this.settingsById=new Map(e.map(t=>[t.id??"",t])),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","auth-settings","new"]);}onEdit(e){e.id&&this.router.navigate(["/agentos","admin","auth-settings",e.id,"edit"]);}onDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.state.delete(e.id,"platform").pipe(U(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}resolveSetting(e){return this.settingsById.get(e)??null}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=vf({type:n,selectors:[["agentos-platform-auth-settings"]],decls:9,vars:3,consts:[["authSettingItemTpl",""],["title","Platform Auth Settings"],["label","Filter auth settings","placeholder","Filter auth settings\u2026",3,"queryChange","query"],["type","button",1,"settings-table__new",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],["title","Platform Auth Settings","emptyMessage","No platform auth settings defined yet.","cardMinWidth","400px",1,"platform-auth-settings__content",3,"hideTitle","hideToolbar","items","loading","showCreate","itemTemplate"],["scope","namespace",3,"config","showBadge","deleteState"],["scope","namespace",3,"editRequested","deleteRequested","config","showBadge","deleteState"]],template:function(t,i){t&1&&(za(0,"ds-section-header",1)(1,"agentos-table-filter",2),dc("queryChange",function(b){return i.rowFilter.query.set(b)}),Cf(),za(2,"button",3),dc("click",function(){return i.openCreateForm()}),r_(3,"New auth setting"),Cf()(),hT(4,Z,2,1,"p",4),hT(5,tt,2,0,"p",5)(6,et,1,6,"ds-entity-list",6),Jy(7,it,1,1,"ng-template",null,0,I_)),t&2&&(yb(),tv("query",i.rowFilter.query()),yb(3),pT(i.deletion.error()?4:-1),yb(),pT(!i.isLoading()&&i.settings().length>0&&i.rowFilter.filteredRows().length===0?5:6));},dependencies:[gi,vi,P$1,P],styles:['.settings-table__new[_ngcontent-%COMP%]{padding:7px 12px;border:1px solid var(--color-accent);border-radius:0;background:var(--color-accent);color:var(--color-bg);cursor:pointer;font-family:var(--font-heading);font-size:14px;font-weight:600;white-space:nowrap}.settings-table__new[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:2px}.settings-table__toolbar[_ngcontent-%COMP%]{display:flex;align-items:center;flex-wrap:wrap;gap:12px;margin:0 0 1rem}.settings-table__toolbar[_ngcontent-%COMP%] agentos-table-filter[_ngcontent-%COMP%]{margin:0;flex:0 1 240px;min-width:80px}.settings-table__toolbar[_ngcontent-%COMP%] .settings-table__new[_ngcontent-%COMP%]{margin-left:auto}.settings-table__toolbar-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;margin-left:auto}.settings-table__toolbar-actions[_ngcontent-%COMP%] agentos-table-filter[_ngcontent-%COMP%]{flex:0 1 240px;min-width:80px}.settings-table__toolbar-actions[_ngcontent-%COMP%] .settings-table__new[_ngcontent-%COMP%]{margin-left:0;white-space:nowrap}.settings-table__status[_ngcontent-%COMP%]{margin:20px 8px;color:var(--color-text-secondary)}.settings-table__error[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:.875rem;color:var(--color-error)}.settings-table__wrap[_ngcontent-%COMP%]{overflow-x:auto}table.ds-table[_ngcontent-%COMP%]{width:100%;border-collapse:collapse;font-size:14px}table.ds-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid var(--color-divider);color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-align:left;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid color-mix(in srgb,var(--color-text) 8%,transparent)}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.settings-table__name[_ngcontent-%COMP%]{font-weight:500}.settings-table__secondary[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.settings-table__stacked[_ngcontent-%COMP%]{display:block}.settings-table__tags[_ngcontent-%COMP%]{display:flex;gap:4px;flex-wrap:wrap}.settings-table__actions[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end;gap:4px;white-space:nowrap}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:4px 7px;border:1px solid transparent;background:transparent;color:var(--color-accent);cursor:pointer;font:inherit}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-100)}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:1px}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:disabled{color:var(--color-neutral-600);cursor:default}.settings-table__actions[_ngcontent-%COMP%] .settings-table__delete[_ngcontent-%COMP%]{color:var(--color-error)}@media(max-width:760px){.settings-table__toolbar[_ngcontent-%COMP%]{flex-direction:column;align-items:stretch;gap:12px}.settings-table__toolbar-actions[_ngcontent-%COMP%]{flex-direction:column;align-items:stretch;width:100%;margin-left:0}.settings-table__toolbar-actions[_ngcontent-%COMP%] agentos-table-filter[_ngcontent-%COMP%]{flex:none;width:100%;min-width:0}.settings-table__toolbar-actions[_ngcontent-%COMP%] .settings-table__new[_ngcontent-%COMP%]{width:100%;min-height:44px}}@media(max-width:760px){table.ds-table[_ngcontent-%COMP%]{position:relative;display:block;width:100%}table.ds-table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:14px;padding-top:12px}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%], table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{display:flex;flex-direction:column;padding:12px;background:var(--color-surface);border:1px solid var(--color-divider)}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{display:grid;grid-template-columns:minmax(88px,30%) minmax(0,1fr);align-items:baseline;gap:4px 12px;padding:5px 0;border-bottom:0;overflow-wrap:anywhere;white-space:normal}table.ds-table[_ngcontent-%COMP%] td[data-label][_ngcontent-%COMP%]:before{content:attr(data-label);content:attr(data-label) / "";color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[data-title][_ngcontent-%COMP%]{display:block;margin-bottom:4px;padding:0 0 6px;border-bottom:0;font-size:15px}table.ds-table[_ngcontent-%COMP%] td[data-title][_ngcontent-%COMP%]:before{display:none}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:4px;margin-top:6px;padding:10px 0 0;border-top:1px solid var(--color-divider);text-align:right}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%]:before{display:none}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%] .settings-table__actions[_ngcontent-%COMP%]{flex-wrap:wrap;width:100%;white-space:normal}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%] button[_ngcontent-%COMP%]{min-width:44px;min-height:44px;padding:0 12px}}.settings-table__confirm-label[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:13px}.sr-only[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}']})};export{K as PlatformAuthSettingsComponent};
1
+ import {R}from'./chunk-dLi7RUdr.js';import {p,c as It,M as Me,P as De,i as ie,Q as Ae,E as Mi,v as vf,a7 as mc,a8 as N$,z as za,r as r_,C as Cf,h as hT,a as yb,I as Iv,d as pT,f as dc,a9 as Jy,t as tv,N as NT,u as uc,R as Rf,e as bT,l as lc,aa as PT,k as ig,m as sg,ab as I_}from'./main-NRMJZZ5V.js';import {i,O,U,o as Vi,r as qe,s as gi,h as vi,P as P$1}from'./chunk-DaxcKFzm.js';import'./chunk-C-LRWCHD.js';function W(n,e){if(n&1&&(za(0,"span",4),r_(1),Cf()),n&2){let t=NT();uc("data-variant",t.badge().variant)("aria-label",t.badge().ariaLabel),yb(),Rf(" ",t.badge().label," ");}}function J(n,e){if(n&1){let t=bT();za(0,"span",7),r_(1,"Delete?"),Cf(),za(2,"ds-icon-button",8),dc("action",function(){ig(t);let l=NT();return sg(l.onDeleteConfirmed())}),Cf(),za(3,"ds-icon-button",9),dc("action",function(){ig(t);let l=NT();return sg(l.onDeleteCancelled())}),Cf();}if(n&2){let t=NT();yb(2),tv("title",t.isDeleting()?"Deleting\u2026":"Confirm deletion")("disabled",t.isDeleting()),yb(),tv("disabled",t.isDeleting());}}function Q(n,e){if(n&1){let t=bT();za(0,"ds-kebab-menu",12),dc("itemSelected",function(l){ig(t);let b=NT(2);return sg(b.onMenuAction(l))}),Cf();}if(n&2){let t=NT(2);tv("items",t.menuItems());}}function X(n,e){if(n&1){let t=bT();za(0,"ds-icon-button",10),dc("action",function(){ig(t);let l=NT();return sg(l.onDuplicate())}),Cf(),hT(1,Q,1,1,"ds-kebab-menu",11);}if(n&2){let t=NT();yb(),pT(t.readOnly()?-1:1);}}var Y=Object.freeze({platform:{label:"PLATFORM",ariaLabel:"Configuration plateforme (lecture seule)",variant:"neutral"},namespace:{label:"NS",ariaLabel:"Configuration partag\xE9e du namespace",variant:"neutral"},userOnNs:{label:"USER \xD7 NS",ariaLabel:"Configuration utilisateur sur ce namespace",variant:"info"},userGlobal:{label:"USER GLOBAL",ariaLabel:"Configuration utilisateur globale",variant:"warning"}}),P=class n{config=mc.required();scope=mc.required();readOnly=mc(false);showBadge=mc(true);deleteState=mc(null);editRequested=N$();deleteRequested=N$();duplicateRequested=N$();pendingDelete=ie(false);isConfirmingDelete=Mi(()=>this.deleteState()?this.deleteState().confirmingId()===this.config().id:this.pendingDelete());isDeleting=Mi(()=>this.deleteState()?.deletingId()===this.config().id);badge=Mi(()=>Y[this.scope()]);menuItems=Mi(()=>[{key:"edit",label:"Edit auth setting",icon:"edit"},{key:"delete",label:"Delete auth setting",icon:"delete",variant:"danger"}]);onMenuAction(e){switch(e){case "edit":this.editRequested.emit(this.config());break;case "delete":{let t=this.deleteState(),i=this.config().id;t&&i?t.request(i):this.pendingDelete.set(true);break}}}onDuplicate(){this.duplicateRequested.emit(this.config());}onDeleteConfirmed(){this.deleteState()||this.pendingDelete.set(false),this.deleteRequested.emit(this.config());}onDeleteCancelled(){this.deleteState()?this.deleteState().cancel():this.pendingDelete.set(false);}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=vf({type:n,selectors:[["agentos-auth-setting-item"]],inputs:{config:[1,"config"],scope:[1,"scope"],readOnly:[1,"readOnly"],showBadge:[1,"showBadge"],deleteState:[1,"deleteState"]},outputs:{editRequested:"editRequested",deleteRequested:"deleteRequested",duplicateRequested:"duplicateRequested"},decls:11,vars:4,consts:[["role","listitem",1,"auth-setting-item"],[1,"auth-setting-item__body"],[1,"auth-setting-item__heading"],[1,"auth-setting-item__name"],[1,"auth-setting-item__badge"],[1,"auth-setting-item__type"],[1,"auth-setting-item__actions"],[1,"auth-setting-item__confirm-label"],["icon","check","variant","danger",3,"action","title","disabled"],["icon","close","title","Cancel deletion",3,"action","disabled"],["icon","content_copy","title","Duplicate this auth setting",3,"action"],[3,"items"],[3,"itemSelected","items"]],template:function(t,i){t&1&&(za(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),r_(4),Cf(),hT(5,W,2,3,"span",4),Cf(),za(6,"span",5),r_(7),Cf()(),za(8,"div",6),hT(9,J,4,3)(10,X,2,1),Cf()()),t&2&&(yb(4),Iv(i.config().name),yb(),pT(i.showBadge()?5:-1),yb(2),Iv(i.config().authType),yb(2),pT(i.isConfirmingDelete()?9:10));},dependencies:[Vi,qe],styles:[".auth-setting-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem 1rem;border-radius:10px;border:1px solid var(--color-border);background:var(--glass-bg);-webkit-backdrop-filter:var(--glass-backdrop-blur);backdrop-filter:var(--glass-backdrop-blur);transition:background .15s ease,border-color .15s ease}.auth-setting-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-primary)}.auth-setting-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.auth-setting-item__heading[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;min-width:0}.auth-setting-item__name[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}.auth-setting-item__badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.65rem;font-weight:600;letter-spacing:.04em;text-transform:uppercase;padding:.1rem .4rem;border-radius:4px;line-height:1.2}.auth-setting-item__badge[data-variant=neutral][_ngcontent-%COMP%]{background:var(--color-bg-secondary);color:var(--color-text-secondary)}.auth-setting-item__badge[data-variant=info][_ngcontent-%COMP%]{background:color-mix(in srgb,var(--color-info) 15%,transparent);color:var(--color-info)}.auth-setting-item__badge[data-variant=warning][_ngcontent-%COMP%]{background:color-mix(in srgb,var(--color-warning) 15%,transparent);color:var(--color-warning)}.auth-setting-item__type[_ngcontent-%COMP%]{font-size:.78rem;color:var(--color-text-secondary);font-family:monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.auth-setting-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.auth-setting-item[_ngcontent-%COMP%]:hover .auth-setting-item__actions[_ngcontent-%COMP%], .auth-setting-item[_ngcontent-%COMP%]:focus-within .auth-setting-item__actions[_ngcontent-%COMP%]{opacity:1}.auth-setting-item__confirm-label[_ngcontent-%COMP%]{font-size:.8rem;font-weight:500;color:var(--color-error);margin-right:.25rem;white-space:nowrap}"]})};function Z(n,e){if(n&1&&(za(0,"p",4),r_(1),Cf()),n&2){let t=NT();yb(),Iv(t.deletion.error());}}function tt(n,e){n&1&&(za(0,"p",5),r_(1,"No auth settings match the current filter."),Cf());}function et(n,e){if(n&1&&lc(0,"ds-entity-list",6),n&2){let t=NT(),i=PT(8);tv("hideTitle",true)("hideToolbar",true)("items",t.settingItems())("loading",t.isLoading())("showCreate",false)("itemTemplate",i);}}function nt(n,e){if(n&1){let t=bT();za(0,"agentos-auth-setting-item",8),dc("editRequested",function(l){ig(t);let b=NT(2);return sg(b.onEdit(l))})("deleteRequested",function(l){ig(t);let b=NT(2);return sg(b.onDelete(l))}),Cf();}if(n&2){let t=NT(2);tv("config",e)("showBadge",false)("deleteState",t.deletion);}}function it(n,e){if(n&1&&hT(0,nt,1,3,"agentos-auth-setting-item",7),n&2){let t,i=e.$implicit,l=NT();pT((t=l.resolveSetting(i.id))?0:-1,t);}}var K=class n{router=p(It);destroyRef=p(Me);state=p(R);refresh$=new De(void 0);isLoading=ie(true);deletion=i();settings$=this.refresh$.pipe(Ae(()=>(this.isLoading.set(true),this.state.loadPlatformSettings())));settings=ie([]);rowFilter=O(this.settings,e=>[e.name,e.authType].filter(Boolean).join(" "));settingItems=Mi(()=>this.rowFilter.filteredRows().map(e=>({id:e.id??"",name:e.name,description:e.authType})));settingsById=new Map;constructor(){this.settings$.pipe(U(this.destroyRef)).subscribe({next:e=>{this.settings.set(e),this.settingsById=new Map(e.map(t=>[t.id??"",t])),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","auth-settings","new"]);}onEdit(e){e.id&&this.router.navigate(["/agentos","admin","auth-settings",e.id,"edit"]);}onDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.state.delete(e.id,"platform").pipe(U(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}resolveSetting(e){return this.settingsById.get(e)??null}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=vf({type:n,selectors:[["agentos-platform-auth-settings"]],decls:9,vars:3,consts:[["authSettingItemTpl",""],["title","Platform Auth Settings"],["label","Filter auth settings","placeholder","Filter auth settings\u2026",3,"queryChange","query"],["type","button",1,"settings-table__new",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],["title","Platform Auth Settings","emptyMessage","No platform auth settings defined yet.","cardMinWidth","400px",1,"platform-auth-settings__content",3,"hideTitle","hideToolbar","items","loading","showCreate","itemTemplate"],["scope","namespace",3,"config","showBadge","deleteState"],["scope","namespace",3,"editRequested","deleteRequested","config","showBadge","deleteState"]],template:function(t,i){t&1&&(za(0,"ds-section-header",1)(1,"agentos-table-filter",2),dc("queryChange",function(b){return i.rowFilter.query.set(b)}),Cf(),za(2,"button",3),dc("click",function(){return i.openCreateForm()}),r_(3,"New auth setting"),Cf()(),hT(4,Z,2,1,"p",4),hT(5,tt,2,0,"p",5)(6,et,1,6,"ds-entity-list",6),Jy(7,it,1,1,"ng-template",null,0,I_)),t&2&&(yb(),tv("query",i.rowFilter.query()),yb(3),pT(i.deletion.error()?4:-1),yb(),pT(!i.isLoading()&&i.settings().length>0&&i.rowFilter.filteredRows().length===0?5:6));},dependencies:[gi,vi,P$1,P],styles:['.settings-table__new[_ngcontent-%COMP%]{padding:7px 12px;border:1px solid var(--color-accent);border-radius:0;background:var(--color-accent);color:var(--color-bg);cursor:pointer;font-family:var(--font-heading);font-size:14px;font-weight:600;white-space:nowrap}.settings-table__new[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:2px}.settings-table__toolbar[_ngcontent-%COMP%]{display:flex;align-items:center;flex-wrap:wrap;gap:12px;margin:0 0 1rem}.settings-table__toolbar[_ngcontent-%COMP%] agentos-table-filter[_ngcontent-%COMP%]{margin:0;flex:0 1 240px;min-width:80px}.settings-table__toolbar[_ngcontent-%COMP%] .settings-table__new[_ngcontent-%COMP%]{margin-left:auto}.settings-table__toolbar-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;margin-left:auto}.settings-table__toolbar-actions[_ngcontent-%COMP%] agentos-table-filter[_ngcontent-%COMP%]{flex:0 1 240px;min-width:80px}.settings-table__toolbar-actions[_ngcontent-%COMP%] .settings-table__new[_ngcontent-%COMP%]{margin-left:0;white-space:nowrap}.settings-table__status[_ngcontent-%COMP%]{margin:20px 8px;color:var(--color-text-secondary)}.settings-table__error[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:.875rem;color:var(--color-error)}.settings-table__wrap[_ngcontent-%COMP%]{overflow-x:auto}table.ds-table[_ngcontent-%COMP%]{width:100%;border-collapse:collapse;font-size:14px}table.ds-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid var(--color-divider);color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-align:left;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid color-mix(in srgb,var(--color-text) 8%,transparent)}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.settings-table__name[_ngcontent-%COMP%]{font-weight:500}.settings-table__secondary[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.settings-table__stacked[_ngcontent-%COMP%]{display:block}.settings-table__tags[_ngcontent-%COMP%]{display:flex;gap:4px;flex-wrap:wrap}.settings-table__actions[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end;gap:4px;white-space:nowrap}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:4px 7px;border:1px solid transparent;background:transparent;color:var(--color-accent);cursor:pointer;font:inherit}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-100)}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:1px}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:disabled{color:var(--color-neutral-600);cursor:default}.settings-table__actions[_ngcontent-%COMP%] .settings-table__delete[_ngcontent-%COMP%]{color:var(--color-error)}@media(max-width:760px){.settings-table__toolbar[_ngcontent-%COMP%]{flex-direction:column;align-items:stretch;gap:12px}.settings-table__toolbar-actions[_ngcontent-%COMP%]{flex-direction:column;align-items:stretch;width:100%;margin-left:0}.settings-table__toolbar-actions[_ngcontent-%COMP%] agentos-table-filter[_ngcontent-%COMP%]{flex:none;width:100%;min-width:0}.settings-table__toolbar-actions[_ngcontent-%COMP%] .settings-table__new[_ngcontent-%COMP%]{width:100%;min-height:44px}}@media(max-width:760px){table.ds-table[_ngcontent-%COMP%]{position:relative;display:block;width:100%}table.ds-table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:14px;padding-top:12px}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%], table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{display:flex;flex-direction:column;padding:12px;background:var(--color-surface);border:1px solid var(--color-divider)}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{display:grid;grid-template-columns:minmax(88px,30%) minmax(0,1fr);align-items:baseline;gap:4px 12px;padding:5px 0;border-bottom:0;overflow-wrap:anywhere;white-space:normal}table.ds-table[_ngcontent-%COMP%] td[data-label][_ngcontent-%COMP%]:before{content:attr(data-label);content:attr(data-label) / "";color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[data-title][_ngcontent-%COMP%]{display:block;margin-bottom:4px;padding:0 0 6px;border-bottom:0;font-size:15px}table.ds-table[_ngcontent-%COMP%] td[data-title][_ngcontent-%COMP%]:before{display:none}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:4px;margin-top:6px;padding:10px 0 0;border-top:1px solid var(--color-divider);text-align:right}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%]:before{display:none}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%] .settings-table__actions[_ngcontent-%COMP%]{flex-wrap:wrap;width:100%;white-space:normal}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%] button[_ngcontent-%COMP%]{min-width:44px;min-height:44px;padding:0 12px}}.settings-table__confirm-label[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:13px}.sr-only[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}']})};export{K as PlatformAuthSettingsComponent};
@@ -1,2 +1,2 @@
1
- import {R}from'./chunk-BrXPglDw.js';import {p,$ as $t,aN as _,M as Me,i as ie$1,E as Mi,aO as Re,Z as pw,a0 as Wn,_ as _$1,v as vf,z as za,r as r_,C as Cf,h as hT,a as yb,d as pT,e as bT,f as dc,s as sS,B as yT,N as NT,t as tv,g as cS,D as vT,R as Rf,I as Iv,q as gv,ae as Cv,k as ig,m as sg}from'./main-NXEJVT36.js';import {U,D as Yn,Z as Zn,X as Xn,Y as Ye,e as Ft,c as bt,L as Ln,G as ln}from'./chunk-BEMVRmeG.js';import'./chunk-tJcOqYO8.js';var q=(a,t)=>t.id;function $(a,t){a&1&&(za(0,"p",3),r_(1,"Loading\u2026"),Cf());}function J(a,t){if(a&1&&(za(0,"p",6),r_(1),Cf()),a&2){let e=NT(2);yb(),Iv(e.errorMessage());}}function Q(a,t){if(a&1){let e=bT();za(0,"button",26),dc("click",function(){ig(e);let s=NT(2);return sg(s.retryLoad())}),r_(1,"Retry loading"),Cf();}}function X(a,t){if(a&1&&(za(0,"span",28),r_(1),Cf()),a&2){let e=NT(3);yb(),Iv(e.association()?.checkoutFailureReason);}}function Z(a,t){if(a&1&&(za(0,"p",27),r_(1),hT(2,X,2,1,"span",28),Cf()),a&2){let e=NT(2);gv("namespace-git__status--failed",e.checkoutStatus()===e.CheckoutStatus.FAILED)("namespace-git__status--ready",e.checkoutStatus()===e.CheckoutStatus.READY),yb(),Rf(" Repository: ",e.checkoutStatus()," "),yb(),pT(e.association()?.checkoutFailureReason?2:-1);}}function ee(a,t){if(a&1&&(za(0,"option",18),r_(1),Cf()),a&2){let e=t.$implicit,d=NT(2);tv("value",e.id),yb(),Cv("",e.name," (",d.authTypeLabel(e.authType),")");}}function te(a,t){a&1&&(za(0,"span",19),r_(1," No usable auth setting in this namespace. Create a BEARER_TOKEN one first. "),Cf());}function ne(a,t){if(a&1){let e=bT();za(0,"button",29),dc("click",function(){ig(e);let s=NT(2);return sg(s.remove())}),r_(1," Remove association "),Cf();}if(a&2){let e=NT(2);tv("disabled",!e.associationLoaded()||e.isSaving());}}function ie(a,t){if(a&1){let e=bT();za(0,"div",4)(1,"p",5),r_(2," Associating a repository enables Git workspaces for this namespace. When worktree creation is enabled, every new top-level case 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. "),Cf(),hT(3,J,2,1,"p",6),hT(4,Q,2,0,"button",7),hT(5,Z,3,6,"p",8),za(6,"fieldset",9)(7,"legend",10),r_(8,"Repository"),Cf(),za(9,"label",11)(10,"span",12),r_(11,"Repository URL"),Cf(),za(12,"input",13),dc("ngModelChange",function(s){ig(e);let p=NT();return sg(p.repositoryUrl.set(s))}),Cf(),sS(),za(13,"span",14),r_(14,"HTTPS only, without credentials in the URL."),Cf()(),za(15,"label",11)(16,"span",12),r_(17,"Main branch"),Cf(),za(18,"input",15),dc("ngModelChange",function(s){ig(e);let p=NT();return sg(p.mainBranch.set(s))}),Cf(),sS(),za(19,"span",14),r_(20,"New worktrees start at this branch\u2019s commit, without creating a branch."),Cf()(),za(21,"label",11)(22,"span",12),r_(23,"Service account"),Cf(),za(24,"select",16),dc("ngModelChange",function(s){ig(e);let p=NT();return sg(p.serviceAuthSettingId.set(s))}),za(25,"option",17),r_(26,"Select an auth setting\u2026"),Cf(),yT(27,ee,2,3,"option",18,q),Cf(),sS(),za(29,"span",14),r_(30," Shared by the namespace. Every Git operation uses this identity, never the identity of whoever opened the case. "),Cf(),hT(31,te,2,0,"span",19),Cf()(),za(32,"fieldset",9)(33,"legend",10),r_(34,"Automation"),Cf(),za(35,"label",20)(36,"input",21),dc("ngModelChange",function(s){ig(e);let p=NT();return sg(p.autoWorktree.set(s))}),Cf(),sS(),za(37,"span"),r_(38,"Create a worktree for every new top-level case"),Cf()(),za(39,"span",14),r_(40," 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. "),Cf(),za(41,"label",11)(42,"span",12),r_(43,"Setup command (optional)"),Cf(),za(44,"input",22),dc("ngModelChange",function(s){ig(e);let p=NT();return sg(p.setupCommand.set(s))}),Cf(),sS(),za(45,"span",19),r_(46," 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. "),Cf()()(),za(47,"div",23)(48,"button",24),dc("click",function(){ig(e);let s=NT();return sg(s.save())}),r_(49),Cf(),hT(50,ne,2,1,"button",25),Cf()();}if(a&2){let e=NT();yb(3),pT(e.errorMessage()?3:-1),yb(),pT(e.associationLoaded()?-1:4),yb(),pT(e.isAssociated()&&e.checkoutStatus()?5:-1),yb(),tv("disabled",!e.associationLoaded()||e.isSaving()),yb(6),tv("ngModel",e.repositoryUrl()),cS(),yb(6),tv("ngModel",e.mainBranch()),cS(),yb(6),tv("ngModel",e.serviceAuthSettingId()),cS(),yb(3),vT(e.eligibleAuthSettings()),yb(4),pT(e.eligibleAuthSettings().length===0?31:-1),yb(),tv("disabled",!e.associationLoaded()||e.isSaving()),yb(4),tv("ngModel",e.autoWorktree()),cS(),yb(8),tv("ngModel",e.setupCommand()),cS(),yb(4),tv("disabled",!e.canSave()),yb(),Rf(" ",e.isSaving()?"Saving\u2026":e.isAssociated()?"Update":"Associate"," "),yb(),pT(e.isAssociated()?50:-1);}}var ae=["BearerTokenAuthSetting","BasicAuthAuthSetting","ApiKeyAuthSetting"],oe={BearerTokenAuthSetting:"token",BasicAuthAuthSetting:"basic auth",ApiKeyAuthSetting:"API key"},j=class a{route=p($t);gitApi=p(_);authSettingState=p(R);destroyRef=p(Me);isLoading=ie$1(true);isSaving=ie$1(false);associationLoaded=ie$1(false);errorMessage=ie$1(null);association=ie$1(null);authSettings=ie$1([]);repositoryUrl=ie$1("");mainBranch=ie$1("main");serviceAuthSettingId=ie$1("");autoWorktree=ie$1(false);setupCommand=ie$1("");namespaceId="";isAssociated=Mi(()=>this.association()?.associated===true);eligibleAuthSettings=Mi(()=>this.authSettings().filter(t=>ae.includes(t.authType)));authTypeLabel(t){return oe[t??""]??t??"unknown"}canSave=Mi(()=>this.associationLoaded()&&!this.isLoading()&&!this.isSaving()&&this.repositoryUrl().trim().length>0&&this.serviceAuthSettingId().length>0);checkoutStatus=Mi(()=>this.association()?.checkoutStatus??null);CheckoutStatus=Re;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),pw({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),Wn(t=>(console.error("Failed to save the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),_$1(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}remove(){!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated()||confirm("Remove the repository association? Existing workspaces keep their worktree.")&&(this.isSaving.set(true),this.gitApi.removeAssociationNamespaceGit(this.namespaceId).pipe(U(this.destroyRef),Wn(t=>(console.error("Failed to remove the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),_$1(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||a)};static \u0275cmp=vf({type:a,selectors:[["agentos-namespace-git"]],decls:6,vars:1,consts:[[1,"namespace-git"],[1,"namespace-git__header"],[1,"namespace-git__title"],[1,"namespace-git__loading"],[1,"namespace-git__body"],[1,"namespace-git__hint"],["role","alert",1,"namespace-git__error"],["type","button",1,"namespace-git__retry"],[1,"namespace-git__status",3,"namespace-git__status--failed","namespace-git__status--ready"],[1,"namespace-git__section",3,"disabled"],[1,"namespace-git__label"],[1,"namespace-git__field"],[1,"namespace-git__field-label"],["type","url","placeholder","https://forge.example/org/project.git","name","repositoryUrl",1,"namespace-git__input",3,"ngModelChange","ngModel"],[1,"namespace-git__field-hint"],["type","text","placeholder","main","name","mainBranch",1,"namespace-git__input",3,"ngModelChange","ngModel"],["name","serviceAuthSettingId",1,"namespace-git__input",3,"ngModelChange","ngModel"],["value",""],[3,"value"],[1,"namespace-git__field-hint","namespace-git__field-hint--warn"],[1,"namespace-git__checkbox"],["type","checkbox","name","autoWorktree",3,"ngModelChange","ngModel"],["type","text","placeholder","pnpm install --ignore-scripts","name","setupCommand",1,"namespace-git__input",3,"ngModelChange","ngModel"],[1,"namespace-git__actions"],["type","button",1,"namespace-git__save",3,"click","disabled"],["type","button",1,"namespace-git__remove",3,"disabled"],["type","button",1,"namespace-git__retry",3,"click"],[1,"namespace-git__status"],[1,"namespace-git__status-reason"],["type","button",1,"namespace-git__remove",3,"click","disabled"]],template:function(e,d){e&1&&(za(0,"div",0)(1,"header",1)(2,"h1",2),r_(3,"Git repository"),Cf()(),hT(4,$,2,0,"p",3)(5,ie,51,14,"div",4),Cf()),e&2&&(yb(4),pT(d.isLoading()?4:5));},dependencies:[Yn,Zn,Xn,Ye,Ft,bt,Ln,ln],styles:[".namespace-git[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.namespace-git__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.namespace-git__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.namespace-git__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.namespace-git__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem}.namespace-git__body[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.namespace-git__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6b7280)}.namespace-git__error[_ngcontent-%COMP%]{margin:0;padding:.75rem;border-radius:.375rem;background:var(--red-bg, #fef2f2);color:var(--color-error, #b91c1c);font-size:.875rem}.namespace-git__status[_ngcontent-%COMP%]{margin:0;padding:.5rem .75rem;border-radius:.375rem;background:var(--color-surface-secondary, #f3f4f6);font-size:.875rem;display:flex;flex-direction:column;gap:.25rem}.namespace-git__status--ready[_ngcontent-%COMP%]{background:var(--color-success-bg, #ecfdf5);color:var(--color-success, #047857)}.namespace-git__status--failed[_ngcontent-%COMP%]{background:var(--red-bg, #fef2f2);color:var(--color-error, #b91c1c)}.namespace-git__status-reason[_ngcontent-%COMP%]{font-size:.8125rem;opacity:.9}.namespace-git__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;border:1px solid var(--color-border, #e5e7eb);border-radius:.5rem;padding:1rem;margin:0}.namespace-git__label[_ngcontent-%COMP%]{font-weight:600;font-size:.9375rem;padding:0 .25rem}.namespace-git__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.namespace-git__field-label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500}.namespace-git__field-hint[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-text-secondary, #6b7280)}.namespace-git__field-hint--warn[_ngcontent-%COMP%]{color:var(--color-warning, #b45309)}.namespace-git__input[_ngcontent-%COMP%]{font-family:inherit;font-size:.875rem;padding:.5rem .625rem;border:1px solid var(--color-border, #e5e7eb);border-radius:.375rem;background:var(--color-surface, #fff);color:inherit}.namespace-git__checkbox[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;font-size:.875rem;cursor:pointer}.namespace-git__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center}.namespace-git__save[_ngcontent-%COMP%], .namespace-git__retry[_ngcontent-%COMP%], .namespace-git__remove[_ngcontent-%COMP%], .namespace-git__cancel[_ngcontent-%COMP%]{font-family:inherit;font-size:.875rem;padding:.5rem 1rem;border-radius:.375rem;cursor:pointer;border:1px solid transparent}.namespace-git__save[_ngcontent-%COMP%]:disabled, .namespace-git__retry[_ngcontent-%COMP%]:disabled, .namespace-git__remove[_ngcontent-%COMP%]:disabled, .namespace-git__cancel[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.namespace-git__save[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);color:var(--color-text-on-accent, #fff)}.namespace-git__remove[_ngcontent-%COMP%]{background:none;border-color:var(--color-error, #b91c1c);color:var(--color-error, #b91c1c)}.namespace-git__cancel[_ngcontent-%COMP%], .namespace-git__retry[_ngcontent-%COMP%]{background:none;border-color:var(--color-border, #e5e7eb);color:inherit}"]})};
1
+ import {R}from'./chunk-dLi7RUdr.js';import {p,$ as $t,aN as _,M as Me,i as ie$1,E as Mi,aO as Re,Z as pw,a0 as Wn,_ as _$1,v as vf,z as za,r as r_,C as Cf,h as hT,a as yb,d as pT,e as bT,f as dc,s as sS,B as yT,N as NT,t as tv,g as cS,D as vT,R as Rf,I as Iv,q as gv,ae as Cv,k as ig,m as sg}from'./main-NRMJZZ5V.js';import {U,D as Yn,Z as Zn,X as Xn,Y as Ye,e as Ft,c as bt,L as Ln,G as ln}from'./chunk-DaxcKFzm.js';import'./chunk-C-LRWCHD.js';var q=(a,t)=>t.id;function $(a,t){a&1&&(za(0,"p",3),r_(1,"Loading\u2026"),Cf());}function J(a,t){if(a&1&&(za(0,"p",6),r_(1),Cf()),a&2){let e=NT(2);yb(),Iv(e.errorMessage());}}function Q(a,t){if(a&1){let e=bT();za(0,"button",26),dc("click",function(){ig(e);let s=NT(2);return sg(s.retryLoad())}),r_(1,"Retry loading"),Cf();}}function X(a,t){if(a&1&&(za(0,"span",28),r_(1),Cf()),a&2){let e=NT(3);yb(),Iv(e.association()?.checkoutFailureReason);}}function Z(a,t){if(a&1&&(za(0,"p",27),r_(1),hT(2,X,2,1,"span",28),Cf()),a&2){let e=NT(2);gv("namespace-git__status--failed",e.checkoutStatus()===e.CheckoutStatus.FAILED)("namespace-git__status--ready",e.checkoutStatus()===e.CheckoutStatus.READY),yb(),Rf(" Repository: ",e.checkoutStatus()," "),yb(),pT(e.association()?.checkoutFailureReason?2:-1);}}function ee(a,t){if(a&1&&(za(0,"option",18),r_(1),Cf()),a&2){let e=t.$implicit,d=NT(2);tv("value",e.id),yb(),Cv("",e.name," (",d.authTypeLabel(e.authType),")");}}function te(a,t){a&1&&(za(0,"span",19),r_(1," No usable auth setting in this namespace. Create a BEARER_TOKEN one first. "),Cf());}function ne(a,t){if(a&1){let e=bT();za(0,"button",29),dc("click",function(){ig(e);let s=NT(2);return sg(s.remove())}),r_(1," Remove association "),Cf();}if(a&2){let e=NT(2);tv("disabled",!e.associationLoaded()||e.isSaving());}}function ie(a,t){if(a&1){let e=bT();za(0,"div",4)(1,"p",5),r_(2," Associating a repository enables Git workspaces for this namespace. When worktree creation is enabled, every new top-level case 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. "),Cf(),hT(3,J,2,1,"p",6),hT(4,Q,2,0,"button",7),hT(5,Z,3,6,"p",8),za(6,"fieldset",9)(7,"legend",10),r_(8,"Repository"),Cf(),za(9,"label",11)(10,"span",12),r_(11,"Repository URL"),Cf(),za(12,"input",13),dc("ngModelChange",function(s){ig(e);let p=NT();return sg(p.repositoryUrl.set(s))}),Cf(),sS(),za(13,"span",14),r_(14,"HTTPS only, without credentials in the URL."),Cf()(),za(15,"label",11)(16,"span",12),r_(17,"Main branch"),Cf(),za(18,"input",15),dc("ngModelChange",function(s){ig(e);let p=NT();return sg(p.mainBranch.set(s))}),Cf(),sS(),za(19,"span",14),r_(20,"New worktrees start at this branch\u2019s commit, without creating a branch."),Cf()(),za(21,"label",11)(22,"span",12),r_(23,"Service account"),Cf(),za(24,"select",16),dc("ngModelChange",function(s){ig(e);let p=NT();return sg(p.serviceAuthSettingId.set(s))}),za(25,"option",17),r_(26,"Select an auth setting\u2026"),Cf(),yT(27,ee,2,3,"option",18,q),Cf(),sS(),za(29,"span",14),r_(30," Shared by the namespace. Every Git operation uses this identity, never the identity of whoever opened the case. "),Cf(),hT(31,te,2,0,"span",19),Cf()(),za(32,"fieldset",9)(33,"legend",10),r_(34,"Automation"),Cf(),za(35,"label",20)(36,"input",21),dc("ngModelChange",function(s){ig(e);let p=NT();return sg(p.autoWorktree.set(s))}),Cf(),sS(),za(37,"span"),r_(38,"Create a worktree for every new top-level case"),Cf()(),za(39,"span",14),r_(40," 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. "),Cf(),za(41,"label",11)(42,"span",12),r_(43,"Setup command (optional)"),Cf(),za(44,"input",22),dc("ngModelChange",function(s){ig(e);let p=NT();return sg(p.setupCommand.set(s))}),Cf(),sS(),za(45,"span",19),r_(46," 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. "),Cf()()(),za(47,"div",23)(48,"button",24),dc("click",function(){ig(e);let s=NT();return sg(s.save())}),r_(49),Cf(),hT(50,ne,2,1,"button",25),Cf()();}if(a&2){let e=NT();yb(3),pT(e.errorMessage()?3:-1),yb(),pT(e.associationLoaded()?-1:4),yb(),pT(e.isAssociated()&&e.checkoutStatus()?5:-1),yb(),tv("disabled",!e.associationLoaded()||e.isSaving()),yb(6),tv("ngModel",e.repositoryUrl()),cS(),yb(6),tv("ngModel",e.mainBranch()),cS(),yb(6),tv("ngModel",e.serviceAuthSettingId()),cS(),yb(3),vT(e.eligibleAuthSettings()),yb(4),pT(e.eligibleAuthSettings().length===0?31:-1),yb(),tv("disabled",!e.associationLoaded()||e.isSaving()),yb(4),tv("ngModel",e.autoWorktree()),cS(),yb(8),tv("ngModel",e.setupCommand()),cS(),yb(4),tv("disabled",!e.canSave()),yb(),Rf(" ",e.isSaving()?"Saving\u2026":e.isAssociated()?"Update":"Associate"," "),yb(),pT(e.isAssociated()?50:-1);}}var ae=["BearerTokenAuthSetting","BasicAuthAuthSetting","ApiKeyAuthSetting"],oe={BearerTokenAuthSetting:"token",BasicAuthAuthSetting:"basic auth",ApiKeyAuthSetting:"API key"},j=class a{route=p($t);gitApi=p(_);authSettingState=p(R);destroyRef=p(Me);isLoading=ie$1(true);isSaving=ie$1(false);associationLoaded=ie$1(false);errorMessage=ie$1(null);association=ie$1(null);authSettings=ie$1([]);repositoryUrl=ie$1("");mainBranch=ie$1("main");serviceAuthSettingId=ie$1("");autoWorktree=ie$1(false);setupCommand=ie$1("");namespaceId="";isAssociated=Mi(()=>this.association()?.associated===true);eligibleAuthSettings=Mi(()=>this.authSettings().filter(t=>ae.includes(t.authType)));authTypeLabel(t){return oe[t??""]??t??"unknown"}canSave=Mi(()=>this.associationLoaded()&&!this.isLoading()&&!this.isSaving()&&this.repositoryUrl().trim().length>0&&this.serviceAuthSettingId().length>0);checkoutStatus=Mi(()=>this.association()?.checkoutStatus??null);CheckoutStatus=Re;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),pw({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),Wn(t=>(console.error("Failed to save the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),_$1(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}remove(){!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated()||confirm("Remove the repository association? Existing workspaces keep their worktree.")&&(this.isSaving.set(true),this.gitApi.removeAssociationNamespaceGit(this.namespaceId).pipe(U(this.destroyRef),Wn(t=>(console.error("Failed to remove the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),_$1(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||a)};static \u0275cmp=vf({type:a,selectors:[["agentos-namespace-git"]],decls:6,vars:1,consts:[[1,"namespace-git"],[1,"namespace-git__header"],[1,"namespace-git__title"],[1,"namespace-git__loading"],[1,"namespace-git__body"],[1,"namespace-git__hint"],["role","alert",1,"namespace-git__error"],["type","button",1,"namespace-git__retry"],[1,"namespace-git__status",3,"namespace-git__status--failed","namespace-git__status--ready"],[1,"namespace-git__section",3,"disabled"],[1,"namespace-git__label"],[1,"namespace-git__field"],[1,"namespace-git__field-label"],["type","url","placeholder","https://forge.example/org/project.git","name","repositoryUrl",1,"namespace-git__input",3,"ngModelChange","ngModel"],[1,"namespace-git__field-hint"],["type","text","placeholder","main","name","mainBranch",1,"namespace-git__input",3,"ngModelChange","ngModel"],["name","serviceAuthSettingId",1,"namespace-git__input",3,"ngModelChange","ngModel"],["value",""],[3,"value"],[1,"namespace-git__field-hint","namespace-git__field-hint--warn"],[1,"namespace-git__checkbox"],["type","checkbox","name","autoWorktree",3,"ngModelChange","ngModel"],["type","text","placeholder","pnpm install --ignore-scripts","name","setupCommand",1,"namespace-git__input",3,"ngModelChange","ngModel"],[1,"namespace-git__actions"],["type","button",1,"namespace-git__save",3,"click","disabled"],["type","button",1,"namespace-git__remove",3,"disabled"],["type","button",1,"namespace-git__retry",3,"click"],[1,"namespace-git__status"],[1,"namespace-git__status-reason"],["type","button",1,"namespace-git__remove",3,"click","disabled"]],template:function(e,d){e&1&&(za(0,"div",0)(1,"header",1)(2,"h1",2),r_(3,"Git repository"),Cf()(),hT(4,$,2,0,"p",3)(5,ie,51,14,"div",4),Cf()),e&2&&(yb(4),pT(d.isLoading()?4:5));},dependencies:[Yn,Zn,Xn,Ye,Ft,bt,Ln,ln],styles:[".namespace-git[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.namespace-git__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.namespace-git__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.namespace-git__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.namespace-git__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem}.namespace-git__body[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.namespace-git__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6b7280)}.namespace-git__error[_ngcontent-%COMP%]{margin:0;padding:.75rem;border-radius:.375rem;background:var(--red-bg, #fef2f2);color:var(--color-error, #b91c1c);font-size:.875rem}.namespace-git__status[_ngcontent-%COMP%]{margin:0;padding:.5rem .75rem;border-radius:.375rem;background:var(--color-surface-secondary, #f3f4f6);font-size:.875rem;display:flex;flex-direction:column;gap:.25rem}.namespace-git__status--ready[_ngcontent-%COMP%]{background:var(--color-success-bg, #ecfdf5);color:var(--color-success, #047857)}.namespace-git__status--failed[_ngcontent-%COMP%]{background:var(--red-bg, #fef2f2);color:var(--color-error, #b91c1c)}.namespace-git__status-reason[_ngcontent-%COMP%]{font-size:.8125rem;opacity:.9}.namespace-git__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;border:1px solid var(--color-border, #e5e7eb);border-radius:.5rem;padding:1rem;margin:0}.namespace-git__label[_ngcontent-%COMP%]{font-weight:600;font-size:.9375rem;padding:0 .25rem}.namespace-git__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.namespace-git__field-label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500}.namespace-git__field-hint[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-text-secondary, #6b7280)}.namespace-git__field-hint--warn[_ngcontent-%COMP%]{color:var(--color-warning, #b45309)}.namespace-git__input[_ngcontent-%COMP%]{font-family:inherit;font-size:.875rem;padding:.5rem .625rem;border:1px solid var(--color-border, #e5e7eb);border-radius:.375rem;background:var(--color-surface, #fff);color:inherit}.namespace-git__checkbox[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;font-size:.875rem;cursor:pointer}.namespace-git__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center}.namespace-git__save[_ngcontent-%COMP%], .namespace-git__retry[_ngcontent-%COMP%], .namespace-git__remove[_ngcontent-%COMP%], .namespace-git__cancel[_ngcontent-%COMP%]{font-family:inherit;font-size:.875rem;padding:.5rem 1rem;border-radius:.375rem;cursor:pointer;border:1px solid transparent}.namespace-git__save[_ngcontent-%COMP%]:disabled, .namespace-git__retry[_ngcontent-%COMP%]:disabled, .namespace-git__remove[_ngcontent-%COMP%]:disabled, .namespace-git__cancel[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.namespace-git__save[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);color:var(--color-text-on-accent, #fff)}.namespace-git__remove[_ngcontent-%COMP%]{background:none;border-color:var(--color-error, #b91c1c);color:var(--color-error, #b91c1c)}.namespace-git__cancel[_ngcontent-%COMP%], .namespace-git__retry[_ngcontent-%COMP%]{background:none;border-color:var(--color-border, #e5e7eb);color:inherit}"]})};
2
2
  export{j as NamespaceGitComponent};