@whoz-oss/coday-client 0.0.0-workstream-forge.242 → 0.0.0-workstream-messaging.2

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 (58) hide show
  1. package/browser/{chunk-CnPp-vmJ.js → chunk-8SxX32rO.js} +1 -1
  2. package/browser/{chunk-vrQUVrbj.js → chunk-B6rPUjlK.js} +1 -1
  3. package/browser/chunk-BH7OLSx0.js +1 -0
  4. package/browser/{chunk-CouuZLIT.js → chunk-BKnj9uiw.js} +1 -1
  5. package/browser/chunk-BLR-ZTHh.js +1 -0
  6. package/browser/{chunk-CxVLCgR7.js → chunk-BMpFwNrL.js} +1 -1
  7. package/browser/{chunk-DD0B2hZ4.js → chunk-BbYQjxBb.js} +1 -1
  8. package/browser/{chunk-CWB_UsoN.js → chunk-Bo2-yEbp.js} +1 -1
  9. package/browser/{chunk-DeDbkfoc.js → chunk-BwqiXXvR.js} +1 -1
  10. package/browser/{chunk-Bjh4fonr.js → chunk-Bz9_W213.js} +1 -1
  11. package/browser/{chunk-1a6DcGem.js → chunk-C1CvCiQs.js} +1 -1
  12. package/browser/chunk-C2LkuBYd.js +1 -0
  13. package/browser/{chunk-x0ys64HX.js → chunk-C3AaPoyZ.js} +1 -1
  14. package/browser/{chunk-C3kKO2hv.js → chunk-C4CyLTkA.js} +1 -1
  15. package/browser/{chunk-Ci_kgYRU.js → chunk-C8Q6ccMm.js} +1 -1
  16. package/browser/chunk-CBtsWofj.js +1 -0
  17. package/browser/chunk-CNBrzP9I.js +1 -0
  18. package/browser/chunk-CTrUVP-N.js +1 -0
  19. package/browser/{chunk-DXVP5qGT.js → chunk-CX2oEBf9.js} +1 -1
  20. package/browser/{chunk-BR-v_Yw0.js → chunk-C_TR3rI-.js} +1 -1
  21. package/browser/chunk-CcI4CWl6.js +1 -0
  22. package/browser/{chunk-Dtel5s0Y.js → chunk-CfifMtwC.js} +1 -1
  23. package/browser/{chunk-B3C0-w1H.js → chunk-CoWzfbqL.js} +1 -1
  24. package/browser/{chunk-Dx2NFZKr.js → chunk-CyIUjRWT.js} +1 -1
  25. package/browser/{chunk-sh5yfJ5w.js → chunk-D0jMQDes.js} +1 -1
  26. package/browser/{chunk-CZVszAsn.js → chunk-D8BMEvrt.js} +1 -1
  27. package/browser/{chunk-D4ZQkLdU.js → chunk-DAiaXy53.js} +1 -1
  28. package/browser/{chunk-CbreKU78.js → chunk-DNefc5l8.js} +1 -1
  29. package/browser/{chunk-Cp88MsOx.js → chunk-DV5IlfBq.js} +1 -1
  30. package/browser/{chunk-CFXn7UF0.js → chunk-DbN0_APN.js} +1 -1
  31. package/browser/{chunk-Cz8XShgD.js → chunk-DlJR_onX.js} +1 -1
  32. package/browser/{chunk-C0dETmrU.js → chunk-DtJYpVtU.js} +1 -1
  33. package/browser/{chunk-U4DrnauI.js → chunk-DwXfEpcA.js} +1 -1
  34. package/browser/{chunk-DaIiIyVs.js → chunk-E81L_Bla.js} +1 -1
  35. package/browser/{chunk-CLmmZDuk.js → chunk-GUDFMaEy.js} +1 -1
  36. package/browser/{chunk-BQP4WQr8.js → chunk-GaJWiH82.js} +1 -1
  37. package/browser/{chunk-lj1CKuoo.js → chunk-MZXI10vX.js} +1 -1
  38. package/browser/{chunk-C6iz6wiq.js → chunk-RGb_eFD5.js} +1 -1
  39. package/browser/{chunk-CSMJ7MDS.js → chunk-Uf57QzfJ.js} +14 -14
  40. package/browser/{chunk-BBqfFT3U.js → chunk-WwdM1pqC.js} +1 -1
  41. package/browser/{chunk-ngHfhGm4.js → chunk-cIF5t9Db.js} +1 -1
  42. package/browser/{chunk-CBcl2plG.js → chunk-dgHw3CIi.js} +1 -1
  43. package/browser/{chunk-BdMromko.js → chunk-kO5zS3K9.js} +1 -1
  44. package/browser/{chunk-8bthdK4h.js → chunk-mgh7hiln.js} +1 -1
  45. package/browser/{chunk-B0qfyg3W.js → chunk-ogAJa2CM.js} +1 -1
  46. package/browser/{chunk-DPXe72IN.js → chunk-zfSbYfDB.js} +1 -1
  47. package/browser/index.html +3 -3
  48. package/browser/{main-2G6YLE3Q.js → main-DYDARBQQ.js} +1 -1
  49. package/browser/styles-6KD2P5NP.css +1 -0
  50. package/package.json +1 -1
  51. package/browser/chunk-CSpJmP5j.js +0 -1
  52. package/browser/chunk-CWOCuTwP.js +0 -1
  53. package/browser/chunk-Cds8WZZ9.js +0 -1
  54. package/browser/chunk-CeB7A5zv.js +0 -1
  55. package/browser/chunk-D6UEHsUd.js +0 -1
  56. package/browser/chunk-Duj3iN07.js +0 -1
  57. package/browser/chunk-yhFoWYCU.js +0 -1
  58. package/browser/styles-VTJT2VI6.css +0 -1
@@ -1 +1 @@
1
- import {f,y,p as pt,T as Te,a as fn,U as Ut,n as nd,b as bo,x as xo,L as Lt,k as kn,G as Gt,m as mo,c as po,$ as $r,V as Vn,A as An,d as pn,h as hn,e as cn,g as dn,i as at,j as an}from'./chunk-CSMJ7MDS.js';import {g,W,q as F,H as J,I as we,r as rT,$ as $i,O as Of,K as U,L as w,N as x,v as vw,E as Es,f as fg,j as jw,a as hl,P as dg,b as BE,c as Bw,x as xC,Y as Yw,Q as vg,R as MI,U as Uw,t as eC,S as xI,l as lg,k as $w,s as Dl,F as Fg,u as pf,w as hf}from'./main-2G6YLE3Q.js';var de=/^(\/|[A-Za-z]:[\\/]|\\\\)/;function me(i){return de.test(i)}function ie(i=()=>true){return t=>{let e=(t.value??"").trim();return !i()||e===""||me(e)?null:{absolutePath:true}}}var ce=(i,t)=>t.value;function ue(i,t){i&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function he(i,t){if(i&1&&(Es(0,"option",23),xC(1),hl()),i&2){let e=t.$implicit;dg("value",e.value),BE(),Fg(e.label);}}function pe(i,t){if(i&1){let e=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let p=eC();return hf(p.submit())}),Es(1,"ds-form-field",5),fg(2,"input",6),MI(),hl(),Es(3,"ds-form-field",7),fg(4,"textarea",8),MI(),hl(),Es(5,"ds-form-field",9),fg(6,"input",10),MI(),hl(),Es(7,"ds-form-field",11),fg(8,"input",12),MI(),hl(),Es(9,"ds-form-field",13),fg(10,"input",14),MI(),hl(),Es(11,"ds-form-field",15),fg(12,"input",16),MI(),hl(),Es(13,"ds-form-field",17),fg(14,"input",18),MI(),hl(),Es(15,"ds-form-field",19)(16,"input",20),vg("input",function(p){pf(e);let se=eC();return hf(se.onMaxToolRoundsInput(p))}),hl(),MI(),hl(),Es(17,"ds-form-field",21)(18,"select",22),Uw(19,he,2,2,"option",23,ce),hl(),MI(),hl(),Es(21,"ds-form-actions")(22,"button",24),xC(23),hl(),Es(24,"button",25),vg("click",function(){pf(e);let p=eC();return hf(p.cancel())}),xC(25,"Cancel"),hl()()();}if(i&2){let e=eC();dg("formGroup",e.form),BE(2),dg("formControl",e.nameControl),xI(),BE(2),dg("formControl",e.descriptionControl),xI(),BE(2),dg("formControl",e.externalIdControl),xI(),BE(2),dg("formControl",e.defaultAgentNameControl),xI(),BE(2),dg("formControl",e.configPathControl),xI(),BE(),dg("hint",e.sharedExchangePathHint())("error",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid&&(e.sharedExchangePathControl.dirty||e.sharedExchangePathControl.touched)?"Enter an absolute path (e.g. /home/me/Coday or C:\\Coday), or leave the field empty.":null),BE(),dg("readOnly",!e.canEditSharedExchangePath())("formControl",e.sharedExchangePathControl),lg("aria-invalid",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid),xI(),BE(),dg("hint",e.runCostThresholdHint()),BE(),dg("placeholder",e.runCostThresholdPlaceholder())("formControl",e.runCostThresholdControl),xI(),BE(),dg("error",e.maxToolRoundsUnparsable()||e.maxToolRoundsControl.invalid&&(e.maxToolRoundsControl.dirty||e.maxToolRoundsControl.touched)?"Enter a whole number of at least 1, or leave the field empty.":null),BE(),dg("formControl",e.maxToolRoundsControl),lg("aria-invalid",e.maxToolRoundsControl.invalid||e.maxToolRoundsUnparsable()),xI(),BE(2),dg("formControl",e.adminCaseListingControl),xI(),BE(),$w(e.adminCaseListingOptions),BE(3),dg("disabled",e.form.invalid||e.isSubmitting()),BE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var fe=1,ge=2147483647,Ce=[{value:"",label:"Default"},{value:"OWN",label:"Their own cases"},{value:"SWITCH",label:"Their own, with a switch to see all"},{value:"ALL",label:"All cases of the namespace"}],le=class i{route=g(W);router=g(F);namespaceController=g(J);destroyRef=g(we);usageConfiguration=g(f);userState=g(y);canEditSharedExchangePath=rT(()=>this.userState.currentUser()?.isAdmin===true);sharedExchangePathHint=rT(()=>this.canEditSharedExchangePath()?"Absolute path of a folder on the server that holds the files shared by the namespace. Leave empty for the default location.":"Only a super-admin can change this folder.");runCostThresholdPlaceholder=rT(()=>{let t=this.usageConfiguration.runCostThreshold();return this.usageConfiguration.enabled()?t===null?"No platform limit":`Platform default: ${t}`:"Optional maximum cost per run (e.g. 0.50)"});runCostThresholdHint=rT(()=>{let t="Leave empty to inherit the platform default",e=this.usageConfiguration.runCostThreshold();switch(this.usageConfiguration.state()){case "enabled":return e===null?`${t}: no limit.`:`${t} (${e}).`;case "disabled":return `${t}. Cost limits are inactive while usage tracking is disabled.`;default:return `${t}.`}});form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te("",{nonNullable:true}),configPath:new Te("",{nonNullable:true}),sharedExchangePath:new Te("",{nonNullable:true,validators:[ie(()=>this.canEditSharedExchangePath())]}),externalId:new Te("",{nonNullable:true}),defaultAgentName:new Te("",{nonNullable:true}),runCostThreshold:new Te(null),maxToolRounds:new Te(null,{validators:[fn.min(fe),fn.max(ge),fn.pattern(/^\d+$/)]}),adminCaseListing:new Te("",{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get configPathControl(){return this.form.controls.configPath}get sharedExchangePathControl(){return this.form.controls.sharedExchangePath}get externalIdControl(){return this.form.controls.externalId}get defaultAgentNameControl(){return this.form.controls.defaultAgentName}get runCostThresholdControl(){return this.form.controls.runCostThreshold}get maxToolRoundsControl(){return this.form.controls.maxToolRounds}get adminCaseListingControl(){return this.form.controls.adminCaseListing}adminCaseListingOptions=Ce;maxToolRoundsUnparsable=$i(false);onMaxToolRoundsInput(t){this.maxToolRoundsUnparsable.set(t.target.validity.badInput);}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);existingNamespace=null;constructor(){Of(()=>{this.canEditSharedExchangePath(),this.sharedExchangePathControl.updateValueAndValidity();});}ngOnInit(){this.userState.currentUser()||this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({error:()=>{}});let t=this.route.snapshot.paramMap.get("namespaceId")??this.route.parent?.snapshot.paramMap.get("namespaceId");t&&(this.isEditMode.set(true),this.loadNamespace(t));}loadNamespace(t){this.isLoading.set(true),this.namespaceController.getByIdNamespace(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingNamespace=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??""),this.configPathControl.setValue(e.configPath??""),this.sharedExchangePathControl.setValue(e.sharedExchangePath??""),this.externalIdControl.setValue(e.externalId??""),this.defaultAgentNameControl.setValue(e.defaultAgentName??""),this.runCostThresholdControl.setValue(e.runCostThreshold??null),this.maxToolRoundsControl.setValue(e.maxToolRounds??null),this.adminCaseListingControl.setValue(e.adminCaseListing??""),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.maxToolRoundsUnparsable()||this.isSubmitting())return;this.isSubmitting.set(true);let t=w(x(w({},this.existingNamespace),{name:this.nameControl.value.trim(),description:this.descriptionControl.value.trim()||void 0,configPath:this.configPathControl.value.trim()||void 0,externalId:this.externalIdControl.value.trim()||void 0,defaultAgentName:this.defaultAgentNameControl.value.trim()||void 0,runCostThreshold:this.runCostThresholdControl.value??void 0,maxToolRounds:this.maxToolRoundsControl.value??void 0,adminCaseListing:this.adminCaseListingControl.value||void 0}),this.canEditSharedExchangePath()?{sharedExchangePath:this.sharedExchangePathPayload()}:{});(this.isEditMode()?this.namespaceController.updateNamespace(this.existingNamespace.id??"",t):this.namespaceController.createNamespace(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}sharedExchangePathPayload(){return this.sharedExchangePathControl.value.trim()||(this.existingNamespace?.sharedExchangePath?"":void 0)}cancel(){this.navigateBack();}navigateBack(){this.router.navigate(["/agentos/namespaces"]);}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=vw({type:i,selectors:[["agentos-namespace-form"]],decls:4,vars:3,consts:[[3,"framed"],[3,"title"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","ns-name","required",""],["dsControl","","id","ns-name","type","text","placeholder","Namespace name","autocomplete","off",3,"formControl"],["label","Description","controlId","ns-description"],["dsControl","","id","ns-description","rows","4","placeholder","Optional description",3,"formControl"],["label","External ID","controlId","ns-external-id"],["dsControl","","id","ns-external-id","type","text","placeholder","Optional federation ID from an external system","autocomplete","off",3,"formControl"],["label","Default agent","controlId","ns-default-agent"],["dsControl","","id","ns-default-agent","type","text","placeholder","Logical name of the default agent (e.g. coday)","autocomplete","off",3,"formControl"],["label","Config path","controlId","ns-config-path"],["dsControl","","id","ns-config-path","type","text","placeholder","Optional path to base configuration directory","autocomplete","off",3,"formControl"],["label","Shared files folder","controlId","ns-shared-exchange-path","hintId","ns-shared-exchange-path-hint","errorId","ns-shared-exchange-path-error",3,"hint","error"],["dsControl","","id","ns-shared-exchange-path","type","text","placeholder","Default location managed by AgentOS","aria-describedby","ns-shared-exchange-path-hint","autocomplete","off",3,"readOnly","formControl"],["label","Run cost threshold","controlId","ns-run-cost-threshold","hintId","ns-run-cost-threshold-hint",3,"hint"],["dsControl","","id","ns-run-cost-threshold","type","number","min","0","step","0.01","aria-describedby","ns-run-cost-threshold-hint",3,"placeholder","formControl"],["label","Maximum tool rounds","controlId","ns-max-tool-rounds","hintId","ns-max-tool-rounds-hint","errorId","ns-max-tool-rounds-error","hint","Most tool rounds one agent run may take. Leave empty to inherit the server default. A change applies from the next agent run.",3,"error"],["dsControl","","id","ns-max-tool-rounds","type","number","min","1","step","1","placeholder","Server default","aria-describedby","ns-max-tool-rounds-hint",3,"input","formControl"],["label","Cases visible to admins","controlId","ns-admin-case-listing","hintId","ns-admin-case-listing-hint","hint","Choose which conversations the admins of this namespace see in their list. Members always see only their own."],["dsControl","","id","ns-admin-case-listing","aria-describedby","ns-admin-case-listing-hint",3,"formControl"],[3,"value"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"]],template:function(e,u){e&1&&(Es(0,"ds-page",0),fg(1,"ds-section-header",1),jw(2,ue,2,0,"p",2)(3,pe,26,20,"form",3),hl()),e&2&&(dg("framed",!u.isEditMode()),BE(),dg("title",u.isEditMode()?"Edit namespace":"New namespace"),BE(),Bw(u.isLoading()?2:3));},dependencies:[Ut,nd,bo,xo,Lt,kn,Gt,mo,po,$r,Vn,An,pn,hn,cn,dn,at,an],encapsulation:2})};export{Ce as ADMIN_CASE_LISTING_OPTIONS,le as NamespaceFormComponent};
1
+ import {f,y,p as pt,T as Te,g as gn,q as qt,m as md,C as Co,M as Mo,H as Ht,F as Fn,U as Ut,a as po,h as ho,Z as Zr,A as An,O as On,b as hn,c as fn,u as un,d as cn,e as at,i as sn}from'./chunk-Uf57QzfJ.js';import {g,W,q as F,H as J,I as we,r as rT,$ as $i,O as Of,K as U,L as w,N as x,v as vw,E as Es,f as fg,j as jw,a as hl,P as dg,b as BE,c as Bw,x as xC,Y as Yw,Q as vg,R as MI,U as Uw,t as eC,S as xI,l as lg,k as $w,s as Dl,F as Fg,u as pf,w as hf}from'./main-DYDARBQQ.js';var de=/^(\/|[A-Za-z]:[\\/]|\\\\)/;function me(i){return de.test(i)}function ie(i=()=>true){return t=>{let e=(t.value??"").trim();return !i()||e===""||me(e)?null:{absolutePath:true}}}var ce=(i,t)=>t.value;function ue(i,t){i&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function he(i,t){if(i&1&&(Es(0,"option",23),xC(1),hl()),i&2){let e=t.$implicit;dg("value",e.value),BE(),Fg(e.label);}}function pe(i,t){if(i&1){let e=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let p=eC();return hf(p.submit())}),Es(1,"ds-form-field",5),fg(2,"input",6),MI(),hl(),Es(3,"ds-form-field",7),fg(4,"textarea",8),MI(),hl(),Es(5,"ds-form-field",9),fg(6,"input",10),MI(),hl(),Es(7,"ds-form-field",11),fg(8,"input",12),MI(),hl(),Es(9,"ds-form-field",13),fg(10,"input",14),MI(),hl(),Es(11,"ds-form-field",15),fg(12,"input",16),MI(),hl(),Es(13,"ds-form-field",17),fg(14,"input",18),MI(),hl(),Es(15,"ds-form-field",19)(16,"input",20),vg("input",function(p){pf(e);let se=eC();return hf(se.onMaxToolRoundsInput(p))}),hl(),MI(),hl(),Es(17,"ds-form-field",21)(18,"select",22),Uw(19,he,2,2,"option",23,ce),hl(),MI(),hl(),Es(21,"ds-form-actions")(22,"button",24),xC(23),hl(),Es(24,"button",25),vg("click",function(){pf(e);let p=eC();return hf(p.cancel())}),xC(25,"Cancel"),hl()()();}if(i&2){let e=eC();dg("formGroup",e.form),BE(2),dg("formControl",e.nameControl),xI(),BE(2),dg("formControl",e.descriptionControl),xI(),BE(2),dg("formControl",e.externalIdControl),xI(),BE(2),dg("formControl",e.defaultAgentNameControl),xI(),BE(2),dg("formControl",e.configPathControl),xI(),BE(),dg("hint",e.sharedExchangePathHint())("error",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid&&(e.sharedExchangePathControl.dirty||e.sharedExchangePathControl.touched)?"Enter an absolute path (e.g. /home/me/Coday or C:\\Coday), or leave the field empty.":null),BE(),dg("readOnly",!e.canEditSharedExchangePath())("formControl",e.sharedExchangePathControl),lg("aria-invalid",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid),xI(),BE(),dg("hint",e.runCostThresholdHint()),BE(),dg("placeholder",e.runCostThresholdPlaceholder())("formControl",e.runCostThresholdControl),xI(),BE(),dg("error",e.maxToolRoundsUnparsable()||e.maxToolRoundsControl.invalid&&(e.maxToolRoundsControl.dirty||e.maxToolRoundsControl.touched)?"Enter a whole number of at least 1, or leave the field empty.":null),BE(),dg("formControl",e.maxToolRoundsControl),lg("aria-invalid",e.maxToolRoundsControl.invalid||e.maxToolRoundsUnparsable()),xI(),BE(2),dg("formControl",e.adminCaseListingControl),xI(),BE(),$w(e.adminCaseListingOptions),BE(3),dg("disabled",e.form.invalid||e.isSubmitting()),BE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var fe=1,ge=2147483647,Ce=[{value:"",label:"Default"},{value:"OWN",label:"Their own cases"},{value:"SWITCH",label:"Their own, with a switch to see all"},{value:"ALL",label:"All cases of the namespace"}],le=class i{route=g(W);router=g(F);namespaceController=g(J);destroyRef=g(we);usageConfiguration=g(f);userState=g(y);canEditSharedExchangePath=rT(()=>this.userState.currentUser()?.isAdmin===true);sharedExchangePathHint=rT(()=>this.canEditSharedExchangePath()?"Absolute path of a folder on the server that holds the files shared by the namespace. Leave empty for the default location.":"Only a super-admin can change this folder.");runCostThresholdPlaceholder=rT(()=>{let t=this.usageConfiguration.runCostThreshold();return this.usageConfiguration.enabled()?t===null?"No platform limit":`Platform default: ${t}`:"Optional maximum cost per run (e.g. 0.50)"});runCostThresholdHint=rT(()=>{let t="Leave empty to inherit the platform default",e=this.usageConfiguration.runCostThreshold();switch(this.usageConfiguration.state()){case "enabled":return e===null?`${t}: no limit.`:`${t} (${e}).`;case "disabled":return `${t}. Cost limits are inactive while usage tracking is disabled.`;default:return `${t}.`}});form=new pt({name:new Te("",{nonNullable:true,validators:[gn.required,gn.minLength(1)]}),description:new Te("",{nonNullable:true}),configPath:new Te("",{nonNullable:true}),sharedExchangePath:new Te("",{nonNullable:true,validators:[ie(()=>this.canEditSharedExchangePath())]}),externalId:new Te("",{nonNullable:true}),defaultAgentName:new Te("",{nonNullable:true}),runCostThreshold:new Te(null),maxToolRounds:new Te(null,{validators:[gn.min(fe),gn.max(ge),gn.pattern(/^\d+$/)]}),adminCaseListing:new Te("",{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get configPathControl(){return this.form.controls.configPath}get sharedExchangePathControl(){return this.form.controls.sharedExchangePath}get externalIdControl(){return this.form.controls.externalId}get defaultAgentNameControl(){return this.form.controls.defaultAgentName}get runCostThresholdControl(){return this.form.controls.runCostThreshold}get maxToolRoundsControl(){return this.form.controls.maxToolRounds}get adminCaseListingControl(){return this.form.controls.adminCaseListing}adminCaseListingOptions=Ce;maxToolRoundsUnparsable=$i(false);onMaxToolRoundsInput(t){this.maxToolRoundsUnparsable.set(t.target.validity.badInput);}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);existingNamespace=null;constructor(){Of(()=>{this.canEditSharedExchangePath(),this.sharedExchangePathControl.updateValueAndValidity();});}ngOnInit(){this.userState.currentUser()||this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({error:()=>{}});let t=this.route.snapshot.paramMap.get("namespaceId")??this.route.parent?.snapshot.paramMap.get("namespaceId");t&&(this.isEditMode.set(true),this.loadNamespace(t));}loadNamespace(t){this.isLoading.set(true),this.namespaceController.getByIdNamespace(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingNamespace=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??""),this.configPathControl.setValue(e.configPath??""),this.sharedExchangePathControl.setValue(e.sharedExchangePath??""),this.externalIdControl.setValue(e.externalId??""),this.defaultAgentNameControl.setValue(e.defaultAgentName??""),this.runCostThresholdControl.setValue(e.runCostThreshold??null),this.maxToolRoundsControl.setValue(e.maxToolRounds??null),this.adminCaseListingControl.setValue(e.adminCaseListing??""),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.maxToolRoundsUnparsable()||this.isSubmitting())return;this.isSubmitting.set(true);let t=w(x(w({},this.existingNamespace),{name:this.nameControl.value.trim(),description:this.descriptionControl.value.trim()||void 0,configPath:this.configPathControl.value.trim()||void 0,externalId:this.externalIdControl.value.trim()||void 0,defaultAgentName:this.defaultAgentNameControl.value.trim()||void 0,runCostThreshold:this.runCostThresholdControl.value??void 0,maxToolRounds:this.maxToolRoundsControl.value??void 0,adminCaseListing:this.adminCaseListingControl.value||void 0}),this.canEditSharedExchangePath()?{sharedExchangePath:this.sharedExchangePathPayload()}:{});(this.isEditMode()?this.namespaceController.updateNamespace(this.existingNamespace.id??"",t):this.namespaceController.createNamespace(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}sharedExchangePathPayload(){return this.sharedExchangePathControl.value.trim()||(this.existingNamespace?.sharedExchangePath?"":void 0)}cancel(){this.navigateBack();}navigateBack(){this.router.navigate(["/agentos/namespaces"]);}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=vw({type:i,selectors:[["agentos-namespace-form"]],decls:4,vars:3,consts:[[3,"framed"],[3,"title"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","ns-name","required",""],["dsControl","","id","ns-name","type","text","placeholder","Namespace name","autocomplete","off",3,"formControl"],["label","Description","controlId","ns-description"],["dsControl","","id","ns-description","rows","4","placeholder","Optional description",3,"formControl"],["label","External ID","controlId","ns-external-id"],["dsControl","","id","ns-external-id","type","text","placeholder","Optional federation ID from an external system","autocomplete","off",3,"formControl"],["label","Default agent","controlId","ns-default-agent"],["dsControl","","id","ns-default-agent","type","text","placeholder","Logical name of the default agent (e.g. coday)","autocomplete","off",3,"formControl"],["label","Config path","controlId","ns-config-path"],["dsControl","","id","ns-config-path","type","text","placeholder","Optional path to base configuration directory","autocomplete","off",3,"formControl"],["label","Shared files folder","controlId","ns-shared-exchange-path","hintId","ns-shared-exchange-path-hint","errorId","ns-shared-exchange-path-error",3,"hint","error"],["dsControl","","id","ns-shared-exchange-path","type","text","placeholder","Default location managed by AgentOS","aria-describedby","ns-shared-exchange-path-hint","autocomplete","off",3,"readOnly","formControl"],["label","Run cost threshold","controlId","ns-run-cost-threshold","hintId","ns-run-cost-threshold-hint",3,"hint"],["dsControl","","id","ns-run-cost-threshold","type","number","min","0","step","0.01","aria-describedby","ns-run-cost-threshold-hint",3,"placeholder","formControl"],["label","Maximum tool rounds","controlId","ns-max-tool-rounds","hintId","ns-max-tool-rounds-hint","errorId","ns-max-tool-rounds-error","hint","Most tool rounds one agent run may take. Leave empty to inherit the server default. A change applies from the next agent run.",3,"error"],["dsControl","","id","ns-max-tool-rounds","type","number","min","1","step","1","placeholder","Server default","aria-describedby","ns-max-tool-rounds-hint",3,"input","formControl"],["label","Cases visible to admins","controlId","ns-admin-case-listing","hintId","ns-admin-case-listing-hint","hint","Choose which conversations the admins of this namespace see in their list. Members always see only their own."],["dsControl","","id","ns-admin-case-listing","aria-describedby","ns-admin-case-listing-hint",3,"formControl"],[3,"value"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"]],template:function(e,u){e&1&&(Es(0,"ds-page",0),fg(1,"ds-section-header",1),jw(2,ue,2,0,"p",2)(3,pe,26,20,"form",3),hl()),e&2&&(dg("framed",!u.isEditMode()),BE(),dg("title",u.isEditMode()?"Edit namespace":"New namespace"),BE(),Bw(u.isLoading()?2:3));},dependencies:[qt,md,Co,Mo,Ht,Fn,Ut,po,ho,Zr,An,On,hn,fn,un,cn,at,sn],encapsulation:2})};export{Ce as ADMIN_CASE_LISTING_OPTIONS,le as NamespaceFormComponent};
@@ -1,2 +1,2 @@
1
- import {v}from'./chunk-CZVszAsn.js';import {I,n as nt,i as it}from'./chunk-CFXn7UF0.js';import {g,W,q as F,I as we,$ as $i,a9 as F$1,r as rT,O as Of,K as U,N as x,L as w,v as vw,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,c as Bw,Y as Yw,U as Uw,ao as Hw,R as MI,f as fg,t as eC,S as xI,k as $w,s as Dl,ae as Pw,F as Fg,l as lg,u as pf,w as hf}from'./main-2G6YLE3Q.js';import {T as Te,a as fn,p as pt,d as pn,h as hn,e as cn,r as ln,g as dn,i as at,j as an,t as rn,U as Ut,n as nd,b as bo,x as xo,L as Lt,G as Gt,w as pa,m as mo,c as po,V as Vn,A as An}from'./chunk-CSMJ7MDS.js';import'./chunk-yhFoWYCU.js';function Ce(i,t){i&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function ye(i,t){if(i&1&&(Es(0,"label",16),fg(1,"input",17),MI(),xC(2),hl()),i&2){let e=t.$implicit,n=eC(3);BE(),dg("formControl",n.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!n.isAdmin()),xI(),BE(),Dl(" ",e.label," ");}}function ge(i,t){if(i&1&&(Es(0,"ds-fieldset",5),Uw(1,ye,3,4,"label",16,Pw().trackByScope,true),hl()),i&2){let e=eC(2);dg("disabled",e.isEditMode()),BE(),$w(e.scopeOptions);}}function fe(i,t){if(i&1&&(Es(0,"option",8),xC(1),hl()),i&2){let e=t.$implicit,n=eC(2);dg("value",e),BE(),Fg(n.authTypeLabel[e]);}}function Se(i,t){if(i&1&&(Es(0,"ds-form-field",18),fg(1,"input",19),MI(),hl()),i&2){let e=eC().$implicit;dg("label",e.label)("controlId","as-cred-"+e.key)("required",e.required)("hint",e.hint??null)("hintId","as-hint-"+e.key),BE(),dg("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),lg("aria-describedby",e.hint?"as-hint-"+e.key:null),xI();}}function Ae(i,t){if(i&1&&jw(0,Se,2,11,"ds-form-field",18),i&2){let e,n=t.$implicit,o=eC(3);Bw((e=o.controlForField(n.key))?0:-1,e);}}function ve(i,t){if(i&1&&(Es(0,"ds-fieldset",13),Uw(1,Ae,1,1,null,null,Pw().trackByField,true),hl()),i&2){let e=eC(2);dg("hint","Values are stored encrypted and masked on read."+(e.isEditMode()?" Leave a field unchanged to keep the stored credential.":"")),BE(),$w(e.credentialFields());}}function be(i,t){if(i&1){let e=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let o=eC();return hf(o.submit())}),jw(1,ge,3,1,"ds-fieldset",5),Es(2,"ds-form-field",6)(3,"select",7),Uw(4,fe,2,2,"option",8,Hw),hl(),MI(),hl(),Es(6,"ds-form-field",9),fg(7,"input",10),MI(),hl(),Es(8,"ds-form-field",11),fg(9,"input",12),MI(),hl(),jw(10,ve,3,1,"ds-fieldset",13),Es(11,"ds-form-actions")(12,"button",14),xC(13),hl(),Es(14,"button",15),vg("click",function(){pf(e);let o=eC();return hf(o.cancel())}),xC(15,"Cancel"),hl()()();}if(i&2){let e=eC();dg("formGroup",e.form),BE(),Bw(e.isPlatformMode?-1:1),BE(2),dg("formControl",e.authTypeControl),xI(),BE(),$w(e.authTypeOptions),BE(3),dg("formControl",e.nameControl),xI(),BE(2),dg("formControl",e.descriptionControl),xI(),BE(),Bw(e.credentialFields().length>0?10:-1),BE(2),dg("disabled",e.form.invalid||e.isSubmitting()),BE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var ke=new Set(["namespace","userOnNs","userGlobal"]),D=Object.freeze({platform:"Platform (read-only)",namespace:"Namespace configuration",userOnNs:"Personal \u2014 this namespace only",userGlobal:"Personal \u2014 all namespaces"}),_e={ApiKeyAuthSetting:[{key:"apiKey",label:"API Key",placeholder:"sk-\u2026",secret:true,required:false}],BasicAuthAuthSetting:[{key:"username",label:"Username",placeholder:"user@example.com",secret:false,required:false},{key:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",secret:true,required:false}],BearerTokenAuthSetting:[{key:"token",label:"Bearer token",placeholder:"eyJ\u2026",secret:true,required:false}],OAuthDiscoverableAuthSetting:[{key:"discoveryUrl",label:"Discovery URL",placeholder:"https://\u2026/.well-known/openid-configuration",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthCustomAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthRegisteredAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthMcpDiscoverableAuthSetting:[{key:"resourceUrl",label:"Resource URL",placeholder:"https://mcp.example.com",hint:"Use the base URL exactly as documented by your provider \u2014 do not append a path suffix. Examples: https://mcp.hubspot.com (HubSpot), https://mcp.atlassian.com/v1/mcp (Atlassian).",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",hint:"Leave empty to let the server register an OAuth client automatically (RFC 7591 dynamic registration). Fill in only if you have a pre-registered client ID from your provider.",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Leave empty in most cases \u2014 the MCP server declares the required scopes itself. Fill in only if your provider explicitly requires client-declared scopes.",secret:false,required:false}]},me=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?$i(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=nt;authTypeLabel=it;scopeOptions=[{value:"namespace",label:D.namespace},{value:"userOnNs",label:D.userOnNs},{value:"userGlobal",label:D.userGlobal}];nameControl=new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]});descriptionControl=new Te(null);authTypeControl=new Te("ApiKeyAuthSetting",{nonNullable:true,validators:[fn.required]});scopeControl=new Te("namespace",{nonNullable:true});form=new pt({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new Te("",{nonNullable:true});usernameControl=new Te("",{nonNullable:true});passwordControl=new Te("",{nonNullable:true});tokenControl=new Te("",{nonNullable:true});discoveryUrlControl=new Te("",{nonNullable:true});authorizationUrlControl=new Te("",{nonNullable:true});tokenUrlControl=new Te("",{nonNullable:true});clientIdControl=new Te("",{nonNullable:true});clientSecretControl=new Te("",{nonNullable:true});scopesControl=new Te("",{nonNullable:true});resourceUrlControl=new Te("",{nonNullable:true});selectedAuthType=F$1(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=rT(()=>_e[this.selectedAuthType()]);isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Of(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,n=t.get("authSettingId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let o=this.parseScope(e.get("scope"));this.scopeControl.setValue(o);let v=e.get("template");v&&this.hydrateFromTemplate(v);}parseScope(t){return t&&ke.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId&&!t.namespaceId?"platform":t.userId?t.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AuthSettingForm] Could not load auth setting '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.authTypeControl.setValue(e.authType),this.clearCredentialControls(),this.initialCredentials={},this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AuthSettingForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){switch(this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.authTypeControl.setValue(t.authType),this.clearCredentialControls(),this.initialCredentials={},t.authType){case "ApiKeyAuthSetting":{let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialCredentials.apiKey=e;break}case "BasicAuthAuthSetting":{let e=t,n=e.username??"",o=e.password??"";this.usernameControl.setValue(n),this.passwordControl.setValue(o),this.initialCredentials.username=n,this.initialCredentials.password=o;break}case "BearerTokenAuthSetting":{let e=t.token??"";this.tokenControl.setValue(e),this.initialCredentials.token=e;break}case "OAuthDiscoverableAuthSetting":{let e=t;this.discoveryUrlControl.setValue(e.discoveryUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.discoveryUrl=e.discoveryUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthCustomAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthRegisteredAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthMcpDiscoverableAuthSetting":{let e=t;this.resourceUrlControl.setValue(e.resourceUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.resourceUrl=e.resourceUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}}}clearCredentialControls(){this.apiKeyControl.setValue(""),this.usernameControl.setValue(""),this.passwordControl.setValue(""),this.tokenControl.setValue(""),this.discoveryUrlControl.setValue(""),this.authorizationUrlControl.setValue(""),this.tokenUrlControl.setValue(""),this.clientIdControl.setValue(""),this.clientSecretControl.setValue(""),this.scopesControl.setValue(""),this.resourceUrlControl.setValue("");}credentialValue(t,e){if(!(this.isEditMode()&&e===this.initialCredentials[t]))return e||void 0}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.nameControl.value.trim(),e=this.descriptionControl.value?.trim()||void 0,n=this.authTypeControl.value,o=this.form.getRawValue().scope,v=this.isPlatformMode?null:this.namespaceId??null,w=this.buildTypedPayload(n,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,this.existingConfig):this.state.create(w,o,v)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}buildTypedPayload(t,e,n){let o={name:e,description:n};switch(t){case "ApiKeyAuthSetting":return x(w({},o),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return x(w({},o),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return x(w({},o),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return x(w({},o),{authType:"OAuthDiscoverableAuthSetting",discoveryUrl:this.credentialValue("discoveryUrl",this.discoveryUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthCustomAuthSetting":return x(w({},o),{authType:"OAuthCustomAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthRegisteredAuthSetting":return x(w({},o),{authType:"OAuthRegisteredAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthMcpDiscoverableAuthSetting":return x(w({},o),{authType:"OAuthMcpDiscoverableAuthSetting",resourceUrl:this.credentialValue("resourceUrl",this.resourceUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)})}}controlForField(t){return {apiKey:this.apiKeyControl,username:this.usernameControl,password:this.passwordControl,token:this.tokenControl,discoveryUrl:this.discoveryUrlControl,authorizationUrl:this.authorizationUrlControl,tokenUrl:this.tokenUrlControl,clientId:this.clientIdControl,clientSecret:this.clientSecretControl,scopes:this.scopesControl,resourceUrl:this.resourceUrlControl}[t]}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","auth-settings"]):this.router.navigate(["/agentos",this.namespaceId,"auth-settings"]);}trackByScope(t,e){return e.value}trackByField(t,e){return e.key}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=vw({type:i,selectors:[["agentos-auth-setting-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to auth settings",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Configuration scope",3,"disabled"],["label","Auth type","controlId","as-auth-type","required",""],["dsControl","","id","as-auth-type",3,"formControl"],[3,"value"],["label","Name","controlId","as-name","required",""],["dsControl","","id","as-name","type","text","placeholder","e.g. GitHub OAuth App","autocomplete","off",3,"formControl"],["label","Description","controlId","as-description"],["dsControl","","id","as-description","type","text","placeholder","Optional \u2014 short description of this auth setting","autocomplete","off",3,"formControl"],["legend","Credentials",3,"hint"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsCheck",""],["type","radio",3,"formControl","value","disabled"],[3,"label","controlId","required","hint","hintId"],["dsControl","",3,"id","type","placeholder","formControl","autocomplete"]],template:function(e,n){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return n.cancel()}),xC(3," \u2190 Auth settings "),hl()(),jw(4,Ce,2,0,"p",2)(5,be,16,8,"form",3),hl()),e&2&&(BE(),dg("title",n.isEditMode()?"Edit auth setting":"New auth setting"),BE(3),Bw(n.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,at,an,rn,Ut,nd,bo,xo,Lt,Gt,pa,mo,po,Vn,An],encapsulation:2})};
1
+ import {v}from'./chunk-D8BMEvrt.js';import {I,n as nt,i as it}from'./chunk-DbN0_APN.js';import {g,W,q as F,I as we,$ as $i,a9 as F$1,r as rT,O as Of,K as U,N as x,L as w,v as vw,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,c as Bw,Y as Yw,U as Uw,ao as Hw,R as MI,f as fg,t as eC,S as xI,k as $w,s as Dl,ae as Pw,F as Fg,l as lg,u as pf,w as hf}from'./main-DYDARBQQ.js';import {T as Te,g as gn,p as pt,b as hn,c as fn,u as un,o as dn,d as cn,e as at,i as sn,t as an,q as qt,m as md,C as Co,M as Mo,H as Ht,U as Ut,x as ya,a as po,h as ho,A as An,O as On}from'./chunk-Uf57QzfJ.js';import'./chunk-CTrUVP-N.js';function Ce(i,t){i&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function ye(i,t){if(i&1&&(Es(0,"label",16),fg(1,"input",17),MI(),xC(2),hl()),i&2){let e=t.$implicit,n=eC(3);BE(),dg("formControl",n.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!n.isAdmin()),xI(),BE(),Dl(" ",e.label," ");}}function ge(i,t){if(i&1&&(Es(0,"ds-fieldset",5),Uw(1,ye,3,4,"label",16,Pw().trackByScope,true),hl()),i&2){let e=eC(2);dg("disabled",e.isEditMode()),BE(),$w(e.scopeOptions);}}function fe(i,t){if(i&1&&(Es(0,"option",8),xC(1),hl()),i&2){let e=t.$implicit,n=eC(2);dg("value",e),BE(),Fg(n.authTypeLabel[e]);}}function Se(i,t){if(i&1&&(Es(0,"ds-form-field",18),fg(1,"input",19),MI(),hl()),i&2){let e=eC().$implicit;dg("label",e.label)("controlId","as-cred-"+e.key)("required",e.required)("hint",e.hint??null)("hintId","as-hint-"+e.key),BE(),dg("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),lg("aria-describedby",e.hint?"as-hint-"+e.key:null),xI();}}function Ae(i,t){if(i&1&&jw(0,Se,2,11,"ds-form-field",18),i&2){let e,n=t.$implicit,o=eC(3);Bw((e=o.controlForField(n.key))?0:-1,e);}}function ve(i,t){if(i&1&&(Es(0,"ds-fieldset",13),Uw(1,Ae,1,1,null,null,Pw().trackByField,true),hl()),i&2){let e=eC(2);dg("hint","Values are stored encrypted and masked on read."+(e.isEditMode()?" Leave a field unchanged to keep the stored credential.":"")),BE(),$w(e.credentialFields());}}function be(i,t){if(i&1){let e=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let o=eC();return hf(o.submit())}),jw(1,ge,3,1,"ds-fieldset",5),Es(2,"ds-form-field",6)(3,"select",7),Uw(4,fe,2,2,"option",8,Hw),hl(),MI(),hl(),Es(6,"ds-form-field",9),fg(7,"input",10),MI(),hl(),Es(8,"ds-form-field",11),fg(9,"input",12),MI(),hl(),jw(10,ve,3,1,"ds-fieldset",13),Es(11,"ds-form-actions")(12,"button",14),xC(13),hl(),Es(14,"button",15),vg("click",function(){pf(e);let o=eC();return hf(o.cancel())}),xC(15,"Cancel"),hl()()();}if(i&2){let e=eC();dg("formGroup",e.form),BE(),Bw(e.isPlatformMode?-1:1),BE(2),dg("formControl",e.authTypeControl),xI(),BE(),$w(e.authTypeOptions),BE(3),dg("formControl",e.nameControl),xI(),BE(2),dg("formControl",e.descriptionControl),xI(),BE(),Bw(e.credentialFields().length>0?10:-1),BE(2),dg("disabled",e.form.invalid||e.isSubmitting()),BE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var ke=new Set(["namespace","userOnNs","userGlobal"]),D=Object.freeze({platform:"Platform (read-only)",namespace:"Namespace configuration",userOnNs:"Personal \u2014 this namespace only",userGlobal:"Personal \u2014 all namespaces"}),_e={ApiKeyAuthSetting:[{key:"apiKey",label:"API Key",placeholder:"sk-\u2026",secret:true,required:false}],BasicAuthAuthSetting:[{key:"username",label:"Username",placeholder:"user@example.com",secret:false,required:false},{key:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",secret:true,required:false}],BearerTokenAuthSetting:[{key:"token",label:"Bearer token",placeholder:"eyJ\u2026",secret:true,required:false}],OAuthDiscoverableAuthSetting:[{key:"discoveryUrl",label:"Discovery URL",placeholder:"https://\u2026/.well-known/openid-configuration",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthCustomAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthRegisteredAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthMcpDiscoverableAuthSetting:[{key:"resourceUrl",label:"Resource URL",placeholder:"https://mcp.example.com",hint:"Use the base URL exactly as documented by your provider \u2014 do not append a path suffix. Examples: https://mcp.hubspot.com (HubSpot), https://mcp.atlassian.com/v1/mcp (Atlassian).",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",hint:"Leave empty to let the server register an OAuth client automatically (RFC 7591 dynamic registration). Fill in only if you have a pre-registered client ID from your provider.",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Leave empty in most cases \u2014 the MCP server declares the required scopes itself. Fill in only if your provider explicitly requires client-declared scopes.",secret:false,required:false}]},me=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?$i(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=nt;authTypeLabel=it;scopeOptions=[{value:"namespace",label:D.namespace},{value:"userOnNs",label:D.userOnNs},{value:"userGlobal",label:D.userGlobal}];nameControl=new Te("",{nonNullable:true,validators:[gn.required,gn.minLength(1)]});descriptionControl=new Te(null);authTypeControl=new Te("ApiKeyAuthSetting",{nonNullable:true,validators:[gn.required]});scopeControl=new Te("namespace",{nonNullable:true});form=new pt({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new Te("",{nonNullable:true});usernameControl=new Te("",{nonNullable:true});passwordControl=new Te("",{nonNullable:true});tokenControl=new Te("",{nonNullable:true});discoveryUrlControl=new Te("",{nonNullable:true});authorizationUrlControl=new Te("",{nonNullable:true});tokenUrlControl=new Te("",{nonNullable:true});clientIdControl=new Te("",{nonNullable:true});clientSecretControl=new Te("",{nonNullable:true});scopesControl=new Te("",{nonNullable:true});resourceUrlControl=new Te("",{nonNullable:true});selectedAuthType=F$1(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=rT(()=>_e[this.selectedAuthType()]);isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Of(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,n=t.get("authSettingId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let o=this.parseScope(e.get("scope"));this.scopeControl.setValue(o);let v=e.get("template");v&&this.hydrateFromTemplate(v);}parseScope(t){return t&&ke.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId&&!t.namespaceId?"platform":t.userId?t.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AuthSettingForm] Could not load auth setting '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.authTypeControl.setValue(e.authType),this.clearCredentialControls(),this.initialCredentials={},this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AuthSettingForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){switch(this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.authTypeControl.setValue(t.authType),this.clearCredentialControls(),this.initialCredentials={},t.authType){case "ApiKeyAuthSetting":{let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialCredentials.apiKey=e;break}case "BasicAuthAuthSetting":{let e=t,n=e.username??"",o=e.password??"";this.usernameControl.setValue(n),this.passwordControl.setValue(o),this.initialCredentials.username=n,this.initialCredentials.password=o;break}case "BearerTokenAuthSetting":{let e=t.token??"";this.tokenControl.setValue(e),this.initialCredentials.token=e;break}case "OAuthDiscoverableAuthSetting":{let e=t;this.discoveryUrlControl.setValue(e.discoveryUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.discoveryUrl=e.discoveryUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthCustomAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthRegisteredAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthMcpDiscoverableAuthSetting":{let e=t;this.resourceUrlControl.setValue(e.resourceUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.resourceUrl=e.resourceUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}}}clearCredentialControls(){this.apiKeyControl.setValue(""),this.usernameControl.setValue(""),this.passwordControl.setValue(""),this.tokenControl.setValue(""),this.discoveryUrlControl.setValue(""),this.authorizationUrlControl.setValue(""),this.tokenUrlControl.setValue(""),this.clientIdControl.setValue(""),this.clientSecretControl.setValue(""),this.scopesControl.setValue(""),this.resourceUrlControl.setValue("");}credentialValue(t,e){if(!(this.isEditMode()&&e===this.initialCredentials[t]))return e||void 0}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.nameControl.value.trim(),e=this.descriptionControl.value?.trim()||void 0,n=this.authTypeControl.value,o=this.form.getRawValue().scope,v=this.isPlatformMode?null:this.namespaceId??null,w=this.buildTypedPayload(n,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,this.existingConfig):this.state.create(w,o,v)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}buildTypedPayload(t,e,n){let o={name:e,description:n};switch(t){case "ApiKeyAuthSetting":return x(w({},o),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return x(w({},o),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return x(w({},o),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return x(w({},o),{authType:"OAuthDiscoverableAuthSetting",discoveryUrl:this.credentialValue("discoveryUrl",this.discoveryUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthCustomAuthSetting":return x(w({},o),{authType:"OAuthCustomAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthRegisteredAuthSetting":return x(w({},o),{authType:"OAuthRegisteredAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthMcpDiscoverableAuthSetting":return x(w({},o),{authType:"OAuthMcpDiscoverableAuthSetting",resourceUrl:this.credentialValue("resourceUrl",this.resourceUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)})}}controlForField(t){return {apiKey:this.apiKeyControl,username:this.usernameControl,password:this.passwordControl,token:this.tokenControl,discoveryUrl:this.discoveryUrlControl,authorizationUrl:this.authorizationUrlControl,tokenUrl:this.tokenUrlControl,clientId:this.clientIdControl,clientSecret:this.clientSecretControl,scopes:this.scopesControl,resourceUrl:this.resourceUrlControl}[t]}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","auth-settings"]):this.router.navigate(["/agentos",this.namespaceId,"auth-settings"]);}trackByScope(t,e){return e.value}trackByField(t,e){return e.key}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=vw({type:i,selectors:[["agentos-auth-setting-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to auth settings",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Configuration scope",3,"disabled"],["label","Auth type","controlId","as-auth-type","required",""],["dsControl","","id","as-auth-type",3,"formControl"],[3,"value"],["label","Name","controlId","as-name","required",""],["dsControl","","id","as-name","type","text","placeholder","e.g. GitHub OAuth App","autocomplete","off",3,"formControl"],["label","Description","controlId","as-description"],["dsControl","","id","as-description","type","text","placeholder","Optional \u2014 short description of this auth setting","autocomplete","off",3,"formControl"],["legend","Credentials",3,"hint"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsCheck",""],["type","radio",3,"formControl","value","disabled"],[3,"label","controlId","required","hint","hintId"],["dsControl","",3,"id","type","placeholder","formControl","autocomplete"]],template:function(e,n){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return n.cancel()}),xC(3," \u2190 Auth settings "),hl()(),jw(4,Ce,2,0,"p",2)(5,be,16,8,"form",3),hl()),e&2&&(BE(),dg("title",n.isEditMode()?"Edit auth setting":"New auth setting"),BE(3),Bw(n.isLoading()?4:5));},dependencies:[hn,fn,un,dn,cn,at,sn,an,qt,md,Co,Mo,Ht,Ut,ya,po,ho,An,On],encapsulation:2})};
2
2
  export{me as AuthSettingFormComponent};
@@ -1 +1 @@
1
- import {e}from'./chunk-C6dIhkYp.js';import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-CZVszAsn.js';import {O}from'./chunk-BR-v_Yw0.js';import {g,W as W$1,q as F,I as we,H as J,$ as $i,K as U$1,ad as ne$1,a1 as ga,aa as br,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,P as dg,b as BE,c as Bw,t as eC,F as Fg,U as Uw,k as $w,s as Dl,Y as Yw,l as lg,u as pf,w as hf}from'./main-2G6YLE3Q.js';import {z as k,O as O$1,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-CSMJ7MDS.js';import'./chunk-yhFoWYCU.js';var Q=(n,e)=>e.key;function W(n,e){if(n&1&&(Es(0,"p",3),xC(1),hl()),n&2){let t=eC();BE(),Fg(t.deletion.error());}}function X(n,e){n&1&&(Es(0,"p",4),xC(1,"Loading integrations\u2026"),hl());}function Z(n,e){n&1&&(Es(0,"p",5),xC(1,"No integrations available."),hl());}function ee(n,e){n&1&&(Es(0,"p",4),xC(1,"No integrations match the current filter."),hl());}function te(n,e){n&1&&(Es(0,"ds-tag",20),xC(1,"YAML"),hl(),Es(2,"ds-tag",21),xC(3,"Read-only"),hl());}function ne(n,e){if(n&1){let t=Yw();Es(0,"button",22),vg("click",function(){pf(t);let s=eC().$implicit,c=eC(2);return hf(c.view(s))}),xC(1,"View"),hl();}if(n&2){let t=eC().$implicit;lg("aria-label","View "+t.config.name);}}function ie(n,e){if(n&1){let t=Yw();Es(0,"button",22),vg("click",function(){pf(t);let s=eC(3).$implicit,c=eC(2);return hf(c.edit(s))}),xC(1," Edit "),hl();}if(n&2){let t=eC(3).$implicit;lg("aria-label","Edit "+t.config.name);}}function oe(n,e){if(n&1){let t=Yw();Es(0,"button",22),vg("click",function(){pf(t);let s=eC(2).$implicit,c=eC(2);return hf(c.duplicate(s))}),xC(1," Duplicate "),hl(),jw(2,ie,2,1,"button",19);}if(n&2){let t=eC(2).$implicit;lg("aria-label","Duplicate "+t.config.name),BE(2),Bw(t.canEdit?2:-1);}}function ae(n,e){if(n&1){let t=Yw();Es(0,"agentos-row-delete-action",25),vg("deleteRequested",function(){pf(t);let s=eC(2).$implicit,c=eC(2);return hf(c.deletion.request(s.key))})("deleteConfirmed",function(){pf(t);let s=eC(2).$implicit,c=eC(2);return hf(c.confirmDelete(s))})("deleteCancelled",function(){pf(t);let s=eC(4);return hf(s.deletion.cancel())}),hl();}if(n&2){let t=eC(2).$implicit,a=eC(2);dg("rowKey",t.key)("rowLabel",t.config.name)("state",a.deletion);}}function re(n,e){n&1&&(Es(0,"button",24),xC(1,"Inherited"),hl());}function le(n,e){if(n&1&&(jw(0,oe,3,2),jw(1,ae,1,3,"agentos-row-delete-action",23),jw(2,re,2,0,"button",24)),n&2){let t=eC().$implicit,a=eC(2);Bw(a.deletion.confirmingId()!==t.key?0:-1),BE(),Bw(t.canDelete?1:-1),BE(),Bw(!t.canEdit&&!t.canDelete?2:-1);}}function se(n,e){if(n&1&&(Es(0,"tr",9)(1,"td",12),xC(2),hl(),Es(3,"td",13),xC(4),hl(),Es(5,"td",14)(6,"div",15)(7,"ds-tag",16),xC(8),hl(),jw(9,te,4,0),hl()(),Es(10,"td",17)(11,"div",18),jw(12,ne,2,1,"button",19)(13,le,3,3),hl()()()),n&2){let t=e.$implicit;BE(2),Fg(t.config.name),BE(2),Dl(" ",t.config.integrationType," "),BE(3),dg("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),BE(),Dl(" ",t.scopeLabel," "),BE(),Bw(t.source==="FILESYSTEM"?9:-1),BE(3),Bw(t.source==="FILESYSTEM"?12:13);}}function ce(n,e){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Type"),hl(),Es(8,"th",10),xC(9,"Scope"),hl(),Es(10,"th",10)(11,"span",11),xC(12,"Actions"),hl()()()(),Es(13,"tbody",8),Uw(14,se,14,6,"tr",9,Q),hl()()()),n&2){let t=eC();BE(14),$w(t.rowFilter.filteredRows());}}var U=class n$1{route=g(W$1);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceApi=g(J);namespaceId=this.route.snapshot.params.namespaceId;namespaceName=$i("this namespace");isAdmin=$i(false);isLoading=$i(true);rows=$i([]);deletion=k();rowFilter=O$1(this.rows,e=>[e.config.name,e.config.integrationType,e.scopeLabel,e.source].join(" "));ngOnInit(){this.state.setNamespace(this.namespaceId),this.namespaceId&&this.namespaceApi.getByIdNamespace(this.namespaceId).pipe(U$1(this.destroyRef)).subscribe({next:e=>this.namespaceName.set(e.name)}),this.route.paramMap.pipe(ne$1(e=>e.get("namespaceId")??""),ga(e=>e?this.namespaceRole.isAdminOfNamespace$(e):br(false)),U$1(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.rows.set(this.toRows(e)),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:n(this.isAdmin())}});}view(e){e.config.id&&this.router.navigate(["/agentos",this.namespaceId,"integrations",e.config.id,"view"]);}edit(e){!e.canEdit||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"integrations",e.config.id,"edit"],{queryParams:{scope:e.scope}});}duplicate(e){if(e.source==="FILESYSTEM"||!e.config.id)return;let a=(e.scope==="platform"||e.scope==="namespace")&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:a,template:e.config.id,templateScope:e.scope}});}confirmDelete(e){!e.canDelete||!e.config.id||this.deletion.execute(e.key,{request$:this.state.delete(e.config.id,e.scope).pipe(U$1(this.destroyRef)),errorMessage:`Deleting "${e.config.name}" failed. Try again.`});}toRows(e){return [...this.mapScope(e.platform,"platform","Platform",true),...this.mapScope(e.namespace,"namespace","Namespace",!this.isAdmin()),...this.mapScope(e.userOnNs,"userOnNs","Personal",false),...this.mapScope(e.userGlobal,"userGlobal","Personal",false)]}mapScope(e$1,t,a,s){return e$1.map((c,z)=>{let h=e(c),w=h==="NEO4J"&&!s;return {key:`${t}:${c.id??z}`,config:c,scope:t,scopeLabel:a,source:h,canEdit:w,canDelete:w}})}static \u0275fac=function(t){return new(t||n$1)};static \u0275cmp=vw({type:n$1,selectors:[["agentos-integrations-all-scopes"]],decls:9,vars:4,consts:[["title","Integrations",3,"description"],["label","Filter integrations","placeholder","Filter integrations\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Integrations"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Type",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["variant","neutral"],["variant","outline"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button","disabled",""],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,a){t&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return a.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return a.openCreateForm()}),xC(3,"New integration"),hl()(),jw(4,W,2,1,"p",3),jw(5,X,2,0,"p",4)(6,Z,2,0,"p",5)(7,ee,2,0,"p",4)(8,ce,16,0,"div",6)),t&2&&(dg("description","Integrations for "+a.namespaceName()+", including entries inherited from the platform."),BE(),dg("query",a.rowFilter.query()),BE(3),Bw(a.deletion.error()?4:-1),BE(),Bw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{U as IntegrationsAllScopesComponent};
1
+ import {e}from'./chunk-C6dIhkYp.js';import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-D8BMEvrt.js';import {O}from'./chunk-C_TR3rI-.js';import {g,W as W$1,q as F,I as we,H as J,$ as $i,K as U$1,ad as ne$1,a1 as ga,aa as br,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,P as dg,b as BE,c as Bw,t as eC,F as Fg,U as Uw,k as $w,s as Dl,Y as Yw,l as lg,u as pf,w as hf}from'./main-DYDARBQQ.js';import {z as k,j as O$1,e as at,c as fn,k as ko,l as Fo,P,B as P$1}from'./chunk-Uf57QzfJ.js';import'./chunk-CTrUVP-N.js';var Q=(n,e)=>e.key;function W(n,e){if(n&1&&(Es(0,"p",3),xC(1),hl()),n&2){let t=eC();BE(),Fg(t.deletion.error());}}function X(n,e){n&1&&(Es(0,"p",4),xC(1,"Loading integrations\u2026"),hl());}function Z(n,e){n&1&&(Es(0,"p",5),xC(1,"No integrations available."),hl());}function ee(n,e){n&1&&(Es(0,"p",4),xC(1,"No integrations match the current filter."),hl());}function te(n,e){n&1&&(Es(0,"ds-tag",20),xC(1,"YAML"),hl(),Es(2,"ds-tag",21),xC(3,"Read-only"),hl());}function ne(n,e){if(n&1){let t=Yw();Es(0,"button",22),vg("click",function(){pf(t);let s=eC().$implicit,c=eC(2);return hf(c.view(s))}),xC(1,"View"),hl();}if(n&2){let t=eC().$implicit;lg("aria-label","View "+t.config.name);}}function ie(n,e){if(n&1){let t=Yw();Es(0,"button",22),vg("click",function(){pf(t);let s=eC(3).$implicit,c=eC(2);return hf(c.edit(s))}),xC(1," Edit "),hl();}if(n&2){let t=eC(3).$implicit;lg("aria-label","Edit "+t.config.name);}}function oe(n,e){if(n&1){let t=Yw();Es(0,"button",22),vg("click",function(){pf(t);let s=eC(2).$implicit,c=eC(2);return hf(c.duplicate(s))}),xC(1," Duplicate "),hl(),jw(2,ie,2,1,"button",19);}if(n&2){let t=eC(2).$implicit;lg("aria-label","Duplicate "+t.config.name),BE(2),Bw(t.canEdit?2:-1);}}function ae(n,e){if(n&1){let t=Yw();Es(0,"agentos-row-delete-action",25),vg("deleteRequested",function(){pf(t);let s=eC(2).$implicit,c=eC(2);return hf(c.deletion.request(s.key))})("deleteConfirmed",function(){pf(t);let s=eC(2).$implicit,c=eC(2);return hf(c.confirmDelete(s))})("deleteCancelled",function(){pf(t);let s=eC(4);return hf(s.deletion.cancel())}),hl();}if(n&2){let t=eC(2).$implicit,a=eC(2);dg("rowKey",t.key)("rowLabel",t.config.name)("state",a.deletion);}}function re(n,e){n&1&&(Es(0,"button",24),xC(1,"Inherited"),hl());}function le(n,e){if(n&1&&(jw(0,oe,3,2),jw(1,ae,1,3,"agentos-row-delete-action",23),jw(2,re,2,0,"button",24)),n&2){let t=eC().$implicit,a=eC(2);Bw(a.deletion.confirmingId()!==t.key?0:-1),BE(),Bw(t.canDelete?1:-1),BE(),Bw(!t.canEdit&&!t.canDelete?2:-1);}}function se(n,e){if(n&1&&(Es(0,"tr",9)(1,"td",12),xC(2),hl(),Es(3,"td",13),xC(4),hl(),Es(5,"td",14)(6,"div",15)(7,"ds-tag",16),xC(8),hl(),jw(9,te,4,0),hl()(),Es(10,"td",17)(11,"div",18),jw(12,ne,2,1,"button",19)(13,le,3,3),hl()()()),n&2){let t=e.$implicit;BE(2),Fg(t.config.name),BE(2),Dl(" ",t.config.integrationType," "),BE(3),dg("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),BE(),Dl(" ",t.scopeLabel," "),BE(),Bw(t.source==="FILESYSTEM"?9:-1),BE(3),Bw(t.source==="FILESYSTEM"?12:13);}}function ce(n,e){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Type"),hl(),Es(8,"th",10),xC(9,"Scope"),hl(),Es(10,"th",10)(11,"span",11),xC(12,"Actions"),hl()()()(),Es(13,"tbody",8),Uw(14,se,14,6,"tr",9,Q),hl()()()),n&2){let t=eC();BE(14),$w(t.rowFilter.filteredRows());}}var U=class n$1{route=g(W$1);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceApi=g(J);namespaceId=this.route.snapshot.params.namespaceId;namespaceName=$i("this namespace");isAdmin=$i(false);isLoading=$i(true);rows=$i([]);deletion=k();rowFilter=O$1(this.rows,e=>[e.config.name,e.config.integrationType,e.scopeLabel,e.source].join(" "));ngOnInit(){this.state.setNamespace(this.namespaceId),this.namespaceId&&this.namespaceApi.getByIdNamespace(this.namespaceId).pipe(U$1(this.destroyRef)).subscribe({next:e=>this.namespaceName.set(e.name)}),this.route.paramMap.pipe(ne$1(e=>e.get("namespaceId")??""),ga(e=>e?this.namespaceRole.isAdminOfNamespace$(e):br(false)),U$1(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.rows.set(this.toRows(e)),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:n(this.isAdmin())}});}view(e){e.config.id&&this.router.navigate(["/agentos",this.namespaceId,"integrations",e.config.id,"view"]);}edit(e){!e.canEdit||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"integrations",e.config.id,"edit"],{queryParams:{scope:e.scope}});}duplicate(e){if(e.source==="FILESYSTEM"||!e.config.id)return;let a=(e.scope==="platform"||e.scope==="namespace")&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:a,template:e.config.id,templateScope:e.scope}});}confirmDelete(e){!e.canDelete||!e.config.id||this.deletion.execute(e.key,{request$:this.state.delete(e.config.id,e.scope).pipe(U$1(this.destroyRef)),errorMessage:`Deleting "${e.config.name}" failed. Try again.`});}toRows(e){return [...this.mapScope(e.platform,"platform","Platform",true),...this.mapScope(e.namespace,"namespace","Namespace",!this.isAdmin()),...this.mapScope(e.userOnNs,"userOnNs","Personal",false),...this.mapScope(e.userGlobal,"userGlobal","Personal",false)]}mapScope(e$1,t,a,s){return e$1.map((c,z)=>{let h=e(c),w=h==="NEO4J"&&!s;return {key:`${t}:${c.id??z}`,config:c,scope:t,scopeLabel:a,source:h,canEdit:w,canDelete:w}})}static \u0275fac=function(t){return new(t||n$1)};static \u0275cmp=vw({type:n$1,selectors:[["agentos-integrations-all-scopes"]],decls:9,vars:4,consts:[["title","Integrations",3,"description"],["label","Filter integrations","placeholder","Filter integrations\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Integrations"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Type",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["variant","neutral"],["variant","outline"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button","disabled",""],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,a){t&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return a.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return a.openCreateForm()}),xC(3,"New integration"),hl()(),jw(4,W,2,1,"p",3),jw(5,X,2,0,"p",4)(6,Z,2,0,"p",5)(7,ee,2,0,"p",4)(8,ce,16,0,"div",6)),t&2&&(dg("description","Integrations for "+a.namespaceName()+", including entries inherited from the platform."),BE(),dg("query",a.rowFilter.query()),BE(3),Bw(a.deletion.error()?4:-1),BE(),Bw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,fn,ko,Fo,P,P$1],encapsulation:2})};export{U as IntegrationsAllScopesComponent};
@@ -0,0 +1 @@
1
+ import {z as k$1,j as O,e as at,c as fn,k as ko,l as Fo,P,B as P$1}from'./chunk-Uf57QzfJ.js';import {g,W as W$1,q as F,I as we,aq as k,ap as F$1,Z as Tr,$ as $i,a1 as ga,ac as by,a2 as ha,aa as br,K as U,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,s as Dl,Y as Yw,u as pf,w as hf,l as lg}from'./main-DYDARBQQ.js';var G=(i,e)=>e.key;function Q(i,e){if(i&1&&(Es(0,"p",3),xC(1),hl()),i&2){let t=eC();BE(),Fg(t.deletion.error());}}function W(i,e){i&1&&(Es(0,"p",4),xC(1,"Loading AI models\u2026"),hl());}function X(i,e){i&1&&(Es(0,"p",5),xC(1,"No AI models configured."),hl());}function Y(i,e){i&1&&(Es(0,"p",4),xC(1,"No AI models match the current filter."),hl());}function Z(i,e){i&1&&(Es(0,"ds-tag",18),xC(1,"Read-only"),hl());}function ee(i,e){if(i&1){let t=Yw();Es(0,"button",24),vg("click",function(){pf(t);let s=eC(2).$implicit,m=eC(2);return hf(m.edit(s))}),xC(1,"Edit"),hl();}if(i&2){let t=eC(2).$implicit,n=eC(2);lg("aria-label","Edit "+n.title(t));}}function te(i,e){if(i&1){let t=Yw();jw(0,ee,2,1,"button",22),Es(1,"agentos-row-delete-action",23),vg("deleteRequested",function(){pf(t);let s=eC().$implicit,m=eC(2);return hf(m.deletion.request(s.key))})("deleteConfirmed",function(){pf(t);let s=eC().$implicit,m=eC(2);return hf(m.confirmDelete(s))})("deleteCancelled",function(){pf(t);let s=eC(3);return hf(s.deletion.cancel())}),hl();}if(i&2){let t=eC().$implicit,n=eC(2);Bw(n.deletion.confirmingId()!==t.key?0:-1),BE(),dg("rowKey",t.key)("rowLabel",n.title(t))("state",n.deletion);}}function ie(i,e){i&1&&(Es(0,"button",21),xC(1,"Inherited"),hl());}function ne(i,e){if(i&1&&(Es(0,"tr",9)(1,"td",12),xC(2),hl(),Es(3,"td",13),xC(4),hl(),Es(5,"td",14),xC(6),hl(),Es(7,"td",15)(8,"div",16)(9,"ds-tag",17),xC(10),hl(),jw(11,Z,2,0,"ds-tag",18),hl()(),Es(12,"td",19)(13,"div",20),jw(14,te,2,4)(15,ie,2,0,"button",21),hl()()()),i&2){let t=e.$implicit,n=eC(2);BE(2),Fg(n.title(t)),BE(2),Fg(t.providerName),BE(2),Dl(" ",t.model.apiModelName," "),BE(3),dg("variant",t.scope==="platform"?"neutral":"accent"),BE(),Fg(t.scope==="platform"?"Platform":"Namespace"),BE(),Bw(t.scope==="platform"?11:-1),BE(3),Bw(t.scope==="namespace"?14:15);}}function oe(i,e){if(i&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Provider"),hl(),Es(8,"th",10),xC(9,"API model name"),hl(),Es(10,"th",10),xC(11,"Scope"),hl(),Es(12,"th",10)(13,"span",11),xC(14,"Actions"),hl()()()(),Es(15,"tbody",8),Uw(16,ne,16,7,"tr",9,G),hl()()()),i&2){let t=eC();BE(16),$w(t.rowFilter.filteredRows());}}var z=class i{route=g(W$1);router=g(F);destroyRef=g(we);aiModelController=g(k);aiProviderController=g(F$1);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);isLoading=$i(true);deletion=k$1();rows=$i([]);rowFilter=O(this.rows,e=>[e.model.alias,e.model.apiModelName,e.providerName,e.scope].filter(Boolean).join(" "));data$=this.refresh$.pipe(ga(()=>(this.isLoading.set(true),by({namespace:this.aiModelController.listByNamespaceIdAiModel(this.namespaceId),platform:this.aiModelController.listPlatformLevelAiModel().pipe(ha(()=>br([]))),providers:this.aiProviderController.listAiProvider(this.namespaceId)}).pipe(ga(({namespace:e,platform:t,providers:n})=>{let s=[...new Set([...t,...e].map(m=>m.aiProviderId))];return by({namespace:br(e),platform:br(t),providers:br(n),referencedProviders:this.aiProviderController.getByIdsAiProvider({ids:s,withRemoved:false}).pipe(ha(()=>br([])))})})))));constructor(){this.data$.pipe(U(this.destroyRef)).subscribe({next:({namespace:e,platform:t,providers:n,referencedProviders:s})=>{let m=new Map([...s,...n].map(c=>[c.id??"",c.name]));this.rows.set([...t.map((c,g)=>({key:`platform:${c.id??g}`,model:c,providerName:m.get(c.aiProviderId)??c.aiProviderId,scope:"platform"})),...e.map((c,g)=>({key:`namespace:${c.id??g}`,model:c,providerName:m.get(c.aiProviderId)??c.aiProviderId,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-models","new"]);}edit(e){e.scope==="platform"||!e.model.id||this.router.navigate(["/agentos",this.namespaceId,"ai-models",e.model.id,"edit"]);}title(e){return e.model.alias??e.model.apiModelName}confirmDelete(e){e.scope==="platform"||!e.model.id||this.deletion.execute(e.key,{request$:this.aiModelController.deleteAiModel(e.model.id).pipe(U(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${this.title(e)}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=vw({type:i,selectors:[["agentos-namespace-ai-models"]],decls:9,vars:3,consts:[["title","AI models","description","AI models configured for this namespace, including models inherited from the platform."],["label","Filter AI models","placeholder","Filter AI models\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","AI models"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Provider"],["role","cell","data-label","API model name",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(t,n){t&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(m){return n.rowFilter.query.set(m)}),hl(),Es(2,"button",2),vg("click",function(){return n.openCreateForm()}),xC(3,"New AI model"),hl()(),jw(4,Q,2,1,"p",3),jw(5,W,2,0,"p",4)(6,X,2,0,"p",5)(7,Y,2,0,"p",4)(8,oe,18,0,"div",6)),t&2&&(BE(),dg("query",n.rowFilter.query()),BE(3),Bw(n.deletion.error()?4:-1),BE(),Bw(n.isLoading()?5:n.rows().length===0?6:n.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,fn,ko,Fo,P,P$1],encapsulation:2})};export{z as NamespaceAiModelsComponent};
@@ -0,0 +1 @@
1
+ import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-D8BMEvrt.js';import {I}from'./chunk-DbN0_APN.js';import {g,W,q as F,I as we,$ as $i,K as U,ad as ne$1,a1 as ga,aa as br,aL as ui,a2 as ha,ac as by,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,z as DC,l as lg,s as Dl,U as Uw,k as $w,Y as Yw,u as pf,w as hf}from'./main-DYDARBQQ.js';import {z as k,j as O,a5 as w,e as at,c as fn,k as ko,l as Fo,P,B as P$1}from'./chunk-Uf57QzfJ.js';import'./chunk-CTrUVP-N.js';var Q=(i,t)=>t.key;function X(i,t){if(i&1&&(Es(0,"p",3),xC(1),hl()),i&2){let e=eC();BE(),Fg(e.deletion.error());}}function Z(i,t){if(i&1&&(Es(0,"p"),xC(1),hl()),i&2){let e=t;DC(e.kind==="error"?"settings-table__error":"settings-table__status"),lg("role",e.kind==="error"?"alert":"status"),BE(),Dl(" ",e.text," ");}}function ee(i,t){i&1&&(Es(0,"p",5),xC(1,"Loading auth settings\u2026"),hl());}function te(i,t){i&1&&(Es(0,"p",6),xC(1,"No auth settings available."),hl());}function ne(i,t){i&1&&(Es(0,"p",5),xC(1,"No auth settings match the current filter."),hl());}function ie(i,t){i&1&&(Es(0,"ds-tag",18),xC(1,"Read-only"),hl());}function oe(i,t){i&1&&(Es(0,"ds-tag",20),xC(1,"Connected"),hl());}function ae(i,t){i&1&&(Es(0,"ds-tag",18),xC(1,"Not connected"),hl());}function se(i,t){i&1&&(Es(0,"span",21),xC(1,"\u2014"),hl());}function re(i,t){if(i&1){let e=Yw();Es(0,"span",26),xC(1,"Waiting for authorization\u2026"),hl(),Es(2,"button",27),vg("click",function(){pf(e);let r=eC(4);return hf(r.cancelConnect())}),xC(3," Cancel "),hl();}if(i&2){let e=eC(2).$implicit;BE(2),lg("aria-label","Stop waiting for the authorization of "+e.config.name);}}function le(i,t){if(i&1){let e=Yw();Es(0,"span",28),xC(1,"Disconnect?"),hl(),Es(2,"button",29),vg("click",function(){pf(e);let r=eC(2).$implicit,d=eC(2);return hf(d.confirmReset(r))}),xC(3),hl(),Es(4,"button",29),vg("click",function(){pf(e);let r=eC(4);return hf(r.cancelReset())}),xC(5," Cancel "),hl();}if(i&2){let e=eC(2).$implicit,n=eC(2);BE(2),dg("disabled",n.resettingKey()===e.key),lg("aria-label","Confirm disconnecting "+e.config.name),BE(),Dl(" ",n.resettingKey()===e.key?"Disconnecting\u2026":"Confirm"," "),BE(),dg("disabled",n.resettingKey()===e.key),lg("aria-label","Cancel disconnecting "+e.config.name);}}function ce(i,t){if(i&1){let e=Yw();Es(0,"button",29),vg("click",function(){pf(e);let r=eC(3).$implicit,d=eC(2);return hf(d.requestReset(r))}),xC(1," Disconnect "),hl();}if(i&2){let e=eC(3).$implicit,n=eC(2);dg("disabled",n.connectingKey()!==null),lg("aria-label","Disconnect "+e.config.name);}}function de(i,t){if(i&1){let e=Yw();Es(0,"button",29),vg("click",function(){pf(e);let r=eC(2).$implicit,d=eC(2);return hf(d.connect(r))}),xC(1),hl(),jw(2,ce,2,2,"button",30);}if(i&2){let e=eC(2).$implicit,n=eC(2);dg("disabled",n.connectingKey()!==null||n.resettingKey()!==null),lg("aria-label",(n.connectionOf(e)==="connected"?"Reconnect ":"Connect ")+e.config.name),BE(),Dl(" ",n.connectionOf(e)==="connected"?"Reconnect":"Connect"," "),BE(),Bw(n.connectionOf(e)==="connected"?2:-1);}}function pe(i,t){if(i&1&&jw(0,re,4,1)(1,le,6,5)(2,de,3,4),i&2){let e=eC().$implicit,n=eC(2);Bw(n.connectingKey()===e.key?0:n.resetConfirmingKey()===e.key?1:n.deletion.confirmingId()!==e.key?2:-1);}}function ue(i,t){if(i&1){let e=Yw();Es(0,"button",27),vg("click",function(){pf(e);let r=eC().$implicit,d=eC(2);return hf(d.duplicate(r))}),xC(1," Duplicate "),hl();}if(i&2){let e=eC().$implicit;lg("aria-label","Duplicate "+e.config.name);}}function _e(i,t){if(i&1){let e=Yw();Es(0,"button",27),vg("click",function(){pf(e);let r=eC(2).$implicit,d=eC(2);return hf(d.edit(r))}),xC(1," Edit "),hl();}if(i&2){let e=eC(2).$implicit;lg("aria-label","Edit "+e.config.name);}}function me(i,t){if(i&1){let e=Yw();jw(0,_e,2,1,"button",24),Es(1,"agentos-row-delete-action",31),vg("deleteRequested",function(){pf(e);let r=eC().$implicit,d=eC(2);return hf(d.deletion.request(r.key))})("deleteConfirmed",function(){pf(e);let r=eC().$implicit,d=eC(2);return hf(d.confirmDelete(r))})("deleteCancelled",function(){pf(e);let r=eC(3);return hf(r.deletion.cancel())}),hl();}if(i&2){let e=eC().$implicit,n=eC(2);Bw(n.deletion.confirmingId()!==e.key?0:-1),BE(),dg("rowKey",e.key)("rowLabel",e.config.name)("state",n.deletion);}}function ge(i,t){i&1&&(Es(0,"button",25),xC(1,"Inherited"),hl());}function he(i,t){if(i&1&&(Es(0,"tr",10)(1,"td",13),xC(2),hl(),Es(3,"td",14),xC(4),hl(),Es(5,"td",15)(6,"div",16)(7,"ds-tag",17),xC(8),hl(),jw(9,ie,2,0,"ds-tag",18),hl()(),Es(10,"td",19),jw(11,oe,2,0,"ds-tag",20)(12,ae,2,0,"ds-tag",18)(13,se,2,0,"span",21),hl(),Es(14,"td",22)(15,"div",23),jw(16,pe,3,1),jw(17,ue,2,1,"button",24),jw(18,me,2,4)(19,ge,2,0,"button",25),hl()()()),i&2){let e=t.$implicit,n=eC(2);BE(2),Fg(e.config.name),BE(2),Dl(" ",e.config.authType," "),BE(3),dg("variant",e.scopeLabel==="Platform"?"neutral":e.scopeLabel==="Personal"?"outline":"accent"),BE(),Fg(e.scopeLabel),BE(),Bw(e.canMutate?-1:9),BE(2),Bw(n.isOAuth(e)&&n.connectionOf(e)==="connected"?11:n.isOAuth(e)&&n.connectionOf(e)==="disconnected"?12:13),BE(5),Bw(n.isOAuth(e)?16:-1),BE(),Bw(n.deletion.confirmingId()!==e.key&&n.resetConfirmingKey()!==e.key&&n.connectingKey()!==e.key?17:-1),BE(),Bw(e.canMutate?18:19);}}function Ce(i,t){if(i&1&&(Es(0,"div",7)(1,"table",8)(2,"thead",9)(3,"tr",10)(4,"th",11),xC(5,"Name"),hl(),Es(6,"th",11),xC(7,"Authentication type"),hl(),Es(8,"th",11),xC(9,"Scope"),hl(),Es(10,"th",11),xC(11,"Connection"),hl(),Es(12,"th",11)(13,"span",12),xC(14,"Actions"),hl()()()(),Es(15,"tbody",9),Uw(16,he,20,9,"tr",10,Q),hl()()()),i&2){let e=eC();BE(16),$w(e.rowFilter.filteredRows());}}var fe=new Set(["OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"]),J=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=$i(false);isLoading=$i(true);rows=$i([]);deletion=k();connections=$i({});connectingKey=$i(null);resetConfirmingKey=$i(null);resettingKey=$i(null);actionMessage=$i(null);connectAttempt=null;connectPopup=null;connectionsLoad=null;rowFilter=O(this.rows,t=>[t.config.name,t.config.authType,t.scopeLabel].join(" "));ngOnInit(){this.route.paramMap.pipe(U(this.destroyRef)).subscribe(t=>{let e=t.get("namespaceId")??"";e&&e!==this.namespaceId&&(this.namespaceId=e),this.state.setNamespace(e);}),this.route.paramMap.pipe(ne$1(t=>t.get("namespaceId")??""),ga(t=>t?this.namespaceRole.isAdminOfNamespace$(t):br(false)),U(this.destroyRef)).subscribe(t=>this.isAdmin.set(t)),this.state.vm$.pipe(U(this.destroyRef)).subscribe({next:t=>{this.rows.set(this.toRows(t)),this.isLoading.set(false),this.loadConnections();},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:n(this.isAdmin())}});}edit(t){!t.canMutate||!t.config.id||this.router.navigate(["/agentos",this.namespaceId,"auth-settings",t.config.id,"edit"],{queryParams:{scope:t.scope}});}confirmDelete(t){!t.canMutate||!t.config.id||this.deletion.execute(t.key,{request$:this.state.delete(t.config.id,t.scope).pipe(U(this.destroyRef)),errorMessage:`Deleting "${t.config.name}" failed. Try again.`});}isOAuth(t){return fe.has(t.config.authType)}connectionOf(t){return this.connections()[t.key]??"unknown"}connect(t){let e=t.config.id;if(!e||this.connectingKey()||this.resettingKey())return;let n=w();if(!n){this.actionMessage.set({kind:"error",text:"The browser blocked the authorization window. Allow pop-ups for this site and try again."});return}this.actionMessage.set(null),this.resetConfirmingKey.set(null),this.connectPopup=n,this.connectingKey.set(t.key),this.connectAttempt=this.state.connect(e,this.namespaceParam(),r=>n.location.href=r,()=>n.closed).pipe(ui(()=>{this.connectingKey.set(null),this.connectAttempt=null,this.connectPopup=null;}),U(this.destroyRef)).subscribe({next:r=>this.onConnectOutcome(t,r,n),error:()=>{n.close(),this.actionMessage.set({kind:"error",text:`Connecting "${t.config.name}" failed. Check that its OAuth settings are complete, then try again.`});}});}cancelConnect(){this.connectAttempt?.unsubscribe(),this.connectPopup?.close();}requestReset(t){this.resettingKey()||this.connectingKey()||(this.actionMessage.set(null),this.resetConfirmingKey.set(t.key));}cancelReset(){this.resettingKey()||this.resetConfirmingKey.set(null);}confirmReset(t){let e=t.config.id;!e||this.resettingKey()||this.resetConfirmingKey()!==t.key||(this.resettingKey.set(t.key),this.state.resetCredential(e,this.namespaceParam()).pipe(U(this.destroyRef)).subscribe({next:()=>{this.resettingKey.set(null),this.resetConfirmingKey.set(null),this.loadConnections();},error:()=>{this.resettingKey.set(null),this.actionMessage.set({kind:"error",text:`Disconnecting "${t.config.name}" failed. Try again.`});}}));}duplicate(t){if(!t.config.id)return;let e=t.scope==="platform"||t.scope==="namespace"&&!this.isAdmin()?"userOnNs":t.scope;this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:e,template:t.config.id,templateScope:t.scope}});}onConnectOutcome(t,e,n){n.close(),this.loadConnections(),e==="abandoned"?this.actionMessage.set({kind:"info",text:`The authorization window was closed before "${t.config.name}" got connected.`}):e==="timeout"&&this.actionMessage.set({kind:"info",text:`No authorization was received for "${t.config.name}" in time. Try again.`});}namespaceParam(){return this.namespaceId||void 0}loadConnections(){this.connectionsLoad?.unsubscribe();let t=this.rows().filter(e=>this.isOAuth(e)&&e.config.id).map(e=>this.state.getConnection(e.config.id,this.namespaceParam()).pipe(ne$1(n=>[e.key,n.connected?"connected":"disconnected"]),ha(()=>br([e.key,"unknown"]))));if(t.length===0){this.connections.set({});return}this.connectionsLoad=by(t).pipe(U(this.destroyRef)).subscribe(e=>this.connections.set(Object.fromEntries(e)));}toRows(t){return [...this.mapScope(t.platform,"platform","Platform",false),...this.mapScope(t.namespace,"namespace","Namespace",this.isAdmin()),...this.mapScope(t.userOnNs,"userOnNs","Personal",true),...this.mapScope(t.userGlobal,"userGlobal","Personal",true)]}mapScope(t,e,n,r){return t.map((d,Y)=>({key:`${e}:${d.id??Y}`,config:d,scope:e,scopeLabel:n,canMutate:r}))}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=vw({type:i,selectors:[["agentos-auth-settings-all-scopes"]],decls:10,vars:4,consts:[["title","Auth settings","description","Authentication settings available in this namespace, including inherited platform and personal entries."],["label","Filter auth settings","placeholder","Filter auth settings\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],[3,"class"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Auth settings"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Authentication type",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Connection"],["variant","accent"],[1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["type","button","disabled",""],["role","status",1,"settings-table__confirm-label"],["type","button",3,"click"],[1,"settings-table__confirm-label"],["type","button",3,"click","disabled"],["type","button",3,"disabled"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(e,n){if(e&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(d){return n.rowFilter.query.set(d)}),hl(),Es(2,"button",2),vg("click",function(){return n.openCreateForm()}),xC(3,"New auth setting"),hl()(),jw(4,X,2,1,"p",3),jw(5,Z,2,4,"p",4),jw(6,ee,2,0,"p",5)(7,te,2,0,"p",6)(8,ne,2,0,"p",5)(9,Ce,18,0,"div",7)),e&2){let r;BE(),dg("query",n.rowFilter.query()),BE(3),Bw(n.deletion.error()?4:-1),BE(),Bw((r=n.actionMessage())?5:-1,r),BE(),Bw(n.isLoading()?6:n.rows().length===0?7:n.rowFilter.filteredRows().length===0?8:9);}},dependencies:[at,fn,ko,Fo,P,P$1],encapsulation:2})};export{J as AuthSettingsAllScopesComponent};
@@ -0,0 +1 @@
1
+ import {a1 as ga,a2 as ha,aa as br,aD as $y}from'./main-DYDARBQQ.js';function i(t,o,p){return t.pipe(ga(()=>o().pipe(ha(()=>br(p)))),$y({bufferSize:1,refCount:true}))}export{i};
@@ -1 +1 @@
1
- import {S}from'./chunk-CSMJ7MDS.js';import {v as vw,T as br,E as Es,x as xC,a as hl,f as fg,P as dg}from'./main-2G6YLE3Q.js';var c=class a{groups=[{label:"Access",items:[{label:"Users & Groups",commands:["users"]},{label:"Auth settings",commands:["auth-settings"]}]},{label:"Connections",items:[{label:"Platform integrations",commands:["integration-configs"]}]},{label:"AI",items:[{label:"Platform agents",commands:["agent-configs"]},{label:"Platform AI providers",commands:["ai-providers"]},{label:"Platform AI models",commands:["ai-models"]},{label:"Platform skills",commands:["skills"]},{label:"Platform prompts",commands:["prompts"]}]},{label:"Automation",items:[{label:"Scheduled prompts",commands:["scheduled-prompts"]},{label:"Tool invoke",commands:["tool-invoke"]}]},{label:"System",items:[{label:"Configuration",commands:["configuration"]}]}];static \u0275fac=function(e){return new(e||a)};static \u0275cmp=vw({type:a,selectors:[["agentos-admin-settings-layout"]],decls:9,vars:1,consts:[["title","Admin \xB7 Configuration","mark","A","navigationLabel","Admin settings",3,"groups"],["settingsBreadcrumb","","aria-label","Breadcrumb"],["aria-hidden","true"]],template:function(e,g){e&1&&(Es(0,"agentos-settings-layout",0)(1,"nav",1)(2,"span"),xC(3,"Platform"),hl(),Es(4,"span",2),xC(5,"/"),hl(),Es(6,"span"),xC(7,"Administration"),hl()(),fg(8,"router-outlet"),hl()),e&2&&dg("groups",g.groups);},dependencies:[br,S],styles:["nav[settingsBreadcrumb][_ngcontent-%COMP%]{display:flex;gap:8px;align-items:center}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-accent-700);text-decoration:none}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:2px}"]})};export{c as AdminSettingsLayoutComponent};
1
+ import {S}from'./chunk-Uf57QzfJ.js';import {v as vw,T as br,E as Es,x as xC,a as hl,f as fg,P as dg}from'./main-DYDARBQQ.js';var c=class a{groups=[{label:"Access",items:[{label:"Users & Groups",commands:["users"]},{label:"Auth settings",commands:["auth-settings"]}]},{label:"Connections",items:[{label:"Platform integrations",commands:["integration-configs"]}]},{label:"AI",items:[{label:"Platform agents",commands:["agent-configs"]},{label:"Platform AI providers",commands:["ai-providers"]},{label:"Platform AI models",commands:["ai-models"]},{label:"Platform skills",commands:["skills"]},{label:"Platform prompts",commands:["prompts"]}]},{label:"Automation",items:[{label:"Scheduled prompts",commands:["scheduled-prompts"]},{label:"Tool invoke",commands:["tool-invoke"]}]},{label:"System",items:[{label:"Configuration",commands:["configuration"]}]}];static \u0275fac=function(e){return new(e||a)};static \u0275cmp=vw({type:a,selectors:[["agentos-admin-settings-layout"]],decls:9,vars:1,consts:[["title","Admin \xB7 Configuration","mark","A","navigationLabel","Admin settings",3,"groups"],["settingsBreadcrumb","","aria-label","Breadcrumb"],["aria-hidden","true"]],template:function(e,g){e&1&&(Es(0,"agentos-settings-layout",0)(1,"nav",1)(2,"span"),xC(3,"Platform"),hl(),Es(4,"span",2),xC(5,"/"),hl(),Es(6,"span"),xC(7,"Administration"),hl()(),fg(8,"router-outlet"),hl()),e&2&&dg("groups",g.groups);},dependencies:[br,S],styles:["nav[settingsBreadcrumb][_ngcontent-%COMP%]{display:flex;gap:8px;align-items:center}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-accent-700);text-decoration:none}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:2px}"]})};export{c as AdminSettingsLayoutComponent};
@@ -1 +1 @@
1
- import {i}from'./chunk-yhFoWYCU.js';import {y}from'./chunk-CSMJ7MDS.js';import {g,af as G,aI as ve,Z as Tr,at as Cy,a1 as ga,a2 as ha,aa as br,ad as ne,aD as $y,a5 as vd,a6 as x}from'./main-2G6YLE3Q.js';var u=s=>s,N="none",w="me",O=class s{nsController=g(G);exportService=g(ve);userState=g(y);refresh$=new Tr(void 0);namespaceId$=new Tr(null);vm$=Cy([this.namespaceId$,this.refresh$]).pipe(ga(([e])=>{let n=this.loadPlatformConfigs().pipe(ha(()=>br([]))),t=this.loadUserConfigs("global").pipe(ha(()=>br([])));return e?Cy([n,this.loadNamespaceConfigs(e).pipe(ha(()=>br([]))),this.loadUserConfigs(e).pipe(ha(()=>br([]))),t]).pipe(ne(([i,r,c,g])=>({platform:i,namespace:r,userOnNs:c,userGlobal:g}))):Cy([n,t]).pipe(ne(([i,r])=>({platform:i,namespace:[],userOnNs:[],userGlobal:r})))}),$y({bufferSize:1,refCount:true}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e);}refresh(){this.refresh$.next();}loadPlatformConfigs(){return this.nsController.listIntegrationConfig(N)}loadUserConfigs(e){let n=e==="global"?N:e;return this.nsController.listIntegrationConfig(n,w)}userGlobal$=i(this.refresh$,()=>this.loadUserConfigs("global"),[]);loadNamespaceConfigs(e){return e?this.nsController.listIntegrationConfig(e):br([])}getById(e,n){return this.nsController.getByIdIntegrationConfig(e)}create(e,n,t){let r=this.userState.currentUser()?.id;if((n==="userOnNs"||n==="userGlobal")&&!r)throw new Error(`Cannot create ${n} config before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(n==="platform"){let g={name:e.name,integrationType:e.integrationType,description:e.description,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(g)).pipe(vd(()=>this.refresh()))}if(n==="namespace"){if(!t)throw new Error("Cannot create namespace-scoped config without a namespaceId");let g={name:e.name,integrationType:e.integrationType,description:e.description,namespaceId:t,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(g)).pipe(vd(()=>this.refresh()))}if(n==="userOnNs"&&!t)throw new Error("Cannot create userOnNs config without a namespaceId");let c={name:e.name,integrationType:e.integrationType,description:e.description,userId:r,namespaceId:n==="userOnNs"?t:void 0,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(c)).pipe(vd(()=>this.refresh()))}update(e,n,t,i){let r={name:n.name,integrationType:n.integrationType,description:n.description,userId:i.userId,namespaceId:i.namespaceId,parameters:n.parameters,authSettingName:n.authSettingName??void 0,autoGrant:n.autoGrant??false};return this.nsController.updateIntegrationConfig(e,u(r)).pipe(vd(()=>this.refresh()))}delete(e,n){return this.nsController.deleteIntegrationConfig(e).pipe(vd(()=>this.refresh()))}exportAsYaml(e){return this.exportService.exportAsYaml(e)}static \u0275fac=function(n){return new(n||s)};static \u0275prov=x({token:s,factory:s.\u0275fac,providedIn:"root"})};export{O};
1
+ import {i}from'./chunk-CTrUVP-N.js';import {y}from'./chunk-Uf57QzfJ.js';import {g,af as G,aI as ve,Z as Tr,at as Cy,a1 as ga,a2 as ha,aa as br,ad as ne,aD as $y,a5 as vd,a6 as x}from'./main-DYDARBQQ.js';var u=s=>s,N="none",w="me",O=class s{nsController=g(G);exportService=g(ve);userState=g(y);refresh$=new Tr(void 0);namespaceId$=new Tr(null);vm$=Cy([this.namespaceId$,this.refresh$]).pipe(ga(([e])=>{let n=this.loadPlatformConfigs().pipe(ha(()=>br([]))),t=this.loadUserConfigs("global").pipe(ha(()=>br([])));return e?Cy([n,this.loadNamespaceConfigs(e).pipe(ha(()=>br([]))),this.loadUserConfigs(e).pipe(ha(()=>br([]))),t]).pipe(ne(([i,r,c,g])=>({platform:i,namespace:r,userOnNs:c,userGlobal:g}))):Cy([n,t]).pipe(ne(([i,r])=>({platform:i,namespace:[],userOnNs:[],userGlobal:r})))}),$y({bufferSize:1,refCount:true}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e);}refresh(){this.refresh$.next();}loadPlatformConfigs(){return this.nsController.listIntegrationConfig(N)}loadUserConfigs(e){let n=e==="global"?N:e;return this.nsController.listIntegrationConfig(n,w)}userGlobal$=i(this.refresh$,()=>this.loadUserConfigs("global"),[]);loadNamespaceConfigs(e){return e?this.nsController.listIntegrationConfig(e):br([])}getById(e,n){return this.nsController.getByIdIntegrationConfig(e)}create(e,n,t){let r=this.userState.currentUser()?.id;if((n==="userOnNs"||n==="userGlobal")&&!r)throw new Error(`Cannot create ${n} config before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(n==="platform"){let g={name:e.name,integrationType:e.integrationType,description:e.description,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(g)).pipe(vd(()=>this.refresh()))}if(n==="namespace"){if(!t)throw new Error("Cannot create namespace-scoped config without a namespaceId");let g={name:e.name,integrationType:e.integrationType,description:e.description,namespaceId:t,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(g)).pipe(vd(()=>this.refresh()))}if(n==="userOnNs"&&!t)throw new Error("Cannot create userOnNs config without a namespaceId");let c={name:e.name,integrationType:e.integrationType,description:e.description,userId:r,namespaceId:n==="userOnNs"?t:void 0,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(c)).pipe(vd(()=>this.refresh()))}update(e,n,t,i){let r={name:n.name,integrationType:n.integrationType,description:n.description,userId:i.userId,namespaceId:i.namespaceId,parameters:n.parameters,authSettingName:n.authSettingName??void 0,autoGrant:n.autoGrant??false};return this.nsController.updateIntegrationConfig(e,u(r)).pipe(vd(()=>this.refresh()))}delete(e,n){return this.nsController.deleteIntegrationConfig(e).pipe(vd(()=>this.refresh()))}exportAsYaml(e){return this.exportService.exportAsYaml(e)}static \u0275fac=function(n){return new(n||s)};static \u0275prov=x({token:s,factory:s.\u0275fac,providedIn:"root"})};export{O};
@@ -0,0 +1 @@
1
+ import {o as o$1,r,i,l}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-zfSbYfDB.js';import {O}from'./chunk-C_TR3rI-.js';import {g,W,q as F$1,I as we,ag as U,ay as N,$ as $i,az as K,a8 as _,r as rT,a9 as F$2,aA as qe$1,K as U$1,a2 as ha,aa as br,ac as by,ad as ne,N as x,L as w,v as vw,au as $t,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,c as Bw,t as eC,Y as Yw,f as fg,R as MI,S as xI,l as lg,s as Dl,U as Uw,k as $w,F as Fg,u as pf,w as hf,as as Pg}from'./main-DYDARBQQ.js';import {N as A,p as pt$1,T as Te,g as gn,Q as E,q as qt,m as md,C as Co,M as Mo,H as Ht,F as Fn,v as yn,U as Ut,a as po,h as ho,Z as Zr,Y as Yr,A as An,O as On,b as hn,c as fn,u as un,o as dn,d as cn,D as pn,e as at$1,i as sn,t as an,l as Fo}from'./chunk-Uf57QzfJ.js';import'./chunk-CTrUVP-N.js';var F="*";function Be(n){return (n??[]).some(t=>t.trim()===F)}function $e(n){let t=(n??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==F).map(e=>e.toLowerCase());return new Set(t)}function j(n){return n.includes(F)}function He(n){let t=n.replace(/[\\.[\]{}()^$|]/g,"\\$&").replace(/\*/g,".*");try{return new RegExp(`^${t}$`,"i")}catch(e){return null}}function Y(n,t){return (t??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==F&&j(e)).some(e=>He(e)?.test(n)??false)}var Ge="AGENTOS_CONFIG",Je=new Set(["HTTP_API","MCP_HTTP","MCP_STDIO","BASH","TMUX","GIT"]);function Ue(n){return n.configEnabled&&(n.hasSubAgents||n.integrationTypes.some(t=>Je.has(t)))}var je=(n,t)=>t.value,Ye=(n,t)=>t.config.id,qe=(n,t)=>t.type,We=(n,t)=>t.selector;function ze(n,t){if(n&1&&(Es(0,"a",2),xC(1,"View resolved definition \u2192"),hl()),n&2){let e=eC();dg("routerLink",e.inspectRoute());}}function Xe(n,t){n&1&&(Es(0,"ds-tag",3),xC(1,"Platform level"),hl());}function Qe(n,t){n&1&&(Es(0,"p",4),xC(1,"Loading\u2026"),hl());}function Ze(n,t){if(n&1&&(fg(0,"input",17),MI()),n&2){let e=eC(2);dg("formControl",e.modelNameControl),xI();}}function et(n,t){if(n&1&&(Es(0,"option",41),xC(1),hl()),n&2){let e=t;dg("ngValue",e.value),BE(),Fg(e.label);}}function tt(n,t){if(n&1&&(Es(0,"option",41),xC(1),hl()),n&2){let e=t.$implicit;dg("ngValue",e.value),BE(),Fg(e.label);}}function nt(n,t){if(n&1&&(Es(0,"optgroup",42),Uw(1,tt,2,2,"option",41,je),hl()),n&2){let e=eC(3);BE(),$w(e.modelOptions().aliases);}}function it(n,t){if(n&1&&(Es(0,"option",41),xC(1),hl()),n&2){let e=t.$implicit;dg("ngValue",e.value),BE(),Fg(e.label);}}function ot(n,t){if(n&1&&(Es(0,"optgroup",43),Uw(1,it,2,2,"option",41,je),hl()),n&2){let e=eC(3);BE(),$w(e.modelOptions().apiNames);}}function at(n,t){if(n&1&&(Es(0,"select",18)(1,"option",40),xC(2,"Select a model"),hl(),jw(3,et,2,2,"option",41),jw(4,nt,3,0,"optgroup",42),jw(5,ot,3,0,"optgroup",43),hl(),MI()),n&2){let e,i=eC(2);dg("formControl",i.modelNameControl),xI(),BE(),dg("ngValue",null),BE(2),Bw((e=i.modelOptions().current)?3:-1,e),BE(),Bw(i.modelOptions().aliases.length>0?4:-1),BE(),Bw(i.modelOptions().apiNames.length>0?5:-1);}}function lt(n,t){if(n&1&&(Es(0,"span",44),xC(1),hl()),n&2){let e=eC().$implicit;BE(),Fg(e.config.integrationType);}}function rt(n,t){if(n&1&&(fg(0,"input",45),MI()),n&2){let e=eC().$implicit;dg("formControl",e.toolsControl),lg("aria-label","Tools of "+e.config.name),xI();}}function st(n,t){if(n&1){let e=Yw();Es(0,"div",10)(1,"label",11)(2,"input",23),vg("change",function(){let s=pf(e).$implicit,c=eC(3);return hf(c.toggleIntegration(s))}),hl(),Es(3,"span",24),xC(4),hl(),jw(5,lt,2,1,"span",44),hl(),jw(6,rt,1,2,"input",45),hl();}if(n&2){let e=t.$implicit;BE(2),dg("checked",e.enabled()),BE(2),Fg(e.config.name),BE(),Bw(e.config.integrationType?5:-1),BE(),Bw(e.enabled()?6:-1);}}function dt(n,t){if(n&1&&(Es(0,"p",13),xC(1),hl()),n&2){let e=eC().$implicit;BE(),Dl(" Restricted to: ",e.restrictedTools.join(", ")," (set outside this form, preserved on save) ");}}function ct(n,t){if(n&1){let e=Yw();Es(0,"div",10)(1,"label",24),xC(2),Es(3,"span",44),xC(4,"built-in"),hl()(),Es(5,"select",47),vg("change",function(s){let c=pf(e).$implicit,C=eC(4);return hf(C.setBuiltInState(c,s.target.value))}),Es(6,"option",48),xC(7),hl(),Es(8,"option",49),xC(9,"Enabled"),hl(),Es(10,"option",50),xC(11,"Disabled"),hl()(),jw(12,dt,2,1,"p",13),Es(13,"p",13),xC(14),hl()();}if(n&2){let e=t.$implicit,i=eC(4);BE(),lg("for","built-in-"+e.type),BE(),Dl(" ",e.displayName," "),BE(3),dg("id","built-in-"+e.type)("value",e.state()),BE(2),Fg(i.builtInDefaultLabel(e)),BE(5),Bw(e.state()==="on"&&e.restrictedTools?12:-1),BE(2),Fg(e.description);}}function mt(n,t){if(n&1&&(Es(0,"span",46),xC(1,"Built-in integrations"),hl(),Uw(2,ct,15,7,"div",10,qe)),n&2){let e=eC(3);BE(2),$w(e.builtInRows());}}function ut(n,t){n&1&&(Es(0,"ds-notice",26),xC(1," This agent can read the AgentOS configuration and also has a network integration or sub-agents: what it reads could be sent outside without any confirmation. Prefer a dedicated configuration agent without them. "),hl());}function gt(n,t){if(n&1&&(Es(0,"ds-fieldset",21),Uw(1,st,7,4,"div",10,Ye),jw(3,mt,4,0),jw(4,ut,2,0,"ds-notice",26),hl()),n&2){let e=eC(2);BE(),$w(e.integrationRows()),BE(2),Bw(e.builtInRows().length>0?3:-1),BE(),Bw(e.configAgentExposureWarning()?4:-1);}}function pt(n,t){n&1&&xC(0," A platform config can only list platform skills here: namespace skills are resolved per namespace when the agent runs. ");}function ft(n,t){n&1&&(Es(0,"ds-notice",26),xC(1," Saving with this on replaces the selection below with "),Es(2,"code",25),xC(3,"*"),hl(),xC(4,". "),hl());}function Ct(n,t){n&1&&(Es(0,"ds-notice"),xC(1," The skill catalogue could not be loaded. What this agent already declares is listed below and preserved on save. "),hl());}function _t(n,t){n&1&&(Es(0,"p",4),xC(1,"No skill available in this scope yet."),hl());}function bt(n,t){n&1&&(Es(0,"span",44),xC(1,"platform"),hl());}function ht(n,t){if(n&1&&(Es(0,"span",44),xC(1),hl()),n&2){let e=eC(4);BE(),Dl(" ",e.skillCatalogueUnavailable()?"not verified":"no matching skill"," ");}}function yt(n,t){if(n&1&&(Es(0,"p",13),xC(1),hl()),n&2){let e=eC().$implicit;BE(),Fg(e.description);}}function vt(n,t){if(n&1){let e=Yw();Es(0,"div",10)(1,"label",11)(2,"input",51),vg("change",function(){let s=pf(e).$implicit,c=eC(3);return hf(c.toggleSkill(s))}),hl(),Es(3,"span",24),xC(4),hl(),jw(5,bt,2,0,"span",44),jw(6,ht,2,1,"span",44),hl(),jw(7,yt,2,1,"p",13),hl();}if(n&2){let e=t.$implicit,i=eC(3);BE(2),dg("checked",e.selected())("disabled",i.allSkillsSelected()),BE(2),Fg(e.name),BE(),Bw(e.platform?5:-1),BE(),Bw(e.unresolved?6:-1),BE(),Bw(e.description?7:-1);}}function xt(n,t){if(n&1&&Uw(0,vt,8,6,"div",10,We),n&2){let e=eC(2);$w(e.skillRows());}}function St(n,t){if(n&1&&(Es(0,"ds-form-field",30),fg(1,"textarea",52),MI(),Es(2,"p",4),xC(3," Default payload for this loop agent. Overridden at launch time if the first message contains a valid "),Es(4,"code"),xC(5,"AgentLoopPayload"),hl(),xC(6,". Leave empty if you always provide the payload at launch. "),hl()()),n&2){let e=eC(2);dg("error",e.loopConfigControl.invalid&&e.loopConfigControl.touched?"Invalid JSON \u2014 please fix the syntax.":null),BE(),dg("placeholder",e.loopConfigPlaceholder)("formControl",e.loopConfigControl),xI();}}function At(n,t){n&1&&xC(0," A platform config can only list platform agents here: a namespace's agents are resolved per namespace when the agent runs. ");}function wt(n,t){if(n&1&&xC(0),n&2){let e=eC(3);Pg(" That deletes ",e.droppedUnresolvedSubAgents()," flagged ",e.droppedUnresolvedSubAgents()===1?"selector":"selectors"," nothing matched, which this form cannot restore. ");}}function Et(n,t){if(n&1&&(Es(0,"ds-notice",26),xC(1," Saving with this on replaces the selection below with "),Es(2,"code",25),xC(3,"*"),hl(),xC(4,". "),jw(5,wt,1,2),hl()),n&2){let e=eC(2);BE(5),Bw(e.droppedUnresolvedSubAgents()>0?5:-1);}}function Tt(n,t){n&1&&(Es(0,"ds-notice"),xC(1," The list of agents could not be loaded. What this agent already declares is listed below and preserved on save. "),hl());}function kt(n,t){n&1&&(Es(0,"p",4),xC(1,"No other agent is available in this scope yet."),hl());}function It(n,t){n&1&&(Es(0,"span",44),xC(1,"pattern"),hl());}function Rt(n,t){n&1&&(Es(0,"span",44),xC(1,"via pattern"),hl());}function Mt(n,t){if(n&1&&(Es(0,"span",44),xC(1),hl()),n&2){let e=eC(4);BE(),Dl(" ",e.subAgentCandidatesUnavailable()?"not verified":"no matching agent"," ");}}function Ft(n,t){if(n&1){let e=Yw();Es(0,"button",55),vg("click",function(){pf(e);let s=eC().$implicit,c=eC(3);return hf(c.removeSubAgent(s))}),xC(1," \xD7 "),hl();}if(n&2){let e=eC().$implicit;lg("aria-label","Remove "+e.selector);}}function Nt(n,t){if(n&1){let e=Yw();Es(0,"div",32)(1,"label",53)(2,"input",51),vg("change",function(){let s=pf(e).$implicit,c=eC(3);return hf(c.toggleSubAgent(s))}),hl(),Es(3,"span",24),xC(4),hl(),jw(5,It,2,0,"span",44)(6,Rt,2,0,"span",44)(7,Mt,2,1,"span",44),hl(),jw(8,Ft,2,1,"button",54),hl();}if(n&2){let e=t.$implicit,i=eC(3);BE(2),dg("checked",e.selected())("disabled",i.allSubAgentsSelected()),BE(2),Fg(e.name),BE(),Bw(e.pattern?5:e.grantedByPattern?6:e.unresolved?7:-1),BE(3),Bw(e.unresolved?8:-1);}}function Dt(n,t){if(n&1&&Uw(0,Nt,9,5,"div",32,We),n&2){let e=eC(2);$w(e.subAgentRows());}}function Lt(n,t){if(n&1){let e=Yw();Es(0,"div")(1,"button",56),vg("click",function(){pf(e);let s=eC(2);return hf(s.useDefaultDelegationTimeout())}),xC(2," Use server default "),hl()();}}function Vt(n,t){n&1&&(Es(0,"ds-notice"),xC(1),hl()),n&2&&(BE(),Fg(t));}function Pt(n,t){if(n&1){let e=Yw();Es(0,"button",57),vg("click",function(){pf(e);let s=eC(2);return hf(s.exportYaml())}),xC(1),hl();}if(n&2){let e=eC(2);dg("disabled",e.isExporting()),BE(),Dl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ot(n,t){if(n&1){let e=Yw();Es(0,"form",6),vg("ngSubmit",function(){pf(e);let s=eC();return hf(s.submit())}),Es(1,"ds-fieldset",7)(2,"ds-form-field",8),fg(3,"input",9),MI(),hl(),Es(4,"div",10)(5,"label",11),fg(6,"input",12),MI(),xC(7," Enabled "),hl(),Es(8,"p",13),xC(9,"Disabled agents are excluded from namespace resolution."),hl()(),Es(10,"ds-form-field",14),fg(11,"input",15),MI(),hl(),Es(12,"ds-form-field",16),jw(13,Ze,1,1,"input",17)(14,at,6,5,"select",18),hl(),Es(15,"ds-form-field",19),fg(16,"textarea",20),MI(),hl()(),jw(17,gt,5,2,"ds-fieldset",21),Es(18,"ds-fieldset",22)(19,"p",4),xC(20," Instruction bundles this agent can read on demand. Selecting at least one grants it the "),Es(21,"code"),xC(22,"readSkill"),hl(),xC(23," and "),Es(24,"code"),xC(25,"readSkillResource"),hl(),xC(26," tools; selecting none grants neither. "),jw(27,pt,1,0),hl(),Es(28,"label",11)(29,"input",23),vg("change",function(){pf(e);let s=eC();return hf(s.toggleAllSkills())}),hl(),Es(30,"span",24),xC(31,"Every skill in the catalogue ("),Es(32,"code",25),xC(33,"*"),hl(),xC(34,")"),hl()(),Es(35,"p",13),xC(36," Resolved at run time, so skills added later are granted too, without editing this agent. "),hl(),jw(37,ft,5,0,"ds-notice",26),jw(38,Ct,2,0,"ds-notice"),jw(39,_t,2,0,"p",4)(40,xt,2,0),hl(),Es(41,"ds-form-field",27)(42,"select",28)(43,"option",29),xC(44,"SIMPLE \u2014 Standard agent (single LLM call)"),hl(),Es(45,"option",29),xC(46,"ADVANCED \u2014 Multi-step reasoning loop"),hl(),Es(47,"option",29),xC(48,"LOOP \u2014 Bulk loop agent (no LLM, experimental)"),hl()(),MI(),hl(),jw(49,St,7,3,"ds-form-field",30),Es(50,"ds-fieldset",31)(51,"p",4),xC(52," The agents this one may delegate to. Selecting at least one grants it the "),Es(53,"code"),xC(54,"DELEGATE__delegate"),hl(),xC(55," tool; selecting none grants it no way to delegate. Entries are matched against agent names, never ids. "),jw(56,At,1,0),hl(),Es(57,"label",11)(58,"input",23),vg("change",function(){pf(e);let s=eC();return hf(s.toggleAllSubAgents())}),hl(),Es(59,"span",24),xC(60,"Every agent it can reach ("),Es(61,"code",25),xC(62,"*"),hl(),xC(63,")"),hl()(),Es(64,"p",13),xC(65," Resolved at run time, so agents added later can be delegated to as well, without editing this agent. "),hl(),jw(66,Et,6,1,"ds-notice",26),jw(67,Tt,2,0,"ds-notice"),jw(68,kt,2,0,"p",4)(69,Dt,2,0),Es(70,"p",4),xC(71," Advanced \u2014 add a glob instead of picking a name, for example "),Es(72,"code"),xC(73,"*Fixer"),hl(),xC(74," to cover BugFixer and StoryFixer. "),hl(),Es(75,"div",32)(76,"input",33),vg("keydown.enter",function(){pf(e);let s=eC();return hf(s.addSubAgent())}),hl(),MI(),Es(77,"button",34),vg("click",function(){pf(e);let s=eC();return hf(s.addSubAgent())}),xC(78," + "),hl()(),Es(79,"ds-form-field",35),fg(80,"input",36),MI(),jw(81,Lt,3,0,"div"),hl()(),jw(82,Vt,2,1,"ds-notice"),Es(83,"ds-form-actions")(84,"button",37),xC(85),hl(),jw(86,Pt,2,2,"button",38),Es(87,"button",39),vg("click",function(){pf(e);let s=eC();return hf(s.cancel())}),xC(88,"Cancel"),hl()()();}if(n&2){let e,i=eC();dg("formGroup",i.form),BE(3),dg("formControl",i.nameControl),xI(),BE(3),dg("formControl",i.enabledControl),xI(),BE(5),dg("formControl",i.descriptionControl),xI(),BE(2),Bw(i.modelAsFreeText()?13:14),BE(3),dg("formControl",i.instructionsControl),xI(),BE(),Bw(i.integrationRows().length>0||i.builtInRows().length>0?17:-1),BE(10),Bw(i.isPlatformMode?27:-1),BE(2),dg("checked",i.allSkillsSelected()),BE(8),Bw(i.namedSkillSelectionDropped()?37:-1),BE(),Bw(i.skillCatalogueUnavailable()?38:-1),BE(),Bw(i.skillRows().length===0?39:40),BE(3),dg("formControl",i.executionModeControl),xI(),BE(),dg("value",i.ExecutionMode.SIMPLE),BE(2),dg("value",i.ExecutionMode.ADVANCED),BE(2),dg("value",i.ExecutionMode.LOOP),BE(2),Bw(i.isLoopMode()?49:-1),BE(7),Bw(i.isPlatformMode?56:-1),BE(2),dg("checked",i.allSubAgentsSelected()),BE(8),Bw(i.namedSubAgentSelectionDropped()?66:-1),BE(),Bw(i.subAgentCandidatesUnavailable()?67:-1),BE(),Bw(i.subAgentRows().length===0?68:69),BE(8),dg("formControl",i.newSubAgentControl),xI(),BE(),dg("disabled",!i.newSubAgentControl.value.trim()),BE(2),dg("hint",i.delegationTimeoutHint())("error",i.delegationTimeoutControl.invalid?"Enter a valid positive whole number of seconds, or leave empty to inherit the server default.":null),BE(),dg("formControl",i.delegationTimeoutControl),lg("aria-invalid",i.delegationTimeoutControl.invalid),xI(),BE(),Bw(i.delegationTimeoutControl.value!==null?81:-1),BE(),Bw((e=i.submitError())?82:-1,e),BE(2),dg("disabled",i.form.invalid||i.isSubmitting()),BE(),Dl(" ",i.isEditMode()?"Save changes":"Create"," "),BE(),Bw(i.isEditMode()?86:-1);}}var Ke=class n{route=g(W);router=g(F$1);destroyRef=g(we);agentConfigController=g(U);defaultsController=g(N);defaultDelegationTimeoutSeconds=$i(null);exportService=g(K);integrationConfigState=g(O);integrationTypeController=g(_);skillState=g(o);aiModelState=g(A);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt$1({name:new Te("",{nonNullable:true,validators:[gn.required,gn.minLength(1)]}),description:new Te(null),modelName:new Te(null,{validators:[gn.required,n.notBlankValidator]}),instructions:new Te(null),executionMode:new Te("SIMPLE",{nonNullable:true}),delegationTimeoutSeconds:new Te(null,{validators:[gn.min(1),gn.max(2147483647),gn.pattern(/^\d+$/)]}),enabled:new Te(false,{nonNullable:true}),loopConfig:new Te(null,{validators:[n.jsonValidator]})});static notBlankValidator(t){let e=t.value;return typeof e=="string"&&e.length>0&&e.trim().length===0?{required:true}:null}static jsonValidator(t){let e=t.value?.trim();if(!e)return null;try{return JSON.parse(e),null}catch(i){return {invalidJson:true}}}get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get modelNameControl(){return this.form.controls.modelName}get instructionsControl(){return this.form.controls.instructions}get executionModeControl(){return this.form.controls.executionMode}get delegationTimeoutControl(){return this.form.controls.delegationTimeoutSeconds}useDefaultDelegationTimeout(){this.delegationTimeoutControl.setValue(null),this.delegationTimeoutControl.markAsDirty();}delegationTimeoutHint=rT(()=>{let t=this.defaultDelegationTimeoutSeconds();return `How long each delegation launched by this agent waits without activity from the sub-agent, including its own delegations. When it runs out, the sub-agent and its active descendants are stopped and can be resumed. Leave empty to use the server default${t!==null?`: ${t} s (${t/60} min)`:""}.`});get enabledControl(){return this.form.controls.enabled}get loopConfigControl(){return this.form.controls.loopConfig}executionModeValue=F$2(this.form.controls.executionMode.valueChanges,{initialValue:this.form.controls.executionMode.value});isLoopMode=rT(()=>this.executionModeValue()==="LOOP");subAgentRows=$i([]);allSubAgentsSelected=$i(false);subAgentCandidatesUnavailable=$i(false);namedSubAgentSelectionDropped=rT(()=>this.allSubAgentsSelected()&&this.subAgentRows().some(t=>t.selected()));droppedUnresolvedSubAgents=rT(()=>this.allSubAgentsSelected()?this.subAgentRows().filter(t=>t.unresolved&&t.selected()).length:0);hasAnySubAgent=rT(()=>this.allSubAgentsSelected()||this.subAgentRows().some(t=>t.selected()));newSubAgentControl=new Te("",{nonNullable:true});isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);isExporting=$i(false);submitError=$i(null);ExecutionMode=qe$1;loopConfigPlaceholder=JSON.stringify({search:{tool:"SearchTalents",params:{talentId:["6ac76692a909eaaae0b078d6"],resolveTargets:["MANAGER"],next:null}},act:{agentName:"ProfileCaretaker",promptTemplate:"This talent has not completed their profile. As their manager, I need you to help me review and improve it."}},null,2);builtInRows=$i([]);inspectRoute(){let t=this.route.snapshot.paramMap.get("agentConfigId")??"";return this.isPlatformMode?["/agentos","admin","agent-configs",t,"inspect"]:["/agentos",this.namespaceId,"agent-configs",t,"inspect"]}configAgentExposureWarning=rT(()=>Ue({configEnabled:this.builtInRows().some(t=>t.type===Ge&&t.state()==="on"),integrationTypes:this.integrationRows().filter(t=>t.enabled()).map(t=>t.config.integrationType),hasSubAgents:this.hasAnySubAgent()}));modelOptions=$i({aliases:[],apiNames:[],current:null});modelCatalogueLoaded=$i(false);modelAsFreeText=rT(()=>{let{aliases:t,apiNames:e}=this.modelOptions();return this.modelCatalogueLoaded()&&t.length+e.length===0});applyModelCatalogue(t,e){this.modelOptions.set(E(t,e)),this.modelCatalogueLoaded.set(true);}integrationRows=$i([]);skillRows=$i([]);allSkillsSelected=$i(false);skillCatalogueUnavailable=$i(false);namedSkillSelectionDropped=rT(()=>this.allSkillsSelected()&&this.skillRows().some(t=>t.selected()));existingConfig=null;ngOnInit(){this.defaultsController.getAgentConfigDefaults().pipe(U$1(this.destroyRef),ha(()=>br(null))).subscribe(e=>this.defaultDelegationTimeoutSeconds.set(e?.delegationTimeoutSeconds??null));let t=this.route.snapshot.paramMap.get("agentConfigId");t?(this.isEditMode.set(true),this.loadConfigAndIntegrations(t)):this.loadIntegrations(void 0);}loadConfigAndIntegrations(t){this.isLoading.set(true),by({config:this.agentConfigController.getByIdAgentConfig(t),namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):br([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes(),skillCatalogue:this.loadSkillCatalogue(),delegationCandidates:this.loadDelegationCandidates(),models:this.aiModelState.listAvailable(this.namespaceId)}).pipe(U$1(this.destroyRef)).subscribe({next:({config:e,namespaceIntegrations:i,platformIntegrations:s,builtInTypes:c,skillCatalogue:C,delegationCandidates:E,models:T})=>{this.existingConfig=e,this.applyModelCatalogue(T,e.modelName??null),this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.modelNameControl.setValue(e.modelName??null),this.instructionsControl.setValue(e.instructions??null);let f=e.executionMode??(e.advancedExecution?"ADVANCED":"SIMPLE");this.executionModeControl.setValue(f),this.delegationTimeoutControl.setValue(e.delegationTimeoutSeconds??null),this.enabledControl.setValue(e.enabled??true),this.loopConfigControl.setValue(e.loopConfig!=null?JSON.stringify(e.loopConfig,null,2):null);let N=[...s,...i];this.integrationRows.set(this.buildIntegrationRows(N,e.integrations??void 0)),this.builtInRows.set(this.buildBuiltInRows(c,e.integrations??void 0)),this.allSubAgentsSelected.set(Be(e.subAgents)),this.subAgentRows.set(this.buildSubAgentRows(E,e.subAgents,e.name)),this.allSkillsSelected.set(o$1(e.skillSelectors)),this.skillRows.set(this.buildSkillRows(C,e.skillSelectors)),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadIntegrations(t){by({namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):br([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes(),skillCatalogue:this.loadSkillCatalogue(),delegationCandidates:this.loadDelegationCandidates(),models:this.aiModelState.listAvailable(this.namespaceId)}).pipe(U$1(this.destroyRef)).subscribe({next:({namespaceIntegrations:e,platformIntegrations:i,builtInTypes:s,skillCatalogue:c,delegationCandidates:C,models:E})=>{this.applyModelCatalogue(E,null);let T=[...i,...e];this.integrationRows.set(this.buildIntegrationRows(T,t??void 0)),this.builtInRows.set(this.buildBuiltInRows(s,t??void 0)),this.allSubAgentsSelected.set(false),this.subAgentRows.set(this.buildSubAgentRows(C,void 0,null)),this.allSkillsSelected.set(false),this.skillRows.set(this.buildSkillRows(c,void 0));}});}loadSkillCatalogue(){return (this.namespaceId?this.skillState.listEffective(this.namespaceId):this.skillState.listPlatform().pipe(ne(e=>e.map(i=>({id:i.id??"",name:i.name,description:i.description,namespaceId:i.namespaceId??null,readOnly:i.readOnly===true}))))).pipe(ha(e=>(console.error("[agent-config-form] failed to load the skill catalogue",e),this.skillCatalogueUnavailable.set(true),br([]))))}buildSkillRows(t,e){let s=(e??[]).map(f=>f.trim()).filter(f=>f.length>0).filter(f=>f!==r),c=i(s),C=new Set(t.map(f=>f.name.toLowerCase())),E=t.map(f=>({selector:f.name,name:f.name,description:f.description,platform:f.namespaceId==null,unresolved:false,selected:$i(c.has(f.name.toLowerCase()))})),T=new Set;for(let f of s){let N=l(f).toLowerCase();C.has(N)||T.has(N)||(T.add(N),E.push({selector:f,name:f,description:"",platform:false,unresolved:true,selected:$i(true)}));}return E}toggleSkill(t){t.selected.update(e=>!e);}toggleAllSkills(){this.allSkillsSelected.update(t=>!t);}buildSkillSelectorsPayload(){if(this.allSkillsSelected())return [r];let t=this.skillRows().filter(e=>e.selected()).map(e=>e.selector);return t.length>0?t:void 0}loadDelegationCandidates(){let t=this.agentConfigController.listPlatformAgentsAgentConfig(false).pipe(this.orNoCandidates()),e=this.namespaceId?this.agentConfigController.listByParentAgentConfig(this.namespaceId,false).pipe(this.orNoCandidates()):br([]);return by({platform:t,namespace:e}).pipe(ne(({platform:i,namespace:s})=>[...i,...s]),ne(i=>i.map(s=>s.name).filter(s=>s.length>0)),ne(i=>n.dedupeByKey(i)))}orNoCandidates(){return ha(t=>(console.error("[agent-config-form] failed to load the delegation candidates",t),this.subAgentCandidatesUnavailable.set(true),br([])))}static dedupeByKey(t){let e=new Set;return t.filter(i=>{let s=i.toLowerCase();return e.has(s)?false:(e.add(s),true)})}buildSubAgentRows(t,e,i){let s=$e(e),c=i?.toLowerCase()??null,C=t.filter(_=>{let O=_.toLowerCase();return O!==c||s.has(O)}),E=new Set(C.map(_=>_.toLowerCase())),T=C.map(_=>({selector:_,name:_,unresolved:false,pattern:false,grantedByPattern:Y(_,e),selected:$i(s.has(_.toLowerCase()))})),f=new Set,N=(e??[]).map(_=>_.trim()).filter(_=>_.length>0&&_!==F);for(let _ of N){let O=_.toLowerCase();E.has(O)||f.has(O)||(f.add(O),T.push({selector:_,name:_,unresolved:true,pattern:j(_),grantedByPattern:false,selected:$i(true)}));}return T}loadBuiltInTypes(){return this.integrationTypeController.listTypesIntegrationType().pipe(ne(t=>t.filter(e=>!e.configSchema)),ha(t=>(console.error("[agent-config-form] failed to load integration types",t),br([]))))}buildIntegrationRows(t,e){return t.map(i=>{let s=i.name??"",c=e?.[s],C=e!=null&&s in e,E=Array.isArray(c)?c.join(", "):"";return {config:i,enabled:$i(C),toolsControl:new Te(E,{nonNullable:true})}})}buildBuiltInRows(t,e){return t.map(i=>{let s=e!=null&&i.type in e,c=e?.[i.type],C=s?Array.isArray(c)&&c.length===0?"off":"on":"default";return {type:i.type,displayName:i.displayName,description:i.description,enabledByDefault:i.enabledByDefault===true,state:$i(C),restrictedTools:Array.isArray(c)&&c.length>0?c:null}})}toggleIntegration(t){t.enabled.update(e=>!e);}setBuiltInState(t,e){t.state.set(e);}builtInDefaultLabel(t){return t.enabledByDefault?"Platform default (enabled)":"Platform default (disabled)"}addSubAgent(){let t=this.newSubAgentControl.value.trim();if(!t)return;let e=this.subAgentRows().find(i=>i.selector.toLowerCase()===t.toLowerCase());e?e.selected.set(true):t===F?this.allSubAgentsSelected.set(true):this.subAgentRows.update(i=>this.withPatternGrants([...i,{selector:t,name:t,unresolved:true,pattern:j(t),grantedByPattern:false,selected:$i(true)}])),this.newSubAgentControl.reset("");}removeSubAgent(t){let e=t.selector.toLowerCase();this.subAgentRows.update(i=>this.withPatternGrants(i.filter(s=>s.selector.toLowerCase()!==e)));}toggleSubAgent(t){t.selected.update(e=>!e),t.pattern&&this.subAgentRows.update(e=>this.withPatternGrants(e));}withPatternGrants(t){let e=this.allSubAgentsSelected()?[]:t.filter(i=>i.selected()).map(i=>i.selector);return t.map(i=>i.unresolved?i:x(w({},i),{grantedByPattern:Y(i.name,e)}))}toggleAllSubAgents(){this.allSubAgentsSelected.update(t=>!t),this.subAgentRows.update(t=>this.withPatternGrants(t));}buildSubAgentsPayload(){if(this.allSubAgentsSelected())return [F];let t=this.subAgentRows().filter(e=>e.selected()).map(e=>e.selector);return t.length>0?t:void 0}buildIntegrationsPayload(){let t={};for(let i of this.integrationRows().filter(s=>s.enabled())){let s=i.config.name??"",c=i.toolsControl.value.trim();t[s]=c===""?null:c.split(",").map(C=>C.trim()).filter(C=>C.length>0);}for(let i of this.builtInRows()){let s=i.state();s==="on"?t[i.type]=i.restrictedTools??null:s==="off"&&(t[i.type]=[]);}let e=new Set([...this.integrationRows().map(i=>i.config.name??""),...this.builtInRows().map(i=>i.type)]);for(let[i,s]of Object.entries(this.existingConfig?.integrations??{}))e.has(i)||(t[i]=s);return Object.keys(t).length>0?t:void 0}submit(){if(this.form.invalid||this.isSubmitting())return;this.addSubAgent(),this.submitError.set(null),this.isSubmitting.set(true);let t=x(w({},this.existingConfig??{}),{createdOn:this.existingConfig?.createdOn,updatedOn:this.existingConfig?.updatedOn,namespaceId:this.namespaceId,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,modelName:this.modelNameControl.value?.trim()||void 0,instructions:this.instructionsControl.value?.trim()||void 0,integrations:this.buildIntegrationsPayload(),executionMode:this.executionModeControl.value,advancedExecution:this.executionModeControl.value==="ADVANCED",enabled:this.enabledControl.value,subAgents:this.buildSubAgentsPayload(),skillSelectors:this.buildSkillSelectorsPayload(),delegationTimeoutSeconds:this.delegationTimeoutControl.value,loopConfig:this.buildLoopConfigPayload()});(this.isEditMode()?this.agentConfigController.updateAgentConfig(this.existingConfig.id??"",t):this.agentConfigController.createAgentConfig(t)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:i=>{this.isSubmitting.set(false),this.submitError.set(n.serverMessage(i));}});}static serverMessage(t){let i=t?.error?.message;if(typeof i=="string"&&i.trim().length>0)return i;let s=t?.status;return s===0?"The server could not be reached. The agent was not saved.":typeof s=="number"&&s>=500?`The server failed to save the agent (HTTP ${s}). Nothing was changed.`:"The server refused the save and gave no reason. Check the values and try again."}exportYaml(){let t=this.existingConfig?.id;!t||this.isExporting()||(this.isExporting.set(true),this.exportService.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let i=new Blob([e],{type:"application/yaml"}),s=URL.createObjectURL(i),c=document.createElement("a");c.href=s,c.download=`${this.existingConfig?.name??"agent"}.yaml`,c.click(),URL.revokeObjectURL(s),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}buildLoopConfigPayload(){let t=this.loopConfigControl.value?.trim();if(!t)return this.existingConfig?.loopConfig!=null?null:void 0;try{return JSON.parse(t)}catch(e){return}}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=vw({type:n,selectors:[["agentos-agent-config-form"]],decls:8,vars:4,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to agent configs",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],["headerMeta","","variant","outline"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Agent"],["label","Name","controlId","agent-config-name","required",""],["dsControl","","id","agent-config-name","type","text","placeholder","e.g. Support agent","autocomplete","off",3,"formControl"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","Description","controlId","agent-config-description"],["dsControl","","id","agent-config-description","type","text","placeholder","Optional \u2014 short description of this agent","autocomplete","off",3,"formControl"],["label","Model","controlId","agent-config-model-name","required","","hint","Aliases are matched first, then API model names. Resolved when the agent runs."],["dsControl","","id","agent-config-model-name","type","text","placeholder","Model alias or name to use, e.g. BIG","autocomplete","off",3,"formControl"],["dsControl","","id","agent-config-model-name",3,"formControl"],["label","Instructions","controlId","agent-config-instructions"],["dsControl","","id","agent-config-instructions","rows","6","placeholder","Optional \u2014 system instructions for this agent",3,"formControl"],["legend","Integrations","hint","Select which integrations this agent can use. Leave tool names empty to allow all tools from an integration."],["legend","Skills"],["type","checkbox",3,"change","checked"],[1,"ds-strong"],[1,"ds-code"],["tone","warning"],["label","Execution mode","controlId","agent-config-execution-mode","hint",'SIMPLE runs a single LLM pass. ADVANCED uses an intention loop for complex tasks and requires a model that supports advanced execution, otherwise the agent fails to run. LOOP (experimental) starts one case per result of a tool, without an LLM \u2014 run it with "Launch loop" in the agent list menu.'],["dsControl","","id","agent-config-execution-mode",3,"formControl"],[3,"value"],["label","Loop configuration (JSON)","controlId","agent-config-loop-config",3,"error"],["legend","Sub-agents"],[1,"ds-inline"],["dsControl","","type","text","aria-label","New sub-agent pattern","placeholder","e.g. *Fixer","autocomplete","off",3,"keydown.enter","formControl"],["dsButton","","variant","icon","type","button","title","Add pattern","aria-label","Add pattern",3,"click","disabled"],["label","Delegation timeout (seconds)","controlId","delegation-timeout","hintId","delegation-timeout-hint","errorId","delegation-timeout-error",3,"hint","error"],["dsControl","","id","delegation-timeout","type","number","min","1","max","2147483647","step","1","placeholder","Server default","aria-describedby","delegation-timeout-hint delegation-timeout-error",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["disabled","",3,"ngValue"],[3,"ngValue"],["label","Aliases"],["label","API model names"],[1,"ds-meta"],["dsControl","","type","text","placeholder","Tool names, comma-separated (empty = all tools)","autocomplete","off",1,"ds-indent",3,"formControl"],[1,"ds-micro"],["dsControl","",1,"ds-indent","ds-control--auto",3,"change","id","value"],["value","default"],["value","on"],["value","off"],["type","checkbox",3,"change","checked","disabled"],["dsControl","","mono","","id","agent-config-loop-config","rows","10","spellcheck","false","autocomplete","off",3,"placeholder","formControl"],["dsCheck","",1,"ds-grow"],["dsButton","","variant","icon-danger","type","button","title","Remove"],["dsButton","","variant","icon-danger","type","button","title","Remove",3,"click"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,i){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return i.cancel()}),xC(3," \u2190 Agent configs "),hl(),jw(4,ze,2,1,"a",2),jw(5,Xe,2,0,"ds-tag",3),hl(),jw(6,Qe,2,0,"p",4)(7,Ot,89,33,"form",5),hl()),e&2&&(BE(),dg("title",i.isEditMode()?"Edit agent config":"New agent config"),BE(3),Bw(i.isEditMode()?4:-1),BE(),Bw(i.isPlatformMode?5:-1),BE(),Bw(i.isLoading()?6:7));},dependencies:[qt,md,Co,Mo,Ht,Fn,yn,Ut,po,ho,Zr,Yr,An,On,$t,hn,fn,un,dn,cn,pn,at$1,sn,an,Fo],encapsulation:2})};export{Ke as AgentConfigFormComponent};
@@ -1,4 +1,4 @@
1
- import {aY as A,aZ as z$1}from'./main-2G6YLE3Q.js';var ut=z$1(Xe=>{"use strict";(function(i){var n=/\S/,t=/\"/g,e=/\n/g,r=/\r/g,a=/\\/g,s=/\u2028/,u=/\u2029/;i.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},i.scan=function(h,g){var S=h.length,U=0,R=1,q=2,E=U,$=null,ee=null,B="",I=[],J=!1,O=0,C=0,L="{{",b="}}";function te(){B.length>0&&(I.push({tag:"_t",text:new String(B)}),B="");}function ge(){for(var A=!0,k=C;k<I.length;k++)if(A=i.tags[I[k].tag]<i.tags._v||I[k].tag=="_t"&&I[k].text.match(n)===null,!A)return !1;return A}function be(A,k){if(te(),A&&ge())for(var _=C,ie;_<I.length;_++)I[_].text&&((ie=I[_+1])&&ie.tag==">"&&(ie.indent=I[_].text.toString()),I.splice(_,1));else k||I.push({tag:`
1
+ import {aY as A,aZ as z$1}from'./main-DYDARBQQ.js';var ut=z$1(Xe=>{"use strict";(function(i){var n=/\S/,t=/\"/g,e=/\n/g,r=/\r/g,a=/\\/g,s=/\u2028/,u=/\u2029/;i.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},i.scan=function(h,g){var S=h.length,U=0,R=1,q=2,E=U,$=null,ee=null,B="",I=[],J=!1,O=0,C=0,L="{{",b="}}";function te(){B.length>0&&(I.push({tag:"_t",text:new String(B)}),B="");}function ge(){for(var A=!0,k=C;k<I.length;k++)if(A=i.tags[I[k].tag]<i.tags._v||I[k].tag=="_t"&&I[k].text.match(n)===null,!A)return !1;return A}function be(A,k){if(te(),A&&ge())for(var _=C,ie;_<I.length;_++)I[_].text&&((ie=I[_+1])&&ie.tag==">"&&(ie.indent=I[_].text.toString()),I.splice(_,1));else k||I.push({tag:`
2
2
  `});J=!1,C=I.length;}function ne(A,k){var _="="+b,ie=A.indexOf(_,k),De=f(A.substring(A.indexOf("=",k)+1,ie)).split(" ");return L=De[0],b=De[De.length-1],ie+_.length-1}for(g&&(g=g.split(" "),L=g[0],b=g[1]),O=0;O<S;O++)E==U?v(L,h,O)?(--O,te(),E=R):h.charAt(O)==`
3
3
  `?be(J):B+=h.charAt(O):E==R?(O+=L.length-1,ee=i.tags[h.charAt(O+1)],$=ee?h.charAt(O+1):"_v",$=="="?(O=ne(h,O),E=U):(ee&&O++,E=q),J=O):v(b,h,O)?(I.push({tag:$,n:f(B),otag:L,ctag:b,i:$=="/"?J-L.length:O+b.length}),B="",O+=b.length-1,E=U,$=="{"&&(b=="}}"?O++:d(I[I.length-1]))):B+=h.charAt(O);return be(J,!0),I};function d(l){l.n.substr(l.n.length-1)==="}"&&(l.n=l.n.substring(0,l.n.length-1));}function f(l){return l.trim?l.trim():l.replace(/^\s*|\s*$/g,"")}function v(l,h,g){if(h.charAt(g)!=l.charAt(0))return !1;for(var S=1,U=l.length;S<U;S++)if(h.charAt(g+S)!=l.charAt(S))return !1;return !0}var y={_t:!0,"\n":!0,$:!0,"/":!0};function o(l,h,g,S){var U=[],R=null,q=null,E=null;for(q=g[g.length-1];l.length>0;){if(E=l.shift(),q&&q.tag=="<"&&!(E.tag in y))throw new Error("Illegal content in < super tag.");if(i.tags[E.tag]<=i.tags.$||c(E,S))g.push(E),E.nodes=o(l,E.tag,g,S);else if(E.tag=="/"){if(g.length===0)throw new Error("Closing tag without opener: /"+E.n);if(R=g.pop(),E.n!=R.n&&!m(E.n,R.n,S))throw new Error("Nesting error: "+R.n+" vs. "+E.n);return R.end=E.i,U}else E.tag==`
4
4
  `&&(E.last=l.length==0||l[0].tag==`
@@ -1 +1 @@
1
- import {v}from'./chunk-CZVszAsn.js';import {I}from'./chunk-CFXn7UF0.js';import {O}from'./chunk-BR-v_Yw0.js';import {g,W,q as F,I as we,a8 as _,a9 as F$1,aa as br,$ as $i,ab as le,r as rT,a1 as ga,K as U,O as Of,ac as by,v as vw,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,c as Bw,a2 as ha,ad as ne,Y as Yw,U as Uw,ae as Pw,R as MI,f as fg,t as eC,k as $w,S as xI,s as Dl,F as Fg,u as pf,w as hf}from'./main-2G6YLE3Q.js';import {p as pt,T as Te$1,a as fn,d as pn,h as hn,e as cn,r as ln,g as dn,o as on,i as at,j as an,t as rn,U as Ut,n as nd,b as bo,x as xo,L as Lt,u as vn,G as Gt,w as pa,m as mo,c as po,V as Vn,A as An,W as Wt}from'./chunk-CSMJ7MDS.js';import'./chunk-yhFoWYCU.js';var be=(i,e)=>e.value;function _e(i,e){i&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function xe(i,e){if(i&1&&(Es(0,"label",6),fg(1,"input",22),MI(),xC(2),hl()),i&2){let t=e.$implicit,n=eC(2);BE(),dg("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),xI(),BE(),Dl(" ",t.label," ");}}function Ie(i,e){if(i&1&&(Es(0,"option",10),xC(1),hl()),i&2){let t=e.$implicit;dg("value",t.type),BE(),Fg(t.displayName);}}function Ne(i,e){if(i&1&&(Es(0,"option",10),xC(1),hl()),i&2){let t=e.$implicit;dg("value",t.value),BE(),Fg(t.label);}}function Ae(i,e){if(i&1&&(Es(0,"div",18)(1,"label",6),fg(2,"input",23),MI(),xC(3," Grant automatically "),hl(),Es(4,"p",2),xC(5),hl()()),i&2){let t=eC(2);BE(2),dg("formControl",t.autoGrantControl),xI(),BE(3),Dl(" Give this integration to ",t.autoGrantReach(),", without each agent having to declare it. An agent can still opt out by mapping this configuration to an empty tool list. ");}}function Ee(i,e){if(i&1){let t=Yw();Es(0,"ds-card")(1,"ds-json-schema-form",24),vg("valueChange",function(a){pf(t);let p=eC(2);return hf(p.onParamsChange(a))}),hl()();}if(i&2){let t=eC(2);BE(),dg("schema",e)("value",t.initialParams());}}function Fe(i,e){if(i&1){let t=Yw();Es(0,"button",25),vg("click",function(){pf(t);let a=eC(2);return hf(a.exportYaml())}),xC(1),hl();}if(i&2){let t=eC(2);dg("disabled",t.isExporting()),BE(),Dl(" ",t.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Te(i,e){if(i&1){let t=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(t);let a=eC();return hf(a.submit())}),Es(1,"ds-fieldset",5),Uw(2,xe,3,4,"label",6,Pw().trackByScope,true),hl(),Es(4,"ds-form-field",7)(5,"select",8)(6,"option",9),xC(7,"Select type"),hl(),Uw(8,Ie,2,2,"option",10,Pw().trackByType,true),hl(),MI(),hl(),Es(10,"ds-form-field",11),fg(11,"input",12),MI(),hl(),Es(12,"ds-form-field",13),fg(13,"textarea",14),MI(),hl(),Es(14,"ds-form-field",15)(15,"select",16)(16,"option",17),xC(17,"None"),hl(),Uw(18,Ne,2,2,"option",10,be),hl(),MI(),hl(),jw(20,Ae,6,2,"div",18),jw(21,Ee,2,2,"ds-card"),Es(22,"ds-form-actions")(23,"button",19),xC(24),hl(),jw(25,Fe,2,2,"button",20),Es(26,"button",21),vg("click",function(){pf(t);let a=eC();return hf(a.cancel())}),xC(27,"Cancel"),hl()()();}if(i&2){let t,n=eC();dg("formGroup",n.form),BE(),dg("disabled",n.isEditMode()),BE(),$w(n.scopeOptions),BE(3),dg("formControl",n.typeControl),xI(),BE(3),$w(n.integrationTypes()),BE(3),dg("formControl",n.nameControl),xI(),BE(2),dg("formControl",n.descriptionControl),xI(),BE(2),dg("formControl",n.authSettingNameControl),xI(),BE(),dg("ngValue",null),BE(2),$w(n.authSettingOptions()),BE(2),Bw(n.isAutoGrantable()?20:-1),BE(),Bw((t=n.schema())?21:-1,t),BE(2),dg("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),BE(),Dl(" ",n.isEditMode()?"Save changes":"Create"," "),BE(),Bw(n.isEditMode()?25:-1);}}var Ve=new Set(["platform","namespace","userOnNs","userGlobal"]),w=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ve=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(O);integrationTypeController=g(_);authSettingState=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?br(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new pt({name:new Te$1("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te$1(null),type:new Te$1("",{nonNullable:true,validators:[fn.required]}),scope:new Te$1("namespace",{nonNullable:true}),autoGrant:new Te$1(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);isExporting=$i(false);scopeOptions=[{value:"platform",label:w.platform},{value:"namespace",label:w.namespace},{value:"userOnNs",label:w.userOnNs},{value:"userGlobal",label:w.userGlobal}];authSettingNameControl=new Te$1(null);loadedAuthSettings=$i([]);authSettingsLoaded=$i(false);savedAuthSettingName=$i(null);authSettingsScope$=new le;authSettingOptions=rT(()=>{let e=this.loadedAuthSettings(),t=this.savedAuthSettingName();return !t||!this.authSettingsLoaded()||e.some(n=>n.value===t)?e:[...e,{value:t,label:`${t} (not found)`}]});paramsValue=$i(null);initialParams=$i(null);integrationTypes=F$1(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=F$1(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});scopeValue=F$1(this.form.controls.scope.valueChanges,{initialValue:this.form.controls.scope.value});schema=rT(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});isAutoGrantable=rT(()=>{let e=this.selectedType();return e?this.integrationTypes().find(t=>t.type===e)?.autoGrantable??false:false});autoGrantReach=rT(()=>{switch(this.scopeValue()){case "platform":return "every agent of this environment";case "namespace":return "every agent of this namespace";default:return "your own runs"}});existingConfig=null;constructor(){this.authSettingsScope$.pipe(ga(e=>this.loadAuthSettingLayers(e)),U(this.destroyRef)).subscribe(e=>{this.loadedAuthSettings.set(this.toAuthSettingOptions(e)),this.authSettingsLoaded.set(true);}),Of(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let e=this.route.snapshot.paramMap,t=this.route.snapshot.queryParamMap,n=e.get("integrationId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable(),this.loadAuthSettingsForScope("platform");return}let a=this.parseScope(t.get("scope"));this.scopeControl.setValue(a),this.loadAuthSettingsForScope(a),this.scopeControl.valueChanges.pipe(U(this.destroyRef)).subscribe(D=>{this.loadAuthSettingsForScope(D);});let p=t.get("template");p&&this.hydrateFromTemplate(p);}parseScope(e){return e&&Ve.has(e)?e:"namespace"}deriveScopeFromConfig(e){return !e.userId&&!e.namespaceId?"platform":e.userId?e.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.existingConfig=t;let n=this.deriveScopeFromConfig(t);this.scopeControl.setValue(n),this.applyConfigToForm(t),this.loadAuthSettingsForScope(n),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[IntegrationForm] Could not load config '${e}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.applyConfigToForm(t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:t=>{console.warn(`[IntegrationForm] Could not hydrate from template ${e}:`,t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(e){this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.typeControl.setValue(e.integrationType),this.initialParams.set(e.parameters),this.paramsValue.set(e.parameters),this.authSettingNameControl.setValue(e.authSettingName??null),this.savedAuthSettingName.set(e.authSettingName??null),this.autoGrantControl.setValue(e.autoGrant??false);}loadAuthSettingsForScope(e){this.authSettingsLoaded.set(false),this.authSettingsScope$.next(e);}loadAuthSettingLayers(e){let t=(p,D)=>D.pipe(ha(()=>br([])),ne(Se=>({label:p,settings:Se}))),n=t("platform",this.authSettingState.loadPlatformSettings()),a=t("mine",this.authSettingState.loadUserSettings("global"));return e==="platform"||e==="userGlobal"?by([a,n]):by([t("mine",this.authSettingState.loadUserSettings(this.namespaceId)),t("namespace",this.authSettingState.loadNamespaceSettings(this.namespaceId)),a,n])}toAuthSettingOptions(e){let t=new Map;for(let{label:n,settings:a}of e)for(let{name:p}of a)p&&t.set(p,(t.get(p)??new Set).add(n));return [...t.entries()].sort(([n],[a])=>n.localeCompare(a)).map(([n,a])=>({value:n,label:`${n} (${[...a].join(", ")})`}))}onParamsChange(e){this.paramsValue.set(e);}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let e=this.descriptionControl.value?.trim(),t={name:this.nameControl.value.trim(),description:e||null,integrationType:this.typeControl.value,parameters:this.paramsValue(),authSettingName:this.authSettingNameControl.value||null,autoGrant:this.isAutoGrantable()&&this.autoGrantControl.value},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,t,n,this.existingConfig):this.state.create(t,n,this.namespaceId??null)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let e=this.existingConfig?.id;!e||this.isExporting()||(this.isExporting.set(true),this.state.exportAsYaml(e).pipe(U(this.destroyRef)).subscribe({next:t=>{let n=new Blob([t],{type:"application/yaml"}),a=URL.createObjectURL(n),p=document.createElement("a");p.href=a,p.download=`${this.existingConfig?.name??"integration"}.yaml`,p.click(),URL.revokeObjectURL(a),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"]);}trackByType(e,t){return t.type}trackByScope(e,t){return t.value}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=vw({type:i,selectors:[["agentos-integration-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to integrations",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Scope",3,"disabled"],["dsCheck",""],["label","Type","controlId","integration-type","required",""],["dsControl","","id","integration-type",3,"formControl"],["value","","disabled",""],[3,"value"],["label","Name","controlId","integration-name","required",""],["dsControl","","id","integration-name","type","text","placeholder","Integration name","autocomplete","off",3,"formControl"],["label","Description","controlId","integration-description"],["dsControl","","id","integration-description","placeholder","Optional description","rows","3",3,"formControl"],["label","Auth Setting","controlId","integration-auth-setting","hint","Only the name is saved. It is resolved at run time for the user running the case, the most specific layer winning (user on this namespace > namespace > user > platform), so a shared integration can rely on each user's own auth setting of that name."],["dsControl","","id","integration-auth-setting",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-stack--sm"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["type","radio",3,"value","formControl","disabled"],["type","checkbox",3,"formControl"],[3,"valueChange","schema","value"],["dsButton","","type","button",3,"click","disabled"]],template:function(t,n){t&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return n.cancel()}),xC(3," \u2190 Integrations "),hl()(),jw(4,_e,2,0,"p",2)(5,Te,28,12,"form",3),hl()),t&2&&(BE(),dg("title",n.isEditMode()?"Edit integration":"New integration"),BE(3),Bw(n.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,on,at,an,rn,Ut,nd,bo,xo,Lt,vn,Gt,pa,mo,po,Vn,An,Wt],encapsulation:2})};export{ve as IntegrationFormComponent};
1
+ import {v}from'./chunk-D8BMEvrt.js';import {I}from'./chunk-DbN0_APN.js';import {O}from'./chunk-C_TR3rI-.js';import {g,W,q as F,I as we,a8 as _,a9 as F$1,aa as br,$ as $i,ab as le,r as rT,a1 as ga,K as U,O as Of,ac as by,v as vw,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,c as Bw,a2 as ha,ad as ne,Y as Yw,U as Uw,ae as Pw,R as MI,f as fg,t as eC,k as $w,S as xI,s as Dl,F as Fg,u as pf,w as hf}from'./main-DYDARBQQ.js';import {p as pt,T as Te$1,g as gn,b as hn,c as fn,u as un,o as dn,d as cn,r as rn,e as at,i as sn,t as an,q as qt,m as md,C as Co,M as Mo,H as Ht,v as yn,U as Ut,x as ya,a as po,h as ho,A as An,O as On,W as Wt}from'./chunk-Uf57QzfJ.js';import'./chunk-CTrUVP-N.js';var be=(i,e)=>e.value;function _e(i,e){i&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function xe(i,e){if(i&1&&(Es(0,"label",6),fg(1,"input",22),MI(),xC(2),hl()),i&2){let t=e.$implicit,n=eC(2);BE(),dg("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),xI(),BE(),Dl(" ",t.label," ");}}function Ie(i,e){if(i&1&&(Es(0,"option",10),xC(1),hl()),i&2){let t=e.$implicit;dg("value",t.type),BE(),Fg(t.displayName);}}function Ne(i,e){if(i&1&&(Es(0,"option",10),xC(1),hl()),i&2){let t=e.$implicit;dg("value",t.value),BE(),Fg(t.label);}}function Ae(i,e){if(i&1&&(Es(0,"div",18)(1,"label",6),fg(2,"input",23),MI(),xC(3," Grant automatically "),hl(),Es(4,"p",2),xC(5),hl()()),i&2){let t=eC(2);BE(2),dg("formControl",t.autoGrantControl),xI(),BE(3),Dl(" Give this integration to ",t.autoGrantReach(),", without each agent having to declare it. An agent can still opt out by mapping this configuration to an empty tool list. ");}}function Ee(i,e){if(i&1){let t=Yw();Es(0,"ds-card")(1,"ds-json-schema-form",24),vg("valueChange",function(a){pf(t);let p=eC(2);return hf(p.onParamsChange(a))}),hl()();}if(i&2){let t=eC(2);BE(),dg("schema",e)("value",t.initialParams());}}function Fe(i,e){if(i&1){let t=Yw();Es(0,"button",25),vg("click",function(){pf(t);let a=eC(2);return hf(a.exportYaml())}),xC(1),hl();}if(i&2){let t=eC(2);dg("disabled",t.isExporting()),BE(),Dl(" ",t.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Te(i,e){if(i&1){let t=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(t);let a=eC();return hf(a.submit())}),Es(1,"ds-fieldset",5),Uw(2,xe,3,4,"label",6,Pw().trackByScope,true),hl(),Es(4,"ds-form-field",7)(5,"select",8)(6,"option",9),xC(7,"Select type"),hl(),Uw(8,Ie,2,2,"option",10,Pw().trackByType,true),hl(),MI(),hl(),Es(10,"ds-form-field",11),fg(11,"input",12),MI(),hl(),Es(12,"ds-form-field",13),fg(13,"textarea",14),MI(),hl(),Es(14,"ds-form-field",15)(15,"select",16)(16,"option",17),xC(17,"None"),hl(),Uw(18,Ne,2,2,"option",10,be),hl(),MI(),hl(),jw(20,Ae,6,2,"div",18),jw(21,Ee,2,2,"ds-card"),Es(22,"ds-form-actions")(23,"button",19),xC(24),hl(),jw(25,Fe,2,2,"button",20),Es(26,"button",21),vg("click",function(){pf(t);let a=eC();return hf(a.cancel())}),xC(27,"Cancel"),hl()()();}if(i&2){let t,n=eC();dg("formGroup",n.form),BE(),dg("disabled",n.isEditMode()),BE(),$w(n.scopeOptions),BE(3),dg("formControl",n.typeControl),xI(),BE(3),$w(n.integrationTypes()),BE(3),dg("formControl",n.nameControl),xI(),BE(2),dg("formControl",n.descriptionControl),xI(),BE(2),dg("formControl",n.authSettingNameControl),xI(),BE(),dg("ngValue",null),BE(2),$w(n.authSettingOptions()),BE(2),Bw(n.isAutoGrantable()?20:-1),BE(),Bw((t=n.schema())?21:-1,t),BE(2),dg("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),BE(),Dl(" ",n.isEditMode()?"Save changes":"Create"," "),BE(),Bw(n.isEditMode()?25:-1);}}var Ve=new Set(["platform","namespace","userOnNs","userGlobal"]),w=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ve=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(O);integrationTypeController=g(_);authSettingState=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?br(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new pt({name:new Te$1("",{nonNullable:true,validators:[gn.required,gn.minLength(1)]}),description:new Te$1(null),type:new Te$1("",{nonNullable:true,validators:[gn.required]}),scope:new Te$1("namespace",{nonNullable:true}),autoGrant:new Te$1(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);isExporting=$i(false);scopeOptions=[{value:"platform",label:w.platform},{value:"namespace",label:w.namespace},{value:"userOnNs",label:w.userOnNs},{value:"userGlobal",label:w.userGlobal}];authSettingNameControl=new Te$1(null);loadedAuthSettings=$i([]);authSettingsLoaded=$i(false);savedAuthSettingName=$i(null);authSettingsScope$=new le;authSettingOptions=rT(()=>{let e=this.loadedAuthSettings(),t=this.savedAuthSettingName();return !t||!this.authSettingsLoaded()||e.some(n=>n.value===t)?e:[...e,{value:t,label:`${t} (not found)`}]});paramsValue=$i(null);initialParams=$i(null);integrationTypes=F$1(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=F$1(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});scopeValue=F$1(this.form.controls.scope.valueChanges,{initialValue:this.form.controls.scope.value});schema=rT(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});isAutoGrantable=rT(()=>{let e=this.selectedType();return e?this.integrationTypes().find(t=>t.type===e)?.autoGrantable??false:false});autoGrantReach=rT(()=>{switch(this.scopeValue()){case "platform":return "every agent of this environment";case "namespace":return "every agent of this namespace";default:return "your own runs"}});existingConfig=null;constructor(){this.authSettingsScope$.pipe(ga(e=>this.loadAuthSettingLayers(e)),U(this.destroyRef)).subscribe(e=>{this.loadedAuthSettings.set(this.toAuthSettingOptions(e)),this.authSettingsLoaded.set(true);}),Of(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let e=this.route.snapshot.paramMap,t=this.route.snapshot.queryParamMap,n=e.get("integrationId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable(),this.loadAuthSettingsForScope("platform");return}let a=this.parseScope(t.get("scope"));this.scopeControl.setValue(a),this.loadAuthSettingsForScope(a),this.scopeControl.valueChanges.pipe(U(this.destroyRef)).subscribe(D=>{this.loadAuthSettingsForScope(D);});let p=t.get("template");p&&this.hydrateFromTemplate(p);}parseScope(e){return e&&Ve.has(e)?e:"namespace"}deriveScopeFromConfig(e){return !e.userId&&!e.namespaceId?"platform":e.userId?e.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.existingConfig=t;let n=this.deriveScopeFromConfig(t);this.scopeControl.setValue(n),this.applyConfigToForm(t),this.loadAuthSettingsForScope(n),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[IntegrationForm] Could not load config '${e}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.applyConfigToForm(t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:t=>{console.warn(`[IntegrationForm] Could not hydrate from template ${e}:`,t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(e){this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.typeControl.setValue(e.integrationType),this.initialParams.set(e.parameters),this.paramsValue.set(e.parameters),this.authSettingNameControl.setValue(e.authSettingName??null),this.savedAuthSettingName.set(e.authSettingName??null),this.autoGrantControl.setValue(e.autoGrant??false);}loadAuthSettingsForScope(e){this.authSettingsLoaded.set(false),this.authSettingsScope$.next(e);}loadAuthSettingLayers(e){let t=(p,D)=>D.pipe(ha(()=>br([])),ne(Se=>({label:p,settings:Se}))),n=t("platform",this.authSettingState.loadPlatformSettings()),a=t("mine",this.authSettingState.loadUserSettings("global"));return e==="platform"||e==="userGlobal"?by([a,n]):by([t("mine",this.authSettingState.loadUserSettings(this.namespaceId)),t("namespace",this.authSettingState.loadNamespaceSettings(this.namespaceId)),a,n])}toAuthSettingOptions(e){let t=new Map;for(let{label:n,settings:a}of e)for(let{name:p}of a)p&&t.set(p,(t.get(p)??new Set).add(n));return [...t.entries()].sort(([n],[a])=>n.localeCompare(a)).map(([n,a])=>({value:n,label:`${n} (${[...a].join(", ")})`}))}onParamsChange(e){this.paramsValue.set(e);}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let e=this.descriptionControl.value?.trim(),t={name:this.nameControl.value.trim(),description:e||null,integrationType:this.typeControl.value,parameters:this.paramsValue(),authSettingName:this.authSettingNameControl.value||null,autoGrant:this.isAutoGrantable()&&this.autoGrantControl.value},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,t,n,this.existingConfig):this.state.create(t,n,this.namespaceId??null)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let e=this.existingConfig?.id;!e||this.isExporting()||(this.isExporting.set(true),this.state.exportAsYaml(e).pipe(U(this.destroyRef)).subscribe({next:t=>{let n=new Blob([t],{type:"application/yaml"}),a=URL.createObjectURL(n),p=document.createElement("a");p.href=a,p.download=`${this.existingConfig?.name??"integration"}.yaml`,p.click(),URL.revokeObjectURL(a),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"]);}trackByType(e,t){return t.type}trackByScope(e,t){return t.value}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=vw({type:i,selectors:[["agentos-integration-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to integrations",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Scope",3,"disabled"],["dsCheck",""],["label","Type","controlId","integration-type","required",""],["dsControl","","id","integration-type",3,"formControl"],["value","","disabled",""],[3,"value"],["label","Name","controlId","integration-name","required",""],["dsControl","","id","integration-name","type","text","placeholder","Integration name","autocomplete","off",3,"formControl"],["label","Description","controlId","integration-description"],["dsControl","","id","integration-description","placeholder","Optional description","rows","3",3,"formControl"],["label","Auth Setting","controlId","integration-auth-setting","hint","Only the name is saved. It is resolved at run time for the user running the case, the most specific layer winning (user on this namespace > namespace > user > platform), so a shared integration can rely on each user's own auth setting of that name."],["dsControl","","id","integration-auth-setting",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-stack--sm"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["type","radio",3,"value","formControl","disabled"],["type","checkbox",3,"formControl"],[3,"valueChange","schema","value"],["dsButton","","type","button",3,"click","disabled"]],template:function(t,n){t&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return n.cancel()}),xC(3," \u2190 Integrations "),hl()(),jw(4,_e,2,0,"p",2)(5,Te,28,12,"form",3),hl()),t&2&&(BE(),dg("title",n.isEditMode()?"Edit integration":"New integration"),BE(3),Bw(n.isLoading()?4:5));},dependencies:[hn,fn,un,dn,cn,rn,at,sn,an,qt,md,Co,Mo,Ht,yn,Ut,ya,po,ho,An,On,Wt],encapsulation:2})};export{ve as IntegrationFormComponent};
@@ -1 +1 @@
1
- import {o}from'./chunk-DPXe72IN.js';import {z as k,O as O$1,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-CSMJ7MDS.js';import {g,q as F,I as we,Z as Tr,$ as $i,a1 as ga,K as U$1,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,s as Dl,Y as Yw,u as pf,w as hf,l as lg}from'./main-2G6YLE3Q.js';var K=(i,e)=>e.id??e.name;function O(i,e){if(i&1&&(Es(0,"p",3),xC(1),hl()),i&2){let t=eC();BE(),Fg(t.deletion.error());}}function A(i,e){i&1&&(Es(0,"p",4),xC(1,"Loading skills\u2026"),hl());}function H(i,e){i&1&&(Es(0,"p",5),xC(1,"No platform skills defined yet."),hl());}function U(i,e){i&1&&(Es(0,"p",4),xC(1,"No skills match the current filter."),hl());}function z(i,e){i&1&&(Es(0,"ds-tag",15),xC(1,"SKILL.md"),hl());}function G(i,e){if(i&1){let t=Yw();Es(0,"button",21),vg("click",function(){pf(t);let d=eC(2).$implicit,m=eC(2);return hf(m.edit(d))}),xC(1,"Edit"),hl();}if(i&2){let t=eC(2).$implicit;lg("aria-label","Edit "+t.name);}}function J(i,e){if(i&1){let t=Yw();Es(0,"button",21),vg("click",function(){pf(t);let d=eC().$implicit,m=eC(2);return hf(m.inspect(d))}),xC(1,"View"),hl(),jw(2,G,2,1,"button",22);}if(i&2){let t=eC().$implicit;lg("aria-label","View "+t.name),BE(2),Bw(t.readOnly?-1:2);}}function Q(i,e){if(i&1){let t=Yw();Es(0,"agentos-row-delete-action",23),vg("deleteRequested",function(){pf(t);let d=eC().$implicit,m=eC(2);return hf(m.deletion.request(d.id))})("deleteConfirmed",function(){pf(t);let d=eC().$implicit,m=eC(2);return hf(m.confirmDelete(d))})("deleteCancelled",function(){pf(t);let d=eC(3);return hf(d.deletion.cancel())}),hl();}if(i&2){let t=eC().$implicit,l=eC(2);dg("rowKey",t.id)("rowLabel",t.name)("state",l.deletion);}}function W(i,e){if(i&1&&(Es(0,"tr",9)(1,"td",12)(2,"div",13)(3,"span",14),xC(4),hl(),jw(5,z,2,0,"ds-tag",15),hl()(),Es(6,"td",16),xC(7),hl(),Es(8,"td",17),xC(9),hl(),Es(10,"td",18)(11,"div",19),jw(12,J,3,2),jw(13,Q,1,3,"agentos-row-delete-action",20),hl()()()),i&2){let t=e.$implicit,l=eC(2);BE(4),Fg(t.name),BE(),Bw(t.readOnly?5:-1),BE(2),Dl(" ",t.description||"\u2014"," "),BE(2),Fg(l.resourceCount(t)),BE(3),Bw(l.deletion.confirmingId()!==t.id?12:-1),BE(),Bw(!t.readOnly&&t.id?13:-1);}}function X(i,e){if(i&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Description"),hl(),Es(8,"th",10),xC(9,"Resources"),hl(),Es(10,"th",10)(11,"span",11),xC(12,"Actions"),hl()()()(),Es(13,"tbody",8),Uw(14,W,14,6,"tr",9,K),hl()()()),i&2){let t=eC();BE(14),$w(t.rowFilter.filteredRows());}}var B=class i{router=g(F);destroyRef=g(we);skillState=g(o);refresh$=new Tr(void 0);isLoading=$i(true);deletion=k();skills=$i([]);rowFilter=O$1(this.skills,e=>[e.name,e.description].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(this.isLoading.set(true),this.skillState.listPlatform())),U$1(this.destroyRef)).subscribe({next:e=>{this.skills.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}resourceCount(e){return Object.keys(e.resources??{}).length}openCreateForm(){this.router.navigate(["/agentos","admin","skills","new"]);}inspect(e){e.id&&this.router.navigate(["/agentos","admin","skills",e.id,"inspect"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","skills",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.skillState.delete(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:t=>t.status===403?`Deleting "${e.name}" requires platform administrator rights.`:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=vw({type:i,selectors:[["agentos-platform-skills"]],decls:9,vars:3,consts:[["title","Platform skills","description","Skills shared across every namespace."],["label","Filter skills","placeholder","Filter skills\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform skills"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__tags"],[1,"settings-table__name"],["variant","neutral"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Resources"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,l){t&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(m){return l.rowFilter.query.set(m)}),hl(),Es(2,"button",2),vg("click",function(){return l.openCreateForm()}),xC(3,"New skill"),hl()(),jw(4,O,2,1,"p",3),jw(5,A,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,X,16,0,"div",6)),t&2&&(BE(),dg("query",l.rowFilter.query()),BE(3),Bw(l.deletion.error()?4:-1),BE(),Bw(l.isLoading()?5:l.skills().length===0?6:l.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{B as PlatformSkillsComponent};
1
+ import {o}from'./chunk-zfSbYfDB.js';import {z as k,j as O$1,e as at,c as fn,k as ko,l as Fo,P,B as P$1}from'./chunk-Uf57QzfJ.js';import {g,q as F,I as we,Z as Tr,$ as $i,a1 as ga,K as U$1,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,s as Dl,Y as Yw,u as pf,w as hf,l as lg}from'./main-DYDARBQQ.js';var K=(i,e)=>e.id??e.name;function O(i,e){if(i&1&&(Es(0,"p",3),xC(1),hl()),i&2){let t=eC();BE(),Fg(t.deletion.error());}}function A(i,e){i&1&&(Es(0,"p",4),xC(1,"Loading skills\u2026"),hl());}function H(i,e){i&1&&(Es(0,"p",5),xC(1,"No platform skills defined yet."),hl());}function U(i,e){i&1&&(Es(0,"p",4),xC(1,"No skills match the current filter."),hl());}function z(i,e){i&1&&(Es(0,"ds-tag",15),xC(1,"SKILL.md"),hl());}function G(i,e){if(i&1){let t=Yw();Es(0,"button",21),vg("click",function(){pf(t);let d=eC(2).$implicit,m=eC(2);return hf(m.edit(d))}),xC(1,"Edit"),hl();}if(i&2){let t=eC(2).$implicit;lg("aria-label","Edit "+t.name);}}function J(i,e){if(i&1){let t=Yw();Es(0,"button",21),vg("click",function(){pf(t);let d=eC().$implicit,m=eC(2);return hf(m.inspect(d))}),xC(1,"View"),hl(),jw(2,G,2,1,"button",22);}if(i&2){let t=eC().$implicit;lg("aria-label","View "+t.name),BE(2),Bw(t.readOnly?-1:2);}}function Q(i,e){if(i&1){let t=Yw();Es(0,"agentos-row-delete-action",23),vg("deleteRequested",function(){pf(t);let d=eC().$implicit,m=eC(2);return hf(m.deletion.request(d.id))})("deleteConfirmed",function(){pf(t);let d=eC().$implicit,m=eC(2);return hf(m.confirmDelete(d))})("deleteCancelled",function(){pf(t);let d=eC(3);return hf(d.deletion.cancel())}),hl();}if(i&2){let t=eC().$implicit,l=eC(2);dg("rowKey",t.id)("rowLabel",t.name)("state",l.deletion);}}function W(i,e){if(i&1&&(Es(0,"tr",9)(1,"td",12)(2,"div",13)(3,"span",14),xC(4),hl(),jw(5,z,2,0,"ds-tag",15),hl()(),Es(6,"td",16),xC(7),hl(),Es(8,"td",17),xC(9),hl(),Es(10,"td",18)(11,"div",19),jw(12,J,3,2),jw(13,Q,1,3,"agentos-row-delete-action",20),hl()()()),i&2){let t=e.$implicit,l=eC(2);BE(4),Fg(t.name),BE(),Bw(t.readOnly?5:-1),BE(2),Dl(" ",t.description||"\u2014"," "),BE(2),Fg(l.resourceCount(t)),BE(3),Bw(l.deletion.confirmingId()!==t.id?12:-1),BE(),Bw(!t.readOnly&&t.id?13:-1);}}function X(i,e){if(i&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Description"),hl(),Es(8,"th",10),xC(9,"Resources"),hl(),Es(10,"th",10)(11,"span",11),xC(12,"Actions"),hl()()()(),Es(13,"tbody",8),Uw(14,W,14,6,"tr",9,K),hl()()()),i&2){let t=eC();BE(14),$w(t.rowFilter.filteredRows());}}var B=class i{router=g(F);destroyRef=g(we);skillState=g(o);refresh$=new Tr(void 0);isLoading=$i(true);deletion=k();skills=$i([]);rowFilter=O$1(this.skills,e=>[e.name,e.description].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(this.isLoading.set(true),this.skillState.listPlatform())),U$1(this.destroyRef)).subscribe({next:e=>{this.skills.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}resourceCount(e){return Object.keys(e.resources??{}).length}openCreateForm(){this.router.navigate(["/agentos","admin","skills","new"]);}inspect(e){e.id&&this.router.navigate(["/agentos","admin","skills",e.id,"inspect"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","skills",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.skillState.delete(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:t=>t.status===403?`Deleting "${e.name}" requires platform administrator rights.`:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=vw({type:i,selectors:[["agentos-platform-skills"]],decls:9,vars:3,consts:[["title","Platform skills","description","Skills shared across every namespace."],["label","Filter skills","placeholder","Filter skills\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform skills"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__tags"],[1,"settings-table__name"],["variant","neutral"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Resources"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,l){t&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(m){return l.rowFilter.query.set(m)}),hl(),Es(2,"button",2),vg("click",function(){return l.openCreateForm()}),xC(3,"New skill"),hl()(),jw(4,O,2,1,"p",3),jw(5,A,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,X,16,0,"div",6)),t&2&&(BE(),dg("query",l.rowFilter.query()),BE(3),Bw(l.deletion.error()?4:-1),BE(),Bw(l.isLoading()?5:l.skills().length===0?6:l.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,fn,ko,Fo,P,P$1],encapsulation:2})};export{B as PlatformSkillsComponent};
@@ -1 +1 @@
1
- import {z as k,O as O$1,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-CSMJ7MDS.js';import {g,q as F,I as we,ag as U$1,Z as Tr,$ as $i,a1 as ga,K as U$2,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,s as Dl,Y as Yw,u as pf,w as hf,l as lg}from'./main-2G6YLE3Q.js';var B=(n,e)=>e.id??e.name;function j(n,e){if(n&1&&(Es(0,"p",3),xC(1),hl()),n&2){let t=eC();BE(),Fg(t.deletion.error());}}function K(n,e){n&1&&(Es(0,"p",4),xC(1,"Loading agent configs\u2026"),hl());}function H(n,e){n&1&&(Es(0,"p",5),xC(1,"No platform agent configs defined yet."),hl());}function U(n,e){n&1&&(Es(0,"p",4),xC(1,"No agent configs match the current filter."),hl());}function z(n,e){if(n&1){let t=Yw();Es(0,"button",19),vg("click",function(){pf(t);let d=eC().$implicit,c=eC(2);return hf(c.inspect(d))}),xC(1," Inspect "),hl(),Es(2,"button",19),vg("click",function(){pf(t);let d=eC().$implicit,c=eC(2);return hf(c.edit(d))}),xC(3,"Edit"),hl();}if(n&2){let t=eC().$implicit;lg("aria-label","Inspect "+t.name),BE(2),lg("aria-label","Edit "+t.name);}}function G(n,e){if(n&1){let t=Yw();Es(0,"agentos-row-delete-action",20),vg("deleteRequested",function(){pf(t);let d=eC().$implicit,c=eC(2);return hf(c.deletion.request(d.id))})("deleteConfirmed",function(){pf(t);let d=eC().$implicit,c=eC(2);return hf(c.confirmDelete(d))})("deleteCancelled",function(){pf(t);let d=eC(3);return hf(d.deletion.cancel())}),hl();}if(n&2){let t=eC().$implicit,a=eC(2);dg("rowKey",t.id)("rowLabel",t.name)("state",a.deletion);}}function J(n,e){if(n&1&&(Es(0,"tr",9)(1,"td",12),xC(2),hl(),Es(3,"td",13),xC(4),hl(),Es(5,"td",14),xC(6),hl(),Es(7,"td",15),xC(8),hl(),Es(9,"td",16)(10,"div",17),jw(11,z,4,2),jw(12,G,1,3,"agentos-row-delete-action",18),hl()()()),n&2){let t=e.$implicit,a=eC(2);BE(2),Fg(t.name),BE(2),Dl(" ",t.description||"\u2014"," "),BE(2),Fg(t.modelName||"\u2014"),BE(2),Fg(a.mode(t)),BE(3),Bw(a.deletion.confirmingId()!==t.id?11:-1),BE(),Bw(t.id?12:-1);}}function O(n,e){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Description"),hl(),Es(8,"th",10),xC(9,"Model"),hl(),Es(10,"th",10),xC(11,"Execution mode"),hl(),Es(12,"th",10)(13,"span",11),xC(14,"Actions"),hl()()()(),Es(15,"tbody",8),Uw(16,J,13,6,"tr",9,B),hl()()()),n&2){let t=eC();BE(16),$w(t.rowFilter.filteredRows());}}var I=class n{router=g(F);destroyRef=g(we);agentConfigController=g(U$1);refresh$=new Tr(void 0);isLoading=$i(true);deletion=k();configs=$i([]);rowFilter=O$1(this.configs,e=>[e.name,e.description,e.modelName,this.mode(e)].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(this.isLoading.set(true),this.agentConfigController.listPlatformAgentsAgentConfig(true))),U$2(this.destroyRef)).subscribe({next:e=>{this.configs.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}mode(e){return e.executionMode??(e.advancedExecution?"ADVANCED":"SIMPLE")}openCreateForm(){this.router.navigate(["/agentos","admin","agent-configs","new"]);}inspect(e){e.id&&this.router.navigate(["/agentos","admin","agent-configs",e.id,"inspect"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","agent-configs",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.agentConfigController.deleteAgentConfig(e.id).pipe(U$2(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=vw({type:n,selectors:[["agentos-platform-agent-configs"]],decls:9,vars:3,consts:[["title","Platform agents","description","Agent configurations shared across every namespace."],["label","Filter agent configs","placeholder","Filter agent configs\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform agents"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Model"],["role","cell","data-label","Execution mode"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,a){t&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return a.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return a.openCreateForm()}),xC(3,"New agent config"),hl()(),jw(4,j,2,1,"p",3),jw(5,K,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,O,18,0,"div",6)),t&2&&(BE(),dg("query",a.rowFilter.query()),BE(3),Bw(a.deletion.error()?4:-1),BE(),Bw(a.isLoading()?5:a.configs().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{I as PlatformAgentConfigsComponent};
1
+ import {z as k,j as O$1,e as at,c as fn,k as ko,P,B as P$1}from'./chunk-Uf57QzfJ.js';import {g,q as F,I as we,ag as U$1,Z as Tr,$ as $i,a1 as ga,K as U$2,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,s as Dl,Y as Yw,u as pf,w as hf,l as lg}from'./main-DYDARBQQ.js';var B=(n,e)=>e.id??e.name;function j(n,e){if(n&1&&(Es(0,"p",3),xC(1),hl()),n&2){let t=eC();BE(),Fg(t.deletion.error());}}function K(n,e){n&1&&(Es(0,"p",4),xC(1,"Loading agent configs\u2026"),hl());}function H(n,e){n&1&&(Es(0,"p",5),xC(1,"No platform agent configs defined yet."),hl());}function U(n,e){n&1&&(Es(0,"p",4),xC(1,"No agent configs match the current filter."),hl());}function z(n,e){if(n&1){let t=Yw();Es(0,"button",19),vg("click",function(){pf(t);let d=eC().$implicit,c=eC(2);return hf(c.inspect(d))}),xC(1," Inspect "),hl(),Es(2,"button",19),vg("click",function(){pf(t);let d=eC().$implicit,c=eC(2);return hf(c.edit(d))}),xC(3,"Edit"),hl();}if(n&2){let t=eC().$implicit;lg("aria-label","Inspect "+t.name),BE(2),lg("aria-label","Edit "+t.name);}}function G(n,e){if(n&1){let t=Yw();Es(0,"agentos-row-delete-action",20),vg("deleteRequested",function(){pf(t);let d=eC().$implicit,c=eC(2);return hf(c.deletion.request(d.id))})("deleteConfirmed",function(){pf(t);let d=eC().$implicit,c=eC(2);return hf(c.confirmDelete(d))})("deleteCancelled",function(){pf(t);let d=eC(3);return hf(d.deletion.cancel())}),hl();}if(n&2){let t=eC().$implicit,a=eC(2);dg("rowKey",t.id)("rowLabel",t.name)("state",a.deletion);}}function J(n,e){if(n&1&&(Es(0,"tr",9)(1,"td",12),xC(2),hl(),Es(3,"td",13),xC(4),hl(),Es(5,"td",14),xC(6),hl(),Es(7,"td",15),xC(8),hl(),Es(9,"td",16)(10,"div",17),jw(11,z,4,2),jw(12,G,1,3,"agentos-row-delete-action",18),hl()()()),n&2){let t=e.$implicit,a=eC(2);BE(2),Fg(t.name),BE(2),Dl(" ",t.description||"\u2014"," "),BE(2),Fg(t.modelName||"\u2014"),BE(2),Fg(a.mode(t)),BE(3),Bw(a.deletion.confirmingId()!==t.id?11:-1),BE(),Bw(t.id?12:-1);}}function O(n,e){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Description"),hl(),Es(8,"th",10),xC(9,"Model"),hl(),Es(10,"th",10),xC(11,"Execution mode"),hl(),Es(12,"th",10)(13,"span",11),xC(14,"Actions"),hl()()()(),Es(15,"tbody",8),Uw(16,J,13,6,"tr",9,B),hl()()()),n&2){let t=eC();BE(16),$w(t.rowFilter.filteredRows());}}var I=class n{router=g(F);destroyRef=g(we);agentConfigController=g(U$1);refresh$=new Tr(void 0);isLoading=$i(true);deletion=k();configs=$i([]);rowFilter=O$1(this.configs,e=>[e.name,e.description,e.modelName,this.mode(e)].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(this.isLoading.set(true),this.agentConfigController.listPlatformAgentsAgentConfig(true))),U$2(this.destroyRef)).subscribe({next:e=>{this.configs.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}mode(e){return e.executionMode??(e.advancedExecution?"ADVANCED":"SIMPLE")}openCreateForm(){this.router.navigate(["/agentos","admin","agent-configs","new"]);}inspect(e){e.id&&this.router.navigate(["/agentos","admin","agent-configs",e.id,"inspect"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","agent-configs",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.agentConfigController.deleteAgentConfig(e.id).pipe(U$2(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=vw({type:n,selectors:[["agentos-platform-agent-configs"]],decls:9,vars:3,consts:[["title","Platform agents","description","Agent configurations shared across every namespace."],["label","Filter agent configs","placeholder","Filter agent configs\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform agents"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Model"],["role","cell","data-label","Execution mode"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,a){t&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return a.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return a.openCreateForm()}),xC(3,"New agent config"),hl()(),jw(4,j,2,1,"p",3),jw(5,K,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,O,18,0,"div",6)),t&2&&(BE(),dg("query",a.rowFilter.query()),BE(3),Bw(a.deletion.error()?4:-1),BE(),Bw(a.isLoading()?5:a.configs().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,fn,ko,P,P$1],encapsulation:2})};export{I as PlatformAgentConfigsComponent};