@whoz-oss/coday-client 0.0.0-workstream-forge.285 → 0.0.0-workstream-forge.286

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/3rdpartylicenses.txt +52 -0
  2. package/browser/{chunk-DXhOdsyd.js → chunk-5mGW4E0G.js} +1 -1
  3. package/browser/{chunk-BozaX28A.js → chunk-B4ZKQxLi.js} +1 -1
  4. package/browser/{chunk-waXaFQA6.js → chunk-B6Jjbp7r.js} +1 -1
  5. package/browser/{chunk-E7h9aRjY.js → chunk-BDdxWZSD.js} +1 -1
  6. package/browser/{chunk-BWZH94Ql.js → chunk-BFMfi7bN.js} +1 -1
  7. package/browser/{chunk-CimgVrmo.js → chunk-BGKOG_jF.js} +1 -1
  8. package/browser/{chunk-DoEqcxIp.js → chunk-BIv3GA0j.js} +1 -1
  9. package/browser/{chunk-Bj2SgFTY.js → chunk-BRKEdS-H.js} +1 -1
  10. package/browser/{chunk-B4IxKhfN.js → chunk-BSLGGdgS.js} +1 -1
  11. package/browser/{chunk-BvWC7yF9.js → chunk-BWOdgPpL.js} +1 -1
  12. package/browser/{chunk-UivSyOHl.js → chunk-BYBCnWol.js} +1 -1
  13. package/browser/{chunk-BU4BNqKl.js → chunk-BaZs2cqq.js} +1 -1
  14. package/browser/{chunk-CHXLjpvB.js → chunk-BecFkRj3.js} +1 -1
  15. package/browser/{chunk-DaKshFXh.js → chunk-BgspkyJn.js} +1 -1
  16. package/browser/chunk-BtNRYep-.js +16 -0
  17. package/browser/{chunk-BsMXvlMY.js → chunk-BuupDt2w.js} +1 -1
  18. package/browser/{chunk-DpaqV0I8.js → chunk-C-TFPDAn.js} +1 -1
  19. package/browser/{chunk-BpRfgEmz.js → chunk-C4AQsMm0.js} +1 -1
  20. package/browser/{chunk-D-9iMQv_.js → chunk-C8kRHbPY.js} +1 -1
  21. package/browser/{chunk-C3n9w6Vo.js → chunk-C9I0IDkC.js} +1 -1
  22. package/browser/{chunk-D7CYFO8e.js → chunk-C9Im1XQZ.js} +1 -1
  23. package/browser/{chunk-C6jMH6l0.js → chunk-CBa63htl.js} +1 -1
  24. package/browser/{chunk-BRhWdEcv.js → chunk-CR2ZgYm1.js} +1 -1
  25. package/browser/{chunk-DLUw6xZL.js → chunk-CTnGJhEu.js} +1 -1
  26. package/browser/chunk-CV72_wbg.js +690 -0
  27. package/browser/{chunk-DYFgJfm3.js → chunk-Cgng0NyG.js} +1 -1
  28. package/browser/{chunk-9lPOnBh7.js → chunk-Cht3Sl44.js} +1 -1
  29. package/browser/{chunk-DT7DFzXk.js → chunk-CpXnuzhL.js} +1 -1
  30. package/browser/chunk-Cw_G-BTP.js +1 -0
  31. package/browser/{chunk-Ch9IS2VK.js → chunk-D48e7Jxo.js} +1 -1
  32. package/browser/{chunk-Ca-YJxkj.js → chunk-DEd4dYEy.js} +1 -1
  33. package/browser/{chunk-ByMpO_2J.js → chunk-DII4lC8r.js} +1 -1
  34. package/browser/chunk-DTHI-QLx.js +61 -0
  35. package/browser/{chunk-BuXYpWqH.js → chunk-DUksmlzj.js} +1 -1
  36. package/browser/{chunk-CX2QtdIw.js → chunk-DWnk-InR.js} +1 -1
  37. package/browser/{chunk-BGaBu_yG.js → chunk-DZzoCiPa.js} +1 -1
  38. package/browser/chunk-Da_8VPJd.js +1 -0
  39. package/browser/{chunk-VqtB1BzG.js → chunk-DeS6UHdw.js} +1 -1
  40. package/browser/{chunk-DNO_UKkx.js → chunk-DtO-loh9.js} +1 -1
  41. package/browser/{chunk-Cnq159eN.js → chunk-DvgyKpON.js} +1 -1
  42. package/browser/{chunk-Deoyp47K.js → chunk-O_4Rn5qq.js} +1 -1
  43. package/browser/{chunk-DaMEeyR0.js → chunk-RNbGWl1w.js} +1 -1
  44. package/browser/{chunk-BQrs6HKm.js → chunk-YSYGmtzS.js} +1 -1
  45. package/browser/{chunk-DCU0O5Ka.js → chunk-cs0QcDnt.js} +1 -1
  46. package/browser/chunk-gOvITjLx.js +1 -0
  47. package/browser/{chunk-CfcxICq5.js → chunk-hqzAiSeU.js} +1 -1
  48. package/browser/{chunk-KqBRRBxT.js → chunk-spovbUSX.js} +1 -1
  49. package/browser/{chunk-DC3rgpMh.js → chunk-wS9pwsFZ.js} +1 -1
  50. package/browser/index.html +1 -1
  51. package/browser/{main-OLEL3JTU.js → main-2W2EKPFF.js} +1 -1
  52. package/package.json +1 -1
  53. package/browser/chunk-Bx5RArn6.js +0 -1
  54. package/browser/chunk-C7Y0YglE.js +0 -1
  55. package/browser/chunk-CFyknSSV.js +0 -1
  56. package/browser/chunk-anaDHfEv.js +0 -680
@@ -1 +1 @@
1
- import {f,y,p as pt,T as Te,b as bn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,P as Pn,Q as Qt,c as fo,g as go,t as ta,N as Nn,R as Rn,v as vn,d as yn,e as fn,h as hn,i as at,u as un}from'./chunk-anaDHfEv.js';import {g,W,F,G as J,K as we,j as mT,z as zi,n as Ff,U,M as w,O as x,N as Nw,I as Is,a as hg,Y as Yw,m as ml,P as pg,Q as QE,b as Qw,H as HC,s as sC,R as Eg,S as BI,J as Jw,p as dC,T as HI,i as fg,k as eC,o as Il,L as Lg,q as mf,r as yf}from'./main-OLEL3JTU.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&&(Is(0,"p",2),HC(1,"Loading\u2026"),ml());}function he(i,t){if(i&1&&(Is(0,"option",23),HC(1),ml()),i&2){let e=t.$implicit;pg("value",e.value),QE(),Lg(e.label);}}function pe(i,t){if(i&1){let e=sC();Is(0,"form",4),Eg("ngSubmit",function(){mf(e);let p=dC();return yf(p.submit())}),Is(1,"ds-form-field",5),hg(2,"input",6),BI(),ml(),Is(3,"ds-form-field",7),hg(4,"textarea",8),BI(),ml(),Is(5,"ds-form-field",9),hg(6,"input",10),BI(),ml(),Is(7,"ds-form-field",11),hg(8,"input",12),BI(),ml(),Is(9,"ds-form-field",13),hg(10,"input",14),BI(),ml(),Is(11,"ds-form-field",15),hg(12,"input",16),BI(),ml(),Is(13,"ds-form-field",17),hg(14,"input",18),BI(),ml(),Is(15,"ds-form-field",19)(16,"input",20),Eg("input",function(p){mf(e);let se=dC();return yf(se.onMaxToolRoundsInput(p))}),ml(),BI(),ml(),Is(17,"ds-form-field",21)(18,"select",22),Jw(19,he,2,2,"option",23,ce),ml(),BI(),ml(),Is(21,"ds-form-actions")(22,"button",24),HC(23),ml(),Is(24,"button",25),Eg("click",function(){mf(e);let p=dC();return yf(p.cancel())}),HC(25,"Cancel"),ml()()();}if(i&2){let e=dC();pg("formGroup",e.form),QE(2),pg("formControl",e.nameControl),HI(),QE(2),pg("formControl",e.descriptionControl),HI(),QE(2),pg("formControl",e.externalIdControl),HI(),QE(2),pg("formControl",e.defaultAgentNameControl),HI(),QE(2),pg("formControl",e.configPathControl),HI(),QE(),pg("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),QE(),pg("readOnly",!e.canEditSharedExchangePath())("formControl",e.sharedExchangePathControl),fg("aria-invalid",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid),HI(),QE(),pg("hint",e.runCostThresholdHint()),QE(),pg("placeholder",e.runCostThresholdPlaceholder())("formControl",e.runCostThresholdControl),HI(),QE(),pg("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),QE(),pg("formControl",e.maxToolRoundsControl),fg("aria-invalid",e.maxToolRoundsControl.invalid||e.maxToolRoundsUnparsable()),HI(),QE(2),pg("formControl",e.adminCaseListingControl),HI(),QE(),eC(e.adminCaseListingOptions),QE(3),pg("disabled",e.form.invalid||e.isSubmitting()),QE(),Il(" ",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=mT(()=>this.userState.currentUser()?.isAdmin===true);sharedExchangePathHint=mT(()=>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=mT(()=>{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=mT(()=>{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:[bn.required,bn.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:[bn.min(fe),bn.max(ge),bn.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=zi(false);onMaxToolRoundsInput(t){this.maxToolRoundsUnparsable.set(t.target.validity.badInput);}isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);existingNamespace=null;constructor(){Ff(()=>{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=Nw({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&&(Is(0,"ds-page",0),hg(1,"ds-section-header",1),Yw(2,ue,2,0,"p",2)(3,pe,26,20,"form",3),ml()),e&2&&(pg("framed",!u.isEditMode()),QE(),pg("title",u.isEditMode()?"Edit namespace":"New namespace"),QE(),Qw(u.isLoading()?2:3));},dependencies:[Kt,fd,Mo,Do,Ut,Pn,Qt,fo,go,ta,Nn,Rn,vn,yn,fn,hn,at,un],encapsulation:2})};export{Ce as ADMIN_CASE_LISTING_OPTIONS,le as NamespaceFormComponent};
1
+ import {f,y,p as pt,T as Te,b as bn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,P as Pn,Q as Qt,c as fo,g as go,t as ta,N as Nn,R as Rn,v as vn,d as yn,e as fn,h as hn,i as at,u as un}from'./chunk-CV72_wbg.js';import {g,W,F,G as J,K as we,j as mT,z as zi,n as Ff,U,M as w,O as x,N as Nw,I as Is,a as hg,Y as Yw,m as ml,P as pg,Q as QE,b as Qw,H as HC,s as sC,R as Eg,S as BI,J as Jw,p as dC,T as HI,i as fg,k as eC,o as Il,L as Lg,q as mf,r as yf}from'./main-2W2EKPFF.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&&(Is(0,"p",2),HC(1,"Loading\u2026"),ml());}function he(i,t){if(i&1&&(Is(0,"option",23),HC(1),ml()),i&2){let e=t.$implicit;pg("value",e.value),QE(),Lg(e.label);}}function pe(i,t){if(i&1){let e=sC();Is(0,"form",4),Eg("ngSubmit",function(){mf(e);let p=dC();return yf(p.submit())}),Is(1,"ds-form-field",5),hg(2,"input",6),BI(),ml(),Is(3,"ds-form-field",7),hg(4,"textarea",8),BI(),ml(),Is(5,"ds-form-field",9),hg(6,"input",10),BI(),ml(),Is(7,"ds-form-field",11),hg(8,"input",12),BI(),ml(),Is(9,"ds-form-field",13),hg(10,"input",14),BI(),ml(),Is(11,"ds-form-field",15),hg(12,"input",16),BI(),ml(),Is(13,"ds-form-field",17),hg(14,"input",18),BI(),ml(),Is(15,"ds-form-field",19)(16,"input",20),Eg("input",function(p){mf(e);let se=dC();return yf(se.onMaxToolRoundsInput(p))}),ml(),BI(),ml(),Is(17,"ds-form-field",21)(18,"select",22),Jw(19,he,2,2,"option",23,ce),ml(),BI(),ml(),Is(21,"ds-form-actions")(22,"button",24),HC(23),ml(),Is(24,"button",25),Eg("click",function(){mf(e);let p=dC();return yf(p.cancel())}),HC(25,"Cancel"),ml()()();}if(i&2){let e=dC();pg("formGroup",e.form),QE(2),pg("formControl",e.nameControl),HI(),QE(2),pg("formControl",e.descriptionControl),HI(),QE(2),pg("formControl",e.externalIdControl),HI(),QE(2),pg("formControl",e.defaultAgentNameControl),HI(),QE(2),pg("formControl",e.configPathControl),HI(),QE(),pg("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),QE(),pg("readOnly",!e.canEditSharedExchangePath())("formControl",e.sharedExchangePathControl),fg("aria-invalid",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid),HI(),QE(),pg("hint",e.runCostThresholdHint()),QE(),pg("placeholder",e.runCostThresholdPlaceholder())("formControl",e.runCostThresholdControl),HI(),QE(),pg("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),QE(),pg("formControl",e.maxToolRoundsControl),fg("aria-invalid",e.maxToolRoundsControl.invalid||e.maxToolRoundsUnparsable()),HI(),QE(2),pg("formControl",e.adminCaseListingControl),HI(),QE(),eC(e.adminCaseListingOptions),QE(3),pg("disabled",e.form.invalid||e.isSubmitting()),QE(),Il(" ",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=mT(()=>this.userState.currentUser()?.isAdmin===true);sharedExchangePathHint=mT(()=>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=mT(()=>{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=mT(()=>{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:[bn.required,bn.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:[bn.min(fe),bn.max(ge),bn.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=zi(false);onMaxToolRoundsInput(t){this.maxToolRoundsUnparsable.set(t.target.validity.badInput);}isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);existingNamespace=null;constructor(){Ff(()=>{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=Nw({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&&(Is(0,"ds-page",0),hg(1,"ds-section-header",1),Yw(2,ue,2,0,"p",2)(3,pe,26,20,"form",3),ml()),e&2&&(pg("framed",!u.isEditMode()),QE(),pg("title",u.isEditMode()?"Edit namespace":"New namespace"),QE(),Qw(u.isLoading()?2:3));},dependencies:[Kt,fd,Mo,Do,Ut,Pn,Qt,fo,go,ta,Nn,Rn,vn,yn,fn,hn,at,un],encapsulation:2})};export{Ce as ADMIN_CASE_LISTING_OPTIONS,le as NamespaceFormComponent};
@@ -1 +1 @@
1
- import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-DpaqV0I8.js';import {I}from'./chunk-Ca-YJxkj.js';import {g,W,F,K as we,z as zi,U,ad as ne$1,a1 as ma,aa as _r,aM as di,a2 as ga,ac as Ny,N as Nw,I as Is,R as Eg,m as ml,H as HC,Y as Yw,Q as QE,P as pg,b as Qw,p as dC,L as Lg,w as xC,i as fg,o as Il,J as Jw,k as eC,s as sC,q as mf,r as yf}from'./main-OLEL3JTU.js';import {q as k,O,a5 as w,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-anaDHfEv.js';import'./chunk-C7Y0YglE.js';var Q=(i,t)=>t.key;function X(i,t){if(i&1&&(Is(0,"p",3),HC(1),ml()),i&2){let e=dC();QE(),Lg(e.deletion.error());}}function Z(i,t){if(i&1&&(Is(0,"p"),HC(1),ml()),i&2){let e=t;xC(e.kind==="error"?"settings-table__error":"settings-table__status"),fg("role",e.kind==="error"?"alert":"status"),QE(),Il(" ",e.text," ");}}function ee(i,t){i&1&&(Is(0,"p",5),HC(1,"Loading auth settings\u2026"),ml());}function te(i,t){i&1&&(Is(0,"p",6),HC(1,"No auth settings available."),ml());}function ne(i,t){i&1&&(Is(0,"p",5),HC(1,"No auth settings match the current filter."),ml());}function ie(i,t){i&1&&(Is(0,"ds-tag",18),HC(1,"Read-only"),ml());}function oe(i,t){i&1&&(Is(0,"ds-tag",20),HC(1,"Connected"),ml());}function ae(i,t){i&1&&(Is(0,"ds-tag",18),HC(1,"Not connected"),ml());}function se(i,t){i&1&&(Is(0,"span",21),HC(1,"\u2014"),ml());}function re(i,t){if(i&1){let e=sC();Is(0,"span",26),HC(1,"Waiting for authorization\u2026"),ml(),Is(2,"button",27),Eg("click",function(){mf(e);let r=dC(4);return yf(r.cancelConnect())}),HC(3," Cancel "),ml();}if(i&2){let e=dC(2).$implicit;QE(2),fg("aria-label","Stop waiting for the authorization of "+e.config.name);}}function le(i,t){if(i&1){let e=sC();Is(0,"span",28),HC(1,"Disconnect?"),ml(),Is(2,"button",29),Eg("click",function(){mf(e);let r=dC(2).$implicit,d=dC(2);return yf(d.confirmReset(r))}),HC(3),ml(),Is(4,"button",29),Eg("click",function(){mf(e);let r=dC(4);return yf(r.cancelReset())}),HC(5," Cancel "),ml();}if(i&2){let e=dC(2).$implicit,n=dC(2);QE(2),pg("disabled",n.resettingKey()===e.key),fg("aria-label","Confirm disconnecting "+e.config.name),QE(),Il(" ",n.resettingKey()===e.key?"Disconnecting\u2026":"Confirm"," "),QE(),pg("disabled",n.resettingKey()===e.key),fg("aria-label","Cancel disconnecting "+e.config.name);}}function ce(i,t){if(i&1){let e=sC();Is(0,"button",29),Eg("click",function(){mf(e);let r=dC(3).$implicit,d=dC(2);return yf(d.requestReset(r))}),HC(1," Disconnect "),ml();}if(i&2){let e=dC(3).$implicit,n=dC(2);pg("disabled",n.connectingKey()!==null),fg("aria-label","Disconnect "+e.config.name);}}function de(i,t){if(i&1){let e=sC();Is(0,"button",29),Eg("click",function(){mf(e);let r=dC(2).$implicit,d=dC(2);return yf(d.connect(r))}),HC(1),ml(),Yw(2,ce,2,2,"button",30);}if(i&2){let e=dC(2).$implicit,n=dC(2);pg("disabled",n.connectingKey()!==null||n.resettingKey()!==null),fg("aria-label",(n.connectionOf(e)==="connected"?"Reconnect ":"Connect ")+e.config.name),QE(),Il(" ",n.connectionOf(e)==="connected"?"Reconnect":"Connect"," "),QE(),Qw(n.connectionOf(e)==="connected"?2:-1);}}function pe(i,t){if(i&1&&Yw(0,re,4,1)(1,le,6,5)(2,de,3,4),i&2){let e=dC().$implicit,n=dC(2);Qw(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=sC();Is(0,"button",27),Eg("click",function(){mf(e);let r=dC().$implicit,d=dC(2);return yf(d.duplicate(r))}),HC(1," Duplicate "),ml();}if(i&2){let e=dC().$implicit;fg("aria-label","Duplicate "+e.config.name);}}function _e(i,t){if(i&1){let e=sC();Is(0,"button",27),Eg("click",function(){mf(e);let r=dC(2).$implicit,d=dC(2);return yf(d.edit(r))}),HC(1," Edit "),ml();}if(i&2){let e=dC(2).$implicit;fg("aria-label","Edit "+e.config.name);}}function me(i,t){if(i&1){let e=sC();Yw(0,_e,2,1,"button",24),Is(1,"agentos-row-delete-action",31),Eg("deleteRequested",function(){mf(e);let r=dC().$implicit,d=dC(2);return yf(d.deletion.request(r.key))})("deleteConfirmed",function(){mf(e);let r=dC().$implicit,d=dC(2);return yf(d.confirmDelete(r))})("deleteCancelled",function(){mf(e);let r=dC(3);return yf(r.deletion.cancel())}),ml();}if(i&2){let e=dC().$implicit,n=dC(2);Qw(n.deletion.confirmingId()!==e.key?0:-1),QE(),pg("rowKey",e.key)("rowLabel",e.config.name)("state",n.deletion);}}function ge(i,t){i&1&&(Is(0,"button",25),HC(1,"Inherited"),ml());}function he(i,t){if(i&1&&(Is(0,"tr",10)(1,"td",13),HC(2),ml(),Is(3,"td",14),HC(4),ml(),Is(5,"td",15)(6,"div",16)(7,"ds-tag",17),HC(8),ml(),Yw(9,ie,2,0,"ds-tag",18),ml()(),Is(10,"td",19),Yw(11,oe,2,0,"ds-tag",20)(12,ae,2,0,"ds-tag",18)(13,se,2,0,"span",21),ml(),Is(14,"td",22)(15,"div",23),Yw(16,pe,3,1),Yw(17,ue,2,1,"button",24),Yw(18,me,2,4)(19,ge,2,0,"button",25),ml()()()),i&2){let e=t.$implicit,n=dC(2);QE(2),Lg(e.config.name),QE(2),Il(" ",e.config.authType," "),QE(3),pg("variant",e.scopeLabel==="Platform"?"neutral":e.scopeLabel==="Personal"?"outline":"accent"),QE(),Lg(e.scopeLabel),QE(),Qw(e.canMutate?-1:9),QE(2),Qw(n.isOAuth(e)&&n.connectionOf(e)==="connected"?11:n.isOAuth(e)&&n.connectionOf(e)==="disconnected"?12:13),QE(5),Qw(n.isOAuth(e)?16:-1),QE(),Qw(n.deletion.confirmingId()!==e.key&&n.resetConfirmingKey()!==e.key&&n.connectingKey()!==e.key?17:-1),QE(),Qw(e.canMutate?18:19);}}function Ce(i,t){if(i&1&&(Is(0,"div",7)(1,"table",8)(2,"thead",9)(3,"tr",10)(4,"th",11),HC(5,"Name"),ml(),Is(6,"th",11),HC(7,"Authentication type"),ml(),Is(8,"th",11),HC(9,"Scope"),ml(),Is(10,"th",11),HC(11,"Connection"),ml(),Is(12,"th",11)(13,"span",12),HC(14,"Actions"),ml()()()(),Is(15,"tbody",9),Jw(16,he,20,9,"tr",10,Q),ml()()()),i&2){let e=dC();QE(16),eC(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=zi(false);isLoading=zi(true);rows=zi([]);deletion=k();connections=zi({});connectingKey=zi(null);resetConfirmingKey=zi(null);resettingKey=zi(null);actionMessage=zi(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")??""),ma(t=>t?this.namespaceRole.isAdminOfNamespace$(t):_r(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(di(()=>{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"]),ga(()=>_r([e.key,"unknown"]))));if(t.length===0){this.connections.set({});return}this.connectionsLoad=Ny(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=Nw({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&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(d){return n.rowFilter.query.set(d)}),ml(),Is(2,"button",2),Eg("click",function(){return n.openCreateForm()}),HC(3,"New auth setting"),ml()(),Yw(4,X,2,1,"p",3),Yw(5,Z,2,4,"p",4),Yw(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;QE(),pg("query",n.rowFilter.query()),QE(3),Qw(n.deletion.error()?4:-1),QE(),Qw((r=n.actionMessage())?5:-1,r),QE(),Qw(n.isLoading()?6:n.rows().length===0?7:n.rowFilter.filteredRows().length===0?8:9);}},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{J as AuthSettingsAllScopesComponent};
1
+ import {n}from'./chunk-CfgXrte_.js';import {q as k,O,a5 as w,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-CV72_wbg.js';import {I}from'./chunk-DEd4dYEy.js';import {v}from'./chunk-C-TFPDAn.js';import {g,W,F,K as we,z as zi,U,ad as ne$1,a1 as ma,aa as _r,aM as di,a2 as ga,ac as Ny,N as Nw,I as Is,R as Eg,m as ml,H as HC,Y as Yw,Q as QE,P as pg,b as Qw,p as dC,L as Lg,w as xC,i as fg,o as Il,J as Jw,k as eC,s as sC,q as mf,r as yf}from'./main-2W2EKPFF.js';import'./chunk-gOvITjLx.js';var Q=(i,t)=>t.key;function X(i,t){if(i&1&&(Is(0,"p",3),HC(1),ml()),i&2){let e=dC();QE(),Lg(e.deletion.error());}}function Z(i,t){if(i&1&&(Is(0,"p"),HC(1),ml()),i&2){let e=t;xC(e.kind==="error"?"settings-table__error":"settings-table__status"),fg("role",e.kind==="error"?"alert":"status"),QE(),Il(" ",e.text," ");}}function ee(i,t){i&1&&(Is(0,"p",5),HC(1,"Loading auth settings\u2026"),ml());}function te(i,t){i&1&&(Is(0,"p",6),HC(1,"No auth settings available."),ml());}function ne(i,t){i&1&&(Is(0,"p",5),HC(1,"No auth settings match the current filter."),ml());}function ie(i,t){i&1&&(Is(0,"ds-tag",18),HC(1,"Read-only"),ml());}function oe(i,t){i&1&&(Is(0,"ds-tag",20),HC(1,"Connected"),ml());}function ae(i,t){i&1&&(Is(0,"ds-tag",18),HC(1,"Not connected"),ml());}function se(i,t){i&1&&(Is(0,"span",21),HC(1,"\u2014"),ml());}function re(i,t){if(i&1){let e=sC();Is(0,"span",26),HC(1,"Waiting for authorization\u2026"),ml(),Is(2,"button",27),Eg("click",function(){mf(e);let r=dC(4);return yf(r.cancelConnect())}),HC(3," Cancel "),ml();}if(i&2){let e=dC(2).$implicit;QE(2),fg("aria-label","Stop waiting for the authorization of "+e.config.name);}}function le(i,t){if(i&1){let e=sC();Is(0,"span",28),HC(1,"Disconnect?"),ml(),Is(2,"button",29),Eg("click",function(){mf(e);let r=dC(2).$implicit,d=dC(2);return yf(d.confirmReset(r))}),HC(3),ml(),Is(4,"button",29),Eg("click",function(){mf(e);let r=dC(4);return yf(r.cancelReset())}),HC(5," Cancel "),ml();}if(i&2){let e=dC(2).$implicit,n=dC(2);QE(2),pg("disabled",n.resettingKey()===e.key),fg("aria-label","Confirm disconnecting "+e.config.name),QE(),Il(" ",n.resettingKey()===e.key?"Disconnecting\u2026":"Confirm"," "),QE(),pg("disabled",n.resettingKey()===e.key),fg("aria-label","Cancel disconnecting "+e.config.name);}}function ce(i,t){if(i&1){let e=sC();Is(0,"button",29),Eg("click",function(){mf(e);let r=dC(3).$implicit,d=dC(2);return yf(d.requestReset(r))}),HC(1," Disconnect "),ml();}if(i&2){let e=dC(3).$implicit,n=dC(2);pg("disabled",n.connectingKey()!==null),fg("aria-label","Disconnect "+e.config.name);}}function de(i,t){if(i&1){let e=sC();Is(0,"button",29),Eg("click",function(){mf(e);let r=dC(2).$implicit,d=dC(2);return yf(d.connect(r))}),HC(1),ml(),Yw(2,ce,2,2,"button",30);}if(i&2){let e=dC(2).$implicit,n=dC(2);pg("disabled",n.connectingKey()!==null||n.resettingKey()!==null),fg("aria-label",(n.connectionOf(e)==="connected"?"Reconnect ":"Connect ")+e.config.name),QE(),Il(" ",n.connectionOf(e)==="connected"?"Reconnect":"Connect"," "),QE(),Qw(n.connectionOf(e)==="connected"?2:-1);}}function pe(i,t){if(i&1&&Yw(0,re,4,1)(1,le,6,5)(2,de,3,4),i&2){let e=dC().$implicit,n=dC(2);Qw(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=sC();Is(0,"button",27),Eg("click",function(){mf(e);let r=dC().$implicit,d=dC(2);return yf(d.duplicate(r))}),HC(1," Duplicate "),ml();}if(i&2){let e=dC().$implicit;fg("aria-label","Duplicate "+e.config.name);}}function _e(i,t){if(i&1){let e=sC();Is(0,"button",27),Eg("click",function(){mf(e);let r=dC(2).$implicit,d=dC(2);return yf(d.edit(r))}),HC(1," Edit "),ml();}if(i&2){let e=dC(2).$implicit;fg("aria-label","Edit "+e.config.name);}}function me(i,t){if(i&1){let e=sC();Yw(0,_e,2,1,"button",24),Is(1,"agentos-row-delete-action",31),Eg("deleteRequested",function(){mf(e);let r=dC().$implicit,d=dC(2);return yf(d.deletion.request(r.key))})("deleteConfirmed",function(){mf(e);let r=dC().$implicit,d=dC(2);return yf(d.confirmDelete(r))})("deleteCancelled",function(){mf(e);let r=dC(3);return yf(r.deletion.cancel())}),ml();}if(i&2){let e=dC().$implicit,n=dC(2);Qw(n.deletion.confirmingId()!==e.key?0:-1),QE(),pg("rowKey",e.key)("rowLabel",e.config.name)("state",n.deletion);}}function ge(i,t){i&1&&(Is(0,"button",25),HC(1,"Inherited"),ml());}function he(i,t){if(i&1&&(Is(0,"tr",10)(1,"td",13),HC(2),ml(),Is(3,"td",14),HC(4),ml(),Is(5,"td",15)(6,"div",16)(7,"ds-tag",17),HC(8),ml(),Yw(9,ie,2,0,"ds-tag",18),ml()(),Is(10,"td",19),Yw(11,oe,2,0,"ds-tag",20)(12,ae,2,0,"ds-tag",18)(13,se,2,0,"span",21),ml(),Is(14,"td",22)(15,"div",23),Yw(16,pe,3,1),Yw(17,ue,2,1,"button",24),Yw(18,me,2,4)(19,ge,2,0,"button",25),ml()()()),i&2){let e=t.$implicit,n=dC(2);QE(2),Lg(e.config.name),QE(2),Il(" ",e.config.authType," "),QE(3),pg("variant",e.scopeLabel==="Platform"?"neutral":e.scopeLabel==="Personal"?"outline":"accent"),QE(),Lg(e.scopeLabel),QE(),Qw(e.canMutate?-1:9),QE(2),Qw(n.isOAuth(e)&&n.connectionOf(e)==="connected"?11:n.isOAuth(e)&&n.connectionOf(e)==="disconnected"?12:13),QE(5),Qw(n.isOAuth(e)?16:-1),QE(),Qw(n.deletion.confirmingId()!==e.key&&n.resetConfirmingKey()!==e.key&&n.connectingKey()!==e.key?17:-1),QE(),Qw(e.canMutate?18:19);}}function Ce(i,t){if(i&1&&(Is(0,"div",7)(1,"table",8)(2,"thead",9)(3,"tr",10)(4,"th",11),HC(5,"Name"),ml(),Is(6,"th",11),HC(7,"Authentication type"),ml(),Is(8,"th",11),HC(9,"Scope"),ml(),Is(10,"th",11),HC(11,"Connection"),ml(),Is(12,"th",11)(13,"span",12),HC(14,"Actions"),ml()()()(),Is(15,"tbody",9),Jw(16,he,20,9,"tr",10,Q),ml()()()),i&2){let e=dC();QE(16),eC(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=zi(false);isLoading=zi(true);rows=zi([]);deletion=k();connections=zi({});connectingKey=zi(null);resetConfirmingKey=zi(null);resettingKey=zi(null);actionMessage=zi(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")??""),ma(t=>t?this.namespaceRole.isAdminOfNamespace$(t):_r(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(di(()=>{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"]),ga(()=>_r([e.key,"unknown"]))));if(t.length===0){this.connections.set({});return}this.connectionsLoad=Ny(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=Nw({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&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(d){return n.rowFilter.query.set(d)}),ml(),Is(2,"button",2),Eg("click",function(){return n.openCreateForm()}),HC(3,"New auth setting"),ml()(),Yw(4,X,2,1,"p",3),Yw(5,Z,2,4,"p",4),Yw(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;QE(),pg("query",n.rowFilter.query()),QE(3),Qw(n.deletion.error()?4:-1),QE(),Qw((r=n.actionMessage())?5:-1,r),QE(),Qw(n.isLoading()?6:n.rows().length===0?7:n.rowFilter.filteredRows().length===0?8:9);}},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{J as AuthSettingsAllScopesComponent};
@@ -1 +1 @@
1
- import {y,p as pt,T as Te,b as bn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,Q as Qt,c as fo,g as go,R as Rn,E as Ea,v as vn,d as yn,e as fn,h as hn,k as dn,i as at,u as un,m as mn,A as Ao}from'./chunk-anaDHfEv.js';import {g,K as we,W,G as J,z as zi,U,N as Nw,I as Is,a as hg,R as Eg,Y as Yw,m as ml,S as BI,H as HC,Q as QE,P as pg,b as Qw,T as HI,o as Il,a4 as we$1,a5 as Ed,a6 as A,p as dC,s as sC,L as Lg,a7 as Ln,q as mf,r as yf,J as Jw,k as eC}from'./main-OLEL3JTU.js';var I=class e{api=g(we$1);isLoading=zi(false);result=zi(null);errorMessage=zi(null);invoke(t,n,o,l){return this.isLoading.set(true),this.result.set(null),this.errorMessage.set(null),this.api.invoke({namespaceId:t,userId:n||void 0,toolName:o,payload:l||void 0}).pipe(Ed({next:v=>{this.result.set(v),this.isLoading.set(false);},error:v=>{this.errorMessage.set(le(v)),this.isLoading.set(false);}}))}reset(){this.result.set(null),this.errorMessage.set(null);}static \u0275fac=function(n){return new(n||e)};static \u0275prov=A({token:e,factory:e.\u0275fac,providedIn:"root"})};function le(e){if(e instanceof Ln){let t=e.error;return t&&typeof t=="object"&&"message"in t&&typeof t.message=="string"?t.message:typeof t=="string"&&t.trim().length>0?t:e.statusText||`HTTP ${e.status}`}return e instanceof Error?e.message:"Unknown error"}var de=(e,t)=>t.id;function me(e,t){e&1&&(Is(0,"p",14),HC(1,"Loading namespaces\u2026"),ml());}function pe(e,t){if(e&1&&(Is(0,"option",17),HC(1),ml()),e&2){let n=t.$implicit;pg("value",n.id),QE(),Lg(n.name);}}function ce(e,t){if(e&1&&(Is(0,"select",15)(1,"option",16),HC(2,"Select a namespace"),ml(),Jw(3,pe,2,2,"option",17,de),ml(),BI()),e&2){let n=dC(2);HI(),QE(3),eC(n.namespaces());}}function ue(e,t){if(e&1&&Yw(0,me,2,0,"p",14)(1,ce,5,0,"select",15),e&2){let n=dC();Qw(n.namespacesLoading()?0:1);}}function fe(e,t){if(e&1&&hg(0,"input",3),e&2){let n=dC();pg("value",n.namespaceName()??n.namespaceId);}}function ge(e,t){if(e&1){let n=sC();Is(0,"button",18),Eg("click",function(){mf(n);let l=dC();return yf(l.reset())}),HC(1,"Clear result"),ml();}}function ve(e,t){e&1&&(Is(0,"ds-card",12)(1,"pre",19),HC(2),ml()()),e&2&&(QE(2),Lg(t));}function ye(e,t){e&1&&(Is(0,"span",21),HC(1,"Metadata"),ml(),Is(2,"pre",19),HC(3),ml()),e&2&&(QE(3),Lg(t));}function Ce(e,t){if(e&1&&(Is(0,"dt"),HC(1,"Type"),ml(),Is(2,"dd",23),HC(3),ml()),e&2){let n=dC(2);QE(3),Lg(n.errorType);}}function _e(e,t){if(e&1&&(Is(0,"dt"),HC(1,"Message"),ml(),Is(2,"dd"),HC(3),ml()),e&2){let n=dC(2);QE(3),Lg(n.errorMessage);}}function be(e,t){if(e&1&&(Is(0,"span",21),HC(1,"Tool error details"),ml(),Is(2,"dl",22),Yw(3,Ce,4,1),Yw(4,_e,4,1),ml()),e&2){let n=dC();QE(3),Qw(n.errorType?3:-1),QE(),Qw(n.errorMessage?4:-1);}}function he(e,t){if(e&1&&(Is(0,"ds-card",13)(1,"div")(2,"ds-tag",20),HC(3),ml()(),Is(4,"span",21),HC(5,"Output"),ml(),Is(6,"pre",19),HC(7),ml(),Yw(8,ye,4,1),Is(9,"span",21),HC(10,"Structured output"),ml(),Is(11,"pre",19),HC(12),ml(),Yw(13,be,5,2),ml()),e&2){let n,o=t,l=dC();pg("heading","Result \u2014 "+o.toolName),QE(2),pg("variant",o.success?"accent":"outline"),QE(),Lg(o.success?"Success":"Tool error"),QE(4),Lg(o.output),QE(),Qw((n=l.formatMetadata(o.metadata))?8:-1,n),QE(4),Lg(l.formatStructuredOutput(o.structuredOutput)??"null"),QE(),Qw(o.errorType||o.errorMessage?13:-1);}}var re=class e{destroyRef=g(we);route=g(W);namespaceController=g(J);userState=g(y);state=g(I);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;namespaces=zi([]);namespacesLoading=zi(true);namespaceName=zi(null);form=new pt({namespaceId:new Te("",{nonNullable:true,validators:[bn.required]}),userId:new Te("",{nonNullable:true}),toolName:new Te("",{nonNullable:true,validators:[bn.required]}),payload:new Te("",{nonNullable:true})});ngOnInit(){let t=this.userState.currentUser()?.id;t?this.form.controls.userId.patchValue(t):this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:n=>{n.id&&this.form.controls.userId.patchValue(n.id);}}),this.isPlatformMode?this.namespaceController.listAllNamespace().pipe(U(this.destroyRef)).subscribe({next:n=>{this.namespaces.set(n.map(o=>({id:o.id,name:o.name}))),this.namespacesLoading.set(false);},error:()=>this.namespacesLoading.set(false)}):(this.form.controls.namespaceId.patchValue(this.namespaceId),this.namespacesLoading.set(false),this.namespaceController.getByIdNamespace(this.namespaceId).pipe(U(this.destroyRef)).subscribe({next:n=>this.namespaceName.set(n.name),error:()=>this.namespaceName.set(this.namespaceId)}));}submit(){if(this.form.invalid||this.state.isLoading())return;let{namespaceId:t,userId:n,toolName:o,payload:l}=this.form.getRawValue();this.state.invoke(t,n.trim()||void 0,o.trim(),l.trim()||void 0).pipe(U(this.destroyRef)).subscribe();}reset(){this.state.reset();}formatMetadata(t){return !t||Object.keys(t).length===0?null:JSON.stringify(t,null,2)}formatStructuredOutput(t){return t===void 0?null:JSON.stringify(t,null,2)}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=Nw({type:e,selectors:[["agentos-tool-invoke"]],decls:18,vars:8,consts:[["title","Tool invoke",3,"description"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Namespace","controlId","ti-namespace","required",""],["dsControl","","id","ti-namespace","type","text","readonly","",3,"value"],["label","User ID","labelHint","optional","controlId","ti-user"],["dsControl","","id","ti-user","type","text","formControlName","userId","placeholder","UUID of the user \u2014 adds user-scoped overlay layers","autocomplete","off"],["label","Tool name","controlId","ti-tool","required","","hint","Exact tool name as returned by the agent definition inspect page. When not found, the error response lists all available tools for the selected namespace."],["dsControl","","mono","","id","ti-tool","type","text","formControlName","toolName","placeholder","e.g. MY_FILES__listFiles","autocomplete","off","spellcheck","false"],["label","Payload","labelHint","optional","controlId","ti-payload"],["dsControl","","mono","","id","ti-payload","formControlName","payload","rows","6","placeholder",'JSON arguments for the tool, e.g. {"path": "/some/dir"} \u2014 leave empty for tools with no input.',"spellcheck","false"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button"],["heading","Error"],[3,"heading"],[1,"ds-hint"],["dsControl","","id","ti-namespace","formControlName","namespaceId"],["value","","disabled",""],[3,"value"],["dsButton","","type","button",3,"click"],[1,"ds-pre"],[3,"variant"],[1,"ds-micro"],["dsDefinitionList",""],[1,"ds-mono"]],template:function(n,o){if(n&1&&(Is(0,"ds-page"),hg(1,"ds-section-header",0),Is(2,"form",1),Eg("ngSubmit",function(){return o.submit()}),Is(3,"ds-form-field",2),Yw(4,ue,2,1)(5,fe,1,1,"input",3),ml(),Is(6,"ds-form-field",4),hg(7,"input",5),BI(),ml(),Is(8,"ds-form-field",6),hg(9,"input",7),BI(),ml(),Is(10,"ds-form-field",8),hg(11,"textarea",9),BI(),ml(),Is(12,"ds-form-actions")(13,"button",10),HC(14),ml(),Yw(15,ge,2,0,"button",11),ml()(),Yw(16,ve,3,1,"ds-card",12),Yw(17,he,14,7,"ds-card",13),ml()),n&2){let l,v;QE(),pg("description",o.isPlatformMode?"Execute any registered tool directly \u2014 bypasses the normal agent-run pipeline. Restricted to super-admins.":"Execute a registered tool directly in this namespace \u2014 bypasses the normal agent-run pipeline."),QE(),pg("formGroup",o.form),QE(2),Qw(o.isPlatformMode?4:5),QE(3),HI(),QE(2),HI(),QE(2),HI(),QE(2),pg("disabled",o.form.invalid||o.state.isLoading()),QE(),Il(" ",o.state.isLoading()?"Running\u2026":"Run tool"," "),QE(),Qw(o.state.result()||o.state.errorMessage()?15:-1),QE(),Qw((l=o.state.errorMessage())?16:-1,l),QE(),Qw((v=o.state.result())?17:-1,v);}},dependencies:[Kt,fd,Mo,Do,Ut,Qt,fo,go,Rn,Ea,vn,yn,fn,hn,dn,at,un,mn,Ao],encapsulation:2})};export{re as ToolInvokeComponent};
1
+ import {y,p as pt,T as Te,b as bn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,Q as Qt,c as fo,g as go,R as Rn,E as Ea,v as vn,d as yn,e as fn,h as hn,k as dn,i as at,u as un,m as mn,A as Ao}from'./chunk-CV72_wbg.js';import {g,K as we,W,G as J,z as zi,U,N as Nw,I as Is,a as hg,R as Eg,Y as Yw,m as ml,S as BI,H as HC,Q as QE,P as pg,b as Qw,T as HI,o as Il,a4 as we$1,a5 as Ed,a6 as A,p as dC,s as sC,L as Lg,a7 as Ln,q as mf,r as yf,J as Jw,k as eC}from'./main-2W2EKPFF.js';var I=class e{api=g(we$1);isLoading=zi(false);result=zi(null);errorMessage=zi(null);invoke(t,n,o,l){return this.isLoading.set(true),this.result.set(null),this.errorMessage.set(null),this.api.invoke({namespaceId:t,userId:n||void 0,toolName:o,payload:l||void 0}).pipe(Ed({next:v=>{this.result.set(v),this.isLoading.set(false);},error:v=>{this.errorMessage.set(le(v)),this.isLoading.set(false);}}))}reset(){this.result.set(null),this.errorMessage.set(null);}static \u0275fac=function(n){return new(n||e)};static \u0275prov=A({token:e,factory:e.\u0275fac,providedIn:"root"})};function le(e){if(e instanceof Ln){let t=e.error;return t&&typeof t=="object"&&"message"in t&&typeof t.message=="string"?t.message:typeof t=="string"&&t.trim().length>0?t:e.statusText||`HTTP ${e.status}`}return e instanceof Error?e.message:"Unknown error"}var de=(e,t)=>t.id;function me(e,t){e&1&&(Is(0,"p",14),HC(1,"Loading namespaces\u2026"),ml());}function pe(e,t){if(e&1&&(Is(0,"option",17),HC(1),ml()),e&2){let n=t.$implicit;pg("value",n.id),QE(),Lg(n.name);}}function ce(e,t){if(e&1&&(Is(0,"select",15)(1,"option",16),HC(2,"Select a namespace"),ml(),Jw(3,pe,2,2,"option",17,de),ml(),BI()),e&2){let n=dC(2);HI(),QE(3),eC(n.namespaces());}}function ue(e,t){if(e&1&&Yw(0,me,2,0,"p",14)(1,ce,5,0,"select",15),e&2){let n=dC();Qw(n.namespacesLoading()?0:1);}}function fe(e,t){if(e&1&&hg(0,"input",3),e&2){let n=dC();pg("value",n.namespaceName()??n.namespaceId);}}function ge(e,t){if(e&1){let n=sC();Is(0,"button",18),Eg("click",function(){mf(n);let l=dC();return yf(l.reset())}),HC(1,"Clear result"),ml();}}function ve(e,t){e&1&&(Is(0,"ds-card",12)(1,"pre",19),HC(2),ml()()),e&2&&(QE(2),Lg(t));}function ye(e,t){e&1&&(Is(0,"span",21),HC(1,"Metadata"),ml(),Is(2,"pre",19),HC(3),ml()),e&2&&(QE(3),Lg(t));}function Ce(e,t){if(e&1&&(Is(0,"dt"),HC(1,"Type"),ml(),Is(2,"dd",23),HC(3),ml()),e&2){let n=dC(2);QE(3),Lg(n.errorType);}}function _e(e,t){if(e&1&&(Is(0,"dt"),HC(1,"Message"),ml(),Is(2,"dd"),HC(3),ml()),e&2){let n=dC(2);QE(3),Lg(n.errorMessage);}}function be(e,t){if(e&1&&(Is(0,"span",21),HC(1,"Tool error details"),ml(),Is(2,"dl",22),Yw(3,Ce,4,1),Yw(4,_e,4,1),ml()),e&2){let n=dC();QE(3),Qw(n.errorType?3:-1),QE(),Qw(n.errorMessage?4:-1);}}function he(e,t){if(e&1&&(Is(0,"ds-card",13)(1,"div")(2,"ds-tag",20),HC(3),ml()(),Is(4,"span",21),HC(5,"Output"),ml(),Is(6,"pre",19),HC(7),ml(),Yw(8,ye,4,1),Is(9,"span",21),HC(10,"Structured output"),ml(),Is(11,"pre",19),HC(12),ml(),Yw(13,be,5,2),ml()),e&2){let n,o=t,l=dC();pg("heading","Result \u2014 "+o.toolName),QE(2),pg("variant",o.success?"accent":"outline"),QE(),Lg(o.success?"Success":"Tool error"),QE(4),Lg(o.output),QE(),Qw((n=l.formatMetadata(o.metadata))?8:-1,n),QE(4),Lg(l.formatStructuredOutput(o.structuredOutput)??"null"),QE(),Qw(o.errorType||o.errorMessage?13:-1);}}var re=class e{destroyRef=g(we);route=g(W);namespaceController=g(J);userState=g(y);state=g(I);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;namespaces=zi([]);namespacesLoading=zi(true);namespaceName=zi(null);form=new pt({namespaceId:new Te("",{nonNullable:true,validators:[bn.required]}),userId:new Te("",{nonNullable:true}),toolName:new Te("",{nonNullable:true,validators:[bn.required]}),payload:new Te("",{nonNullable:true})});ngOnInit(){let t=this.userState.currentUser()?.id;t?this.form.controls.userId.patchValue(t):this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:n=>{n.id&&this.form.controls.userId.patchValue(n.id);}}),this.isPlatformMode?this.namespaceController.listAllNamespace().pipe(U(this.destroyRef)).subscribe({next:n=>{this.namespaces.set(n.map(o=>({id:o.id,name:o.name}))),this.namespacesLoading.set(false);},error:()=>this.namespacesLoading.set(false)}):(this.form.controls.namespaceId.patchValue(this.namespaceId),this.namespacesLoading.set(false),this.namespaceController.getByIdNamespace(this.namespaceId).pipe(U(this.destroyRef)).subscribe({next:n=>this.namespaceName.set(n.name),error:()=>this.namespaceName.set(this.namespaceId)}));}submit(){if(this.form.invalid||this.state.isLoading())return;let{namespaceId:t,userId:n,toolName:o,payload:l}=this.form.getRawValue();this.state.invoke(t,n.trim()||void 0,o.trim(),l.trim()||void 0).pipe(U(this.destroyRef)).subscribe();}reset(){this.state.reset();}formatMetadata(t){return !t||Object.keys(t).length===0?null:JSON.stringify(t,null,2)}formatStructuredOutput(t){return t===void 0?null:JSON.stringify(t,null,2)}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=Nw({type:e,selectors:[["agentos-tool-invoke"]],decls:18,vars:8,consts:[["title","Tool invoke",3,"description"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Namespace","controlId","ti-namespace","required",""],["dsControl","","id","ti-namespace","type","text","readonly","",3,"value"],["label","User ID","labelHint","optional","controlId","ti-user"],["dsControl","","id","ti-user","type","text","formControlName","userId","placeholder","UUID of the user \u2014 adds user-scoped overlay layers","autocomplete","off"],["label","Tool name","controlId","ti-tool","required","","hint","Exact tool name as returned by the agent definition inspect page. When not found, the error response lists all available tools for the selected namespace."],["dsControl","","mono","","id","ti-tool","type","text","formControlName","toolName","placeholder","e.g. MY_FILES__listFiles","autocomplete","off","spellcheck","false"],["label","Payload","labelHint","optional","controlId","ti-payload"],["dsControl","","mono","","id","ti-payload","formControlName","payload","rows","6","placeholder",'JSON arguments for the tool, e.g. {"path": "/some/dir"} \u2014 leave empty for tools with no input.',"spellcheck","false"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button"],["heading","Error"],[3,"heading"],[1,"ds-hint"],["dsControl","","id","ti-namespace","formControlName","namespaceId"],["value","","disabled",""],[3,"value"],["dsButton","","type","button",3,"click"],[1,"ds-pre"],[3,"variant"],[1,"ds-micro"],["dsDefinitionList",""],[1,"ds-mono"]],template:function(n,o){if(n&1&&(Is(0,"ds-page"),hg(1,"ds-section-header",0),Is(2,"form",1),Eg("ngSubmit",function(){return o.submit()}),Is(3,"ds-form-field",2),Yw(4,ue,2,1)(5,fe,1,1,"input",3),ml(),Is(6,"ds-form-field",4),hg(7,"input",5),BI(),ml(),Is(8,"ds-form-field",6),hg(9,"input",7),BI(),ml(),Is(10,"ds-form-field",8),hg(11,"textarea",9),BI(),ml(),Is(12,"ds-form-actions")(13,"button",10),HC(14),ml(),Yw(15,ge,2,0,"button",11),ml()(),Yw(16,ve,3,1,"ds-card",12),Yw(17,he,14,7,"ds-card",13),ml()),n&2){let l,v;QE(),pg("description",o.isPlatformMode?"Execute any registered tool directly \u2014 bypasses the normal agent-run pipeline. Restricted to super-admins.":"Execute a registered tool directly in this namespace \u2014 bypasses the normal agent-run pipeline."),QE(),pg("formGroup",o.form),QE(2),Qw(o.isPlatformMode?4:5),QE(3),HI(),QE(2),HI(),QE(2),HI(),QE(2),pg("disabled",o.form.invalid||o.state.isLoading()),QE(),Il(" ",o.state.isLoading()?"Running\u2026":"Run tool"," "),QE(),Qw(o.state.result()||o.state.errorMessage()?15:-1),QE(),Qw((l=o.state.errorMessage())?16:-1,l),QE(),Qw((v=o.state.result())?17:-1,v);}},dependencies:[Kt,fd,Mo,Do,Ut,Qt,fo,go,Rn,Ea,vn,yn,fn,hn,dn,at,un,mn,Ao],encapsulation:2})};export{re as ToolInvokeComponent};
@@ -1 +1 @@
1
- import {g,aJ as fe,a6 as A}from'./main-OLEL3JTU.js';var c=class r{api=g(fe);getById(e){return this.api.getByIdScheduledPrompt(e)}listPlatform(){return this.api.searchScheduledPrompt({namespaceId:null,userId:null})}listByNamespace(e){return this.api.searchScheduledPrompt({namespaceId:e,userId:null})}search(e){return this.api.searchScheduledPrompt(e)}listEffective(e){return this.api.resolveEffectiveScheduledPrompt(e)}create(e){return this.api.createScheduledPrompt(e)}update(e,t){return this.api.updateScheduledPrompt(e,t)}enable(e){return this.api.enableScheduledPrompt(e)}disable(e){return this.api.disableScheduledPrompt(e)}delete(e){return this.api.deleteScheduledPrompt(e)}static \u0275fac=function(t){return new(t||r)};static \u0275prov=A({token:r,factory:r.\u0275fac,providedIn:"root"})};export{c};
1
+ import {g,aJ as fe,a6 as A}from'./main-2W2EKPFF.js';var c=class r{api=g(fe);getById(e){return this.api.getByIdScheduledPrompt(e)}listPlatform(){return this.api.searchScheduledPrompt({namespaceId:null,userId:null})}listByNamespace(e){return this.api.searchScheduledPrompt({namespaceId:e,userId:null})}search(e){return this.api.searchScheduledPrompt(e)}listEffective(e){return this.api.resolveEffectiveScheduledPrompt(e)}create(e){return this.api.createScheduledPrompt(e)}update(e,t){return this.api.updateScheduledPrompt(e,t)}enable(e){return this.api.enableScheduledPrompt(e)}disable(e){return this.api.disableScheduledPrompt(e)}delete(e){return this.api.deleteScheduledPrompt(e)}static \u0275fac=function(t){return new(t||r)};static \u0275prov=A({token:r,factory:r.\u0275fac,providedIn:"root"})};export{c};
@@ -0,0 +1,16 @@
1
+ var u=/highlight-(?:text|source)-([a-z0-9]+)/;function s(e){e.addRule("highlightedCodeBlock",{filter:function(t){var n=t.firstChild;return t.nodeName==="DIV"&&u.test(t.className)&&n&&n.nodeName==="PRE"},replacement:function(t,n,r){var i=n.className||"",l=(i.match(u)||[null,""])[1];return `
2
+
3
+ `+r.fence+l+`
4
+ `+n.firstChild.textContent+`
5
+ `+r.fence+`
6
+
7
+ `}});}function d(e){e.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(t){return "~"+t+"~"}});}var h=Array.prototype.indexOf,m=Array.prototype.every,a={};a.tableCell={filter:["th","td"],replacement:function(e,t){return f(e,t)}};a.tableRow={filter:"tr",replacement:function(e,t){var n="",r={left:":--",right:"--:",center:":-:"};if(o(t))for(var i=0;i<t.childNodes.length;i++){var l="---",c=(t.childNodes[i].getAttribute("align")||"").toLowerCase();c&&(l=r[c]||l),n+=f(l,t.childNodes[i]);}return `
8
+ `+e+(n?`
9
+ `+n:"")}};a.table={filter:function(e){return e.nodeName==="TABLE"&&o(e.rows[0])},replacement:function(e){return e=e.replace(`
10
+
11
+ `,`
12
+ `),`
13
+
14
+ `+e+`
15
+
16
+ `}};a.tableSection={filter:["thead","tbody","tfoot"],replacement:function(e){return e}};function o(e){var t=e.parentNode;return t.nodeName==="THEAD"||t.firstChild===e&&(t.nodeName==="TABLE"||p(t))&&m.call(e.childNodes,function(n){return n.nodeName==="TH"})}function p(e){var t=e.previousSibling;return e.nodeName==="TBODY"&&(!t||t.nodeName==="THEAD"&&/^\s*$/i.test(t.textContent))}function f(e,t){var n=h.call(t.parentNode.childNodes,t),r=" ";return n===0&&(r="| "),r+e+" |"}function N(e){e.keep(function(n){return n.nodeName==="TABLE"&&!o(n.rows[0])});for(var t in a)e.addRule(t,a[t]);}function g(e){e.addRule("taskListItems",{filter:function(t){return t.type==="checkbox"&&t.parentNode.nodeName==="LI"},replacement:function(t,n){return (n.checked?"[x]":"[ ]")+" "}});}function v(e){e.use([s,d,N,g]);}export{v as gfm,s as highlightedCodeBlock,d as strikethrough,N as tables,g as taskListItems};
@@ -1 +1 @@
1
- import {e}from'./chunk-C6dIhkYp.js';import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-DpaqV0I8.js';import {O}from'./chunk-DNO_UKkx.js';import {g,W as W$1,F,K as we,G as J,z as zi,U as U$1,ad as ne$1,a1 as ma,aa as _r,N as Nw,I as Is,R as Eg,m as ml,H as HC,Y as Yw,P as pg,Q as QE,b as Qw,p as dC,L as Lg,J as Jw,k as eC,o as Il,s as sC,i as fg,q as mf,r as yf}from'./main-OLEL3JTU.js';import {q as k,O as O$1,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-anaDHfEv.js';import'./chunk-C7Y0YglE.js';var Q=(n,e)=>e.key;function W(n,e){if(n&1&&(Is(0,"p",3),HC(1),ml()),n&2){let t=dC();QE(),Lg(t.deletion.error());}}function X(n,e){n&1&&(Is(0,"p",4),HC(1,"Loading integrations\u2026"),ml());}function Z(n,e){n&1&&(Is(0,"p",5),HC(1,"No integrations available."),ml());}function ee(n,e){n&1&&(Is(0,"p",4),HC(1,"No integrations match the current filter."),ml());}function te(n,e){n&1&&(Is(0,"ds-tag",20),HC(1,"YAML"),ml(),Is(2,"ds-tag",21),HC(3,"Read-only"),ml());}function ne(n,e){if(n&1){let t=sC();Is(0,"button",22),Eg("click",function(){mf(t);let s=dC().$implicit,c=dC(2);return yf(c.view(s))}),HC(1,"View"),ml();}if(n&2){let t=dC().$implicit;fg("aria-label","View "+t.config.name);}}function ie(n,e){if(n&1){let t=sC();Is(0,"button",22),Eg("click",function(){mf(t);let s=dC(3).$implicit,c=dC(2);return yf(c.edit(s))}),HC(1," Edit "),ml();}if(n&2){let t=dC(3).$implicit;fg("aria-label","Edit "+t.config.name);}}function oe(n,e){if(n&1){let t=sC();Is(0,"button",22),Eg("click",function(){mf(t);let s=dC(2).$implicit,c=dC(2);return yf(c.duplicate(s))}),HC(1," Duplicate "),ml(),Yw(2,ie,2,1,"button",19);}if(n&2){let t=dC(2).$implicit;fg("aria-label","Duplicate "+t.config.name),QE(2),Qw(t.canEdit?2:-1);}}function ae(n,e){if(n&1){let t=sC();Is(0,"agentos-row-delete-action",25),Eg("deleteRequested",function(){mf(t);let s=dC(2).$implicit,c=dC(2);return yf(c.deletion.request(s.key))})("deleteConfirmed",function(){mf(t);let s=dC(2).$implicit,c=dC(2);return yf(c.confirmDelete(s))})("deleteCancelled",function(){mf(t);let s=dC(4);return yf(s.deletion.cancel())}),ml();}if(n&2){let t=dC(2).$implicit,a=dC(2);pg("rowKey",t.key)("rowLabel",t.config.name)("state",a.deletion);}}function re(n,e){n&1&&(Is(0,"button",24),HC(1,"Inherited"),ml());}function le(n,e){if(n&1&&(Yw(0,oe,3,2),Yw(1,ae,1,3,"agentos-row-delete-action",23),Yw(2,re,2,0,"button",24)),n&2){let t=dC().$implicit,a=dC(2);Qw(a.deletion.confirmingId()!==t.key?0:-1),QE(),Qw(t.canDelete?1:-1),QE(),Qw(!t.canEdit&&!t.canDelete?2:-1);}}function se(n,e){if(n&1&&(Is(0,"tr",9)(1,"td",12),HC(2),ml(),Is(3,"td",13),HC(4),ml(),Is(5,"td",14)(6,"div",15)(7,"ds-tag",16),HC(8),ml(),Yw(9,te,4,0),ml()(),Is(10,"td",17)(11,"div",18),Yw(12,ne,2,1,"button",19)(13,le,3,3),ml()()()),n&2){let t=e.$implicit;QE(2),Lg(t.config.name),QE(2),Il(" ",t.config.integrationType," "),QE(3),pg("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),QE(),Il(" ",t.scopeLabel," "),QE(),Qw(t.source==="FILESYSTEM"?9:-1),QE(3),Qw(t.source==="FILESYSTEM"?12:13);}}function ce(n,e){if(n&1&&(Is(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),HC(5,"Name"),ml(),Is(6,"th",10),HC(7,"Type"),ml(),Is(8,"th",10),HC(9,"Scope"),ml(),Is(10,"th",10)(11,"span",11),HC(12,"Actions"),ml()()()(),Is(13,"tbody",8),Jw(14,se,14,6,"tr",9,Q),ml()()()),n&2){let t=dC();QE(14),eC(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=zi("this namespace");isAdmin=zi(false);isLoading=zi(true);rows=zi([]);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")??""),ma(e=>e?this.namespaceRole.isAdminOfNamespace$(e):_r(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=Nw({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&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(c){return a.rowFilter.query.set(c)}),ml(),Is(2,"button",2),Eg("click",function(){return a.openCreateForm()}),HC(3,"New integration"),ml()(),Yw(4,W,2,1,"p",3),Yw(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&&(pg("description","Integrations for "+a.namespaceName()+", including entries inherited from the platform."),QE(),pg("query",a.rowFilter.query()),QE(3),Qw(a.deletion.error()?4:-1),QE(),Qw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{U as IntegrationsAllScopesComponent};
1
+ import {e}from'./chunk-C6dIhkYp.js';import {n}from'./chunk-CfgXrte_.js';import {q as k,O as O$1,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-CV72_wbg.js';import {O}from'./chunk-DtO-loh9.js';import {v}from'./chunk-C-TFPDAn.js';import {g,W as W$1,F,K as we,G as J,z as zi,U as U$1,ad as ne$1,a1 as ma,aa as _r,N as Nw,I as Is,R as Eg,m as ml,H as HC,Y as Yw,P as pg,Q as QE,b as Qw,p as dC,L as Lg,J as Jw,k as eC,o as Il,s as sC,i as fg,q as mf,r as yf}from'./main-2W2EKPFF.js';import'./chunk-gOvITjLx.js';var Q=(n,e)=>e.key;function W(n,e){if(n&1&&(Is(0,"p",3),HC(1),ml()),n&2){let t=dC();QE(),Lg(t.deletion.error());}}function X(n,e){n&1&&(Is(0,"p",4),HC(1,"Loading integrations\u2026"),ml());}function Z(n,e){n&1&&(Is(0,"p",5),HC(1,"No integrations available."),ml());}function ee(n,e){n&1&&(Is(0,"p",4),HC(1,"No integrations match the current filter."),ml());}function te(n,e){n&1&&(Is(0,"ds-tag",20),HC(1,"YAML"),ml(),Is(2,"ds-tag",21),HC(3,"Read-only"),ml());}function ne(n,e){if(n&1){let t=sC();Is(0,"button",22),Eg("click",function(){mf(t);let s=dC().$implicit,c=dC(2);return yf(c.view(s))}),HC(1,"View"),ml();}if(n&2){let t=dC().$implicit;fg("aria-label","View "+t.config.name);}}function ie(n,e){if(n&1){let t=sC();Is(0,"button",22),Eg("click",function(){mf(t);let s=dC(3).$implicit,c=dC(2);return yf(c.edit(s))}),HC(1," Edit "),ml();}if(n&2){let t=dC(3).$implicit;fg("aria-label","Edit "+t.config.name);}}function oe(n,e){if(n&1){let t=sC();Is(0,"button",22),Eg("click",function(){mf(t);let s=dC(2).$implicit,c=dC(2);return yf(c.duplicate(s))}),HC(1," Duplicate "),ml(),Yw(2,ie,2,1,"button",19);}if(n&2){let t=dC(2).$implicit;fg("aria-label","Duplicate "+t.config.name),QE(2),Qw(t.canEdit?2:-1);}}function ae(n,e){if(n&1){let t=sC();Is(0,"agentos-row-delete-action",25),Eg("deleteRequested",function(){mf(t);let s=dC(2).$implicit,c=dC(2);return yf(c.deletion.request(s.key))})("deleteConfirmed",function(){mf(t);let s=dC(2).$implicit,c=dC(2);return yf(c.confirmDelete(s))})("deleteCancelled",function(){mf(t);let s=dC(4);return yf(s.deletion.cancel())}),ml();}if(n&2){let t=dC(2).$implicit,a=dC(2);pg("rowKey",t.key)("rowLabel",t.config.name)("state",a.deletion);}}function re(n,e){n&1&&(Is(0,"button",24),HC(1,"Inherited"),ml());}function le(n,e){if(n&1&&(Yw(0,oe,3,2),Yw(1,ae,1,3,"agentos-row-delete-action",23),Yw(2,re,2,0,"button",24)),n&2){let t=dC().$implicit,a=dC(2);Qw(a.deletion.confirmingId()!==t.key?0:-1),QE(),Qw(t.canDelete?1:-1),QE(),Qw(!t.canEdit&&!t.canDelete?2:-1);}}function se(n,e){if(n&1&&(Is(0,"tr",9)(1,"td",12),HC(2),ml(),Is(3,"td",13),HC(4),ml(),Is(5,"td",14)(6,"div",15)(7,"ds-tag",16),HC(8),ml(),Yw(9,te,4,0),ml()(),Is(10,"td",17)(11,"div",18),Yw(12,ne,2,1,"button",19)(13,le,3,3),ml()()()),n&2){let t=e.$implicit;QE(2),Lg(t.config.name),QE(2),Il(" ",t.config.integrationType," "),QE(3),pg("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),QE(),Il(" ",t.scopeLabel," "),QE(),Qw(t.source==="FILESYSTEM"?9:-1),QE(3),Qw(t.source==="FILESYSTEM"?12:13);}}function ce(n,e){if(n&1&&(Is(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),HC(5,"Name"),ml(),Is(6,"th",10),HC(7,"Type"),ml(),Is(8,"th",10),HC(9,"Scope"),ml(),Is(10,"th",10)(11,"span",11),HC(12,"Actions"),ml()()()(),Is(13,"tbody",8),Jw(14,se,14,6,"tr",9,Q),ml()()()),n&2){let t=dC();QE(14),eC(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=zi("this namespace");isAdmin=zi(false);isLoading=zi(true);rows=zi([]);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")??""),ma(e=>e?this.namespaceRole.isAdminOfNamespace$(e):_r(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=Nw({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&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(c){return a.rowFilter.query.set(c)}),ml(),Is(2,"button",2),Eg("click",function(){return a.openCreateForm()}),HC(3,"New integration"),ml()(),Yw(4,W,2,1,"p",3),Yw(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&&(pg("description","Integrations for "+a.namespaceName()+", including entries inherited from the platform."),QE(),pg("query",a.rowFilter.query()),QE(3),Qw(a.deletion.error()?4:-1),QE(),Qw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{U as IntegrationsAllScopesComponent};
@@ -1 +1 @@
1
- import {y}from'./chunk-anaDHfEv.js';import {g,aB as ie,aC as T,aa as _r,a1 as ma,ad as ne,a2 as ga,aD as Jy,a6 as A}from'./main-OLEL3JTU.js';var v=class i{userState=g(y);membership=g(ie);currentUser$=T(this.userState.currentUser);cache=new Map;isAdminOfNamespace$(e){if(!e)return _r(false);let t=this.cache.get(e);if(t)return t;let s=this.currentUser$.pipe(ma(a=>a?a.isAdmin?_r(true):this.membership.getMembersNamespaceMembership(e).pipe(ne(d=>d.some(n=>n.id===a.id&&n.role==="ADMIN")),ga(()=>_r(false))):_r(false)),Jy({bufferSize:1,refCount:false}));return this.cache.set(e,s),s}static \u0275fac=function(t){return new(t||i)};static \u0275prov=A({token:i,factory:i.\u0275fac,providedIn:"root"})};export{v};
1
+ import {y}from'./chunk-CV72_wbg.js';import {g,aH as ie,aI as T,aa as _r,a1 as ma,ad as ne,a2 as ga,aC as Jy,a6 as A}from'./main-2W2EKPFF.js';var v=class i{userState=g(y);membership=g(ie);currentUser$=T(this.userState.currentUser);cache=new Map;isAdminOfNamespace$(e){if(!e)return _r(false);let t=this.cache.get(e);if(t)return t;let s=this.currentUser$.pipe(ma(a=>a?a.isAdmin?_r(true):this.membership.getMembersNamespaceMembership(e).pipe(ne(d=>d.some(n=>n.id===a.id&&n.role==="ADMIN")),ga(()=>_r(false))):_r(false)),Jy({bufferSize:1,refCount:false}));return this.cache.set(e,s),s}static \u0275fac=function(t){return new(t||i)};static \u0275prov=A({token:i,factory:i.\u0275fac,providedIn:"root"})};export{v};
@@ -1 +1 @@
1
- import {s}from'./chunk-anaDHfEv.js';import {g,W,D as ry,E as y,N as Nw,y as yl,H as HC,v as vl,Q as QE,L as Lg}from'./main-OLEL3JTU.js';var A=class r{route=g(W);http=g(ry);config=g(y);message="Authentication in progress\u2026";ngOnInit(){let e=this.route.snapshot.queryParamMap.get("code"),t=this.route.snapshot.queryParamMap.get("state"),o=this.route.snapshot.queryParamMap.get("error"),i=this.route.snapshot.queryParamMap.get("error_description");if(o){console.warn("[AgentOS OAuth Callback] OAuth error:",o,i),this.notifyParentAndClose({success:false,error:i||o});return}if(!e){console.error("[AgentOS OAuth Callback] Missing authorization code"),this.message="OAuth callback error: missing authorization code.",this.notifyParentAndClose({success:false,error:"Missing authorization code"});return}this.http.post(`${this.config.basePath}/api/oauth/callback`,{code:e,state:t}).subscribe({next:()=>{console.log("[AgentOS OAuth Callback] Backend callback resolved"),this.notifyParentAndClose({success:true});},error:a=>{console.error("[AgentOS OAuth Callback] Backend callback failed:",a),this.notifyParentAndClose({success:false,error:a?.error?.message||a?.message||"Token exchange failed"});}});}notifyParentAndClose(e){if(this.message=e.success?"Authentication complete. You can close this window.":`Authentication failed: ${e.error??"unknown error"}. You can close this window.`,window.opener)try{window.opener.postMessage(e,window.location.origin);}catch(t){console.error("[AgentOS OAuth Callback] postMessage failed:",t),localStorage.setItem(s,JSON.stringify(e));}else console.warn("[AgentOS OAuth Callback] No window.opener \u2014 localStorage fallback"),localStorage.setItem(s,JSON.stringify(e));setTimeout(()=>window.close(),1e3);}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=Nw({type:r,selectors:[["agentos-oauth-callback"]],decls:2,vars:1,consts:[[2,"font-family","sans-serif","padding","2rem","text-align","center"]],template:function(t,o){t&1&&(yl(0,"p",0),HC(1),vl()),t&2&&(QE(),Lg(o.message));},encapsulation:2,changeDetection:1})};export{A as OAuthCallbackComponent};
1
+ import {s}from'./chunk-CV72_wbg.js';import {g,W,D as ry,E as y,N as Nw,y as yl,H as HC,v as vl,Q as QE,L as Lg}from'./main-2W2EKPFF.js';var A=class r{route=g(W);http=g(ry);config=g(y);message="Authentication in progress\u2026";ngOnInit(){let e=this.route.snapshot.queryParamMap.get("code"),t=this.route.snapshot.queryParamMap.get("state"),o=this.route.snapshot.queryParamMap.get("error"),i=this.route.snapshot.queryParamMap.get("error_description");if(o){console.warn("[AgentOS OAuth Callback] OAuth error:",o,i),this.notifyParentAndClose({success:false,error:i||o});return}if(!e){console.error("[AgentOS OAuth Callback] Missing authorization code"),this.message="OAuth callback error: missing authorization code.",this.notifyParentAndClose({success:false,error:"Missing authorization code"});return}this.http.post(`${this.config.basePath}/api/oauth/callback`,{code:e,state:t}).subscribe({next:()=>{console.log("[AgentOS OAuth Callback] Backend callback resolved"),this.notifyParentAndClose({success:true});},error:a=>{console.error("[AgentOS OAuth Callback] Backend callback failed:",a),this.notifyParentAndClose({success:false,error:a?.error?.message||a?.message||"Token exchange failed"});}});}notifyParentAndClose(e){if(this.message=e.success?"Authentication complete. You can close this window.":`Authentication failed: ${e.error??"unknown error"}. You can close this window.`,window.opener)try{window.opener.postMessage(e,window.location.origin);}catch(t){console.error("[AgentOS OAuth Callback] postMessage failed:",t),localStorage.setItem(s,JSON.stringify(e));}else console.warn("[AgentOS OAuth Callback] No window.opener \u2014 localStorage fallback"),localStorage.setItem(s,JSON.stringify(e));setTimeout(()=>window.close(),1e3);}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=Nw({type:r,selectors:[["agentos-oauth-callback"]],decls:2,vars:1,consts:[[2,"font-family","sans-serif","padding","2rem","text-align","center"]],template:function(t,o){t&1&&(yl(0,"p",0),HC(1),vl()),t&2&&(QE(),Lg(o.message));},encapsulation:2,changeDetection:1})};export{A as OAuthCallbackComponent};
@@ -1 +1 @@
1
- import {i}from'./chunk-C7Y0YglE.js';import {y}from'./chunk-anaDHfEv.js';import {g as g$1,ap as k,$ as Sr,at as _y,a1 as ma,a2 as ga,aa as _r,ad as ne,aD as Jy,a5 as Ed,M as w,a6 as A}from'./main-OLEL3JTU.js';var g="none",N="me",O=class p{nsController=g$1(k);userState=g$1(y);refresh$=new Sr(void 0);namespaceId$=new Sr(null);vm$=_y([this.namespaceId$,this.refresh$]).pipe(ma(([e])=>{let r=this.loadPlatformProviders().pipe(ga(()=>_r([])));return e?_y([r,this.loadNamespaceProviders(e).pipe(ga(()=>_r([]))),this.loadUserProviders(e).pipe(ga(()=>_r([]))),this.loadUserProviders("global").pipe(ga(()=>_r([])))]).pipe(ne(([i,n,s,t])=>({platform:i,namespace:n,userOnNs:s,userGlobal:t}))):_y([r,this.loadNamespaceProviders("").pipe(ga(()=>_r([]))),this.loadUserProviders("global").pipe(ga(()=>_r([])))]).pipe(ne(([i,n,s])=>({platform:i,namespace:n,userOnNs:[],userGlobal:s})))}),Jy({bufferSize:1,refCount:true}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e);}refresh(){this.refresh$.next();}loadUserProviders(e){let r=e==="global"?g:e;return this.nsController.listAiProvider(r,N)}userGlobal$=i(this.refresh$,()=>this.loadUserProviders("global"),[]);loadPlatformProviders(){return this.nsController.listAiProvider(g)}loadNamespaceProviders(e){return e?this.nsController.listAiProvider(e):_r([])}getById(e,r){return this.nsController.getByIdAiProvider(e)}create(e,r,i){let s=this.userState.currentUser()?.id;if((r==="userOnNs"||r==="userGlobal")&&!s)throw new Error(`Cannot create ${r} provider before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(r==="namespace"){if(i===void 0||i==="")throw new Error("Cannot create namespace-scoped provider without a namespaceId");let S={name:e.name,apiType:e.apiType,description:e.description,baseUrl:e.baseUrl,apiKey:e.apiKey,headers:e.headers??void 0,namespaceId:i??void 0};return this.nsController.createAiProvider(S).pipe(Ed(()=>this.refresh()))}if(r==="userOnNs"&&!i)throw new Error("Cannot create userOnNs provider without a namespaceId");let t={name:e.name,apiType:e.apiType,description:e.description,baseUrl:e.baseUrl,apiKey:e.apiKey,headers:e.headers??void 0,userId:s,namespaceId:r==="userOnNs"?i:void 0};return this.nsController.createAiProvider(t).pipe(Ed(()=>this.refresh()))}update(e,r,i,n){let s=r.apiKey===null?{}:{apiKey:r.apiKey},t=w({name:r.name,apiType:r.apiType,description:r.description,baseUrl:r.baseUrl,headers:r.headers??void 0,namespaceId:n.namespaceId,userId:n.userId},s);return this.nsController.updateAiProvider(e,t).pipe(Ed(()=>this.refresh()))}delete(e,r){return this.nsController.deleteAiProvider(e).pipe(Ed(()=>this.refresh()))}static \u0275fac=function(r){return new(r||p)};static \u0275prov=A({token:p,factory:p.\u0275fac,providedIn:"root"})};export{O};
1
+ import {i}from'./chunk-gOvITjLx.js';import {y}from'./chunk-CV72_wbg.js';import {g as g$1,ap as k,$ as Sr,at as _y,a1 as ma,a2 as ga,aa as _r,ad as ne,aC as Jy,a5 as Ed,M as w,a6 as A}from'./main-2W2EKPFF.js';var g="none",N="me",O=class p{nsController=g$1(k);userState=g$1(y);refresh$=new Sr(void 0);namespaceId$=new Sr(null);vm$=_y([this.namespaceId$,this.refresh$]).pipe(ma(([e])=>{let r=this.loadPlatformProviders().pipe(ga(()=>_r([])));return e?_y([r,this.loadNamespaceProviders(e).pipe(ga(()=>_r([]))),this.loadUserProviders(e).pipe(ga(()=>_r([]))),this.loadUserProviders("global").pipe(ga(()=>_r([])))]).pipe(ne(([i,n,s,t])=>({platform:i,namespace:n,userOnNs:s,userGlobal:t}))):_y([r,this.loadNamespaceProviders("").pipe(ga(()=>_r([]))),this.loadUserProviders("global").pipe(ga(()=>_r([])))]).pipe(ne(([i,n,s])=>({platform:i,namespace:n,userOnNs:[],userGlobal:s})))}),Jy({bufferSize:1,refCount:true}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e);}refresh(){this.refresh$.next();}loadUserProviders(e){let r=e==="global"?g:e;return this.nsController.listAiProvider(r,N)}userGlobal$=i(this.refresh$,()=>this.loadUserProviders("global"),[]);loadPlatformProviders(){return this.nsController.listAiProvider(g)}loadNamespaceProviders(e){return e?this.nsController.listAiProvider(e):_r([])}getById(e,r){return this.nsController.getByIdAiProvider(e)}create(e,r,i){let s=this.userState.currentUser()?.id;if((r==="userOnNs"||r==="userGlobal")&&!s)throw new Error(`Cannot create ${r} provider before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(r==="namespace"){if(i===void 0||i==="")throw new Error("Cannot create namespace-scoped provider without a namespaceId");let S={name:e.name,apiType:e.apiType,description:e.description,baseUrl:e.baseUrl,apiKey:e.apiKey,headers:e.headers??void 0,namespaceId:i??void 0};return this.nsController.createAiProvider(S).pipe(Ed(()=>this.refresh()))}if(r==="userOnNs"&&!i)throw new Error("Cannot create userOnNs provider without a namespaceId");let t={name:e.name,apiType:e.apiType,description:e.description,baseUrl:e.baseUrl,apiKey:e.apiKey,headers:e.headers??void 0,userId:s,namespaceId:r==="userOnNs"?i:void 0};return this.nsController.createAiProvider(t).pipe(Ed(()=>this.refresh()))}update(e,r,i,n){let s=r.apiKey===null?{}:{apiKey:r.apiKey},t=w({name:r.name,apiType:r.apiType,description:r.description,baseUrl:r.baseUrl,headers:r.headers??void 0,namespaceId:n.namespaceId,userId:n.userId},s);return this.nsController.updateAiProvider(e,t).pipe(Ed(()=>this.refresh()))}delete(e,r){return this.nsController.deleteAiProvider(e).pipe(Ed(()=>this.refresh()))}static \u0275fac=function(r){return new(r||p)};static \u0275prov=A({token:p,factory:p.\u0275fac,providedIn:"root"})};export{O};
@@ -1 +1 @@
1
- import {I as I$1}from'./chunk-Ca-YJxkj.js';import {g,F,K as we,$ as Sr,z as zi,a1 as ma,U as U$1,N as Nw,I as Is,R as Eg,m as ml,H as HC,Y as Yw,Q as QE,P as pg,b as Qw,p as dC,L as Lg,J as Jw,k as eC,o as Il,s as sC,i as fg,q as mf,r as yf}from'./main-OLEL3JTU.js';import {q as k,O as O$1,i as at,d as yn,V as Vo,j as P,r as P$1}from'./chunk-anaDHfEv.js';import'./chunk-C7Y0YglE.js';var B=(e,t)=>t.id??t.name;function j(e,t){if(e&1&&(Is(0,"p",3),HC(1),ml()),e&2){let n=dC();QE(),Lg(n.deletion.error());}}function K(e,t){e&1&&(Is(0,"p",4),HC(1,"Loading auth settings\u2026"),ml());}function H(e,t){e&1&&(Is(0,"p",5),HC(1,"No platform auth settings defined yet."),ml());}function U(e,t){e&1&&(Is(0,"p",4),HC(1,"No auth settings match the current filter."),ml());}function z(e,t){if(e&1){let n=sC();Is(0,"button",18),Eg("click",function(){mf(n);let d=dC().$implicit,m=dC(2);return yf(m.onEdit(d))}),HC(1," Edit "),ml();}if(e&2){let n=dC().$implicit;fg("aria-label","Edit "+n.name);}}function G(e,t){if(e&1){let n=sC();Is(0,"agentos-row-delete-action",19),Eg("deleteRequested",function(){mf(n);let d=dC().$implicit,m=dC(2);return yf(m.deletion.request(d.id))})("deleteConfirmed",function(){mf(n);let d=dC().$implicit,m=dC(2);return yf(m.onDelete(d))})("deleteCancelled",function(){mf(n);let d=dC(3);return yf(d.deletion.cancel())}),ml();}if(e&2){let n=dC().$implicit,a=dC(2);pg("rowKey",n.id)("rowLabel",n.name)("state",a.deletion);}}function J(e,t){if(e&1&&(Is(0,"tr",9)(1,"td",12),HC(2),ml(),Is(3,"td",13),HC(4),ml(),Is(5,"td",14)(6,"div",15),Yw(7,z,2,1,"button",16),Yw(8,G,1,3,"agentos-row-delete-action",17),ml()()()),e&2){let n=t.$implicit,a=dC(2);QE(2),Lg(n.name),QE(2),Il(" ",n.authType," "),QE(3),Qw(a.deletion.confirmingId()!==n.id?7:-1),QE(),Qw(n.id?8:-1);}}function O(e,t){if(e&1&&(Is(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),HC(5,"Name"),ml(),Is(6,"th",10),HC(7,"Authentication type"),ml(),Is(8,"th",10)(9,"span",11),HC(10,"Actions"),ml()()()(),Is(11,"tbody",8),Jw(12,J,9,4,"tr",9,B),ml()()()),e&2){let n=dC();QE(12),eC(n.rowFilter.filteredRows());}}var I=class e{router=g(F);destroyRef=g(we);state=g(I$1);refresh$=new Sr(void 0);isLoading=zi(true);deletion=k();settings=zi([]);rowFilter=O$1(this.settings,t=>[t.name,t.authType].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ma(()=>(this.isLoading.set(true),this.state.loadPlatformSettings())),U$1(this.destroyRef)).subscribe({next:t=>{this.settings.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","auth-settings","new"]);}onEdit(t){t.id&&this.router.navigate(["/agentos","admin","auth-settings",t.id,"edit"]);}onDelete(t){t.id&&this.deletion.execute(t.id,{request$:this.state.delete(t.id,"platform").pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${t.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=Nw({type:e,selectors:[["agentos-platform-auth-settings"]],decls:9,vars:3,consts:[["title","Platform auth settings","description","Authentication settings shared across every namespace."],["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"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform 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","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(n,a){n&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(m){return a.rowFilter.query.set(m)}),ml(),Is(2,"button",2),Eg("click",function(){return a.openCreateForm()}),HC(3,"New auth setting"),ml()(),Yw(4,j,2,1,"p",3),Yw(5,K,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,O,14,0,"div",6)),n&2&&(QE(),pg("query",a.rowFilter.query()),QE(3),Qw(a.deletion.error()?4:-1),QE(),Qw(a.isLoading()?5:a.settings().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,P,P$1],encapsulation:2})};export{I as PlatformAuthSettingsComponent};
1
+ import {q as k,O as O$1,i as at,d as yn,V as Vo,j as P,r as P$1}from'./chunk-CV72_wbg.js';import {I as I$1}from'./chunk-DEd4dYEy.js';import {g,F,K as we,$ as Sr,z as zi,a1 as ma,U as U$1,N as Nw,I as Is,R as Eg,m as ml,H as HC,Y as Yw,Q as QE,P as pg,b as Qw,p as dC,L as Lg,J as Jw,k as eC,o as Il,s as sC,i as fg,q as mf,r as yf}from'./main-2W2EKPFF.js';import'./chunk-gOvITjLx.js';var B=(e,t)=>t.id??t.name;function j(e,t){if(e&1&&(Is(0,"p",3),HC(1),ml()),e&2){let n=dC();QE(),Lg(n.deletion.error());}}function K(e,t){e&1&&(Is(0,"p",4),HC(1,"Loading auth settings\u2026"),ml());}function H(e,t){e&1&&(Is(0,"p",5),HC(1,"No platform auth settings defined yet."),ml());}function U(e,t){e&1&&(Is(0,"p",4),HC(1,"No auth settings match the current filter."),ml());}function z(e,t){if(e&1){let n=sC();Is(0,"button",18),Eg("click",function(){mf(n);let d=dC().$implicit,m=dC(2);return yf(m.onEdit(d))}),HC(1," Edit "),ml();}if(e&2){let n=dC().$implicit;fg("aria-label","Edit "+n.name);}}function G(e,t){if(e&1){let n=sC();Is(0,"agentos-row-delete-action",19),Eg("deleteRequested",function(){mf(n);let d=dC().$implicit,m=dC(2);return yf(m.deletion.request(d.id))})("deleteConfirmed",function(){mf(n);let d=dC().$implicit,m=dC(2);return yf(m.onDelete(d))})("deleteCancelled",function(){mf(n);let d=dC(3);return yf(d.deletion.cancel())}),ml();}if(e&2){let n=dC().$implicit,a=dC(2);pg("rowKey",n.id)("rowLabel",n.name)("state",a.deletion);}}function J(e,t){if(e&1&&(Is(0,"tr",9)(1,"td",12),HC(2),ml(),Is(3,"td",13),HC(4),ml(),Is(5,"td",14)(6,"div",15),Yw(7,z,2,1,"button",16),Yw(8,G,1,3,"agentos-row-delete-action",17),ml()()()),e&2){let n=t.$implicit,a=dC(2);QE(2),Lg(n.name),QE(2),Il(" ",n.authType," "),QE(3),Qw(a.deletion.confirmingId()!==n.id?7:-1),QE(),Qw(n.id?8:-1);}}function O(e,t){if(e&1&&(Is(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),HC(5,"Name"),ml(),Is(6,"th",10),HC(7,"Authentication type"),ml(),Is(8,"th",10)(9,"span",11),HC(10,"Actions"),ml()()()(),Is(11,"tbody",8),Jw(12,J,9,4,"tr",9,B),ml()()()),e&2){let n=dC();QE(12),eC(n.rowFilter.filteredRows());}}var I=class e{router=g(F);destroyRef=g(we);state=g(I$1);refresh$=new Sr(void 0);isLoading=zi(true);deletion=k();settings=zi([]);rowFilter=O$1(this.settings,t=>[t.name,t.authType].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ma(()=>(this.isLoading.set(true),this.state.loadPlatformSettings())),U$1(this.destroyRef)).subscribe({next:t=>{this.settings.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","auth-settings","new"]);}onEdit(t){t.id&&this.router.navigate(["/agentos","admin","auth-settings",t.id,"edit"]);}onDelete(t){t.id&&this.deletion.execute(t.id,{request$:this.state.delete(t.id,"platform").pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${t.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=Nw({type:e,selectors:[["agentos-platform-auth-settings"]],decls:9,vars:3,consts:[["title","Platform auth settings","description","Authentication settings shared across every namespace."],["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"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform 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","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(n,a){n&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(m){return a.rowFilter.query.set(m)}),ml(),Is(2,"button",2),Eg("click",function(){return a.openCreateForm()}),HC(3,"New auth setting"),ml()(),Yw(4,j,2,1,"p",3),Yw(5,K,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,O,14,0,"div",6)),n&2&&(QE(),pg("query",a.rowFilter.query()),QE(3),Qw(a.deletion.error()?4:-1),QE(),Qw(a.isLoading()?5:a.settings().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,P,P$1],encapsulation:2})};export{I as PlatformAuthSettingsComponent};
@@ -1 +1 @@
1
- import {O}from'./chunk-D-9iMQv_.js';import {v}from'./chunk-DpaqV0I8.js';import {g,W,F,K as we,z as zi,a9 as F$1,an as $e,n as Ff,U,N as Nw,I as Is,R as Eg,H as HC,m as ml,Y as Yw,Q as QE,P as pg,b as Qw,s as sC,J as Jw,ao as Xw,S as BI,a as hg,am as Kw,p as dC,T as HI,k as eC,o as Il,ae as qw,L as Lg,q as mf,r as yf}from'./main-OLEL3JTU.js';import {p as pt,W as Wt,T as Te,b as bn,v as vn,d as yn,e as fn,l as pn,h as hn,i as at,u as un,n as cn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,Q as Qt,C as Ca,c as fo,g as go,N as Nn,R as Rn,E as Ea,x as yo,z as bo}from'./chunk-anaDHfEv.js';import'./chunk-C7Y0YglE.js';function ge(o,t){o&1&&(Is(0,"p",2),HC(1,"Loading\u2026"),ml());}function be(o,t){if(o&1&&(Is(0,"label",23),hg(1,"input",24),BI(),HC(2),ml()),o&2){let e=t.$implicit,r=dC(3);QE(),pg("formControl",r.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!r.isAdmin()),HI(),QE(),Il(" ",e.label," ");}}function _e(o,t){if(o&1&&(Is(0,"ds-fieldset",5),Jw(1,be,3,4,"label",23,qw().trackByScope,true),ml()),o&2){let e=dC(2);pg("disabled",e.isEditMode()),QE(),eC(e.scopeOptions);}}function Ae(o,t){if(o&1&&(Is(0,"option",8),HC(1),ml()),o&2){let e=t.$implicit;pg("value",e),QE(),Lg(e);}}function Se(o,t){if(o&1){let e=sC();Is(0,"div",19),hg(1,"input",25),BI(),hg(2,"input",26),BI(),Is(3,"button",27),Eg("click",function(){let l=mf(e).$index,f=dC(2);return yf(f.removeHeader(l))}),HC(4," \xD7 "),ml()();}if(o&2){let e=t.$index;pg("formGroupName",e),QE(),HI(),QE(),HI();}}function Pe(o,t){if(o&1){let e=sC();Is(0,"form",4),Eg("ngSubmit",function(){mf(e);let l=dC();return yf(l.submit())}),Yw(1,_e,3,1,"ds-fieldset",5),Is(2,"ds-form-field",6)(3,"select",7),Jw(4,Ae,2,2,"option",8,Xw),ml(),BI(),ml(),Is(6,"ds-form-field",9),hg(7,"input",10),BI(),ml(),Is(8,"ds-form-field",11),hg(9,"input",12),BI(),ml(),Is(10,"ds-form-field",13),hg(11,"input",14),BI(),ml(),Is(12,"ds-form-field",15),hg(13,"input",16),BI(),ml(),Is(14,"ds-form-field",17)(15,"div",18),Jw(16,Se,5,1,"div",19,Kw),Is(18,"div")(19,"button",20),Eg("click",function(){mf(e);let l=dC();return yf(l.addHeader())}),HC(20,"+ Add header"),ml()()()(),Is(21,"ds-form-actions")(22,"button",21),HC(23),ml(),Is(24,"button",22),Eg("click",function(){mf(e);let l=dC();return yf(l.cancel())}),HC(25,"Cancel"),ml()()();}if(o&2){let e=dC();pg("formGroup",e.form),QE(),Qw(e.isPlatformMode?-1:1),QE(2),pg("formControl",e.apiTypeControl),HI(),QE(),eC(e.apiTypeOptions),QE(3),pg("formControl",e.nameControl),HI(),QE(2),pg("formControl",e.descriptionControl),HI(),QE(2),pg("formControl",e.baseUrlControl),HI(),QE(2),pg("formControl",e.apiKeyControl),HI(),QE(2),pg("formArrayName","headers"),QE(),eC(e.headersArray.controls),QE(6),pg("disabled",e.form.invalid||e.isSubmitting()),QE(),Il(" ",e.isEditMode()?"Save changes":"Create"," ");}}var xe=new Set(["namespace","userOnNs","userGlobal"]),E=Object.freeze({platform:"Configuration de niveau plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ye=class o{route=g(W);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?zi(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});apiTypeOptions=Object.values($e);scopeOptions=[{value:"namespace",label:E.namespace},{value:"userOnNs",label:E.userOnNs},{value:"userGlobal",label:E.userGlobal}];form=new pt({name:new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te(null),apiType:new Te("OpenAI",{nonNullable:true,validators:[bn.required]}),baseUrl:new Te("",{nonNullable:true}),apiKey:new Te("",{nonNullable:true}),scope:new Te("namespace",{nonNullable:true}),headers:new Wt([],{validators:[]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get apiTypeControl(){return this.form.controls.apiType}get baseUrlControl(){return this.form.controls.baseUrl}get apiKeyControl(){return this.form.controls.apiKey}get scopeControl(){return this.form.controls.scope}get headersArray(){return this.form.controls.headers}addHeader(){this.headersArray.push(new pt({key:new Te("",{nonNullable:true,validators:[bn.required]}),value:new Te("",{nonNullable:true})}));}removeHeader(t){this.headersArray.removeAt(t);}isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);existingConfig=null;initialApiKey="";constructor(){this.isPlatformMode||Ff(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,r=t.get("aiProviderId"),l=this.isPlatformMode?"namespace":this.parseScope(e.get("scope"));if(r){this.isEditMode.set(true),this.scopeControl.disable(),this.apiTypeControl.disable(),this.loadConfig(r);return}this.scopeControl.setValue(l);let f=e.get("template");f&&this.hydrateFromTemplate(f);}parseScope(t){return t&&xe.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId?"namespace":t.namespaceId?"userOnNs":"userGlobal"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AiProviderForm] Could not load provider '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.apiTypeControl.setValue(e.apiType),this.baseUrlControl.setValue(e.baseUrl??""),this.apiKeyControl.setValue(""),this.initialApiKey="",this.apiKeyControl.markAsTouched(),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AiProviderForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.apiTypeControl.setValue(t.apiType),this.baseUrlControl.setValue(t.baseUrl??"");let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialApiKey=e,this.headersArray.clear();for(let[r,l]of Object.entries(t.headers??{}))this.headersArray.push(new pt({key:new Te(r,{nonNullable:true,validators:[bn.required]}),value:new Te(l,{nonNullable:true})}));}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.descriptionControl.value?.trim(),e=this.baseUrlControl.value.trim(),r=this.apiKeyControl.value,l=this.isEditMode()&&r===this.initialApiKey?null:r,f=this.headersArray.controls.filter(A=>A.controls.key.value.trim()).map(A=>[A.controls.key.value.trim(),A.controls.value.value]),Ce=f.length>0?Object.fromEntries(f):null,V={name:this.nameControl.value.trim(),apiType:this.apiTypeControl.value,description:t||null,baseUrl:e||null,apiKey:l,headers:Ce},w=this.form.getRawValue().scope,he=this.isPlatformMode?null:this.namespaceId??null;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,V,w,this.existingConfig):this.state.create(V,w,he)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-providers"]):this.router.navigate(["/agentos",this.namespaceId,"ai-providers"]);}trackByScope(t,e){return e.value}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=Nw({type:o,selectors:[["agentos-ai-provider-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to AI providers",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Configuration scope",3,"disabled"],["label","API type","controlId","llm-api-type","required",""],["dsControl","","id","llm-api-type",3,"formControl"],[3,"value"],["label","Name","controlId","llm-name","required",""],["dsControl","","id","llm-name","type","text","placeholder","e.g. OpenAI prod","autocomplete","off",3,"formControl"],["label","Description","controlId","llm-description"],["dsControl","","id","llm-description","type","text","placeholder","Optional \u2014 short description of this provider","autocomplete","off",3,"formControl"],["label","Base URL","controlId","llm-base-url"],["dsControl","","id","llm-base-url","type","url","placeholder","Optional \u2014 leave empty for default endpoint","autocomplete","off",3,"formControl"],["label","API key","controlId","llm-api-key"],["dsControl","","id","llm-api-key","type","password","placeholder","sk-\u2026","autocomplete","new-password",3,"formControl"],["label","Custom headers"],[1,"ds-stack","ds-stack--sm",3,"formArrayName"],[1,"ds-inline",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsCheck",""],["type","radio",3,"formControl","value","disabled"],["dsControl","","type","text","placeholder","Header name","formControlName","key","autocomplete","off"],["dsControl","","type","text","placeholder","Value","formControlName","value","autocomplete","off"],["dsButton","","variant","icon-danger","type","button","title","Remove header","aria-label","Remove header",3,"click"]],template:function(e,r){e&1&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return r.cancel()}),HC(3," \u2190 AI providers "),ml()(),Yw(4,ge,2,0,"p",2)(5,Pe,26,10,"form",3),ml()),e&2&&(QE(),pg("title",r.isEditMode()?"Edit AI provider":"New AI provider"),QE(3),Qw(r.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,at,un,cn,Kt,fd,Mo,Do,Ut,Qt,Ca,fo,go,Nn,Rn,Ea,yo,bo],encapsulation:2})};export{ye as AiProviderFormComponent};
1
+ import {O}from'./chunk-C8kRHbPY.js';import {v}from'./chunk-C-TFPDAn.js';import {g,W,F,K as we,z as zi,a9 as F$1,an as $e,n as Ff,U,N as Nw,I as Is,R as Eg,H as HC,m as ml,Y as Yw,Q as QE,P as pg,b as Qw,s as sC,J as Jw,ao as Xw,S as BI,a as hg,am as Kw,p as dC,T as HI,k as eC,o as Il,ae as qw,L as Lg,q as mf,r as yf}from'./main-2W2EKPFF.js';import {p as pt,W as Wt,T as Te,b as bn,v as vn,d as yn,e as fn,l as pn,h as hn,i as at,u as un,n as cn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,Q as Qt,C as Ca,c as fo,g as go,N as Nn,R as Rn,E as Ea,x as yo,z as bo}from'./chunk-CV72_wbg.js';import'./chunk-gOvITjLx.js';function ge(o,t){o&1&&(Is(0,"p",2),HC(1,"Loading\u2026"),ml());}function be(o,t){if(o&1&&(Is(0,"label",23),hg(1,"input",24),BI(),HC(2),ml()),o&2){let e=t.$implicit,r=dC(3);QE(),pg("formControl",r.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!r.isAdmin()),HI(),QE(),Il(" ",e.label," ");}}function _e(o,t){if(o&1&&(Is(0,"ds-fieldset",5),Jw(1,be,3,4,"label",23,qw().trackByScope,true),ml()),o&2){let e=dC(2);pg("disabled",e.isEditMode()),QE(),eC(e.scopeOptions);}}function Ae(o,t){if(o&1&&(Is(0,"option",8),HC(1),ml()),o&2){let e=t.$implicit;pg("value",e),QE(),Lg(e);}}function Se(o,t){if(o&1){let e=sC();Is(0,"div",19),hg(1,"input",25),BI(),hg(2,"input",26),BI(),Is(3,"button",27),Eg("click",function(){let l=mf(e).$index,f=dC(2);return yf(f.removeHeader(l))}),HC(4," \xD7 "),ml()();}if(o&2){let e=t.$index;pg("formGroupName",e),QE(),HI(),QE(),HI();}}function Pe(o,t){if(o&1){let e=sC();Is(0,"form",4),Eg("ngSubmit",function(){mf(e);let l=dC();return yf(l.submit())}),Yw(1,_e,3,1,"ds-fieldset",5),Is(2,"ds-form-field",6)(3,"select",7),Jw(4,Ae,2,2,"option",8,Xw),ml(),BI(),ml(),Is(6,"ds-form-field",9),hg(7,"input",10),BI(),ml(),Is(8,"ds-form-field",11),hg(9,"input",12),BI(),ml(),Is(10,"ds-form-field",13),hg(11,"input",14),BI(),ml(),Is(12,"ds-form-field",15),hg(13,"input",16),BI(),ml(),Is(14,"ds-form-field",17)(15,"div",18),Jw(16,Se,5,1,"div",19,Kw),Is(18,"div")(19,"button",20),Eg("click",function(){mf(e);let l=dC();return yf(l.addHeader())}),HC(20,"+ Add header"),ml()()()(),Is(21,"ds-form-actions")(22,"button",21),HC(23),ml(),Is(24,"button",22),Eg("click",function(){mf(e);let l=dC();return yf(l.cancel())}),HC(25,"Cancel"),ml()()();}if(o&2){let e=dC();pg("formGroup",e.form),QE(),Qw(e.isPlatformMode?-1:1),QE(2),pg("formControl",e.apiTypeControl),HI(),QE(),eC(e.apiTypeOptions),QE(3),pg("formControl",e.nameControl),HI(),QE(2),pg("formControl",e.descriptionControl),HI(),QE(2),pg("formControl",e.baseUrlControl),HI(),QE(2),pg("formControl",e.apiKeyControl),HI(),QE(2),pg("formArrayName","headers"),QE(),eC(e.headersArray.controls),QE(6),pg("disabled",e.form.invalid||e.isSubmitting()),QE(),Il(" ",e.isEditMode()?"Save changes":"Create"," ");}}var xe=new Set(["namespace","userOnNs","userGlobal"]),E=Object.freeze({platform:"Configuration de niveau plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ye=class o{route=g(W);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?zi(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});apiTypeOptions=Object.values($e);scopeOptions=[{value:"namespace",label:E.namespace},{value:"userOnNs",label:E.userOnNs},{value:"userGlobal",label:E.userGlobal}];form=new pt({name:new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te(null),apiType:new Te("OpenAI",{nonNullable:true,validators:[bn.required]}),baseUrl:new Te("",{nonNullable:true}),apiKey:new Te("",{nonNullable:true}),scope:new Te("namespace",{nonNullable:true}),headers:new Wt([],{validators:[]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get apiTypeControl(){return this.form.controls.apiType}get baseUrlControl(){return this.form.controls.baseUrl}get apiKeyControl(){return this.form.controls.apiKey}get scopeControl(){return this.form.controls.scope}get headersArray(){return this.form.controls.headers}addHeader(){this.headersArray.push(new pt({key:new Te("",{nonNullable:true,validators:[bn.required]}),value:new Te("",{nonNullable:true})}));}removeHeader(t){this.headersArray.removeAt(t);}isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);existingConfig=null;initialApiKey="";constructor(){this.isPlatformMode||Ff(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,r=t.get("aiProviderId"),l=this.isPlatformMode?"namespace":this.parseScope(e.get("scope"));if(r){this.isEditMode.set(true),this.scopeControl.disable(),this.apiTypeControl.disable(),this.loadConfig(r);return}this.scopeControl.setValue(l);let f=e.get("template");f&&this.hydrateFromTemplate(f);}parseScope(t){return t&&xe.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId?"namespace":t.namespaceId?"userOnNs":"userGlobal"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AiProviderForm] Could not load provider '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.apiTypeControl.setValue(e.apiType),this.baseUrlControl.setValue(e.baseUrl??""),this.apiKeyControl.setValue(""),this.initialApiKey="",this.apiKeyControl.markAsTouched(),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AiProviderForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.apiTypeControl.setValue(t.apiType),this.baseUrlControl.setValue(t.baseUrl??"");let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialApiKey=e,this.headersArray.clear();for(let[r,l]of Object.entries(t.headers??{}))this.headersArray.push(new pt({key:new Te(r,{nonNullable:true,validators:[bn.required]}),value:new Te(l,{nonNullable:true})}));}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.descriptionControl.value?.trim(),e=this.baseUrlControl.value.trim(),r=this.apiKeyControl.value,l=this.isEditMode()&&r===this.initialApiKey?null:r,f=this.headersArray.controls.filter(A=>A.controls.key.value.trim()).map(A=>[A.controls.key.value.trim(),A.controls.value.value]),Ce=f.length>0?Object.fromEntries(f):null,V={name:this.nameControl.value.trim(),apiType:this.apiTypeControl.value,description:t||null,baseUrl:e||null,apiKey:l,headers:Ce},w=this.form.getRawValue().scope,he=this.isPlatformMode?null:this.namespaceId??null;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,V,w,this.existingConfig):this.state.create(V,w,he)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-providers"]):this.router.navigate(["/agentos",this.namespaceId,"ai-providers"]);}trackByScope(t,e){return e.value}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=Nw({type:o,selectors:[["agentos-ai-provider-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to AI providers",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Configuration scope",3,"disabled"],["label","API type","controlId","llm-api-type","required",""],["dsControl","","id","llm-api-type",3,"formControl"],[3,"value"],["label","Name","controlId","llm-name","required",""],["dsControl","","id","llm-name","type","text","placeholder","e.g. OpenAI prod","autocomplete","off",3,"formControl"],["label","Description","controlId","llm-description"],["dsControl","","id","llm-description","type","text","placeholder","Optional \u2014 short description of this provider","autocomplete","off",3,"formControl"],["label","Base URL","controlId","llm-base-url"],["dsControl","","id","llm-base-url","type","url","placeholder","Optional \u2014 leave empty for default endpoint","autocomplete","off",3,"formControl"],["label","API key","controlId","llm-api-key"],["dsControl","","id","llm-api-key","type","password","placeholder","sk-\u2026","autocomplete","new-password",3,"formControl"],["label","Custom headers"],[1,"ds-stack","ds-stack--sm",3,"formArrayName"],[1,"ds-inline",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsCheck",""],["type","radio",3,"formControl","value","disabled"],["dsControl","","type","text","placeholder","Header name","formControlName","key","autocomplete","off"],["dsControl","","type","text","placeholder","Value","formControlName","value","autocomplete","off"],["dsButton","","variant","icon-danger","type","button","title","Remove header","aria-label","Remove header",3,"click"]],template:function(e,r){e&1&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return r.cancel()}),HC(3," \u2190 AI providers "),ml()(),Yw(4,ge,2,0,"p",2)(5,Pe,26,10,"form",3),ml()),e&2&&(QE(),pg("title",r.isEditMode()?"Edit AI provider":"New AI provider"),QE(3),Qw(r.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,at,un,cn,Kt,fd,Mo,Do,Ut,Qt,Ca,fo,go,Nn,Rn,Ea,yo,bo],encapsulation:2})};export{ye as AiProviderFormComponent};
@@ -1 +1 @@
1
- import {n}from'./chunk-CfgXrte_.js';import {O}from'./chunk-D-9iMQv_.js';import {v}from'./chunk-DpaqV0I8.js';import {g,W as W$1,F,K as we,z as zi,U as U$1,ad as ne,a1 as ma,aa as _r,N as Nw,I as Is,R as Eg,m as ml,H as HC,Y as Yw,Q as QE,P as pg,b as Qw,p as dC,L as Lg,J as Jw,k as eC,s as sC,i as fg,q as mf,r as yf}from'./main-OLEL3JTU.js';import {q as k,O as O$1,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-anaDHfEv.js';import'./chunk-C7Y0YglE.js';var H=(i,e)=>e.key;function U(i,e){if(i&1&&(Is(0,"p",3),HC(1),ml()),i&2){let t=dC();QE(),Lg(t.deletion.error());}}function z(i,e){i&1&&(Is(0,"p",4),HC(1,"Loading AI providers\u2026"),ml());}function J(i,e){i&1&&(Is(0,"p",5),HC(1,"No AI providers available."),ml());}function Q(i,e){i&1&&(Is(0,"p",4),HC(1,"No AI providers match the current filter."),ml());}function W(i,e){i&1&&(Is(0,"ds-tag",17),HC(1,"Read-only"),ml());}function X(i,e){if(i&1){let t=sC();Is(0,"button",22),Eg("click",function(){mf(t);let d=dC().$implicit,c=dC(2);return yf(c.duplicate(d))}),HC(1," Duplicate "),ml();}if(i&2){let t=dC().$implicit;fg("aria-label","Duplicate "+t.config.name);}}function Y(i,e){if(i&1){let t=sC();Is(0,"button",22),Eg("click",function(){mf(t);let d=dC(2).$implicit,c=dC(2);return yf(c.edit(d))}),HC(1," Edit "),ml();}if(i&2){let t=dC(2).$implicit;fg("aria-label","Edit "+t.config.name);}}function Z(i,e){if(i&1){let t=sC();Yw(0,Y,2,1,"button",20),Is(1,"agentos-row-delete-action",23),Eg("deleteRequested",function(){mf(t);let d=dC().$implicit,c=dC(2);return yf(c.deletion.request(d.key))})("deleteConfirmed",function(){mf(t);let d=dC().$implicit,c=dC(2);return yf(c.confirmDelete(d))})("deleteCancelled",function(){mf(t);let d=dC(3);return yf(d.deletion.cancel())}),ml();}if(i&2){let t=dC().$implicit,r=dC(2);Qw(r.deletion.confirmingId()!==t.key?0:-1),QE(),pg("rowKey",t.key)("rowLabel",t.config.name)("state",r.deletion);}}function ee(i,e){i&1&&(Is(0,"button",21),HC(1,"Inherited"),ml());}function te(i,e){if(i&1&&(Is(0,"tr",9)(1,"td",12),HC(2),ml(),Is(3,"td",13),HC(4),ml(),Is(5,"td",14)(6,"div",15)(7,"ds-tag",16),HC(8),ml(),Yw(9,W,2,0,"ds-tag",17),ml()(),Is(10,"td",18)(11,"div",19),Yw(12,X,2,1,"button",20),Yw(13,Z,2,4)(14,ee,2,0,"button",21),ml()()()),i&2){let t=e.$implicit,r=dC(2);QE(2),Lg(t.config.name),QE(2),Lg(t.config.apiType),QE(3),pg("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),QE(),Lg(t.scopeLabel),QE(),Qw(t.canMutate?-1:9),QE(3),Qw(r.deletion.confirmingId()!==t.key?12:-1),QE(),Qw(t.canMutate?13:14);}}function ie(i,e){if(i&1&&(Is(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),HC(5,"Name"),ml(),Is(6,"th",10),HC(7,"API type"),ml(),Is(8,"th",10),HC(9,"Scope"),ml(),Is(10,"th",10)(11,"span",11),HC(12,"Actions"),ml()()()(),Is(13,"tbody",8),Jw(14,te,15,7,"tr",9,H),ml()()()),i&2){let t=dC();QE(14),eC(t.rowFilter.filteredRows());}}var G=class i{route=g(W$1);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=zi(false);isLoading=zi(true);rows=zi([]);deletion=k();rowFilter=O$1(this.rows,e=>[e.config.name,e.config.apiType,e.scopeLabel].join(" "));ngOnInit(){this.route.paramMap.pipe(U$1(this.destroyRef)).subscribe(e=>{let t=e.get("namespaceId")??"";t&&t!==this.namespaceId&&(this.namespaceId=t),this.state.setNamespace(t);}),this.route.paramMap.pipe(ne(e=>e.get("namespaceId")??""),ma(e=>e?this.namespaceRole.isAdminOfNamespace$(e):_r(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,"ai-providers","new"],{queryParams:{scope:n(this.isAdmin())}});}edit(e){!e.canMutate||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"ai-providers",e.config.id,"edit"],{queryParams:{scope:e.scope}});}confirmDelete(e){!e.canMutate||!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.`});}duplicate(e){if(!e.config.id)return;let t=e.scope==="platform"||e.scope==="namespace"&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"ai-providers","new"],{queryParams:{scope:t,template:e.config.id,templateScope:e.scope}});}toRows(e){return [...this.mapScope(e.platform,"platform","Platform",false),...this.mapScope(e.namespace,"namespace","Namespace",this.isAdmin()),...this.mapScope(e.userOnNs,"userOnNs","Personal",true),...this.mapScope(e.userGlobal,"userGlobal","Personal",true)]}mapScope(e,t,r,d){return e.map((c,K)=>({key:`${t}:${c.id??K}`,config:c,scope:t,scopeLabel:r,canMutate:d}))}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=Nw({type:i,selectors:[["agentos-ai-providers-all-scopes"]],decls:9,vars:3,consts:[["title","AI providers","description","AI providers available in this namespace, including inherited platform and personal entries."],["label","Filter AI providers","placeholder","Filter AI providers\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","AI providers"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","API type",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"],["type","button","disabled",""],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,r){t&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(c){return r.rowFilter.query.set(c)}),ml(),Is(2,"button",2),Eg("click",function(){return r.openCreateForm()}),HC(3,"New AI provider"),ml()(),Yw(4,U,2,1,"p",3),Yw(5,z,2,0,"p",4)(6,J,2,0,"p",5)(7,Q,2,0,"p",4)(8,ie,16,0,"div",6)),t&2&&(QE(),pg("query",r.rowFilter.query()),QE(3),Qw(r.deletion.error()?4:-1),QE(),Qw(r.isLoading()?5:r.rows().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{G as AiProvidersAllScopesComponent};
1
+ import {n}from'./chunk-CfgXrte_.js';import {O}from'./chunk-C8kRHbPY.js';import {q as k,O as O$1,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-CV72_wbg.js';import {v}from'./chunk-C-TFPDAn.js';import {g,W as W$1,F,K as we,z as zi,U as U$1,ad as ne,a1 as ma,aa as _r,N as Nw,I as Is,R as Eg,m as ml,H as HC,Y as Yw,Q as QE,P as pg,b as Qw,p as dC,L as Lg,J as Jw,k as eC,s as sC,i as fg,q as mf,r as yf}from'./main-2W2EKPFF.js';import'./chunk-gOvITjLx.js';var H=(i,e)=>e.key;function U(i,e){if(i&1&&(Is(0,"p",3),HC(1),ml()),i&2){let t=dC();QE(),Lg(t.deletion.error());}}function z(i,e){i&1&&(Is(0,"p",4),HC(1,"Loading AI providers\u2026"),ml());}function J(i,e){i&1&&(Is(0,"p",5),HC(1,"No AI providers available."),ml());}function Q(i,e){i&1&&(Is(0,"p",4),HC(1,"No AI providers match the current filter."),ml());}function W(i,e){i&1&&(Is(0,"ds-tag",17),HC(1,"Read-only"),ml());}function X(i,e){if(i&1){let t=sC();Is(0,"button",22),Eg("click",function(){mf(t);let d=dC().$implicit,c=dC(2);return yf(c.duplicate(d))}),HC(1," Duplicate "),ml();}if(i&2){let t=dC().$implicit;fg("aria-label","Duplicate "+t.config.name);}}function Y(i,e){if(i&1){let t=sC();Is(0,"button",22),Eg("click",function(){mf(t);let d=dC(2).$implicit,c=dC(2);return yf(c.edit(d))}),HC(1," Edit "),ml();}if(i&2){let t=dC(2).$implicit;fg("aria-label","Edit "+t.config.name);}}function Z(i,e){if(i&1){let t=sC();Yw(0,Y,2,1,"button",20),Is(1,"agentos-row-delete-action",23),Eg("deleteRequested",function(){mf(t);let d=dC().$implicit,c=dC(2);return yf(c.deletion.request(d.key))})("deleteConfirmed",function(){mf(t);let d=dC().$implicit,c=dC(2);return yf(c.confirmDelete(d))})("deleteCancelled",function(){mf(t);let d=dC(3);return yf(d.deletion.cancel())}),ml();}if(i&2){let t=dC().$implicit,r=dC(2);Qw(r.deletion.confirmingId()!==t.key?0:-1),QE(),pg("rowKey",t.key)("rowLabel",t.config.name)("state",r.deletion);}}function ee(i,e){i&1&&(Is(0,"button",21),HC(1,"Inherited"),ml());}function te(i,e){if(i&1&&(Is(0,"tr",9)(1,"td",12),HC(2),ml(),Is(3,"td",13),HC(4),ml(),Is(5,"td",14)(6,"div",15)(7,"ds-tag",16),HC(8),ml(),Yw(9,W,2,0,"ds-tag",17),ml()(),Is(10,"td",18)(11,"div",19),Yw(12,X,2,1,"button",20),Yw(13,Z,2,4)(14,ee,2,0,"button",21),ml()()()),i&2){let t=e.$implicit,r=dC(2);QE(2),Lg(t.config.name),QE(2),Lg(t.config.apiType),QE(3),pg("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),QE(),Lg(t.scopeLabel),QE(),Qw(t.canMutate?-1:9),QE(3),Qw(r.deletion.confirmingId()!==t.key?12:-1),QE(),Qw(t.canMutate?13:14);}}function ie(i,e){if(i&1&&(Is(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),HC(5,"Name"),ml(),Is(6,"th",10),HC(7,"API type"),ml(),Is(8,"th",10),HC(9,"Scope"),ml(),Is(10,"th",10)(11,"span",11),HC(12,"Actions"),ml()()()(),Is(13,"tbody",8),Jw(14,te,15,7,"tr",9,H),ml()()()),i&2){let t=dC();QE(14),eC(t.rowFilter.filteredRows());}}var G=class i{route=g(W$1);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=zi(false);isLoading=zi(true);rows=zi([]);deletion=k();rowFilter=O$1(this.rows,e=>[e.config.name,e.config.apiType,e.scopeLabel].join(" "));ngOnInit(){this.route.paramMap.pipe(U$1(this.destroyRef)).subscribe(e=>{let t=e.get("namespaceId")??"";t&&t!==this.namespaceId&&(this.namespaceId=t),this.state.setNamespace(t);}),this.route.paramMap.pipe(ne(e=>e.get("namespaceId")??""),ma(e=>e?this.namespaceRole.isAdminOfNamespace$(e):_r(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,"ai-providers","new"],{queryParams:{scope:n(this.isAdmin())}});}edit(e){!e.canMutate||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"ai-providers",e.config.id,"edit"],{queryParams:{scope:e.scope}});}confirmDelete(e){!e.canMutate||!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.`});}duplicate(e){if(!e.config.id)return;let t=e.scope==="platform"||e.scope==="namespace"&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"ai-providers","new"],{queryParams:{scope:t,template:e.config.id,templateScope:e.scope}});}toRows(e){return [...this.mapScope(e.platform,"platform","Platform",false),...this.mapScope(e.namespace,"namespace","Namespace",this.isAdmin()),...this.mapScope(e.userOnNs,"userOnNs","Personal",true),...this.mapScope(e.userGlobal,"userGlobal","Personal",true)]}mapScope(e,t,r,d){return e.map((c,K)=>({key:`${t}:${c.id??K}`,config:c,scope:t,scopeLabel:r,canMutate:d}))}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=Nw({type:i,selectors:[["agentos-ai-providers-all-scopes"]],decls:9,vars:3,consts:[["title","AI providers","description","AI providers available in this namespace, including inherited platform and personal entries."],["label","Filter AI providers","placeholder","Filter AI providers\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","AI providers"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","API type",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"],["type","button","disabled",""],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,r){t&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(c){return r.rowFilter.query.set(c)}),ml(),Is(2,"button",2),Eg("click",function(){return r.openCreateForm()}),HC(3,"New AI provider"),ml()(),Yw(4,U,2,1,"p",3),Yw(5,z,2,0,"p",4)(6,J,2,0,"p",5)(7,Q,2,0,"p",4)(8,ie,16,0,"div",6)),t&2&&(QE(),pg("query",r.rowFilter.query()),QE(3),Qw(r.deletion.error()?4:-1),QE(),Qw(r.isLoading()?5:r.rows().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{G as AiProvidersAllScopesComponent};
@@ -1 +1 @@
1
- import {c}from'./chunk-DaKshFXh.js';import {q as k,O as O$1,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-anaDHfEv.js';import {g,W,F,K as we,z as zi,ac as Ny,a2 as ga,aa as _r,U,O as x,M as w,ai as Fe,al as We,N as Nw,I as Is,R as Eg,m as ml,H as HC,Y as Yw,Q as QE,P as pg,b as Qw,p as dC,L as Lg,J as Jw,k as eC,s as sC,q as mf,r as yf,i as fg}from'./main-OLEL3JTU.js';var J=(n,t)=>t.key;function O(n,t){if(n&1&&(Is(0,"p",3),HC(1),ml()),n&2){let e=dC();QE(),Lg(e.deletion.error());}}function Y(n,t){n&1&&(Is(0,"p",4),HC(1,"Loading scheduled prompts\u2026"),ml());}function z(n,t){n&1&&(Is(0,"p",5),HC(1,"No scheduled prompts available."),ml());}function G(n,t){n&1&&(Is(0,"p",4),HC(1,"No scheduled prompts match the current filter."),ml());}function Q(n,t){if(n&1&&(Is(0,"span",14),HC(1),ml()),n&2){let e=dC().$implicit;QE(),Lg(e.prompt.description);}}function X(n,t){n&1&&(Is(0,"ds-tag",20),HC(1,"Read-only"),ml());}function Z(n,t){if(n&1){let e=sC();Is(0,"button",25),Eg("click",function(){mf(e);let l=dC(2).$implicit,p=dC(2);return yf(p.toggle(l))}),HC(1),ml(),Is(2,"button",25),Eg("click",function(){mf(e);let l=dC(2).$implicit,p=dC(2);return yf(p.edit(l))}),HC(3," Edit "),ml();}if(n&2){let e=dC(2).$implicit;QE(),Lg(e.prompt.enabled?"Disable":"Enable"),QE(),fg("aria-label","Edit "+e.prompt.name);}}function ee(n,t){if(n&1){let e=sC();Yw(0,Z,4,2),Is(1,"agentos-row-delete-action",24),Eg("deleteRequested",function(){mf(e);let l=dC().$implicit,p=dC(2);return yf(p.deletion.request(l.key))})("deleteConfirmed",function(){mf(e);let l=dC().$implicit,p=dC(2);return yf(p.confirmDelete(l))})("deleteCancelled",function(){mf(e);let l=dC(3);return yf(l.deletion.cancel())}),ml();}if(n&2){let e=dC().$implicit,i=dC(2);Qw(i.deletion.confirmingId()!==e.key?0:-1),QE(),pg("rowKey",e.key)("rowLabel",e.prompt.name)("state",i.deletion);}}function te(n,t){n&1&&(Is(0,"button",23),HC(1,"Inherited"),ml());}function ne(n,t){if(n&1&&(Is(0,"tr",9)(1,"td",12)(2,"span",13),HC(3),ml(),Yw(4,Q,2,1,"span",14),ml(),Is(5,"td",15),HC(6),ml(),Is(7,"td",16)(8,"ds-tag",17),HC(9),ml()(),Is(10,"td",18)(11,"div",19)(12,"ds-tag",17),HC(13),ml(),Yw(14,X,2,0,"ds-tag",20),ml()(),Is(15,"td",21)(16,"div",22),Yw(17,ee,2,4)(18,te,2,0,"button",23),ml()()()),n&2){let e=t.$implicit,i=dC(2);QE(3),Lg(e.prompt.name),QE(),Qw(e.prompt.description?4:-1),QE(2),Lg(i.scheduleLabel(e.prompt)),QE(2),pg("variant",e.prompt.enabled?"accent":"outline"),QE(),Lg(e.prompt.enabled?"Enabled":"Disabled"),QE(3),pg("variant",e.scope==="platform"?"neutral":"accent"),QE(),Lg(e.scope==="platform"?"Platform":"Namespace"),QE(),Qw(e.scope==="platform"?14:-1),QE(3),Qw(e.scope==="namespace"?17:18);}}function ie(n,t){if(n&1&&(Is(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),HC(5,"Name"),ml(),Is(6,"th",10),HC(7,"Schedule"),ml(),Is(8,"th",10),HC(9,"Status"),ml(),Is(10,"th",10),HC(11,"Scope"),ml(),Is(12,"th",10)(13,"span",11),HC(14,"Actions"),ml()()()(),Is(15,"tbody",8),Jw(16,ne,19,9,"tr",9,J),ml()()()),n&2){let e=dC();QE(16),eC(e.rowFilter.filteredRows());}}var H=class n{route=g(W);router=g(F);destroyRef=g(we);state=g(c);namespaceId=this.route.snapshot.params.namespaceId;rows=zi([]);isLoading=zi(true);deletion=k();rowFilter=O$1(this.rows,t=>[t.prompt.name,t.prompt.description,this.scheduleLabel(t.prompt),t.prompt.enabled?"Enabled":"Disabled",t.scope].filter(Boolean).join(" "));constructor(){Ny({platform:this.state.listPlatform().pipe(ga(()=>_r([]))),namespace:this.state.listByNamespace(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({platform:t,namespace:e})=>{this.rows.set([...t.map((i,l)=>({key:`platform:${i.id??l}`,prompt:i,scope:"platform"})),...e.map((i,l)=>({key:`namespace:${i.id??l}`,prompt:i,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts","new"]);}edit(t){t.scope==="platform"||!t.prompt.id||this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts",t.prompt.id,"edit"]);}toggle(t){if(t.scope==="platform")return;(t.prompt.enabled?this.state.disable(t.prompt.id??""):this.state.enable(t.prompt.id??"")).pipe(U(this.destroyRef)).subscribe(i=>this.rows.update(l=>l.map(p=>p.key===t.key?x(w({},p),{prompt:i}):p)));}confirmDelete(t){t.scope==="platform"||!t.prompt.id||this.deletion.execute(t.key,{request$:this.state.delete(t.prompt.id).pipe(U(this.destroyRef)),onSuccess:()=>this.rows.update(e=>e.filter(i=>i.key!==t.key)),errorMessage:`Deleting "${t.prompt.name}" failed. Try again.`});}scheduleLabel(t){let e=t.recurrence,i=e.unit===Fe.WEEK?"week":"month",l=e.unit===Fe.WEEK&&e.days?.length?` (${e.days.map(p=>We[p]??p).join(", ")})`:"";return `Every ${i}${l} at ${e.timeUtc} UTC`}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Nw({type:n,selectors:[["agentos-scheduled-prompt-list"]],decls:9,vars:3,consts:[["title","Scheduled prompts","description","Scheduled prompts for this namespace, including schedules inherited from the platform."],["label","Filter scheduled prompts","placeholder","Filter scheduled prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Scheduled prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Schedule"],["role","cell","data-label","Status"],[3,"variant"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(e,i){e&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(p){return i.rowFilter.query.set(p)}),ml(),Is(2,"button",2),Eg("click",function(){return i.openCreateForm()}),HC(3,"New scheduled prompt"),ml()(),Yw(4,O,2,1,"p",3),Yw(5,Y,2,0,"p",4)(6,z,2,0,"p",5)(7,G,2,0,"p",4)(8,ie,18,0,"div",6)),e&2&&(QE(),pg("query",i.rowFilter.query()),QE(3),Qw(i.deletion.error()?4:-1),QE(),Qw(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{H as ScheduledPromptListComponent};
1
+ import {c}from'./chunk-BgspkyJn.js';import {q as k,O as O$1,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-CV72_wbg.js';import {g,W,F,K as we,z as zi,ac as Ny,a2 as ga,aa as _r,U,O as x,M as w,ai as Fe,al as We,N as Nw,I as Is,R as Eg,m as ml,H as HC,Y as Yw,Q as QE,P as pg,b as Qw,p as dC,L as Lg,J as Jw,k as eC,s as sC,q as mf,r as yf,i as fg}from'./main-2W2EKPFF.js';var J=(n,t)=>t.key;function O(n,t){if(n&1&&(Is(0,"p",3),HC(1),ml()),n&2){let e=dC();QE(),Lg(e.deletion.error());}}function Y(n,t){n&1&&(Is(0,"p",4),HC(1,"Loading scheduled prompts\u2026"),ml());}function z(n,t){n&1&&(Is(0,"p",5),HC(1,"No scheduled prompts available."),ml());}function G(n,t){n&1&&(Is(0,"p",4),HC(1,"No scheduled prompts match the current filter."),ml());}function Q(n,t){if(n&1&&(Is(0,"span",14),HC(1),ml()),n&2){let e=dC().$implicit;QE(),Lg(e.prompt.description);}}function X(n,t){n&1&&(Is(0,"ds-tag",20),HC(1,"Read-only"),ml());}function Z(n,t){if(n&1){let e=sC();Is(0,"button",25),Eg("click",function(){mf(e);let l=dC(2).$implicit,p=dC(2);return yf(p.toggle(l))}),HC(1),ml(),Is(2,"button",25),Eg("click",function(){mf(e);let l=dC(2).$implicit,p=dC(2);return yf(p.edit(l))}),HC(3," Edit "),ml();}if(n&2){let e=dC(2).$implicit;QE(),Lg(e.prompt.enabled?"Disable":"Enable"),QE(),fg("aria-label","Edit "+e.prompt.name);}}function ee(n,t){if(n&1){let e=sC();Yw(0,Z,4,2),Is(1,"agentos-row-delete-action",24),Eg("deleteRequested",function(){mf(e);let l=dC().$implicit,p=dC(2);return yf(p.deletion.request(l.key))})("deleteConfirmed",function(){mf(e);let l=dC().$implicit,p=dC(2);return yf(p.confirmDelete(l))})("deleteCancelled",function(){mf(e);let l=dC(3);return yf(l.deletion.cancel())}),ml();}if(n&2){let e=dC().$implicit,i=dC(2);Qw(i.deletion.confirmingId()!==e.key?0:-1),QE(),pg("rowKey",e.key)("rowLabel",e.prompt.name)("state",i.deletion);}}function te(n,t){n&1&&(Is(0,"button",23),HC(1,"Inherited"),ml());}function ne(n,t){if(n&1&&(Is(0,"tr",9)(1,"td",12)(2,"span",13),HC(3),ml(),Yw(4,Q,2,1,"span",14),ml(),Is(5,"td",15),HC(6),ml(),Is(7,"td",16)(8,"ds-tag",17),HC(9),ml()(),Is(10,"td",18)(11,"div",19)(12,"ds-tag",17),HC(13),ml(),Yw(14,X,2,0,"ds-tag",20),ml()(),Is(15,"td",21)(16,"div",22),Yw(17,ee,2,4)(18,te,2,0,"button",23),ml()()()),n&2){let e=t.$implicit,i=dC(2);QE(3),Lg(e.prompt.name),QE(),Qw(e.prompt.description?4:-1),QE(2),Lg(i.scheduleLabel(e.prompt)),QE(2),pg("variant",e.prompt.enabled?"accent":"outline"),QE(),Lg(e.prompt.enabled?"Enabled":"Disabled"),QE(3),pg("variant",e.scope==="platform"?"neutral":"accent"),QE(),Lg(e.scope==="platform"?"Platform":"Namespace"),QE(),Qw(e.scope==="platform"?14:-1),QE(3),Qw(e.scope==="namespace"?17:18);}}function ie(n,t){if(n&1&&(Is(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),HC(5,"Name"),ml(),Is(6,"th",10),HC(7,"Schedule"),ml(),Is(8,"th",10),HC(9,"Status"),ml(),Is(10,"th",10),HC(11,"Scope"),ml(),Is(12,"th",10)(13,"span",11),HC(14,"Actions"),ml()()()(),Is(15,"tbody",8),Jw(16,ne,19,9,"tr",9,J),ml()()()),n&2){let e=dC();QE(16),eC(e.rowFilter.filteredRows());}}var H=class n{route=g(W);router=g(F);destroyRef=g(we);state=g(c);namespaceId=this.route.snapshot.params.namespaceId;rows=zi([]);isLoading=zi(true);deletion=k();rowFilter=O$1(this.rows,t=>[t.prompt.name,t.prompt.description,this.scheduleLabel(t.prompt),t.prompt.enabled?"Enabled":"Disabled",t.scope].filter(Boolean).join(" "));constructor(){Ny({platform:this.state.listPlatform().pipe(ga(()=>_r([]))),namespace:this.state.listByNamespace(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({platform:t,namespace:e})=>{this.rows.set([...t.map((i,l)=>({key:`platform:${i.id??l}`,prompt:i,scope:"platform"})),...e.map((i,l)=>({key:`namespace:${i.id??l}`,prompt:i,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts","new"]);}edit(t){t.scope==="platform"||!t.prompt.id||this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts",t.prompt.id,"edit"]);}toggle(t){if(t.scope==="platform")return;(t.prompt.enabled?this.state.disable(t.prompt.id??""):this.state.enable(t.prompt.id??"")).pipe(U(this.destroyRef)).subscribe(i=>this.rows.update(l=>l.map(p=>p.key===t.key?x(w({},p),{prompt:i}):p)));}confirmDelete(t){t.scope==="platform"||!t.prompt.id||this.deletion.execute(t.key,{request$:this.state.delete(t.prompt.id).pipe(U(this.destroyRef)),onSuccess:()=>this.rows.update(e=>e.filter(i=>i.key!==t.key)),errorMessage:`Deleting "${t.prompt.name}" failed. Try again.`});}scheduleLabel(t){let e=t.recurrence,i=e.unit===Fe.WEEK?"week":"month",l=e.unit===Fe.WEEK&&e.days?.length?` (${e.days.map(p=>We[p]??p).join(", ")})`:"";return `Every ${i}${l} at ${e.timeUtc} UTC`}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Nw({type:n,selectors:[["agentos-scheduled-prompt-list"]],decls:9,vars:3,consts:[["title","Scheduled prompts","description","Scheduled prompts for this namespace, including schedules inherited from the platform."],["label","Filter scheduled prompts","placeholder","Filter scheduled prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Scheduled prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Schedule"],["role","cell","data-label","Status"],[3,"variant"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(e,i){e&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(p){return i.rowFilter.query.set(p)}),ml(),Is(2,"button",2),Eg("click",function(){return i.openCreateForm()}),HC(3,"New scheduled prompt"),ml()(),Yw(4,O,2,1,"p",3),Yw(5,Y,2,0,"p",4)(6,z,2,0,"p",5)(7,G,2,0,"p",4)(8,ie,18,0,"div",6)),e&2&&(QE(),pg("query",i.rowFilter.query()),QE(3),Qw(i.deletion.error()?4:-1),QE(),Qw(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{H as ScheduledPromptListComponent};
@@ -1 +1 @@
1
- import {q as k$1,O as O$1,i as at,d as yn,V as Vo,j as P,r as P$1}from'./chunk-anaDHfEv.js';import {g,F,K as we,aq as F$1,ap as k,$ as Sr,z as zi,a1 as ma,at as _y,U as U$1,N as Nw,I as Is,R as Eg,m as ml,H as HC,Y as Yw,Q as QE,P as pg,b as Qw,p as dC,L as Lg,J as Jw,k as eC,s as sC,q as mf,r as yf,o as Il,i as fg}from'./main-OLEL3JTU.js';var K=(o,t)=>t.key;function H(o,t){if(o&1&&(Is(0,"p",3),HC(1),ml()),o&2){let e=dC();QE(),Lg(e.deletion.error());}}function U(o,t){o&1&&(Is(0,"p",4),HC(1,"Loading AI models\u2026"),ml());}function z(o,t){o&1&&(Is(0,"p",5),HC(1,"No platform AI models defined yet."),ml());}function G(o,t){o&1&&(Is(0,"p",4),HC(1,"No AI models match the current filter."),ml());}function J(o,t){if(o&1){let e=sC();Is(0,"button",21),Eg("click",function(){mf(e);let r=dC().$implicit,m=dC(2);return yf(m.edit(r))}),HC(1,"Edit"),ml();}if(o&2){let e=dC().$implicit;fg("aria-label","Edit "+e.title);}}function O(o,t){if(o&1){let e=sC();Is(0,"tr",9)(1,"td",12),HC(2),ml(),Is(3,"td",13),HC(4),ml(),Is(5,"td",14),HC(6),ml(),Is(7,"td",15),HC(8),ml(),Is(9,"td",16),HC(10),ml(),Is(11,"td",17)(12,"div",18),Yw(13,J,2,1,"button",19),Is(14,"agentos-row-delete-action",20),Eg("deleteRequested",function(){let r=mf(e).$implicit,m=dC(2);return yf(m.deletion.request(r.key))})("deleteConfirmed",function(){let r=mf(e).$implicit,m=dC(2);return yf(m.confirmDelete(r))})("deleteCancelled",function(){mf(e);let r=dC(2);return yf(r.deletion.cancel())}),ml()()()();}if(o&2){let e=t.$implicit,a=dC(2);QE(2),Lg(e.title),QE(2),Lg(e.providerName),QE(2),Il(" ",e.model.apiModelName," "),QE(2),Lg(e.model.priority),QE(2),Il(" ",e.model.reasoningEffort?e.model.reasoningEffort.toLowerCase():"\u2014"," "),QE(3),Qw(a.deletion.confirmingId()!==e.key?13:-1),QE(),pg("rowKey",e.key)("rowLabel",e.title)("state",a.deletion);}}function Q(o,t){if(o&1&&(Is(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),HC(5,"Name"),ml(),Is(6,"th",10),HC(7,"Provider"),ml(),Is(8,"th",10),HC(9,"API model name"),ml(),Is(10,"th",10),HC(11,"Priority"),ml(),Is(12,"th",10),HC(13,"Reasoning effort"),ml(),Is(14,"th",10)(15,"span",11),HC(16,"Actions"),ml()()()(),Is(17,"tbody",8),Jw(18,O,15,9,"tr",9,K),ml()()()),o&2){let e=dC();QE(18),eC(e.rowFilter.filteredRows());}}var j=class o{router=g(F);destroyRef=g(we);aiModelController=g(F$1);aiProviderController=g(k);refresh$=new Sr(void 0);isLoading=zi(true);deletion=k$1();rows=zi([]);rowFilter=O$1(this.rows,t=>[t.title,t.model.apiModelName,t.providerName].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ma(()=>(this.isLoading.set(true),_y([this.aiModelController.listPlatformLevelAiModel(),this.aiProviderController.listAiProvider("none")]))),U$1(this.destroyRef)).subscribe({next:([t,e])=>{let a=new Map(e.map(r=>[r.id??"",r.name]));this.rows.set(t.map((r,m)=>({key:r.id??`model:${m}`,model:r,title:r.alias??r.apiModelName,providerName:a.get(r.aiProviderId)??r.aiProviderId}))),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","ai-models","new"]);}edit(t){t.model.id&&this.router.navigate(["/agentos","admin","ai-models",t.model.id,"edit"]);}confirmDelete(t){t.model.id&&this.deletion.execute(t.key,{request$:this.aiModelController.deleteAiModel(t.model.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${t.title}" failed. Try again.`});}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=Nw({type:o,selectors:[["agentos-platform-ai-models"]],decls:9,vars:3,consts:[["title","Platform AI models","description","AI models shared across every namespace."],["label","Filter AI models","placeholder","Filter AI models\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform AI models"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Provider"],["role","cell","data-label","API model name",1,"settings-table__secondary"],["role","cell","data-label","Priority"],["role","cell","data-label","Reasoning effort"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(e,a){e&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(m){return a.rowFilter.query.set(m)}),ml(),Is(2,"button",2),Eg("click",function(){return a.openCreateForm()}),HC(3,"New AI model"),ml()(),Yw(4,H,2,1,"p",3),Yw(5,U,2,0,"p",4)(6,z,2,0,"p",5)(7,G,2,0,"p",4)(8,Q,20,0,"div",6)),e&2&&(QE(),pg("query",a.rowFilter.query()),QE(3),Qw(a.deletion.error()?4:-1),QE(),Qw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,P,P$1],encapsulation:2})};export{j as PlatformAiModelsComponent};
1
+ import {q as k$1,O as O$1,i as at,d as yn,V as Vo,j as P,r as P$1}from'./chunk-CV72_wbg.js';import {g,F,K as we,aq as F$1,ap as k,$ as Sr,z as zi,a1 as ma,at as _y,U as U$1,N as Nw,I as Is,R as Eg,m as ml,H as HC,Y as Yw,Q as QE,P as pg,b as Qw,p as dC,L as Lg,J as Jw,k as eC,s as sC,q as mf,r as yf,o as Il,i as fg}from'./main-2W2EKPFF.js';var K=(o,t)=>t.key;function H(o,t){if(o&1&&(Is(0,"p",3),HC(1),ml()),o&2){let e=dC();QE(),Lg(e.deletion.error());}}function U(o,t){o&1&&(Is(0,"p",4),HC(1,"Loading AI models\u2026"),ml());}function z(o,t){o&1&&(Is(0,"p",5),HC(1,"No platform AI models defined yet."),ml());}function G(o,t){o&1&&(Is(0,"p",4),HC(1,"No AI models match the current filter."),ml());}function J(o,t){if(o&1){let e=sC();Is(0,"button",21),Eg("click",function(){mf(e);let r=dC().$implicit,m=dC(2);return yf(m.edit(r))}),HC(1,"Edit"),ml();}if(o&2){let e=dC().$implicit;fg("aria-label","Edit "+e.title);}}function O(o,t){if(o&1){let e=sC();Is(0,"tr",9)(1,"td",12),HC(2),ml(),Is(3,"td",13),HC(4),ml(),Is(5,"td",14),HC(6),ml(),Is(7,"td",15),HC(8),ml(),Is(9,"td",16),HC(10),ml(),Is(11,"td",17)(12,"div",18),Yw(13,J,2,1,"button",19),Is(14,"agentos-row-delete-action",20),Eg("deleteRequested",function(){let r=mf(e).$implicit,m=dC(2);return yf(m.deletion.request(r.key))})("deleteConfirmed",function(){let r=mf(e).$implicit,m=dC(2);return yf(m.confirmDelete(r))})("deleteCancelled",function(){mf(e);let r=dC(2);return yf(r.deletion.cancel())}),ml()()()();}if(o&2){let e=t.$implicit,a=dC(2);QE(2),Lg(e.title),QE(2),Lg(e.providerName),QE(2),Il(" ",e.model.apiModelName," "),QE(2),Lg(e.model.priority),QE(2),Il(" ",e.model.reasoningEffort?e.model.reasoningEffort.toLowerCase():"\u2014"," "),QE(3),Qw(a.deletion.confirmingId()!==e.key?13:-1),QE(),pg("rowKey",e.key)("rowLabel",e.title)("state",a.deletion);}}function Q(o,t){if(o&1&&(Is(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),HC(5,"Name"),ml(),Is(6,"th",10),HC(7,"Provider"),ml(),Is(8,"th",10),HC(9,"API model name"),ml(),Is(10,"th",10),HC(11,"Priority"),ml(),Is(12,"th",10),HC(13,"Reasoning effort"),ml(),Is(14,"th",10)(15,"span",11),HC(16,"Actions"),ml()()()(),Is(17,"tbody",8),Jw(18,O,15,9,"tr",9,K),ml()()()),o&2){let e=dC();QE(18),eC(e.rowFilter.filteredRows());}}var j=class o{router=g(F);destroyRef=g(we);aiModelController=g(F$1);aiProviderController=g(k);refresh$=new Sr(void 0);isLoading=zi(true);deletion=k$1();rows=zi([]);rowFilter=O$1(this.rows,t=>[t.title,t.model.apiModelName,t.providerName].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ma(()=>(this.isLoading.set(true),_y([this.aiModelController.listPlatformLevelAiModel(),this.aiProviderController.listAiProvider("none")]))),U$1(this.destroyRef)).subscribe({next:([t,e])=>{let a=new Map(e.map(r=>[r.id??"",r.name]));this.rows.set(t.map((r,m)=>({key:r.id??`model:${m}`,model:r,title:r.alias??r.apiModelName,providerName:a.get(r.aiProviderId)??r.aiProviderId}))),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","ai-models","new"]);}edit(t){t.model.id&&this.router.navigate(["/agentos","admin","ai-models",t.model.id,"edit"]);}confirmDelete(t){t.model.id&&this.deletion.execute(t.key,{request$:this.aiModelController.deleteAiModel(t.model.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${t.title}" failed. Try again.`});}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=Nw({type:o,selectors:[["agentos-platform-ai-models"]],decls:9,vars:3,consts:[["title","Platform AI models","description","AI models shared across every namespace."],["label","Filter AI models","placeholder","Filter AI models\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform AI models"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Provider"],["role","cell","data-label","API model name",1,"settings-table__secondary"],["role","cell","data-label","Priority"],["role","cell","data-label","Reasoning effort"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(e,a){e&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(m){return a.rowFilter.query.set(m)}),ml(),Is(2,"button",2),Eg("click",function(){return a.openCreateForm()}),HC(3,"New AI model"),ml()(),Yw(4,H,2,1,"p",3),Yw(5,U,2,0,"p",4)(6,z,2,0,"p",5)(7,G,2,0,"p",4)(8,Q,20,0,"div",6)),e&2&&(QE(),pg("query",a.rowFilter.query()),QE(3),Qw(a.deletion.error()?4:-1),QE(),Qw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,P,P$1],encapsulation:2})};export{j as PlatformAiModelsComponent};