@whoz-oss/coday-client 0.0.0-workstream-forge.216 → 0.0.0-workstream-forge.218

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 (52) hide show
  1. package/browser/{chunk-C_Avxpfs.js → chunk--dM4D-oL.js} +1 -1
  2. package/browser/{chunk-C_Iy_sl5.js → chunk-B4MBlO_b.js} +1 -1
  3. package/browser/{chunk-Ds3Ed0sH.js → chunk-B73pA5E_.js} +1 -1
  4. package/browser/{chunk-Btt4voiy.js → chunk-BCXx84GO.js} +1 -1
  5. package/browser/{chunk-DJ76MYDz.js → chunk-BCzo9j9W.js} +1 -1
  6. package/browser/chunk-BJ563fIz.js +1 -0
  7. package/browser/{chunk-D0OTml7-.js → chunk-BMLHuIpc.js} +1 -1
  8. package/browser/{chunk-BBbt6kLE.js → chunk-BYMHlvCD.js} +1 -1
  9. package/browser/{chunk-DzRPY88Q.js → chunk-BbMAGadY.js} +1 -1
  10. package/browser/{chunk-CIRLs5BO.js → chunk-C1hG8h_Q.js} +1 -1
  11. package/browser/{chunk-DgOO5ylV.js → chunk-C83oay5Y.js} +1 -1
  12. package/browser/{chunk-DpVPRmgg.js → chunk-CAw1vQcl.js} +1 -1
  13. package/browser/{chunk-TpRPxdzH.js → chunk-CCKojbus.js} +1 -1
  14. package/browser/{chunk-B5RsrYWK.js → chunk-CEwpNeBE.js} +1 -1
  15. package/browser/{chunk-CRz_ufIK.js → chunk-CN7I1CO9.js} +1 -1
  16. package/browser/{chunk-CKz2arFC.js → chunk-CXYRkeNj.js} +1 -1
  17. package/browser/{chunk-D7iyozTh.js → chunk-Cfl9BJZg.js} +1 -1
  18. package/browser/{chunk-BPzMOcbJ.js → chunk-CitKRB6u.js} +1 -1
  19. package/browser/{chunk-CS7ZRkxO.js → chunk-Cq2-xloX.js} +1 -1
  20. package/browser/{chunk-CfQHAGOy.js → chunk-Cv9CJu7B.js} +1 -1
  21. package/browser/{chunk-Cby-Xx9Q.js → chunk-CyeY9oKH.js} +1 -1
  22. package/browser/{chunk-D-yZAfdg.js → chunk-CzmNxLJW.js} +1 -1
  23. package/browser/{chunk-U-HGjGAl.js → chunk-D2r8wuNb.js} +1 -1
  24. package/browser/{chunk-Bjsa3Q1_.js → chunk-D7GNFZQA.js} +1 -1
  25. package/browser/{chunk-EewxiDYN.js → chunk-DOyReEdW.js} +1 -1
  26. package/browser/{chunk-BBpQq4Ud.js → chunk-DPXNVO6U.js} +1 -1
  27. package/browser/{chunk-C6umsgbZ.js → chunk-DQuC5tUb.js} +1 -1
  28. package/browser/{chunk-CzIb1o-P.js → chunk-DUteS8z6.js} +1 -1
  29. package/browser/{chunk-CsuAvKcl.js → chunk-D_OcLa_E.js} +1 -1
  30. package/browser/{chunk-CY3YlK6T.js → chunk-Da7PJEUd.js} +1 -1
  31. package/browser/{chunk-n9xUsBQE.js → chunk-DfgNJWb_.js} +1 -1
  32. package/browser/{chunk-ByR0DUU7.js → chunk-Dh6xEoGu.js} +1 -1
  33. package/browser/{chunk-DY0qiEum.js → chunk-DhUYxBri.js} +1 -1
  34. package/browser/{chunk-C_H_042u.js → chunk-Dkqh13sM.js} +1 -1
  35. package/browser/chunk-DrlG2odS.js +1 -0
  36. package/browser/{chunk-B6aro_Gm.js → chunk-DyUPwDEV.js} +1 -1
  37. package/browser/{chunk-Wxr20zwV.js → chunk-RUkEp-ED.js} +1 -1
  38. package/browser/{chunk-2YrL7HTZ.js → chunk-TQFfWQ2A.js} +1 -1
  39. package/browser/{chunk-BANKlygo.js → chunk-TtebDFw9.js} +1 -1
  40. package/browser/chunk-fqKIQa08.js +1 -0
  41. package/browser/{chunk-DzpVd3Z4.js → chunk-j5oQmb_U.js} +1 -1
  42. package/browser/{chunk-B6y4uwI0.js → chunk-jgOJSUqj.js} +1 -1
  43. package/browser/{chunk-v7C9eeiE.js → chunk-mEq0rZYG.js} +1 -1
  44. package/browser/{chunk-Cd2-t2uT.js → chunk-o2j8lyJa.js} +1 -1
  45. package/browser/{chunk-C20Tq5VN.js → chunk-qv7FKA2K.js} +17 -17
  46. package/browser/{chunk-CCU0x4vV.js → chunk-s6jxPP6f.js} +1 -1
  47. package/browser/index.html +1 -1
  48. package/browser/{main-M62523CG.js → main-A7H5YZCD.js} +5 -5
  49. package/package.json +1 -1
  50. package/browser/chunk-CrCRSut7.js +0 -1
  51. package/browser/chunk-Cw6z8nOS.js +0 -1
  52. package/browser/chunk-DeaV_e6t.js +0 -1
@@ -1 +1 @@
1
- import {O as O$1}from'./chunk-C_Iy_sl5.js';import {I}from'./chunk-B5RsrYWK.js';import {O}from'./chunk-CfQHAGOy.js';import {g,I as Ie$1,U as Ui,X as XC,a9 as F,at as wy,ad as ne,G as U,y as yw,D as Ds,l as lg,L as Lw,p as pl,a as BE,j as jw,N as NC,Z as Zw,Q as mg,J as Jw,P as ug,_ as _I,H as Hw,O as Og,R as NI,m as Uw,v as vl,ae as Fw,r as df,s as ff,M as x,K as w}from'./main-M62523CG.js';import {y,N as D,Q as B,R as a,p as pt,T as Te$1,X as f,Y as A,U as Ut,n as nd,l as bo,x as xo,L as Lt,G as Gt,m as mo,b as po,A as An,v as va,c as pn,h as hn,d as cn,Z as un,e as dn,g as at,i as an,q as sn,a0 as Ti,K as Oi,a1 as d,a2 as v}from'./chunk-C20Tq5VN.js';import'./chunk-CrCRSut7.js';var ye=(o,e)=>e.value,Ce=(o,e)=>e.title;function be(o,e){o&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function xe(o,e){if(o&1&&(Ds(0,"option",27),NC(1),pl()),o&2){let t=e.$implicit;ug("value",t.value),BE(),Og(t.label);}}function Se(o,e){if(o&1){let t=Zw();Ds(0,"form",15),mg("ngSubmit",function(){df(t);let s=Jw(2);return ff(s.save())}),Ds(1,"ds-group",16)(2,"dl",17)(3,"dt"),NC(4,"Email"),pl(),Ds(5,"dd"),NC(6),pl(),Ds(7,"dt"),NC(8,"External ID"),pl(),Ds(9,"dd"),NC(10),pl()()(),Ds(11,"ds-group",18)(12,"ds-form-field",19),lg(13,"input",20),_I(),pl(),Ds(14,"ds-form-field",21),lg(15,"input",22),_I(),pl(),Ds(16,"ds-form-field",23),lg(17,"textarea",24),_I(),pl(),Ds(18,"ds-form-field",25)(19,"select",26),Hw(20,xe,2,2,"option",27,ye),pl(),_I(),pl()(),Ds(22,"ds-form-actions")(23,"button",28),NC(24),pl(),Ds(25,"button",29),mg("click",function(){df(t);let s=Jw(2);return ff(s.cancelEditing())}),NC(26,"Cancel"),pl()()();}if(o&2){let t=Jw(),l=Jw();ug("formGroup",l.form),BE(6),Og(t.email),BE(4),Og(t.externalId),BE(3),NI(),BE(2),NI(),BE(2),NI(),BE(2),NI(),BE(),Uw(l.languageOptions),BE(3),ug("disabled",l.isSaving()),BE(),vl(" ",l.isSaving()?"Saving\u2026":"Save changes"," ");}}function Ee(o,e){o&1&&(Ds(0,"p",2),NC(1," No global configuration yet. Create one from the Integrations / AI Providers / Auth Settings pages of your namespaces. "),pl());}function Pe(o,e){if(o&1){let t=Zw();Ds(0,"span",38),NC(1,"Delete?"),pl(),Ds(2,"button",39),mg("click",function(){df(t);let s=Jw().$implicit,m=Jw(5);return ff(m.confirmDelete(s))}),NC(3,"Confirm"),pl(),Ds(4,"button",40),mg("click",function(){df(t);let s=Jw(6);return ff(s.cancelDelete())}),NC(5,"Cancel"),pl();}}function Te(o,e){if(o&1){let t=Zw();Ds(0,"button",40),mg("click",function(){df(t);let s=Jw().$implicit,m=Jw(5);return ff(m.armDelete(s))}),NC(1,"Delete"),pl();}}function De(o,e){if(o&1&&(Ds(0,"li",34)(1,"span",35),NC(2),pl(),Ds(3,"span",36),NC(4),pl(),Lw(5,Pe,6,0)(6,Te,2,0,"button",37),pl()),o&2){let t=e.$implicit,l=Jw(5);BE(2),Og(t.name),BE(2),Og(t.subtitle),BE(),jw(l.isPendingDelete(t)?5:6);}}function we(o,e){if(o&1&&(Ds(0,"span",32),NC(1),pl(),Ds(2,"ul",33),Hw(3,De,7,3,"li",34,Fw().trackEntry,true),pl()),o&2){let t=e.$implicit;BE(),Og(t.title),BE(2),Uw(t.entries);}}function Ve(o,e){if(o&1&&Hw(0,we,5,1,null,null,Ce),o&2){let t=Jw(3);Uw(t.recapSections());}}function Ue(o,e){if(o&1){let t=Zw();Ds(0,"ds-group",16)(1,"dl",17)(2,"dt"),NC(3,"Email"),pl(),Ds(4,"dd"),NC(5),pl(),Ds(6,"dt"),NC(7,"External ID"),pl(),Ds(8,"dd"),NC(9),pl()()(),Ds(10,"ds-group",18)(11,"dl",17)(12,"dt"),NC(13,"First name"),pl(),Ds(14,"dd"),NC(15),pl(),Ds(16,"dt"),NC(17,"Last name"),pl(),Ds(18,"dd"),NC(19),pl(),Ds(20,"dt"),NC(21,"Bio"),pl(),Ds(22,"dd"),NC(23),pl(),Ds(24,"dt"),NC(25,"Language"),pl(),Ds(26,"dd"),NC(27),pl()()(),Ds(28,"ds-form-actions")(29,"button",30),mg("click",function(){df(t);let s=Jw(2);return ff(s.startEditing())}),NC(30,"Edit profile"),pl()(),Ds(31,"ds-disclosure",31),mg("toggled",function(){df(t);let s=Jw(2);return ff(s.toggleOverrides())}),Lw(32,Ee,2,0,"p",2)(33,Ve,2,0),pl();}if(o&2){let t=Jw(),l=Jw();BE(5),Og(t.email),BE(4),Og(t.externalId),BE(6),Og(t.firstname||"\u2014"),BE(4),Og(t.lastname||"\u2014"),BE(4),Og(t.bio||"\u2014"),BE(4),Og(t.preferredLanguage||"\u2014"),BE(4),ug("heading","My global user configurations ("+l.recap().total+")")("open",l.isOverridesExpanded()),BE(),jw(l.recap().total===0?32:33);}}function Me(o,e){if(o&1){let t=Zw();Ds(0,"ds-group",3)(1,"ds-form-field",4)(2,"ds-segmented",5),mg("valueChange",function(s){df(t);let m=Jw();return ff(m.setThemeVariant(s))}),pl()(),Ds(3,"ds-form-field",6)(4,"ds-segmented",7),mg("valueChange",function(s){df(t);let m=Jw();return ff(m.setTheme(s))}),pl()()(),Ds(5,"ds-group",8)(6,"ds-form-field",9)(7,"ds-segmented",10),mg("valueChange",function(s){df(t);let m=Jw();return ff(m.setEnterKeyBehavior(s))}),pl()()(),Ds(8,"ds-group",11)(9,"ds-form-field",12)(10,"ds-segmented",13),mg("valueChange",function(s){df(t);let m=Jw();return ff(m.setShowTechnical(s))}),pl()()(),Lw(11,Se,27,5,"form",14)(12,Ue,34,9);}if(o&2){let t=Jw();BE(),ug("hint",t.activeVariantDescription()),BE(),ug("options",t.themeVariantOptions)("value",t.themeVariant()),BE(),ug("hint",t.modeOverridden()?t.activeVariantLabel()+" does not support this mode; your choice is kept for other skins.":null),BE(),ug("options",t.modeOptions())("value",t.shownMode()),BE(3),ug("options",t.enterKeyOptions)("value",t.enterKeyBehavior()),BE(3),ug("options",t.showTechnicalOptions)("value",t.showTechnical()),BE(),jw(t.isEditing()?11:12);}}function Ie(o,e){o&1&&(Ds(0,"p",2),NC(1,"Unable to load profile."),pl());}var ve=class o{userState=g(y);destroyRef=g(Ie$1);integrationState=g(O);providerState=g(O$1);authSettingState=g(I);themePort=g(D);preferencesPort=g(B);isEditing=Ui(false);isLoading=Ui(false);isSaving=Ui(false);isOverridesExpanded=Ui(false);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeMode=XC(()=>this.themePort.theme().mode);themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];themeVariant=XC(()=>this.themePort.theme().variant);themeVariantOptions=a.map(({id:e,label:t,description:l})=>({value:e,label:t,description:l}));modeOverridden=XC(()=>!A(this.themeVariant(),this.themeMode()));activeVariantLabel=XC(()=>d(this.themeVariant()).label);activeVariantDescription=XC(()=>d(this.themeVariant()).description);modeOptions=XC(()=>this.themeOptions.map(e=>x(w({},e),{disabled:this.isModeDisabled(e.value)})));shownMode=XC(()=>this.modeOverridden()?v(this.themeVariant(),this.themeMode(),false):this.themeMode());enterKeyBehavior=this.preferencesPort.enterKeyBehavior;enterKeyOptions=[{value:"send",label:"Send"},{value:"newline",label:"New line"}];showTechnical=this.preferencesPort.showTechnical;showTechnicalOptions=[{value:true,label:"Shown"},{value:false,label:"Hidden"}];languageOptions=[{value:"",label:"No preference (English fallback)"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"es",label:"Spanish"},{value:"pt",label:"Portuguese"},{value:"it",label:"Italian"},{value:"nl",label:"Dutch"},{value:"pl",label:"Polish"},{value:"ja",label:"Japanese"},{value:"zh",label:"Chinese"}];form=new pt({firstname:new Te$1("",{nonNullable:true}),lastname:new Te$1("",{nonNullable:true}),bio:new Te$1("",{nonNullable:true}),preferredLanguage:new Te$1("",{nonNullable:true})});recap=F(wy([this.integrationState.userGlobal$,this.providerState.userGlobal$,this.authSettingState.userGlobal$]).pipe(ne(([e,t,l])=>{let s=e.map(g=>({category:"integration",id:g.id??"",name:g.name,subtitle:g.integrationType})),m=t.map(g=>({category:"aiProvider",id:g.id??"",name:g.name,subtitle:g.apiType})),I=l.map(g=>({category:"authSetting",id:g.id??"",name:g.name,subtitle:g.authType}));return {integrations:s,aiProviders:m,authSettings:I,total:s.length+m.length+I.length}})),{initialValue:{integrations:[],aiProviders:[],authSettings:[],total:0}});recapSections=XC(()=>{let e=this.recap();return [{title:"Integrations",entries:e.integrations},{title:"AI Providers",entries:e.aiProviders},{title:"My global auth settings",entries:e.authSettings}].filter(t=>t.entries.length>0)});ngOnInit(){if(this.currentUser()){this.syncFormFromState();return}this.isLoading.set(true),this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:()=>{this.syncFormFromState(),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}startEditing(){this.syncFormFromState(),this.isEditing.set(true);}cancelEditing(){this.isEditing.set(false);}setTheme(e){this.themePort.setTheme({variant:this.themePort.theme().variant,mode:e});}setThemeVariant(e){f(e)&&this.themePort.setTheme({variant:e,mode:this.themePort.theme().mode});}isModeDisabled(e){return !A(this.themeVariant(),e)}setEnterKeyBehavior(e){this.preferencesPort.setEnterKeyBehavior(e);}setShowTechnical(e){this.preferencesPort.setShowTechnical(e);}save(){if(this.isSaving())return;this.isSaving.set(true);let e=this.form.controls.preferredLanguage.value.trim();this.userState.updateMe({firstname:this.form.controls.firstname.value.trim()||void 0,lastname:this.form.controls.lastname.value.trim()||void 0,bio:this.form.controls.bio.value.trim()||void 0,preferredLanguage:e||void 0}).pipe(U(this.destroyRef)).subscribe({next:()=>{this.isSaving.set(false),this.isEditing.set(false);},error:()=>this.isSaving.set(false)});}toggleOverrides(){this.isOverridesExpanded.update(e=>!e),this.pendingDeleteKey.set(null);}pendingDeleteKey=Ui(null);isPendingDelete(e){return this.pendingDeleteKey()===this.entryKey(e)}armDelete(e){e.id&&this.pendingDeleteKey.set(this.entryKey(e));}cancelDelete(){this.pendingDeleteKey.set(null);}confirmDelete(e){if(!e.id)return;this.pendingDeleteKey.set(null),(e.category==="integration"?this.integrationState.delete(e.id,"userGlobal"):e.category==="authSetting"?this.authSettingState.delete(e.id,"userGlobal"):this.providerState.delete(e.id,"userGlobal")).pipe(U(this.destroyRef)).subscribe({error:l=>{console.error(`[UserProfile] Delete failed for ${e.category}:${e.id}:`,l);}});}entryKey(e){return `${e.category}:${e.id}`}trackEntry(e,t){return this.entryKey(t)}syncFormFromState(){let e=this.currentUser();e&&this.form.setValue({firstname:e.firstname??"",lastname:e.lastname??"",bio:e.bio??"",preferredLanguage:e.preferredLanguage??""});}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=yw({type:o,selectors:[["agentos-user-profile"]],decls:5,vars:1,consts:[["framed",""],["title","My profile"],[1,"ds-hint"],["heading","Appearance"],["label","Skin",3,"hint"],["label","Skin",3,"valueChange","options","value"],["label","Mode",3,"hint"],["label","Color mode",3,"valueChange","options","value"],["heading","Composer"],["label","Enter key","hint",'In "New line" mode, press Ctrl or Cmd + Enter to send.'],["label","Enter key behavior",3,"valueChange","options","value"],["heading","Case chat"],["label","Technical logs","hint","Show system log lines (agent status, tool selection...) in the case chat."],["label","Technical logs",3,"valueChange","options","value"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["heading","Identity"],["dsDefinitionList",""],["heading","Profile"],["label","First name","controlId","up-firstname"],["dsControl","","id","up-firstname","type","text","placeholder","Your first name","formControlName","firstname","autocomplete","given-name"],["label","Last name","controlId","up-lastname"],["dsControl","","id","up-lastname","type","text","placeholder","Your last name","formControlName","lastname","autocomplete","family-name"],["label","Bio","controlId","up-bio"],["dsControl","","id","up-bio","placeholder","A short description about yourself","formControlName","bio","rows","4"],["label","Language","controlId","up-preferredLanguage"],["dsControl","","id","up-preferredLanguage","formControlName","preferredLanguage"],[3,"value"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsButton","","variant","primary","type","button",3,"click"],[3,"toggled","heading","open"],[1,"ds-micro"],[1,"ds-list"],[1,"ds-row"],[1,"ds-strong","ds-row__grow"],[1,"ds-meta"],["dsButton","","variant","ghost","type","button"],[1,"ds-error"],["dsButton","","variant","danger","type","button",3,"click"],["dsButton","","variant","ghost","type","button",3,"click"]],template:function(t,l){if(t&1&&(Ds(0,"ds-page",0),lg(1,"ds-section-header",1),Lw(2,be,2,0,"p",2)(3,Me,13,11)(4,Ie,2,0,"p",2),pl()),t&2){let s;BE(2),jw(l.isLoading()?2:(s=l.currentUser())?3:4,s);}},dependencies:[Ut,nd,bo,xo,Lt,Gt,mo,po,An,va,pn,hn,cn,un,dn,at,an,sn,Ti,Oi],encapsulation:2})};export{ve as UserProfileComponent};
1
+ import {O as O$1}from'./chunk-B4MBlO_b.js';import {I}from'./chunk-CEwpNeBE.js';import {O}from'./chunk-Cv9CJu7B.js';import {g,I as Ie$1,U as Ui,X as XC,a9 as F,at as wy,ad as ne,G as U,y as yw,D as Ds,l as lg,L as Lw,p as pl,a as BE,j as jw,N as NC,Z as Zw,Q as mg,J as Jw,P as ug,_ as _I,H as Hw,O as Og,R as NI,m as Uw,v as vl,ae as Fw,r as df,s as ff,M as x,K as w}from'./main-A7H5YZCD.js';import {y,N as D,Q as B,R as a,p as pt,T as Te$1,X as f,Y as A,U as Ut,n as nd,l as bo,x as xo,L as Lt,G as Gt,m as mo,b as po,A as An,v as va,c as pn,h as hn,d as cn,Z as un,e as dn,g as at,i as an,q as sn,a0 as Ti,K as Oi,a1 as d,a2 as v}from'./chunk-qv7FKA2K.js';import'./chunk-DrlG2odS.js';var ye=(o,e)=>e.value,Ce=(o,e)=>e.title;function be(o,e){o&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function xe(o,e){if(o&1&&(Ds(0,"option",27),NC(1),pl()),o&2){let t=e.$implicit;ug("value",t.value),BE(),Og(t.label);}}function Se(o,e){if(o&1){let t=Zw();Ds(0,"form",15),mg("ngSubmit",function(){df(t);let s=Jw(2);return ff(s.save())}),Ds(1,"ds-group",16)(2,"dl",17)(3,"dt"),NC(4,"Email"),pl(),Ds(5,"dd"),NC(6),pl(),Ds(7,"dt"),NC(8,"External ID"),pl(),Ds(9,"dd"),NC(10),pl()()(),Ds(11,"ds-group",18)(12,"ds-form-field",19),lg(13,"input",20),_I(),pl(),Ds(14,"ds-form-field",21),lg(15,"input",22),_I(),pl(),Ds(16,"ds-form-field",23),lg(17,"textarea",24),_I(),pl(),Ds(18,"ds-form-field",25)(19,"select",26),Hw(20,xe,2,2,"option",27,ye),pl(),_I(),pl()(),Ds(22,"ds-form-actions")(23,"button",28),NC(24),pl(),Ds(25,"button",29),mg("click",function(){df(t);let s=Jw(2);return ff(s.cancelEditing())}),NC(26,"Cancel"),pl()()();}if(o&2){let t=Jw(),l=Jw();ug("formGroup",l.form),BE(6),Og(t.email),BE(4),Og(t.externalId),BE(3),NI(),BE(2),NI(),BE(2),NI(),BE(2),NI(),BE(),Uw(l.languageOptions),BE(3),ug("disabled",l.isSaving()),BE(),vl(" ",l.isSaving()?"Saving\u2026":"Save changes"," ");}}function Ee(o,e){o&1&&(Ds(0,"p",2),NC(1," No global configuration yet. Create one from the Integrations / AI Providers / Auth Settings pages of your namespaces. "),pl());}function Pe(o,e){if(o&1){let t=Zw();Ds(0,"span",38),NC(1,"Delete?"),pl(),Ds(2,"button",39),mg("click",function(){df(t);let s=Jw().$implicit,m=Jw(5);return ff(m.confirmDelete(s))}),NC(3,"Confirm"),pl(),Ds(4,"button",40),mg("click",function(){df(t);let s=Jw(6);return ff(s.cancelDelete())}),NC(5,"Cancel"),pl();}}function Te(o,e){if(o&1){let t=Zw();Ds(0,"button",40),mg("click",function(){df(t);let s=Jw().$implicit,m=Jw(5);return ff(m.armDelete(s))}),NC(1,"Delete"),pl();}}function De(o,e){if(o&1&&(Ds(0,"li",34)(1,"span",35),NC(2),pl(),Ds(3,"span",36),NC(4),pl(),Lw(5,Pe,6,0)(6,Te,2,0,"button",37),pl()),o&2){let t=e.$implicit,l=Jw(5);BE(2),Og(t.name),BE(2),Og(t.subtitle),BE(),jw(l.isPendingDelete(t)?5:6);}}function we(o,e){if(o&1&&(Ds(0,"span",32),NC(1),pl(),Ds(2,"ul",33),Hw(3,De,7,3,"li",34,Fw().trackEntry,true),pl()),o&2){let t=e.$implicit;BE(),Og(t.title),BE(2),Uw(t.entries);}}function Ve(o,e){if(o&1&&Hw(0,we,5,1,null,null,Ce),o&2){let t=Jw(3);Uw(t.recapSections());}}function Ue(o,e){if(o&1){let t=Zw();Ds(0,"ds-group",16)(1,"dl",17)(2,"dt"),NC(3,"Email"),pl(),Ds(4,"dd"),NC(5),pl(),Ds(6,"dt"),NC(7,"External ID"),pl(),Ds(8,"dd"),NC(9),pl()()(),Ds(10,"ds-group",18)(11,"dl",17)(12,"dt"),NC(13,"First name"),pl(),Ds(14,"dd"),NC(15),pl(),Ds(16,"dt"),NC(17,"Last name"),pl(),Ds(18,"dd"),NC(19),pl(),Ds(20,"dt"),NC(21,"Bio"),pl(),Ds(22,"dd"),NC(23),pl(),Ds(24,"dt"),NC(25,"Language"),pl(),Ds(26,"dd"),NC(27),pl()()(),Ds(28,"ds-form-actions")(29,"button",30),mg("click",function(){df(t);let s=Jw(2);return ff(s.startEditing())}),NC(30,"Edit profile"),pl()(),Ds(31,"ds-disclosure",31),mg("toggled",function(){df(t);let s=Jw(2);return ff(s.toggleOverrides())}),Lw(32,Ee,2,0,"p",2)(33,Ve,2,0),pl();}if(o&2){let t=Jw(),l=Jw();BE(5),Og(t.email),BE(4),Og(t.externalId),BE(6),Og(t.firstname||"\u2014"),BE(4),Og(t.lastname||"\u2014"),BE(4),Og(t.bio||"\u2014"),BE(4),Og(t.preferredLanguage||"\u2014"),BE(4),ug("heading","My global user configurations ("+l.recap().total+")")("open",l.isOverridesExpanded()),BE(),jw(l.recap().total===0?32:33);}}function Me(o,e){if(o&1){let t=Zw();Ds(0,"ds-group",3)(1,"ds-form-field",4)(2,"ds-segmented",5),mg("valueChange",function(s){df(t);let m=Jw();return ff(m.setThemeVariant(s))}),pl()(),Ds(3,"ds-form-field",6)(4,"ds-segmented",7),mg("valueChange",function(s){df(t);let m=Jw();return ff(m.setTheme(s))}),pl()()(),Ds(5,"ds-group",8)(6,"ds-form-field",9)(7,"ds-segmented",10),mg("valueChange",function(s){df(t);let m=Jw();return ff(m.setEnterKeyBehavior(s))}),pl()()(),Ds(8,"ds-group",11)(9,"ds-form-field",12)(10,"ds-segmented",13),mg("valueChange",function(s){df(t);let m=Jw();return ff(m.setShowTechnical(s))}),pl()()(),Lw(11,Se,27,5,"form",14)(12,Ue,34,9);}if(o&2){let t=Jw();BE(),ug("hint",t.activeVariantDescription()),BE(),ug("options",t.themeVariantOptions)("value",t.themeVariant()),BE(),ug("hint",t.modeOverridden()?t.activeVariantLabel()+" does not support this mode; your choice is kept for other skins.":null),BE(),ug("options",t.modeOptions())("value",t.shownMode()),BE(3),ug("options",t.enterKeyOptions)("value",t.enterKeyBehavior()),BE(3),ug("options",t.showTechnicalOptions)("value",t.showTechnical()),BE(),jw(t.isEditing()?11:12);}}function Ie(o,e){o&1&&(Ds(0,"p",2),NC(1,"Unable to load profile."),pl());}var ve=class o{userState=g(y);destroyRef=g(Ie$1);integrationState=g(O);providerState=g(O$1);authSettingState=g(I);themePort=g(D);preferencesPort=g(B);isEditing=Ui(false);isLoading=Ui(false);isSaving=Ui(false);isOverridesExpanded=Ui(false);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeMode=XC(()=>this.themePort.theme().mode);themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];themeVariant=XC(()=>this.themePort.theme().variant);themeVariantOptions=a.map(({id:e,label:t,description:l})=>({value:e,label:t,description:l}));modeOverridden=XC(()=>!A(this.themeVariant(),this.themeMode()));activeVariantLabel=XC(()=>d(this.themeVariant()).label);activeVariantDescription=XC(()=>d(this.themeVariant()).description);modeOptions=XC(()=>this.themeOptions.map(e=>x(w({},e),{disabled:this.isModeDisabled(e.value)})));shownMode=XC(()=>this.modeOverridden()?v(this.themeVariant(),this.themeMode(),false):this.themeMode());enterKeyBehavior=this.preferencesPort.enterKeyBehavior;enterKeyOptions=[{value:"send",label:"Send"},{value:"newline",label:"New line"}];showTechnical=this.preferencesPort.showTechnical;showTechnicalOptions=[{value:true,label:"Shown"},{value:false,label:"Hidden"}];languageOptions=[{value:"",label:"No preference (English fallback)"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"es",label:"Spanish"},{value:"pt",label:"Portuguese"},{value:"it",label:"Italian"},{value:"nl",label:"Dutch"},{value:"pl",label:"Polish"},{value:"ja",label:"Japanese"},{value:"zh",label:"Chinese"}];form=new pt({firstname:new Te$1("",{nonNullable:true}),lastname:new Te$1("",{nonNullable:true}),bio:new Te$1("",{nonNullable:true}),preferredLanguage:new Te$1("",{nonNullable:true})});recap=F(wy([this.integrationState.userGlobal$,this.providerState.userGlobal$,this.authSettingState.userGlobal$]).pipe(ne(([e,t,l])=>{let s=e.map(g=>({category:"integration",id:g.id??"",name:g.name,subtitle:g.integrationType})),m=t.map(g=>({category:"aiProvider",id:g.id??"",name:g.name,subtitle:g.apiType})),I=l.map(g=>({category:"authSetting",id:g.id??"",name:g.name,subtitle:g.authType}));return {integrations:s,aiProviders:m,authSettings:I,total:s.length+m.length+I.length}})),{initialValue:{integrations:[],aiProviders:[],authSettings:[],total:0}});recapSections=XC(()=>{let e=this.recap();return [{title:"Integrations",entries:e.integrations},{title:"AI Providers",entries:e.aiProviders},{title:"My global auth settings",entries:e.authSettings}].filter(t=>t.entries.length>0)});ngOnInit(){if(this.currentUser()){this.syncFormFromState();return}this.isLoading.set(true),this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:()=>{this.syncFormFromState(),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}startEditing(){this.syncFormFromState(),this.isEditing.set(true);}cancelEditing(){this.isEditing.set(false);}setTheme(e){this.themePort.setTheme({variant:this.themePort.theme().variant,mode:e});}setThemeVariant(e){f(e)&&this.themePort.setTheme({variant:e,mode:this.themePort.theme().mode});}isModeDisabled(e){return !A(this.themeVariant(),e)}setEnterKeyBehavior(e){this.preferencesPort.setEnterKeyBehavior(e);}setShowTechnical(e){this.preferencesPort.setShowTechnical(e);}save(){if(this.isSaving())return;this.isSaving.set(true);let e=this.form.controls.preferredLanguage.value.trim();this.userState.updateMe({firstname:this.form.controls.firstname.value.trim()||void 0,lastname:this.form.controls.lastname.value.trim()||void 0,bio:this.form.controls.bio.value.trim()||void 0,preferredLanguage:e||void 0}).pipe(U(this.destroyRef)).subscribe({next:()=>{this.isSaving.set(false),this.isEditing.set(false);},error:()=>this.isSaving.set(false)});}toggleOverrides(){this.isOverridesExpanded.update(e=>!e),this.pendingDeleteKey.set(null);}pendingDeleteKey=Ui(null);isPendingDelete(e){return this.pendingDeleteKey()===this.entryKey(e)}armDelete(e){e.id&&this.pendingDeleteKey.set(this.entryKey(e));}cancelDelete(){this.pendingDeleteKey.set(null);}confirmDelete(e){if(!e.id)return;this.pendingDeleteKey.set(null),(e.category==="integration"?this.integrationState.delete(e.id,"userGlobal"):e.category==="authSetting"?this.authSettingState.delete(e.id,"userGlobal"):this.providerState.delete(e.id,"userGlobal")).pipe(U(this.destroyRef)).subscribe({error:l=>{console.error(`[UserProfile] Delete failed for ${e.category}:${e.id}:`,l);}});}entryKey(e){return `${e.category}:${e.id}`}trackEntry(e,t){return this.entryKey(t)}syncFormFromState(){let e=this.currentUser();e&&this.form.setValue({firstname:e.firstname??"",lastname:e.lastname??"",bio:e.bio??"",preferredLanguage:e.preferredLanguage??""});}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=yw({type:o,selectors:[["agentos-user-profile"]],decls:5,vars:1,consts:[["framed",""],["title","My profile"],[1,"ds-hint"],["heading","Appearance"],["label","Skin",3,"hint"],["label","Skin",3,"valueChange","options","value"],["label","Mode",3,"hint"],["label","Color mode",3,"valueChange","options","value"],["heading","Composer"],["label","Enter key","hint",'In "New line" mode, press Ctrl or Cmd + Enter to send.'],["label","Enter key behavior",3,"valueChange","options","value"],["heading","Case chat"],["label","Technical logs","hint","Show system log lines (agent status, tool selection...) in the case chat."],["label","Technical logs",3,"valueChange","options","value"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["heading","Identity"],["dsDefinitionList",""],["heading","Profile"],["label","First name","controlId","up-firstname"],["dsControl","","id","up-firstname","type","text","placeholder","Your first name","formControlName","firstname","autocomplete","given-name"],["label","Last name","controlId","up-lastname"],["dsControl","","id","up-lastname","type","text","placeholder","Your last name","formControlName","lastname","autocomplete","family-name"],["label","Bio","controlId","up-bio"],["dsControl","","id","up-bio","placeholder","A short description about yourself","formControlName","bio","rows","4"],["label","Language","controlId","up-preferredLanguage"],["dsControl","","id","up-preferredLanguage","formControlName","preferredLanguage"],[3,"value"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsButton","","variant","primary","type","button",3,"click"],[3,"toggled","heading","open"],[1,"ds-micro"],[1,"ds-list"],[1,"ds-row"],[1,"ds-strong","ds-row__grow"],[1,"ds-meta"],["dsButton","","variant","ghost","type","button"],[1,"ds-error"],["dsButton","","variant","danger","type","button",3,"click"],["dsButton","","variant","ghost","type","button",3,"click"]],template:function(t,l){if(t&1&&(Ds(0,"ds-page",0),lg(1,"ds-section-header",1),Lw(2,be,2,0,"p",2)(3,Me,13,11)(4,Ie,2,0,"p",2),pl()),t&2){let s;BE(2),jw(l.isLoading()?2:(s=l.currentUser())?3:4,s);}},dependencies:[Ut,nd,bo,xo,Lt,Gt,mo,po,An,va,pn,hn,cn,un,dn,at,an,sn,Ti,Oi],encapsulation:2})};export{ve as UserProfileComponent};
@@ -1 +1 @@
1
- import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-CY3YlK6T.js';import {I}from'./chunk-B5RsrYWK.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-M62523CG.js';import {z as k,O,a3 as w,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-C20Tq5VN.js';import'./chunk-CrCRSut7.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-Da7PJEUd.js';import {I}from'./chunk-CEwpNeBE.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-A7H5YZCD.js';import {z as k,O,a3 as w,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-qv7FKA2K.js';import'./chunk-DrlG2odS.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 {i}from'./chunk-CrCRSut7.js';import {y}from'./chunk-C20Tq5VN.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-M62523CG.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-DrlG2odS.js';import {y}from'./chunk-qv7FKA2K.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-A7H5YZCD.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,g as at,h as hn,I as Io,P,B as P$1}from'./chunk-C20Tq5VN.js';import {g,F,I as Ie,$ 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,v as vl,Z as Zw,k as cg,r as df,s as ff}from'./main-M62523CG.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 prompts\u2026"),pl());}function H(t,e){t&1&&(Ds(0,"p",5),NC(1,"No platform prompts defined yet."),pl());}function U(t,e){t&1&&(Ds(0,"p",4),NC(1,"No prompts 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 m=Jw().$implicit,p=Jw(2);return ff(p.edit(m))}),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 m=Jw().$implicit,p=Jw(2);return ff(p.deletion.request(m.id))})("deleteConfirmed",function(){df(n);let m=Jw().$implicit,p=Jw(2);return ff(p.confirmDelete(m))})("deleteCancelled",function(){df(n);let m=Jw(3);return ff(m.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),vl(" ",n.description||"\u2014"," "),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,"Description"),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);promptState=g(m);refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k();prompts=Ui([]);rowFilter=O$1(this.prompts,e=>[e.name,e.description].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.promptState.listPlatform())),U$1(this.destroyRef)).subscribe({next:e=>{this.prompts.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","prompts","new"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","prompts",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.promptState.delete(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-prompts"]],decls:9,vars:3,consts:[["title","Platform prompts","description","Prompts shared across every namespace."],["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","Platform 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","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(p){return r.rowFilter.query.set(p)}),pl(),Ds(2,"button",2),mg("click",function(){return r.openCreateForm()}),NC(3,"New prompt"),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.prompts().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{B as PlatformPromptsComponent};
1
+ import {D as m,z as k,O as O$1,g as at,h as hn,I as Io,P,B as P$1}from'./chunk-qv7FKA2K.js';import {g,F,I as Ie,$ 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,v as vl,Z as Zw,k as cg,r as df,s as ff}from'./main-A7H5YZCD.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 prompts\u2026"),pl());}function H(t,e){t&1&&(Ds(0,"p",5),NC(1,"No platform prompts defined yet."),pl());}function U(t,e){t&1&&(Ds(0,"p",4),NC(1,"No prompts 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 m=Jw().$implicit,p=Jw(2);return ff(p.edit(m))}),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 m=Jw().$implicit,p=Jw(2);return ff(p.deletion.request(m.id))})("deleteConfirmed",function(){df(n);let m=Jw().$implicit,p=Jw(2);return ff(p.confirmDelete(m))})("deleteCancelled",function(){df(n);let m=Jw(3);return ff(m.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),vl(" ",n.description||"\u2014"," "),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,"Description"),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);promptState=g(m);refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k();prompts=Ui([]);rowFilter=O$1(this.prompts,e=>[e.name,e.description].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.promptState.listPlatform())),U$1(this.destroyRef)).subscribe({next:e=>{this.prompts.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","prompts","new"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","prompts",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.promptState.delete(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-prompts"]],decls:9,vars:3,consts:[["title","Platform prompts","description","Prompts shared across every namespace."],["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","Platform 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","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(p){return r.rowFilter.query.set(p)}),pl(),Ds(2,"button",2),mg("click",function(){return r.openCreateForm()}),NC(3,"New prompt"),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.prompts().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{B as PlatformPromptsComponent};
@@ -1 +1 @@
1
- import {v}from'./chunk-CY3YlK6T.js';import {I}from'./chunk-B5RsrYWK.js';import {O}from'./chunk-CfQHAGOy.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-M62523CG.js';import {p as pt,T as Te$1,a as fn,c as pn,h as hn,d as cn,r as ln,e as dn,o as on,g as at,i as an,t as rn,U as Ut,n as nd,l as bo,x as xo,L as Lt,u as vn,G as Gt,w as pa,m as mo,b as po,V as Vn,A as An,W as Wt}from'./chunk-C20Tq5VN.js';import'./chunk-CrCRSut7.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-Da7PJEUd.js';import {I}from'./chunk-CEwpNeBE.js';import {O}from'./chunk-Cv9CJu7B.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-A7H5YZCD.js';import {p as pt,T as Te$1,a as fn,c as pn,h as hn,d as cn,r as ln,e as dn,o as on,g as at,i as an,t as rn,U as Ut,n as nd,l as bo,x as xo,L as Lt,u as vn,G as Gt,w as pa,m as mo,b as po,V as Vn,A as An,W as Wt}from'./chunk-qv7FKA2K.js';import'./chunk-DrlG2odS.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 {n}from'./chunk-CfgXrte_.js';import {O}from'./chunk-C_Iy_sl5.js';import {v}from'./chunk-CY3YlK6T.js';import {g,W as W$1,F,I as Ie,U as Ui,G as U$1,ad as ne,a1 as fa,aa as Tr,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-M62523CG.js';import {z as k,O as O$1,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-C20Tq5VN.js';import'./chunk-CrCRSut7.js';var H=(i,e)=>e.key;function U(i,e){if(i&1&&(Ds(0,"p",3),NC(1),pl()),i&2){let t=Jw();BE(),Og(t.deletion.error());}}function z(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 AI providers available."),pl());}function Q(i,e){i&1&&(Ds(0,"p",4),NC(1,"No AI providers match the current filter."),pl());}function W(i,e){i&1&&(Ds(0,"ds-tag",17),NC(1,"Read-only"),pl());}function X(i,e){if(i&1){let t=Zw();Ds(0,"button",22),mg("click",function(){df(t);let d=Jw().$implicit,c=Jw(2);return ff(c.duplicate(d))}),NC(1," Duplicate "),pl();}if(i&2){let t=Jw().$implicit;cg("aria-label","Duplicate "+t.config.name);}}function Y(i,e){if(i&1){let t=Zw();Ds(0,"button",22),mg("click",function(){df(t);let d=Jw(2).$implicit,c=Jw(2);return ff(c.edit(d))}),NC(1," Edit "),pl();}if(i&2){let t=Jw(2).$implicit;cg("aria-label","Edit "+t.config.name);}}function Z(i,e){if(i&1){let t=Zw();Lw(0,Y,2,1,"button",20),Ds(1,"agentos-row-delete-action",23),mg("deleteRequested",function(){df(t);let d=Jw().$implicit,c=Jw(2);return ff(c.deletion.request(d.key))})("deleteConfirmed",function(){df(t);let d=Jw().$implicit,c=Jw(2);return ff(c.confirmDelete(d))})("deleteCancelled",function(){df(t);let d=Jw(3);return ff(d.deletion.cancel())}),pl();}if(i&2){let t=Jw().$implicit,r=Jw(2);jw(r.deletion.confirmingId()!==t.key?0:-1),BE(),ug("rowKey",t.key)("rowLabel",t.config.name)("state",r.deletion);}}function ee(i,e){i&1&&(Ds(0,"button",21),NC(1,"Inherited"),pl());}function te(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)(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,X,2,1,"button",20),Lw(13,Z,2,4)(14,ee,2,0,"button",21),pl()()()),i&2){let t=e.$implicit,r=Jw(2);BE(2),Og(t.config.name),BE(2),Og(t.config.apiType),BE(3),ug("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),BE(),Og(t.scopeLabel),BE(),jw(t.canMutate?-1:9),BE(3),jw(r.deletion.confirmingId()!==t.key?12:-1),BE(),jw(t.canMutate?13:14);}}function ie(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,"Scope"),pl(),Ds(10,"th",10)(11,"span",11),NC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Hw(14,te,15,7,"tr",9,H),pl()()()),i&2){let t=Jw();BE(14),Uw(t.rowFilter.filteredRows());}}var G=class i{route=g(W$1);router=g(F);destroyRef=g(Ie);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=Ui(false);isLoading=Ui(true);rows=Ui([]);deletion=k();rowFilter=O$1(this.rows,e=>[e.config.name,e.config.apiType,e.scopeLabel].join(" "));ngOnInit(){this.route.paramMap.pipe(U$1(this.destroyRef)).subscribe(e=>{let t=e.get("namespaceId")??"";t&&t!==this.namespaceId&&(this.namespaceId=t),this.state.setNamespace(t);}),this.route.paramMap.pipe(ne(e=>e.get("namespaceId")??""),fa(e=>e?this.namespaceRole.isAdminOfNamespace$(e):Tr(false)),U$1(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.rows.set(this.toRows(e)),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-providers","new"],{queryParams:{scope:n(this.isAdmin())}});}edit(e){!e.canMutate||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"ai-providers",e.config.id,"edit"],{queryParams:{scope:e.scope}});}confirmDelete(e){!e.canMutate||!e.config.id||this.deletion.execute(e.key,{request$:this.state.delete(e.config.id,e.scope).pipe(U$1(this.destroyRef)),errorMessage:`Deleting "${e.config.name}" failed. Try again.`});}duplicate(e){if(!e.config.id)return;let t=e.scope==="platform"||e.scope==="namespace"&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"ai-providers","new"],{queryParams:{scope:t,template:e.config.id,templateScope:e.scope}});}toRows(e){return [...this.mapScope(e.platform,"platform","Platform",false),...this.mapScope(e.namespace,"namespace","Namespace",this.isAdmin()),...this.mapScope(e.userOnNs,"userOnNs","Personal",true),...this.mapScope(e.userGlobal,"userGlobal","Personal",true)]}mapScope(e,t,r,d){return e.map((c,K)=>({key:`${t}:${c.id??K}`,config:c,scope:t,scopeLabel:r,canMutate:d}))}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-ai-providers-all-scopes"]],decls:9,vars:3,consts:[["title","AI providers","description","AI providers available in this namespace, including inherited platform and personal entries."],["label","Filter AI providers","placeholder","Filter AI providers\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","AI providers"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","API type",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["type","button","disabled",""],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,r){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(c){return r.rowFilter.query.set(c)}),pl(),Ds(2,"button",2),mg("click",function(){return r.openCreateForm()}),NC(3,"New AI provider"),pl()(),Lw(4,U,2,1,"p",3),Lw(5,z,2,0,"p",4)(6,J,2,0,"p",5)(7,Q,2,0,"p",4)(8,ie,16,0,"div",6)),t&2&&(BE(),ug("query",r.rowFilter.query()),BE(3),jw(r.deletion.error()?4:-1),BE(),jw(r.isLoading()?5:r.rows().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{G as AiProvidersAllScopesComponent};
1
+ import {n}from'./chunk-CfgXrte_.js';import {O}from'./chunk-B4MBlO_b.js';import {v}from'./chunk-Da7PJEUd.js';import {g,W as W$1,F,I as Ie,U as Ui,G as U$1,ad as ne,a1 as fa,aa as Tr,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-A7H5YZCD.js';import {z as k,O as O$1,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-qv7FKA2K.js';import'./chunk-DrlG2odS.js';var H=(i,e)=>e.key;function U(i,e){if(i&1&&(Ds(0,"p",3),NC(1),pl()),i&2){let t=Jw();BE(),Og(t.deletion.error());}}function z(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 AI providers available."),pl());}function Q(i,e){i&1&&(Ds(0,"p",4),NC(1,"No AI providers match the current filter."),pl());}function W(i,e){i&1&&(Ds(0,"ds-tag",17),NC(1,"Read-only"),pl());}function X(i,e){if(i&1){let t=Zw();Ds(0,"button",22),mg("click",function(){df(t);let d=Jw().$implicit,c=Jw(2);return ff(c.duplicate(d))}),NC(1," Duplicate "),pl();}if(i&2){let t=Jw().$implicit;cg("aria-label","Duplicate "+t.config.name);}}function Y(i,e){if(i&1){let t=Zw();Ds(0,"button",22),mg("click",function(){df(t);let d=Jw(2).$implicit,c=Jw(2);return ff(c.edit(d))}),NC(1," Edit "),pl();}if(i&2){let t=Jw(2).$implicit;cg("aria-label","Edit "+t.config.name);}}function Z(i,e){if(i&1){let t=Zw();Lw(0,Y,2,1,"button",20),Ds(1,"agentos-row-delete-action",23),mg("deleteRequested",function(){df(t);let d=Jw().$implicit,c=Jw(2);return ff(c.deletion.request(d.key))})("deleteConfirmed",function(){df(t);let d=Jw().$implicit,c=Jw(2);return ff(c.confirmDelete(d))})("deleteCancelled",function(){df(t);let d=Jw(3);return ff(d.deletion.cancel())}),pl();}if(i&2){let t=Jw().$implicit,r=Jw(2);jw(r.deletion.confirmingId()!==t.key?0:-1),BE(),ug("rowKey",t.key)("rowLabel",t.config.name)("state",r.deletion);}}function ee(i,e){i&1&&(Ds(0,"button",21),NC(1,"Inherited"),pl());}function te(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)(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,X,2,1,"button",20),Lw(13,Z,2,4)(14,ee,2,0,"button",21),pl()()()),i&2){let t=e.$implicit,r=Jw(2);BE(2),Og(t.config.name),BE(2),Og(t.config.apiType),BE(3),ug("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),BE(),Og(t.scopeLabel),BE(),jw(t.canMutate?-1:9),BE(3),jw(r.deletion.confirmingId()!==t.key?12:-1),BE(),jw(t.canMutate?13:14);}}function ie(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,"Scope"),pl(),Ds(10,"th",10)(11,"span",11),NC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Hw(14,te,15,7,"tr",9,H),pl()()()),i&2){let t=Jw();BE(14),Uw(t.rowFilter.filteredRows());}}var G=class i{route=g(W$1);router=g(F);destroyRef=g(Ie);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=Ui(false);isLoading=Ui(true);rows=Ui([]);deletion=k();rowFilter=O$1(this.rows,e=>[e.config.name,e.config.apiType,e.scopeLabel].join(" "));ngOnInit(){this.route.paramMap.pipe(U$1(this.destroyRef)).subscribe(e=>{let t=e.get("namespaceId")??"";t&&t!==this.namespaceId&&(this.namespaceId=t),this.state.setNamespace(t);}),this.route.paramMap.pipe(ne(e=>e.get("namespaceId")??""),fa(e=>e?this.namespaceRole.isAdminOfNamespace$(e):Tr(false)),U$1(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.rows.set(this.toRows(e)),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-providers","new"],{queryParams:{scope:n(this.isAdmin())}});}edit(e){!e.canMutate||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"ai-providers",e.config.id,"edit"],{queryParams:{scope:e.scope}});}confirmDelete(e){!e.canMutate||!e.config.id||this.deletion.execute(e.key,{request$:this.state.delete(e.config.id,e.scope).pipe(U$1(this.destroyRef)),errorMessage:`Deleting "${e.config.name}" failed. Try again.`});}duplicate(e){if(!e.config.id)return;let t=e.scope==="platform"||e.scope==="namespace"&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"ai-providers","new"],{queryParams:{scope:t,template:e.config.id,templateScope:e.scope}});}toRows(e){return [...this.mapScope(e.platform,"platform","Platform",false),...this.mapScope(e.namespace,"namespace","Namespace",this.isAdmin()),...this.mapScope(e.userOnNs,"userOnNs","Personal",true),...this.mapScope(e.userGlobal,"userGlobal","Personal",true)]}mapScope(e,t,r,d){return e.map((c,K)=>({key:`${t}:${c.id??K}`,config:c,scope:t,scopeLabel:r,canMutate:d}))}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-ai-providers-all-scopes"]],decls:9,vars:3,consts:[["title","AI providers","description","AI providers available in this namespace, including inherited platform and personal entries."],["label","Filter AI providers","placeholder","Filter AI providers\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","AI providers"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","API type",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["type","button","disabled",""],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,r){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(c){return r.rowFilter.query.set(c)}),pl(),Ds(2,"button",2),mg("click",function(){return r.openCreateForm()}),NC(3,"New AI provider"),pl()(),Lw(4,U,2,1,"p",3),Lw(5,z,2,0,"p",4)(6,J,2,0,"p",5)(7,Q,2,0,"p",4)(8,ie,16,0,"div",6)),t&2&&(BE(),ug("query",r.rowFilter.query()),BE(3),jw(r.deletion.error()?4:-1),BE(),jw(r.isLoading()?5:r.rows().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{G as AiProvidersAllScopesComponent};
@@ -1 +1 @@
1
- import {p as pt,T as Te,a as fn,c as pn,h as hn,d as cn,r as ln,e as dn,g as at,i as an,U as Ut,n as nd,l as bo,x as xo,L as Lt,k as kn,u as vn,G as Gt,m as mo,b as po,$ as $r,H as qr,V as Vn,A as An,v as va}from'./chunk-C20Tq5VN.js';import {g,W,F,I as Ie$1,aq as k,ap as F$1,a9 as F$2,a2 as da,aa as Tr,ar as Be,X as XC,U as Ui,q as Af,G as U,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,j as jw,Z as Zw,l as lg,_ as _I,H as Hw,ao as Vw,J as Jw,R as NI,m as Uw,v as vl,ae as Fw,O as Og,as as kg,r as df,s as ff}from'./main-M62523CG.js';function he(r,t){r&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function ve(r,t){if(r&1&&lg(0,"input",6),r&2){let e=Jw(2);ug("value",e.selectedProviderLabel());}}function ye(r,t){if(r&1&&(Ds(0,"option",44),NC(1),pl()),r&2){let e=t.$implicit;ug("value",e.id),BE(),kg("",e.name," (",e.apiType,")");}}function be(r,t){if(r&1&&(Ds(0,"select",7)(1,"option",43),NC(2,"Select provider"),pl(),Hw(3,ye,2,3,"option",44,Fw().trackByProvider,true),pl(),_I()),r&2){let e=Jw(2);ug("formControl",e.aiProviderIdControl),NI(),BE(3),Uw(e.providers());}}function xe(r,t){if(r&1&&(Ds(0,"option",25),NC(1),pl()),r&2){let e=t.$implicit;ug("ngValue",e),BE(),Og(e.toLowerCase());}}function _e(r,t){r&1&&(Ds(0,"p",2),NC(1,"Not supported yet for Anthropic and Gemini providers."),pl());}function Me(r,t){r&1&&(Ds(0,"p",2),NC(1," Sent as is to OpenAI-compatible providers, which reject levels the model does not support. Through Requesty, Claude models do not apply it faithfully. "),pl());}function Ee(r,t){r&1&&(Ds(0,"p",26),NC(1," OpenAI reasoning models (GPT-5.1 and later) reject a temperature other than 1 with an effort: leave Temperature empty or set it to 1. "),pl());}function Ae(r,t){if(r&1){let e=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let u=Jw();return ff(u.submit())}),Ds(1,"ds-form-field",5),Lw(2,ve,1,1,"input",6)(3,be,5,1,"select",7),pl(),Ds(4,"ds-form-field",8),lg(5,"input",9),_I(),pl(),Ds(6,"ds-form-field",10),lg(7,"input",11),_I(),pl(),Ds(8,"ds-form-field",12),lg(9,"input",13),_I(),pl(),Ds(10,"ds-form-field",14),lg(11,"input",15),_I(),pl(),Ds(12,"div",16)(13,"ds-form-field",17),lg(14,"input",18),_I(),pl(),Ds(15,"ds-form-field",19),lg(16,"input",20),_I(),pl()(),Ds(17,"ds-form-field",21),lg(18,"input",22),_I(),pl(),Ds(19,"ds-form-field",23)(20,"select",24)(21,"option",25),NC(22,"Provider default"),pl(),Hw(23,xe,2,2,"option",25,Vw),pl(),_I(),Lw(25,_e,2,0,"p",2)(26,Me,2,0,"p",2),Lw(27,Ee,2,0,"p",26),pl(),Ds(28,"div",27)(29,"label",28),lg(30,"input",29),_I(),Ds(31,"span",30),NC(32,"Supports advanced execution"),pl()(),Ds(33,"p",31),NC(34," Agents configured in ADVANCED execution mode fail to run on a model that does not support it. SIMPLE agents are not concerned. "),pl()(),Ds(35,"ds-fieldset",32)(36,"div",16)(37,"ds-form-field",33),lg(38,"input",34),_I(),pl(),Ds(39,"ds-form-field",35),lg(40,"input",36),_I(),pl()(),Ds(41,"div",16)(42,"ds-form-field",37),lg(43,"input",38),_I(),pl(),Ds(44,"ds-form-field",39),lg(45,"input",40),_I(),pl()()(),Ds(46,"ds-form-actions")(47,"button",41),NC(48),pl(),Ds(49,"button",42),mg("click",function(){df(e);let u=Jw();return ff(u.cancel())}),NC(50,"Cancel"),pl()()();}if(r&2){let e=Jw();ug("formGroup",e.form),BE(2),jw(e.isEditMode()?2:3),BE(3),ug("formControl",e.apiModelNameControl),NI(),BE(2),ug("formControl",e.descriptionControl),NI(),BE(2),ug("formControl",e.aliasControl),NI(),BE(2),ug("formControl",e.priorityControl),NI(),BE(3),ug("formControl",e.temperatureControl),NI(),BE(2),ug("formControl",e.contextWindowControl),NI(),BE(2),ug("formControl",e.maxCompletionTokensControl),NI(),BE(2),ug("formControl",e.reasoningEffortControl),NI(),BE(),ug("ngValue",null),BE(2),Uw(e.reasoningEffortOptions),BE(2),jw(e.reasoningEffortUnsupported()?25:26),BE(2),jw(e.temperatureMayConflictWithEffort()?27:-1),BE(3),ug("formControl",e.supportsAdvancedExecutionControl),NI(),BE(5),ug("formGroup",e.pricingGroup),BE(3),NI(),BE(2),NI(),BE(3),NI(),BE(2),NI(),BE(2),ug("disabled",e.form.invalid||e.isSubmitting()),BE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var Ie=["Anthropic","Gemini"],ge=class r{route=g(W);router=g(F);destroyRef=g(Ie$1);aiModelController=g(k);aiProviderController=g(F$1);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;providers=F$2(this.aiProviderController.listAiProvider(this.isPlatformMode?"none":this.namespaceId).pipe(da(()=>Tr([]))),{initialValue:[]});form=new pt({aiProviderId:new Te("",{nonNullable:true,validators:[fn.required]}),apiModelName:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(null),alias:new Te("",{nonNullable:true}),priority:new Te(0,{nonNullable:true}),temperature:new Te(null),contextWindow:new Te(null),maxCompletionTokens:new Te(null),reasoningEffort:new Te(null),supportsAdvancedExecution:new Te(false,{nonNullable:true}),pricing:new pt({inputMTokens:new Te(null),outputMTokens:new Te(null),cacheWrite:new Te(null),cacheRead:new Te(null)})});get aiProviderIdControl(){return this.form.controls.aiProviderId}get apiModelNameControl(){return this.form.controls.apiModelName}get descriptionControl(){return this.form.controls.description}get aliasControl(){return this.form.controls.alias}get priorityControl(){return this.form.controls.priority}get temperatureControl(){return this.form.controls.temperature}get contextWindowControl(){return this.form.controls.contextWindow}get maxCompletionTokensControl(){return this.form.controls.maxCompletionTokens}get reasoningEffortControl(){return this.form.controls.reasoningEffort}get supportsAdvancedExecutionControl(){return this.form.controls.supportsAdvancedExecution}get pricingGroup(){return this.form.controls.pricing}reasoningEffortOptions=Object.values(Be);selectedProviderId=F$2(this.form.controls.aiProviderId.valueChanges,{initialValue:this.form.controls.aiProviderId.value});reasoningEffortUnsupported=XC(()=>{let t=this.providers().find(e=>e.id===this.selectedProviderId())?.apiType;return t!==void 0&&Ie.includes(t)});temperatureValue=F$2(this.form.controls.temperature.valueChanges,{initialValue:this.form.controls.temperature.value});reasoningEffortValue=F$2(this.form.controls.reasoningEffort.valueChanges,{initialValue:this.form.controls.reasoningEffort.value});temperatureMayConflictWithEffort=XC(()=>{let t=this.temperatureValue();return this.reasoningEffortValue()!=null&&t!=null&&t!==1});isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);selectedProviderLabel=XC(()=>{let t=this.aiProviderIdControl.value,e=this.providers().find(c=>c.id===t);return e?`${e.name} (${e.apiType})`:t});existingModel=null;constructor(){Af(()=>{this.reasoningEffortUnsupported()?(this.reasoningEffortControl.setValue(null),this.reasoningEffortControl.disable()):this.reasoningEffortControl.enable();});}ngOnInit(){let t=this.route.snapshot.paramMap.get("modelId");t&&(this.isEditMode.set(true),this.loadModel(t));}loadModel(t){this.isLoading.set(true),this.aiModelController.getByIdAiModel(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingModel=e,this.aiProviderIdControl.setValue(e.aiProviderId),this.aiProviderIdControl.disable(),this.apiModelNameControl.setValue(e.apiModelName),this.descriptionControl.setValue(e.description??null),this.aliasControl.setValue(e.alias??""),this.priorityControl.setValue(e.priority??0),this.temperatureControl.setValue(e.temperature??null),this.contextWindowControl.setValue(e.contextWindow??null),this.maxCompletionTokensControl.setValue(e.maxCompletionTokens??null),this.reasoningEffortControl.setValue(e.reasoningEffort??null),this.supportsAdvancedExecutionControl.setValue(e.supportsAdvancedExecution??false),this.pricingGroup.setValue({inputMTokens:e.pricing?.inputMTokens??null,outputMTokens:e.pricing?.outputMTokens??null,cacheWrite:e.pricing?.cacheWrite??null,cacheRead:e.pricing?.cacheRead??null}),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.form.getRawValue(),e=t.pricing,u=e.inputMTokens!=null||e.outputMTokens!=null||e.cacheWrite!=null||e.cacheRead!=null?{isEmpty:false,inputMTokens:e.inputMTokens??void 0,outputMTokens:e.outputMTokens??void 0,cacheWrite:e.cacheWrite??void 0,cacheRead:e.cacheRead??void 0}:void 0,w$1=x(w({},this.existingModel??{}),{aiProviderId:t.aiProviderId,namespaceId:this.isPlatformMode?void 0:this.existingModel?.namespaceId??this.namespaceId,apiModelName:t.apiModelName.trim(),description:t.description?.trim()||void 0,alias:t.alias.trim()||void 0,priority:t.priority,temperature:t.temperature??void 0,contextWindow:t.contextWindow??void 0,maxCompletionTokens:t.maxCompletionTokens??void 0,reasoningEffort:t.reasoningEffort??void 0,supportsAdvancedExecution:t.supportsAdvancedExecution,pricing:u});(this.isEditMode()?this.aiModelController.updateAiModel(this.existingModel.id??"",w$1):this.aiModelController.createAiModel(w$1)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-models"]):this.router.navigate(["/agentos",this.namespaceId,"ai-models"]);}trackByProvider(t,e){return e.id??""}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=yw({type:r,selectors:[["agentos-ai-model-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to AI models",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Provider","controlId","model-provider","required",""],["dsControl","","id","model-provider","type","text","readonly","","tabindex","-1",3,"value"],["dsControl","","id","model-provider",3,"formControl"],["label","API name","controlId","model-api-name","required",""],["dsControl","","mono","","id","model-api-name","type","text","placeholder","e.g. gpt-4o, claude-3-5-sonnet-20241022","autocomplete","off",3,"formControl"],["label","Description","controlId","model-description"],["dsControl","","id","model-description","type","text","placeholder","Optional \u2014 short description of this model config","autocomplete","off",3,"formControl"],["label","Alias","controlId","model-alias"],["dsControl","","id","model-alias","type","text","placeholder","e.g. fast, smart \u2014 short identifier used internally","autocomplete","off",3,"formControl"],["label","Priority","controlId","model-priority"],["dsControl","","id","model-priority","type","number","placeholder","0 \u2014 higher wins when multiple configs share the same alias","min","0","step","1",3,"formControl"],[1,"ds-grid-2"],["label","Temperature","controlId","model-temperature"],["dsControl","","id","model-temperature","type","number","placeholder","0 \u2013 2","min","0","max","2","step","0.1",3,"formControl"],["label","Context window","controlId","model-context-window"],["dsControl","","id","model-context-window","type","number","placeholder","e.g. 128000","min","1","step","1",3,"formControl"],["label","Max completion tokens","controlId","model-max-completion-tokens"],["dsControl","","id","model-max-completion-tokens","type","number","placeholder","e.g. 4096","min","1","step","1",3,"formControl"],["label","Reasoning effort","controlId","model-reasoning-effort"],["dsControl","","id","model-reasoning-effort",3,"formControl"],[3,"ngValue"],[1,"ds-hint","ds-hint--warning"],[1,"ai-model-form__field"],[1,"ai-model-form__toggle-label"],["type","checkbox",1,"ai-model-form__toggle-checkbox",3,"formControl"],[1,"ai-model-form__toggle-text"],[1,"ai-model-form__toggle-hint"],["legend","Pricing","legendHint","per million tokens \u2014 leave blank to skip cost monitoring",3,"formGroup"],["label","Input","controlId","pricing-input"],["dsControl","","id","pricing-input","type","number","placeholder","e.g. 2.50","min","0","step","0.01","formControlName","inputMTokens"],["label","Output","controlId","pricing-output"],["dsControl","","id","pricing-output","type","number","placeholder","e.g. 10.00","min","0","step","0.01","formControlName","outputMTokens"],["label","Cache write","controlId","pricing-cache-write"],["dsControl","","id","pricing-cache-write","type","number","placeholder","e.g. 3.75","min","0","step","0.01","formControlName","cacheWrite"],["label","Cache read","controlId","pricing-cache-read"],["dsControl","","id","pricing-cache-read","type","number","placeholder","e.g. 0.30","min","0","step","0.01","formControlName","cacheRead"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["value","","disabled",""],[3,"value"]],template:function(e,c){e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return c.cancel()}),NC(3," \u2190 AI models "),pl()(),Lw(4,he,2,0,"p",2)(5,Ae,51,17,"form",3),pl()),e&2&&(BE(),ug("title",c.isEditMode()?"Edit AI model":"New AI model"),BE(3),jw(c.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,at,an,Ut,nd,bo,xo,Lt,kn,vn,Gt,mo,po,$r,qr,Vn,An,va],encapsulation:2})};export{ge as AiModelFormComponent};
1
+ import {p as pt,T as Te,a as fn,c as pn,h as hn,d as cn,r as ln,e as dn,g as at,i as an,U as Ut,n as nd,l as bo,x as xo,L as Lt,k as kn,u as vn,G as Gt,m as mo,b as po,$ as $r,H as qr,V as Vn,A as An,v as va}from'./chunk-qv7FKA2K.js';import {g,W,F,I as Ie$1,aq as k,ap as F$1,a9 as F$2,a2 as da,aa as Tr,ar as Ue,X as XC,U as Ui,q as Af,G as U,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,j as jw,Z as Zw,l as lg,_ as _I,H as Hw,ao as Vw,J as Jw,R as NI,m as Uw,v as vl,ae as Fw,O as Og,as as kg,r as df,s as ff}from'./main-A7H5YZCD.js';function he(r,t){r&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function ve(r,t){if(r&1&&lg(0,"input",6),r&2){let e=Jw(2);ug("value",e.selectedProviderLabel());}}function ye(r,t){if(r&1&&(Ds(0,"option",44),NC(1),pl()),r&2){let e=t.$implicit;ug("value",e.id),BE(),kg("",e.name," (",e.apiType,")");}}function be(r,t){if(r&1&&(Ds(0,"select",7)(1,"option",43),NC(2,"Select provider"),pl(),Hw(3,ye,2,3,"option",44,Fw().trackByProvider,true),pl(),_I()),r&2){let e=Jw(2);ug("formControl",e.aiProviderIdControl),NI(),BE(3),Uw(e.providers());}}function xe(r,t){if(r&1&&(Ds(0,"option",25),NC(1),pl()),r&2){let e=t.$implicit;ug("ngValue",e),BE(),Og(e.toLowerCase());}}function _e(r,t){r&1&&(Ds(0,"p",2),NC(1,"Not supported yet for Anthropic and Gemini providers."),pl());}function Me(r,t){r&1&&(Ds(0,"p",2),NC(1," Sent as is to OpenAI-compatible providers, which reject levels the model does not support. Through Requesty, Claude models do not apply it faithfully. "),pl());}function Ee(r,t){r&1&&(Ds(0,"p",26),NC(1," OpenAI reasoning models (GPT-5.1 and later) reject a temperature other than 1 with an effort: leave Temperature empty or set it to 1. "),pl());}function Ae(r,t){if(r&1){let e=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let u=Jw();return ff(u.submit())}),Ds(1,"ds-form-field",5),Lw(2,ve,1,1,"input",6)(3,be,5,1,"select",7),pl(),Ds(4,"ds-form-field",8),lg(5,"input",9),_I(),pl(),Ds(6,"ds-form-field",10),lg(7,"input",11),_I(),pl(),Ds(8,"ds-form-field",12),lg(9,"input",13),_I(),pl(),Ds(10,"ds-form-field",14),lg(11,"input",15),_I(),pl(),Ds(12,"div",16)(13,"ds-form-field",17),lg(14,"input",18),_I(),pl(),Ds(15,"ds-form-field",19),lg(16,"input",20),_I(),pl()(),Ds(17,"ds-form-field",21),lg(18,"input",22),_I(),pl(),Ds(19,"ds-form-field",23)(20,"select",24)(21,"option",25),NC(22,"Provider default"),pl(),Hw(23,xe,2,2,"option",25,Vw),pl(),_I(),Lw(25,_e,2,0,"p",2)(26,Me,2,0,"p",2),Lw(27,Ee,2,0,"p",26),pl(),Ds(28,"div",27)(29,"label",28),lg(30,"input",29),_I(),Ds(31,"span",30),NC(32,"Supports advanced execution"),pl()(),Ds(33,"p",31),NC(34," Agents configured in ADVANCED execution mode fail to run on a model that does not support it. SIMPLE agents are not concerned. "),pl()(),Ds(35,"ds-fieldset",32)(36,"div",16)(37,"ds-form-field",33),lg(38,"input",34),_I(),pl(),Ds(39,"ds-form-field",35),lg(40,"input",36),_I(),pl()(),Ds(41,"div",16)(42,"ds-form-field",37),lg(43,"input",38),_I(),pl(),Ds(44,"ds-form-field",39),lg(45,"input",40),_I(),pl()()(),Ds(46,"ds-form-actions")(47,"button",41),NC(48),pl(),Ds(49,"button",42),mg("click",function(){df(e);let u=Jw();return ff(u.cancel())}),NC(50,"Cancel"),pl()()();}if(r&2){let e=Jw();ug("formGroup",e.form),BE(2),jw(e.isEditMode()?2:3),BE(3),ug("formControl",e.apiModelNameControl),NI(),BE(2),ug("formControl",e.descriptionControl),NI(),BE(2),ug("formControl",e.aliasControl),NI(),BE(2),ug("formControl",e.priorityControl),NI(),BE(3),ug("formControl",e.temperatureControl),NI(),BE(2),ug("formControl",e.contextWindowControl),NI(),BE(2),ug("formControl",e.maxCompletionTokensControl),NI(),BE(2),ug("formControl",e.reasoningEffortControl),NI(),BE(),ug("ngValue",null),BE(2),Uw(e.reasoningEffortOptions),BE(2),jw(e.reasoningEffortUnsupported()?25:26),BE(2),jw(e.temperatureMayConflictWithEffort()?27:-1),BE(3),ug("formControl",e.supportsAdvancedExecutionControl),NI(),BE(5),ug("formGroup",e.pricingGroup),BE(3),NI(),BE(2),NI(),BE(3),NI(),BE(2),NI(),BE(2),ug("disabled",e.form.invalid||e.isSubmitting()),BE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var Ie=["Anthropic","Gemini"],ge=class r{route=g(W);router=g(F);destroyRef=g(Ie$1);aiModelController=g(k);aiProviderController=g(F$1);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;providers=F$2(this.aiProviderController.listAiProvider(this.isPlatformMode?"none":this.namespaceId).pipe(da(()=>Tr([]))),{initialValue:[]});form=new pt({aiProviderId:new Te("",{nonNullable:true,validators:[fn.required]}),apiModelName:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(null),alias:new Te("",{nonNullable:true}),priority:new Te(0,{nonNullable:true}),temperature:new Te(null),contextWindow:new Te(null),maxCompletionTokens:new Te(null),reasoningEffort:new Te(null),supportsAdvancedExecution:new Te(false,{nonNullable:true}),pricing:new pt({inputMTokens:new Te(null),outputMTokens:new Te(null),cacheWrite:new Te(null),cacheRead:new Te(null)})});get aiProviderIdControl(){return this.form.controls.aiProviderId}get apiModelNameControl(){return this.form.controls.apiModelName}get descriptionControl(){return this.form.controls.description}get aliasControl(){return this.form.controls.alias}get priorityControl(){return this.form.controls.priority}get temperatureControl(){return this.form.controls.temperature}get contextWindowControl(){return this.form.controls.contextWindow}get maxCompletionTokensControl(){return this.form.controls.maxCompletionTokens}get reasoningEffortControl(){return this.form.controls.reasoningEffort}get supportsAdvancedExecutionControl(){return this.form.controls.supportsAdvancedExecution}get pricingGroup(){return this.form.controls.pricing}reasoningEffortOptions=Object.values(Ue);selectedProviderId=F$2(this.form.controls.aiProviderId.valueChanges,{initialValue:this.form.controls.aiProviderId.value});reasoningEffortUnsupported=XC(()=>{let t=this.providers().find(e=>e.id===this.selectedProviderId())?.apiType;return t!==void 0&&Ie.includes(t)});temperatureValue=F$2(this.form.controls.temperature.valueChanges,{initialValue:this.form.controls.temperature.value});reasoningEffortValue=F$2(this.form.controls.reasoningEffort.valueChanges,{initialValue:this.form.controls.reasoningEffort.value});temperatureMayConflictWithEffort=XC(()=>{let t=this.temperatureValue();return this.reasoningEffortValue()!=null&&t!=null&&t!==1});isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);selectedProviderLabel=XC(()=>{let t=this.aiProviderIdControl.value,e=this.providers().find(c=>c.id===t);return e?`${e.name} (${e.apiType})`:t});existingModel=null;constructor(){Af(()=>{this.reasoningEffortUnsupported()?(this.reasoningEffortControl.setValue(null),this.reasoningEffortControl.disable()):this.reasoningEffortControl.enable();});}ngOnInit(){let t=this.route.snapshot.paramMap.get("modelId");t&&(this.isEditMode.set(true),this.loadModel(t));}loadModel(t){this.isLoading.set(true),this.aiModelController.getByIdAiModel(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingModel=e,this.aiProviderIdControl.setValue(e.aiProviderId),this.aiProviderIdControl.disable(),this.apiModelNameControl.setValue(e.apiModelName),this.descriptionControl.setValue(e.description??null),this.aliasControl.setValue(e.alias??""),this.priorityControl.setValue(e.priority??0),this.temperatureControl.setValue(e.temperature??null),this.contextWindowControl.setValue(e.contextWindow??null),this.maxCompletionTokensControl.setValue(e.maxCompletionTokens??null),this.reasoningEffortControl.setValue(e.reasoningEffort??null),this.supportsAdvancedExecutionControl.setValue(e.supportsAdvancedExecution??false),this.pricingGroup.setValue({inputMTokens:e.pricing?.inputMTokens??null,outputMTokens:e.pricing?.outputMTokens??null,cacheWrite:e.pricing?.cacheWrite??null,cacheRead:e.pricing?.cacheRead??null}),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.form.getRawValue(),e=t.pricing,u=e.inputMTokens!=null||e.outputMTokens!=null||e.cacheWrite!=null||e.cacheRead!=null?{isEmpty:false,inputMTokens:e.inputMTokens??void 0,outputMTokens:e.outputMTokens??void 0,cacheWrite:e.cacheWrite??void 0,cacheRead:e.cacheRead??void 0}:void 0,w$1=x(w({},this.existingModel??{}),{aiProviderId:t.aiProviderId,namespaceId:this.isPlatformMode?void 0:this.existingModel?.namespaceId??this.namespaceId,apiModelName:t.apiModelName.trim(),description:t.description?.trim()||void 0,alias:t.alias.trim()||void 0,priority:t.priority,temperature:t.temperature??void 0,contextWindow:t.contextWindow??void 0,maxCompletionTokens:t.maxCompletionTokens??void 0,reasoningEffort:t.reasoningEffort??void 0,supportsAdvancedExecution:t.supportsAdvancedExecution,pricing:u});(this.isEditMode()?this.aiModelController.updateAiModel(this.existingModel.id??"",w$1):this.aiModelController.createAiModel(w$1)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-models"]):this.router.navigate(["/agentos",this.namespaceId,"ai-models"]);}trackByProvider(t,e){return e.id??""}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=yw({type:r,selectors:[["agentos-ai-model-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to AI models",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Provider","controlId","model-provider","required",""],["dsControl","","id","model-provider","type","text","readonly","","tabindex","-1",3,"value"],["dsControl","","id","model-provider",3,"formControl"],["label","API name","controlId","model-api-name","required",""],["dsControl","","mono","","id","model-api-name","type","text","placeholder","e.g. gpt-4o, claude-3-5-sonnet-20241022","autocomplete","off",3,"formControl"],["label","Description","controlId","model-description"],["dsControl","","id","model-description","type","text","placeholder","Optional \u2014 short description of this model config","autocomplete","off",3,"formControl"],["label","Alias","controlId","model-alias"],["dsControl","","id","model-alias","type","text","placeholder","e.g. fast, smart \u2014 short identifier used internally","autocomplete","off",3,"formControl"],["label","Priority","controlId","model-priority"],["dsControl","","id","model-priority","type","number","placeholder","0 \u2014 higher wins when multiple configs share the same alias","min","0","step","1",3,"formControl"],[1,"ds-grid-2"],["label","Temperature","controlId","model-temperature"],["dsControl","","id","model-temperature","type","number","placeholder","0 \u2013 2","min","0","max","2","step","0.1",3,"formControl"],["label","Context window","controlId","model-context-window"],["dsControl","","id","model-context-window","type","number","placeholder","e.g. 128000","min","1","step","1",3,"formControl"],["label","Max completion tokens","controlId","model-max-completion-tokens"],["dsControl","","id","model-max-completion-tokens","type","number","placeholder","e.g. 4096","min","1","step","1",3,"formControl"],["label","Reasoning effort","controlId","model-reasoning-effort"],["dsControl","","id","model-reasoning-effort",3,"formControl"],[3,"ngValue"],[1,"ds-hint","ds-hint--warning"],[1,"ai-model-form__field"],[1,"ai-model-form__toggle-label"],["type","checkbox",1,"ai-model-form__toggle-checkbox",3,"formControl"],[1,"ai-model-form__toggle-text"],[1,"ai-model-form__toggle-hint"],["legend","Pricing","legendHint","per million tokens \u2014 leave blank to skip cost monitoring",3,"formGroup"],["label","Input","controlId","pricing-input"],["dsControl","","id","pricing-input","type","number","placeholder","e.g. 2.50","min","0","step","0.01","formControlName","inputMTokens"],["label","Output","controlId","pricing-output"],["dsControl","","id","pricing-output","type","number","placeholder","e.g. 10.00","min","0","step","0.01","formControlName","outputMTokens"],["label","Cache write","controlId","pricing-cache-write"],["dsControl","","id","pricing-cache-write","type","number","placeholder","e.g. 3.75","min","0","step","0.01","formControlName","cacheWrite"],["label","Cache read","controlId","pricing-cache-read"],["dsControl","","id","pricing-cache-read","type","number","placeholder","e.g. 0.30","min","0","step","0.01","formControlName","cacheRead"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["value","","disabled",""],[3,"value"]],template:function(e,c){e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return c.cancel()}),NC(3," \u2190 AI models "),pl()(),Lw(4,he,2,0,"p",2)(5,Ae,51,17,"form",3),pl()),e&2&&(BE(),ug("title",c.isEditMode()?"Edit AI model":"New AI model"),BE(3),jw(c.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,at,an,Ut,nd,bo,xo,Lt,kn,vn,Gt,mo,po,$r,qr,Vn,An,va],encapsulation:2})};export{ge as AiModelFormComponent};
@@ -1 +1 @@
1
- import {g,aK as fe,a6 as x}from'./main-M62523CG.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-A7H5YZCD.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 {c}from'./chunk-CsuAvKcl.js';import {z as k,O as O$1,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-C20Tq5VN.js';import {g,F,I as Ie,U as Ui,G as U$1,ai as Ue,al as Fe,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-M62523CG.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===Ue.WEEK?"week":"month",s=e.unit===Ue.WEEK&&e.days?.length?` (${e.days.map(c=>Fe[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-D_OcLa_E.js';import {z as k,O as O$1,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-qv7FKA2K.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-A7H5YZCD.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 {I as I$1}from'./chunk-B5RsrYWK.js';import {g,F,I as Ie,$ 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,v as vl,Z as Zw,k as cg,r as df,s as ff}from'./main-M62523CG.js';import {z as k,O as O$1,g as at,h as hn,I as Io,P,B as P$1}from'./chunk-C20Tq5VN.js';import'./chunk-CrCRSut7.js';var B=(e,t)=>t.id??t.name;function j(e,t){if(e&1&&(Ds(0,"p",3),NC(1),pl()),e&2){let n=Jw();BE(),Og(n.deletion.error());}}function K(e,t){e&1&&(Ds(0,"p",4),NC(1,"Loading auth settings\u2026"),pl());}function H(e,t){e&1&&(Ds(0,"p",5),NC(1,"No platform auth settings defined yet."),pl());}function U(e,t){e&1&&(Ds(0,"p",4),NC(1,"No auth settings match the current filter."),pl());}function z(e,t){if(e&1){let n=Zw();Ds(0,"button",18),mg("click",function(){df(n);let d=Jw().$implicit,m=Jw(2);return ff(m.onEdit(d))}),NC(1," Edit "),pl();}if(e&2){let n=Jw().$implicit;cg("aria-label","Edit "+n.name);}}function G(e,t){if(e&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.onDelete(d))})("deleteCancelled",function(){df(n);let d=Jw(3);return ff(d.deletion.cancel())}),pl();}if(e&2){let n=Jw().$implicit,a=Jw(2);ug("rowKey",n.id)("rowLabel",n.name)("state",a.deletion);}}function J(e,t){if(e&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()()()),e&2){let n=t.$implicit,a=Jw(2);BE(2),Og(n.name),BE(2),vl(" ",n.authType," "),BE(3),jw(a.deletion.confirmingId()!==n.id?7:-1),BE(),jw(n.id?8:-1);}}function O(e,t){if(e&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,"Authentication type"),pl(),Ds(8,"th",10)(9,"span",11),NC(10,"Actions"),pl()()()(),Ds(11,"tbody",8),Hw(12,J,9,4,"tr",9,B),pl()()()),e&2){let n=Jw();BE(12),Uw(n.rowFilter.filteredRows());}}var I=class e{router=g(F);destroyRef=g(Ie);state=g(I$1);refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k();settings=Ui([]);rowFilter=O$1(this.settings,t=>[t.name,t.authType].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.state.loadPlatformSettings())),U$1(this.destroyRef)).subscribe({next:t=>{this.settings.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","auth-settings","new"]);}onEdit(t){t.id&&this.router.navigate(["/agentos","admin","auth-settings",t.id,"edit"]);}onDelete(t){t.id&&this.deletion.execute(t.id,{request$:this.state.delete(t.id,"platform").pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${t.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=yw({type:e,selectors:[["agentos-platform-auth-settings"]],decls:9,vars:3,consts:[["title","Platform auth settings","description","Authentication settings shared across every namespace."],["label","Filter auth settings","placeholder","Filter auth settings\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform auth settings"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Authentication type",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(n,a){n&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return a.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return a.openCreateForm()}),NC(3,"New auth setting"),pl()(),Lw(4,j,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",a.rowFilter.query()),BE(3),jw(a.deletion.error()?4:-1),BE(),jw(a.isLoading()?5:a.settings().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{I as PlatformAuthSettingsComponent};
1
+ import {I as I$1}from'./chunk-CEwpNeBE.js';import {g,F,I as Ie,$ 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,v as vl,Z as Zw,k as cg,r as df,s as ff}from'./main-A7H5YZCD.js';import {z as k,O as O$1,g as at,h as hn,I as Io,P,B as P$1}from'./chunk-qv7FKA2K.js';import'./chunk-DrlG2odS.js';var B=(e,t)=>t.id??t.name;function j(e,t){if(e&1&&(Ds(0,"p",3),NC(1),pl()),e&2){let n=Jw();BE(),Og(n.deletion.error());}}function K(e,t){e&1&&(Ds(0,"p",4),NC(1,"Loading auth settings\u2026"),pl());}function H(e,t){e&1&&(Ds(0,"p",5),NC(1,"No platform auth settings defined yet."),pl());}function U(e,t){e&1&&(Ds(0,"p",4),NC(1,"No auth settings match the current filter."),pl());}function z(e,t){if(e&1){let n=Zw();Ds(0,"button",18),mg("click",function(){df(n);let d=Jw().$implicit,m=Jw(2);return ff(m.onEdit(d))}),NC(1," Edit "),pl();}if(e&2){let n=Jw().$implicit;cg("aria-label","Edit "+n.name);}}function G(e,t){if(e&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.onDelete(d))})("deleteCancelled",function(){df(n);let d=Jw(3);return ff(d.deletion.cancel())}),pl();}if(e&2){let n=Jw().$implicit,a=Jw(2);ug("rowKey",n.id)("rowLabel",n.name)("state",a.deletion);}}function J(e,t){if(e&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()()()),e&2){let n=t.$implicit,a=Jw(2);BE(2),Og(n.name),BE(2),vl(" ",n.authType," "),BE(3),jw(a.deletion.confirmingId()!==n.id?7:-1),BE(),jw(n.id?8:-1);}}function O(e,t){if(e&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,"Authentication type"),pl(),Ds(8,"th",10)(9,"span",11),NC(10,"Actions"),pl()()()(),Ds(11,"tbody",8),Hw(12,J,9,4,"tr",9,B),pl()()()),e&2){let n=Jw();BE(12),Uw(n.rowFilter.filteredRows());}}var I=class e{router=g(F);destroyRef=g(Ie);state=g(I$1);refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k();settings=Ui([]);rowFilter=O$1(this.settings,t=>[t.name,t.authType].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.state.loadPlatformSettings())),U$1(this.destroyRef)).subscribe({next:t=>{this.settings.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","auth-settings","new"]);}onEdit(t){t.id&&this.router.navigate(["/agentos","admin","auth-settings",t.id,"edit"]);}onDelete(t){t.id&&this.deletion.execute(t.id,{request$:this.state.delete(t.id,"platform").pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${t.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=yw({type:e,selectors:[["agentos-platform-auth-settings"]],decls:9,vars:3,consts:[["title","Platform auth settings","description","Authentication settings shared across every namespace."],["label","Filter auth settings","placeholder","Filter auth settings\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform auth settings"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Authentication type",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(n,a){n&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return a.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return a.openCreateForm()}),NC(3,"New auth setting"),pl()(),Lw(4,j,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",a.rowFilter.query()),BE(3),jw(a.deletion.error()?4:-1),BE(),jw(a.isLoading()?5:a.settings().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{I as PlatformAuthSettingsComponent};
@@ -1 +1 @@
1
- import {o}from'./chunk-EewxiDYN.js';import {z as k,O as O$1,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-C20Tq5VN.js';import {g,F,I as Ie,$ 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,v as vl,Z as Zw,r as df,s as ff,k as cg}from'./main-M62523CG.js';var K=(i,e)=>e.id??e.name;function O(i,e){if(i&1&&(Ds(0,"p",3),NC(1),pl()),i&2){let t=Jw();BE(),Og(t.deletion.error());}}function A(i,e){i&1&&(Ds(0,"p",4),NC(1,"Loading skills\u2026"),pl());}function H(i,e){i&1&&(Ds(0,"p",5),NC(1,"No platform skills defined yet."),pl());}function U(i,e){i&1&&(Ds(0,"p",4),NC(1,"No skills match the current filter."),pl());}function z(i,e){i&1&&(Ds(0,"ds-tag",15),NC(1,"SKILL.md"),pl());}function G(i,e){if(i&1){let t=Zw();Ds(0,"button",21),mg("click",function(){df(t);let d=Jw(2).$implicit,m=Jw(2);return ff(m.edit(d))}),NC(1,"Edit"),pl();}if(i&2){let t=Jw(2).$implicit;cg("aria-label","Edit "+t.name);}}function J(i,e){if(i&1){let t=Zw();Ds(0,"button",21),mg("click",function(){df(t);let d=Jw().$implicit,m=Jw(2);return ff(m.inspect(d))}),NC(1,"View"),pl(),Lw(2,G,2,1,"button",22);}if(i&2){let t=Jw().$implicit;cg("aria-label","View "+t.name),BE(2),jw(t.readOnly?-1:2);}}function Q(i,e){if(i&1){let t=Zw();Ds(0,"agentos-row-delete-action",23),mg("deleteRequested",function(){df(t);let d=Jw().$implicit,m=Jw(2);return ff(m.deletion.request(d.id))})("deleteConfirmed",function(){df(t);let d=Jw().$implicit,m=Jw(2);return ff(m.confirmDelete(d))})("deleteCancelled",function(){df(t);let d=Jw(3);return ff(d.deletion.cancel())}),pl();}if(i&2){let t=Jw().$implicit,l=Jw(2);ug("rowKey",t.id)("rowLabel",t.name)("state",l.deletion);}}function W(i,e){if(i&1&&(Ds(0,"tr",9)(1,"td",12)(2,"div",13)(3,"span",14),NC(4),pl(),Lw(5,z,2,0,"ds-tag",15),pl()(),Ds(6,"td",16),NC(7),pl(),Ds(8,"td",17),NC(9),pl(),Ds(10,"td",18)(11,"div",19),Lw(12,J,3,2),Lw(13,Q,1,3,"agentos-row-delete-action",20),pl()()()),i&2){let t=e.$implicit,l=Jw(2);BE(4),Og(t.name),BE(),jw(t.readOnly?5:-1),BE(2),vl(" ",t.description||"\u2014"," "),BE(2),Og(l.resourceCount(t)),BE(3),jw(l.deletion.confirmingId()!==t.id?12:-1),BE(),jw(!t.readOnly&&t.id?13:-1);}}function X(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,"Description"),pl(),Ds(8,"th",10),NC(9,"Resources"),pl(),Ds(10,"th",10)(11,"span",11),NC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Hw(14,W,14,6,"tr",9,K),pl()()()),i&2){let t=Jw();BE(14),Uw(t.rowFilter.filteredRows());}}var B=class i{router=g(F);destroyRef=g(Ie);skillState=g(o);refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k();skills=Ui([]);rowFilter=O$1(this.skills,e=>[e.name,e.description].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.skillState.listPlatform())),U$1(this.destroyRef)).subscribe({next:e=>{this.skills.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}resourceCount(e){return Object.keys(e.resources??{}).length}openCreateForm(){this.router.navigate(["/agentos","admin","skills","new"]);}inspect(e){e.id&&this.router.navigate(["/agentos","admin","skills",e.id,"inspect"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","skills",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.skillState.delete(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:t=>t.status===403?`Deleting "${e.name}" requires platform administrator rights.`:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-platform-skills"]],decls:9,vars:3,consts:[["title","Platform skills","description","Skills shared across every namespace."],["label","Filter skills","placeholder","Filter skills\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform skills"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__tags"],[1,"settings-table__name"],["variant","neutral"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Resources"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,l){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return l.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return l.openCreateForm()}),NC(3,"New skill"),pl()(),Lw(4,O,2,1,"p",3),Lw(5,A,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,X,16,0,"div",6)),t&2&&(BE(),ug("query",l.rowFilter.query()),BE(3),jw(l.deletion.error()?4:-1),BE(),jw(l.isLoading()?5:l.skills().length===0?6:l.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{B as PlatformSkillsComponent};
1
+ import {o}from'./chunk-DOyReEdW.js';import {z as k,O as O$1,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-qv7FKA2K.js';import {g,F,I as Ie,$ 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,v as vl,Z as Zw,r as df,s as ff,k as cg}from'./main-A7H5YZCD.js';var K=(i,e)=>e.id??e.name;function O(i,e){if(i&1&&(Ds(0,"p",3),NC(1),pl()),i&2){let t=Jw();BE(),Og(t.deletion.error());}}function A(i,e){i&1&&(Ds(0,"p",4),NC(1,"Loading skills\u2026"),pl());}function H(i,e){i&1&&(Ds(0,"p",5),NC(1,"No platform skills defined yet."),pl());}function U(i,e){i&1&&(Ds(0,"p",4),NC(1,"No skills match the current filter."),pl());}function z(i,e){i&1&&(Ds(0,"ds-tag",15),NC(1,"SKILL.md"),pl());}function G(i,e){if(i&1){let t=Zw();Ds(0,"button",21),mg("click",function(){df(t);let d=Jw(2).$implicit,m=Jw(2);return ff(m.edit(d))}),NC(1,"Edit"),pl();}if(i&2){let t=Jw(2).$implicit;cg("aria-label","Edit "+t.name);}}function J(i,e){if(i&1){let t=Zw();Ds(0,"button",21),mg("click",function(){df(t);let d=Jw().$implicit,m=Jw(2);return ff(m.inspect(d))}),NC(1,"View"),pl(),Lw(2,G,2,1,"button",22);}if(i&2){let t=Jw().$implicit;cg("aria-label","View "+t.name),BE(2),jw(t.readOnly?-1:2);}}function Q(i,e){if(i&1){let t=Zw();Ds(0,"agentos-row-delete-action",23),mg("deleteRequested",function(){df(t);let d=Jw().$implicit,m=Jw(2);return ff(m.deletion.request(d.id))})("deleteConfirmed",function(){df(t);let d=Jw().$implicit,m=Jw(2);return ff(m.confirmDelete(d))})("deleteCancelled",function(){df(t);let d=Jw(3);return ff(d.deletion.cancel())}),pl();}if(i&2){let t=Jw().$implicit,l=Jw(2);ug("rowKey",t.id)("rowLabel",t.name)("state",l.deletion);}}function W(i,e){if(i&1&&(Ds(0,"tr",9)(1,"td",12)(2,"div",13)(3,"span",14),NC(4),pl(),Lw(5,z,2,0,"ds-tag",15),pl()(),Ds(6,"td",16),NC(7),pl(),Ds(8,"td",17),NC(9),pl(),Ds(10,"td",18)(11,"div",19),Lw(12,J,3,2),Lw(13,Q,1,3,"agentos-row-delete-action",20),pl()()()),i&2){let t=e.$implicit,l=Jw(2);BE(4),Og(t.name),BE(),jw(t.readOnly?5:-1),BE(2),vl(" ",t.description||"\u2014"," "),BE(2),Og(l.resourceCount(t)),BE(3),jw(l.deletion.confirmingId()!==t.id?12:-1),BE(),jw(!t.readOnly&&t.id?13:-1);}}function X(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,"Description"),pl(),Ds(8,"th",10),NC(9,"Resources"),pl(),Ds(10,"th",10)(11,"span",11),NC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Hw(14,W,14,6,"tr",9,K),pl()()()),i&2){let t=Jw();BE(14),Uw(t.rowFilter.filteredRows());}}var B=class i{router=g(F);destroyRef=g(Ie);skillState=g(o);refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k();skills=Ui([]);rowFilter=O$1(this.skills,e=>[e.name,e.description].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.skillState.listPlatform())),U$1(this.destroyRef)).subscribe({next:e=>{this.skills.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}resourceCount(e){return Object.keys(e.resources??{}).length}openCreateForm(){this.router.navigate(["/agentos","admin","skills","new"]);}inspect(e){e.id&&this.router.navigate(["/agentos","admin","skills",e.id,"inspect"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","skills",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.skillState.delete(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:t=>t.status===403?`Deleting "${e.name}" requires platform administrator rights.`:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-platform-skills"]],decls:9,vars:3,consts:[["title","Platform skills","description","Skills shared across every namespace."],["label","Filter skills","placeholder","Filter skills\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform skills"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__tags"],[1,"settings-table__name"],["variant","neutral"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Resources"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,l){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return l.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return l.openCreateForm()}),NC(3,"New skill"),pl()(),Lw(4,O,2,1,"p",3),Lw(5,A,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,X,16,0,"div",6)),t&2&&(BE(),ug("query",l.rowFilter.query()),BE(3),jw(l.deletion.error()?4:-1),BE(),jw(l.isLoading()?5:l.skills().length===0?6:l.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{B as PlatformSkillsComponent};
@@ -1 +1 @@
1
- import {g,aJ as be,a6 as x}from'./main-M62523CG.js';var c=class r{api=g(be);getById(e){return this.api.getByIdScheduledPrompt(e)}listPlatform(){return this.api.searchScheduledPrompt({namespaceId:null,userId:null})}listByNamespace(e){return this.api.searchScheduledPrompt({namespaceId:e,userId:null})}search(e){return this.api.searchScheduledPrompt(e)}listEffective(e){return this.api.resolveEffectiveScheduledPrompt(e)}create(e){return this.api.createScheduledPrompt(e)}update(e,t){return this.api.updateScheduledPrompt(e,t)}enable(e){return this.api.enableScheduledPrompt(e)}disable(e){return this.api.disableScheduledPrompt(e)}delete(e){return this.api.deleteScheduledPrompt(e)}static \u0275fac=function(t){return new(t||r)};static \u0275prov=x({token:r,factory:r.\u0275fac,providedIn:"root"})};export{c};
1
+ import {g,aJ as be,a6 as x}from'./main-A7H5YZCD.js';var c=class r{api=g(be);getById(e){return this.api.getByIdScheduledPrompt(e)}listPlatform(){return this.api.searchScheduledPrompt({namespaceId:null,userId:null})}listByNamespace(e){return this.api.searchScheduledPrompt({namespaceId:e,userId:null})}search(e){return this.api.searchScheduledPrompt(e)}listEffective(e){return this.api.resolveEffectiveScheduledPrompt(e)}create(e){return this.api.createScheduledPrompt(e)}update(e,t){return this.api.updateScheduledPrompt(e,t)}enable(e){return this.api.enableScheduledPrompt(e)}disable(e){return this.api.disableScheduledPrompt(e)}delete(e){return this.api.deleteScheduledPrompt(e)}static \u0275fac=function(t){return new(t||r)};static \u0275prov=x({token:r,factory:r.\u0275fac,providedIn:"root"})};export{c};
@@ -1 +1 @@
1
- import {y}from'./chunk-C20Tq5VN.js';import {g,aB as se,aC as T,aa as Tr,a1 as fa,ad as ne,a2 as da,aD as $y,a6 as x}from'./main-M62523CG.js';var v=class i{userState=g(y);membership=g(se);currentUser$=T(this.userState.currentUser);cache=new Map;isAdminOfNamespace$(e){if(!e)return Tr(false);let t=this.cache.get(e);if(t)return t;let s=this.currentUser$.pipe(fa(a=>a?a.isAdmin?Tr(true):this.membership.getMembersNamespaceMembership(e).pipe(ne(d=>d.some(n=>n.id===a.id&&n.role==="ADMIN")),da(()=>Tr(false))):Tr(false)),$y({bufferSize:1,refCount:false}));return this.cache.set(e,s),s}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};export{v};
1
+ import {y}from'./chunk-qv7FKA2K.js';import {g,aB as se,aC as T,aa as Tr,a1 as fa,ad as ne,a2 as da,aD as $y,a6 as x}from'./main-A7H5YZCD.js';var v=class i{userState=g(y);membership=g(se);currentUser$=T(this.userState.currentUser);cache=new Map;isAdminOfNamespace$(e){if(!e)return Tr(false);let t=this.cache.get(e);if(t)return t;let s=this.currentUser$.pipe(fa(a=>a?a.isAdmin?Tr(true):this.membership.getMembersNamespaceMembership(e).pipe(ne(d=>d.some(n=>n.id===a.id&&n.role==="ADMIN")),da(()=>Tr(false))):Tr(false)),$y({bufferSize:1,refCount:false}));return this.cache.set(e,s),s}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};export{v};
@@ -1 +1 @@
1
- import {a}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-EewxiDYN.js';import {J as s,c as pn,h as hn,o as on,C as mn,g as at,q as sn,j as ko,K as Oi,M as On}from'./chunk-C20Tq5VN.js';import {g,W,F,I as Ie,U as Ui,X as XC,G as U,ac as Ty,a2 as da,aa as Tr,y as yw,au as $t,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,j as jw,J as Jw,P as ug,Z as Zw,l as lg,av as zC,O as Og,v as vl,aw as WC,H as Hw,m as Uw,ao as Vw,r as df,s as ff,ax as YD}from'./main-M62523CG.js';var Y=(e,t)=>t.name+t.grant;function Z(e,t){if(e&1&&(Ds(0,"a",2),NC(1,"Edit skill \u2192"),pl()),e&2){let n=Jw();ug("routerLink",n.editRoute());}}function ee(e,t){e&1&&(Ds(0,"ds-tag",3),NC(1,"Platform level"),pl());}function te(e,t){e&1&&(Ds(0,"p",4),NC(1,"Loading\u2026"),pl());}function ne(e,t){e&1&&(Ds(0,"ds-notice"),NC(1,"Failed to load skill."),pl());}function ie(e,t){if(e&1&&(Ds(0,"dt"),NC(1,"Created by"),pl(),Ds(2,"dd"),NC(3),pl()),e&2){let n=Jw(2);BE(3),Og(n.createdBy);}}function oe(e,t){if(e&1&&(Ds(0,"dt"),NC(1,"Last updated"),pl(),Ds(2,"dd"),NC(3),pl()),e&2){let n=Jw(2);BE(3),Og(n.updatedOn);}}function ae(e,t){if(e&1&&(Lw(0,ie,4,1),Lw(1,oe,4,1)),e&2){let n=Jw();jw(n.createdBy?0:-1),BE(),jw(n.updatedOn?1:-1);}}function le(e,t){e&1&&(Ds(0,"p",4),NC(1," A platform skill is offered to every namespace. Open it from a namespace to see which of its agents use it. "),pl());}function se(e,t){e&1&&(Ds(0,"p",4),NC(1,"Loading\u2026"),pl());}function re(e,t){e&1&&(Ds(0,"ds-notice"),NC(1," The agent configs could not be read, so it is unknown whether any agent uses this skill. "),pl());}function de(e,t){e&1&&(Ds(0,"p",4),NC(1,"No agent references this skill."),pl());}function ce(e,t){e&1&&(Ds(0,"ds-tag",15),NC(1,"platform agent"),pl());}function me(e,t){e&1&&(Ds(0,"ds-tag",15),NC(1,"via *"),pl());}function pe(e,t){if(e&1&&(Ds(0,"li",13)(1,"span",14),NC(2),pl(),Lw(3,ce,2,0,"ds-tag",15),Lw(4,me,2,0,"ds-tag",15),pl()),e&2){let n=t.$implicit;BE(2),Og(n.name),BE(),jw(n.platform?3:-1),BE(),jw(n.grant==="all"?4:-1);}}function ue(e,t){if(e&1&&(Ds(0,"ul",12),Hw(1,pe,5,3,"li",13,Y),pl(),Ds(3,"p",4),NC(4," An agent listed "),Ds(5,"code"),NC(6,"via *"),pl(),NC(7," takes the whole catalogue and keeps working without this skill. The others name it, so deleting the skill leaves their selector resolving to nothing. "),pl()),e&2){let n=Jw(2);BE(),Uw(n.consumers());}}function _e(e,t){e&1&&(Ds(0,"p",4),NC(1,"No resources bundled with this skill."),pl());}function ge(e,t){if(e&1){let n=Zw();Ds(0,"li")(1,"ds-disclosure",16),mg("toggled",function(){let r=df(n).$implicit,g=Jw(3);return ff(g.toggleResource(r))}),Ds(2,"pre",17),NC(3),pl()()();}if(e&2){let n=t.$implicit,o=Jw(3);BE(),ug("heading",n)("open",o.isResourceExpanded(n)),BE(2),Og(o.resourceContent(n));}}function Ce(e,t){if(e&1&&(Ds(0,"ul",12),Hw(1,ge,4,3,"li",null,Vw),pl()),e&2){let n=Jw(2);BE(),Uw(n.resourcePaths());}}function fe(e,t){if(e&1){let n=Zw();Ds(0,"ds-card",5)(1,"dl",6)(2,"dt"),NC(3,"Name"),pl(),Ds(4,"dd",7),NC(5),pl(),Ds(6,"dt"),NC(7,"Description"),pl(),Ds(8,"dd"),NC(9),pl(),Ds(10,"dt"),NC(11,"Scope"),pl(),Ds(12,"dd"),NC(13),pl(),Ds(14,"dt"),NC(15,"Storage"),pl(),Ds(16,"dd")(17,"ds-tag",8),NC(18),pl()(),Lw(19,ae,2,2),pl()(),Ds(20,"ds-card",9),Lw(21,le,2,0,"p",4)(22,se,2,0,"p",4)(23,re,2,0,"ds-notice")(24,de,2,0,"p",4)(25,ue,8,0),pl(),Ds(26,"ds-card")(27,"ds-disclosure",10),mg("toggled",function(){df(n);let r=Jw();return ff(r.toggleBody())}),lg(28,"div",11),zC(29,"agentosMarkdown"),pl()(),Ds(30,"ds-card",9),Lw(31,_e,2,0,"p",4)(32,Ce,3,0,"ul",12),pl();}if(e&2){let n=t,o=Jw();BE(5),Og(n.name),BE(4),Og(n.description),BE(4),Og(n.namespaceId?"Namespace":"Platform"),BE(4),ug("variant",o.isFilesystemBacked()?"outline":"neutral"),BE(),vl(" ",o.isFilesystemBacked()?"SKILL.md file (read-only)":"Database"," "),BE(),jw(o.isFilesystemBacked()?-1:19),BE(),ug("heading","Used by"+(!o.isPlatformMode&&!o.consumersLoading()&&!o.consumersUnavailable()?" ("+o.consumers().length+")":"")),BE(),jw(o.isPlatformMode?21:o.consumersLoading()?22:o.consumersUnavailable()?23:o.consumers().length===0?24:25),BE(6),ug("open",!o.bodyCollapsed()),BE(),ug("innerHTML",WC(29,12,n.body),YD),BE(2),ug("heading","Resources ("+o.resourcePaths().length+")"),BE(),jw(o.resourcePaths().length===0?31:32);}}var X=class e{route=g(W);router=g(F);destroyRef=g(Ie);skillState=g(o);agentState=g(s);namespaceId=this.route.snapshot.params.namespaceId;skillId=this.route.snapshot.params.skillId;isPlatformMode=!this.namespaceId;isLoading=Ui(true);hasError=Ui(false);skill=Ui(null);bodyCollapsed=Ui(false);expandedResources=Ui(new Set);resourcePaths=XC(()=>Object.keys(this.skill()?.resources??{}).sort());isFilesystemBacked=XC(()=>this.skill()?.readOnly===true);consumers=Ui([]);consumersUnavailable=Ui(false);consumersLoading=Ui(false);ngOnInit(){this.skillState.getById(this.skillId).pipe(U(this.destroyRef)).subscribe({next:t=>{this.skill.set(t),this.isLoading.set(false),this.loadConsumers(t.name);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}loadConsumers(t){this.namespaceId&&(this.consumersLoading.set(true),Ty({namespace:this.agentState.listByNamespace(this.namespaceId),platform:this.agentState.listPlatform().pipe(da(()=>Tr([])))}).pipe(U(this.destroyRef)).subscribe({next:({namespace:n,platform:o})=>{let r=[...this.toConsumers(n,t,false),...this.toConsumers(o,t,true)];this.consumers.set([...r.filter(g=>g.grant==="named"),...r.filter(g=>g.grant==="all")]),this.consumersLoading.set(false);},error:()=>{this.consumersUnavailable.set(true),this.consumersLoading.set(false);}}));}toConsumers(t,n,o){return t.map(r=>({config:r,grant:a(r.skillSelectors,n)})).filter(r=>r.grant!=="none").map(({config:r,grant:g})=>({name:r.name,grant:g,platform:o}))}toggleBody(){this.bodyCollapsed.update(t=>!t);}toggleResource(t){this.expandedResources.update(n=>{let o=new Set(n);return o.has(t)?o.delete(t):o.add(t),o});}isResourceExpanded(t){return this.expandedResources().has(t)}resourceContent(t){return this.skill()?.resources?.[t]??""}editRoute(){return this.isPlatformMode?["/agentos","admin","skills",this.skillId,"edit"]:["/agentos",this.namespaceId,"skills",this.skillId,"edit"]}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin","skills"]):this.router.navigate(["/agentos",this.namespaceId,"skills"]);}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=yw({type:e,selectors:[["agentos-skill-inspect"]],decls:9,vars:3,consts:[["title","Skill"],["dsButton","","variant","ghost","type","button","title","Back to skills",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],["headerMeta","","variant","outline"],[1,"ds-hint"],["heading","General"],["dsDefinitionList",""],[1,"ds-mono"],[3,"variant"],[3,"heading"],["heading","Body",3,"toggled","open"],[1,"ds-pre","ds-pre--prose","ds-prose",3,"innerHTML"],[1,"ds-list"],[1,"ds-inline","ds-inline--wrap"],[1,"ds-strong"],["variant","neutral"],["bordered","","mono","",3,"toggled","heading","open"],[1,"ds-pre"]],template:function(n,o){if(n&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return o.back()}),NC(3,"\u2190 Skills"),pl(),Lw(4,Z,2,1,"a",2),Lw(5,ee,2,0,"ds-tag",3),pl(),Lw(6,te,2,0,"p",4)(7,ne,2,0,"ds-notice")(8,fe,33,14),pl()),n&2){let r;BE(4),jw(o.skill()&&!o.isFilesystemBacked()?4:-1),BE(),jw(o.isPlatformMode?5:-1),BE(),jw(o.isLoading()?6:o.hasError()?7:(r=o.skill())?8:-1,r);}},dependencies:[$t,pn,hn,on,mn,at,sn,ko,Oi,On],encapsulation:2})};export{X as SkillInspectComponent};
1
+ import {a}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-DOyReEdW.js';import {J as s,c as pn,h as hn,o as on,C as mn,g as at,q as sn,j as ko,K as Oi,M as On}from'./chunk-qv7FKA2K.js';import {g,W,F,I as Ie,U as Ui,X as XC,G as U,ac as Ty,a2 as da,aa as Tr,y as yw,au as $t,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,j as jw,J as Jw,P as ug,Z as Zw,l as lg,av as zC,O as Og,v as vl,aw as WC,H as Hw,m as Uw,ao as Vw,r as df,s as ff,ax as YD}from'./main-A7H5YZCD.js';var Y=(e,t)=>t.name+t.grant;function Z(e,t){if(e&1&&(Ds(0,"a",2),NC(1,"Edit skill \u2192"),pl()),e&2){let n=Jw();ug("routerLink",n.editRoute());}}function ee(e,t){e&1&&(Ds(0,"ds-tag",3),NC(1,"Platform level"),pl());}function te(e,t){e&1&&(Ds(0,"p",4),NC(1,"Loading\u2026"),pl());}function ne(e,t){e&1&&(Ds(0,"ds-notice"),NC(1,"Failed to load skill."),pl());}function ie(e,t){if(e&1&&(Ds(0,"dt"),NC(1,"Created by"),pl(),Ds(2,"dd"),NC(3),pl()),e&2){let n=Jw(2);BE(3),Og(n.createdBy);}}function oe(e,t){if(e&1&&(Ds(0,"dt"),NC(1,"Last updated"),pl(),Ds(2,"dd"),NC(3),pl()),e&2){let n=Jw(2);BE(3),Og(n.updatedOn);}}function ae(e,t){if(e&1&&(Lw(0,ie,4,1),Lw(1,oe,4,1)),e&2){let n=Jw();jw(n.createdBy?0:-1),BE(),jw(n.updatedOn?1:-1);}}function le(e,t){e&1&&(Ds(0,"p",4),NC(1," A platform skill is offered to every namespace. Open it from a namespace to see which of its agents use it. "),pl());}function se(e,t){e&1&&(Ds(0,"p",4),NC(1,"Loading\u2026"),pl());}function re(e,t){e&1&&(Ds(0,"ds-notice"),NC(1," The agent configs could not be read, so it is unknown whether any agent uses this skill. "),pl());}function de(e,t){e&1&&(Ds(0,"p",4),NC(1,"No agent references this skill."),pl());}function ce(e,t){e&1&&(Ds(0,"ds-tag",15),NC(1,"platform agent"),pl());}function me(e,t){e&1&&(Ds(0,"ds-tag",15),NC(1,"via *"),pl());}function pe(e,t){if(e&1&&(Ds(0,"li",13)(1,"span",14),NC(2),pl(),Lw(3,ce,2,0,"ds-tag",15),Lw(4,me,2,0,"ds-tag",15),pl()),e&2){let n=t.$implicit;BE(2),Og(n.name),BE(),jw(n.platform?3:-1),BE(),jw(n.grant==="all"?4:-1);}}function ue(e,t){if(e&1&&(Ds(0,"ul",12),Hw(1,pe,5,3,"li",13,Y),pl(),Ds(3,"p",4),NC(4," An agent listed "),Ds(5,"code"),NC(6,"via *"),pl(),NC(7," takes the whole catalogue and keeps working without this skill. The others name it, so deleting the skill leaves their selector resolving to nothing. "),pl()),e&2){let n=Jw(2);BE(),Uw(n.consumers());}}function _e(e,t){e&1&&(Ds(0,"p",4),NC(1,"No resources bundled with this skill."),pl());}function ge(e,t){if(e&1){let n=Zw();Ds(0,"li")(1,"ds-disclosure",16),mg("toggled",function(){let r=df(n).$implicit,g=Jw(3);return ff(g.toggleResource(r))}),Ds(2,"pre",17),NC(3),pl()()();}if(e&2){let n=t.$implicit,o=Jw(3);BE(),ug("heading",n)("open",o.isResourceExpanded(n)),BE(2),Og(o.resourceContent(n));}}function Ce(e,t){if(e&1&&(Ds(0,"ul",12),Hw(1,ge,4,3,"li",null,Vw),pl()),e&2){let n=Jw(2);BE(),Uw(n.resourcePaths());}}function fe(e,t){if(e&1){let n=Zw();Ds(0,"ds-card",5)(1,"dl",6)(2,"dt"),NC(3,"Name"),pl(),Ds(4,"dd",7),NC(5),pl(),Ds(6,"dt"),NC(7,"Description"),pl(),Ds(8,"dd"),NC(9),pl(),Ds(10,"dt"),NC(11,"Scope"),pl(),Ds(12,"dd"),NC(13),pl(),Ds(14,"dt"),NC(15,"Storage"),pl(),Ds(16,"dd")(17,"ds-tag",8),NC(18),pl()(),Lw(19,ae,2,2),pl()(),Ds(20,"ds-card",9),Lw(21,le,2,0,"p",4)(22,se,2,0,"p",4)(23,re,2,0,"ds-notice")(24,de,2,0,"p",4)(25,ue,8,0),pl(),Ds(26,"ds-card")(27,"ds-disclosure",10),mg("toggled",function(){df(n);let r=Jw();return ff(r.toggleBody())}),lg(28,"div",11),zC(29,"agentosMarkdown"),pl()(),Ds(30,"ds-card",9),Lw(31,_e,2,0,"p",4)(32,Ce,3,0,"ul",12),pl();}if(e&2){let n=t,o=Jw();BE(5),Og(n.name),BE(4),Og(n.description),BE(4),Og(n.namespaceId?"Namespace":"Platform"),BE(4),ug("variant",o.isFilesystemBacked()?"outline":"neutral"),BE(),vl(" ",o.isFilesystemBacked()?"SKILL.md file (read-only)":"Database"," "),BE(),jw(o.isFilesystemBacked()?-1:19),BE(),ug("heading","Used by"+(!o.isPlatformMode&&!o.consumersLoading()&&!o.consumersUnavailable()?" ("+o.consumers().length+")":"")),BE(),jw(o.isPlatformMode?21:o.consumersLoading()?22:o.consumersUnavailable()?23:o.consumers().length===0?24:25),BE(6),ug("open",!o.bodyCollapsed()),BE(),ug("innerHTML",WC(29,12,n.body),YD),BE(2),ug("heading","Resources ("+o.resourcePaths().length+")"),BE(),jw(o.resourcePaths().length===0?31:32);}}var X=class e{route=g(W);router=g(F);destroyRef=g(Ie);skillState=g(o);agentState=g(s);namespaceId=this.route.snapshot.params.namespaceId;skillId=this.route.snapshot.params.skillId;isPlatformMode=!this.namespaceId;isLoading=Ui(true);hasError=Ui(false);skill=Ui(null);bodyCollapsed=Ui(false);expandedResources=Ui(new Set);resourcePaths=XC(()=>Object.keys(this.skill()?.resources??{}).sort());isFilesystemBacked=XC(()=>this.skill()?.readOnly===true);consumers=Ui([]);consumersUnavailable=Ui(false);consumersLoading=Ui(false);ngOnInit(){this.skillState.getById(this.skillId).pipe(U(this.destroyRef)).subscribe({next:t=>{this.skill.set(t),this.isLoading.set(false),this.loadConsumers(t.name);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}loadConsumers(t){this.namespaceId&&(this.consumersLoading.set(true),Ty({namespace:this.agentState.listByNamespace(this.namespaceId),platform:this.agentState.listPlatform().pipe(da(()=>Tr([])))}).pipe(U(this.destroyRef)).subscribe({next:({namespace:n,platform:o})=>{let r=[...this.toConsumers(n,t,false),...this.toConsumers(o,t,true)];this.consumers.set([...r.filter(g=>g.grant==="named"),...r.filter(g=>g.grant==="all")]),this.consumersLoading.set(false);},error:()=>{this.consumersUnavailable.set(true),this.consumersLoading.set(false);}}));}toConsumers(t,n,o){return t.map(r=>({config:r,grant:a(r.skillSelectors,n)})).filter(r=>r.grant!=="none").map(({config:r,grant:g})=>({name:r.name,grant:g,platform:o}))}toggleBody(){this.bodyCollapsed.update(t=>!t);}toggleResource(t){this.expandedResources.update(n=>{let o=new Set(n);return o.has(t)?o.delete(t):o.add(t),o});}isResourceExpanded(t){return this.expandedResources().has(t)}resourceContent(t){return this.skill()?.resources?.[t]??""}editRoute(){return this.isPlatformMode?["/agentos","admin","skills",this.skillId,"edit"]:["/agentos",this.namespaceId,"skills",this.skillId,"edit"]}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin","skills"]):this.router.navigate(["/agentos",this.namespaceId,"skills"]);}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=yw({type:e,selectors:[["agentos-skill-inspect"]],decls:9,vars:3,consts:[["title","Skill"],["dsButton","","variant","ghost","type","button","title","Back to skills",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],["headerMeta","","variant","outline"],[1,"ds-hint"],["heading","General"],["dsDefinitionList",""],[1,"ds-mono"],[3,"variant"],[3,"heading"],["heading","Body",3,"toggled","open"],[1,"ds-pre","ds-pre--prose","ds-prose",3,"innerHTML"],[1,"ds-list"],[1,"ds-inline","ds-inline--wrap"],[1,"ds-strong"],["variant","neutral"],["bordered","","mono","",3,"toggled","heading","open"],[1,"ds-pre"]],template:function(n,o){if(n&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return o.back()}),NC(3,"\u2190 Skills"),pl(),Lw(4,Z,2,1,"a",2),Lw(5,ee,2,0,"ds-tag",3),pl(),Lw(6,te,2,0,"p",4)(7,ne,2,0,"ds-notice")(8,fe,33,14),pl()),n&2){let r;BE(4),jw(o.skill()&&!o.isFilesystemBacked()?4:-1),BE(),jw(o.isPlatformMode?5:-1),BE(),jw(o.isLoading()?6:o.hasError()?7:(r=o.skill())?8:-1,r);}},dependencies:[$t,pn,hn,on,mn,at,sn,ko,Oi,On],encapsulation:2})};export{X as SkillInspectComponent};