@whoz-oss/coday-client 0.0.0-workstream-forge.228 → 0.0.0-workstream-forge.230

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 (53) hide show
  1. package/browser/{chunk-DKxnQYEw.js → chunk-3iWM1pUJ.js} +1 -1
  2. package/browser/{chunk-KxPMQW9g.js → chunk-B84B1DTB.js} +1 -1
  3. package/browser/{chunk-DVh_U_Pz.js → chunk-B8NR3gly.js} +1 -1
  4. package/browser/{chunk-CAOHsMU2.js → chunk-BA4i878Z.js} +1 -1
  5. package/browser/{chunk-DCCVtxUY.js → chunk-BAKv4OOf.js} +1 -1
  6. package/browser/{chunk-CgJ89AEq.js → chunk-BMhcJQjx.js} +1 -1
  7. package/browser/chunk-BOcSAL90.js +672 -0
  8. package/browser/{chunk-DZOFO-hq.js → chunk-BSWIz_Km.js} +1 -1
  9. package/browser/{chunk-DwTR8XO9.js → chunk-BX2XpHMR.js} +1 -1
  10. package/browser/{chunk-C2MCLvYa.js → chunk-BXYK9ddk.js} +1 -1
  11. package/browser/{chunk-CGDxWxaW.js → chunk-BYqwJbiA.js} +1 -1
  12. package/browser/{chunk-YshJHpGX.js → chunk-Bd8S8WUb.js} +1 -1
  13. package/browser/{chunk-CPRh25Ns.js → chunk-Bgu8hMmi.js} +1 -1
  14. package/browser/{chunk-Do3yjTGr.js → chunk-Bi-bGiSK.js} +1 -1
  15. package/browser/{chunk-7YWH-FdV.js → chunk-Bp8gQw3Y.js} +1 -1
  16. package/browser/{chunk-BgJ8ySs3.js → chunk-Bz-woDEt.js} +1 -1
  17. package/browser/{chunk-CTc3J6-o.js → chunk-C06RuD-b.js} +1 -1
  18. package/browser/{chunk-pWR46qVc.js → chunk-C4NG5Qhr.js} +1 -1
  19. package/browser/{chunk-BbULbTE-.js → chunk-CM8V0RXH.js} +1 -1
  20. package/browser/{chunk-B-t8V9u4.js → chunk-COdXRjZV.js} +1 -1
  21. package/browser/{chunk-BJoOTamk.js → chunk-CRqKTWwq.js} +1 -1
  22. package/browser/{chunk-BU8nA2oi.js → chunk-Cey_y2CV.js} +1 -1
  23. package/browser/{chunk-CdwiSnSZ.js → chunk-CftIqK3_.js} +1 -1
  24. package/browser/chunk-CiIonjNH.js +1 -0
  25. package/browser/{chunk-BNVtpBuz.js → chunk-ClOnvvKc.js} +1 -1
  26. package/browser/{chunk-DDVFqcYY.js → chunk-CmwPBjqS.js} +1 -1
  27. package/browser/chunk-CodMcnv-.js +1 -0
  28. package/browser/{chunk-B_CfL5ct.js → chunk-D1Ae_kle.js} +1 -1
  29. package/browser/{chunk-CQO1OiJR.js → chunk-DG5PeMsJ.js} +1 -1
  30. package/browser/{chunk-CSFdqw8r.js → chunk-DHUd7frd.js} +1 -1
  31. package/browser/{chunk-RQLqPysh.js → chunk-DLObebZ1.js} +1 -1
  32. package/browser/{chunk-6p69HsOa.js → chunk-DNLzFXoQ.js} +1 -1
  33. package/browser/{chunk-TeOKZRPI.js → chunk-DQwKP_yT.js} +1 -1
  34. package/browser/{chunk-CVaTzEB2.js → chunk-DWCZa3Pe.js} +1 -1
  35. package/browser/{chunk-qeffs5uB.js → chunk-Da8TCbbj.js} +1 -1
  36. package/browser/{chunk-Bjr7FKYe.js → chunk-DcwUNNhm.js} +1 -1
  37. package/browser/{chunk-ucWYVIhR.js → chunk-DkG7-_is.js} +1 -1
  38. package/browser/{chunk-wnG909KK.js → chunk-DlLKuR6k.js} +1 -1
  39. package/browser/{chunk-DewdYvKa.js → chunk-DtxVuetC.js} +1 -1
  40. package/browser/{chunk-Q-_uA4d5.js → chunk-Dzzg0QN7.js} +1 -1
  41. package/browser/{chunk-BpaAtA6H.js → chunk-Jq3zT61j.js} +1 -1
  42. package/browser/{chunk-C1xoalWH.js → chunk-KJMGa0UO.js} +1 -1
  43. package/browser/{chunk-CYPfAgi6.js → chunk-g63Z93Jt.js} +1 -1
  44. package/browser/{chunk-D7BuhvqM.js → chunk-qdtRFvyR.js} +1 -1
  45. package/browser/chunk-vxDhq3Xm.js +1 -0
  46. package/browser/{chunk-BkqVneOQ.js → chunk-yJewQfCQ.js} +1 -1
  47. package/browser/index.html +1 -1
  48. package/browser/{main-ZPG3XUQU.js → main-YOWURGI5.js} +3 -3
  49. package/package.json +1 -1
  50. package/browser/chunk-BEy6GrAQ.js +0 -1
  51. package/browser/chunk-Bs2lM6dc.js +0 -670
  52. package/browser/chunk-CHgX-NHl.js +0 -1
  53. package/browser/chunk-TuIJresS.js +0 -1
@@ -1 +1 @@
1
- import {O}from'./chunk-DDVFqcYY.js';import {v}from'./chunk-CAOHsMU2.js';import {g,W,F,I as Ie,U as Ui,a9 as F$1,an as Me,q as Af,G as U,y as yw,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,j as jw,Z as Zw,H as Hw,ao as Vw,_ as _I,l as lg,am as Bw,J as Jw,R as NI,m as Uw,v as vl,ae as Fw,O as Og,r as df,s as ff}from'./main-ZPG3XUQU.js';import {p as pt,E as Bt,T as Te,a as fn,d as pn,h as hn,e as cn,r as ln,g as dn,i as at,j as an,t as rn,U as Ut,n as nd,b as bo,x as xo,L as Lt,G as Gt,w as pa,m as mo,c as po,V as Vn,A as An,v as va,F as go,_ as _o}from'./chunk-Bs2lM6dc.js';import'./chunk-TuIJresS.js';function ge(o,t){o&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function be(o,t){if(o&1&&(Ds(0,"label",23),lg(1,"input",24),_I(),NC(2),pl()),o&2){let e=t.$implicit,r=Jw(3);BE(),ug("formControl",r.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!r.isAdmin()),NI(),BE(),vl(" ",e.label," ");}}function _e(o,t){if(o&1&&(Ds(0,"ds-fieldset",5),Hw(1,be,3,4,"label",23,Fw().trackByScope,true),pl()),o&2){let e=Jw(2);ug("disabled",e.isEditMode()),BE(),Uw(e.scopeOptions);}}function Ae(o,t){if(o&1&&(Ds(0,"option",8),NC(1),pl()),o&2){let e=t.$implicit;ug("value",e),BE(),Og(e);}}function Se(o,t){if(o&1){let e=Zw();Ds(0,"div",19),lg(1,"input",25),_I(),lg(2,"input",26),_I(),Ds(3,"button",27),mg("click",function(){let l=df(e).$index,f=Jw(2);return ff(f.removeHeader(l))}),NC(4," \xD7 "),pl()();}if(o&2){let e=t.$index;ug("formGroupName",e),BE(),NI(),BE(),NI();}}function Pe(o,t){if(o&1){let e=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let l=Jw();return ff(l.submit())}),Lw(1,_e,3,1,"ds-fieldset",5),Ds(2,"ds-form-field",6)(3,"select",7),Hw(4,Ae,2,2,"option",8,Vw),pl(),_I(),pl(),Ds(6,"ds-form-field",9),lg(7,"input",10),_I(),pl(),Ds(8,"ds-form-field",11),lg(9,"input",12),_I(),pl(),Ds(10,"ds-form-field",13),lg(11,"input",14),_I(),pl(),Ds(12,"ds-form-field",15),lg(13,"input",16),_I(),pl(),Ds(14,"ds-form-field",17)(15,"div",18),Hw(16,Se,5,1,"div",19,Bw),Ds(18,"div")(19,"button",20),mg("click",function(){df(e);let l=Jw();return ff(l.addHeader())}),NC(20,"+ Add header"),pl()()()(),Ds(21,"ds-form-actions")(22,"button",21),NC(23),pl(),Ds(24,"button",22),mg("click",function(){df(e);let l=Jw();return ff(l.cancel())}),NC(25,"Cancel"),pl()()();}if(o&2){let e=Jw();ug("formGroup",e.form),BE(),jw(e.isPlatformMode?-1:1),BE(2),ug("formControl",e.apiTypeControl),NI(),BE(),Uw(e.apiTypeOptions),BE(3),ug("formControl",e.nameControl),NI(),BE(2),ug("formControl",e.descriptionControl),NI(),BE(2),ug("formControl",e.baseUrlControl),NI(),BE(2),ug("formControl",e.apiKeyControl),NI(),BE(2),ug("formArrayName","headers"),BE(),Uw(e.headersArray.controls),BE(6),ug("disabled",e.form.invalid||e.isSubmitting()),BE(),vl(" ",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(Ie);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?Ui(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});apiTypeOptions=Object.values(Me);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:[fn.required,fn.minLength(1)]}),description:new Te(null),apiType:new Te("OpenAI",{nonNullable:true,validators:[fn.required]}),baseUrl:new Te("",{nonNullable:true}),apiKey:new Te("",{nonNullable:true}),scope:new Te("namespace",{nonNullable:true}),headers:new Bt([],{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:[fn.required]}),value:new Te("",{nonNullable:true})}));}removeHeader(t){this.headersArray.removeAt(t);}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);existingConfig=null;initialApiKey="";constructor(){this.isPlatformMode||Af(()=>{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:[fn.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=yw({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&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return r.cancel()}),NC(3," \u2190 AI providers "),pl()(),Lw(4,ge,2,0,"p",2)(5,Pe,26,10,"form",3),pl()),e&2&&(BE(),ug("title",r.isEditMode()?"Edit AI provider":"New AI provider"),BE(3),jw(r.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,at,an,rn,Ut,nd,bo,xo,Lt,Gt,pa,mo,po,Vn,An,va,go,_o],encapsulation:2})};export{ye as AiProviderFormComponent};
1
+ import {O}from'./chunk-CmwPBjqS.js';import {v}from'./chunk-BA4i878Z.js';import {g,W,F,I as Ie,U as Ui,a9 as F$1,an as Me,q as Af,G as U,y as yw,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,j as jw,Z as Zw,H as Hw,ao as Vw,_ as _I,l as lg,am as Bw,J as Jw,R as NI,m as Uw,v as vl,ae as Fw,O as Og,r as df,s as ff}from'./main-YOWURGI5.js';import {p as pt,E as Bt,T as Te,a as fn,d as pn,h as hn,e as cn,r as ln,g as dn,i as at,j as an,t as rn,U as Ut,n as nd,b as bo,x as xo,L as Lt,G as Gt,w as pa,m as mo,c as po,V as Vn,A as An,v as va,F as go,_ as _o}from'./chunk-BOcSAL90.js';import'./chunk-CodMcnv-.js';function ge(o,t){o&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function be(o,t){if(o&1&&(Ds(0,"label",23),lg(1,"input",24),_I(),NC(2),pl()),o&2){let e=t.$implicit,r=Jw(3);BE(),ug("formControl",r.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!r.isAdmin()),NI(),BE(),vl(" ",e.label," ");}}function _e(o,t){if(o&1&&(Ds(0,"ds-fieldset",5),Hw(1,be,3,4,"label",23,Fw().trackByScope,true),pl()),o&2){let e=Jw(2);ug("disabled",e.isEditMode()),BE(),Uw(e.scopeOptions);}}function Ae(o,t){if(o&1&&(Ds(0,"option",8),NC(1),pl()),o&2){let e=t.$implicit;ug("value",e),BE(),Og(e);}}function Se(o,t){if(o&1){let e=Zw();Ds(0,"div",19),lg(1,"input",25),_I(),lg(2,"input",26),_I(),Ds(3,"button",27),mg("click",function(){let l=df(e).$index,f=Jw(2);return ff(f.removeHeader(l))}),NC(4," \xD7 "),pl()();}if(o&2){let e=t.$index;ug("formGroupName",e),BE(),NI(),BE(),NI();}}function Pe(o,t){if(o&1){let e=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let l=Jw();return ff(l.submit())}),Lw(1,_e,3,1,"ds-fieldset",5),Ds(2,"ds-form-field",6)(3,"select",7),Hw(4,Ae,2,2,"option",8,Vw),pl(),_I(),pl(),Ds(6,"ds-form-field",9),lg(7,"input",10),_I(),pl(),Ds(8,"ds-form-field",11),lg(9,"input",12),_I(),pl(),Ds(10,"ds-form-field",13),lg(11,"input",14),_I(),pl(),Ds(12,"ds-form-field",15),lg(13,"input",16),_I(),pl(),Ds(14,"ds-form-field",17)(15,"div",18),Hw(16,Se,5,1,"div",19,Bw),Ds(18,"div")(19,"button",20),mg("click",function(){df(e);let l=Jw();return ff(l.addHeader())}),NC(20,"+ Add header"),pl()()()(),Ds(21,"ds-form-actions")(22,"button",21),NC(23),pl(),Ds(24,"button",22),mg("click",function(){df(e);let l=Jw();return ff(l.cancel())}),NC(25,"Cancel"),pl()()();}if(o&2){let e=Jw();ug("formGroup",e.form),BE(),jw(e.isPlatformMode?-1:1),BE(2),ug("formControl",e.apiTypeControl),NI(),BE(),Uw(e.apiTypeOptions),BE(3),ug("formControl",e.nameControl),NI(),BE(2),ug("formControl",e.descriptionControl),NI(),BE(2),ug("formControl",e.baseUrlControl),NI(),BE(2),ug("formControl",e.apiKeyControl),NI(),BE(2),ug("formArrayName","headers"),BE(),Uw(e.headersArray.controls),BE(6),ug("disabled",e.form.invalid||e.isSubmitting()),BE(),vl(" ",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(Ie);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?Ui(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});apiTypeOptions=Object.values(Me);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:[fn.required,fn.minLength(1)]}),description:new Te(null),apiType:new Te("OpenAI",{nonNullable:true,validators:[fn.required]}),baseUrl:new Te("",{nonNullable:true}),apiKey:new Te("",{nonNullable:true}),scope:new Te("namespace",{nonNullable:true}),headers:new Bt([],{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:[fn.required]}),value:new Te("",{nonNullable:true})}));}removeHeader(t){this.headersArray.removeAt(t);}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);existingConfig=null;initialApiKey="";constructor(){this.isPlatformMode||Af(()=>{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:[fn.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=yw({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&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return r.cancel()}),NC(3," \u2190 AI providers "),pl()(),Lw(4,ge,2,0,"p",2)(5,Pe,26,10,"form",3),pl()),e&2&&(BE(),ug("title",r.isEditMode()?"Edit AI provider":"New AI provider"),BE(3),jw(r.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,at,an,rn,Ut,nd,bo,xo,Lt,Gt,pa,mo,po,Vn,An,va,go,_o],encapsulation:2})};export{ye as AiProviderFormComponent};
@@ -1 +1 @@
1
- import {i}from'./chunk-TuIJresS.js';import {y}from'./chunk-Bs2lM6dc.js';import {g,af as G,aI as ve,$ as Cr,at as wy,a1 as fa,a2 as da,aa as Tr,ad as ne,aD as $y,a5 as yd,a6 as x}from'./main-ZPG3XUQU.js';var u=s=>s,N="none",w="me",O=class s{nsController=g(G);exportService=g(ve);userState=g(y);refresh$=new Cr(void 0);namespaceId$=new Cr(null);vm$=wy([this.namespaceId$,this.refresh$]).pipe(fa(([e])=>{let n=this.loadPlatformConfigs().pipe(da(()=>Tr([]))),t=this.loadUserConfigs("global").pipe(da(()=>Tr([])));return e?wy([n,this.loadNamespaceConfigs(e).pipe(da(()=>Tr([]))),this.loadUserConfigs(e).pipe(da(()=>Tr([]))),t]).pipe(ne(([i,r,c,g])=>({platform:i,namespace:r,userOnNs:c,userGlobal:g}))):wy([n,t]).pipe(ne(([i,r])=>({platform:i,namespace:[],userOnNs:[],userGlobal:r})))}),$y({bufferSize:1,refCount:true}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e);}refresh(){this.refresh$.next();}loadPlatformConfigs(){return this.nsController.listIntegrationConfig(N)}loadUserConfigs(e){let n=e==="global"?N:e;return this.nsController.listIntegrationConfig(n,w)}userGlobal$=i(this.refresh$,()=>this.loadUserConfigs("global"),[]);loadNamespaceConfigs(e){return e?this.nsController.listIntegrationConfig(e):Tr([])}getById(e,n){return this.nsController.getByIdIntegrationConfig(e)}create(e,n,t){let r=this.userState.currentUser()?.id;if((n==="userOnNs"||n==="userGlobal")&&!r)throw new Error(`Cannot create ${n} config before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(n==="platform"){let g={name:e.name,integrationType:e.integrationType,description:e.description,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(g)).pipe(yd(()=>this.refresh()))}if(n==="namespace"){if(!t)throw new Error("Cannot create namespace-scoped config without a namespaceId");let g={name:e.name,integrationType:e.integrationType,description:e.description,namespaceId:t,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(g)).pipe(yd(()=>this.refresh()))}if(n==="userOnNs"&&!t)throw new Error("Cannot create userOnNs config without a namespaceId");let c={name:e.name,integrationType:e.integrationType,description:e.description,userId:r,namespaceId:n==="userOnNs"?t:void 0,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(c)).pipe(yd(()=>this.refresh()))}update(e,n,t,i){let r={name:n.name,integrationType:n.integrationType,description:n.description,userId:i.userId,namespaceId:i.namespaceId,parameters:n.parameters,authSettingName:n.authSettingName??void 0,autoGrant:n.autoGrant??false};return this.nsController.updateIntegrationConfig(e,u(r)).pipe(yd(()=>this.refresh()))}delete(e,n){return this.nsController.deleteIntegrationConfig(e).pipe(yd(()=>this.refresh()))}exportAsYaml(e){return this.exportService.exportAsYaml(e)}static \u0275fac=function(n){return new(n||s)};static \u0275prov=x({token:s,factory:s.\u0275fac,providedIn:"root"})};export{O};
1
+ import {i}from'./chunk-CodMcnv-.js';import {y}from'./chunk-BOcSAL90.js';import {g,af as G,aI as ve,$ as Cr,at as wy,a1 as fa,a2 as da,aa as Tr,ad as ne,aD as $y,a5 as yd,a6 as x}from'./main-YOWURGI5.js';var u=s=>s,N="none",w="me",O=class s{nsController=g(G);exportService=g(ve);userState=g(y);refresh$=new Cr(void 0);namespaceId$=new Cr(null);vm$=wy([this.namespaceId$,this.refresh$]).pipe(fa(([e])=>{let n=this.loadPlatformConfigs().pipe(da(()=>Tr([]))),t=this.loadUserConfigs("global").pipe(da(()=>Tr([])));return e?wy([n,this.loadNamespaceConfigs(e).pipe(da(()=>Tr([]))),this.loadUserConfigs(e).pipe(da(()=>Tr([]))),t]).pipe(ne(([i,r,c,g])=>({platform:i,namespace:r,userOnNs:c,userGlobal:g}))):wy([n,t]).pipe(ne(([i,r])=>({platform:i,namespace:[],userOnNs:[],userGlobal:r})))}),$y({bufferSize:1,refCount:true}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e);}refresh(){this.refresh$.next();}loadPlatformConfigs(){return this.nsController.listIntegrationConfig(N)}loadUserConfigs(e){let n=e==="global"?N:e;return this.nsController.listIntegrationConfig(n,w)}userGlobal$=i(this.refresh$,()=>this.loadUserConfigs("global"),[]);loadNamespaceConfigs(e){return e?this.nsController.listIntegrationConfig(e):Tr([])}getById(e,n){return this.nsController.getByIdIntegrationConfig(e)}create(e,n,t){let r=this.userState.currentUser()?.id;if((n==="userOnNs"||n==="userGlobal")&&!r)throw new Error(`Cannot create ${n} config before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(n==="platform"){let g={name:e.name,integrationType:e.integrationType,description:e.description,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(g)).pipe(yd(()=>this.refresh()))}if(n==="namespace"){if(!t)throw new Error("Cannot create namespace-scoped config without a namespaceId");let g={name:e.name,integrationType:e.integrationType,description:e.description,namespaceId:t,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(g)).pipe(yd(()=>this.refresh()))}if(n==="userOnNs"&&!t)throw new Error("Cannot create userOnNs config without a namespaceId");let c={name:e.name,integrationType:e.integrationType,description:e.description,userId:r,namespaceId:n==="userOnNs"?t:void 0,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(c)).pipe(yd(()=>this.refresh()))}update(e,n,t,i){let r={name:n.name,integrationType:n.integrationType,description:n.description,userId:i.userId,namespaceId:i.namespaceId,parameters:n.parameters,authSettingName:n.authSettingName??void 0,autoGrant:n.autoGrant??false};return this.nsController.updateIntegrationConfig(e,u(r)).pipe(yd(()=>this.refresh()))}delete(e,n){return this.nsController.deleteIntegrationConfig(e).pipe(yd(()=>this.refresh()))}exportAsYaml(e){return this.exportService.exportAsYaml(e)}static \u0275fac=function(n){return new(n||s)};static \u0275prov=x({token:s,factory:s.\u0275fac,providedIn:"root"})};export{O};
@@ -1 +1 @@
1
- import {D as m,z as k,O as O$1,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-Bs2lM6dc.js';import {g,W as W$1,F,I as Ie,$ as Cr,U as Ui,a1 as fa,ac as Ty,a2 as da,aa as Tr,G as U$1,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,H as Hw,m as Uw,v as vl,Z as Zw,r as df,s as ff,k as cg}from'./main-ZPG3XUQU.js';var U=(n,e)=>e.key;function z(n,e){if(n&1&&(Ds(0,"p",3),NC(1),pl()),n&2){let t=Jw();BE(),Og(t.deletion.error());}}function G(n,e){n&1&&(Ds(0,"p",4),NC(1,"Loading prompts\u2026"),pl());}function O(n,e){n&1&&(Ds(0,"p",5),NC(1,"No prompts available."),pl());}function Q(n,e){n&1&&(Ds(0,"p",4),NC(1,"No prompts match the current filter."),pl());}function W(n,e){n&1&&(Ds(0,"ds-tag",17),NC(1,"Read-only"),pl());}function X(n,e){if(n&1){let t=Zw();Ds(0,"button",23),mg("click",function(){df(t);let l=Jw(2).$implicit,m=Jw(2);return ff(m.edit(l))}),NC(1," Edit "),pl();}if(n&2){let t=Jw(2).$implicit;cg("aria-label","Edit "+t.prompt.name);}}function Y(n,e){if(n&1){let t=Zw();Lw(0,X,2,1,"button",21),Ds(1,"agentos-row-delete-action",22),mg("deleteRequested",function(){df(t);let l=Jw().$implicit,m=Jw(2);return ff(m.deletion.request(l.key))})("deleteConfirmed",function(){df(t);let l=Jw().$implicit,m=Jw(2);return ff(m.confirmDelete(l))})("deleteCancelled",function(){df(t);let l=Jw(3);return ff(l.deletion.cancel())}),pl();}if(n&2){let t=Jw().$implicit,i=Jw(2);jw(i.deletion.confirmingId()!==t.key?0:-1),BE(),ug("rowKey",t.key)("rowLabel",t.prompt.name)("state",i.deletion);}}function Z(n,e){n&1&&(Ds(0,"button",20),NC(1,"Inherited"),pl());}function ee(n,e){if(n&1&&(Ds(0,"tr",9)(1,"td",12),NC(2),pl(),Ds(3,"td",13),NC(4),pl(),Ds(5,"td",14)(6,"div",15)(7,"ds-tag",16),NC(8),pl(),Lw(9,W,2,0,"ds-tag",17),pl()(),Ds(10,"td",18)(11,"div",19),Lw(12,Y,2,4)(13,Z,2,0,"button",20),pl()()()),n&2){let t=e.$implicit;BE(2),Og(t.prompt.name),BE(2),vl(" ",t.prompt.description||"\u2014"," "),BE(3),ug("variant",t.scope==="platform"?"neutral":"accent"),BE(),Og(t.scope==="platform"?"Platform":"Namespace"),BE(),jw(t.scope==="platform"?9:-1),BE(3),jw(t.scope==="namespace"?12:13);}}function te(n,e){if(n&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"Description"),pl(),Ds(8,"th",10),NC(9,"Scope"),pl(),Ds(10,"th",10)(11,"span",11),NC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Hw(14,ee,14,6,"tr",9,U),pl()()()),n&2){let t=Jw();BE(14),Uw(t.rowFilter.filteredRows());}}var J=class n{route=g(W$1);router=g(F);destroyRef=g(Ie);promptState=g(m);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k();rows=Ui([]);rowFilter=O$1(this.rows,e=>[e.prompt.name,e.prompt.description,e.scope].filter(Boolean).join(" "));allPrompts$=this.refresh$.pipe(fa(()=>(this.isLoading.set(true),Ty({platform:this.promptState.listPlatform().pipe(da(()=>Tr([]))),namespace:this.promptState.listByNamespace(this.namespaceId)}))));constructor(){this.allPrompts$.pipe(U$1(this.destroyRef)).subscribe({next:({platform:e,namespace:t})=>{this.rows.set([...e.map((i,l)=>({key:`platform:${i.id??l}`,prompt:i,scope:"platform"})),...t.map((i,l)=>({key:`namespace:${i.id??l}`,prompt:i,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"prompts","new"]);}edit(e){e.scope==="platform"||!e.prompt.id||this.router.navigate(["/agentos",this.namespaceId,"prompts",e.prompt.id,"edit"]);}confirmDelete(e){e.scope==="platform"||!e.prompt.id||this.deletion.execute(e.key,{request$:this.promptState.delete(e.prompt.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.prompt.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=yw({type:n,selectors:[["agentos-namespace-prompts"]],decls:9,vars:3,consts:[["title","Prompts","description","Prompts available in this namespace, including prompts inherited from the platform."],["label","Filter prompts","placeholder","Filter prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(t,i){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return i.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return i.openCreateForm()}),NC(3,"New prompt"),pl()(),Lw(4,z,2,1,"p",3),Lw(5,G,2,0,"p",4)(6,O,2,0,"p",5)(7,Q,2,0,"p",4)(8,te,16,0,"div",6)),t&2&&(BE(),ug("query",i.rowFilter.query()),BE(3),jw(i.deletion.error()?4:-1),BE(),jw(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{J as NamespacePromptsComponent};
1
+ import {D as m,z as k,O as O$1,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-BOcSAL90.js';import {g,W as W$1,F,I as Ie,$ as Cr,U as Ui,a1 as fa,ac as Ty,a2 as da,aa as Tr,G as U$1,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,H as Hw,m as Uw,v as vl,Z as Zw,r as df,s as ff,k as cg}from'./main-YOWURGI5.js';var U=(n,e)=>e.key;function z(n,e){if(n&1&&(Ds(0,"p",3),NC(1),pl()),n&2){let t=Jw();BE(),Og(t.deletion.error());}}function G(n,e){n&1&&(Ds(0,"p",4),NC(1,"Loading prompts\u2026"),pl());}function O(n,e){n&1&&(Ds(0,"p",5),NC(1,"No prompts available."),pl());}function Q(n,e){n&1&&(Ds(0,"p",4),NC(1,"No prompts match the current filter."),pl());}function W(n,e){n&1&&(Ds(0,"ds-tag",17),NC(1,"Read-only"),pl());}function X(n,e){if(n&1){let t=Zw();Ds(0,"button",23),mg("click",function(){df(t);let l=Jw(2).$implicit,m=Jw(2);return ff(m.edit(l))}),NC(1," Edit "),pl();}if(n&2){let t=Jw(2).$implicit;cg("aria-label","Edit "+t.prompt.name);}}function Y(n,e){if(n&1){let t=Zw();Lw(0,X,2,1,"button",21),Ds(1,"agentos-row-delete-action",22),mg("deleteRequested",function(){df(t);let l=Jw().$implicit,m=Jw(2);return ff(m.deletion.request(l.key))})("deleteConfirmed",function(){df(t);let l=Jw().$implicit,m=Jw(2);return ff(m.confirmDelete(l))})("deleteCancelled",function(){df(t);let l=Jw(3);return ff(l.deletion.cancel())}),pl();}if(n&2){let t=Jw().$implicit,i=Jw(2);jw(i.deletion.confirmingId()!==t.key?0:-1),BE(),ug("rowKey",t.key)("rowLabel",t.prompt.name)("state",i.deletion);}}function Z(n,e){n&1&&(Ds(0,"button",20),NC(1,"Inherited"),pl());}function ee(n,e){if(n&1&&(Ds(0,"tr",9)(1,"td",12),NC(2),pl(),Ds(3,"td",13),NC(4),pl(),Ds(5,"td",14)(6,"div",15)(7,"ds-tag",16),NC(8),pl(),Lw(9,W,2,0,"ds-tag",17),pl()(),Ds(10,"td",18)(11,"div",19),Lw(12,Y,2,4)(13,Z,2,0,"button",20),pl()()()),n&2){let t=e.$implicit;BE(2),Og(t.prompt.name),BE(2),vl(" ",t.prompt.description||"\u2014"," "),BE(3),ug("variant",t.scope==="platform"?"neutral":"accent"),BE(),Og(t.scope==="platform"?"Platform":"Namespace"),BE(),jw(t.scope==="platform"?9:-1),BE(3),jw(t.scope==="namespace"?12:13);}}function te(n,e){if(n&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"Description"),pl(),Ds(8,"th",10),NC(9,"Scope"),pl(),Ds(10,"th",10)(11,"span",11),NC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Hw(14,ee,14,6,"tr",9,U),pl()()()),n&2){let t=Jw();BE(14),Uw(t.rowFilter.filteredRows());}}var J=class n{route=g(W$1);router=g(F);destroyRef=g(Ie);promptState=g(m);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k();rows=Ui([]);rowFilter=O$1(this.rows,e=>[e.prompt.name,e.prompt.description,e.scope].filter(Boolean).join(" "));allPrompts$=this.refresh$.pipe(fa(()=>(this.isLoading.set(true),Ty({platform:this.promptState.listPlatform().pipe(da(()=>Tr([]))),namespace:this.promptState.listByNamespace(this.namespaceId)}))));constructor(){this.allPrompts$.pipe(U$1(this.destroyRef)).subscribe({next:({platform:e,namespace:t})=>{this.rows.set([...e.map((i,l)=>({key:`platform:${i.id??l}`,prompt:i,scope:"platform"})),...t.map((i,l)=>({key:`namespace:${i.id??l}`,prompt:i,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"prompts","new"]);}edit(e){e.scope==="platform"||!e.prompt.id||this.router.navigate(["/agentos",this.namespaceId,"prompts",e.prompt.id,"edit"]);}confirmDelete(e){e.scope==="platform"||!e.prompt.id||this.deletion.execute(e.key,{request$:this.promptState.delete(e.prompt.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.prompt.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=yw({type:n,selectors:[["agentos-namespace-prompts"]],decls:9,vars:3,consts:[["title","Prompts","description","Prompts available in this namespace, including prompts inherited from the platform."],["label","Filter prompts","placeholder","Filter prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(t,i){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return i.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return i.openCreateForm()}),NC(3,"New prompt"),pl()(),Lw(4,z,2,1,"p",3),Lw(5,G,2,0,"p",4)(6,O,2,0,"p",5)(7,Q,2,0,"p",4)(8,te,16,0,"div",6)),t&2&&(BE(),ug("query",i.rowFilter.query()),BE(3),jw(i.deletion.error()?4:-1),BE(),jw(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{J as NamespacePromptsComponent};
@@ -1 +1 @@
1
- import {O as O$1}from'./chunk-6p69HsOa.js';import {g,F,I as Ie,af as G$1,$ as Cr,U as Ui,a1 as fa,G as U$1,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,H as Hw,m as Uw,Z as Zw,k as cg,r as df,s as ff}from'./main-ZPG3XUQU.js';import {z as k,O as O$2,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-Bs2lM6dc.js';import'./chunk-TuIJresS.js';var j=(t,e)=>e.id??e.name;function A(t,e){if(t&1&&(Ds(0,"p",3),NC(1),pl()),t&2){let n=Jw();BE(),Og(n.deletion.error());}}function K(t,e){t&1&&(Ds(0,"p",4),NC(1,"Loading integrations\u2026"),pl());}function H(t,e){t&1&&(Ds(0,"p",5),NC(1,"No platform integrations defined yet."),pl());}function U(t,e){t&1&&(Ds(0,"p",4),NC(1,"No integrations match the current filter."),pl());}function z(t,e){if(t&1){let n=Zw();Ds(0,"button",18),mg("click",function(){df(n);let d=Jw().$implicit,m=Jw(2);return ff(m.edit(d))}),NC(1,"Edit"),pl();}if(t&2){let n=Jw().$implicit;cg("aria-label","Edit "+n.name);}}function G(t,e){if(t&1){let n=Zw();Ds(0,"agentos-row-delete-action",19),mg("deleteRequested",function(){df(n);let d=Jw().$implicit,m=Jw(2);return ff(m.deletion.request(d.id))})("deleteConfirmed",function(){df(n);let d=Jw().$implicit,m=Jw(2);return ff(m.confirmDelete(d))})("deleteCancelled",function(){df(n);let d=Jw(3);return ff(d.deletion.cancel())}),pl();}if(t&2){let n=Jw().$implicit,r=Jw(2);ug("rowKey",n.id)("rowLabel",n.name)("state",r.deletion);}}function J(t,e){if(t&1&&(Ds(0,"tr",9)(1,"td",12),NC(2),pl(),Ds(3,"td",13),NC(4),pl(),Ds(5,"td",14)(6,"div",15),Lw(7,z,2,1,"button",16),Lw(8,G,1,3,"agentos-row-delete-action",17),pl()()()),t&2){let n=e.$implicit,r=Jw(2);BE(2),Og(n.name),BE(2),Og(n.integrationType),BE(3),jw(r.deletion.confirmingId()!==n.id?7:-1),BE(),jw(n.id?8:-1);}}function O(t,e){if(t&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"Type"),pl(),Ds(8,"th",10)(9,"span",11),NC(10,"Actions"),pl()()()(),Ds(11,"tbody",8),Hw(12,J,9,4,"tr",9,j),pl()()()),t&2){let n=Jw();BE(12),Uw(n.rowFilter.filteredRows());}}var B=class t{router=g(F);destroyRef=g(Ie);state=g(O$1);integrationConfigController=g(G$1);refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k();configs=Ui([]);rowFilter=O$2(this.configs,e=>[e.name,e.integrationType].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.state.loadPlatformConfigs())),U$1(this.destroyRef)).subscribe({next:e=>{this.configs.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","integration-configs","new"]);}edit(e){this.router.navigate(["/agentos","admin","integration-configs",e.id??"","edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.integrationConfigController.deleteIntegrationConfig(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=yw({type:t,selectors:[["agentos-platform-integration-configs"]],decls:9,vars:3,consts:[["title","Platform integrations","description","Integration configurations shared across every namespace."],["label","Filter integrations","placeholder","Filter integrations\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform integrations"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Type",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(n,r){n&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return r.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return r.openCreateForm()}),NC(3,"New integration"),pl()(),Lw(4,A,2,1,"p",3),Lw(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&&(BE(),ug("query",r.rowFilter.query()),BE(3),jw(r.deletion.error()?4:-1),BE(),jw(r.isLoading()?5:r.configs().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{B as PlatformIntegrationConfigsComponent};
1
+ import {O as O$1}from'./chunk-DNLzFXoQ.js';import {g,F,I as Ie,af as G$1,$ as Cr,U as Ui,a1 as fa,G as U$1,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,H as Hw,m as Uw,Z as Zw,k as cg,r as df,s as ff}from'./main-YOWURGI5.js';import {z as k,O as O$2,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-BOcSAL90.js';import'./chunk-CodMcnv-.js';var j=(t,e)=>e.id??e.name;function A(t,e){if(t&1&&(Ds(0,"p",3),NC(1),pl()),t&2){let n=Jw();BE(),Og(n.deletion.error());}}function K(t,e){t&1&&(Ds(0,"p",4),NC(1,"Loading integrations\u2026"),pl());}function H(t,e){t&1&&(Ds(0,"p",5),NC(1,"No platform integrations defined yet."),pl());}function U(t,e){t&1&&(Ds(0,"p",4),NC(1,"No integrations match the current filter."),pl());}function z(t,e){if(t&1){let n=Zw();Ds(0,"button",18),mg("click",function(){df(n);let d=Jw().$implicit,m=Jw(2);return ff(m.edit(d))}),NC(1,"Edit"),pl();}if(t&2){let n=Jw().$implicit;cg("aria-label","Edit "+n.name);}}function G(t,e){if(t&1){let n=Zw();Ds(0,"agentos-row-delete-action",19),mg("deleteRequested",function(){df(n);let d=Jw().$implicit,m=Jw(2);return ff(m.deletion.request(d.id))})("deleteConfirmed",function(){df(n);let d=Jw().$implicit,m=Jw(2);return ff(m.confirmDelete(d))})("deleteCancelled",function(){df(n);let d=Jw(3);return ff(d.deletion.cancel())}),pl();}if(t&2){let n=Jw().$implicit,r=Jw(2);ug("rowKey",n.id)("rowLabel",n.name)("state",r.deletion);}}function J(t,e){if(t&1&&(Ds(0,"tr",9)(1,"td",12),NC(2),pl(),Ds(3,"td",13),NC(4),pl(),Ds(5,"td",14)(6,"div",15),Lw(7,z,2,1,"button",16),Lw(8,G,1,3,"agentos-row-delete-action",17),pl()()()),t&2){let n=e.$implicit,r=Jw(2);BE(2),Og(n.name),BE(2),Og(n.integrationType),BE(3),jw(r.deletion.confirmingId()!==n.id?7:-1),BE(),jw(n.id?8:-1);}}function O(t,e){if(t&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"Type"),pl(),Ds(8,"th",10)(9,"span",11),NC(10,"Actions"),pl()()()(),Ds(11,"tbody",8),Hw(12,J,9,4,"tr",9,j),pl()()()),t&2){let n=Jw();BE(12),Uw(n.rowFilter.filteredRows());}}var B=class t{router=g(F);destroyRef=g(Ie);state=g(O$1);integrationConfigController=g(G$1);refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k();configs=Ui([]);rowFilter=O$2(this.configs,e=>[e.name,e.integrationType].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.state.loadPlatformConfigs())),U$1(this.destroyRef)).subscribe({next:e=>{this.configs.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","integration-configs","new"]);}edit(e){this.router.navigate(["/agentos","admin","integration-configs",e.id??"","edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.integrationConfigController.deleteIntegrationConfig(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=yw({type:t,selectors:[["agentos-platform-integration-configs"]],decls:9,vars:3,consts:[["title","Platform integrations","description","Integration configurations shared across every namespace."],["label","Filter integrations","placeholder","Filter integrations\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform integrations"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Type",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(n,r){n&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return r.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return r.openCreateForm()}),NC(3,"New integration"),pl()(),Lw(4,A,2,1,"p",3),Lw(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&&(BE(),ug("query",r.rowFilter.query()),BE(3),jw(r.deletion.error()?4:-1),BE(),jw(r.isLoading()?5:r.configs().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{B as PlatformIntegrationConfigsComponent};
@@ -1 +1 @@
1
- import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-CAOHsMU2.js';import {I}from'./chunk-7YWH-FdV.js';import {g,W,F,I as Ie,U as Ui,G as U,ad as ne$1,a1 as fa,aa as Tr,aL as ci,a2 as da,ac as Ty,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,u as vC,k as cg,v as vl,H as Hw,m as Uw,Z as Zw,r as df,s as ff}from'./main-ZPG3XUQU.js';import {z as k,O,a3 as w,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-Bs2lM6dc.js';import'./chunk-TuIJresS.js';var Q=(i,t)=>t.key;function X(i,t){if(i&1&&(Ds(0,"p",3),NC(1),pl()),i&2){let e=Jw();BE(),Og(e.deletion.error());}}function Z(i,t){if(i&1&&(Ds(0,"p"),NC(1),pl()),i&2){let e=t;vC(e.kind==="error"?"settings-table__error":"settings-table__status"),cg("role",e.kind==="error"?"alert":"status"),BE(),vl(" ",e.text," ");}}function ee(i,t){i&1&&(Ds(0,"p",5),NC(1,"Loading auth settings\u2026"),pl());}function te(i,t){i&1&&(Ds(0,"p",6),NC(1,"No auth settings available."),pl());}function ne(i,t){i&1&&(Ds(0,"p",5),NC(1,"No auth settings match the current filter."),pl());}function ie(i,t){i&1&&(Ds(0,"ds-tag",18),NC(1,"Read-only"),pl());}function oe(i,t){i&1&&(Ds(0,"ds-tag",20),NC(1,"Connected"),pl());}function ae(i,t){i&1&&(Ds(0,"ds-tag",18),NC(1,"Not connected"),pl());}function se(i,t){i&1&&(Ds(0,"span",21),NC(1,"\u2014"),pl());}function re(i,t){if(i&1){let e=Zw();Ds(0,"span",26),NC(1,"Waiting for authorization\u2026"),pl(),Ds(2,"button",27),mg("click",function(){df(e);let r=Jw(4);return ff(r.cancelConnect())}),NC(3," Cancel "),pl();}if(i&2){let e=Jw(2).$implicit;BE(2),cg("aria-label","Stop waiting for the authorization of "+e.config.name);}}function le(i,t){if(i&1){let e=Zw();Ds(0,"span",28),NC(1,"Disconnect?"),pl(),Ds(2,"button",29),mg("click",function(){df(e);let r=Jw(2).$implicit,d=Jw(2);return ff(d.confirmReset(r))}),NC(3),pl(),Ds(4,"button",29),mg("click",function(){df(e);let r=Jw(4);return ff(r.cancelReset())}),NC(5," Cancel "),pl();}if(i&2){let e=Jw(2).$implicit,n=Jw(2);BE(2),ug("disabled",n.resettingKey()===e.key),cg("aria-label","Confirm disconnecting "+e.config.name),BE(),vl(" ",n.resettingKey()===e.key?"Disconnecting\u2026":"Confirm"," "),BE(),ug("disabled",n.resettingKey()===e.key),cg("aria-label","Cancel disconnecting "+e.config.name);}}function ce(i,t){if(i&1){let e=Zw();Ds(0,"button",29),mg("click",function(){df(e);let r=Jw(3).$implicit,d=Jw(2);return ff(d.requestReset(r))}),NC(1," Disconnect "),pl();}if(i&2){let e=Jw(3).$implicit,n=Jw(2);ug("disabled",n.connectingKey()!==null),cg("aria-label","Disconnect "+e.config.name);}}function de(i,t){if(i&1){let e=Zw();Ds(0,"button",29),mg("click",function(){df(e);let r=Jw(2).$implicit,d=Jw(2);return ff(d.connect(r))}),NC(1),pl(),Lw(2,ce,2,2,"button",30);}if(i&2){let e=Jw(2).$implicit,n=Jw(2);ug("disabled",n.connectingKey()!==null||n.resettingKey()!==null),cg("aria-label",(n.connectionOf(e)==="connected"?"Reconnect ":"Connect ")+e.config.name),BE(),vl(" ",n.connectionOf(e)==="connected"?"Reconnect":"Connect"," "),BE(),jw(n.connectionOf(e)==="connected"?2:-1);}}function pe(i,t){if(i&1&&Lw(0,re,4,1)(1,le,6,5)(2,de,3,4),i&2){let e=Jw().$implicit,n=Jw(2);jw(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=Zw();Ds(0,"button",27),mg("click",function(){df(e);let r=Jw().$implicit,d=Jw(2);return ff(d.duplicate(r))}),NC(1," Duplicate "),pl();}if(i&2){let e=Jw().$implicit;cg("aria-label","Duplicate "+e.config.name);}}function _e(i,t){if(i&1){let e=Zw();Ds(0,"button",27),mg("click",function(){df(e);let r=Jw(2).$implicit,d=Jw(2);return ff(d.edit(r))}),NC(1," Edit "),pl();}if(i&2){let e=Jw(2).$implicit;cg("aria-label","Edit "+e.config.name);}}function me(i,t){if(i&1){let e=Zw();Lw(0,_e,2,1,"button",24),Ds(1,"agentos-row-delete-action",31),mg("deleteRequested",function(){df(e);let r=Jw().$implicit,d=Jw(2);return ff(d.deletion.request(r.key))})("deleteConfirmed",function(){df(e);let r=Jw().$implicit,d=Jw(2);return ff(d.confirmDelete(r))})("deleteCancelled",function(){df(e);let r=Jw(3);return ff(r.deletion.cancel())}),pl();}if(i&2){let e=Jw().$implicit,n=Jw(2);jw(n.deletion.confirmingId()!==e.key?0:-1),BE(),ug("rowKey",e.key)("rowLabel",e.config.name)("state",n.deletion);}}function ge(i,t){i&1&&(Ds(0,"button",25),NC(1,"Inherited"),pl());}function he(i,t){if(i&1&&(Ds(0,"tr",10)(1,"td",13),NC(2),pl(),Ds(3,"td",14),NC(4),pl(),Ds(5,"td",15)(6,"div",16)(7,"ds-tag",17),NC(8),pl(),Lw(9,ie,2,0,"ds-tag",18),pl()(),Ds(10,"td",19),Lw(11,oe,2,0,"ds-tag",20)(12,ae,2,0,"ds-tag",18)(13,se,2,0,"span",21),pl(),Ds(14,"td",22)(15,"div",23),Lw(16,pe,3,1),Lw(17,ue,2,1,"button",24),Lw(18,me,2,4)(19,ge,2,0,"button",25),pl()()()),i&2){let e=t.$implicit,n=Jw(2);BE(2),Og(e.config.name),BE(2),vl(" ",e.config.authType," "),BE(3),ug("variant",e.scopeLabel==="Platform"?"neutral":e.scopeLabel==="Personal"?"outline":"accent"),BE(),Og(e.scopeLabel),BE(),jw(e.canMutate?-1:9),BE(2),jw(n.isOAuth(e)&&n.connectionOf(e)==="connected"?11:n.isOAuth(e)&&n.connectionOf(e)==="disconnected"?12:13),BE(5),jw(n.isOAuth(e)?16:-1),BE(),jw(n.deletion.confirmingId()!==e.key&&n.resetConfirmingKey()!==e.key&&n.connectingKey()!==e.key?17:-1),BE(),jw(e.canMutate?18:19);}}function Ce(i,t){if(i&1&&(Ds(0,"div",7)(1,"table",8)(2,"thead",9)(3,"tr",10)(4,"th",11),NC(5,"Name"),pl(),Ds(6,"th",11),NC(7,"Authentication type"),pl(),Ds(8,"th",11),NC(9,"Scope"),pl(),Ds(10,"th",11),NC(11,"Connection"),pl(),Ds(12,"th",11)(13,"span",12),NC(14,"Actions"),pl()()()(),Ds(15,"tbody",9),Hw(16,he,20,9,"tr",10,Q),pl()()()),i&2){let e=Jw();BE(16),Uw(e.rowFilter.filteredRows());}}var fe=new Set(["OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"]),J=class i{route=g(W);router=g(F);destroyRef=g(Ie);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=Ui(false);isLoading=Ui(true);rows=Ui([]);deletion=k();connections=Ui({});connectingKey=Ui(null);resetConfirmingKey=Ui(null);resettingKey=Ui(null);actionMessage=Ui(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")??""),fa(t=>t?this.namespaceRole.isAdminOfNamespace$(t):Tr(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(ci(()=>{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"]),da(()=>Tr([e.key,"unknown"]))));if(t.length===0){this.connections.set({});return}this.connectionsLoad=Ty(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=yw({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&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(d){return n.rowFilter.query.set(d)}),pl(),Ds(2,"button",2),mg("click",function(){return n.openCreateForm()}),NC(3,"New auth setting"),pl()(),Lw(4,X,2,1,"p",3),Lw(5,Z,2,4,"p",4),Lw(6,ee,2,0,"p",5)(7,te,2,0,"p",6)(8,ne,2,0,"p",5)(9,Ce,18,0,"div",7)),e&2){let r;BE(),ug("query",n.rowFilter.query()),BE(3),jw(n.deletion.error()?4:-1),BE(),jw((r=n.actionMessage())?5:-1,r),BE(),jw(n.isLoading()?6:n.rows().length===0?7:n.rowFilter.filteredRows().length===0?8:9);}},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{J as AuthSettingsAllScopesComponent};
1
+ import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-BA4i878Z.js';import {I}from'./chunk-Bp8gQw3Y.js';import {g,W,F,I as Ie,U as Ui,G as U,ad as ne$1,a1 as fa,aa as Tr,aL as ci,a2 as da,ac as Ty,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,u as vC,k as cg,v as vl,H as Hw,m as Uw,Z as Zw,r as df,s as ff}from'./main-YOWURGI5.js';import {z as k,O,a5 as w,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-BOcSAL90.js';import'./chunk-CodMcnv-.js';var Q=(i,t)=>t.key;function X(i,t){if(i&1&&(Ds(0,"p",3),NC(1),pl()),i&2){let e=Jw();BE(),Og(e.deletion.error());}}function Z(i,t){if(i&1&&(Ds(0,"p"),NC(1),pl()),i&2){let e=t;vC(e.kind==="error"?"settings-table__error":"settings-table__status"),cg("role",e.kind==="error"?"alert":"status"),BE(),vl(" ",e.text," ");}}function ee(i,t){i&1&&(Ds(0,"p",5),NC(1,"Loading auth settings\u2026"),pl());}function te(i,t){i&1&&(Ds(0,"p",6),NC(1,"No auth settings available."),pl());}function ne(i,t){i&1&&(Ds(0,"p",5),NC(1,"No auth settings match the current filter."),pl());}function ie(i,t){i&1&&(Ds(0,"ds-tag",18),NC(1,"Read-only"),pl());}function oe(i,t){i&1&&(Ds(0,"ds-tag",20),NC(1,"Connected"),pl());}function ae(i,t){i&1&&(Ds(0,"ds-tag",18),NC(1,"Not connected"),pl());}function se(i,t){i&1&&(Ds(0,"span",21),NC(1,"\u2014"),pl());}function re(i,t){if(i&1){let e=Zw();Ds(0,"span",26),NC(1,"Waiting for authorization\u2026"),pl(),Ds(2,"button",27),mg("click",function(){df(e);let r=Jw(4);return ff(r.cancelConnect())}),NC(3," Cancel "),pl();}if(i&2){let e=Jw(2).$implicit;BE(2),cg("aria-label","Stop waiting for the authorization of "+e.config.name);}}function le(i,t){if(i&1){let e=Zw();Ds(0,"span",28),NC(1,"Disconnect?"),pl(),Ds(2,"button",29),mg("click",function(){df(e);let r=Jw(2).$implicit,d=Jw(2);return ff(d.confirmReset(r))}),NC(3),pl(),Ds(4,"button",29),mg("click",function(){df(e);let r=Jw(4);return ff(r.cancelReset())}),NC(5," Cancel "),pl();}if(i&2){let e=Jw(2).$implicit,n=Jw(2);BE(2),ug("disabled",n.resettingKey()===e.key),cg("aria-label","Confirm disconnecting "+e.config.name),BE(),vl(" ",n.resettingKey()===e.key?"Disconnecting\u2026":"Confirm"," "),BE(),ug("disabled",n.resettingKey()===e.key),cg("aria-label","Cancel disconnecting "+e.config.name);}}function ce(i,t){if(i&1){let e=Zw();Ds(0,"button",29),mg("click",function(){df(e);let r=Jw(3).$implicit,d=Jw(2);return ff(d.requestReset(r))}),NC(1," Disconnect "),pl();}if(i&2){let e=Jw(3).$implicit,n=Jw(2);ug("disabled",n.connectingKey()!==null),cg("aria-label","Disconnect "+e.config.name);}}function de(i,t){if(i&1){let e=Zw();Ds(0,"button",29),mg("click",function(){df(e);let r=Jw(2).$implicit,d=Jw(2);return ff(d.connect(r))}),NC(1),pl(),Lw(2,ce,2,2,"button",30);}if(i&2){let e=Jw(2).$implicit,n=Jw(2);ug("disabled",n.connectingKey()!==null||n.resettingKey()!==null),cg("aria-label",(n.connectionOf(e)==="connected"?"Reconnect ":"Connect ")+e.config.name),BE(),vl(" ",n.connectionOf(e)==="connected"?"Reconnect":"Connect"," "),BE(),jw(n.connectionOf(e)==="connected"?2:-1);}}function pe(i,t){if(i&1&&Lw(0,re,4,1)(1,le,6,5)(2,de,3,4),i&2){let e=Jw().$implicit,n=Jw(2);jw(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=Zw();Ds(0,"button",27),mg("click",function(){df(e);let r=Jw().$implicit,d=Jw(2);return ff(d.duplicate(r))}),NC(1," Duplicate "),pl();}if(i&2){let e=Jw().$implicit;cg("aria-label","Duplicate "+e.config.name);}}function _e(i,t){if(i&1){let e=Zw();Ds(0,"button",27),mg("click",function(){df(e);let r=Jw(2).$implicit,d=Jw(2);return ff(d.edit(r))}),NC(1," Edit "),pl();}if(i&2){let e=Jw(2).$implicit;cg("aria-label","Edit "+e.config.name);}}function me(i,t){if(i&1){let e=Zw();Lw(0,_e,2,1,"button",24),Ds(1,"agentos-row-delete-action",31),mg("deleteRequested",function(){df(e);let r=Jw().$implicit,d=Jw(2);return ff(d.deletion.request(r.key))})("deleteConfirmed",function(){df(e);let r=Jw().$implicit,d=Jw(2);return ff(d.confirmDelete(r))})("deleteCancelled",function(){df(e);let r=Jw(3);return ff(r.deletion.cancel())}),pl();}if(i&2){let e=Jw().$implicit,n=Jw(2);jw(n.deletion.confirmingId()!==e.key?0:-1),BE(),ug("rowKey",e.key)("rowLabel",e.config.name)("state",n.deletion);}}function ge(i,t){i&1&&(Ds(0,"button",25),NC(1,"Inherited"),pl());}function he(i,t){if(i&1&&(Ds(0,"tr",10)(1,"td",13),NC(2),pl(),Ds(3,"td",14),NC(4),pl(),Ds(5,"td",15)(6,"div",16)(7,"ds-tag",17),NC(8),pl(),Lw(9,ie,2,0,"ds-tag",18),pl()(),Ds(10,"td",19),Lw(11,oe,2,0,"ds-tag",20)(12,ae,2,0,"ds-tag",18)(13,se,2,0,"span",21),pl(),Ds(14,"td",22)(15,"div",23),Lw(16,pe,3,1),Lw(17,ue,2,1,"button",24),Lw(18,me,2,4)(19,ge,2,0,"button",25),pl()()()),i&2){let e=t.$implicit,n=Jw(2);BE(2),Og(e.config.name),BE(2),vl(" ",e.config.authType," "),BE(3),ug("variant",e.scopeLabel==="Platform"?"neutral":e.scopeLabel==="Personal"?"outline":"accent"),BE(),Og(e.scopeLabel),BE(),jw(e.canMutate?-1:9),BE(2),jw(n.isOAuth(e)&&n.connectionOf(e)==="connected"?11:n.isOAuth(e)&&n.connectionOf(e)==="disconnected"?12:13),BE(5),jw(n.isOAuth(e)?16:-1),BE(),jw(n.deletion.confirmingId()!==e.key&&n.resetConfirmingKey()!==e.key&&n.connectingKey()!==e.key?17:-1),BE(),jw(e.canMutate?18:19);}}function Ce(i,t){if(i&1&&(Ds(0,"div",7)(1,"table",8)(2,"thead",9)(3,"tr",10)(4,"th",11),NC(5,"Name"),pl(),Ds(6,"th",11),NC(7,"Authentication type"),pl(),Ds(8,"th",11),NC(9,"Scope"),pl(),Ds(10,"th",11),NC(11,"Connection"),pl(),Ds(12,"th",11)(13,"span",12),NC(14,"Actions"),pl()()()(),Ds(15,"tbody",9),Hw(16,he,20,9,"tr",10,Q),pl()()()),i&2){let e=Jw();BE(16),Uw(e.rowFilter.filteredRows());}}var fe=new Set(["OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"]),J=class i{route=g(W);router=g(F);destroyRef=g(Ie);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=Ui(false);isLoading=Ui(true);rows=Ui([]);deletion=k();connections=Ui({});connectingKey=Ui(null);resetConfirmingKey=Ui(null);resettingKey=Ui(null);actionMessage=Ui(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")??""),fa(t=>t?this.namespaceRole.isAdminOfNamespace$(t):Tr(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(ci(()=>{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"]),da(()=>Tr([e.key,"unknown"]))));if(t.length===0){this.connections.set({});return}this.connectionsLoad=Ty(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=yw({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&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(d){return n.rowFilter.query.set(d)}),pl(),Ds(2,"button",2),mg("click",function(){return n.openCreateForm()}),NC(3,"New auth setting"),pl()(),Lw(4,X,2,1,"p",3),Lw(5,Z,2,4,"p",4),Lw(6,ee,2,0,"p",5)(7,te,2,0,"p",6)(8,ne,2,0,"p",5)(9,Ce,18,0,"div",7)),e&2){let r;BE(),ug("query",n.rowFilter.query()),BE(3),jw(n.deletion.error()?4:-1),BE(),jw((r=n.actionMessage())?5:-1,r),BE(),jw(n.isLoading()?6:n.rows().length===0?7:n.rowFilter.filteredRows().length===0?8:9);}},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{J as AuthSettingsAllScopesComponent};
@@ -1 +1 @@
1
- import {c}from'./chunk-DVh_U_Pz.js';import {z as k,O as O$1,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-Bs2lM6dc.js';import {g,W,F,I as Ie,U as Ui,ac as Ty,a2 as da,aa as Tr,G as U,M as x,K as w,ai as Ne,al as De,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,H as Hw,m as Uw,Z as Zw,r as df,s as ff,k as cg}from'./main-ZPG3XUQU.js';var J=(n,t)=>t.key;function O(n,t){if(n&1&&(Ds(0,"p",3),NC(1),pl()),n&2){let e=Jw();BE(),Og(e.deletion.error());}}function Y(n,t){n&1&&(Ds(0,"p",4),NC(1,"Loading scheduled prompts\u2026"),pl());}function z(n,t){n&1&&(Ds(0,"p",5),NC(1,"No scheduled prompts available."),pl());}function G(n,t){n&1&&(Ds(0,"p",4),NC(1,"No scheduled prompts match the current filter."),pl());}function Q(n,t){if(n&1&&(Ds(0,"span",14),NC(1),pl()),n&2){let e=Jw().$implicit;BE(),Og(e.prompt.description);}}function X(n,t){n&1&&(Ds(0,"ds-tag",20),NC(1,"Read-only"),pl());}function Z(n,t){if(n&1){let e=Zw();Ds(0,"button",25),mg("click",function(){df(e);let l=Jw(2).$implicit,p=Jw(2);return ff(p.toggle(l))}),NC(1),pl(),Ds(2,"button",25),mg("click",function(){df(e);let l=Jw(2).$implicit,p=Jw(2);return ff(p.edit(l))}),NC(3," Edit "),pl();}if(n&2){let e=Jw(2).$implicit;BE(),Og(e.prompt.enabled?"Disable":"Enable"),BE(),cg("aria-label","Edit "+e.prompt.name);}}function ee(n,t){if(n&1){let e=Zw();Lw(0,Z,4,2),Ds(1,"agentos-row-delete-action",24),mg("deleteRequested",function(){df(e);let l=Jw().$implicit,p=Jw(2);return ff(p.deletion.request(l.key))})("deleteConfirmed",function(){df(e);let l=Jw().$implicit,p=Jw(2);return ff(p.confirmDelete(l))})("deleteCancelled",function(){df(e);let l=Jw(3);return ff(l.deletion.cancel())}),pl();}if(n&2){let e=Jw().$implicit,i=Jw(2);jw(i.deletion.confirmingId()!==e.key?0:-1),BE(),ug("rowKey",e.key)("rowLabel",e.prompt.name)("state",i.deletion);}}function te(n,t){n&1&&(Ds(0,"button",23),NC(1,"Inherited"),pl());}function ne(n,t){if(n&1&&(Ds(0,"tr",9)(1,"td",12)(2,"span",13),NC(3),pl(),Lw(4,Q,2,1,"span",14),pl(),Ds(5,"td",15),NC(6),pl(),Ds(7,"td",16)(8,"ds-tag",17),NC(9),pl()(),Ds(10,"td",18)(11,"div",19)(12,"ds-tag",17),NC(13),pl(),Lw(14,X,2,0,"ds-tag",20),pl()(),Ds(15,"td",21)(16,"div",22),Lw(17,ee,2,4)(18,te,2,0,"button",23),pl()()()),n&2){let e=t.$implicit,i=Jw(2);BE(3),Og(e.prompt.name),BE(),jw(e.prompt.description?4:-1),BE(2),Og(i.scheduleLabel(e.prompt)),BE(2),ug("variant",e.prompt.enabled?"accent":"outline"),BE(),Og(e.prompt.enabled?"Enabled":"Disabled"),BE(3),ug("variant",e.scope==="platform"?"neutral":"accent"),BE(),Og(e.scope==="platform"?"Platform":"Namespace"),BE(),jw(e.scope==="platform"?14:-1),BE(3),jw(e.scope==="namespace"?17:18);}}function ie(n,t){if(n&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"Schedule"),pl(),Ds(8,"th",10),NC(9,"Status"),pl(),Ds(10,"th",10),NC(11,"Scope"),pl(),Ds(12,"th",10)(13,"span",11),NC(14,"Actions"),pl()()()(),Ds(15,"tbody",8),Hw(16,ne,19,9,"tr",9,J),pl()()()),n&2){let e=Jw();BE(16),Uw(e.rowFilter.filteredRows());}}var H=class n{route=g(W);router=g(F);destroyRef=g(Ie);state=g(c);namespaceId=this.route.snapshot.params.namespaceId;rows=Ui([]);isLoading=Ui(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(){Ty({platform:this.state.listPlatform().pipe(da(()=>Tr([]))),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===Ne.WEEK?"week":"month",l=e.unit===Ne.WEEK&&e.days?.length?` (${e.days.map(p=>De[p]??p).join(", ")})`:"";return `Every ${i}${l} at ${e.timeUtc} UTC`}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=yw({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&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(p){return i.rowFilter.query.set(p)}),pl(),Ds(2,"button",2),mg("click",function(){return i.openCreateForm()}),NC(3,"New scheduled prompt"),pl()(),Lw(4,O,2,1,"p",3),Lw(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&&(BE(),ug("query",i.rowFilter.query()),BE(3),jw(i.deletion.error()?4:-1),BE(),jw(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{H as ScheduledPromptListComponent};
1
+ import {c}from'./chunk-B8NR3gly.js';import {z as k,O as O$1,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-BOcSAL90.js';import {g,W,F,I as Ie,U as Ui,ac as Ty,a2 as da,aa as Tr,G as U,M as x,K as w,ai as Ne,al as De,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,H as Hw,m as Uw,Z as Zw,r as df,s as ff,k as cg}from'./main-YOWURGI5.js';var J=(n,t)=>t.key;function O(n,t){if(n&1&&(Ds(0,"p",3),NC(1),pl()),n&2){let e=Jw();BE(),Og(e.deletion.error());}}function Y(n,t){n&1&&(Ds(0,"p",4),NC(1,"Loading scheduled prompts\u2026"),pl());}function z(n,t){n&1&&(Ds(0,"p",5),NC(1,"No scheduled prompts available."),pl());}function G(n,t){n&1&&(Ds(0,"p",4),NC(1,"No scheduled prompts match the current filter."),pl());}function Q(n,t){if(n&1&&(Ds(0,"span",14),NC(1),pl()),n&2){let e=Jw().$implicit;BE(),Og(e.prompt.description);}}function X(n,t){n&1&&(Ds(0,"ds-tag",20),NC(1,"Read-only"),pl());}function Z(n,t){if(n&1){let e=Zw();Ds(0,"button",25),mg("click",function(){df(e);let l=Jw(2).$implicit,p=Jw(2);return ff(p.toggle(l))}),NC(1),pl(),Ds(2,"button",25),mg("click",function(){df(e);let l=Jw(2).$implicit,p=Jw(2);return ff(p.edit(l))}),NC(3," Edit "),pl();}if(n&2){let e=Jw(2).$implicit;BE(),Og(e.prompt.enabled?"Disable":"Enable"),BE(),cg("aria-label","Edit "+e.prompt.name);}}function ee(n,t){if(n&1){let e=Zw();Lw(0,Z,4,2),Ds(1,"agentos-row-delete-action",24),mg("deleteRequested",function(){df(e);let l=Jw().$implicit,p=Jw(2);return ff(p.deletion.request(l.key))})("deleteConfirmed",function(){df(e);let l=Jw().$implicit,p=Jw(2);return ff(p.confirmDelete(l))})("deleteCancelled",function(){df(e);let l=Jw(3);return ff(l.deletion.cancel())}),pl();}if(n&2){let e=Jw().$implicit,i=Jw(2);jw(i.deletion.confirmingId()!==e.key?0:-1),BE(),ug("rowKey",e.key)("rowLabel",e.prompt.name)("state",i.deletion);}}function te(n,t){n&1&&(Ds(0,"button",23),NC(1,"Inherited"),pl());}function ne(n,t){if(n&1&&(Ds(0,"tr",9)(1,"td",12)(2,"span",13),NC(3),pl(),Lw(4,Q,2,1,"span",14),pl(),Ds(5,"td",15),NC(6),pl(),Ds(7,"td",16)(8,"ds-tag",17),NC(9),pl()(),Ds(10,"td",18)(11,"div",19)(12,"ds-tag",17),NC(13),pl(),Lw(14,X,2,0,"ds-tag",20),pl()(),Ds(15,"td",21)(16,"div",22),Lw(17,ee,2,4)(18,te,2,0,"button",23),pl()()()),n&2){let e=t.$implicit,i=Jw(2);BE(3),Og(e.prompt.name),BE(),jw(e.prompt.description?4:-1),BE(2),Og(i.scheduleLabel(e.prompt)),BE(2),ug("variant",e.prompt.enabled?"accent":"outline"),BE(),Og(e.prompt.enabled?"Enabled":"Disabled"),BE(3),ug("variant",e.scope==="platform"?"neutral":"accent"),BE(),Og(e.scope==="platform"?"Platform":"Namespace"),BE(),jw(e.scope==="platform"?14:-1),BE(3),jw(e.scope==="namespace"?17:18);}}function ie(n,t){if(n&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"Schedule"),pl(),Ds(8,"th",10),NC(9,"Status"),pl(),Ds(10,"th",10),NC(11,"Scope"),pl(),Ds(12,"th",10)(13,"span",11),NC(14,"Actions"),pl()()()(),Ds(15,"tbody",8),Hw(16,ne,19,9,"tr",9,J),pl()()()),n&2){let e=Jw();BE(16),Uw(e.rowFilter.filteredRows());}}var H=class n{route=g(W);router=g(F);destroyRef=g(Ie);state=g(c);namespaceId=this.route.snapshot.params.namespaceId;rows=Ui([]);isLoading=Ui(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(){Ty({platform:this.state.listPlatform().pipe(da(()=>Tr([]))),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===Ne.WEEK?"week":"month",l=e.unit===Ne.WEEK&&e.days?.length?` (${e.days.map(p=>De[p]??p).join(", ")})`:"";return `Every ${i}${l} at ${e.timeUtc} UTC`}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=yw({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&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(p){return i.rowFilter.query.set(p)}),pl(),Ds(2,"button",2),mg("click",function(){return i.openCreateForm()}),NC(3,"New scheduled prompt"),pl()(),Lw(4,O,2,1,"p",3),Lw(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&&(BE(),ug("query",i.rowFilter.query()),BE(3),jw(i.deletion.error()?4:-1),BE(),jw(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{H as ScheduledPromptListComponent};
@@ -1 +1 @@
1
- import {c}from'./chunk-DVh_U_Pz.js';import {z as k,O as O$1,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-Bs2lM6dc.js';import {g,F,I as Ie,U as Ui,G as U$1,ai as Ne,al as De,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,H as Hw,m as Uw,Z as Zw,r as df,s as ff,k as cg}from'./main-ZPG3XUQU.js';var M=(n,t)=>t.id??t.name;function U(n,t){if(n&1&&(Ds(0,"p",3),NC(1),pl()),n&2){let e=Jw();BE(),Og(e.deletion.error());}}function B(n,t){n&1&&(Ds(0,"p",4),NC(1,"Loading scheduled prompts\u2026"),pl());}function j(n,t){n&1&&(Ds(0,"p",5),NC(1,"No platform scheduled prompts defined yet."),pl());}function W(n,t){n&1&&(Ds(0,"p",4),NC(1,"No scheduled prompts match the current filter."),pl());}function H(n,t){if(n&1&&(Ds(0,"span",14),NC(1),pl()),n&2){let e=Jw().$implicit;BE(),Og(e.description);}}function O(n,t){if(n&1){let e=Zw();Ds(0,"button",21),mg("click",function(){df(e);let s=Jw().$implicit,c=Jw(2);return ff(c.toggle(s))}),NC(1),pl(),Ds(2,"button",21),mg("click",function(){df(e);let s=Jw().$implicit,c=Jw(2);return ff(c.edit(s))}),NC(3,"Edit"),pl();}if(n&2){let e=Jw().$implicit;BE(),Og(e.enabled?"Disable":"Enable"),BE(),cg("aria-label","Edit "+e.name);}}function Y(n,t){if(n&1){let e=Zw();Ds(0,"agentos-row-delete-action",22),mg("deleteRequested",function(){df(e);let s=Jw().$implicit,c=Jw(2);return ff(c.deletion.request(s.id))})("deleteConfirmed",function(){df(e);let s=Jw().$implicit,c=Jw(2);return ff(c.confirmDelete(s))})("deleteCancelled",function(){df(e);let s=Jw(3);return ff(s.deletion.cancel())}),pl();}if(n&2){let e=Jw().$implicit,i=Jw(2);ug("rowKey",e.id)("rowLabel",e.name)("state",i.deletion);}}function z(n,t){if(n&1&&(Ds(0,"tr",9)(1,"td",12)(2,"span",13),NC(3),pl(),Lw(4,H,2,1,"span",14),pl(),Ds(5,"td",15),NC(6),pl(),Ds(7,"td",16)(8,"ds-tag",17),NC(9),pl()(),Ds(10,"td",18)(11,"div",19),Lw(12,O,4,2),Lw(13,Y,1,3,"agentos-row-delete-action",20),pl()()()),n&2){let e=t.$implicit,i=Jw(2);BE(3),Og(e.name),BE(),jw(e.description?4:-1),BE(2),Og(i.scheduleLabel(e)),BE(2),ug("variant",e.enabled?"accent":"outline"),BE(),Og(e.enabled?"Enabled":"Disabled"),BE(3),jw(i.deletion.confirmingId()!==e.id?12:-1),BE(),jw(e.id?13:-1);}}function G(n,t){if(n&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"Schedule"),pl(),Ds(8,"th",10),NC(9,"Status"),pl(),Ds(10,"th",10)(11,"span",11),NC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Hw(14,z,14,7,"tr",9,M),pl()()()),n&2){let e=Jw();BE(14),Uw(e.rowFilter.filteredRows());}}var A=class n{router=g(F);destroyRef=g(Ie);state=g(c);prompts=Ui([]);isLoading=Ui(true);deletion=k();rowFilter=O$1(this.prompts,t=>[t.name,t.description,this.scheduleLabel(t),t.enabled?"Enabled":"Disabled"].filter(Boolean).join(" "));constructor(){this.state.listPlatform().pipe(U$1(this.destroyRef)).subscribe({next:t=>{this.prompts.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}scheduleLabel(t){let{recurrence:e}=t,i=e.unit===Ne.WEEK?"week":"month",s=e.unit===Ne.WEEK&&e.days?.length?` (${e.days.map(c=>De[c]??c).join(", ")})`:"";return `Every ${i}${s} at ${e.timeUtc} UTC`}openCreateForm(){this.router.navigate(["/agentos","admin","scheduled-prompts","new"]);}edit(t){t.id&&this.router.navigate(["/agentos","admin","scheduled-prompts",t.id,"edit"]);}toggle(t){(t.enabled?this.state.disable(t.id??""):this.state.enable(t.id??"")).pipe(U$1(this.destroyRef)).subscribe(i=>this.patchPrompt(i));}confirmDelete(t){if(!t.id)return;let e=t.id;this.deletion.execute(e,{request$:this.state.delete(e).pipe(U$1(this.destroyRef)),onSuccess:()=>this.prompts.update(i=>i.filter(s=>s.id!==e)),errorMessage:`Deleting "${t.name}" failed. Try again.`});}patchPrompt(t){this.prompts.update(e=>e.map(i=>i.id===t.id?t:i));}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=yw({type:n,selectors:[["agentos-platform-scheduled-prompts"]],decls:9,vars:3,consts:[["title","Platform scheduled prompts","description","Scheduled prompts shared across every namespace."],["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","Platform 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","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(e,i){e&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(c){return i.rowFilter.query.set(c)}),pl(),Ds(2,"button",2),mg("click",function(){return i.openCreateForm()}),NC(3,"New scheduled prompt"),pl()(),Lw(4,U,2,1,"p",3),Lw(5,B,2,0,"p",4)(6,j,2,0,"p",5)(7,W,2,0,"p",4)(8,G,16,0,"div",6)),e&2&&(BE(),ug("query",i.rowFilter.query()),BE(3),jw(i.deletion.error()?4:-1),BE(),jw(i.isLoading()?5:i.prompts().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{A as PlatformScheduledPromptsComponent};
1
+ import {c}from'./chunk-B8NR3gly.js';import {z as k,O as O$1,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-BOcSAL90.js';import {g,F,I as Ie,U as Ui,G as U$1,ai as Ne,al as De,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,H as Hw,m as Uw,Z as Zw,r as df,s as ff,k as cg}from'./main-YOWURGI5.js';var M=(n,t)=>t.id??t.name;function U(n,t){if(n&1&&(Ds(0,"p",3),NC(1),pl()),n&2){let e=Jw();BE(),Og(e.deletion.error());}}function B(n,t){n&1&&(Ds(0,"p",4),NC(1,"Loading scheduled prompts\u2026"),pl());}function j(n,t){n&1&&(Ds(0,"p",5),NC(1,"No platform scheduled prompts defined yet."),pl());}function W(n,t){n&1&&(Ds(0,"p",4),NC(1,"No scheduled prompts match the current filter."),pl());}function H(n,t){if(n&1&&(Ds(0,"span",14),NC(1),pl()),n&2){let e=Jw().$implicit;BE(),Og(e.description);}}function O(n,t){if(n&1){let e=Zw();Ds(0,"button",21),mg("click",function(){df(e);let s=Jw().$implicit,c=Jw(2);return ff(c.toggle(s))}),NC(1),pl(),Ds(2,"button",21),mg("click",function(){df(e);let s=Jw().$implicit,c=Jw(2);return ff(c.edit(s))}),NC(3,"Edit"),pl();}if(n&2){let e=Jw().$implicit;BE(),Og(e.enabled?"Disable":"Enable"),BE(),cg("aria-label","Edit "+e.name);}}function Y(n,t){if(n&1){let e=Zw();Ds(0,"agentos-row-delete-action",22),mg("deleteRequested",function(){df(e);let s=Jw().$implicit,c=Jw(2);return ff(c.deletion.request(s.id))})("deleteConfirmed",function(){df(e);let s=Jw().$implicit,c=Jw(2);return ff(c.confirmDelete(s))})("deleteCancelled",function(){df(e);let s=Jw(3);return ff(s.deletion.cancel())}),pl();}if(n&2){let e=Jw().$implicit,i=Jw(2);ug("rowKey",e.id)("rowLabel",e.name)("state",i.deletion);}}function z(n,t){if(n&1&&(Ds(0,"tr",9)(1,"td",12)(2,"span",13),NC(3),pl(),Lw(4,H,2,1,"span",14),pl(),Ds(5,"td",15),NC(6),pl(),Ds(7,"td",16)(8,"ds-tag",17),NC(9),pl()(),Ds(10,"td",18)(11,"div",19),Lw(12,O,4,2),Lw(13,Y,1,3,"agentos-row-delete-action",20),pl()()()),n&2){let e=t.$implicit,i=Jw(2);BE(3),Og(e.name),BE(),jw(e.description?4:-1),BE(2),Og(i.scheduleLabel(e)),BE(2),ug("variant",e.enabled?"accent":"outline"),BE(),Og(e.enabled?"Enabled":"Disabled"),BE(3),jw(i.deletion.confirmingId()!==e.id?12:-1),BE(),jw(e.id?13:-1);}}function G(n,t){if(n&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"Schedule"),pl(),Ds(8,"th",10),NC(9,"Status"),pl(),Ds(10,"th",10)(11,"span",11),NC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Hw(14,z,14,7,"tr",9,M),pl()()()),n&2){let e=Jw();BE(14),Uw(e.rowFilter.filteredRows());}}var A=class n{router=g(F);destroyRef=g(Ie);state=g(c);prompts=Ui([]);isLoading=Ui(true);deletion=k();rowFilter=O$1(this.prompts,t=>[t.name,t.description,this.scheduleLabel(t),t.enabled?"Enabled":"Disabled"].filter(Boolean).join(" "));constructor(){this.state.listPlatform().pipe(U$1(this.destroyRef)).subscribe({next:t=>{this.prompts.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}scheduleLabel(t){let{recurrence:e}=t,i=e.unit===Ne.WEEK?"week":"month",s=e.unit===Ne.WEEK&&e.days?.length?` (${e.days.map(c=>De[c]??c).join(", ")})`:"";return `Every ${i}${s} at ${e.timeUtc} UTC`}openCreateForm(){this.router.navigate(["/agentos","admin","scheduled-prompts","new"]);}edit(t){t.id&&this.router.navigate(["/agentos","admin","scheduled-prompts",t.id,"edit"]);}toggle(t){(t.enabled?this.state.disable(t.id??""):this.state.enable(t.id??"")).pipe(U$1(this.destroyRef)).subscribe(i=>this.patchPrompt(i));}confirmDelete(t){if(!t.id)return;let e=t.id;this.deletion.execute(e,{request$:this.state.delete(e).pipe(U$1(this.destroyRef)),onSuccess:()=>this.prompts.update(i=>i.filter(s=>s.id!==e)),errorMessage:`Deleting "${t.name}" failed. Try again.`});}patchPrompt(t){this.prompts.update(e=>e.map(i=>i.id===t.id?t:i));}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=yw({type:n,selectors:[["agentos-platform-scheduled-prompts"]],decls:9,vars:3,consts:[["title","Platform scheduled prompts","description","Scheduled prompts shared across every namespace."],["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","Platform 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","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(e,i){e&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(c){return i.rowFilter.query.set(c)}),pl(),Ds(2,"button",2),mg("click",function(){return i.openCreateForm()}),NC(3,"New scheduled prompt"),pl()(),Lw(4,U,2,1,"p",3),Lw(5,B,2,0,"p",4)(6,j,2,0,"p",5)(7,W,2,0,"p",4)(8,G,16,0,"div",6)),e&2&&(BE(),ug("query",i.rowFilter.query()),BE(3),jw(i.deletion.error()?4:-1),BE(),jw(i.isLoading()?5:i.prompts().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{A as PlatformScheduledPromptsComponent};
@@ -1 +1 @@
1
- import {v}from'./chunk-CAOHsMU2.js';import {I}from'./chunk-7YWH-FdV.js';import {O}from'./chunk-6p69HsOa.js';import {g,W,F,I as Ie$1,a8 as _,a9 as F$1,aa as Tr,U as Ui,ab as le,X as XC,a1 as fa,G as U,q as Af,ac as Ty,y as yw,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,j as jw,a2 as da,ad as ne,Z as Zw,H as Hw,ae as Fw,_ as _I,l as lg,J as Jw,m as Uw,R as NI,v as vl,O as Og,r as df,s as ff}from'./main-ZPG3XUQU.js';import {p as pt,T as Te$1,a as fn,d as pn,h as hn,e as cn,r as ln,g as dn,o as on,i as at,j as an,t as rn,U as Ut,n as nd,b as bo,x as xo,L as Lt,u as vn,G as Gt,w as pa,m as mo,c as po,V as Vn,A as An,W as Wt}from'./chunk-Bs2lM6dc.js';import'./chunk-TuIJresS.js';var be=(i,e)=>e.value;function _e(i,e){i&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function xe(i,e){if(i&1&&(Ds(0,"label",6),lg(1,"input",22),_I(),NC(2),pl()),i&2){let t=e.$implicit,n=Jw(2);BE(),ug("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),NI(),BE(),vl(" ",t.label," ");}}function Ie(i,e){if(i&1&&(Ds(0,"option",10),NC(1),pl()),i&2){let t=e.$implicit;ug("value",t.type),BE(),Og(t.displayName);}}function Ne(i,e){if(i&1&&(Ds(0,"option",10),NC(1),pl()),i&2){let t=e.$implicit;ug("value",t.value),BE(),Og(t.label);}}function Ae(i,e){if(i&1&&(Ds(0,"div",18)(1,"label",6),lg(2,"input",23),_I(),NC(3," Grant automatically "),pl(),Ds(4,"p",2),NC(5),pl()()),i&2){let t=Jw(2);BE(2),ug("formControl",t.autoGrantControl),NI(),BE(3),vl(" Give this integration to ",t.autoGrantReach(),", without each agent having to declare it. An agent can still opt out by mapping this configuration to an empty tool list. ");}}function Ee(i,e){if(i&1){let t=Zw();Ds(0,"ds-card")(1,"ds-json-schema-form",24),mg("valueChange",function(a){df(t);let p=Jw(2);return ff(p.onParamsChange(a))}),pl()();}if(i&2){let t=Jw(2);BE(),ug("schema",e)("value",t.initialParams());}}function Fe(i,e){if(i&1){let t=Zw();Ds(0,"button",25),mg("click",function(){df(t);let a=Jw(2);return ff(a.exportYaml())}),NC(1),pl();}if(i&2){let t=Jw(2);ug("disabled",t.isExporting()),BE(),vl(" ",t.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Te(i,e){if(i&1){let t=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(t);let a=Jw();return ff(a.submit())}),Ds(1,"ds-fieldset",5),Hw(2,xe,3,4,"label",6,Fw().trackByScope,true),pl(),Ds(4,"ds-form-field",7)(5,"select",8)(6,"option",9),NC(7,"Select type"),pl(),Hw(8,Ie,2,2,"option",10,Fw().trackByType,true),pl(),_I(),pl(),Ds(10,"ds-form-field",11),lg(11,"input",12),_I(),pl(),Ds(12,"ds-form-field",13),lg(13,"textarea",14),_I(),pl(),Ds(14,"ds-form-field",15)(15,"select",16)(16,"option",17),NC(17,"None"),pl(),Hw(18,Ne,2,2,"option",10,be),pl(),_I(),pl(),Lw(20,Ae,6,2,"div",18),Lw(21,Ee,2,2,"ds-card"),Ds(22,"ds-form-actions")(23,"button",19),NC(24),pl(),Lw(25,Fe,2,2,"button",20),Ds(26,"button",21),mg("click",function(){df(t);let a=Jw();return ff(a.cancel())}),NC(27,"Cancel"),pl()()();}if(i&2){let t,n=Jw();ug("formGroup",n.form),BE(),ug("disabled",n.isEditMode()),BE(),Uw(n.scopeOptions),BE(3),ug("formControl",n.typeControl),NI(),BE(3),Uw(n.integrationTypes()),BE(3),ug("formControl",n.nameControl),NI(),BE(2),ug("formControl",n.descriptionControl),NI(),BE(2),ug("formControl",n.authSettingNameControl),NI(),BE(),ug("ngValue",null),BE(2),Uw(n.authSettingOptions()),BE(2),jw(n.isAutoGrantable()?20:-1),BE(),jw((t=n.schema())?21:-1,t),BE(2),ug("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),BE(),vl(" ",n.isEditMode()?"Save changes":"Create"," "),BE(),jw(n.isEditMode()?25:-1);}}var Ve=new Set(["platform","namespace","userOnNs","userGlobal"]),w=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ve=class i{route=g(W);router=g(F);destroyRef=g(Ie$1);state=g(O);integrationTypeController=g(_);authSettingState=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?Tr(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new pt({name:new Te$1("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te$1(null),type:new Te$1("",{nonNullable:true,validators:[fn.required]}),scope:new Te$1("namespace",{nonNullable:true}),autoGrant:new Te$1(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);isExporting=Ui(false);scopeOptions=[{value:"platform",label:w.platform},{value:"namespace",label:w.namespace},{value:"userOnNs",label:w.userOnNs},{value:"userGlobal",label:w.userGlobal}];authSettingNameControl=new Te$1(null);loadedAuthSettings=Ui([]);authSettingsLoaded=Ui(false);savedAuthSettingName=Ui(null);authSettingsScope$=new le;authSettingOptions=XC(()=>{let e=this.loadedAuthSettings(),t=this.savedAuthSettingName();return !t||!this.authSettingsLoaded()||e.some(n=>n.value===t)?e:[...e,{value:t,label:`${t} (not found)`}]});paramsValue=Ui(null);initialParams=Ui(null);integrationTypes=F$1(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=F$1(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});scopeValue=F$1(this.form.controls.scope.valueChanges,{initialValue:this.form.controls.scope.value});schema=XC(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});isAutoGrantable=XC(()=>{let e=this.selectedType();return e?this.integrationTypes().find(t=>t.type===e)?.autoGrantable??false:false});autoGrantReach=XC(()=>{switch(this.scopeValue()){case "platform":return "every agent of this environment";case "namespace":return "every agent of this namespace";default:return "your own runs"}});existingConfig=null;constructor(){this.authSettingsScope$.pipe(fa(e=>this.loadAuthSettingLayers(e)),U(this.destroyRef)).subscribe(e=>{this.loadedAuthSettings.set(this.toAuthSettingOptions(e)),this.authSettingsLoaded.set(true);}),Af(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let e=this.route.snapshot.paramMap,t=this.route.snapshot.queryParamMap,n=e.get("integrationId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable(),this.loadAuthSettingsForScope("platform");return}let a=this.parseScope(t.get("scope"));this.scopeControl.setValue(a),this.loadAuthSettingsForScope(a),this.scopeControl.valueChanges.pipe(U(this.destroyRef)).subscribe(D=>{this.loadAuthSettingsForScope(D);});let p=t.get("template");p&&this.hydrateFromTemplate(p);}parseScope(e){return e&&Ve.has(e)?e:"namespace"}deriveScopeFromConfig(e){return !e.userId&&!e.namespaceId?"platform":e.userId?e.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.existingConfig=t;let n=this.deriveScopeFromConfig(t);this.scopeControl.setValue(n),this.applyConfigToForm(t),this.loadAuthSettingsForScope(n),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[IntegrationForm] Could not load config '${e}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.applyConfigToForm(t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:t=>{console.warn(`[IntegrationForm] Could not hydrate from template ${e}:`,t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(e){this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.typeControl.setValue(e.integrationType),this.initialParams.set(e.parameters),this.paramsValue.set(e.parameters),this.authSettingNameControl.setValue(e.authSettingName??null),this.savedAuthSettingName.set(e.authSettingName??null),this.autoGrantControl.setValue(e.autoGrant??false);}loadAuthSettingsForScope(e){this.authSettingsLoaded.set(false),this.authSettingsScope$.next(e);}loadAuthSettingLayers(e){let t=(p,D)=>D.pipe(da(()=>Tr([])),ne(Se=>({label:p,settings:Se}))),n=t("platform",this.authSettingState.loadPlatformSettings()),a=t("mine",this.authSettingState.loadUserSettings("global"));return e==="platform"||e==="userGlobal"?Ty([a,n]):Ty([t("mine",this.authSettingState.loadUserSettings(this.namespaceId)),t("namespace",this.authSettingState.loadNamespaceSettings(this.namespaceId)),a,n])}toAuthSettingOptions(e){let t=new Map;for(let{label:n,settings:a}of e)for(let{name:p}of a)p&&t.set(p,(t.get(p)??new Set).add(n));return [...t.entries()].sort(([n],[a])=>n.localeCompare(a)).map(([n,a])=>({value:n,label:`${n} (${[...a].join(", ")})`}))}onParamsChange(e){this.paramsValue.set(e);}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let e=this.descriptionControl.value?.trim(),t={name:this.nameControl.value.trim(),description:e||null,integrationType:this.typeControl.value,parameters:this.paramsValue(),authSettingName:this.authSettingNameControl.value||null,autoGrant:this.isAutoGrantable()&&this.autoGrantControl.value},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,t,n,this.existingConfig):this.state.create(t,n,this.namespaceId??null)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let e=this.existingConfig?.id;!e||this.isExporting()||(this.isExporting.set(true),this.state.exportAsYaml(e).pipe(U(this.destroyRef)).subscribe({next:t=>{let n=new Blob([t],{type:"application/yaml"}),a=URL.createObjectURL(n),p=document.createElement("a");p.href=a,p.download=`${this.existingConfig?.name??"integration"}.yaml`,p.click(),URL.revokeObjectURL(a),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"]);}trackByType(e,t){return t.type}trackByScope(e,t){return t.value}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-integration-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to integrations",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Scope",3,"disabled"],["dsCheck",""],["label","Type","controlId","integration-type","required",""],["dsControl","","id","integration-type",3,"formControl"],["value","","disabled",""],[3,"value"],["label","Name","controlId","integration-name","required",""],["dsControl","","id","integration-name","type","text","placeholder","Integration name","autocomplete","off",3,"formControl"],["label","Description","controlId","integration-description"],["dsControl","","id","integration-description","placeholder","Optional description","rows","3",3,"formControl"],["label","Auth Setting","controlId","integration-auth-setting","hint","Only the name is saved. It is resolved at run time for the user running the case, the most specific layer winning (user on this namespace > namespace > user > platform), so a shared integration can rely on each user's own auth setting of that name."],["dsControl","","id","integration-auth-setting",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-stack--sm"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["type","radio",3,"value","formControl","disabled"],["type","checkbox",3,"formControl"],[3,"valueChange","schema","value"],["dsButton","","type","button",3,"click","disabled"]],template:function(t,n){t&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return n.cancel()}),NC(3," \u2190 Integrations "),pl()(),Lw(4,_e,2,0,"p",2)(5,Te,28,12,"form",3),pl()),t&2&&(BE(),ug("title",n.isEditMode()?"Edit integration":"New integration"),BE(3),jw(n.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,on,at,an,rn,Ut,nd,bo,xo,Lt,vn,Gt,pa,mo,po,Vn,An,Wt],encapsulation:2})};export{ve as IntegrationFormComponent};
1
+ import {v}from'./chunk-BA4i878Z.js';import {I}from'./chunk-Bp8gQw3Y.js';import {O}from'./chunk-DNLzFXoQ.js';import {g,W,F,I as Ie$1,a8 as _,a9 as F$1,aa as Tr,U as Ui,ab as le,X as XC,a1 as fa,G as U,q as Af,ac as Ty,y as yw,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,j as jw,a2 as da,ad as ne,Z as Zw,H as Hw,ae as Fw,_ as _I,l as lg,J as Jw,m as Uw,R as NI,v as vl,O as Og,r as df,s as ff}from'./main-YOWURGI5.js';import {p as pt,T as Te$1,a as fn,d as pn,h as hn,e as cn,r as ln,g as dn,o as on,i as at,j as an,t as rn,U as Ut,n as nd,b as bo,x as xo,L as Lt,u as vn,G as Gt,w as pa,m as mo,c as po,V as Vn,A as An,W as Wt}from'./chunk-BOcSAL90.js';import'./chunk-CodMcnv-.js';var be=(i,e)=>e.value;function _e(i,e){i&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function xe(i,e){if(i&1&&(Ds(0,"label",6),lg(1,"input",22),_I(),NC(2),pl()),i&2){let t=e.$implicit,n=Jw(2);BE(),ug("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),NI(),BE(),vl(" ",t.label," ");}}function Ie(i,e){if(i&1&&(Ds(0,"option",10),NC(1),pl()),i&2){let t=e.$implicit;ug("value",t.type),BE(),Og(t.displayName);}}function Ne(i,e){if(i&1&&(Ds(0,"option",10),NC(1),pl()),i&2){let t=e.$implicit;ug("value",t.value),BE(),Og(t.label);}}function Ae(i,e){if(i&1&&(Ds(0,"div",18)(1,"label",6),lg(2,"input",23),_I(),NC(3," Grant automatically "),pl(),Ds(4,"p",2),NC(5),pl()()),i&2){let t=Jw(2);BE(2),ug("formControl",t.autoGrantControl),NI(),BE(3),vl(" Give this integration to ",t.autoGrantReach(),", without each agent having to declare it. An agent can still opt out by mapping this configuration to an empty tool list. ");}}function Ee(i,e){if(i&1){let t=Zw();Ds(0,"ds-card")(1,"ds-json-schema-form",24),mg("valueChange",function(a){df(t);let p=Jw(2);return ff(p.onParamsChange(a))}),pl()();}if(i&2){let t=Jw(2);BE(),ug("schema",e)("value",t.initialParams());}}function Fe(i,e){if(i&1){let t=Zw();Ds(0,"button",25),mg("click",function(){df(t);let a=Jw(2);return ff(a.exportYaml())}),NC(1),pl();}if(i&2){let t=Jw(2);ug("disabled",t.isExporting()),BE(),vl(" ",t.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Te(i,e){if(i&1){let t=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(t);let a=Jw();return ff(a.submit())}),Ds(1,"ds-fieldset",5),Hw(2,xe,3,4,"label",6,Fw().trackByScope,true),pl(),Ds(4,"ds-form-field",7)(5,"select",8)(6,"option",9),NC(7,"Select type"),pl(),Hw(8,Ie,2,2,"option",10,Fw().trackByType,true),pl(),_I(),pl(),Ds(10,"ds-form-field",11),lg(11,"input",12),_I(),pl(),Ds(12,"ds-form-field",13),lg(13,"textarea",14),_I(),pl(),Ds(14,"ds-form-field",15)(15,"select",16)(16,"option",17),NC(17,"None"),pl(),Hw(18,Ne,2,2,"option",10,be),pl(),_I(),pl(),Lw(20,Ae,6,2,"div",18),Lw(21,Ee,2,2,"ds-card"),Ds(22,"ds-form-actions")(23,"button",19),NC(24),pl(),Lw(25,Fe,2,2,"button",20),Ds(26,"button",21),mg("click",function(){df(t);let a=Jw();return ff(a.cancel())}),NC(27,"Cancel"),pl()()();}if(i&2){let t,n=Jw();ug("formGroup",n.form),BE(),ug("disabled",n.isEditMode()),BE(),Uw(n.scopeOptions),BE(3),ug("formControl",n.typeControl),NI(),BE(3),Uw(n.integrationTypes()),BE(3),ug("formControl",n.nameControl),NI(),BE(2),ug("formControl",n.descriptionControl),NI(),BE(2),ug("formControl",n.authSettingNameControl),NI(),BE(),ug("ngValue",null),BE(2),Uw(n.authSettingOptions()),BE(2),jw(n.isAutoGrantable()?20:-1),BE(),jw((t=n.schema())?21:-1,t),BE(2),ug("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),BE(),vl(" ",n.isEditMode()?"Save changes":"Create"," "),BE(),jw(n.isEditMode()?25:-1);}}var Ve=new Set(["platform","namespace","userOnNs","userGlobal"]),w=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ve=class i{route=g(W);router=g(F);destroyRef=g(Ie$1);state=g(O);integrationTypeController=g(_);authSettingState=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?Tr(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new pt({name:new Te$1("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te$1(null),type:new Te$1("",{nonNullable:true,validators:[fn.required]}),scope:new Te$1("namespace",{nonNullable:true}),autoGrant:new Te$1(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);isExporting=Ui(false);scopeOptions=[{value:"platform",label:w.platform},{value:"namespace",label:w.namespace},{value:"userOnNs",label:w.userOnNs},{value:"userGlobal",label:w.userGlobal}];authSettingNameControl=new Te$1(null);loadedAuthSettings=Ui([]);authSettingsLoaded=Ui(false);savedAuthSettingName=Ui(null);authSettingsScope$=new le;authSettingOptions=XC(()=>{let e=this.loadedAuthSettings(),t=this.savedAuthSettingName();return !t||!this.authSettingsLoaded()||e.some(n=>n.value===t)?e:[...e,{value:t,label:`${t} (not found)`}]});paramsValue=Ui(null);initialParams=Ui(null);integrationTypes=F$1(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=F$1(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});scopeValue=F$1(this.form.controls.scope.valueChanges,{initialValue:this.form.controls.scope.value});schema=XC(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});isAutoGrantable=XC(()=>{let e=this.selectedType();return e?this.integrationTypes().find(t=>t.type===e)?.autoGrantable??false:false});autoGrantReach=XC(()=>{switch(this.scopeValue()){case "platform":return "every agent of this environment";case "namespace":return "every agent of this namespace";default:return "your own runs"}});existingConfig=null;constructor(){this.authSettingsScope$.pipe(fa(e=>this.loadAuthSettingLayers(e)),U(this.destroyRef)).subscribe(e=>{this.loadedAuthSettings.set(this.toAuthSettingOptions(e)),this.authSettingsLoaded.set(true);}),Af(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let e=this.route.snapshot.paramMap,t=this.route.snapshot.queryParamMap,n=e.get("integrationId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable(),this.loadAuthSettingsForScope("platform");return}let a=this.parseScope(t.get("scope"));this.scopeControl.setValue(a),this.loadAuthSettingsForScope(a),this.scopeControl.valueChanges.pipe(U(this.destroyRef)).subscribe(D=>{this.loadAuthSettingsForScope(D);});let p=t.get("template");p&&this.hydrateFromTemplate(p);}parseScope(e){return e&&Ve.has(e)?e:"namespace"}deriveScopeFromConfig(e){return !e.userId&&!e.namespaceId?"platform":e.userId?e.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.existingConfig=t;let n=this.deriveScopeFromConfig(t);this.scopeControl.setValue(n),this.applyConfigToForm(t),this.loadAuthSettingsForScope(n),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[IntegrationForm] Could not load config '${e}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.applyConfigToForm(t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:t=>{console.warn(`[IntegrationForm] Could not hydrate from template ${e}:`,t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(e){this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.typeControl.setValue(e.integrationType),this.initialParams.set(e.parameters),this.paramsValue.set(e.parameters),this.authSettingNameControl.setValue(e.authSettingName??null),this.savedAuthSettingName.set(e.authSettingName??null),this.autoGrantControl.setValue(e.autoGrant??false);}loadAuthSettingsForScope(e){this.authSettingsLoaded.set(false),this.authSettingsScope$.next(e);}loadAuthSettingLayers(e){let t=(p,D)=>D.pipe(da(()=>Tr([])),ne(Se=>({label:p,settings:Se}))),n=t("platform",this.authSettingState.loadPlatformSettings()),a=t("mine",this.authSettingState.loadUserSettings("global"));return e==="platform"||e==="userGlobal"?Ty([a,n]):Ty([t("mine",this.authSettingState.loadUserSettings(this.namespaceId)),t("namespace",this.authSettingState.loadNamespaceSettings(this.namespaceId)),a,n])}toAuthSettingOptions(e){let t=new Map;for(let{label:n,settings:a}of e)for(let{name:p}of a)p&&t.set(p,(t.get(p)??new Set).add(n));return [...t.entries()].sort(([n],[a])=>n.localeCompare(a)).map(([n,a])=>({value:n,label:`${n} (${[...a].join(", ")})`}))}onParamsChange(e){this.paramsValue.set(e);}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let e=this.descriptionControl.value?.trim(),t={name:this.nameControl.value.trim(),description:e||null,integrationType:this.typeControl.value,parameters:this.paramsValue(),authSettingName:this.authSettingNameControl.value||null,autoGrant:this.isAutoGrantable()&&this.autoGrantControl.value},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,t,n,this.existingConfig):this.state.create(t,n,this.namespaceId??null)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let e=this.existingConfig?.id;!e||this.isExporting()||(this.isExporting.set(true),this.state.exportAsYaml(e).pipe(U(this.destroyRef)).subscribe({next:t=>{let n=new Blob([t],{type:"application/yaml"}),a=URL.createObjectURL(n),p=document.createElement("a");p.href=a,p.download=`${this.existingConfig?.name??"integration"}.yaml`,p.click(),URL.revokeObjectURL(a),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"]);}trackByType(e,t){return t.type}trackByScope(e,t){return t.value}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-integration-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to integrations",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Scope",3,"disabled"],["dsCheck",""],["label","Type","controlId","integration-type","required",""],["dsControl","","id","integration-type",3,"formControl"],["value","","disabled",""],[3,"value"],["label","Name","controlId","integration-name","required",""],["dsControl","","id","integration-name","type","text","placeholder","Integration name","autocomplete","off",3,"formControl"],["label","Description","controlId","integration-description"],["dsControl","","id","integration-description","placeholder","Optional description","rows","3",3,"formControl"],["label","Auth Setting","controlId","integration-auth-setting","hint","Only the name is saved. It is resolved at run time for the user running the case, the most specific layer winning (user on this namespace > namespace > user > platform), so a shared integration can rely on each user's own auth setting of that name."],["dsControl","","id","integration-auth-setting",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-stack--sm"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["type","radio",3,"value","formControl","disabled"],["type","checkbox",3,"formControl"],[3,"valueChange","schema","value"],["dsButton","","type","button",3,"click","disabled"]],template:function(t,n){t&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return n.cancel()}),NC(3," \u2190 Integrations "),pl()(),Lw(4,_e,2,0,"p",2)(5,Te,28,12,"form",3),pl()),t&2&&(BE(),ug("title",n.isEditMode()?"Edit integration":"New integration"),BE(3),jw(n.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,on,at,an,rn,Ut,nd,bo,xo,Lt,vn,Gt,pa,mo,po,Vn,An,Wt],encapsulation:2})};export{ve as IntegrationFormComponent};
@@ -1 +1 @@
1
- import {g,aK as fe,a6 as x}from'./main-ZPG3XUQU.js';var o=class r{skillController=g(fe);getById(l){return this.skillController.getByIdSkill(l)}listPlatform(){return this.skillController.listPlatformSkill()}listByNamespace(l){return this.skillController.listByParentSkill(l)}listEffective(l){return this.skillController.listEffectiveSkill(l)}create(l){return this.skillController.createSkill(l)}update(l,e){return this.skillController.updateSkill(l,e)}delete(l){return this.skillController.deleteSkill(l)}static \u0275fac=function(e){return new(e||r)};static \u0275prov=x({token:r,factory:r.\u0275fac,providedIn:"root"})};export{o};
1
+ import {g,aK as fe,a6 as x}from'./main-YOWURGI5.js';var o=class r{skillController=g(fe);getById(l){return this.skillController.getByIdSkill(l)}listPlatform(){return this.skillController.listPlatformSkill()}listByNamespace(l){return this.skillController.listByParentSkill(l)}listEffective(l){return this.skillController.listEffectiveSkill(l)}create(l){return this.skillController.createSkill(l)}update(l,e){return this.skillController.updateSkill(l,e)}delete(l){return this.skillController.deleteSkill(l)}static \u0275fac=function(e){return new(e||r)};static \u0275prov=x({token:r,factory:r.\u0275fac,providedIn:"root"})};export{o};
@@ -1 +1 @@
1
- import {D as m,p as pt,E as Bt,T as Te,a as fn,U as Ut,n as nd,b as bo,x as xo,L as Lt,G as Gt,m as mo,c as po,V as Vn,A as An,v as va,F as go,_ as _o,d as pn,h as hn,e as cn,r as ln,g as dn,C as mn,i as at,j as an}from'./chunk-Bs2lM6dc.js';import {g,W,F,I as Ie,ag as U,U as Ui,G as U$1,a2 as da,aa as Tr,M as x,K as w,y as yw,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,v as vl,j as jw,Z as Zw,l as lg,_ as _I,H as Hw,am as Bw,J as Jw,R as NI,O as Og,m as Uw,k as cg,r as df,s as ff}from'./main-ZPG3XUQU.js';var ce=(o,t)=>t.id;function ue(o,t){o&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function fe(o,t){if(o&1&&(Ds(0,"ds-form-field",20),lg(1,"input",22),pl()),o&2){let e=Jw(3);BE(),ug("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function ge(o,t){if(o&1&&(Ds(0,"option",24),NC(1),pl()),o&2){let e=t.$implicit;ug("ngValue",e.id),BE(),Og(e.name);}}function Ce(o,t){if(o&1&&(Ds(0,"ds-form-field",21)(1,"select",23)(2,"option",24),NC(3,"\u2014 None \u2014"),pl(),Hw(4,ge,2,2,"option",24,ce),pl(),_I(),pl()),o&2){let e=Jw(3);BE(),ug("formControl",e.agentConfigIdControl),NI(),BE(),ug("ngValue",null),BE(2),Uw(e.availableAgentConfigs());}}function ye(o,t){if(o&1&&Lw(0,fe,2,1,"ds-form-field",20)(1,Ce,6,2,"ds-form-field",21),o&2){let e=Jw(2);jw(e.isEditMode()&&e.agentConfigIdControl.value?0:e.isEditMode()?-1:1);}}function ve(o,t){o&1&&(Ds(0,"p",2),NC(1,"No parameters defined."),pl());}function he(o,t){if(o&1){let e=Zw();Ds(0,"div",11)(1,"div",25)(2,"ds-form-field",26),lg(3,"input",27),_I(),pl(),Ds(4,"ds-form-field",28),lg(5,"input",29),_I(),pl(),Ds(6,"ds-form-field",30),lg(7,"input",31),_I(),pl()(),Ds(8,"button",32),mg("click",function(){let d=df(e).$index,m=Jw(2);return ff(m.removeParameter(d))}),NC(9," \xD7 "),pl()();}if(o&2){let e=t.$implicit,r=t.$index;ug("formGroupName",r),BE(2),ug("controlId","param-name-"+r)("error",e.controls.name.invalid&&e.controls.name.touched?"Parameter name is required.":null),BE(),ug("id","param-name-"+r),NI(),BE(),ug("controlId","param-desc-"+r),BE(),ug("id","param-desc-"+r),NI(),BE(),ug("controlId","param-default-"+r),BE(),ug("id","param-default-"+r),NI();}}function _e(o,t){if(o&1){let e=Zw();Ds(0,"div",14)(1,"span",33),NC(2),pl(),Ds(3,"ds-form-field",34),lg(4,"textarea",35),_I(),pl(),Ds(5,"button",36),mg("click",function(){let d=df(e).$index,m=Jw(2);return ff(m.removeContentEntry(d))}),NC(6," \xD7 "),pl()();}if(o&2){let e=t.$implicit,r=t.$index,d=Jw(2);BE(2),Og(r+1),BE(),ug("error",e.invalid&&e.touched?"Content entry must not be blank.":null),BE(),ug("formControlName",r),cg("aria-label","Content entry "+(r+1)),NI(),BE(),ug("disabled",d.contentArray.length===1);}}function xe(o,t){if(o&1&&(Ds(0,"ds-notice"),NC(1),pl()),o&2){let e=Jw(2);BE(),Og(e.errorMessage());}}function be(o,t){if(o&1){let e=Zw();Ds(0,"button",37),mg("click",function(){df(e);let d=Jw(2);return ff(d.exportYaml())}),NC(1),pl();}if(o&2){let e=Jw(2);ug("disabled",e.isExporting()),BE(),vl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ee(o,t){if(o&1){let e=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let d=Jw();return ff(d.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),_I(),pl(),Ds(3,"ds-form-field",7),lg(4,"input",8),_I(),pl(),Lw(5,ye,2,1),Ds(6,"ds-fieldset",9)(7,"p",2),NC(8," Each parameter must have a name and a default value. Use "),Ds(9,"code"),NC(10),pl(),NC(11," in content entries to reference them. "),pl(),Ds(12,"div",10),Lw(13,ve,2,0,"p",2),Hw(14,he,10,8,"div",11,Bw),Ds(16,"div")(17,"button",12),mg("click",function(){df(e);let d=Jw();return ff(d.addParameter())}),NC(18,"+ Add parameter"),pl()()()(),Ds(19,"ds-fieldset",13)(20,"p",2),NC(21," Each content entry is a command. Use "),Ds(22,"code"),NC(23,"@AgentName"),pl(),NC(24," to target an agent, "),Ds(25,"code"),NC(26,"/promptName param1 param2"),pl(),NC(27," to call another prompt, and "),Ds(28,"code"),NC(29),pl(),NC(30," for parameter placeholders. "),pl(),Ds(31,"div",10),Hw(32,_e,7,5,"div",14,Bw),Ds(34,"div")(35,"button",12),mg("click",function(){df(e);let d=Jw();return ff(d.addContentEntry())}),NC(36,"+ Add content entry"),pl()()()(),Lw(37,xe,2,1,"ds-notice"),Ds(38,"ds-form-field",15),lg(39,"textarea",16),_I(),pl(),Ds(40,"ds-form-actions")(41,"button",17),NC(42),pl(),Lw(43,be,2,2,"button",18),Ds(44,"button",19),mg("click",function(){df(e);let d=Jw();return ff(d.cancel())}),NC(45,"Cancel"),pl()()();}if(o&2){let e=Jw();ug("formGroup",e.form),BE(),ug("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),BE(),ug("formControl",e.nameControl),NI(),BE(2),ug("formControl",e.descriptionControl),NI(),BE(),jw(e.availableAgentConfigs().length>0?5:-1),BE(5),Og(e.paramPlaceholderSyntax),BE(2),ug("formArrayName","parameters"),BE(),jw(e.parametersArray.length===0?13:-1),BE(),Uw(e.parametersArray.controls),BE(15),Og(e.paramPlaceholderSyntax),BE(2),ug("formArrayName","content"),BE(),Uw(e.contentArray.controls),BE(5),jw(e.errorMessage()?37:-1),BE(),ug("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),BE(),ug("formControl",e.externalMetadataJsonControl),NI(),BE(2),ug("disabled",e.form.invalid||e.isSubmitting()),BE(),vl(" ",e.isEditMode()?"Save changes":"Create"," "),BE(),jw(e.isEditMode()?43:-1);}}var pe=class o{route=g(W);router=g(F);destroyRef=g(Ie);promptState=g(m);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(null),agentConfigId:new Te(null),externalMetadataJson:new Te("",{nonNullable:true,validators:[Pe]}),content:new Bt([this.createContentControl()],{validators:[fn.required]}),parameters:new Bt([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);isExporting=Ui(false);errorMessage=Ui(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=Ui([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(true),this.loadPrompt(t)),this.isPlatformMode?this.loadPlatformAgentConfigs():this.namespaceId&&this.loadAgentConfigs(this.namespaceId);}loadPrompt(t){this.isLoading.set(true),this.promptState.getById(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadAgentConfigs(t){this.agentConfigController.listByParentAgentConfig(t).pipe(U$1(this.destroyRef),da(()=>Tr([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U$1(this.destroyRef),da(()=>Tr([]))).subscribe(t=>this.agentConfigs.set(t));}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(r=>this.contentArray.push(this.createContentControl(r))),this.parametersArray.clear(),(t.parameters??[]).forEach(r=>this.parametersArray.push(this.createParameterGroup(r))),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}createContentControl(t=""){return new Te(t,{nonNullable:true,validators:[fn.required,fn.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl());}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t);}createParameterGroup(t){return new pt({name:new Te(t?.name??"",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(t?.description??null),defaultValue:new Te(t?.defaultValue??"",{nonNullable:true,validators:[fn.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup());}removeParameter(t){this.parametersArray.removeAt(t);}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId,sourceLanguage:this.existingPrompt?.sourceLanguage??"en",name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(m=>m.value.trim()),parameters:this.parametersArray.controls.map(m=>({name:m.controls.name.value.trim(),description:m.controls.description.value?.trim()||void 0,defaultValue:m.controls.defaultValue.value.trim()}))});t||(e.agentConfigId=this.agentConfigIdControl.value||null);let r=this.externalMetadataJsonControl.value.trim();e.externalMetadata=r?JSON.parse(r):null;let d=t?this.promptState.update(this.existingPrompt.id,e):this.promptState.create(e);this.errorMessage.set(null),d.pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:m=>{this.isSubmitting.set(false),m.status===409?this.errorMessage.set(`A prompt named "${e.name}" already exists in this scope.`):m.status===400?this.errorMessage.set(m.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}exportYaml(){let t=this.existingPrompt?.id;!t||this.isExporting()||(this.isExporting.set(true),this.promptState.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let r=new Blob([e],{type:"application/yaml"}),d=URL.createObjectURL(r),m=document.createElement("a");m.href=d,m.download=`${this.existingPrompt?.name??"prompt"}.yaml`,m.click(),URL.revokeObjectURL(d),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"]);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=yw({type:o,selectors:[["agentos-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","prompt-name","required","",3,"error"],["dsControl","","id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",3,"formControl"],["label","Description","controlId","prompt-description"],["dsControl","","id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",3,"formControl"],["legend","Parameters","legendHint","Named placeholders used in content"],[1,"ds-stack",3,"formArrayName"],[1,"ds-panel","ds-inline","ds-inline--start",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["legend","Content","legendHint","Ordered list of text commands"],[1,"ds-inline","ds-inline--start"],["label","External Metadata","controlId","prompt-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["label","Agent Config","hint","Agent Config cannot be changed after creation."],["label","Agent Config","controlId","prompt-agent-config","hint","Optional. Links this prompt to an agent as a starter. Immutable after creation."],["dsControl","","type","text","readonly","",3,"value"],["dsControl","","id","prompt-agent-config",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-grow"],["label","Name","required","",3,"controlId","error"],["dsControl","","type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",3,"id"],["label","Description",3,"controlId"],["dsControl","","type","text","placeholder","Optional","formControlName","description","autocomplete","off",3,"id"],["label","Default value",3,"controlId"],["dsControl","","type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",3,"id"],["dsButton","","variant","icon-danger","type","button","title","Remove this parameter","aria-label","Remove this parameter",3,"click"],[1,"ds-index"],["grow","",3,"error"],["dsControl","","rows","4","placeholder","Enter a command\u2026",3,"formControlName"],["dsButton","","variant","icon-danger","type","button","title","Remove this entry","aria-label","Remove this entry",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,r){e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return r.cancel()}),NC(3),pl()(),Lw(4,ue,2,0,"p",2)(5,Ee,46,16,"form",3),pl()),e&2&&(BE(),ug("title",r.isEditMode()?"Edit prompt":"New prompt"),BE(2),vl(" \u2190 ",r.isPlatformMode?"Platform prompts":"Prompts"," "),BE(),jw(r.isLoading()?4:5));},dependencies:[Ut,nd,bo,xo,Lt,Gt,mo,po,Vn,An,va,go,_o,pn,hn,cn,ln,dn,mn,at,an],encapsulation:2})};function Pe(o){let t=o.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}export{pe as PromptFormComponent};
1
+ import {D as m,p as pt,E as Bt,T as Te,a as fn,U as Ut,n as nd,b as bo,x as xo,L as Lt,G as Gt,m as mo,c as po,V as Vn,A as An,v as va,F as go,_ as _o,d as pn,h as hn,e as cn,r as ln,g as dn,C as mn,i as at,j as an}from'./chunk-BOcSAL90.js';import {g,W,F,I as Ie,ag as U,U as Ui,G as U$1,a2 as da,aa as Tr,M as x,K as w,y as yw,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,v as vl,j as jw,Z as Zw,l as lg,_ as _I,H as Hw,am as Bw,J as Jw,R as NI,O as Og,m as Uw,k as cg,r as df,s as ff}from'./main-YOWURGI5.js';var ce=(o,t)=>t.id;function ue(o,t){o&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function fe(o,t){if(o&1&&(Ds(0,"ds-form-field",20),lg(1,"input",22),pl()),o&2){let e=Jw(3);BE(),ug("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function ge(o,t){if(o&1&&(Ds(0,"option",24),NC(1),pl()),o&2){let e=t.$implicit;ug("ngValue",e.id),BE(),Og(e.name);}}function Ce(o,t){if(o&1&&(Ds(0,"ds-form-field",21)(1,"select",23)(2,"option",24),NC(3,"\u2014 None \u2014"),pl(),Hw(4,ge,2,2,"option",24,ce),pl(),_I(),pl()),o&2){let e=Jw(3);BE(),ug("formControl",e.agentConfigIdControl),NI(),BE(),ug("ngValue",null),BE(2),Uw(e.availableAgentConfigs());}}function ye(o,t){if(o&1&&Lw(0,fe,2,1,"ds-form-field",20)(1,Ce,6,2,"ds-form-field",21),o&2){let e=Jw(2);jw(e.isEditMode()&&e.agentConfigIdControl.value?0:e.isEditMode()?-1:1);}}function ve(o,t){o&1&&(Ds(0,"p",2),NC(1,"No parameters defined."),pl());}function he(o,t){if(o&1){let e=Zw();Ds(0,"div",11)(1,"div",25)(2,"ds-form-field",26),lg(3,"input",27),_I(),pl(),Ds(4,"ds-form-field",28),lg(5,"input",29),_I(),pl(),Ds(6,"ds-form-field",30),lg(7,"input",31),_I(),pl()(),Ds(8,"button",32),mg("click",function(){let d=df(e).$index,m=Jw(2);return ff(m.removeParameter(d))}),NC(9," \xD7 "),pl()();}if(o&2){let e=t.$implicit,r=t.$index;ug("formGroupName",r),BE(2),ug("controlId","param-name-"+r)("error",e.controls.name.invalid&&e.controls.name.touched?"Parameter name is required.":null),BE(),ug("id","param-name-"+r),NI(),BE(),ug("controlId","param-desc-"+r),BE(),ug("id","param-desc-"+r),NI(),BE(),ug("controlId","param-default-"+r),BE(),ug("id","param-default-"+r),NI();}}function _e(o,t){if(o&1){let e=Zw();Ds(0,"div",14)(1,"span",33),NC(2),pl(),Ds(3,"ds-form-field",34),lg(4,"textarea",35),_I(),pl(),Ds(5,"button",36),mg("click",function(){let d=df(e).$index,m=Jw(2);return ff(m.removeContentEntry(d))}),NC(6," \xD7 "),pl()();}if(o&2){let e=t.$implicit,r=t.$index,d=Jw(2);BE(2),Og(r+1),BE(),ug("error",e.invalid&&e.touched?"Content entry must not be blank.":null),BE(),ug("formControlName",r),cg("aria-label","Content entry "+(r+1)),NI(),BE(),ug("disabled",d.contentArray.length===1);}}function xe(o,t){if(o&1&&(Ds(0,"ds-notice"),NC(1),pl()),o&2){let e=Jw(2);BE(),Og(e.errorMessage());}}function be(o,t){if(o&1){let e=Zw();Ds(0,"button",37),mg("click",function(){df(e);let d=Jw(2);return ff(d.exportYaml())}),NC(1),pl();}if(o&2){let e=Jw(2);ug("disabled",e.isExporting()),BE(),vl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ee(o,t){if(o&1){let e=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let d=Jw();return ff(d.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),_I(),pl(),Ds(3,"ds-form-field",7),lg(4,"input",8),_I(),pl(),Lw(5,ye,2,1),Ds(6,"ds-fieldset",9)(7,"p",2),NC(8," Each parameter must have a name and a default value. Use "),Ds(9,"code"),NC(10),pl(),NC(11," in content entries to reference them. "),pl(),Ds(12,"div",10),Lw(13,ve,2,0,"p",2),Hw(14,he,10,8,"div",11,Bw),Ds(16,"div")(17,"button",12),mg("click",function(){df(e);let d=Jw();return ff(d.addParameter())}),NC(18,"+ Add parameter"),pl()()()(),Ds(19,"ds-fieldset",13)(20,"p",2),NC(21," Each content entry is a command. Use "),Ds(22,"code"),NC(23,"@AgentName"),pl(),NC(24," to target an agent, "),Ds(25,"code"),NC(26,"/promptName param1 param2"),pl(),NC(27," to call another prompt, and "),Ds(28,"code"),NC(29),pl(),NC(30," for parameter placeholders. "),pl(),Ds(31,"div",10),Hw(32,_e,7,5,"div",14,Bw),Ds(34,"div")(35,"button",12),mg("click",function(){df(e);let d=Jw();return ff(d.addContentEntry())}),NC(36,"+ Add content entry"),pl()()()(),Lw(37,xe,2,1,"ds-notice"),Ds(38,"ds-form-field",15),lg(39,"textarea",16),_I(),pl(),Ds(40,"ds-form-actions")(41,"button",17),NC(42),pl(),Lw(43,be,2,2,"button",18),Ds(44,"button",19),mg("click",function(){df(e);let d=Jw();return ff(d.cancel())}),NC(45,"Cancel"),pl()()();}if(o&2){let e=Jw();ug("formGroup",e.form),BE(),ug("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),BE(),ug("formControl",e.nameControl),NI(),BE(2),ug("formControl",e.descriptionControl),NI(),BE(),jw(e.availableAgentConfigs().length>0?5:-1),BE(5),Og(e.paramPlaceholderSyntax),BE(2),ug("formArrayName","parameters"),BE(),jw(e.parametersArray.length===0?13:-1),BE(),Uw(e.parametersArray.controls),BE(15),Og(e.paramPlaceholderSyntax),BE(2),ug("formArrayName","content"),BE(),Uw(e.contentArray.controls),BE(5),jw(e.errorMessage()?37:-1),BE(),ug("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),BE(),ug("formControl",e.externalMetadataJsonControl),NI(),BE(2),ug("disabled",e.form.invalid||e.isSubmitting()),BE(),vl(" ",e.isEditMode()?"Save changes":"Create"," "),BE(),jw(e.isEditMode()?43:-1);}}var pe=class o{route=g(W);router=g(F);destroyRef=g(Ie);promptState=g(m);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(null),agentConfigId:new Te(null),externalMetadataJson:new Te("",{nonNullable:true,validators:[Pe]}),content:new Bt([this.createContentControl()],{validators:[fn.required]}),parameters:new Bt([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);isExporting=Ui(false);errorMessage=Ui(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=Ui([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(true),this.loadPrompt(t)),this.isPlatformMode?this.loadPlatformAgentConfigs():this.namespaceId&&this.loadAgentConfigs(this.namespaceId);}loadPrompt(t){this.isLoading.set(true),this.promptState.getById(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadAgentConfigs(t){this.agentConfigController.listByParentAgentConfig(t).pipe(U$1(this.destroyRef),da(()=>Tr([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U$1(this.destroyRef),da(()=>Tr([]))).subscribe(t=>this.agentConfigs.set(t));}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(r=>this.contentArray.push(this.createContentControl(r))),this.parametersArray.clear(),(t.parameters??[]).forEach(r=>this.parametersArray.push(this.createParameterGroup(r))),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}createContentControl(t=""){return new Te(t,{nonNullable:true,validators:[fn.required,fn.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl());}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t);}createParameterGroup(t){return new pt({name:new Te(t?.name??"",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(t?.description??null),defaultValue:new Te(t?.defaultValue??"",{nonNullable:true,validators:[fn.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup());}removeParameter(t){this.parametersArray.removeAt(t);}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId,sourceLanguage:this.existingPrompt?.sourceLanguage??"en",name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(m=>m.value.trim()),parameters:this.parametersArray.controls.map(m=>({name:m.controls.name.value.trim(),description:m.controls.description.value?.trim()||void 0,defaultValue:m.controls.defaultValue.value.trim()}))});t||(e.agentConfigId=this.agentConfigIdControl.value||null);let r=this.externalMetadataJsonControl.value.trim();e.externalMetadata=r?JSON.parse(r):null;let d=t?this.promptState.update(this.existingPrompt.id,e):this.promptState.create(e);this.errorMessage.set(null),d.pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:m=>{this.isSubmitting.set(false),m.status===409?this.errorMessage.set(`A prompt named "${e.name}" already exists in this scope.`):m.status===400?this.errorMessage.set(m.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}exportYaml(){let t=this.existingPrompt?.id;!t||this.isExporting()||(this.isExporting.set(true),this.promptState.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let r=new Blob([e],{type:"application/yaml"}),d=URL.createObjectURL(r),m=document.createElement("a");m.href=d,m.download=`${this.existingPrompt?.name??"prompt"}.yaml`,m.click(),URL.revokeObjectURL(d),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"]);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=yw({type:o,selectors:[["agentos-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","prompt-name","required","",3,"error"],["dsControl","","id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",3,"formControl"],["label","Description","controlId","prompt-description"],["dsControl","","id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",3,"formControl"],["legend","Parameters","legendHint","Named placeholders used in content"],[1,"ds-stack",3,"formArrayName"],[1,"ds-panel","ds-inline","ds-inline--start",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["legend","Content","legendHint","Ordered list of text commands"],[1,"ds-inline","ds-inline--start"],["label","External Metadata","controlId","prompt-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["label","Agent Config","hint","Agent Config cannot be changed after creation."],["label","Agent Config","controlId","prompt-agent-config","hint","Optional. Links this prompt to an agent as a starter. Immutable after creation."],["dsControl","","type","text","readonly","",3,"value"],["dsControl","","id","prompt-agent-config",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-grow"],["label","Name","required","",3,"controlId","error"],["dsControl","","type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",3,"id"],["label","Description",3,"controlId"],["dsControl","","type","text","placeholder","Optional","formControlName","description","autocomplete","off",3,"id"],["label","Default value",3,"controlId"],["dsControl","","type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",3,"id"],["dsButton","","variant","icon-danger","type","button","title","Remove this parameter","aria-label","Remove this parameter",3,"click"],[1,"ds-index"],["grow","",3,"error"],["dsControl","","rows","4","placeholder","Enter a command\u2026",3,"formControlName"],["dsButton","","variant","icon-danger","type","button","title","Remove this entry","aria-label","Remove this entry",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,r){e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return r.cancel()}),NC(3),pl()(),Lw(4,ue,2,0,"p",2)(5,Ee,46,16,"form",3),pl()),e&2&&(BE(),ug("title",r.isEditMode()?"Edit prompt":"New prompt"),BE(2),vl(" \u2190 ",r.isPlatformMode?"Platform prompts":"Prompts"," "),BE(),jw(r.isLoading()?4:5));},dependencies:[Ut,nd,bo,xo,Lt,Gt,mo,po,Vn,An,va,go,_o,pn,hn,cn,ln,dn,mn,at,an],encapsulation:2})};function Pe(o){let t=o.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}export{pe as PromptFormComponent};
@@ -1 +1 @@
1
- import {z as k$1,O,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-Bs2lM6dc.js';import {g,F,I as Ie,ap as F$1,$ as Cr,U as Ui,a1 as fa,G as U$1,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,H as Hw,m as Uw,Z as Zw,k as cg,r as df,s as ff}from'./main-ZPG3XUQU.js';var B=(i,e)=>e.id??e.name;function M(i,e){if(i&1&&(Ds(0,"p",3),NC(1),pl()),i&2){let t=Jw();BE(),Og(t.deletion.error());}}function U(i,e){i&1&&(Ds(0,"p",4),NC(1,"Loading AI providers\u2026"),pl());}function j(i,e){i&1&&(Ds(0,"p",5),NC(1,"No platform AI providers defined yet."),pl());}function K(i,e){i&1&&(Ds(0,"p",4),NC(1,"No AI providers match the current filter."),pl());}function H(i,e){if(i&1){let t=Zw();Ds(0,"button",19),mg("click",function(){df(t);let s=Jw().$implicit,m=Jw(2);return ff(m.edit(s))}),NC(1," Edit "),pl();}if(i&2){let t=Jw().$implicit;cg("aria-label","Edit "+t.name);}}function z(i,e){if(i&1){let t=Zw();Ds(0,"agentos-row-delete-action",20),mg("deleteRequested",function(){df(t);let s=Jw().$implicit,m=Jw(2);return ff(m.deletion.request(s.id))})("deleteConfirmed",function(){df(t);let s=Jw().$implicit,m=Jw(2);return ff(m.confirmDelete(s))})("deleteCancelled",function(){df(t);let s=Jw(3);return ff(s.deletion.cancel())}),pl();}if(i&2){let t=Jw().$implicit,r=Jw(2);ug("rowKey",t.id)("rowLabel",t.name)("state",r.deletion);}}function G(i,e){if(i&1&&(Ds(0,"tr",9)(1,"td",12),NC(2),pl(),Ds(3,"td",13),NC(4),pl(),Ds(5,"td",14),NC(6),pl(),Ds(7,"td",15)(8,"div",16),Lw(9,H,2,1,"button",17),Lw(10,z,1,3,"agentos-row-delete-action",18),pl()()()),i&2){let t=e.$implicit,r=Jw(2);BE(2),Og(t.name),BE(2),Og(t.apiType),BE(2),Og(t.baseUrl||"\u2014"),BE(3),jw(r.deletion.confirmingId()!==t.id?9:-1),BE(),jw(t.id?10:-1);}}function J(i,e){if(i&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"API type"),pl(),Ds(8,"th",10),NC(9,"Base URL"),pl(),Ds(10,"th",10)(11,"span",11),NC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Hw(14,G,11,5,"tr",9,B),pl()()()),i&2){let t=Jw();BE(14),Uw(t.rowFilter.filteredRows());}}var k=class i{router=g(F);destroyRef=g(Ie);aiProviderController=g(F$1);refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k$1();providers=Ui([]);rowFilter=O(this.providers,e=>[e.name,e.apiType,e.baseUrl].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.aiProviderController.listAiProvider("none"))),U$1(this.destroyRef)).subscribe({next:e=>{this.providers.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","ai-providers","new"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","ai-providers",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.aiProviderController.deleteAiProvider(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-platform-ai-providers"]],decls:9,vars:3,consts:[["title","Platform AI providers","description","AI providers shared across every namespace."],["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","Platform 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"],["role","cell","data-label","Base URL",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(t,r){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return r.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return r.openCreateForm()}),NC(3,"New AI provider"),pl()(),Lw(4,M,2,1,"p",3),Lw(5,U,2,0,"p",4)(6,j,2,0,"p",5)(7,K,2,0,"p",4)(8,J,16,0,"div",6)),t&2&&(BE(),ug("query",r.rowFilter.query()),BE(3),jw(r.deletion.error()?4:-1),BE(),jw(r.isLoading()?5:r.providers().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{k as PlatformAiProvidersComponent};
1
+ import {z as k$1,O,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-BOcSAL90.js';import {g,F,I as Ie,ap as F$1,$ as Cr,U as Ui,a1 as fa,G as U$1,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,H as Hw,m as Uw,Z as Zw,k as cg,r as df,s as ff}from'./main-YOWURGI5.js';var B=(i,e)=>e.id??e.name;function M(i,e){if(i&1&&(Ds(0,"p",3),NC(1),pl()),i&2){let t=Jw();BE(),Og(t.deletion.error());}}function U(i,e){i&1&&(Ds(0,"p",4),NC(1,"Loading AI providers\u2026"),pl());}function j(i,e){i&1&&(Ds(0,"p",5),NC(1,"No platform AI providers defined yet."),pl());}function K(i,e){i&1&&(Ds(0,"p",4),NC(1,"No AI providers match the current filter."),pl());}function H(i,e){if(i&1){let t=Zw();Ds(0,"button",19),mg("click",function(){df(t);let s=Jw().$implicit,m=Jw(2);return ff(m.edit(s))}),NC(1," Edit "),pl();}if(i&2){let t=Jw().$implicit;cg("aria-label","Edit "+t.name);}}function z(i,e){if(i&1){let t=Zw();Ds(0,"agentos-row-delete-action",20),mg("deleteRequested",function(){df(t);let s=Jw().$implicit,m=Jw(2);return ff(m.deletion.request(s.id))})("deleteConfirmed",function(){df(t);let s=Jw().$implicit,m=Jw(2);return ff(m.confirmDelete(s))})("deleteCancelled",function(){df(t);let s=Jw(3);return ff(s.deletion.cancel())}),pl();}if(i&2){let t=Jw().$implicit,r=Jw(2);ug("rowKey",t.id)("rowLabel",t.name)("state",r.deletion);}}function G(i,e){if(i&1&&(Ds(0,"tr",9)(1,"td",12),NC(2),pl(),Ds(3,"td",13),NC(4),pl(),Ds(5,"td",14),NC(6),pl(),Ds(7,"td",15)(8,"div",16),Lw(9,H,2,1,"button",17),Lw(10,z,1,3,"agentos-row-delete-action",18),pl()()()),i&2){let t=e.$implicit,r=Jw(2);BE(2),Og(t.name),BE(2),Og(t.apiType),BE(2),Og(t.baseUrl||"\u2014"),BE(3),jw(r.deletion.confirmingId()!==t.id?9:-1),BE(),jw(t.id?10:-1);}}function J(i,e){if(i&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"API type"),pl(),Ds(8,"th",10),NC(9,"Base URL"),pl(),Ds(10,"th",10)(11,"span",11),NC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Hw(14,G,11,5,"tr",9,B),pl()()()),i&2){let t=Jw();BE(14),Uw(t.rowFilter.filteredRows());}}var k=class i{router=g(F);destroyRef=g(Ie);aiProviderController=g(F$1);refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k$1();providers=Ui([]);rowFilter=O(this.providers,e=>[e.name,e.apiType,e.baseUrl].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.aiProviderController.listAiProvider("none"))),U$1(this.destroyRef)).subscribe({next:e=>{this.providers.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","ai-providers","new"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","ai-providers",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.aiProviderController.deleteAiProvider(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-platform-ai-providers"]],decls:9,vars:3,consts:[["title","Platform AI providers","description","AI providers shared across every namespace."],["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","Platform 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"],["role","cell","data-label","Base URL",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(t,r){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return r.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return r.openCreateForm()}),NC(3,"New AI provider"),pl()(),Lw(4,M,2,1,"p",3),Lw(5,U,2,0,"p",4)(6,j,2,0,"p",5)(7,K,2,0,"p",4)(8,J,16,0,"div",6)),t&2&&(BE(),ug("query",r.rowFilter.query()),BE(3),jw(r.deletion.error()?4:-1),BE(),jw(r.isLoading()?5:r.providers().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{k as PlatformAiProvidersComponent};
@@ -1 +1 @@
1
- import {f,a4 as id,n as nd,L as Lt,m as mo,c as po,a5 as so,a6 as da,a7 as ra,d as pn,h as hn,e as cn,C as mn,i as at,j as an,I as Io,a8 as f$1}from'./chunk-Bs2lM6dc.js';import {g,W,aM as Y,U as Ui,ab as le,q as Af,y as yw,aN as hb,D as Ds,l as lg,L as Lw,p as pl,a as BE,j as jw,ak as md,a1 as fa,a3 as nn,ac as Ty,a2 as da$1,N as NC,Z as Zw,Q as mg,aO as Bg,_ as _I,J as Jw,aP as jg,R as NI,H as Hw,m as Uw,aQ as $C,aR as UC,O as Og,k as cg,av as zC,aw as WC,as as kg,v as vl,aS as qC,r as df,s as ff,aT as FC}from'./main-ZPG3XUQU.js';var ce=e=>({title:"By agent",rows:e}),pe=e=>({title:"By model",rows:e}),ge=(e,a)=>[e,a],ue=(e,a)=>a.title,_e=(e,a)=>a.key;function Ce(e,a){e&1&&(Ds(0,"p",2),NC(1,"Loading usage settings\u2026"),pl());}function fe(e,a){if(e&1){let t=Zw();Ds(0,"ds-notice"),NC(1,"Could not load usage settings. Please try again."),pl(),Ds(2,"div")(3,"button",3),mg("click",function(){df(t);let s=Jw();return ff(s.configuration.retry())}),NC(4,"Retry usage settings"),pl()();}}function ye(e,a){e&1&&(Ds(0,"p",2),NC(1,"Usage tracking is disabled."),pl());}function be(e,a){e&1&&(Ds(0,"ds-notice"),NC(1),pl()),e&2&&(BE(),Og(a));}function xe(e,a){e&1&&(Ds(0,"p",2),NC(1,"Loading usage\u2026"),pl());}function he(e,a){e&1&&(Ds(0,"p",12),NC(1,"No recorded usage for this period."),pl());}function Se(e,a){if(e&1&&(Ds(0,"p",10),NC(1),pl()),e&2){let t=Jw().$implicit;BE(),vl("",t.aggregate.unknownCostCount," record(s) with unknown cost");}}function we(e,a){if(e&1&&(Ds(0,"tr",16)(1,"td",18),NC(2),pl(),Ds(3,"td",19),NC(4),zC(5,"number"),pl(),Ds(6,"td",20),NC(7),zC(8,"number"),zC(9,"number"),pl(),Ds(10,"td",21),NC(11),zC(12,"number"),zC(13,"number"),pl(),Ds(14,"td",22),NC(15),zC(16,"agentosCost"),Lw(17,Se,2,1,"p",10),pl()()),e&2){let t=a.$implicit;BE(2),Og(t.key),BE(2),Og(WC(5,8,t.aggregate.totalTokens)),BE(3),kg(" ",WC(8,10,t.aggregate.inputTokens)," / ",WC(9,12,t.aggregate.outputTokens)," "),BE(4),kg(" ",WC(12,14,t.aggregate.cacheReadTokens)," / ",WC(13,16,t.aggregate.cacheWriteTokens)," "),BE(4),vl(" ",qC(16,18,t.aggregate.cost,t.aggregate.unknownCostCount)," "),BE(2),jw(t.aggregate.unknownCostCount>0?17:-1);}}function ve(e,a){if(e&1&&(Ds(0,"div",13)(1,"table",14)(2,"thead",15)(3,"tr",16)(4,"th",17),NC(5,"Name"),pl(),Ds(6,"th",17),NC(7,"Tokens"),pl(),Ds(8,"th",17),NC(9,"Input / output"),pl(),Ds(10,"th",17),NC(11,"Cache read / write"),pl(),Ds(12,"th",17),NC(13,"Estimated cost"),pl()()(),Ds(14,"tbody",15),Hw(15,we,18,21,"tr",16,_e),pl()()()),e&2){let t=Jw().$implicit;BE(),cg("aria-label","Usage "+t.title.toLowerCase()),BE(14),Uw(t.rows);}}function Ne(e,a){if(e&1&&(Ds(0,"h3",11),NC(1),pl(),Lw(2,he,2,0,"p",12)(3,ve,17,1,"div",13)),e&2){let t=a.$implicit;BE(),Og(t.title),BE(),jw(t.rows.length===0?2:3);}}function Te(e,a){if(e&1&&(Hw(0,Ne,4,2,null,null,ue),Ds(2,"p",10),NC(3," Unpriced usage is kept separate from known costs. Active agent runs appear here after they finish. "),pl()),e&2){let t=Jw(2);Uw($C(4,ge,UC(0,ce,t.agents()),UC(2,pe,t.models())));}}function Ee(e,a){if(e&1){let t=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(t);let s=Jw();return ff(s.load())}),Ds(1,"ds-form-field",5)(2,"input",6),Bg("ngModelChange",function(s){df(t);let m=Jw();return FC(m.from,s)||(m.from=s),ff(s)}),pl(),_I(),pl(),Ds(3,"ds-form-field",7)(4,"input",8),Bg("ngModelChange",function(s){df(t);let m=Jw();return FC(m.to,s)||(m.to=s),ff(s)}),pl(),_I(),pl(),Ds(5,"button",9),NC(6,"Refresh"),pl()(),Lw(7,be,2,1,"ds-notice"),Lw(8,xe,2,0,"p",2)(9,Te,4,7);}if(e&2){let t,r=Jw();BE(2),jg("ngModel",r.from),NI(),BE(2),jg("ngModel",r.to),NI(),BE(3),jw((t=r.error())?7:-1,t),BE(),jw(r.loading()?8:r.error()?-1:9);}}var me=class e{route=g(W);api=g(Y);configuration=g(f);namespaceId=this.route.snapshot.params.namespaceId;agents=Ui([]);models=Ui([]);error=Ui(null);loading=Ui(false);from=new Date(Date.now()-30*864e5).toISOString().slice(0,10);to=new Date().toISOString().slice(0,10);refresh=new le;constructor(){Af(a=>{if(!this.configuration.enabled())return;let t=this.refresh.pipe(md(void 0),fa(()=>{this.error.set(null),this.agents.set([]),this.models.set([]);let r=new Date(`${this.from}T00:00:00.000Z`),s=new Date(`${this.to}T23:59:59.999Z`);return !Number.isFinite(r.getTime())||!Number.isFinite(s.getTime())||r>s?(this.error.set("Select a valid date range."),this.loading.set(false),nn):(this.loading.set(true),Ty({agents:this.api.aggregateByAgentUsageRecord(this.namespaceId,r.toISOString(),s.toISOString()),models:this.api.aggregateByModelUsageRecord(this.namespaceId,r.toISOString(),s.toISOString())}).pipe(da$1(m=>(this.loading.set(false),this.error.set(m.status===403?"Namespace admin permission is required to view this report.":"Could not load usage. Please try again."),nn))))})).subscribe(({agents:r,models:s})=>{this.agents.set(r),this.models.set(s),this.loading.set(false);});a(()=>t.unsubscribe());});}load(){this.configuration.enabled()&&this.refresh.next();}static \u0275fac=function(t){return new(t||e)};static \u0275cmp=yw({type:e,selectors:[["agentos-namespace-usage"]],decls:6,vars:1,consts:[["full",""],["title","Usage and costs","description","Recorded LLM usage across this namespace. Costs are estimates in the platform currency."],["role","status",1,"settings-table__status"],["dsButton","","type","button",3,"click"],[1,"ds-inline","ds-inline--wrap","ds-inline--end",3,"ngSubmit"],["label","From (UTC)","controlId","usage-from"],["dsControl","","id","usage-from","type","date","name","from","required","",3,"ngModelChange","ngModel"],["label","To (UTC)","controlId","usage-to"],["dsControl","","id","usage-to","type","date","name","to","required","",3,"ngModelChange","ngModel"],["dsButton","","variant","primary","type","submit"],[1,"ds-hint"],[1,"ds-micro"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table"],["role","rowgroup"],["role","row"],["role","columnheader"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Tokens"],["role","cell","data-label","Input / output"],["role","cell","data-label","Cache read / write"],["role","cell","data-label","Estimated cost"]],template:function(t,r){t&1&&(Ds(0,"ds-page",0),lg(1,"ds-section-header",1),Lw(2,Ce,2,0,"p",2)(3,fe,5,0)(4,ye,2,0,"p",2)(5,Ee,10,4),pl()),t&2&&(BE(2),jw(r.configuration.state()==="loading"?2:r.configuration.state()==="error"?3:r.configuration.state()==="disabled"?4:5));},dependencies:[id,nd,Lt,mo,po,so,da,ra,pn,hn,cn,mn,at,an,Io,hb,f$1],encapsulation:2})};export{me as NamespaceUsageComponent};
1
+ import {f,a6 as id,n as nd,L as Lt,m as mo,c as po,a7 as so,a8 as da,a9 as ra,d as pn,h as hn,e as cn,C as mn,i as at,j as an,I as Io,aa as f$1}from'./chunk-BOcSAL90.js';import {g,W,aM as Y,U as Ui,ab as le,q as Af,y as yw,aN as hb,D as Ds,l as lg,L as Lw,p as pl,a as BE,j as jw,ak as md,a1 as fa,a3 as nn,ac as Ty,a2 as da$1,N as NC,Z as Zw,Q as mg,aO as Bg,_ as _I,J as Jw,aP as jg,R as NI,H as Hw,m as Uw,aQ as $C,aR as UC,O as Og,k as cg,av as zC,aw as WC,as as kg,v as vl,aS as qC,r as df,s as ff,aT as FC}from'./main-YOWURGI5.js';var ce=e=>({title:"By agent",rows:e}),pe=e=>({title:"By model",rows:e}),ge=(e,a)=>[e,a],ue=(e,a)=>a.title,_e=(e,a)=>a.key;function Ce(e,a){e&1&&(Ds(0,"p",2),NC(1,"Loading usage settings\u2026"),pl());}function fe(e,a){if(e&1){let t=Zw();Ds(0,"ds-notice"),NC(1,"Could not load usage settings. Please try again."),pl(),Ds(2,"div")(3,"button",3),mg("click",function(){df(t);let s=Jw();return ff(s.configuration.retry())}),NC(4,"Retry usage settings"),pl()();}}function ye(e,a){e&1&&(Ds(0,"p",2),NC(1,"Usage tracking is disabled."),pl());}function be(e,a){e&1&&(Ds(0,"ds-notice"),NC(1),pl()),e&2&&(BE(),Og(a));}function xe(e,a){e&1&&(Ds(0,"p",2),NC(1,"Loading usage\u2026"),pl());}function he(e,a){e&1&&(Ds(0,"p",12),NC(1,"No recorded usage for this period."),pl());}function Se(e,a){if(e&1&&(Ds(0,"p",10),NC(1),pl()),e&2){let t=Jw().$implicit;BE(),vl("",t.aggregate.unknownCostCount," record(s) with unknown cost");}}function we(e,a){if(e&1&&(Ds(0,"tr",16)(1,"td",18),NC(2),pl(),Ds(3,"td",19),NC(4),zC(5,"number"),pl(),Ds(6,"td",20),NC(7),zC(8,"number"),zC(9,"number"),pl(),Ds(10,"td",21),NC(11),zC(12,"number"),zC(13,"number"),pl(),Ds(14,"td",22),NC(15),zC(16,"agentosCost"),Lw(17,Se,2,1,"p",10),pl()()),e&2){let t=a.$implicit;BE(2),Og(t.key),BE(2),Og(WC(5,8,t.aggregate.totalTokens)),BE(3),kg(" ",WC(8,10,t.aggregate.inputTokens)," / ",WC(9,12,t.aggregate.outputTokens)," "),BE(4),kg(" ",WC(12,14,t.aggregate.cacheReadTokens)," / ",WC(13,16,t.aggregate.cacheWriteTokens)," "),BE(4),vl(" ",qC(16,18,t.aggregate.cost,t.aggregate.unknownCostCount)," "),BE(2),jw(t.aggregate.unknownCostCount>0?17:-1);}}function ve(e,a){if(e&1&&(Ds(0,"div",13)(1,"table",14)(2,"thead",15)(3,"tr",16)(4,"th",17),NC(5,"Name"),pl(),Ds(6,"th",17),NC(7,"Tokens"),pl(),Ds(8,"th",17),NC(9,"Input / output"),pl(),Ds(10,"th",17),NC(11,"Cache read / write"),pl(),Ds(12,"th",17),NC(13,"Estimated cost"),pl()()(),Ds(14,"tbody",15),Hw(15,we,18,21,"tr",16,_e),pl()()()),e&2){let t=Jw().$implicit;BE(),cg("aria-label","Usage "+t.title.toLowerCase()),BE(14),Uw(t.rows);}}function Ne(e,a){if(e&1&&(Ds(0,"h3",11),NC(1),pl(),Lw(2,he,2,0,"p",12)(3,ve,17,1,"div",13)),e&2){let t=a.$implicit;BE(),Og(t.title),BE(),jw(t.rows.length===0?2:3);}}function Te(e,a){if(e&1&&(Hw(0,Ne,4,2,null,null,ue),Ds(2,"p",10),NC(3," Unpriced usage is kept separate from known costs. Active agent runs appear here after they finish. "),pl()),e&2){let t=Jw(2);Uw($C(4,ge,UC(0,ce,t.agents()),UC(2,pe,t.models())));}}function Ee(e,a){if(e&1){let t=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(t);let s=Jw();return ff(s.load())}),Ds(1,"ds-form-field",5)(2,"input",6),Bg("ngModelChange",function(s){df(t);let m=Jw();return FC(m.from,s)||(m.from=s),ff(s)}),pl(),_I(),pl(),Ds(3,"ds-form-field",7)(4,"input",8),Bg("ngModelChange",function(s){df(t);let m=Jw();return FC(m.to,s)||(m.to=s),ff(s)}),pl(),_I(),pl(),Ds(5,"button",9),NC(6,"Refresh"),pl()(),Lw(7,be,2,1,"ds-notice"),Lw(8,xe,2,0,"p",2)(9,Te,4,7);}if(e&2){let t,r=Jw();BE(2),jg("ngModel",r.from),NI(),BE(2),jg("ngModel",r.to),NI(),BE(3),jw((t=r.error())?7:-1,t),BE(),jw(r.loading()?8:r.error()?-1:9);}}var me=class e{route=g(W);api=g(Y);configuration=g(f);namespaceId=this.route.snapshot.params.namespaceId;agents=Ui([]);models=Ui([]);error=Ui(null);loading=Ui(false);from=new Date(Date.now()-30*864e5).toISOString().slice(0,10);to=new Date().toISOString().slice(0,10);refresh=new le;constructor(){Af(a=>{if(!this.configuration.enabled())return;let t=this.refresh.pipe(md(void 0),fa(()=>{this.error.set(null),this.agents.set([]),this.models.set([]);let r=new Date(`${this.from}T00:00:00.000Z`),s=new Date(`${this.to}T23:59:59.999Z`);return !Number.isFinite(r.getTime())||!Number.isFinite(s.getTime())||r>s?(this.error.set("Select a valid date range."),this.loading.set(false),nn):(this.loading.set(true),Ty({agents:this.api.aggregateByAgentUsageRecord(this.namespaceId,r.toISOString(),s.toISOString()),models:this.api.aggregateByModelUsageRecord(this.namespaceId,r.toISOString(),s.toISOString())}).pipe(da$1(m=>(this.loading.set(false),this.error.set(m.status===403?"Namespace admin permission is required to view this report.":"Could not load usage. Please try again."),nn))))})).subscribe(({agents:r,models:s})=>{this.agents.set(r),this.models.set(s),this.loading.set(false);});a(()=>t.unsubscribe());});}load(){this.configuration.enabled()&&this.refresh.next();}static \u0275fac=function(t){return new(t||e)};static \u0275cmp=yw({type:e,selectors:[["agentos-namespace-usage"]],decls:6,vars:1,consts:[["full",""],["title","Usage and costs","description","Recorded LLM usage across this namespace. Costs are estimates in the platform currency."],["role","status",1,"settings-table__status"],["dsButton","","type","button",3,"click"],[1,"ds-inline","ds-inline--wrap","ds-inline--end",3,"ngSubmit"],["label","From (UTC)","controlId","usage-from"],["dsControl","","id","usage-from","type","date","name","from","required","",3,"ngModelChange","ngModel"],["label","To (UTC)","controlId","usage-to"],["dsControl","","id","usage-to","type","date","name","to","required","",3,"ngModelChange","ngModel"],["dsButton","","variant","primary","type","submit"],[1,"ds-hint"],[1,"ds-micro"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table"],["role","rowgroup"],["role","row"],["role","columnheader"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Tokens"],["role","cell","data-label","Input / output"],["role","cell","data-label","Cache read / write"],["role","cell","data-label","Estimated cost"]],template:function(t,r){t&1&&(Ds(0,"ds-page",0),lg(1,"ds-section-header",1),Lw(2,Ce,2,0,"p",2)(3,fe,5,0)(4,ye,2,0,"p",2)(5,Ee,10,4),pl()),t&2&&(BE(2),jw(r.configuration.state()==="loading"?2:r.configuration.state()==="error"?3:r.configuration.state()==="disabled"?4:5));},dependencies:[id,nd,Lt,mo,po,so,da,ra,pn,hn,cn,mn,at,an,Io,hb,f$1],encapsulation:2})};export{me as NamespaceUsageComponent};
@@ -1,4 +1,4 @@
1
- import {aY as A,aZ as z$1}from'./main-ZPG3XUQU.js';var ut=z$1(Xe=>{"use strict";(function(i){var n=/\S/,t=/\"/g,e=/\n/g,r=/\r/g,a=/\\/g,s=/\u2028/,u=/\u2029/;i.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},i.scan=function(h,g){var S=h.length,U=0,R=1,q=2,E=U,$=null,ee=null,B="",I=[],J=!1,O=0,C=0,L="{{",b="}}";function te(){B.length>0&&(I.push({tag:"_t",text:new String(B)}),B="");}function ge(){for(var A=!0,k=C;k<I.length;k++)if(A=i.tags[I[k].tag]<i.tags._v||I[k].tag=="_t"&&I[k].text.match(n)===null,!A)return !1;return A}function be(A,k){if(te(),A&&ge())for(var _=C,ie;_<I.length;_++)I[_].text&&((ie=I[_+1])&&ie.tag==">"&&(ie.indent=I[_].text.toString()),I.splice(_,1));else k||I.push({tag:`
1
+ import {aY as A,aZ as z$1}from'./main-YOWURGI5.js';var ut=z$1(Xe=>{"use strict";(function(i){var n=/\S/,t=/\"/g,e=/\n/g,r=/\r/g,a=/\\/g,s=/\u2028/,u=/\u2029/;i.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},i.scan=function(h,g){var S=h.length,U=0,R=1,q=2,E=U,$=null,ee=null,B="",I=[],J=!1,O=0,C=0,L="{{",b="}}";function te(){B.length>0&&(I.push({tag:"_t",text:new String(B)}),B="");}function ge(){for(var A=!0,k=C;k<I.length;k++)if(A=i.tags[I[k].tag]<i.tags._v||I[k].tag=="_t"&&I[k].text.match(n)===null,!A)return !1;return A}function be(A,k){if(te(),A&&ge())for(var _=C,ie;_<I.length;_++)I[_].text&&((ie=I[_+1])&&ie.tag==">"&&(ie.indent=I[_].text.toString()),I.splice(_,1));else k||I.push({tag:`
2
2
  `});J=!1,C=I.length;}function ne(A,k){var _="="+b,ie=A.indexOf(_,k),De=f(A.substring(A.indexOf("=",k)+1,ie)).split(" ");return L=De[0],b=De[De.length-1],ie+_.length-1}for(g&&(g=g.split(" "),L=g[0],b=g[1]),O=0;O<S;O++)E==U?v(L,h,O)?(--O,te(),E=R):h.charAt(O)==`
3
3
  `?be(J):B+=h.charAt(O):E==R?(O+=L.length-1,ee=i.tags[h.charAt(O+1)],$=ee?h.charAt(O+1):"_v",$=="="?(O=ne(h,O),E=U):(ee&&O++,E=q),J=O):v(b,h,O)?(I.push({tag:$,n:f(B),otag:L,ctag:b,i:$=="/"?J-L.length:O+b.length}),B="",O+=b.length-1,E=U,$=="{"&&(b=="}}"?O++:d(I[I.length-1]))):B+=h.charAt(O);return be(J,!0),I};function d(l){l.n.substr(l.n.length-1)==="}"&&(l.n=l.n.substring(0,l.n.length-1));}function f(l){return l.trim?l.trim():l.replace(/^\s*|\s*$/g,"")}function v(l,h,g){if(h.charAt(g)!=l.charAt(0))return !1;for(var S=1,U=l.length;S<U;S++)if(h.charAt(g+S)!=l.charAt(S))return !1;return !0}var y={_t:!0,"\n":!0,$:!0,"/":!0};function o(l,h,g,S){var U=[],R=null,q=null,E=null;for(q=g[g.length-1];l.length>0;){if(E=l.shift(),q&&q.tag=="<"&&!(E.tag in y))throw new Error("Illegal content in < super tag.");if(i.tags[E.tag]<=i.tags.$||c(E,S))g.push(E),E.nodes=o(l,E.tag,g,S);else if(E.tag=="/"){if(g.length===0)throw new Error("Closing tag without opener: /"+E.n);if(R=g.pop(),E.n!=R.n&&!m(E.n,R.n,S))throw new Error("Nesting error: "+R.n+" vs. "+E.n);return R.end=E.i,U}else E.tag==`
4
4
  `&&(E.last=l.length==0||l[0].tag==`