@whoz-oss/coday-client 0.0.0-workstream-forge.273 → 0.0.0-workstream-messaging.10

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 (91) hide show
  1. package/browser/chunk-0mZ3Y_ZJ.js +1 -0
  2. package/browser/chunk-1XF6Qsuy.js +1 -0
  3. package/browser/chunk-2KFuV5E5.js +671 -0
  4. package/browser/chunk-ATg3fmRI.js +1 -0
  5. package/browser/{chunk-CDUMxrcp.js → chunk-BFAp9jo2.js} +1 -1
  6. package/browser/chunk-BL1cOmqY.js +1 -0
  7. package/browser/chunk-BMbtNfWQ.js +1 -0
  8. package/browser/chunk-BqHLVmOf.js +1 -0
  9. package/browser/{chunk-BB9Gq9LM.js → chunk-BuwHCrKf.js} +1 -1
  10. package/browser/{chunk-BgL5ewFe.js → chunk-BwyYPrKV.js} +1 -1
  11. package/browser/chunk-C0i49sQV.js +1 -0
  12. package/browser/chunk-C4EP50-g.js +1 -0
  13. package/browser/chunk-C4OG4ewl.js +1 -0
  14. package/browser/chunk-C57t194y.js +1 -0
  15. package/browser/chunk-C7nsTLJX.js +1 -0
  16. package/browser/chunk-CCDRNHex.js +1 -0
  17. package/browser/chunk-CIeSnHU_.js +1 -0
  18. package/browser/chunk-CL0y_n4N.js +1 -0
  19. package/browser/chunk-CMZIhnyc.js +1 -0
  20. package/browser/chunk-CVlOQ_eN.js +1 -0
  21. package/browser/chunk-C_6VN9jF.js +1 -0
  22. package/browser/chunk-C_ual2NQ.js +2 -0
  23. package/browser/{chunk-CBVMv4ai.js → chunk-Cdql7t44.js} +1 -1
  24. package/browser/chunk-CqT7zdSp.js +1 -0
  25. package/browser/chunk-D2x7xu27.js +1 -0
  26. package/browser/chunk-D51v34BD.js +1 -0
  27. package/browser/chunk-D7Yaudd7.js +1 -0
  28. package/browser/chunk-D9gwrCSe.js +1 -0
  29. package/browser/chunk-DAoXL__Q.js +2 -0
  30. package/browser/chunk-DKPVmUTX.js +1 -0
  31. package/browser/{chunk-CZFKR68R.js → chunk-DPNOnAOU.js} +1 -1
  32. package/browser/chunk-D_jkAHyb.js +1 -0
  33. package/browser/{chunk-CBWtz2mG.js → chunk-DoiOjutD.js} +1 -1
  34. package/browser/chunk-DpA9bfvt.js +1 -0
  35. package/browser/chunk-DqrAPruo.js +1 -0
  36. package/browser/chunk-Dt3vfYW7.js +1 -0
  37. package/browser/chunk-DvR4terh.js +1 -0
  38. package/browser/{chunk-BnhHFWL5.js → chunk-R1TauUsQ.js} +1 -1
  39. package/browser/chunk-SMenvxTt.js +1 -0
  40. package/browser/chunk-dszE6BqR.js +1 -0
  41. package/browser/chunk-hCtZ2RNp.js +1 -0
  42. package/browser/chunk-ijPuDimC.js +1 -0
  43. package/browser/chunk-nnH-h9C7.js +1 -0
  44. package/browser/chunk-peLkf2eQ.js +1 -0
  45. package/browser/{chunk-Dadlh5JC.js → chunk-rKr5ufU2.js} +1 -1
  46. package/browser/chunk-tNsYxLDx.js +1 -0
  47. package/browser/chunk-wXEAK6xj.js +1 -0
  48. package/browser/chunk-wmoMXtn0.js +1 -0
  49. package/browser/chunk-x7GGjcqr.js +1 -0
  50. package/browser/index.html +1 -1
  51. package/browser/main-EPHSXFSY.js +1254 -0
  52. package/package.json +1 -1
  53. package/browser/chunk-0ZtY80DW.js +0 -1
  54. package/browser/chunk-14mxT3bD.js +0 -1
  55. package/browser/chunk-9n3XkPN1.js +0 -1
  56. package/browser/chunk-B0xq8HoB.js +0 -1
  57. package/browser/chunk-BQof2LNq.js +0 -1
  58. package/browser/chunk-BSRpGLZu.js +0 -1
  59. package/browser/chunk-BTUoHs1a.js +0 -1
  60. package/browser/chunk-BZjbpPBa.js +0 -671
  61. package/browser/chunk-BbjUb8n0.js +0 -1
  62. package/browser/chunk-BkPDwEh1.js +0 -1
  63. package/browser/chunk-BmsFJQ_v.js +0 -2
  64. package/browser/chunk-Bt4hGQrm.js +0 -1
  65. package/browser/chunk-C1EaR3-9.js +0 -1
  66. package/browser/chunk-C9MRS4KJ.js +0 -1
  67. package/browser/chunk-CAqIYs7P.js +0 -1
  68. package/browser/chunk-C_vj5e-Y.js +0 -1
  69. package/browser/chunk-CaSk42fD.js +0 -1
  70. package/browser/chunk-CeqhBlc6.js +0 -1
  71. package/browser/chunk-CfhLsKNC.js +0 -1
  72. package/browser/chunk-Cix3-0K2.js +0 -1
  73. package/browser/chunk-CjVNMPMk.js +0 -2
  74. package/browser/chunk-Cl72Xnim.js +0 -1
  75. package/browser/chunk-CuwUFZ9P.js +0 -1
  76. package/browser/chunk-CyYuvnGm.js +0 -1
  77. package/browser/chunk-D68ToWiu.js +0 -1
  78. package/browser/chunk-DDZiCKt-.js +0 -1
  79. package/browser/chunk-DKbc-fih.js +0 -1
  80. package/browser/chunk-Daidn0iH.js +0 -1
  81. package/browser/chunk-DgEngWkY.js +0 -1
  82. package/browser/chunk-Dnc62mls.js +0 -1
  83. package/browser/chunk-NON463g4.js +0 -1
  84. package/browser/chunk-PGJjZGrF.js +0 -1
  85. package/browser/chunk-VCV19Z6L.js +0 -1
  86. package/browser/chunk-dCxf5p0L.js +0 -1
  87. package/browser/chunk-hha5EuTF.js +0 -1
  88. package/browser/chunk-hmzIFgbE.js +0 -1
  89. package/browser/chunk-q02QECba.js +0 -1
  90. package/browser/chunk-sKMEQoDc.js +0 -1
  91. package/browser/main-G2NDWI4S.js +0 -1253
@@ -0,0 +1 @@
1
+ import {r as k$1,O,i as at,d as yn,V as Vo,A as Ao,k as P,w as P$1}from'./chunk-2KFuV5E5.js';import {g,W as W$1,F,v as we,au as k,at as F$1,a3 as vr,M as Mi,a5 as Ys,ag as Gm,a6 as Zs,ae as Dr,x as U,a as ew,o as os,K as qh,z as zu,b as pC,I as Iw,c as IE,J as Vh,w as ww,L as Lw,l as lg,T as Tw,_ as _w,Y as Yu,R as Rw,P as Pd,n as Ld,h as Bh}from'./main-EPHSXFSY.js';var G=(i,e)=>e.key;function Q(i,e){if(i&1&&(os(0,"p",3),pC(1),zu()),i&2){let t=Lw();IE(),lg(t.deletion.error());}}function W(i,e){i&1&&(os(0,"p",4),pC(1,"Loading AI models\u2026"),zu());}function X(i,e){i&1&&(os(0,"p",5),pC(1,"No AI models configured."),zu());}function Y(i,e){i&1&&(os(0,"p",4),pC(1,"No AI models match the current filter."),zu());}function Z(i,e){i&1&&(os(0,"ds-tag",18),pC(1,"Read-only"),zu());}function ee(i,e){if(i&1){let t=Rw();os(0,"button",24),qh("click",function(){Pd(t);let s=Lw(2).$implicit,m=Lw(2);return Ld(m.edit(s))}),pC(1,"Edit"),zu();}if(i&2){let t=Lw(2).$implicit,n=Lw(2);Bh("aria-label","Edit "+n.title(t));}}function te(i,e){if(i&1){let t=Rw();Iw(0,ee,2,1,"button",22),os(1,"agentos-row-delete-action",23),qh("deleteRequested",function(){Pd(t);let s=Lw().$implicit,m=Lw(2);return Ld(m.deletion.request(s.key))})("deleteConfirmed",function(){Pd(t);let s=Lw().$implicit,m=Lw(2);return Ld(m.confirmDelete(s))})("deleteCancelled",function(){Pd(t);let s=Lw(3);return Ld(s.deletion.cancel())}),zu();}if(i&2){let t=Lw().$implicit,n=Lw(2);ww(n.deletion.confirmingId()!==t.key?0:-1),IE(),Vh("rowKey",t.key)("rowLabel",n.title(t))("state",n.deletion);}}function ie(i,e){i&1&&(os(0,"button",21),pC(1,"Inherited"),zu());}function ne(i,e){if(i&1&&(os(0,"tr",9)(1,"td",12),pC(2),zu(),os(3,"td",13),pC(4),zu(),os(5,"td",14),pC(6),zu(),os(7,"td",15)(8,"div",16)(9,"ds-tag",17),pC(10),zu(),Iw(11,Z,2,0,"ds-tag",18),zu()(),os(12,"td",19)(13,"div",20),Iw(14,te,2,4)(15,ie,2,0,"button",21),zu()()()),i&2){let t=e.$implicit,n=Lw(2);IE(2),lg(n.title(t)),IE(2),lg(t.providerName),IE(2),Yu(" ",t.model.apiModelName," "),IE(3),Vh("variant",t.scope==="platform"?"neutral":"accent"),IE(),lg(t.scope==="platform"?"Platform":"Namespace"),IE(),ww(t.scope==="platform"?11:-1),IE(3),ww(t.scope==="namespace"?14:15);}}function oe(i,e){if(i&1&&(os(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),pC(5,"Name"),zu(),os(6,"th",10),pC(7,"Provider"),zu(),os(8,"th",10),pC(9,"API model name"),zu(),os(10,"th",10),pC(11,"Scope"),zu(),os(12,"th",10)(13,"span",11),pC(14,"Actions"),zu()()()(),os(15,"tbody",8),Tw(16,ne,16,7,"tr",9,G),zu()()()),i&2){let t=Lw();IE(16),_w(t.rowFilter.filteredRows());}}var z=class i{route=g(W$1);router=g(F);destroyRef=g(we);aiModelController=g(k);aiProviderController=g(F$1);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new vr(void 0);isLoading=Mi(true);deletion=k$1();rows=Mi([]);rowFilter=O(this.rows,e=>[e.model.alias,e.model.apiModelName,e.providerName,e.scope].filter(Boolean).join(" "));data$=this.refresh$.pipe(Ys(()=>(this.isLoading.set(true),Gm({namespace:this.aiModelController.listByNamespaceIdAiModel(this.namespaceId),platform:this.aiModelController.listPlatformLevelAiModel().pipe(Zs(()=>Dr([]))),providers:this.aiProviderController.listAiProvider(this.namespaceId)}).pipe(Ys(({namespace:e,platform:t,providers:n})=>{let s=[...new Set([...t,...e].map(m=>m.aiProviderId))];return Gm({namespace:Dr(e),platform:Dr(t),providers:Dr(n),referencedProviders:this.aiProviderController.getByIdsAiProvider({ids:s,withRemoved:false}).pipe(Zs(()=>Dr([])))})})))));constructor(){this.data$.pipe(U(this.destroyRef)).subscribe({next:({namespace:e,platform:t,providers:n,referencedProviders:s})=>{let m=new Map([...s,...n].map(c=>[c.id??"",c.name]));this.rows.set([...t.map((c,g)=>({key:`platform:${c.id??g}`,model:c,providerName:m.get(c.aiProviderId)??c.aiProviderId,scope:"platform"})),...e.map((c,g)=>({key:`namespace:${c.id??g}`,model:c,providerName:m.get(c.aiProviderId)??c.aiProviderId,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-models","new"]);}edit(e){e.scope==="platform"||!e.model.id||this.router.navigate(["/agentos",this.namespaceId,"ai-models",e.model.id,"edit"]);}title(e){return e.model.alias??e.model.apiModelName}confirmDelete(e){e.scope==="platform"||!e.model.id||this.deletion.execute(e.key,{request$:this.aiModelController.deleteAiModel(e.model.id).pipe(U(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${this.title(e)}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=ew({type:i,selectors:[["agentos-namespace-ai-models"]],decls:9,vars:3,consts:[["title","AI models","description","AI models configured for this namespace, including models inherited from the platform."],["label","Filter AI models","placeholder","Filter AI models\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","AI models"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Provider"],["role","cell","data-label","API model name",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(t,n){t&1&&(os(0,"ds-section-header",0)(1,"agentos-table-filter",1),qh("queryChange",function(m){return n.rowFilter.query.set(m)}),zu(),os(2,"button",2),qh("click",function(){return n.openCreateForm()}),pC(3,"New AI model"),zu()(),Iw(4,Q,2,1,"p",3),Iw(5,W,2,0,"p",4)(6,X,2,0,"p",5)(7,Y,2,0,"p",4)(8,oe,18,0,"div",6)),t&2&&(IE(),Vh("query",n.rowFilter.query()),IE(3),ww(n.deletion.error()?4:-1),IE(),ww(n.isLoading()?5:n.rows().length===0?6:n.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{z as NamespaceAiModelsComponent};
@@ -1 +1 @@
1
- import {v}from'./chunk-DDZiCKt-.js';import {I}from'./chunk-hmzIFgbE.js';import {O}from'./chunk-CAqIYs7P.js';import {g,W,t as F,K as we,a8 as _,a9 as F$1,aa as br,$ as $i,ab as le,o as oT,a1 as ga,U,O as Of,ac as by,D as Dw,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,i as Vw,a2 as ha,ad as ne,Q as Qw,q as $w,ae as Lw,S as NI,f as fg,v as tC,z as zw,T as AI,u as Dl,F as Fg,w as pf,x as hf}from'./main-G2NDWI4S.js';import {p as pt,T as Te$1,b as bn,v as vn,d as yn,e as fn,l as pn,h as hn,k as dn,i as at,u as un,n as cn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,o as Mn,Q as Qt,C as Ca,c as fo,g as go,N as Nn,R as Rn,Y as Yt}from'./chunk-BZjbpPBa.js';import'./chunk-Cl72Xnim.js';var be=(i,e)=>e.value;function _e(i,e){i&1&&(Es(0,"p",2),AC(1,"Loading\u2026"),hl());}function xe(i,e){if(i&1&&(Es(0,"label",6),fg(1,"input",22),NI(),AC(2),hl()),i&2){let t=e.$implicit,n=tC(2);VE(),dg("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),AI(),VE(),Dl(" ",t.label," ");}}function Ie(i,e){if(i&1&&(Es(0,"option",10),AC(1),hl()),i&2){let t=e.$implicit;dg("value",t.type),VE(),Fg(t.displayName);}}function Ne(i,e){if(i&1&&(Es(0,"option",10),AC(1),hl()),i&2){let t=e.$implicit;dg("value",t.value),VE(),Fg(t.label);}}function Ae(i,e){if(i&1&&(Es(0,"div",18)(1,"label",6),fg(2,"input",23),NI(),AC(3," Grant automatically "),hl(),Es(4,"p",2),AC(5),hl()()),i&2){let t=tC(2);VE(2),dg("formControl",t.autoGrantControl),AI(),VE(3),Dl(" Give this integration to ",t.autoGrantReach(),", without each agent having to declare it. An agent can still opt out by mapping this configuration to an empty tool list. ");}}function Ee(i,e){if(i&1){let t=Qw();Es(0,"ds-card")(1,"ds-json-schema-form",24),vg("valueChange",function(a){pf(t);let p=tC(2);return hf(p.onParamsChange(a))}),hl()();}if(i&2){let t=tC(2);VE(),dg("schema",e)("value",t.initialParams());}}function Fe(i,e){if(i&1){let t=Qw();Es(0,"button",25),vg("click",function(){pf(t);let a=tC(2);return hf(a.exportYaml())}),AC(1),hl();}if(i&2){let t=tC(2);dg("disabled",t.isExporting()),VE(),Dl(" ",t.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Te(i,e){if(i&1){let t=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(t);let a=tC();return hf(a.submit())}),Es(1,"ds-fieldset",5),$w(2,xe,3,4,"label",6,Lw().trackByScope,true),hl(),Es(4,"ds-form-field",7)(5,"select",8)(6,"option",9),AC(7,"Select type"),hl(),$w(8,Ie,2,2,"option",10,Lw().trackByType,true),hl(),NI(),hl(),Es(10,"ds-form-field",11),fg(11,"input",12),NI(),hl(),Es(12,"ds-form-field",13),fg(13,"textarea",14),NI(),hl(),Es(14,"ds-form-field",15)(15,"select",16)(16,"option",17),AC(17,"None"),hl(),$w(18,Ne,2,2,"option",10,be),hl(),NI(),hl(),Bw(20,Ae,6,2,"div",18),Bw(21,Ee,2,2,"ds-card"),Es(22,"ds-form-actions")(23,"button",19),AC(24),hl(),Bw(25,Fe,2,2,"button",20),Es(26,"button",21),vg("click",function(){pf(t);let a=tC();return hf(a.cancel())}),AC(27,"Cancel"),hl()()();}if(i&2){let t,n=tC();dg("formGroup",n.form),VE(),dg("disabled",n.isEditMode()),VE(),zw(n.scopeOptions),VE(3),dg("formControl",n.typeControl),AI(),VE(3),zw(n.integrationTypes()),VE(3),dg("formControl",n.nameControl),AI(),VE(2),dg("formControl",n.descriptionControl),AI(),VE(2),dg("formControl",n.authSettingNameControl),AI(),VE(),dg("ngValue",null),VE(2),zw(n.authSettingOptions()),VE(2),Vw(n.isAutoGrantable()?20:-1),VE(),Vw((t=n.schema())?21:-1,t),VE(2),dg("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),VE(),Dl(" ",n.isEditMode()?"Save changes":"Create"," "),VE(),Vw(n.isEditMode()?25:-1);}}var Ve=new Set(["platform","namespace","userOnNs","userGlobal"]),w=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ve=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(O);integrationTypeController=g(_);authSettingState=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?br(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new pt({name:new Te$1("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te$1(null),type:new Te$1("",{nonNullable:true,validators:[bn.required]}),scope:new Te$1("namespace",{nonNullable:true}),autoGrant:new Te$1(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);isExporting=$i(false);scopeOptions=[{value:"platform",label:w.platform},{value:"namespace",label:w.namespace},{value:"userOnNs",label:w.userOnNs},{value:"userGlobal",label:w.userGlobal}];authSettingNameControl=new Te$1(null);loadedAuthSettings=$i([]);authSettingsLoaded=$i(false);savedAuthSettingName=$i(null);authSettingsScope$=new le;authSettingOptions=oT(()=>{let e=this.loadedAuthSettings(),t=this.savedAuthSettingName();return !t||!this.authSettingsLoaded()||e.some(n=>n.value===t)?e:[...e,{value:t,label:`${t} (not found)`}]});paramsValue=$i(null);initialParams=$i(null);integrationTypes=F$1(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=F$1(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});scopeValue=F$1(this.form.controls.scope.valueChanges,{initialValue:this.form.controls.scope.value});schema=oT(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});isAutoGrantable=oT(()=>{let e=this.selectedType();return e?this.integrationTypes().find(t=>t.type===e)?.autoGrantable??false:false});autoGrantReach=oT(()=>{switch(this.scopeValue()){case "platform":return "every agent of this environment";case "namespace":return "every agent of this namespace";default:return "your own runs"}});existingConfig=null;constructor(){this.authSettingsScope$.pipe(ga(e=>this.loadAuthSettingLayers(e)),U(this.destroyRef)).subscribe(e=>{this.loadedAuthSettings.set(this.toAuthSettingOptions(e)),this.authSettingsLoaded.set(true);}),Of(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let e=this.route.snapshot.paramMap,t=this.route.snapshot.queryParamMap,n=e.get("integrationId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable(),this.loadAuthSettingsForScope("platform");return}let a=this.parseScope(t.get("scope"));this.scopeControl.setValue(a),this.loadAuthSettingsForScope(a),this.scopeControl.valueChanges.pipe(U(this.destroyRef)).subscribe(D=>{this.loadAuthSettingsForScope(D);});let p=t.get("template");p&&this.hydrateFromTemplate(p);}parseScope(e){return e&&Ve.has(e)?e:"namespace"}deriveScopeFromConfig(e){return !e.userId&&!e.namespaceId?"platform":e.userId?e.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.existingConfig=t;let n=this.deriveScopeFromConfig(t);this.scopeControl.setValue(n),this.applyConfigToForm(t),this.loadAuthSettingsForScope(n),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[IntegrationForm] Could not load config '${e}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.applyConfigToForm(t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:t=>{console.warn(`[IntegrationForm] Could not hydrate from template ${e}:`,t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(e){this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.typeControl.setValue(e.integrationType),this.initialParams.set(e.parameters),this.paramsValue.set(e.parameters),this.authSettingNameControl.setValue(e.authSettingName??null),this.savedAuthSettingName.set(e.authSettingName??null),this.autoGrantControl.setValue(e.autoGrant??false);}loadAuthSettingsForScope(e){this.authSettingsLoaded.set(false),this.authSettingsScope$.next(e);}loadAuthSettingLayers(e){let t=(p,D)=>D.pipe(ha(()=>br([])),ne(Se=>({label:p,settings:Se}))),n=t("platform",this.authSettingState.loadPlatformSettings()),a=t("mine",this.authSettingState.loadUserSettings("global"));return e==="platform"||e==="userGlobal"?by([a,n]):by([t("mine",this.authSettingState.loadUserSettings(this.namespaceId)),t("namespace",this.authSettingState.loadNamespaceSettings(this.namespaceId)),a,n])}toAuthSettingOptions(e){let t=new Map;for(let{label:n,settings:a}of e)for(let{name:p}of a)p&&t.set(p,(t.get(p)??new Set).add(n));return [...t.entries()].sort(([n],[a])=>n.localeCompare(a)).map(([n,a])=>({value:n,label:`${n} (${[...a].join(", ")})`}))}onParamsChange(e){this.paramsValue.set(e);}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let e=this.descriptionControl.value?.trim(),t={name:this.nameControl.value.trim(),description:e||null,integrationType:this.typeControl.value,parameters:this.paramsValue(),authSettingName:this.authSettingNameControl.value||null,autoGrant:this.isAutoGrantable()&&this.autoGrantControl.value},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,t,n,this.existingConfig):this.state.create(t,n,this.namespaceId??null)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let e=this.existingConfig?.id;!e||this.isExporting()||(this.isExporting.set(true),this.state.exportAsYaml(e).pipe(U(this.destroyRef)).subscribe({next:t=>{let n=new Blob([t],{type:"application/yaml"}),a=URL.createObjectURL(n),p=document.createElement("a");p.href=a,p.download=`${this.existingConfig?.name??"integration"}.yaml`,p.click(),URL.revokeObjectURL(a),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"]);}trackByType(e,t){return t.type}trackByScope(e,t){return t.value}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=Dw({type:i,selectors:[["agentos-integration-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to integrations",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Scope",3,"disabled"],["dsCheck",""],["label","Type","controlId","integration-type","required",""],["dsControl","","id","integration-type",3,"formControl"],["value","","disabled",""],[3,"value"],["label","Name","controlId","integration-name","required",""],["dsControl","","id","integration-name","type","text","placeholder","Integration name","autocomplete","off",3,"formControl"],["label","Description","controlId","integration-description"],["dsControl","","id","integration-description","placeholder","Optional description","rows","3",3,"formControl"],["label","Auth Setting","controlId","integration-auth-setting","hint","Only the name is saved. It is resolved at run time for the user running the case, the most specific layer winning (user on this namespace > namespace > user > platform), so a shared integration can rely on each user's own auth setting of that name."],["dsControl","","id","integration-auth-setting",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-stack--sm"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["type","radio",3,"value","formControl","disabled"],["type","checkbox",3,"formControl"],[3,"valueChange","schema","value"],["dsButton","","type","button",3,"click","disabled"]],template:function(t,n){t&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return n.cancel()}),AC(3," \u2190 Integrations "),hl()(),Bw(4,_e,2,0,"p",2)(5,Te,28,12,"form",3),hl()),t&2&&(VE(),dg("title",n.isEditMode()?"Edit integration":"New integration"),VE(3),Vw(n.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,dn,at,un,cn,Kt,fd,Mo,Do,Ut,Mn,Qt,Ca,fo,go,Nn,Rn,Yt],encapsulation:2})};export{ve as IntegrationFormComponent};
1
+ import {v}from'./chunk-C7nsTLJX.js';import {I}from'./chunk-x7GGjcqr.js';import {O}from'./chunk-CL0y_n4N.js';import {g,W,F,v as we,ac as _,ad as F$1,ae as Dr,M as Mi,af as ue,i as VC,a5 as Ys,x as U,s as sf,ag as Gm,a as ew,o as os,K as qh,b as pC,z as zu,I as Iw,c as IE,J as Vh,w as ww,a6 as Zs,ah as te,R as Rw,T as Tw,ai as Dw,N as lI,H as Hh,L as Lw,_ as _w,Q as fI,Y as Yu,l as lg,P as Pd,n as Ld}from'./main-EPHSXFSY.js';import {p as pt,T as Te$1,b as bn,v as vn,d as yn,e as fn,n as pn,h as hn,l as dn,i as at,u as un,o as cn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,q as Mn,Q as Qt,C as Ca,c as fo,g as go,N as Nn,R as Rn,Y as Yt}from'./chunk-2KFuV5E5.js';import'./chunk-BMbtNfWQ.js';var be=(i,e)=>e.value;function _e(i,e){i&1&&(os(0,"p",2),pC(1,"Loading\u2026"),zu());}function xe(i,e){if(i&1&&(os(0,"label",6),Hh(1,"input",22),lI(),pC(2),zu()),i&2){let t=e.$implicit,n=Lw(2);IE(),Vh("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),fI(),IE(),Yu(" ",t.label," ");}}function Ie(i,e){if(i&1&&(os(0,"option",10),pC(1),zu()),i&2){let t=e.$implicit;Vh("value",t.type),IE(),lg(t.displayName);}}function Ne(i,e){if(i&1&&(os(0,"option",10),pC(1),zu()),i&2){let t=e.$implicit;Vh("value",t.value),IE(),lg(t.label);}}function Ae(i,e){if(i&1&&(os(0,"div",18)(1,"label",6),Hh(2,"input",23),lI(),pC(3," Grant automatically "),zu(),os(4,"p",2),pC(5),zu()()),i&2){let t=Lw(2);IE(2),Vh("formControl",t.autoGrantControl),fI(),IE(3),Yu(" 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=Rw();os(0,"ds-card")(1,"ds-json-schema-form",24),qh("valueChange",function(a){Pd(t);let p=Lw(2);return Ld(p.onParamsChange(a))}),zu()();}if(i&2){let t=Lw(2);IE(),Vh("schema",e)("value",t.initialParams());}}function Fe(i,e){if(i&1){let t=Rw();os(0,"button",25),qh("click",function(){Pd(t);let a=Lw(2);return Ld(a.exportYaml())}),pC(1),zu();}if(i&2){let t=Lw(2);Vh("disabled",t.isExporting()),IE(),Yu(" ",t.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Te(i,e){if(i&1){let t=Rw();os(0,"form",4),qh("ngSubmit",function(){Pd(t);let a=Lw();return Ld(a.submit())}),os(1,"ds-fieldset",5),Tw(2,xe,3,4,"label",6,Dw().trackByScope,true),zu(),os(4,"ds-form-field",7)(5,"select",8)(6,"option",9),pC(7,"Select type"),zu(),Tw(8,Ie,2,2,"option",10,Dw().trackByType,true),zu(),lI(),zu(),os(10,"ds-form-field",11),Hh(11,"input",12),lI(),zu(),os(12,"ds-form-field",13),Hh(13,"textarea",14),lI(),zu(),os(14,"ds-form-field",15)(15,"select",16)(16,"option",17),pC(17,"None"),zu(),Tw(18,Ne,2,2,"option",10,be),zu(),lI(),zu(),Iw(20,Ae,6,2,"div",18),Iw(21,Ee,2,2,"ds-card"),os(22,"ds-form-actions")(23,"button",19),pC(24),zu(),Iw(25,Fe,2,2,"button",20),os(26,"button",21),qh("click",function(){Pd(t);let a=Lw();return Ld(a.cancel())}),pC(27,"Cancel"),zu()()();}if(i&2){let t,n=Lw();Vh("formGroup",n.form),IE(),Vh("disabled",n.isEditMode()),IE(),_w(n.scopeOptions),IE(3),Vh("formControl",n.typeControl),fI(),IE(3),_w(n.integrationTypes()),IE(3),Vh("formControl",n.nameControl),fI(),IE(2),Vh("formControl",n.descriptionControl),fI(),IE(2),Vh("formControl",n.authSettingNameControl),fI(),IE(),Vh("ngValue",null),IE(2),_w(n.authSettingOptions()),IE(2),ww(n.isAutoGrantable()?20:-1),IE(),ww((t=n.schema())?21:-1,t),IE(2),Vh("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),IE(),Yu(" ",n.isEditMode()?"Save changes":"Create"," "),IE(),ww(n.isEditMode()?25:-1);}}var Ve=new Set(["platform","namespace","userOnNs","userGlobal"]),w=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ve=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(O);integrationTypeController=g(_);authSettingState=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?Dr(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new pt({name:new Te$1("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te$1(null),type:new Te$1("",{nonNullable:true,validators:[bn.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=Mi(false);isSubmitting=Mi(false);isLoading=Mi(false);isExporting=Mi(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=Mi([]);authSettingsLoaded=Mi(false);savedAuthSettingName=Mi(null);authSettingsScope$=new ue;authSettingOptions=VC(()=>{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=Mi(null);initialParams=Mi(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=VC(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});isAutoGrantable=VC(()=>{let e=this.selectedType();return e?this.integrationTypes().find(t=>t.type===e)?.autoGrantable??false:false});autoGrantReach=VC(()=>{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(Ys(e=>this.loadAuthSettingLayers(e)),U(this.destroyRef)).subscribe(e=>{this.loadedAuthSettings.set(this.toAuthSettingOptions(e)),this.authSettingsLoaded.set(true);}),sf(()=>{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(Zs(()=>Dr([])),te(Se=>({label:p,settings:Se}))),n=t("platform",this.authSettingState.loadPlatformSettings()),a=t("mine",this.authSettingState.loadUserSettings("global"));return e==="platform"||e==="userGlobal"?Gm([a,n]):Gm([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=ew({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&&(os(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),qh("click",function(){return n.cancel()}),pC(3," \u2190 Integrations "),zu()(),Iw(4,_e,2,0,"p",2)(5,Te,28,12,"form",3),zu()),t&2&&(IE(),Vh("title",n.isEditMode()?"Edit integration":"New integration"),IE(3),ww(n.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,dn,at,un,cn,Kt,fd,Mo,Do,Ut,Mn,Qt,Ca,fo,go,Nn,Rn,Yt],encapsulation:2})};export{ve as IntegrationFormComponent};
@@ -0,0 +1 @@
1
+ import {c}from'./chunk-DPNOnAOU.js';import {r as k,O as O$1,i as at,d as yn,V as Vo,A as Ao,k as P,w as P$1}from'./chunk-2KFuV5E5.js';import {g,W,F,v as we,M as Mi,ag as Gm,a6 as Zs,ae as Dr,x as U,E as x,C as w,am as De,ap as _e,a as ew,o as os,K as qh,z as zu,b as pC,I as Iw,c as IE,J as Vh,w as ww,L as Lw,l as lg,T as Tw,_ as _w,R as Rw,P as Pd,n as Ld,h as Bh}from'./main-EPHSXFSY.js';var J=(n,t)=>t.key;function O(n,t){if(n&1&&(os(0,"p",3),pC(1),zu()),n&2){let e=Lw();IE(),lg(e.deletion.error());}}function Y(n,t){n&1&&(os(0,"p",4),pC(1,"Loading scheduled prompts\u2026"),zu());}function z(n,t){n&1&&(os(0,"p",5),pC(1,"No scheduled prompts available."),zu());}function G(n,t){n&1&&(os(0,"p",4),pC(1,"No scheduled prompts match the current filter."),zu());}function Q(n,t){if(n&1&&(os(0,"span",14),pC(1),zu()),n&2){let e=Lw().$implicit;IE(),lg(e.prompt.description);}}function X(n,t){n&1&&(os(0,"ds-tag",20),pC(1,"Read-only"),zu());}function Z(n,t){if(n&1){let e=Rw();os(0,"button",25),qh("click",function(){Pd(e);let l=Lw(2).$implicit,p=Lw(2);return Ld(p.toggle(l))}),pC(1),zu(),os(2,"button",25),qh("click",function(){Pd(e);let l=Lw(2).$implicit,p=Lw(2);return Ld(p.edit(l))}),pC(3," Edit "),zu();}if(n&2){let e=Lw(2).$implicit;IE(),lg(e.prompt.enabled?"Disable":"Enable"),IE(),Bh("aria-label","Edit "+e.prompt.name);}}function ee(n,t){if(n&1){let e=Rw();Iw(0,Z,4,2),os(1,"agentos-row-delete-action",24),qh("deleteRequested",function(){Pd(e);let l=Lw().$implicit,p=Lw(2);return Ld(p.deletion.request(l.key))})("deleteConfirmed",function(){Pd(e);let l=Lw().$implicit,p=Lw(2);return Ld(p.confirmDelete(l))})("deleteCancelled",function(){Pd(e);let l=Lw(3);return Ld(l.deletion.cancel())}),zu();}if(n&2){let e=Lw().$implicit,i=Lw(2);ww(i.deletion.confirmingId()!==e.key?0:-1),IE(),Vh("rowKey",e.key)("rowLabel",e.prompt.name)("state",i.deletion);}}function te(n,t){n&1&&(os(0,"button",23),pC(1,"Inherited"),zu());}function ne(n,t){if(n&1&&(os(0,"tr",9)(1,"td",12)(2,"span",13),pC(3),zu(),Iw(4,Q,2,1,"span",14),zu(),os(5,"td",15),pC(6),zu(),os(7,"td",16)(8,"ds-tag",17),pC(9),zu()(),os(10,"td",18)(11,"div",19)(12,"ds-tag",17),pC(13),zu(),Iw(14,X,2,0,"ds-tag",20),zu()(),os(15,"td",21)(16,"div",22),Iw(17,ee,2,4)(18,te,2,0,"button",23),zu()()()),n&2){let e=t.$implicit,i=Lw(2);IE(3),lg(e.prompt.name),IE(),ww(e.prompt.description?4:-1),IE(2),lg(i.scheduleLabel(e.prompt)),IE(2),Vh("variant",e.prompt.enabled?"accent":"outline"),IE(),lg(e.prompt.enabled?"Enabled":"Disabled"),IE(3),Vh("variant",e.scope==="platform"?"neutral":"accent"),IE(),lg(e.scope==="platform"?"Platform":"Namespace"),IE(),ww(e.scope==="platform"?14:-1),IE(3),ww(e.scope==="namespace"?17:18);}}function ie(n,t){if(n&1&&(os(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),pC(5,"Name"),zu(),os(6,"th",10),pC(7,"Schedule"),zu(),os(8,"th",10),pC(9,"Status"),zu(),os(10,"th",10),pC(11,"Scope"),zu(),os(12,"th",10)(13,"span",11),pC(14,"Actions"),zu()()()(),os(15,"tbody",8),Tw(16,ne,19,9,"tr",9,J),zu()()()),n&2){let e=Lw();IE(16),_w(e.rowFilter.filteredRows());}}var H=class n{route=g(W);router=g(F);destroyRef=g(we);state=g(c);namespaceId=this.route.snapshot.params.namespaceId;rows=Mi([]);isLoading=Mi(true);deletion=k();rowFilter=O$1(this.rows,t=>[t.prompt.name,t.prompt.description,this.scheduleLabel(t.prompt),t.prompt.enabled?"Enabled":"Disabled",t.scope].filter(Boolean).join(" "));constructor(){Gm({platform:this.state.listPlatform().pipe(Zs(()=>Dr([]))),namespace:this.state.listByNamespace(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({platform:t,namespace:e})=>{this.rows.set([...t.map((i,l)=>({key:`platform:${i.id??l}`,prompt:i,scope:"platform"})),...e.map((i,l)=>({key:`namespace:${i.id??l}`,prompt:i,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts","new"]);}edit(t){t.scope==="platform"||!t.prompt.id||this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts",t.prompt.id,"edit"]);}toggle(t){if(t.scope==="platform")return;(t.prompt.enabled?this.state.disable(t.prompt.id??""):this.state.enable(t.prompt.id??"")).pipe(U(this.destroyRef)).subscribe(i=>this.rows.update(l=>l.map(p=>p.key===t.key?x(w({},p),{prompt:i}):p)));}confirmDelete(t){t.scope==="platform"||!t.prompt.id||this.deletion.execute(t.key,{request$:this.state.delete(t.prompt.id).pipe(U(this.destroyRef)),onSuccess:()=>this.rows.update(e=>e.filter(i=>i.key!==t.key)),errorMessage:`Deleting "${t.prompt.name}" failed. Try again.`});}scheduleLabel(t){let e=t.recurrence,i=e.unit===De.WEEK?"week":"month",l=e.unit===De.WEEK&&e.days?.length?` (${e.days.map(p=>_e[p]??p).join(", ")})`:"";return `Every ${i}${l} at ${e.timeUtc} UTC`}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=ew({type:n,selectors:[["agentos-scheduled-prompt-list"]],decls:9,vars:3,consts:[["title","Scheduled prompts","description","Scheduled prompts for this namespace, including schedules inherited from the platform."],["label","Filter scheduled prompts","placeholder","Filter scheduled prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Scheduled prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Schedule"],["role","cell","data-label","Status"],[3,"variant"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(e,i){e&1&&(os(0,"ds-section-header",0)(1,"agentos-table-filter",1),qh("queryChange",function(p){return i.rowFilter.query.set(p)}),zu(),os(2,"button",2),qh("click",function(){return i.openCreateForm()}),pC(3,"New scheduled prompt"),zu()(),Iw(4,O,2,1,"p",3),Iw(5,Y,2,0,"p",4)(6,z,2,0,"p",5)(7,G,2,0,"p",4)(8,ie,18,0,"div",6)),e&2&&(IE(),Vh("query",i.rowFilter.query()),IE(3),ww(i.deletion.error()?4:-1),IE(),ww(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{H as ScheduledPromptListComponent};
@@ -0,0 +1 @@
1
+ import {a5 as Ys,a6 as Zs,ae as Dr,aK as my}from'./main-EPHSXFSY.js';function i(t,o,p){return t.pipe(Ys(()=>o().pipe(Zs(()=>Dr(p)))),my({bufferSize:1,refCount:true}))}export{i};
@@ -0,0 +1 @@
1
+ import {e}from'./chunk-C6dIhkYp.js';import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-C7nsTLJX.js';import {O}from'./chunk-CL0y_n4N.js';import {g,W as W$1,F,v as we,u as L,M as Mi,x as U$1,ah as te$1,a5 as Ys,ae as Dr,a as ew,o as os,K as qh,z as zu,b as pC,I as Iw,J as Vh,c as IE,w as ww,L as Lw,l as lg,T as Tw,_ as _w,Y as Yu,R as Rw,h as Bh,P as Pd,n as Ld}from'./main-EPHSXFSY.js';import {r as k,O as O$1,i as at,d as yn,V as Vo,A as Ao,k as P,w as P$1}from'./chunk-2KFuV5E5.js';import'./chunk-BMbtNfWQ.js';var Q=(n,e)=>e.key;function W(n,e){if(n&1&&(os(0,"p",3),pC(1),zu()),n&2){let t=Lw();IE(),lg(t.deletion.error());}}function X(n,e){n&1&&(os(0,"p",4),pC(1,"Loading integrations\u2026"),zu());}function Z(n,e){n&1&&(os(0,"p",5),pC(1,"No integrations available."),zu());}function ee(n,e){n&1&&(os(0,"p",4),pC(1,"No integrations match the current filter."),zu());}function te(n,e){n&1&&(os(0,"ds-tag",20),pC(1,"YAML"),zu(),os(2,"ds-tag",21),pC(3,"Read-only"),zu());}function ne(n,e){if(n&1){let t=Rw();os(0,"button",22),qh("click",function(){Pd(t);let s=Lw().$implicit,c=Lw(2);return Ld(c.view(s))}),pC(1,"View"),zu();}if(n&2){let t=Lw().$implicit;Bh("aria-label","View "+t.config.name);}}function ie(n,e){if(n&1){let t=Rw();os(0,"button",22),qh("click",function(){Pd(t);let s=Lw(3).$implicit,c=Lw(2);return Ld(c.edit(s))}),pC(1," Edit "),zu();}if(n&2){let t=Lw(3).$implicit;Bh("aria-label","Edit "+t.config.name);}}function oe(n,e){if(n&1){let t=Rw();os(0,"button",22),qh("click",function(){Pd(t);let s=Lw(2).$implicit,c=Lw(2);return Ld(c.duplicate(s))}),pC(1," Duplicate "),zu(),Iw(2,ie,2,1,"button",19);}if(n&2){let t=Lw(2).$implicit;Bh("aria-label","Duplicate "+t.config.name),IE(2),ww(t.canEdit?2:-1);}}function ae(n,e){if(n&1){let t=Rw();os(0,"agentos-row-delete-action",25),qh("deleteRequested",function(){Pd(t);let s=Lw(2).$implicit,c=Lw(2);return Ld(c.deletion.request(s.key))})("deleteConfirmed",function(){Pd(t);let s=Lw(2).$implicit,c=Lw(2);return Ld(c.confirmDelete(s))})("deleteCancelled",function(){Pd(t);let s=Lw(4);return Ld(s.deletion.cancel())}),zu();}if(n&2){let t=Lw(2).$implicit,a=Lw(2);Vh("rowKey",t.key)("rowLabel",t.config.name)("state",a.deletion);}}function re(n,e){n&1&&(os(0,"button",24),pC(1,"Inherited"),zu());}function le(n,e){if(n&1&&(Iw(0,oe,3,2),Iw(1,ae,1,3,"agentos-row-delete-action",23),Iw(2,re,2,0,"button",24)),n&2){let t=Lw().$implicit,a=Lw(2);ww(a.deletion.confirmingId()!==t.key?0:-1),IE(),ww(t.canDelete?1:-1),IE(),ww(!t.canEdit&&!t.canDelete?2:-1);}}function se(n,e){if(n&1&&(os(0,"tr",9)(1,"td",12),pC(2),zu(),os(3,"td",13),pC(4),zu(),os(5,"td",14)(6,"div",15)(7,"ds-tag",16),pC(8),zu(),Iw(9,te,4,0),zu()(),os(10,"td",17)(11,"div",18),Iw(12,ne,2,1,"button",19)(13,le,3,3),zu()()()),n&2){let t=e.$implicit;IE(2),lg(t.config.name),IE(2),Yu(" ",t.config.integrationType," "),IE(3),Vh("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),IE(),Yu(" ",t.scopeLabel," "),IE(),ww(t.source==="FILESYSTEM"?9:-1),IE(3),ww(t.source==="FILESYSTEM"?12:13);}}function ce(n,e){if(n&1&&(os(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),pC(5,"Name"),zu(),os(6,"th",10),pC(7,"Type"),zu(),os(8,"th",10),pC(9,"Scope"),zu(),os(10,"th",10)(11,"span",11),pC(12,"Actions"),zu()()()(),os(13,"tbody",8),Tw(14,se,14,6,"tr",9,Q),zu()()()),n&2){let t=Lw();IE(14),_w(t.rowFilter.filteredRows());}}var U=class n$1{route=g(W$1);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceApi=g(L);namespaceId=this.route.snapshot.params.namespaceId;namespaceName=Mi("this namespace");isAdmin=Mi(false);isLoading=Mi(true);rows=Mi([]);deletion=k();rowFilter=O$1(this.rows,e=>[e.config.name,e.config.integrationType,e.scopeLabel,e.source].join(" "));ngOnInit(){this.state.setNamespace(this.namespaceId),this.namespaceId&&this.namespaceApi.getByIdNamespace(this.namespaceId).pipe(U$1(this.destroyRef)).subscribe({next:e=>this.namespaceName.set(e.name)}),this.route.paramMap.pipe(te$1(e=>e.get("namespaceId")??""),Ys(e=>e?this.namespaceRole.isAdminOfNamespace$(e):Dr(false)),U$1(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.rows.set(this.toRows(e)),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:n(this.isAdmin())}});}view(e){e.config.id&&this.router.navigate(["/agentos",this.namespaceId,"integrations",e.config.id,"view"]);}edit(e){!e.canEdit||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"integrations",e.config.id,"edit"],{queryParams:{scope:e.scope}});}duplicate(e){if(e.source==="FILESYSTEM"||!e.config.id)return;let a=(e.scope==="platform"||e.scope==="namespace")&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:a,template:e.config.id,templateScope:e.scope}});}confirmDelete(e){!e.canDelete||!e.config.id||this.deletion.execute(e.key,{request$:this.state.delete(e.config.id,e.scope).pipe(U$1(this.destroyRef)),errorMessage:`Deleting "${e.config.name}" failed. Try again.`});}toRows(e){return [...this.mapScope(e.platform,"platform","Platform",true),...this.mapScope(e.namespace,"namespace","Namespace",!this.isAdmin()),...this.mapScope(e.userOnNs,"userOnNs","Personal",false),...this.mapScope(e.userGlobal,"userGlobal","Personal",false)]}mapScope(e$1,t,a,s){return e$1.map((c,z)=>{let h=e(c),w=h==="NEO4J"&&!s;return {key:`${t}:${c.id??z}`,config:c,scope:t,scopeLabel:a,source:h,canEdit:w,canDelete:w}})}static \u0275fac=function(t){return new(t||n$1)};static \u0275cmp=ew({type:n$1,selectors:[["agentos-integrations-all-scopes"]],decls:9,vars:4,consts:[["title","Integrations",3,"description"],["label","Filter integrations","placeholder","Filter integrations\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Integrations"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Type",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["variant","neutral"],["variant","outline"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button","disabled",""],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,a){t&1&&(os(0,"ds-section-header",0)(1,"agentos-table-filter",1),qh("queryChange",function(c){return a.rowFilter.query.set(c)}),zu(),os(2,"button",2),qh("click",function(){return a.openCreateForm()}),pC(3,"New integration"),zu()(),Iw(4,W,2,1,"p",3),Iw(5,X,2,0,"p",4)(6,Z,2,0,"p",5)(7,ee,2,0,"p",4)(8,ce,16,0,"div",6)),t&2&&(Vh("description","Integrations for "+a.namespaceName()+", including entries inherited from the platform."),IE(),Vh("query",a.rowFilter.query()),IE(3),ww(a.deletion.error()?4:-1),IE(),ww(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{U as IntegrationsAllScopesComponent};
@@ -1 +1 @@
1
- import {g,aK as ue,a6 as x}from'./main-G2NDWI4S.js';var o=class r{skillController=g(ue);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,aR as ge,aa as k}from'./main-EPHSXFSY.js';var o=class r{skillController=g(ge);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=k({token:r,factory:r.\u0275fac,providedIn:"root"})};export{o};
@@ -1 +1 @@
1
- import {O}from'./chunk-Dnc62mls.js';import {v}from'./chunk-DDZiCKt-.js';import {g,W,t as F,K as we,$ as $i,a9 as F$1,an as $e,O as Of,U,D as Dw,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,i as Vw,Q as Qw,q as $w,ao as Uw,S as NI,f as fg,am as Hw,v as tC,T as AI,z as zw,u as Dl,ae as Lw,F as Fg,w as pf,x as hf}from'./main-G2NDWI4S.js';import {p as pt,W as Wt,T as Te,b as bn,v as vn,d as yn,e as fn,l as pn,h as hn,i as at,u as un,n as cn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,Q as Qt,C as Ca,c as fo,g as go,N as Nn,R as Rn,E as Ea,x as yo,z as bo}from'./chunk-BZjbpPBa.js';import'./chunk-Cl72Xnim.js';function ge(o,t){o&1&&(Es(0,"p",2),AC(1,"Loading\u2026"),hl());}function be(o,t){if(o&1&&(Es(0,"label",23),fg(1,"input",24),NI(),AC(2),hl()),o&2){let e=t.$implicit,r=tC(3);VE(),dg("formControl",r.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!r.isAdmin()),AI(),VE(),Dl(" ",e.label," ");}}function _e(o,t){if(o&1&&(Es(0,"ds-fieldset",5),$w(1,be,3,4,"label",23,Lw().trackByScope,true),hl()),o&2){let e=tC(2);dg("disabled",e.isEditMode()),VE(),zw(e.scopeOptions);}}function Ae(o,t){if(o&1&&(Es(0,"option",8),AC(1),hl()),o&2){let e=t.$implicit;dg("value",e),VE(),Fg(e);}}function Se(o,t){if(o&1){let e=Qw();Es(0,"div",19),fg(1,"input",25),NI(),fg(2,"input",26),NI(),Es(3,"button",27),vg("click",function(){let l=pf(e).$index,f=tC(2);return hf(f.removeHeader(l))}),AC(4," \xD7 "),hl()();}if(o&2){let e=t.$index;dg("formGroupName",e),VE(),AI(),VE(),AI();}}function Pe(o,t){if(o&1){let e=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let l=tC();return hf(l.submit())}),Bw(1,_e,3,1,"ds-fieldset",5),Es(2,"ds-form-field",6)(3,"select",7),$w(4,Ae,2,2,"option",8,Uw),hl(),NI(),hl(),Es(6,"ds-form-field",9),fg(7,"input",10),NI(),hl(),Es(8,"ds-form-field",11),fg(9,"input",12),NI(),hl(),Es(10,"ds-form-field",13),fg(11,"input",14),NI(),hl(),Es(12,"ds-form-field",15),fg(13,"input",16),NI(),hl(),Es(14,"ds-form-field",17)(15,"div",18),$w(16,Se,5,1,"div",19,Hw),Es(18,"div")(19,"button",20),vg("click",function(){pf(e);let l=tC();return hf(l.addHeader())}),AC(20,"+ Add header"),hl()()()(),Es(21,"ds-form-actions")(22,"button",21),AC(23),hl(),Es(24,"button",22),vg("click",function(){pf(e);let l=tC();return hf(l.cancel())}),AC(25,"Cancel"),hl()()();}if(o&2){let e=tC();dg("formGroup",e.form),VE(),Vw(e.isPlatformMode?-1:1),VE(2),dg("formControl",e.apiTypeControl),AI(),VE(),zw(e.apiTypeOptions),VE(3),dg("formControl",e.nameControl),AI(),VE(2),dg("formControl",e.descriptionControl),AI(),VE(2),dg("formControl",e.baseUrlControl),AI(),VE(2),dg("formControl",e.apiKeyControl),AI(),VE(2),dg("formArrayName","headers"),VE(),zw(e.headersArray.controls),VE(6),dg("disabled",e.form.invalid||e.isSubmitting()),VE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var xe=new Set(["namespace","userOnNs","userGlobal"]),E=Object.freeze({platform:"Configuration de niveau plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ye=class o{route=g(W);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?$i(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});apiTypeOptions=Object.values($e);scopeOptions=[{value:"namespace",label:E.namespace},{value:"userOnNs",label:E.userOnNs},{value:"userGlobal",label:E.userGlobal}];form=new pt({name:new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te(null),apiType:new Te("OpenAI",{nonNullable:true,validators:[bn.required]}),baseUrl:new Te("",{nonNullable:true}),apiKey:new Te("",{nonNullable:true}),scope:new Te("namespace",{nonNullable:true}),headers:new Wt([],{validators:[]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get apiTypeControl(){return this.form.controls.apiType}get baseUrlControl(){return this.form.controls.baseUrl}get apiKeyControl(){return this.form.controls.apiKey}get scopeControl(){return this.form.controls.scope}get headersArray(){return this.form.controls.headers}addHeader(){this.headersArray.push(new pt({key:new Te("",{nonNullable:true,validators:[bn.required]}),value:new Te("",{nonNullable:true})}));}removeHeader(t){this.headersArray.removeAt(t);}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);existingConfig=null;initialApiKey="";constructor(){this.isPlatformMode||Of(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,r=t.get("aiProviderId"),l=this.isPlatformMode?"namespace":this.parseScope(e.get("scope"));if(r){this.isEditMode.set(true),this.scopeControl.disable(),this.apiTypeControl.disable(),this.loadConfig(r);return}this.scopeControl.setValue(l);let f=e.get("template");f&&this.hydrateFromTemplate(f);}parseScope(t){return t&&xe.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId?"namespace":t.namespaceId?"userOnNs":"userGlobal"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AiProviderForm] Could not load provider '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.apiTypeControl.setValue(e.apiType),this.baseUrlControl.setValue(e.baseUrl??""),this.apiKeyControl.setValue(""),this.initialApiKey="",this.apiKeyControl.markAsTouched(),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AiProviderForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.apiTypeControl.setValue(t.apiType),this.baseUrlControl.setValue(t.baseUrl??"");let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialApiKey=e,this.headersArray.clear();for(let[r,l]of Object.entries(t.headers??{}))this.headersArray.push(new pt({key:new Te(r,{nonNullable:true,validators:[bn.required]}),value:new Te(l,{nonNullable:true})}));}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.descriptionControl.value?.trim(),e=this.baseUrlControl.value.trim(),r=this.apiKeyControl.value,l=this.isEditMode()&&r===this.initialApiKey?null:r,f=this.headersArray.controls.filter(A=>A.controls.key.value.trim()).map(A=>[A.controls.key.value.trim(),A.controls.value.value]),Ce=f.length>0?Object.fromEntries(f):null,V={name:this.nameControl.value.trim(),apiType:this.apiTypeControl.value,description:t||null,baseUrl:e||null,apiKey:l,headers:Ce},w=this.form.getRawValue().scope,he=this.isPlatformMode?null:this.namespaceId??null;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,V,w,this.existingConfig):this.state.create(V,w,he)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-providers"]):this.router.navigate(["/agentos",this.namespaceId,"ai-providers"]);}trackByScope(t,e){return e.value}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=Dw({type:o,selectors:[["agentos-ai-provider-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to AI providers",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Configuration scope",3,"disabled"],["label","API type","controlId","llm-api-type","required",""],["dsControl","","id","llm-api-type",3,"formControl"],[3,"value"],["label","Name","controlId","llm-name","required",""],["dsControl","","id","llm-name","type","text","placeholder","e.g. OpenAI prod","autocomplete","off",3,"formControl"],["label","Description","controlId","llm-description"],["dsControl","","id","llm-description","type","text","placeholder","Optional \u2014 short description of this provider","autocomplete","off",3,"formControl"],["label","Base URL","controlId","llm-base-url"],["dsControl","","id","llm-base-url","type","url","placeholder","Optional \u2014 leave empty for default endpoint","autocomplete","off",3,"formControl"],["label","API key","controlId","llm-api-key"],["dsControl","","id","llm-api-key","type","password","placeholder","sk-\u2026","autocomplete","new-password",3,"formControl"],["label","Custom headers"],[1,"ds-stack","ds-stack--sm",3,"formArrayName"],[1,"ds-inline",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsCheck",""],["type","radio",3,"formControl","value","disabled"],["dsControl","","type","text","placeholder","Header name","formControlName","key","autocomplete","off"],["dsControl","","type","text","placeholder","Value","formControlName","value","autocomplete","off"],["dsButton","","variant","icon-danger","type","button","title","Remove header","aria-label","Remove header",3,"click"]],template:function(e,r){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return r.cancel()}),AC(3," \u2190 AI providers "),hl()(),Bw(4,ge,2,0,"p",2)(5,Pe,26,10,"form",3),hl()),e&2&&(VE(),dg("title",r.isEditMode()?"Edit AI provider":"New AI provider"),VE(3),Vw(r.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,at,un,cn,Kt,fd,Mo,Do,Ut,Qt,Ca,fo,go,Nn,Rn,Ea,yo,bo],encapsulation:2})};export{ye as AiProviderFormComponent};
1
+ import {O}from'./chunk-C0i49sQV.js';import {v}from'./chunk-C7nsTLJX.js';import {g,W,F,v as we,M as Mi,ad as F$1,ar as Ue,s as sf,x as U,a as ew,o as os,K as qh,b as pC,z as zu,I as Iw,c as IE,J as Vh,w as ww,R as Rw,T as Tw,as as bw,N as lI,H as Hh,aq as Cw,L as Lw,Q as fI,_ as _w,Y as Yu,ai as Dw,l as lg,P as Pd,n as Ld}from'./main-EPHSXFSY.js';import {p as pt,W as Wt,T as Te,b as bn,v as vn,d as yn,e as fn,n as pn,h as hn,i as at,u as un,o as cn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,Q as Qt,C as Ca,c as fo,g as go,N as Nn,R as Rn,E as Ea,z as yo,B as bo}from'./chunk-2KFuV5E5.js';import'./chunk-BMbtNfWQ.js';function ge(o,t){o&1&&(os(0,"p",2),pC(1,"Loading\u2026"),zu());}function be(o,t){if(o&1&&(os(0,"label",23),Hh(1,"input",24),lI(),pC(2),zu()),o&2){let e=t.$implicit,r=Lw(3);IE(),Vh("formControl",r.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!r.isAdmin()),fI(),IE(),Yu(" ",e.label," ");}}function _e(o,t){if(o&1&&(os(0,"ds-fieldset",5),Tw(1,be,3,4,"label",23,Dw().trackByScope,true),zu()),o&2){let e=Lw(2);Vh("disabled",e.isEditMode()),IE(),_w(e.scopeOptions);}}function Ae(o,t){if(o&1&&(os(0,"option",8),pC(1),zu()),o&2){let e=t.$implicit;Vh("value",e),IE(),lg(e);}}function Se(o,t){if(o&1){let e=Rw();os(0,"div",19),Hh(1,"input",25),lI(),Hh(2,"input",26),lI(),os(3,"button",27),qh("click",function(){let l=Pd(e).$index,f=Lw(2);return Ld(f.removeHeader(l))}),pC(4," \xD7 "),zu()();}if(o&2){let e=t.$index;Vh("formGroupName",e),IE(),fI(),IE(),fI();}}function Pe(o,t){if(o&1){let e=Rw();os(0,"form",4),qh("ngSubmit",function(){Pd(e);let l=Lw();return Ld(l.submit())}),Iw(1,_e,3,1,"ds-fieldset",5),os(2,"ds-form-field",6)(3,"select",7),Tw(4,Ae,2,2,"option",8,bw),zu(),lI(),zu(),os(6,"ds-form-field",9),Hh(7,"input",10),lI(),zu(),os(8,"ds-form-field",11),Hh(9,"input",12),lI(),zu(),os(10,"ds-form-field",13),Hh(11,"input",14),lI(),zu(),os(12,"ds-form-field",15),Hh(13,"input",16),lI(),zu(),os(14,"ds-form-field",17)(15,"div",18),Tw(16,Se,5,1,"div",19,Cw),os(18,"div")(19,"button",20),qh("click",function(){Pd(e);let l=Lw();return Ld(l.addHeader())}),pC(20,"+ Add header"),zu()()()(),os(21,"ds-form-actions")(22,"button",21),pC(23),zu(),os(24,"button",22),qh("click",function(){Pd(e);let l=Lw();return Ld(l.cancel())}),pC(25,"Cancel"),zu()()();}if(o&2){let e=Lw();Vh("formGroup",e.form),IE(),ww(e.isPlatformMode?-1:1),IE(2),Vh("formControl",e.apiTypeControl),fI(),IE(),_w(e.apiTypeOptions),IE(3),Vh("formControl",e.nameControl),fI(),IE(2),Vh("formControl",e.descriptionControl),fI(),IE(2),Vh("formControl",e.baseUrlControl),fI(),IE(2),Vh("formControl",e.apiKeyControl),fI(),IE(2),Vh("formArrayName","headers"),IE(),_w(e.headersArray.controls),IE(6),Vh("disabled",e.form.invalid||e.isSubmitting()),IE(),Yu(" ",e.isEditMode()?"Save changes":"Create"," ");}}var xe=new Set(["namespace","userOnNs","userGlobal"]),E=Object.freeze({platform:"Configuration de niveau plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ye=class o{route=g(W);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?Mi(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});apiTypeOptions=Object.values(Ue);scopeOptions=[{value:"namespace",label:E.namespace},{value:"userOnNs",label:E.userOnNs},{value:"userGlobal",label:E.userGlobal}];form=new pt({name:new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te(null),apiType:new Te("OpenAI",{nonNullable:true,validators:[bn.required]}),baseUrl:new Te("",{nonNullable:true}),apiKey:new Te("",{nonNullable:true}),scope:new Te("namespace",{nonNullable:true}),headers:new Wt([],{validators:[]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get apiTypeControl(){return this.form.controls.apiType}get baseUrlControl(){return this.form.controls.baseUrl}get apiKeyControl(){return this.form.controls.apiKey}get scopeControl(){return this.form.controls.scope}get headersArray(){return this.form.controls.headers}addHeader(){this.headersArray.push(new pt({key:new Te("",{nonNullable:true,validators:[bn.required]}),value:new Te("",{nonNullable:true})}));}removeHeader(t){this.headersArray.removeAt(t);}isEditMode=Mi(false);isSubmitting=Mi(false);isLoading=Mi(false);existingConfig=null;initialApiKey="";constructor(){this.isPlatformMode||sf(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,r=t.get("aiProviderId"),l=this.isPlatformMode?"namespace":this.parseScope(e.get("scope"));if(r){this.isEditMode.set(true),this.scopeControl.disable(),this.apiTypeControl.disable(),this.loadConfig(r);return}this.scopeControl.setValue(l);let f=e.get("template");f&&this.hydrateFromTemplate(f);}parseScope(t){return t&&xe.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId?"namespace":t.namespaceId?"userOnNs":"userGlobal"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AiProviderForm] Could not load provider '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.apiTypeControl.setValue(e.apiType),this.baseUrlControl.setValue(e.baseUrl??""),this.apiKeyControl.setValue(""),this.initialApiKey="",this.apiKeyControl.markAsTouched(),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AiProviderForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.apiTypeControl.setValue(t.apiType),this.baseUrlControl.setValue(t.baseUrl??"");let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialApiKey=e,this.headersArray.clear();for(let[r,l]of Object.entries(t.headers??{}))this.headersArray.push(new pt({key:new Te(r,{nonNullable:true,validators:[bn.required]}),value:new Te(l,{nonNullable:true})}));}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.descriptionControl.value?.trim(),e=this.baseUrlControl.value.trim(),r=this.apiKeyControl.value,l=this.isEditMode()&&r===this.initialApiKey?null:r,f=this.headersArray.controls.filter(A=>A.controls.key.value.trim()).map(A=>[A.controls.key.value.trim(),A.controls.value.value]),Ce=f.length>0?Object.fromEntries(f):null,V={name:this.nameControl.value.trim(),apiType:this.apiTypeControl.value,description:t||null,baseUrl:e||null,apiKey:l,headers:Ce},w=this.form.getRawValue().scope,he=this.isPlatformMode?null:this.namespaceId??null;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,V,w,this.existingConfig):this.state.create(V,w,he)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-providers"]):this.router.navigate(["/agentos",this.namespaceId,"ai-providers"]);}trackByScope(t,e){return e.value}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=ew({type:o,selectors:[["agentos-ai-provider-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to AI providers",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Configuration scope",3,"disabled"],["label","API type","controlId","llm-api-type","required",""],["dsControl","","id","llm-api-type",3,"formControl"],[3,"value"],["label","Name","controlId","llm-name","required",""],["dsControl","","id","llm-name","type","text","placeholder","e.g. OpenAI prod","autocomplete","off",3,"formControl"],["label","Description","controlId","llm-description"],["dsControl","","id","llm-description","type","text","placeholder","Optional \u2014 short description of this provider","autocomplete","off",3,"formControl"],["label","Base URL","controlId","llm-base-url"],["dsControl","","id","llm-base-url","type","url","placeholder","Optional \u2014 leave empty for default endpoint","autocomplete","off",3,"formControl"],["label","API key","controlId","llm-api-key"],["dsControl","","id","llm-api-key","type","password","placeholder","sk-\u2026","autocomplete","new-password",3,"formControl"],["label","Custom headers"],[1,"ds-stack","ds-stack--sm",3,"formArrayName"],[1,"ds-inline",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsCheck",""],["type","radio",3,"formControl","value","disabled"],["dsControl","","type","text","placeholder","Header name","formControlName","key","autocomplete","off"],["dsControl","","type","text","placeholder","Value","formControlName","value","autocomplete","off"],["dsButton","","variant","icon-danger","type","button","title","Remove header","aria-label","Remove header",3,"click"]],template:function(e,r){e&1&&(os(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),qh("click",function(){return r.cancel()}),pC(3," \u2190 AI providers "),zu()(),Iw(4,ge,2,0,"p",2)(5,Pe,26,10,"form",3),zu()),e&2&&(IE(),Vh("title",r.isEditMode()?"Edit AI provider":"New AI provider"),IE(3),ww(r.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,at,un,cn,Kt,fd,Mo,Do,Ut,Qt,Ca,fo,go,Nn,Rn,Ea,yo,bo],encapsulation:2})};export{ye as AiProviderFormComponent};
@@ -0,0 +1 @@
1
+ import {i}from'./chunk-BMbtNfWQ.js';import {y}from'./chunk-2KFuV5E5.js';import {g as g$1,at as F,a3 as vr,aw as $m,a5 as Ys,a6 as Zs,ae as Dr,ah as te,aK as my,a9 as Hl,C as w,aa as k}from'./main-EPHSXFSY.js';var g="none",N="me",O=class p{nsController=g$1(F);userState=g$1(y);refresh$=new vr(void 0);namespaceId$=new vr(null);vm$=$m([this.namespaceId$,this.refresh$]).pipe(Ys(([e])=>{let r=this.loadPlatformProviders().pipe(Zs(()=>Dr([])));return e?$m([r,this.loadNamespaceProviders(e).pipe(Zs(()=>Dr([]))),this.loadUserProviders(e).pipe(Zs(()=>Dr([]))),this.loadUserProviders("global").pipe(Zs(()=>Dr([])))]).pipe(te(([i,n,s,t])=>({platform:i,namespace:n,userOnNs:s,userGlobal:t}))):$m([r,this.loadNamespaceProviders("").pipe(Zs(()=>Dr([]))),this.loadUserProviders("global").pipe(Zs(()=>Dr([])))]).pipe(te(([i,n,s])=>({platform:i,namespace:n,userOnNs:[],userGlobal:s})))}),my({bufferSize:1,refCount:true}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e);}refresh(){this.refresh$.next();}loadUserProviders(e){let r=e==="global"?g:e;return this.nsController.listAiProvider(r,N)}userGlobal$=i(this.refresh$,()=>this.loadUserProviders("global"),[]);loadPlatformProviders(){return this.nsController.listAiProvider(g)}loadNamespaceProviders(e){return e?this.nsController.listAiProvider(e):Dr([])}getById(e,r){return this.nsController.getByIdAiProvider(e)}create(e,r,i){let s=this.userState.currentUser()?.id;if((r==="userOnNs"||r==="userGlobal")&&!s)throw new Error(`Cannot create ${r} provider before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(r==="namespace"){if(i===void 0||i==="")throw new Error("Cannot create namespace-scoped provider without a namespaceId");let S={name:e.name,apiType:e.apiType,description:e.description,baseUrl:e.baseUrl,apiKey:e.apiKey,headers:e.headers??void 0,namespaceId:i??void 0};return this.nsController.createAiProvider(S).pipe(Hl(()=>this.refresh()))}if(r==="userOnNs"&&!i)throw new Error("Cannot create userOnNs provider without a namespaceId");let t={name:e.name,apiType:e.apiType,description:e.description,baseUrl:e.baseUrl,apiKey:e.apiKey,headers:e.headers??void 0,userId:s,namespaceId:r==="userOnNs"?i:void 0};return this.nsController.createAiProvider(t).pipe(Hl(()=>this.refresh()))}update(e,r,i,n){let s=r.apiKey===null?{}:{apiKey:r.apiKey},t=w({name:r.name,apiType:r.apiType,description:r.description,baseUrl:r.baseUrl,headers:r.headers??void 0,namespaceId:n.namespaceId,userId:n.userId},s);return this.nsController.updateAiProvider(e,t).pipe(Hl(()=>this.refresh()))}delete(e,r){return this.nsController.deleteAiProvider(e).pipe(Hl(()=>this.refresh()))}static \u0275fac=function(r){return new(r||p)};static \u0275prov=k({token:p,factory:p.\u0275fac,providedIn:"root"})};export{O};
@@ -0,0 +1 @@
1
+ import {s}from'./chunk-2KFuV5E5.js';import {g,W,D as Dm,y,a as ew,G as Gu,b as pC,d as Wu,c as IE,l as lg}from'./main-EPHSXFSY.js';var A=class r{route=g(W);http=g(Dm);config=g(y);message="Authentication in progress\u2026";ngOnInit(){let e=this.route.snapshot.queryParamMap.get("code"),t=this.route.snapshot.queryParamMap.get("state"),o=this.route.snapshot.queryParamMap.get("error"),i=this.route.snapshot.queryParamMap.get("error_description");if(o){console.warn("[AgentOS OAuth Callback] OAuth error:",o,i),this.notifyParentAndClose({success:false,error:i||o});return}if(!e){console.error("[AgentOS OAuth Callback] Missing authorization code"),this.message="OAuth callback error: missing authorization code.",this.notifyParentAndClose({success:false,error:"Missing authorization code"});return}this.http.post(`${this.config.basePath}/api/oauth/callback`,{code:e,state:t}).subscribe({next:()=>{console.log("[AgentOS OAuth Callback] Backend callback resolved"),this.notifyParentAndClose({success:true});},error:a=>{console.error("[AgentOS OAuth Callback] Backend callback failed:",a),this.notifyParentAndClose({success:false,error:a?.error?.message||a?.message||"Token exchange failed"});}});}notifyParentAndClose(e){if(this.message=e.success?"Authentication complete. You can close this window.":`Authentication failed: ${e.error??"unknown error"}. You can close this window.`,window.opener)try{window.opener.postMessage(e,window.location.origin);}catch(t){console.error("[AgentOS OAuth Callback] postMessage failed:",t),localStorage.setItem(s,JSON.stringify(e));}else console.warn("[AgentOS OAuth Callback] No window.opener \u2014 localStorage fallback"),localStorage.setItem(s,JSON.stringify(e));setTimeout(()=>window.close(),1e3);}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=ew({type:r,selectors:[["agentos-oauth-callback"]],decls:2,vars:1,consts:[[2,"font-family","sans-serif","padding","2rem","text-align","center"]],template:function(t,o){t&1&&(Gu(0,"p",0),pC(1),Wu()),t&2&&(IE(),lg(o.message));},encapsulation:2,changeDetection:1})};export{A as OAuthCallbackComponent};
@@ -0,0 +1 @@
1
+ import {r as k,O as O$1,i as at,d as yn,V as Vo,k as P,w as P$1}from'./chunk-2KFuV5E5.js';import {g,F,v as we,ak as U$1,a3 as vr,M as Mi,a5 as Ys,x as U$2,a as ew,o as os,K as qh,z as zu,b as pC,I as Iw,c as IE,J as Vh,w as ww,L as Lw,l as lg,T as Tw,_ as _w,Y as Yu,R as Rw,P as Pd,n as Ld,h as Bh}from'./main-EPHSXFSY.js';var B=(n,e)=>e.id??e.name;function j(n,e){if(n&1&&(os(0,"p",3),pC(1),zu()),n&2){let t=Lw();IE(),lg(t.deletion.error());}}function K(n,e){n&1&&(os(0,"p",4),pC(1,"Loading agent configs\u2026"),zu());}function H(n,e){n&1&&(os(0,"p",5),pC(1,"No platform agent configs defined yet."),zu());}function U(n,e){n&1&&(os(0,"p",4),pC(1,"No agent configs match the current filter."),zu());}function z(n,e){if(n&1){let t=Rw();os(0,"button",19),qh("click",function(){Pd(t);let d=Lw().$implicit,c=Lw(2);return Ld(c.inspect(d))}),pC(1," Inspect "),zu(),os(2,"button",19),qh("click",function(){Pd(t);let d=Lw().$implicit,c=Lw(2);return Ld(c.edit(d))}),pC(3,"Edit"),zu();}if(n&2){let t=Lw().$implicit;Bh("aria-label","Inspect "+t.name),IE(2),Bh("aria-label","Edit "+t.name);}}function G(n,e){if(n&1){let t=Rw();os(0,"agentos-row-delete-action",20),qh("deleteRequested",function(){Pd(t);let d=Lw().$implicit,c=Lw(2);return Ld(c.deletion.request(d.id))})("deleteConfirmed",function(){Pd(t);let d=Lw().$implicit,c=Lw(2);return Ld(c.confirmDelete(d))})("deleteCancelled",function(){Pd(t);let d=Lw(3);return Ld(d.deletion.cancel())}),zu();}if(n&2){let t=Lw().$implicit,a=Lw(2);Vh("rowKey",t.id)("rowLabel",t.name)("state",a.deletion);}}function J(n,e){if(n&1&&(os(0,"tr",9)(1,"td",12),pC(2),zu(),os(3,"td",13),pC(4),zu(),os(5,"td",14),pC(6),zu(),os(7,"td",15),pC(8),zu(),os(9,"td",16)(10,"div",17),Iw(11,z,4,2),Iw(12,G,1,3,"agentos-row-delete-action",18),zu()()()),n&2){let t=e.$implicit,a=Lw(2);IE(2),lg(t.name),IE(2),Yu(" ",t.description||"\u2014"," "),IE(2),lg(t.modelName||"\u2014"),IE(2),lg(a.mode(t)),IE(3),ww(a.deletion.confirmingId()!==t.id?11:-1),IE(),ww(t.id?12:-1);}}function O(n,e){if(n&1&&(os(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),pC(5,"Name"),zu(),os(6,"th",10),pC(7,"Description"),zu(),os(8,"th",10),pC(9,"Model"),zu(),os(10,"th",10),pC(11,"Execution mode"),zu(),os(12,"th",10)(13,"span",11),pC(14,"Actions"),zu()()()(),os(15,"tbody",8),Tw(16,J,13,6,"tr",9,B),zu()()()),n&2){let t=Lw();IE(16),_w(t.rowFilter.filteredRows());}}var I=class n{router=g(F);destroyRef=g(we);agentConfigController=g(U$1);refresh$=new vr(void 0);isLoading=Mi(true);deletion=k();configs=Mi([]);rowFilter=O$1(this.configs,e=>[e.name,e.description,e.modelName,this.mode(e)].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(Ys(()=>(this.isLoading.set(true),this.agentConfigController.listPlatformAgentsAgentConfig(true))),U$2(this.destroyRef)).subscribe({next:e=>{this.configs.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}mode(e){return e.executionMode??(e.advancedExecution?"ADVANCED":"SIMPLE")}openCreateForm(){this.router.navigate(["/agentos","admin","agent-configs","new"]);}inspect(e){e.id&&this.router.navigate(["/agentos","admin","agent-configs",e.id,"inspect"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","agent-configs",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.agentConfigController.deleteAgentConfig(e.id).pipe(U$2(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=ew({type:n,selectors:[["agentos-platform-agent-configs"]],decls:9,vars:3,consts:[["title","Platform agents","description","Agent configurations shared across every namespace."],["label","Filter agent configs","placeholder","Filter agent configs\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform agents"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Model"],["role","cell","data-label","Execution mode"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,a){t&1&&(os(0,"ds-section-header",0)(1,"agentos-table-filter",1),qh("queryChange",function(c){return a.rowFilter.query.set(c)}),zu(),os(2,"button",2),qh("click",function(){return a.openCreateForm()}),pC(3,"New agent config"),zu()(),Iw(4,j,2,1,"p",3),Iw(5,K,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,O,18,0,"div",6)),t&2&&(IE(),Vh("query",a.rowFilter.query()),IE(3),ww(a.deletion.error()?4:-1),IE(),ww(a.isLoading()?5:a.configs().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,P,P$1],encapsulation:2})};export{I as PlatformAgentConfigsComponent};
@@ -0,0 +1 @@
1
+ import {g as g$1,aH as ie,aa as k}from'./main-EPHSXFSY.js';var g=class r{botController=g$1(ie);agentBots(t,e){return this.botController.listAgentMessagingBots(t,e)}attach(t,e,s,i,l){return this.botController.attachMessagingBot(t,e,{platform:s,token:i,appToken:l})}manifest(t,e,s){return this.botController.getMessagingBotAppManifest(t,e,s)}requestCreation(t,e,s){return this.botController.requestMessagingBotCreation(t,e,{platform:s})}setEnabled(t,e){return this.botController.updateMessagingBot(t,{enabled:e})}remove(t){return this.botController.deleteMessagingBot(t)}managers(){return this.botController.listMessagingBotManagers()}setManager(t,e){return this.botController.setMessagingBotManager({platform:t,token:e})}removeManager(t){return this.botController.deleteMessagingBotManager(t)}static \u0275fac=function(e){return new(e||r)};static \u0275prov=k({token:r,factory:r.\u0275fac,providedIn:"root"})};export{g};
@@ -0,0 +1 @@
1
+ import {y}from'./chunk-2KFuV5E5.js';import {g,aI as ce,aJ as T,ae as Dr,a5 as Ys,ah as te,a6 as Zs,aK as my,aa as k}from'./main-EPHSXFSY.js';var v=class i{userState=g(y);membership=g(ce);currentUser$=T(this.userState.currentUser);cache=new Map;isAdminOfNamespace$(e){if(!e)return Dr(false);let t=this.cache.get(e);if(t)return t;let s=this.currentUser$.pipe(Ys(a=>a?a.isAdmin?Dr(true):this.membership.getMembersNamespaceMembership(e).pipe(te(d=>d.some(n=>n.id===a.id&&n.role==="ADMIN")),Zs(()=>Dr(false))):Dr(false)),my({bufferSize:1,refCount:false}));return this.cache.set(e,s),s}static \u0275fac=function(t){return new(t||i)};static \u0275prov=k({token:i,factory:i.\u0275fac,providedIn:"root"})};export{v};
@@ -0,0 +1 @@
1
+ import {o as o$1,r,i,l}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-BuwHCrKf.js';import {q}from'./chunk-CIeSnHU_.js';import'./chunk-C57t194y.js';import'./chunk-C7nsTLJX.js';import {O}from'./chunk-CL0y_n4N.js';import {g,W,F as F$1,v as we,ak as U,aA as N,M as Mi,aB as Q,ac as _,i as VC,ad as F$2,aC as $e$1,x as U$1,a6 as Zs,ae as Dr,ag as Gm,ah as te,E as x,C as w,a as ew,ax as $t$1,o as os,K as qh,b as pC,z as zu,I as Iw,c as IE,J as Vh,w as ww,L as Lw,R as Rw,H as Hh,N as lI,Q as fI,h as Bh,Y as Yu,T as Tw,_ as _w,l as lg,P as Pd,n as Ld,$ as dg}from'./main-EPHSXFSY.js';import {I as A,p as pt$1,T as Te,b as bn,J as E,K as Kt,a as fd,M as Mo,D as Do,U as Ut,P as Pn,q as Mn,Q as Qt,c as fo,g as go,t as ta,Z as Zr,N as Nn,R as Rn,v as vn,d as yn,e as fn,n as pn,h as hn,_ as _n,i as at$1,u as un,o as cn,A as Ao}from'./chunk-2KFuV5E5.js';import'./chunk-BMbtNfWQ.js';var F="*";function $e(n){return (n??[]).some(t=>t.trim()===F)}function Ge(n){let t=(n??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==F).map(e=>e.toLowerCase());return new Set(t)}function j(n){return n.includes(F)}function Je(n){let t=n.replace(/[\\.[\]{}()^$|]/g,"\\$&").replace(/\*/g,".*");try{return new RegExp(`^${t}$`,"i")}catch(e){return null}}function Y(n,t){return (t??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==F&&j(e)).some(e=>Je(e)?.test(n)??false)}var Ue="AGENTOS_CONFIG",Ye=new Set(["HTTP_API","MCP_HTTP","MCP_STDIO","BASH","TMUX","GIT"]);function Ke(n){return n.configEnabled&&(n.hasSubAgents||n.integrationTypes.some(t=>Ye.has(t)))}var We=(n,t)=>t.value,qe=(n,t)=>t.config.id,ze=(n,t)=>t.type,He=(n,t)=>t.selector;function Xe(n,t){if(n&1&&(os(0,"a",2),pC(1,"View resolved definition \u2192"),zu()),n&2){let e=Lw();Vh("routerLink",e.inspectRoute());}}function Qe(n,t){n&1&&(os(0,"ds-tag",3),pC(1,"Platform level"),zu());}function Ze(n,t){n&1&&(os(0,"p",4),pC(1,"Loading\u2026"),zu());}function et(n,t){if(n&1&&(Hh(0,"input",16),lI()),n&2){let e=Lw(2);Vh("formControl",e.modelNameControl),fI();}}function tt(n,t){if(n&1&&(os(0,"option",41),pC(1),zu()),n&2){let e=t;Vh("ngValue",e.value),IE(),lg(e.label);}}function nt(n,t){if(n&1&&(os(0,"option",41),pC(1),zu()),n&2){let e=t.$implicit;Vh("ngValue",e.value),IE(),lg(e.label);}}function it(n,t){if(n&1&&(os(0,"optgroup",42),Tw(1,nt,2,2,"option",41,We),zu()),n&2){let e=Lw(3);IE(),_w(e.modelOptions().aliases);}}function ot(n,t){if(n&1&&(os(0,"option",41),pC(1),zu()),n&2){let e=t.$implicit;Vh("ngValue",e.value),IE(),lg(e.label);}}function at(n,t){if(n&1&&(os(0,"optgroup",43),Tw(1,ot,2,2,"option",41,We),zu()),n&2){let e=Lw(3);IE(),_w(e.modelOptions().apiNames);}}function lt(n,t){if(n&1&&(os(0,"select",17)(1,"option",40),pC(2,"Select a model"),zu(),Iw(3,tt,2,2,"option",41),Iw(4,it,3,0,"optgroup",42),Iw(5,at,3,0,"optgroup",43),zu(),lI()),n&2){let e,i=Lw(2);Vh("formControl",i.modelNameControl),fI(),IE(),Vh("ngValue",null),IE(2),ww((e=i.modelOptions().current)?3:-1,e),IE(),ww(i.modelOptions().aliases.length>0?4:-1),IE(),ww(i.modelOptions().apiNames.length>0?5:-1);}}function rt(n,t){if(n&1&&(os(0,"span",44),pC(1),zu()),n&2){let e=Lw().$implicit;IE(),lg(e.config.integrationType);}}function st(n,t){if(n&1&&(Hh(0,"input",45),lI()),n&2){let e=Lw().$implicit;Vh("formControl",e.toolsControl),Bh("aria-label","Tools of "+e.config.name),fI();}}function dt(n,t){if(n&1){let e=Rw();os(0,"div",9)(1,"label",10)(2,"input",22),qh("change",function(){let s=Pd(e).$implicit,m=Lw(3);return Ld(m.toggleIntegration(s))}),zu(),os(3,"span",23),pC(4),zu(),Iw(5,rt,2,1,"span",44),zu(),Iw(6,st,1,2,"input",45),zu();}if(n&2){let e=t.$implicit;IE(2),Vh("checked",e.enabled()),IE(2),lg(e.config.name),IE(),ww(e.config.integrationType?5:-1),IE(),ww(e.enabled()?6:-1);}}function ct(n,t){if(n&1&&(os(0,"p",12),pC(1),zu()),n&2){let e=Lw().$implicit;IE(),Yu(" Restricted to: ",e.restrictedTools.join(", ")," (set outside this form, preserved on save) ");}}function mt(n,t){if(n&1){let e=Rw();os(0,"div",9)(1,"label",23),pC(2),os(3,"span",44),pC(4,"built-in"),zu()(),os(5,"select",47),qh("change",function(s){let m=Pd(e).$implicit,C=Lw(4);return Ld(C.setBuiltInState(m,s.target.value))}),os(6,"option",48),pC(7),zu(),os(8,"option",49),pC(9,"Enabled"),zu(),os(10,"option",50),pC(11,"Disabled"),zu()(),Iw(12,ct,2,1,"p",12),os(13,"p",12),pC(14),zu()();}if(n&2){let e=t.$implicit,i=Lw(4);IE(),Bh("for","built-in-"+e.type),IE(),Yu(" ",e.displayName," "),IE(3),Vh("id","built-in-"+e.type)("value",e.state()),IE(2),lg(i.builtInDefaultLabel(e)),IE(5),ww(e.state()==="on"&&e.restrictedTools?12:-1),IE(2),lg(e.description);}}function gt(n,t){if(n&1&&(os(0,"span",46),pC(1,"Built-in integrations"),zu(),Tw(2,mt,15,7,"div",9,ze)),n&2){let e=Lw(3);IE(2),_w(e.builtInRows());}}function ut(n,t){n&1&&(os(0,"ds-notice",25),pC(1," This agent can read the AgentOS configuration and also has a network integration or sub-agents: what it reads could be sent outside without any confirmation. Prefer a dedicated configuration agent without them. "),zu());}function pt(n,t){if(n&1&&(os(0,"ds-fieldset",20),Tw(1,dt,7,4,"div",9,qe),Iw(3,gt,4,0),Iw(4,ut,2,0,"ds-notice",25),zu()),n&2){let e=Lw(2);IE(),_w(e.integrationRows()),IE(2),ww(e.builtInRows().length>0?3:-1),IE(),ww(e.configAgentExposureWarning()?4:-1);}}function ft(n,t){n&1&&pC(0," A platform config can only list platform skills here: namespace skills are resolved per namespace when the agent runs. ");}function Ct(n,t){n&1&&(os(0,"ds-notice",25),pC(1," Saving with this on replaces the selection below with "),os(2,"code",24),pC(3,"*"),zu(),pC(4,". "),zu());}function _t(n,t){n&1&&(os(0,"ds-notice"),pC(1," The skill catalogue could not be loaded. What this agent already declares is listed below and preserved on save. "),zu());}function bt(n,t){n&1&&(os(0,"p",4),pC(1,"No skill available in this scope yet."),zu());}function ht(n,t){n&1&&(os(0,"span",44),pC(1,"platform"),zu());}function yt(n,t){if(n&1&&(os(0,"span",44),pC(1),zu()),n&2){let e=Lw(4);IE(),Yu(" ",e.skillCatalogueUnavailable()?"not verified":"no matching skill"," ");}}function xt(n,t){if(n&1&&(os(0,"p",12),pC(1),zu()),n&2){let e=Lw().$implicit;IE(),lg(e.description);}}function vt(n,t){if(n&1){let e=Rw();os(0,"div",9)(1,"label",10)(2,"input",51),qh("change",function(){let s=Pd(e).$implicit,m=Lw(3);return Ld(m.toggleSkill(s))}),zu(),os(3,"span",23),pC(4),zu(),Iw(5,ht,2,0,"span",44),Iw(6,yt,2,1,"span",44),zu(),Iw(7,xt,2,1,"p",12),zu();}if(n&2){let e=t.$implicit,i=Lw(3);IE(2),Vh("checked",e.selected())("disabled",i.allSkillsSelected()),IE(2),lg(e.name),IE(),ww(e.platform?5:-1),IE(),ww(e.unresolved?6:-1),IE(),ww(e.description?7:-1);}}function St(n,t){if(n&1&&Tw(0,vt,8,6,"div",9,He),n&2){let e=Lw(2);_w(e.skillRows());}}function At(n,t){if(n&1&&(os(0,"ds-form-field",29),Hh(1,"textarea",52),lI(),os(2,"p",4),pC(3," Default payload for this loop agent. Overridden at launch time if the first message contains a valid "),os(4,"code"),pC(5,"AgentLoopPayload"),zu(),pC(6,". Leave empty if you always provide the payload at launch. "),zu()()),n&2){let e=Lw(2);Vh("error",e.loopConfigControl.invalid&&e.loopConfigControl.touched?"Invalid JSON \u2014 please fix the syntax.":null),IE(),Vh("placeholder",e.loopConfigPlaceholder)("formControl",e.loopConfigControl),fI();}}function wt(n,t){n&1&&pC(0," A platform config can only list platform agents here: a namespace's agents are resolved per namespace when the agent runs. ");}function Et(n,t){if(n&1&&pC(0),n&2){let e=Lw(3);dg(" That deletes ",e.droppedUnresolvedSubAgents()," flagged ",e.droppedUnresolvedSubAgents()===1?"selector":"selectors"," nothing matched, which this form cannot restore. ");}}function Tt(n,t){if(n&1&&(os(0,"ds-notice",25),pC(1," Saving with this on replaces the selection below with "),os(2,"code",24),pC(3,"*"),zu(),pC(4,". "),Iw(5,Et,1,2),zu()),n&2){let e=Lw(2);IE(5),ww(e.droppedUnresolvedSubAgents()>0?5:-1);}}function It(n,t){n&1&&(os(0,"ds-notice"),pC(1," The list of agents could not be loaded. What this agent already declares is listed below and preserved on save. "),zu());}function kt(n,t){n&1&&(os(0,"p",4),pC(1,"No other agent is available in this scope yet."),zu());}function Rt(n,t){n&1&&(os(0,"span",44),pC(1,"pattern"),zu());}function Mt(n,t){n&1&&(os(0,"span",44),pC(1,"via pattern"),zu());}function Ft(n,t){if(n&1&&(os(0,"span",44),pC(1),zu()),n&2){let e=Lw(4);IE(),Yu(" ",e.subAgentCandidatesUnavailable()?"not verified":"no matching agent"," ");}}function Nt(n,t){if(n&1){let e=Rw();os(0,"button",55),qh("click",function(){Pd(e);let s=Lw().$implicit,m=Lw(3);return Ld(m.removeSubAgent(s))}),pC(1," \xD7 "),zu();}if(n&2){let e=Lw().$implicit;Bh("aria-label","Remove "+e.selector);}}function Dt(n,t){if(n&1){let e=Rw();os(0,"div",31)(1,"label",53)(2,"input",51),qh("change",function(){let s=Pd(e).$implicit,m=Lw(3);return Ld(m.toggleSubAgent(s))}),zu(),os(3,"span",23),pC(4),zu(),Iw(5,Rt,2,0,"span",44)(6,Mt,2,0,"span",44)(7,Ft,2,1,"span",44),zu(),Iw(8,Nt,2,1,"button",54),zu();}if(n&2){let e=t.$implicit,i=Lw(3);IE(2),Vh("checked",e.selected())("disabled",i.allSubAgentsSelected()),IE(2),lg(e.name),IE(),ww(e.pattern?5:e.grantedByPattern?6:e.unresolved?7:-1),IE(3),ww(e.unresolved?8:-1);}}function Lt(n,t){if(n&1&&Tw(0,Dt,9,5,"div",31,He),n&2){let e=Lw(2);_w(e.subAgentRows());}}function Vt(n,t){if(n&1){let e=Rw();os(0,"div")(1,"button",56),qh("click",function(){Pd(e);let s=Lw(2);return Ld(s.useDefaultDelegationTimeout())}),pC(2," Use server default "),zu()();}}function Pt(n,t){n&1&&(os(0,"ds-notice"),pC(1),zu()),n&2&&(IE(),lg(t));}function Ot(n,t){if(n&1){let e=Rw();os(0,"button",57),qh("click",function(){Pd(e);let s=Lw(2);return Ld(s.exportYaml())}),pC(1),zu();}if(n&2){let e=Lw(2);Vh("disabled",e.isExporting()),IE(),Yu(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Bt(n,t){if(n&1&&Hh(0,"agentos-agent-messaging",39),n&2){let e=Lw(2);Vh("namespaceId",e.namespaceId)("agentId",e.agentConfigId);}}function $t(n,t){if(n&1){let e=Rw();os(0,"form",5),qh("ngSubmit",function(){Pd(e);let s=Lw();return Ld(s.submit())}),os(1,"ds-fieldset",6)(2,"ds-form-field",7),Hh(3,"input",8),lI(),zu(),os(4,"div",9)(5,"label",10),Hh(6,"input",11),lI(),pC(7," Enabled "),zu(),os(8,"p",12),pC(9,"Disabled agents are excluded from namespace resolution."),zu()(),os(10,"ds-form-field",13),Hh(11,"input",14),lI(),zu(),os(12,"ds-form-field",15),Iw(13,et,1,1,"input",16)(14,lt,6,5,"select",17),zu(),os(15,"ds-form-field",18),Hh(16,"textarea",19),lI(),zu()(),Iw(17,pt,5,2,"ds-fieldset",20),os(18,"ds-fieldset",21)(19,"p",4),pC(20," Instruction bundles this agent can read on demand. Selecting at least one grants it the "),os(21,"code"),pC(22,"readSkill"),zu(),pC(23," and "),os(24,"code"),pC(25,"readSkillResource"),zu(),pC(26," tools; selecting none grants neither. "),Iw(27,ft,1,0),zu(),os(28,"label",10)(29,"input",22),qh("change",function(){Pd(e);let s=Lw();return Ld(s.toggleAllSkills())}),zu(),os(30,"span",23),pC(31,"Every skill in the catalogue ("),os(32,"code",24),pC(33,"*"),zu(),pC(34,")"),zu()(),os(35,"p",12),pC(36," Resolved at run time, so skills added later are granted too, without editing this agent. "),zu(),Iw(37,Ct,5,0,"ds-notice",25),Iw(38,_t,2,0,"ds-notice"),Iw(39,bt,2,0,"p",4)(40,St,2,0),zu(),os(41,"ds-form-field",26)(42,"select",27)(43,"option",28),pC(44,"SIMPLE \u2014 Standard agent (single LLM call)"),zu(),os(45,"option",28),pC(46,"ADVANCED \u2014 Multi-step reasoning loop"),zu(),os(47,"option",28),pC(48,"LOOP \u2014 Bulk loop agent (no LLM, experimental)"),zu()(),lI(),zu(),Iw(49,At,7,3,"ds-form-field",29),os(50,"ds-fieldset",30)(51,"p",4),pC(52," The agents this one may delegate to. Selecting at least one grants it the "),os(53,"code"),pC(54,"DELEGATE__delegate"),zu(),pC(55," tool; selecting none grants it no way to delegate. Entries are matched against agent names, never ids. "),Iw(56,wt,1,0),zu(),os(57,"label",10)(58,"input",22),qh("change",function(){Pd(e);let s=Lw();return Ld(s.toggleAllSubAgents())}),zu(),os(59,"span",23),pC(60,"Every agent it can reach ("),os(61,"code",24),pC(62,"*"),zu(),pC(63,")"),zu()(),os(64,"p",12),pC(65," Resolved at run time, so agents added later can be delegated to as well, without editing this agent. "),zu(),Iw(66,Tt,6,1,"ds-notice",25),Iw(67,It,2,0,"ds-notice"),Iw(68,kt,2,0,"p",4)(69,Lt,2,0),os(70,"p",4),pC(71," Advanced \u2014 add a glob instead of picking a name, for example "),os(72,"code"),pC(73,"*Fixer"),zu(),pC(74," to cover BugFixer and StoryFixer. "),zu(),os(75,"div",31)(76,"input",32),qh("keydown.enter",function(){Pd(e);let s=Lw();return Ld(s.addSubAgent())}),zu(),lI(),os(77,"button",33),qh("click",function(){Pd(e);let s=Lw();return Ld(s.addSubAgent())}),pC(78," + "),zu()(),os(79,"ds-form-field",34),Hh(80,"input",35),lI(),Iw(81,Vt,3,0,"div"),zu()(),Iw(82,Pt,2,1,"ds-notice"),os(83,"ds-form-actions")(84,"button",36),pC(85),zu(),Iw(86,Ot,2,2,"button",37),os(87,"button",38),qh("click",function(){Pd(e);let s=Lw();return Ld(s.cancel())}),pC(88,"Cancel"),zu()()(),Iw(89,Bt,1,2,"agentos-agent-messaging",39);}if(n&2){let e,i=Lw();Vh("formGroup",i.form),IE(3),Vh("formControl",i.nameControl),fI(),IE(3),Vh("formControl",i.enabledControl),fI(),IE(5),Vh("formControl",i.descriptionControl),fI(),IE(2),ww(i.modelAsFreeText()?13:14),IE(3),Vh("formControl",i.instructionsControl),fI(),IE(),ww(i.integrationRows().length>0||i.builtInRows().length>0?17:-1),IE(10),ww(i.isPlatformMode?27:-1),IE(2),Vh("checked",i.allSkillsSelected()),IE(8),ww(i.namedSkillSelectionDropped()?37:-1),IE(),ww(i.skillCatalogueUnavailable()?38:-1),IE(),ww(i.skillRows().length===0?39:40),IE(3),Vh("formControl",i.executionModeControl),fI(),IE(),Vh("value",i.ExecutionMode.SIMPLE),IE(2),Vh("value",i.ExecutionMode.ADVANCED),IE(2),Vh("value",i.ExecutionMode.LOOP),IE(2),ww(i.isLoopMode()?49:-1),IE(7),ww(i.isPlatformMode?56:-1),IE(2),Vh("checked",i.allSubAgentsSelected()),IE(8),ww(i.namedSubAgentSelectionDropped()?66:-1),IE(),ww(i.subAgentCandidatesUnavailable()?67:-1),IE(),ww(i.subAgentRows().length===0?68:69),IE(8),Vh("formControl",i.newSubAgentControl),fI(),IE(),Vh("disabled",!i.newSubAgentControl.value.trim()),IE(2),Vh("hint",i.delegationTimeoutHint())("error",i.delegationTimeoutControl.invalid?"Enter a valid positive whole number of seconds, or leave empty to inherit the server default.":null),IE(),Vh("formControl",i.delegationTimeoutControl),Bh("aria-invalid",i.delegationTimeoutControl.invalid),fI(),IE(),ww(i.delegationTimeoutControl.value!==null?81:-1),IE(),ww((e=i.submitError())?82:-1,e),IE(2),Vh("disabled",i.form.invalid||i.isSubmitting()),IE(),Yu(" ",i.isEditMode()?"Save changes":"Create"," "),IE(),ww(i.isEditMode()?86:-1),IE(3),ww(i.isEditMode()&&i.namespaceId?89:-1);}}var je=class n{route=g(W);router=g(F$1);destroyRef=g(we);agentConfigController=g(U);defaultsController=g(N);defaultDelegationTimeoutSeconds=Mi(null);exportService=g(Q);integrationConfigState=g(O);integrationTypeController=g(_);skillState=g(o);aiModelState=g(A);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.paramMap.get("agentConfigId")??"";isPlatformMode=!this.namespaceId;form=new pt$1({name:new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te(null),modelName:new Te(null,{validators:[bn.required,n.notBlankValidator]}),instructions:new Te(null),executionMode:new Te("SIMPLE",{nonNullable:true}),delegationTimeoutSeconds:new Te(null,{validators:[bn.min(1),bn.max(2147483647),bn.pattern(/^\d+$/)]}),enabled:new Te(false,{nonNullable:true}),loopConfig:new Te(null,{validators:[n.jsonValidator]})});static notBlankValidator(t){let e=t.value;return typeof e=="string"&&e.length>0&&e.trim().length===0?{required:true}:null}static jsonValidator(t){let e=t.value?.trim();if(!e)return null;try{return JSON.parse(e),null}catch(i){return {invalidJson:true}}}get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get modelNameControl(){return this.form.controls.modelName}get instructionsControl(){return this.form.controls.instructions}get executionModeControl(){return this.form.controls.executionMode}get delegationTimeoutControl(){return this.form.controls.delegationTimeoutSeconds}useDefaultDelegationTimeout(){this.delegationTimeoutControl.setValue(null),this.delegationTimeoutControl.markAsDirty();}delegationTimeoutHint=VC(()=>{let t=this.defaultDelegationTimeoutSeconds();return `How long each delegation launched by this agent waits without activity from the sub-agent, including its own delegations. When it runs out, the sub-agent and its active descendants are stopped and can be resumed. Leave empty to use the server default${t!==null?`: ${t} s (${t/60} min)`:""}.`});get enabledControl(){return this.form.controls.enabled}get loopConfigControl(){return this.form.controls.loopConfig}executionModeValue=F$2(this.form.controls.executionMode.valueChanges,{initialValue:this.form.controls.executionMode.value});isLoopMode=VC(()=>this.executionModeValue()==="LOOP");subAgentRows=Mi([]);allSubAgentsSelected=Mi(false);subAgentCandidatesUnavailable=Mi(false);namedSubAgentSelectionDropped=VC(()=>this.allSubAgentsSelected()&&this.subAgentRows().some(t=>t.selected()));droppedUnresolvedSubAgents=VC(()=>this.allSubAgentsSelected()?this.subAgentRows().filter(t=>t.unresolved&&t.selected()).length:0);hasAnySubAgent=VC(()=>this.allSubAgentsSelected()||this.subAgentRows().some(t=>t.selected()));newSubAgentControl=new Te("",{nonNullable:true});isEditMode=Mi(false);isSubmitting=Mi(false);isLoading=Mi(false);isExporting=Mi(false);submitError=Mi(null);ExecutionMode=$e$1;loopConfigPlaceholder=JSON.stringify({search:{tool:"SearchTalents",params:{talentId:["6ac76692a909eaaae0b078d6"],resolveTargets:["MANAGER"],next:null}},act:{agentName:"ProfileCaretaker",promptTemplate:"This talent has not completed their profile. As their manager, I need you to help me review and improve it."}},null,2);builtInRows=Mi([]);inspectRoute(){let t=this.route.snapshot.paramMap.get("agentConfigId")??"";return this.isPlatformMode?["/agentos","admin","agent-configs",t,"inspect"]:["/agentos",this.namespaceId,"agent-configs",t,"inspect"]}configAgentExposureWarning=VC(()=>Ke({configEnabled:this.builtInRows().some(t=>t.type===Ue&&t.state()==="on"),integrationTypes:this.integrationRows().filter(t=>t.enabled()).map(t=>t.config.integrationType),hasSubAgents:this.hasAnySubAgent()}));modelOptions=Mi({aliases:[],apiNames:[],current:null});modelCatalogueLoaded=Mi(false);modelAsFreeText=VC(()=>{let{aliases:t,apiNames:e}=this.modelOptions();return this.modelCatalogueLoaded()&&t.length+e.length===0});applyModelCatalogue(t,e){this.modelOptions.set(E(t,e)),this.modelCatalogueLoaded.set(true);}integrationRows=Mi([]);skillRows=Mi([]);allSkillsSelected=Mi(false);skillCatalogueUnavailable=Mi(false);namedSkillSelectionDropped=VC(()=>this.allSkillsSelected()&&this.skillRows().some(t=>t.selected()));existingConfig=null;ngOnInit(){this.defaultsController.getAgentConfigDefaults().pipe(U$1(this.destroyRef),Zs(()=>Dr(null))).subscribe(e=>this.defaultDelegationTimeoutSeconds.set(e?.delegationTimeoutSeconds??null));let t=this.route.snapshot.paramMap.get("agentConfigId");t?(this.isEditMode.set(true),this.loadConfigAndIntegrations(t)):this.loadIntegrations(void 0);}loadConfigAndIntegrations(t){this.isLoading.set(true),Gm({config:this.agentConfigController.getByIdAgentConfig(t),namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):Dr([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes(),skillCatalogue:this.loadSkillCatalogue(),delegationCandidates:this.loadDelegationCandidates(),models:this.aiModelState.listAvailable(this.namespaceId)}).pipe(U$1(this.destroyRef)).subscribe({next:({config:e,namespaceIntegrations:i,platformIntegrations:s,builtInTypes:m,skillCatalogue:C,delegationCandidates:E,models:I})=>{this.existingConfig=e,this.applyModelCatalogue(I,e.modelName??null),this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.modelNameControl.setValue(e.modelName??null),this.instructionsControl.setValue(e.instructions??null);let f=e.executionMode??(e.advancedExecution?"ADVANCED":"SIMPLE");this.executionModeControl.setValue(f),this.delegationTimeoutControl.setValue(e.delegationTimeoutSeconds??null),this.enabledControl.setValue(e.enabled??true),this.loopConfigControl.setValue(e.loopConfig!=null?JSON.stringify(e.loopConfig,null,2):null);let N=[...s,...i];this.integrationRows.set(this.buildIntegrationRows(N,e.integrations??void 0)),this.builtInRows.set(this.buildBuiltInRows(m,e.integrations??void 0)),this.allSubAgentsSelected.set($e(e.subAgents)),this.subAgentRows.set(this.buildSubAgentRows(E,e.subAgents,e.name)),this.allSkillsSelected.set(o$1(e.skillSelectors)),this.skillRows.set(this.buildSkillRows(C,e.skillSelectors)),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadIntegrations(t){Gm({namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):Dr([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes(),skillCatalogue:this.loadSkillCatalogue(),delegationCandidates:this.loadDelegationCandidates(),models:this.aiModelState.listAvailable(this.namespaceId)}).pipe(U$1(this.destroyRef)).subscribe({next:({namespaceIntegrations:e,platformIntegrations:i,builtInTypes:s,skillCatalogue:m,delegationCandidates:C,models:E})=>{this.applyModelCatalogue(E,null);let I=[...i,...e];this.integrationRows.set(this.buildIntegrationRows(I,t??void 0)),this.builtInRows.set(this.buildBuiltInRows(s,t??void 0)),this.allSubAgentsSelected.set(false),this.subAgentRows.set(this.buildSubAgentRows(C,void 0,null)),this.allSkillsSelected.set(false),this.skillRows.set(this.buildSkillRows(m,void 0));}});}loadSkillCatalogue(){return (this.namespaceId?this.skillState.listEffective(this.namespaceId):this.skillState.listPlatform().pipe(te(e=>e.map(i=>({id:i.id??"",name:i.name,description:i.description,namespaceId:i.namespaceId??null,readOnly:i.readOnly===true}))))).pipe(Zs(e=>(console.error("[agent-config-form] failed to load the skill catalogue",e),this.skillCatalogueUnavailable.set(true),Dr([]))))}buildSkillRows(t,e){let s=(e??[]).map(f=>f.trim()).filter(f=>f.length>0).filter(f=>f!==r),m=i(s),C=new Set(t.map(f=>f.name.toLowerCase())),E=t.map(f=>({selector:f.name,name:f.name,description:f.description,platform:f.namespaceId==null,unresolved:false,selected:Mi(m.has(f.name.toLowerCase()))})),I=new Set;for(let f of s){let N=l(f).toLowerCase();C.has(N)||I.has(N)||(I.add(N),E.push({selector:f,name:f,description:"",platform:false,unresolved:true,selected:Mi(true)}));}return E}toggleSkill(t){t.selected.update(e=>!e);}toggleAllSkills(){this.allSkillsSelected.update(t=>!t);}buildSkillSelectorsPayload(){if(this.allSkillsSelected())return [r];let t=this.skillRows().filter(e=>e.selected()).map(e=>e.selector);return t.length>0?t:void 0}loadDelegationCandidates(){let t=this.agentConfigController.listPlatformAgentsAgentConfig(false).pipe(this.orNoCandidates()),e=this.namespaceId?this.agentConfigController.listByParentAgentConfig(this.namespaceId,false).pipe(this.orNoCandidates()):Dr([]);return Gm({platform:t,namespace:e}).pipe(te(({platform:i,namespace:s})=>[...i,...s]),te(i=>i.map(s=>s.name).filter(s=>s.length>0)),te(i=>n.dedupeByKey(i)))}orNoCandidates(){return Zs(t=>(console.error("[agent-config-form] failed to load the delegation candidates",t),this.subAgentCandidatesUnavailable.set(true),Dr([])))}static dedupeByKey(t){let e=new Set;return t.filter(i=>{let s=i.toLowerCase();return e.has(s)?false:(e.add(s),true)})}buildSubAgentRows(t,e,i){let s=Ge(e),m=i?.toLowerCase()??null,C=t.filter(_=>{let O=_.toLowerCase();return O!==m||s.has(O)}),E=new Set(C.map(_=>_.toLowerCase())),I=C.map(_=>({selector:_,name:_,unresolved:false,pattern:false,grantedByPattern:Y(_,e),selected:Mi(s.has(_.toLowerCase()))})),f=new Set,N=(e??[]).map(_=>_.trim()).filter(_=>_.length>0&&_!==F);for(let _ of N){let O=_.toLowerCase();E.has(O)||f.has(O)||(f.add(O),I.push({selector:_,name:_,unresolved:true,pattern:j(_),grantedByPattern:false,selected:Mi(true)}));}return I}loadBuiltInTypes(){return this.integrationTypeController.listTypesIntegrationType().pipe(te(t=>t.filter(e=>!e.configSchema)),Zs(t=>(console.error("[agent-config-form] failed to load integration types",t),Dr([]))))}buildIntegrationRows(t,e){return t.map(i=>{let s=i.name??"",m=e?.[s],C=e!=null&&s in e,E=Array.isArray(m)?m.join(", "):"";return {config:i,enabled:Mi(C),toolsControl:new Te(E,{nonNullable:true})}})}buildBuiltInRows(t,e){return t.map(i=>{let s=e!=null&&i.type in e,m=e?.[i.type],C=s?Array.isArray(m)&&m.length===0?"off":"on":"default";return {type:i.type,displayName:i.displayName,description:i.description,enabledByDefault:i.enabledByDefault===true,state:Mi(C),restrictedTools:Array.isArray(m)&&m.length>0?m:null}})}toggleIntegration(t){t.enabled.update(e=>!e);}setBuiltInState(t,e){t.state.set(e);}builtInDefaultLabel(t){return t.enabledByDefault?"Platform default (enabled)":"Platform default (disabled)"}addSubAgent(){let t=this.newSubAgentControl.value.trim();if(!t)return;let e=this.subAgentRows().find(i=>i.selector.toLowerCase()===t.toLowerCase());e?e.selected.set(true):t===F?this.allSubAgentsSelected.set(true):this.subAgentRows.update(i=>this.withPatternGrants([...i,{selector:t,name:t,unresolved:true,pattern:j(t),grantedByPattern:false,selected:Mi(true)}])),this.newSubAgentControl.reset("");}removeSubAgent(t){let e=t.selector.toLowerCase();this.subAgentRows.update(i=>this.withPatternGrants(i.filter(s=>s.selector.toLowerCase()!==e)));}toggleSubAgent(t){t.selected.update(e=>!e),t.pattern&&this.subAgentRows.update(e=>this.withPatternGrants(e));}withPatternGrants(t){let e=this.allSubAgentsSelected()?[]:t.filter(i=>i.selected()).map(i=>i.selector);return t.map(i=>i.unresolved?i:x(w({},i),{grantedByPattern:Y(i.name,e)}))}toggleAllSubAgents(){this.allSubAgentsSelected.update(t=>!t),this.subAgentRows.update(t=>this.withPatternGrants(t));}buildSubAgentsPayload(){if(this.allSubAgentsSelected())return [F];let t=this.subAgentRows().filter(e=>e.selected()).map(e=>e.selector);return t.length>0?t:void 0}buildIntegrationsPayload(){let t={};for(let i of this.integrationRows().filter(s=>s.enabled())){let s=i.config.name??"",m=i.toolsControl.value.trim();t[s]=m===""?null:m.split(",").map(C=>C.trim()).filter(C=>C.length>0);}for(let i of this.builtInRows()){let s=i.state();s==="on"?t[i.type]=i.restrictedTools??null:s==="off"&&(t[i.type]=[]);}let e=new Set([...this.integrationRows().map(i=>i.config.name??""),...this.builtInRows().map(i=>i.type)]);for(let[i,s]of Object.entries(this.existingConfig?.integrations??{}))e.has(i)||(t[i]=s);return Object.keys(t).length>0?t:void 0}submit(){if(this.form.invalid||this.isSubmitting())return;this.addSubAgent(),this.submitError.set(null),this.isSubmitting.set(true);let t=x(w({},this.existingConfig??{}),{createdOn:this.existingConfig?.createdOn,updatedOn:this.existingConfig?.updatedOn,namespaceId:this.namespaceId,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,modelName:this.modelNameControl.value?.trim()||void 0,instructions:this.instructionsControl.value?.trim()||void 0,integrations:this.buildIntegrationsPayload(),executionMode:this.executionModeControl.value,advancedExecution:this.executionModeControl.value==="ADVANCED",enabled:this.enabledControl.value,subAgents:this.buildSubAgentsPayload(),skillSelectors:this.buildSkillSelectorsPayload(),delegationTimeoutSeconds:this.delegationTimeoutControl.value,loopConfig:this.buildLoopConfigPayload()});(this.isEditMode()?this.agentConfigController.updateAgentConfig(this.existingConfig.id??"",t):this.agentConfigController.createAgentConfig(t)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:i=>{this.isSubmitting.set(false),this.submitError.set(n.serverMessage(i));}});}static serverMessage(t){let i=t?.error?.message;if(typeof i=="string"&&i.trim().length>0)return i;let s=t?.status;return s===0?"The server could not be reached. The agent was not saved.":typeof s=="number"&&s>=500?`The server failed to save the agent (HTTP ${s}). Nothing was changed.`:"The server refused the save and gave no reason. Check the values and try again."}exportYaml(){let t=this.existingConfig?.id;!t||this.isExporting()||(this.isExporting.set(true),this.exportService.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let i=new Blob([e],{type:"application/yaml"}),s=URL.createObjectURL(i),m=document.createElement("a");m.href=s,m.download=`${this.existingConfig?.name??"agent"}.yaml`,m.click(),URL.revokeObjectURL(s),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}buildLoopConfigPayload(){let t=this.loopConfigControl.value?.trim();if(!t)return this.existingConfig?.loopConfig!=null?null:void 0;try{return JSON.parse(t)}catch(e){return}}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=ew({type:n,selectors:[["agentos-agent-config-form"]],decls:8,vars:4,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to agent configs",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],["headerMeta","","variant","outline"],[1,"ds-hint"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Agent"],["label","Name","controlId","agent-config-name","required",""],["dsControl","","id","agent-config-name","type","text","placeholder","e.g. Support agent","autocomplete","off",3,"formControl"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","Description","controlId","agent-config-description"],["dsControl","","id","agent-config-description","type","text","placeholder","Optional \u2014 short description of this agent","autocomplete","off",3,"formControl"],["label","Model","controlId","agent-config-model-name","required","","hint","Aliases are matched first, then API model names. Resolved when the agent runs."],["dsControl","","id","agent-config-model-name","type","text","placeholder","Model alias or name to use, e.g. BIG","autocomplete","off",3,"formControl"],["dsControl","","id","agent-config-model-name",3,"formControl"],["label","Instructions","controlId","agent-config-instructions"],["dsControl","","id","agent-config-instructions","rows","6","placeholder","Optional \u2014 system instructions for this agent",3,"formControl"],["legend","Integrations","hint","Select which integrations this agent can use. Leave tool names empty to allow all tools from an integration."],["legend","Skills"],["type","checkbox",3,"change","checked"],[1,"ds-strong"],[1,"ds-code"],["tone","warning"],["label","Execution mode","controlId","agent-config-execution-mode","hint",'SIMPLE runs a single LLM pass. ADVANCED uses an intention loop for complex tasks and requires a model that supports advanced execution, otherwise the agent fails to run. LOOP (experimental) starts one case per result of a tool, without an LLM \u2014 run it with "Launch loop" in the agent list menu.'],["dsControl","","id","agent-config-execution-mode",3,"formControl"],[3,"value"],["label","Loop configuration (JSON)","controlId","agent-config-loop-config",3,"error"],["legend","Sub-agents"],[1,"ds-inline"],["dsControl","","type","text","aria-label","New sub-agent pattern","placeholder","e.g. *Fixer","autocomplete","off",3,"keydown.enter","formControl"],["dsButton","","variant","icon","type","button","title","Add pattern","aria-label","Add pattern",3,"click","disabled"],["label","Delegation timeout (seconds)","controlId","delegation-timeout","hintId","delegation-timeout-hint","errorId","delegation-timeout-error",3,"hint","error"],["dsControl","","id","delegation-timeout","type","number","min","1","max","2147483647","step","1","placeholder","Server default","aria-describedby","delegation-timeout-hint delegation-timeout-error",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],[3,"namespaceId","agentId"],["disabled","",3,"ngValue"],[3,"ngValue"],["label","Aliases"],["label","API model names"],[1,"ds-meta"],["dsControl","","type","text","placeholder","Tool names, comma-separated (empty = all tools)","autocomplete","off",1,"ds-indent",3,"formControl"],[1,"ds-micro"],["dsControl","",1,"ds-indent","ds-control--auto",3,"change","id","value"],["value","default"],["value","on"],["value","off"],["type","checkbox",3,"change","checked","disabled"],["dsControl","","mono","","id","agent-config-loop-config","rows","10","spellcheck","false","autocomplete","off",3,"placeholder","formControl"],["dsCheck","",1,"ds-grow"],["dsButton","","variant","icon-danger","type","button","title","Remove"],["dsButton","","variant","icon-danger","type","button","title","Remove",3,"click"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,i){e&1&&(os(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),qh("click",function(){return i.cancel()}),pC(3," \u2190 Agent configs "),zu(),Iw(4,Xe,2,1,"a",2),Iw(5,Qe,2,0,"ds-tag",3),zu(),Iw(6,Ze,2,0,"p",4)(7,$t,90,34),zu()),e&2&&(IE(),Vh("title",i.isEditMode()?"Edit agent config":"New agent config"),IE(3),ww(i.isEditMode()?4:-1),IE(),ww(i.isPlatformMode?5:-1),IE(),ww(i.isLoading()?6:7));},dependencies:[Kt,fd,Mo,Do,Ut,Pn,Mn,Qt,fo,go,ta,Zr,Nn,Rn,$t$1,vn,yn,fn,pn,hn,_n,at$1,un,cn,Ao,q],encapsulation:2})};export{je as AgentConfigFormComponent};
@@ -0,0 +1 @@
1
+ import {g as g$1}from'./chunk-C57t194y.js';import {v}from'./chunk-C7nsTLJX.js';import {L as M,X as a,j as e}from'./chunk-2KFuV5E5.js';import {g,v as we,aD as aB,aE as ze,M as Mi,aF as Qs,x as U,aG as oy,E as x,C as w,a as ew,X as Kb,G as Gu,b as pC,d as Wu,T as Tw,as as bw,I as Iw,c as IE,_ as _w,w as ww,L as Lw,l as lg,Y as Yu,a0 as RC,f as Gh,a1 as FC,R as Rw,Z as Zh,P as Pd,n as Ld,O as Op,q as nC,U as Uh}from'./main-EPHSXFSY.js';function J(i,t){i&1&&(Gu(0,"span",6),pC(1,"created by AgentOS"),Wu());}function H(i,t){if(i&1){let e=Rw();Gu(0,"span",6),pC(1,"Remove the bot and its users' links?"),Wu(),Gu(2,"button",14),Zh("click",function(){Pd(e);let o=Lw(2),d=Lw(2);return Ld(d.remove(o))}),pC(3," Remove "),Wu(),Gu(4,"button",15),Zh("click",function(){Pd(e);let o=Lw(4);return Ld(o.confirmingRemoveId.set(null))}),pC(5,"Cancel"),Wu();}if(i&2){let e=Lw(4);IE(2),Gh("disabled",e.busy());}}function Y(i,t){if(i&1){let e=Rw();Gu(0,"button",15),Zh("click",function(){Pd(e);let o=Lw(2),d=Lw(2);return Ld(d.confirmingRemoveId.set(o.id))}),pC(1," Remove "),Wu();}}function Q(i,t){if(i&1){let e=Rw();Uh(0,"span",11),Gu(1,"button",12),Zh("click",function(){Pd(e);let o=Lw(),d=Lw(2);return Ld(d.toggle(o))}),pC(2),Wu(),Iw(3,H,6,1)(4,Y,2,0,"button",13);}if(i&2){let e=Lw(),n=Lw(2);IE(),Gh("disabled",n.busy()),IE(),Yu(" ",e.enabled?"Turn off":"Turn on"," "),IE(),ww(n.confirmingRemoveId()===e.id?3:4);}}function W(i,t){if(i&1&&(Gu(0,"p",10),pC(1),Wu()),i&2){let e=Lw(2).$implicit,n=Lw();IE(),Yu(" ",n.platformName(e)," refuses this bot's token: it was revoked or replaced. Remove the bot and give the agent a new one. ");}}function X(i,t){i&1&&(Gu(0,"p",10),pC(1," Another program receives this bot's messages, such as another AgentOS instance: give each instance its own bot. "),Wu());}function Z(i,t){if(i&1&&(Gu(0,"p",2),pC(1),Wu()),i&2){let e=Lw(2).$implicit,n=Lw();IE(),Yu("Your ",n.platformName(e)," account is connected to this bot.");}}function ee(i,t){if(i&1){let e=Rw();Gu(0,"span",6),pC(1,"then send it this message:"),Wu(),Gu(2,"code",17),pC(3),Wu(),Gu(4,"button",15),Zh("click",function(){let o=Pd(e),d=Lw(4);return Ld(d.copy(o))}),pC(5,"Copy"),Wu();}i&2&&(IE(3),lg(t));}function te(i,t){i&1&&(Gu(0,"span",6),pC(1,"Press Start, then come back here."),Wu());}function ne(i,t){if(i&1&&(Gu(0,"div",7)(1,"a",16),pC(2),Wu(),Iw(3,ee,6,1)(4,te,2,0,"span",6),Gu(5,"span",6),pC(6),RC(7,"date"),Wu()()),i&2){let e,n=t,o=Lw();IE(),Gh("href",n.url,Op),IE(),Yu(" Open @",o.username," "),IE(),ww((e=n.code)?3:4,e),IE(3),Yu("Valid until ",FC(7,4,n.expiresAt,"shortTime"),".");}}function ie(i,t){if(i&1){let e=Rw();Gu(0,"div",7)(1,"button",12),Zh("click",function(){Pd(e);let o=Lw(),d=Lw(2);return Ld(d.connect(o))}),pC(2," Connect my account "),Wu()();}if(i&2){let e=Lw(3);IE(),Gh("disabled",e.busy());}}function oe(i,t){if(i&1&&(Gu(0,"div",7)(1,"a",8),pC(2),Wu(),Gu(3,"span",9),pC(4),Wu(),Iw(5,J,2,0,"span",6),Iw(6,Q,5,3),Wu(),Iw(7,W,2,1,"p",10)(8,X,2,0,"p",10),Iw(9,Z,2,1,"p",2)(10,ne,8,7,"div",7)(11,ie,3,1,"div",7)),i&2){let e,n=t,o=Lw(2);IE(),Gh("href",n.url,Op),IE(),Yu("@",n.username),IE(),nC("agent-messaging__status--"+o.statusTone(n.status)),IE(),Yu(" ",o.statusLabel(n.status)," "),IE(),ww(n.managed?5:-1),IE(),ww(o.canAdminister()?6:-1),IE(),ww(n.status==="TOKEN_REJECTED"?7:n.status==="CONFLICT"?8:-1),IE(2),ww(n.linked?9:(e=o.connectLinkOf(n))?10:n.enabled?11:-1,e);}}function ae(i,t){if(i&1&&(Gu(0,"div",7)(1,"a",16),pC(2," Open Telegram "),Wu(),Gu(3,"span",6),pC(4),RC(5,"date"),Wu()()),i&2){let e=t;IE(),Gh("href",e.url,Op),IE(3),Yu(" Press Start, then Create, and confirm the bot's name: this page shows the bot as soon as it exists. Valid until ",FC(5,2,e.expiresAt,"shortTime"),". ");}}function re(i,t){if(i&1){let e=Rw();Gu(0,"button",20),Zh("click",function(){Pd(e);let o=Lw(3).$implicit,d=Lw();return Ld(d.createBot(o))}),pC(1),Wu();}if(i&2){let e=Lw(3).$implicit,n=Lw();Gh("disabled",n.busy()),IE(),Yu(" Create a ",n.platformName(e)," bot ");}}function se(i,t){i&1&&(Gu(0,"p",6),pC(1," Creating a bot without copying a token needs the instance's bot manager: a super-admin sets it in Settings, Messaging. "),Wu());}function le(i,t){if(i&1){let e=Rw();Gu(0,"div",7),Iw(1,re,2,2,"button",19),Gu(2,"button",15),Zh("click",function(){Pd(e);let o=Lw(2).$implicit,d=Lw();return Ld(d.openForm(o))}),pC(3),Wu()(),Iw(4,se,2,0,"p",6);}if(i&2){let e=Lw(2).$implicit,n=Lw();IE(),ww(n.canCreate(e)?1:-1),IE(2),Yu(" ",e===n.Platform.SLACK?"Connect a Slack app":"Use an existing bot"," "),IE(),ww(e===n.Platform.TELEGRAM&&!n.canCreate(e)?4:-1);}}function me(i,t){if(i&1){let e=Rw();Gu(0,"a",27),pC(1,"open Slack's apps"),Wu(),pC(2,", choose From a manifest, pick the workspace and paste it. "),Gu(3,"pre",28),pC(4),Wu(),Gu(5,"button",15),Zh("click",function(){let o=Pd(e),d=Lw(5);return Ld(d.copy(o.manifest))}),pC(6),Wu();}if(i&2){let e=t,n=Lw(5);Gh("href",e.createUrl,Op),IE(4),lg(e.manifest),IE(2),Yu(" ",n.copied()?"Copied":"Copy the manifest"," ");}}function de(i,t){if(i&1&&(Gu(0,"ol",22)(1,"li"),pC(2," Create a Slack app from this manifest: "),Iw(3,me,7,3),Wu(),Gu(4,"li"),pC(5,"Install the app in the workspace, then copy its Bot User OAuth Token (OAuth & Permissions)."),Wu(),Gu(6,"li"),pC(7," In Basic Information, App-Level Tokens, generate a token with the connections:write scope, and copy it. "),Wu()()),i&2){let e,n=Lw(4);IE(3),ww((e=n.manifest())?3:-1,e);}}function ge(i,t){if(i&1){let e=Rw();Gu(0,"label",29),pC(1,"App-level token"),Wu(),Gu(2,"input",30),Zh("input",function(o){Pd(e);let d=Lw(4);return Ld(d.appToken.set(o.target.value))}),Wu();}if(i&2){let e=Lw(4);IE(2),Gh("value",e.appToken());}}function ce(i,t){i&1&&pC(0," Create a bot with @BotFather in Telegram (/newbot) and paste its token. ");}function _e(i,t){if(i&1){let e=Rw();Gu(0,"form",21),Zh("submit",function(o){Pd(e);let d=Lw(2).$implicit,M=Lw();return o.preventDefault(),Ld(M.attach(d))}),Iw(1,de,8,1,"ol",22),Gu(2,"div",23)(3,"label",24),pC(4),Wu(),Gu(5,"input",25),Zh("input",function(o){Pd(e);let d=Lw(3);return Ld(d.token.set(o.target.value))}),Wu(),Iw(6,ge,3,1),Gu(7,"button",26),pC(8," Attach "),Wu()(),Gu(9,"p",6),Iw(10,ce,1,0),pC(11," The tokens are stored encrypted and never shown again. "),Wu()();}if(i&2){let e=Lw(2).$implicit,n=Lw();IE(),ww(e===n.Platform.SLACK?1:-1),IE(2),Gh("htmlFor","agent-messaging-token-"+e),IE(),Yu(" ",e===n.Platform.SLACK?"Bot User OAuth Token":"Bot token"," "),IE(),Gh("id","agent-messaging-token-"+e)("placeholder",e===n.Platform.SLACK?"xoxb-\u2026":"123456789:AA\u2026")("value",n.token()),IE(),ww(e===n.Platform.SLACK?6:-1),IE(),Gh("disabled",n.busy()||!n.token().trim()||e===n.Platform.SLACK&&!n.appToken().trim()),IE(3),ww(e===n.Platform.TELEGRAM?10:-1);}}function pe(i,t){if(i&1&&(Iw(0,ae,6,5,"div",7)(1,le,5,3),Iw(2,_e,12,9,"form",18)),i&2){let e,n=Lw().$implicit,o=Lw();ww((e=n===o.Platform.TELEGRAM&&o.creationLink())?0:1,e),IE(2),ww(o.formPlatform()===n?2:-1);}}function ue(i,t){if(i&1&&(Gu(0,"p",6),pC(1),Wu()),i&2){let e=Lw().$implicit,n=Lw();IE(),Yu(" No bot yet. An admin of the namespace can give this agent a ",n.platformName(e)," bot. ");}}function fe(i,t){if(i&1&&(Gu(0,"div",3)(1,"h3",5),pC(2),Wu(),Iw(3,oe,12,9)(4,pe,3,2)(5,ue,2,1,"p",6),Wu()),i&2){let e,n=t.$implicit,o=Lw();IE(2),lg(o.platformName(n)),IE(),ww((e=o.botOf(n))?3:o.canAdminister()?4:5,e);}}function Ce(i,t){i&1&&(Gu(0,"p",4),pC(1),Wu()),i&2&&(IE(),lg(t));}var q=class i{botConfig=g(g$1);messagingState=g(M);namespaceRole=g(v);destroyRef=g(we);namespaceId=aB.required();agentId=aB.required();platforms=a;platformName=e;Platform=ze;bots=Mi([]);canAdminister=Mi(false);creatable=Mi([]);creationLink=Mi(null);connectLinks=Mi({});formPlatform=Mi(null);token=Mi("");appToken=Mi("");manifest=Mi(null);copied=Mi(false);busy=Mi(false);confirmingRemoveId=Mi(null);error=Mi(null);constructor(){Qs(window,"focus").pipe(U()).subscribe(()=>{(this.creationLink()||Object.keys(this.connectLinks()).length>0)&&this.refresh();}),oy(be).pipe(U()).subscribe(()=>{let t=this.creationLink();t&&(Date.parse(t.expiresAt)<Date.now()?this.creationLink.set(null):this.refresh());});}ngOnInit(){this.namespaceRole.isAdminOfNamespace$(this.namespaceId()).pipe(U(this.destroyRef)).subscribe(t=>this.canAdminister.set(t)),this.messagingState.capabilities().pipe(U(this.destroyRef)).subscribe({next:t=>this.creatable.set(t.botCreation),error:t=>console.error("[AgentMessaging] Could not read the messaging capabilities:",t)}),this.refresh();}botOf(t){return this.bots().find(e=>e.platform===t)??null}canCreate(t){return this.creatable().includes(t)}connectLinkOf(t){return this.connectLinks()[t.id]}statusLabel(t){return xe[t]??t}statusTone(t){switch(t){case "RUNNING":return "ok";case "DISABLED":return "off";default:return "warn"}}openForm(t){if(this.formPlatform()===t){this.formPlatform.set(null);return}this.formPlatform.set(t),this.token.set(""),this.appToken.set(""),this.manifest.set(null),this.copied.set(false),t==="SLACK"&&this.run(this.botConfig.manifest(this.namespaceId(),this.agentId(),t),e=>this.manifest.set(e),"Could not get the manifest of the Slack app.");}copy(t){navigator.clipboard?.writeText(t).then(()=>this.copied.set(true),()=>this.copied.set(false));}createBot(t){this.run(this.botConfig.requestCreation(this.namespaceId(),this.agentId(),t),e=>this.creationLink.set(e),"Could not start the creation of the bot.");}attach(t){let e$1=this.token().trim(),n=this.appToken().trim();!e$1||t==="SLACK"&&!n||this.run(this.botConfig.attach(this.namespaceId(),this.agentId(),t,e$1,n||void 0),o=>{this.token.set(""),this.appToken.set(""),this.formPlatform.set(null),this.replace(o);},`${e(t)} refused these tokens, or the bot already serves another agent.`);}toggle(t){this.run(this.botConfig.setEnabled(t.id,!t.enabled),e=>this.replace(e),"Could not change the bot.");}remove(t){this.confirmingRemoveId.set(null),this.run(this.botConfig.remove(t.id),()=>{this.bots.update(e=>e.filter(n=>n.id!==t.id)),this.reloadMessagingState();},"Could not remove the bot.");}connect(t){this.run(this.messagingState.createLink(t.id),e=>this.connectLinks.update(n=>x(w({},n),{[t.id]:e})),"Could not get a link to the bot.");}refresh(){let t=this.creationLink()!==null||Object.keys(this.connectLinks()).length>0;this.botConfig.agentBots(this.namespaceId(),this.agentId()).pipe(U(this.destroyRef)).subscribe({next:e=>{let n=e.some(o=>o.linked&&!this.bots().some(d=>d.id===o.id&&d.linked));this.bots.set(e),t&&n&&this.reloadMessagingState(),e.some(o=>o.platform==="TELEGRAM")&&this.creationLink.set(null),this.connectLinks.update(o=>Object.fromEntries(Object.entries(o).filter(([d])=>!e.some(M=>M.id===d&&M.linked))));},error:e=>console.error("[AgentMessaging] Could not load the bots of the agent:",e)});}reloadMessagingState(){this.messagingState.load().pipe(U(this.destroyRef)).subscribe({error:()=>{}});}replace(t){this.bots.update(e=>[...e.filter(n=>n.platform!==t.platform),t]);}run(t,e,n){this.error.set(null),this.busy.set(true),t.pipe(U(this.destroyRef)).subscribe({next:o=>{this.busy.set(false),e(o);},error:o=>{console.error("[AgentMessaging]",n,o),this.busy.set(false),this.error.set(o?.error?.message??n);}});}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=ew({type:i,selectors:[["agentos-agent-messaging"]],inputs:{namespaceId:[1,"namespaceId"],agentId:[1,"agentId"]},decls:8,vars:1,consts:[[1,"agent-messaging"],[1,"agent-messaging__title"],[1,"agent-messaging__hint"],[1,"agent-messaging__platform"],["role","alert",1,"agent-messaging__error"],[1,"agent-messaging__platform-title"],[1,"agent-messaging__note"],[1,"agent-messaging__row"],["target","_blank","rel","noopener",1,"agent-messaging__bot",3,"href"],[1,"agent-messaging__status"],[1,"agent-messaging__warning"],[1,"agent-messaging__spacer"],["type","button",1,"agent-messaging__btn",3,"click","disabled"],["type","button",1,"agent-messaging__btn"],["type","button",1,"agent-messaging__btn","agent-messaging__btn--danger",3,"click","disabled"],["type","button",1,"agent-messaging__btn",3,"click"],["target","_blank","rel","noopener",1,"agent-messaging__btn","agent-messaging__btn--primary",3,"href"],[1,"agent-messaging__code"],[1,"agent-messaging__form"],["type","button",1,"agent-messaging__btn","agent-messaging__btn--primary",3,"disabled"],["type","button",1,"agent-messaging__btn","agent-messaging__btn--primary",3,"click","disabled"],[1,"agent-messaging__form",3,"submit"],[1,"agent-messaging__steps"],[1,"agent-messaging__fields"],[1,"agent-messaging__label",3,"for"],["type","password","name","token","autocomplete","off",1,"agent-messaging__input",3,"input","id","placeholder","value"],["type","submit",1,"agent-messaging__btn","agent-messaging__btn--primary",3,"disabled"],["target","_blank","rel","noopener",1,"agent-messaging__link",3,"href"],[1,"agent-messaging__manifest"],["for","agent-messaging-app-token",1,"agent-messaging__label"],["id","agent-messaging-app-token","type","password","name","appToken","autocomplete","off","placeholder","xapp-\u2026",1,"agent-messaging__input",3,"input","value"]],template:function(e,n){if(e&1&&(Gu(0,"section",0)(1,"h2",1),pC(2,"Messaging"),Wu(),Gu(3,"p",2),pC(4," Users talk to this agent from a messaging application through its bot: their messages go to their cases in this namespace, the answers come back in the application. "),Wu(),Tw(5,fe,6,2,"div",3,bw),Iw(7,Ce,2,1,"p",4),Wu()),e&2){let o;IE(5),_w(n.platforms),IE(2),ww((o=n.error())?7:-1,o);}},dependencies:[Kb],styles:[".agent-messaging[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem;margin-top:1.5rem}.agent-messaging__title[_ngcontent-%COMP%]{margin:0;font-family:var(--font-heading);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);border-bottom:1px solid var(--color-divider);padding-bottom:.5rem}.agent-messaging__hint[_ngcontent-%COMP%], .agent-messaging__note[_ngcontent-%COMP%]{margin:0;font-size:.8125rem;color:var(--color-text-secondary)}.agent-messaging__warning[_ngcontent-%COMP%]{margin:0;font-size:.8125rem;color:var(--color-warning, #b26a00)}.agent-messaging__error[_ngcontent-%COMP%]{margin:0;font-size:.8125rem;color:var(--color-error, #c62828)}.agent-messaging__row[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.agent-messaging__spacer[_ngcontent-%COMP%]{flex:1}.agent-messaging__bot[_ngcontent-%COMP%]{font-family:var(--font-mono, monospace);font-size:.9375rem;color:var(--color-accent);text-decoration:none}.agent-messaging__bot[_ngcontent-%COMP%]:hover{text-decoration:underline}.agent-messaging__status[_ngcontent-%COMP%]{padding:.1rem .5rem;border:1px solid var(--color-divider);border-radius:var(--radius-sm, 0);font-size:.75rem;font-weight:600}.agent-messaging__status--ok[_ngcontent-%COMP%]{border-color:var(--color-success, #2e7d32);color:var(--color-success, #2e7d32)}.agent-messaging__status--off[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.agent-messaging__status--warn[_ngcontent-%COMP%]{border-color:var(--color-warning, #b26a00);color:var(--color-warning, #b26a00)}.agent-messaging__token[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.agent-messaging__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text-secondary)}.agent-messaging__input[_ngcontent-%COMP%]{flex:1;min-width:16rem;padding:.4rem .6rem;border:1px solid var(--color-divider);border-radius:var(--radius-sm, 0);background:var(--color-bg);color:var(--color-text);font-family:var(--font-mono, monospace);font-size:.875rem}.agent-messaging__btn[_ngcontent-%COMP%]{padding:.4rem .9rem;border:1px solid var(--color-divider);border-radius:var(--radius-sm, 0);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;text-decoration:none;cursor:pointer}.agent-messaging__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.agent-messaging__btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:default}.agent-messaging__btn--primary[_ngcontent-%COMP%]{border-color:var(--color-accent);color:var(--color-accent)}.agent-messaging__btn--danger[_ngcontent-%COMP%]{border-color:var(--color-error, #c62828);color:var(--color-error, #c62828)}.agent-messaging__platform[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem}.agent-messaging__platform-title[_ngcontent-%COMP%]{margin:0;font-size:.875rem;font-weight:600;color:var(--color-text)}.agent-messaging__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem}.agent-messaging__fields[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.agent-messaging__steps[_ngcontent-%COMP%]{margin:0;padding-left:1.25rem;font-size:.875rem;color:var(--color-text);line-height:1.6}.agent-messaging__steps[_ngcontent-%COMP%] li[_ngcontent-%COMP%] + li[_ngcontent-%COMP%]{margin-top:.25rem}.agent-messaging__manifest[_ngcontent-%COMP%]{max-height:14rem;overflow:auto;margin:.5rem 0;padding:.5rem .75rem;border:1px solid var(--color-divider);border-radius:var(--radius-sm, 0);background:var(--color-bg-subtle, var(--color-bg));font-family:var(--font-mono, monospace);font-size:.75rem}.agent-messaging__code[_ngcontent-%COMP%]{padding:.1rem .4rem;border:1px solid var(--color-divider);border-radius:var(--radius-sm, 0);font-family:var(--font-mono, monospace);font-size:.8125rem;word-break:break-all}.agent-messaging__link[_ngcontent-%COMP%]{color:var(--color-accent)}"]})},be=3e3,xe={STARTING:"Starting",RUNNING:"Running",DISABLED:"Off",TOKEN_REJECTED:"Token rejected",CONFLICT:"Used elsewhere",UNREACHABLE:"Unreachable"};export{q};
@@ -0,0 +1 @@
1
+ import {i}from'./chunk-BMbtNfWQ.js';import {y}from'./chunk-2KFuV5E5.js';import {g,aj as G,aP as we,a3 as vr,aw as $m,a5 as Ys,a6 as Zs,ae as Dr,ah as te,aK as my,a9 as Hl,aa as k}from'./main-EPHSXFSY.js';var u=s=>s,N="none",w="me",O=class s{nsController=g(G);exportService=g(we);userState=g(y);refresh$=new vr(void 0);namespaceId$=new vr(null);vm$=$m([this.namespaceId$,this.refresh$]).pipe(Ys(([e])=>{let n=this.loadPlatformConfigs().pipe(Zs(()=>Dr([]))),t=this.loadUserConfigs("global").pipe(Zs(()=>Dr([])));return e?$m([n,this.loadNamespaceConfigs(e).pipe(Zs(()=>Dr([]))),this.loadUserConfigs(e).pipe(Zs(()=>Dr([]))),t]).pipe(te(([i,r,c,g])=>({platform:i,namespace:r,userOnNs:c,userGlobal:g}))):$m([n,t]).pipe(te(([i,r])=>({platform:i,namespace:[],userOnNs:[],userGlobal:r})))}),my({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):Dr([])}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(Hl(()=>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(Hl(()=>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(Hl(()=>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(Hl(()=>this.refresh()))}delete(e,n){return this.nsController.deleteIntegrationConfig(e).pipe(Hl(()=>this.refresh()))}exportAsYaml(e){return this.exportService.exportAsYaml(e)}static \u0275fac=function(n){return new(n||s)};static \u0275prov=k({token:s,factory:s.\u0275fac,providedIn:"root"})};export{O};
@@ -0,0 +1 @@
1
+ import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-C7nsTLJX.js';import {I}from'./chunk-x7GGjcqr.js';import {g,W,F,v as we,M as Mi,x as U,ah as te$1,a5 as Ys,ae as Dr,aS as qo,a6 as Zs,ag as Gm,a as ew,o as os,K as qh,z as zu,b as pC,I as Iw,c as IE,J as Vh,w as ww,L as Lw,l as lg,q as nC,h as Bh,Y as Yu,T as Tw,_ as _w,R as Rw,P as Pd,n as Ld}from'./main-EPHSXFSY.js';import {r as k,O,a8 as w,i as at,d as yn,V as Vo,A as Ao,k as P,w as P$1}from'./chunk-2KFuV5E5.js';import'./chunk-BMbtNfWQ.js';var Q=(i,t)=>t.key;function X(i,t){if(i&1&&(os(0,"p",3),pC(1),zu()),i&2){let e=Lw();IE(),lg(e.deletion.error());}}function Z(i,t){if(i&1&&(os(0,"p"),pC(1),zu()),i&2){let e=t;nC(e.kind==="error"?"settings-table__error":"settings-table__status"),Bh("role",e.kind==="error"?"alert":"status"),IE(),Yu(" ",e.text," ");}}function ee(i,t){i&1&&(os(0,"p",5),pC(1,"Loading auth settings\u2026"),zu());}function te(i,t){i&1&&(os(0,"p",6),pC(1,"No auth settings available."),zu());}function ne(i,t){i&1&&(os(0,"p",5),pC(1,"No auth settings match the current filter."),zu());}function ie(i,t){i&1&&(os(0,"ds-tag",18),pC(1,"Read-only"),zu());}function oe(i,t){i&1&&(os(0,"ds-tag",20),pC(1,"Connected"),zu());}function ae(i,t){i&1&&(os(0,"ds-tag",18),pC(1,"Not connected"),zu());}function se(i,t){i&1&&(os(0,"span",21),pC(1,"\u2014"),zu());}function re(i,t){if(i&1){let e=Rw();os(0,"span",26),pC(1,"Waiting for authorization\u2026"),zu(),os(2,"button",27),qh("click",function(){Pd(e);let r=Lw(4);return Ld(r.cancelConnect())}),pC(3," Cancel "),zu();}if(i&2){let e=Lw(2).$implicit;IE(2),Bh("aria-label","Stop waiting for the authorization of "+e.config.name);}}function le(i,t){if(i&1){let e=Rw();os(0,"span",28),pC(1,"Disconnect?"),zu(),os(2,"button",29),qh("click",function(){Pd(e);let r=Lw(2).$implicit,d=Lw(2);return Ld(d.confirmReset(r))}),pC(3),zu(),os(4,"button",29),qh("click",function(){Pd(e);let r=Lw(4);return Ld(r.cancelReset())}),pC(5," Cancel "),zu();}if(i&2){let e=Lw(2).$implicit,n=Lw(2);IE(2),Vh("disabled",n.resettingKey()===e.key),Bh("aria-label","Confirm disconnecting "+e.config.name),IE(),Yu(" ",n.resettingKey()===e.key?"Disconnecting\u2026":"Confirm"," "),IE(),Vh("disabled",n.resettingKey()===e.key),Bh("aria-label","Cancel disconnecting "+e.config.name);}}function ce(i,t){if(i&1){let e=Rw();os(0,"button",29),qh("click",function(){Pd(e);let r=Lw(3).$implicit,d=Lw(2);return Ld(d.requestReset(r))}),pC(1," Disconnect "),zu();}if(i&2){let e=Lw(3).$implicit,n=Lw(2);Vh("disabled",n.connectingKey()!==null),Bh("aria-label","Disconnect "+e.config.name);}}function de(i,t){if(i&1){let e=Rw();os(0,"button",29),qh("click",function(){Pd(e);let r=Lw(2).$implicit,d=Lw(2);return Ld(d.connect(r))}),pC(1),zu(),Iw(2,ce,2,2,"button",30);}if(i&2){let e=Lw(2).$implicit,n=Lw(2);Vh("disabled",n.connectingKey()!==null||n.resettingKey()!==null),Bh("aria-label",(n.connectionOf(e)==="connected"?"Reconnect ":"Connect ")+e.config.name),IE(),Yu(" ",n.connectionOf(e)==="connected"?"Reconnect":"Connect"," "),IE(),ww(n.connectionOf(e)==="connected"?2:-1);}}function pe(i,t){if(i&1&&Iw(0,re,4,1)(1,le,6,5)(2,de,3,4),i&2){let e=Lw().$implicit,n=Lw(2);ww(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=Rw();os(0,"button",27),qh("click",function(){Pd(e);let r=Lw().$implicit,d=Lw(2);return Ld(d.duplicate(r))}),pC(1," Duplicate "),zu();}if(i&2){let e=Lw().$implicit;Bh("aria-label","Duplicate "+e.config.name);}}function _e(i,t){if(i&1){let e=Rw();os(0,"button",27),qh("click",function(){Pd(e);let r=Lw(2).$implicit,d=Lw(2);return Ld(d.edit(r))}),pC(1," Edit "),zu();}if(i&2){let e=Lw(2).$implicit;Bh("aria-label","Edit "+e.config.name);}}function me(i,t){if(i&1){let e=Rw();Iw(0,_e,2,1,"button",24),os(1,"agentos-row-delete-action",31),qh("deleteRequested",function(){Pd(e);let r=Lw().$implicit,d=Lw(2);return Ld(d.deletion.request(r.key))})("deleteConfirmed",function(){Pd(e);let r=Lw().$implicit,d=Lw(2);return Ld(d.confirmDelete(r))})("deleteCancelled",function(){Pd(e);let r=Lw(3);return Ld(r.deletion.cancel())}),zu();}if(i&2){let e=Lw().$implicit,n=Lw(2);ww(n.deletion.confirmingId()!==e.key?0:-1),IE(),Vh("rowKey",e.key)("rowLabel",e.config.name)("state",n.deletion);}}function ge(i,t){i&1&&(os(0,"button",25),pC(1,"Inherited"),zu());}function he(i,t){if(i&1&&(os(0,"tr",10)(1,"td",13),pC(2),zu(),os(3,"td",14),pC(4),zu(),os(5,"td",15)(6,"div",16)(7,"ds-tag",17),pC(8),zu(),Iw(9,ie,2,0,"ds-tag",18),zu()(),os(10,"td",19),Iw(11,oe,2,0,"ds-tag",20)(12,ae,2,0,"ds-tag",18)(13,se,2,0,"span",21),zu(),os(14,"td",22)(15,"div",23),Iw(16,pe,3,1),Iw(17,ue,2,1,"button",24),Iw(18,me,2,4)(19,ge,2,0,"button",25),zu()()()),i&2){let e=t.$implicit,n=Lw(2);IE(2),lg(e.config.name),IE(2),Yu(" ",e.config.authType," "),IE(3),Vh("variant",e.scopeLabel==="Platform"?"neutral":e.scopeLabel==="Personal"?"outline":"accent"),IE(),lg(e.scopeLabel),IE(),ww(e.canMutate?-1:9),IE(2),ww(n.isOAuth(e)&&n.connectionOf(e)==="connected"?11:n.isOAuth(e)&&n.connectionOf(e)==="disconnected"?12:13),IE(5),ww(n.isOAuth(e)?16:-1),IE(),ww(n.deletion.confirmingId()!==e.key&&n.resetConfirmingKey()!==e.key&&n.connectingKey()!==e.key?17:-1),IE(),ww(e.canMutate?18:19);}}function Ce(i,t){if(i&1&&(os(0,"div",7)(1,"table",8)(2,"thead",9)(3,"tr",10)(4,"th",11),pC(5,"Name"),zu(),os(6,"th",11),pC(7,"Authentication type"),zu(),os(8,"th",11),pC(9,"Scope"),zu(),os(10,"th",11),pC(11,"Connection"),zu(),os(12,"th",11)(13,"span",12),pC(14,"Actions"),zu()()()(),os(15,"tbody",9),Tw(16,he,20,9,"tr",10,Q),zu()()()),i&2){let e=Lw();IE(16),_w(e.rowFilter.filteredRows());}}var fe=new Set(["OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"]),J=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=Mi(false);isLoading=Mi(true);rows=Mi([]);deletion=k();connections=Mi({});connectingKey=Mi(null);resetConfirmingKey=Mi(null);resettingKey=Mi(null);actionMessage=Mi(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(te$1(t=>t.get("namespaceId")??""),Ys(t=>t?this.namespaceRole.isAdminOfNamespace$(t):Dr(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(qo(()=>{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(te$1(n=>[e.key,n.connected?"connected":"disconnected"]),Zs(()=>Dr([e.key,"unknown"]))));if(t.length===0){this.connections.set({});return}this.connectionsLoad=Gm(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=ew({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&&(os(0,"ds-section-header",0)(1,"agentos-table-filter",1),qh("queryChange",function(d){return n.rowFilter.query.set(d)}),zu(),os(2,"button",2),qh("click",function(){return n.openCreateForm()}),pC(3,"New auth setting"),zu()(),Iw(4,X,2,1,"p",3),Iw(5,Z,2,4,"p",4),Iw(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;IE(),Vh("query",n.rowFilter.query()),IE(3),ww(n.deletion.error()?4:-1),IE(),ww((r=n.actionMessage())?5:-1,r),IE(),ww(n.isLoading()?6:n.rows().length===0?7:n.rowFilter.filteredRows().length===0?8:9);}},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{J as AuthSettingsAllScopesComponent};
@@ -0,0 +1 @@
1
+ import {f,a9 as gd,a as fd,U as Ut,c as fo,g as go,aa as uo,ab as _a,ac as pa,v as vn,d as yn,e as fn,_ as _n,i as at,u as un,V as Vo,ad as f$1}from'./chunk-2KFuV5E5.js';import {g,W,aT as Y,M as Mi,af as ue$1,s as sf,a as ew,aU as Jb,o as os,H as Hh,I as Iw,z as zu,c as IE,w as ww,ao as Vl,a5 as Ys,a7 as Kt,ag as Gm,a6 as Zs,b as pC,R as Rw,K as qh,aV as mg,N as lI,L as Lw,aW as gg,Q as fI,T as Tw,_ as _w,aX as SC,aY as _C,l as lg,h as Bh,a0 as RC,ay as kC,$ as dg,Y as Yu,a1 as FC,P as Pd,n as Ld,aZ as DC}from'./main-EPHSXFSY.js';var ce=e=>({title:"By agent",rows:e}),pe=e=>({title:"By model",rows:e}),ge=(e,a)=>[e,a],ue=(e,a)=>a.title,_e=(e,a)=>a.key;function Ce(e,a){e&1&&(os(0,"p",2),pC(1,"Loading usage settings\u2026"),zu());}function fe(e,a){if(e&1){let t=Rw();os(0,"ds-notice"),pC(1,"Could not load usage settings. Please try again."),zu(),os(2,"div")(3,"button",3),qh("click",function(){Pd(t);let s=Lw();return Ld(s.configuration.retry())}),pC(4,"Retry usage settings"),zu()();}}function ye(e,a){e&1&&(os(0,"p",2),pC(1,"Usage tracking is disabled."),zu());}function be(e,a){e&1&&(os(0,"ds-notice"),pC(1),zu()),e&2&&(IE(),lg(a));}function xe(e,a){e&1&&(os(0,"p",2),pC(1,"Loading usage\u2026"),zu());}function he(e,a){e&1&&(os(0,"p",12),pC(1,"No recorded usage for this period."),zu());}function Se(e,a){if(e&1&&(os(0,"p",10),pC(1),zu()),e&2){let t=Lw().$implicit;IE(),Yu("",t.aggregate.unknownCostCount," record(s) with unknown cost");}}function we(e,a){if(e&1&&(os(0,"tr",16)(1,"td",18),pC(2),zu(),os(3,"td",19),pC(4),RC(5,"number"),zu(),os(6,"td",20),pC(7),RC(8,"number"),RC(9,"number"),zu(),os(10,"td",21),pC(11),RC(12,"number"),RC(13,"number"),zu(),os(14,"td",22),pC(15),RC(16,"agentosCost"),Iw(17,Se,2,1,"p",10),zu()()),e&2){let t=a.$implicit;IE(2),lg(t.key),IE(2),lg(kC(5,8,t.aggregate.totalTokens)),IE(3),dg(" ",kC(8,10,t.aggregate.inputTokens)," / ",kC(9,12,t.aggregate.outputTokens)," "),IE(4),dg(" ",kC(12,14,t.aggregate.cacheReadTokens)," / ",kC(13,16,t.aggregate.cacheWriteTokens)," "),IE(4),Yu(" ",FC(16,18,t.aggregate.cost,t.aggregate.unknownCostCount)," "),IE(2),ww(t.aggregate.unknownCostCount>0?17:-1);}}function ve(e,a){if(e&1&&(os(0,"div",13)(1,"table",14)(2,"thead",15)(3,"tr",16)(4,"th",17),pC(5,"Name"),zu(),os(6,"th",17),pC(7,"Tokens"),zu(),os(8,"th",17),pC(9,"Input / output"),zu(),os(10,"th",17),pC(11,"Cache read / write"),zu(),os(12,"th",17),pC(13,"Estimated cost"),zu()()(),os(14,"tbody",15),Tw(15,we,18,21,"tr",16,_e),zu()()()),e&2){let t=Lw().$implicit;IE(),Bh("aria-label","Usage "+t.title.toLowerCase()),IE(14),_w(t.rows);}}function Ne(e,a){if(e&1&&(os(0,"h3",11),pC(1),zu(),Iw(2,he,2,0,"p",12)(3,ve,17,1,"div",13)),e&2){let t=a.$implicit;IE(),lg(t.title),IE(),ww(t.rows.length===0?2:3);}}function Te(e,a){if(e&1&&(Tw(0,Ne,4,2,null,null,ue),os(2,"p",10),pC(3," Unpriced usage is kept separate from known costs. Active agent runs appear here after they finish. "),zu()),e&2){let t=Lw(2);_w(SC(4,ge,_C(0,ce,t.agents()),_C(2,pe,t.models())));}}function Ee(e,a){if(e&1){let t=Rw();os(0,"form",4),qh("ngSubmit",function(){Pd(t);let s=Lw();return Ld(s.load())}),os(1,"ds-form-field",5)(2,"input",6),mg("ngModelChange",function(s){Pd(t);let m=Lw();return DC(m.from,s)||(m.from=s),Ld(s)}),zu(),lI(),zu(),os(3,"ds-form-field",7)(4,"input",8),mg("ngModelChange",function(s){Pd(t);let m=Lw();return DC(m.to,s)||(m.to=s),Ld(s)}),zu(),lI(),zu(),os(5,"button",9),pC(6,"Refresh"),zu()(),Iw(7,be,2,1,"ds-notice"),Iw(8,xe,2,0,"p",2)(9,Te,4,7);}if(e&2){let t,r=Lw();IE(2),gg("ngModel",r.from),fI(),IE(2),gg("ngModel",r.to),fI(),IE(3),ww((t=r.error())?7:-1,t),IE(),ww(r.loading()?8:r.error()?-1:9);}}var me=class e{route=g(W);api=g(Y);configuration=g(f);namespaceId=this.route.snapshot.params.namespaceId;agents=Mi([]);models=Mi([]);error=Mi(null);loading=Mi(false);from=new Date(Date.now()-30*864e5).toISOString().slice(0,10);to=new Date().toISOString().slice(0,10);refresh=new ue$1;constructor(){sf(a=>{if(!this.configuration.enabled())return;let t=this.refresh.pipe(Vl(void 0),Ys(()=>{this.error.set(null),this.agents.set([]),this.models.set([]);let r=new Date(`${this.from}T00:00:00.000Z`),s=new Date(`${this.to}T23:59:59.999Z`);return !Number.isFinite(r.getTime())||!Number.isFinite(s.getTime())||r>s?(this.error.set("Select a valid date range."),this.loading.set(false),Kt):(this.loading.set(true),Gm({agents:this.api.aggregateByAgentUsageRecord(this.namespaceId,r.toISOString(),s.toISOString()),models:this.api.aggregateByModelUsageRecord(this.namespaceId,r.toISOString(),s.toISOString())}).pipe(Zs(m=>(this.loading.set(false),this.error.set(m.status===403?"Namespace admin permission is required to view this report.":"Could not load usage. Please try again."),Kt))))})).subscribe(({agents:r,models:s})=>{this.agents.set(r),this.models.set(s),this.loading.set(false);});a(()=>t.unsubscribe());});}load(){this.configuration.enabled()&&this.refresh.next();}static \u0275fac=function(t){return new(t||e)};static \u0275cmp=ew({type:e,selectors:[["agentos-namespace-usage"]],decls:6,vars:1,consts:[["full",""],["title","Usage and costs","description","Recorded LLM usage across this namespace. Costs are estimates in the platform currency."],["role","status",1,"settings-table__status"],["dsButton","","type","button",3,"click"],[1,"ds-inline","ds-inline--wrap","ds-inline--end",3,"ngSubmit"],["label","From (UTC)","controlId","usage-from"],["dsControl","","id","usage-from","type","date","name","from","required","",3,"ngModelChange","ngModel"],["label","To (UTC)","controlId","usage-to"],["dsControl","","id","usage-to","type","date","name","to","required","",3,"ngModelChange","ngModel"],["dsButton","","variant","primary","type","submit"],[1,"ds-hint"],[1,"ds-micro"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table"],["role","rowgroup"],["role","row"],["role","columnheader"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Tokens"],["role","cell","data-label","Input / output"],["role","cell","data-label","Cache read / write"],["role","cell","data-label","Estimated cost"]],template:function(t,r){t&1&&(os(0,"ds-page",0),Hh(1,"ds-section-header",1),Iw(2,Ce,2,0,"p",2)(3,fe,5,0)(4,ye,2,0,"p",2)(5,Ee,10,4),zu()),t&2&&(IE(2),ww(r.configuration.state()==="loading"?2:r.configuration.state()==="error"?3:r.configuration.state()==="disabled"?4:5));},dependencies:[gd,fd,Ut,fo,go,uo,_a,pa,vn,yn,fn,_n,at,un,Vo,Jb,f$1],encapsulation:2})};export{me as NamespaceUsageComponent};
@@ -0,0 +1 @@
1
+ import {S}from'./chunk-2KFuV5E5.js';import {a as ew,S as br,o as os,b as pC,z as zu,H as Hh,J as Vh}from'./main-EPHSXFSY.js';var c=class a{groups=[{label:"Access",items:[{label:"Users & Groups",commands:["users"]},{label:"Auth settings",commands:["auth-settings"]}]},{label:"Connections",items:[{label:"Platform integrations",commands:["integration-configs"]},{label:"Messaging",commands:["messaging"]}]},{label:"AI",items:[{label:"Platform agents",commands:["agent-configs"]},{label:"Platform AI providers",commands:["ai-providers"]},{label:"Platform AI models",commands:["ai-models"]},{label:"Platform skills",commands:["skills"]},{label:"Platform prompts",commands:["prompts"]}]},{label:"Automation",items:[{label:"Scheduled prompts",commands:["scheduled-prompts"]},{label:"Tool invoke",commands:["tool-invoke"]}]},{label:"System",items:[{label:"Configuration",commands:["configuration"]}]}];static \u0275fac=function(t){return new(t||a)};static \u0275cmp=ew({type:a,selectors:[["agentos-admin-settings-layout"]],decls:9,vars:1,consts:[["title","Admin \xB7 Configuration","mark","A","navigationLabel","Admin settings",3,"groups"],["settingsBreadcrumb","","aria-label","Breadcrumb"],["aria-hidden","true"]],template:function(t,g){t&1&&(os(0,"agentos-settings-layout",0)(1,"nav",1)(2,"span"),pC(3,"Platform"),zu(),os(4,"span",2),pC(5,"/"),zu(),os(6,"span"),pC(7,"Administration"),zu()(),Hh(8,"router-outlet"),zu()),t&2&&Vh("groups",g.groups);},dependencies:[br,S],styles:["nav[settingsBreadcrumb][_ngcontent-%COMP%]{display:flex;gap:8px;align-items:center}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-accent-700);text-decoration:none}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:2px}"]})};export{c as AdminSettingsLayoutComponent};
@@ -0,0 +1,2 @@
1
+ import {I}from'./chunk-x7GGjcqr.js';import {g,W,b0 as J,v as we,M as Mi,i as VC,b1 as ke,ag as Gm,x as U,a6 as Zs,ae as Dr,a as ew,o as os,H as Hh,I as Iw,z as zu,K as qh,c as IE,w as ww,J as Vh,b as pC,R as Rw,N as lI,T as Tw,L as Lw,Q as fI,_ as _w,Y as Yu,$ as dg,P as Pd,n as Ld,l as lg}from'./main-EPHSXFSY.js';import {a9 as gd,M as Mo,D as Do,U as Ut,q as Mn,Q as Qt,c as fo,ab as _a,af as Bi,v as vn,d as yn,e as fn,n as pn,h as hn,_ as _n,i as at,u as un,o as cn}from'./chunk-2KFuV5E5.js';import'./chunk-BMbtNfWQ.js';var oe=(i,t)=>t.id;function ae(i,t){i&1&&(os(0,"p",1),pC(1,"Loading\u2026"),zu());}function se(i,t){if(i&1&&(os(0,"ds-notice"),pC(1),zu()),i&2){let e=Lw(2);IE(),lg(e.errorMessage());}}function re(i,t){if(i&1){let e=Rw();os(0,"div")(1,"button",23),qh("click",function(){Pd(e);let s=Lw(2);return Ld(s.retryLoad())}),pC(2,"Retry loading"),zu()();}}function ce(i,t){if(i&1&&(Hh(0,"br"),pC(1)),i&2){let e=Lw(3);IE(),Yu("",e.association()?.checkoutFailureReason," ");}}function de(i,t){if(i&1&&(os(0,"ds-notice",3),pC(1),Iw(2,ce,2,1),zu()),i&2){let e=Lw(2);Vh("tone",e.checkoutStatus()===e.CheckoutStatus.FAILED?"error":e.checkoutStatus()===e.CheckoutStatus.READY?"success":"neutral"),IE(),Yu(" Repository: ",e.checkoutStatus()," "),IE(),ww(e.association()?.checkoutFailureReason?2:-1);}}function le(i,t){if(i&1&&(os(0,"option",12),pC(1),zu()),i&2){let e=t.$implicit,c=Lw(2);Vh("value",e.id),IE(),dg("",e.name," (",c.authTypeLabel(e.authType),")");}}function me(i,t){i&1&&(os(0,"p",13),pC(1," No usable auth setting in this namespace. Create a BEARER_TOKEN one first. "),zu());}function pe(i,t){if(i&1){let e=Rw();os(0,"button",24),qh("click",function(){Pd(e);let s=Lw(2);return Ld(s.remove())}),pC(1," Remove association "),zu();}if(i&2){let e=Lw(2);Vh("disabled",!e.associationLoaded()||e.isSaving());}}function ue(i,t){if(i&1){let e=Rw();Iw(0,se,2,1,"ds-notice"),Iw(1,re,3,0,"div"),Iw(2,de,3,3,"ds-notice",3),os(3,"ds-fieldset",4)(4,"ds-form-field",5)(5,"input",6),qh("ngModelChange",function(s){Pd(e);let u=Lw();return Ld(u.repositoryUrl.set(s))}),zu(),lI(),zu(),os(6,"ds-form-field",7)(7,"input",8),qh("ngModelChange",function(s){Pd(e);let u=Lw();return Ld(u.mainBranch.set(s))}),zu(),lI(),zu(),os(8,"ds-form-field",9)(9,"select",10),qh("ngModelChange",function(s){Pd(e);let u=Lw();return Ld(u.serviceAuthSettingId.set(s))}),os(10,"option",11),pC(11,"Select an auth setting\u2026"),zu(),Tw(12,le,2,3,"option",12,oe),zu(),lI(),Iw(14,me,2,0,"p",13),zu()(),os(15,"ds-fieldset",14)(16,"div",15)(17,"label",16)(18,"input",17),qh("ngModelChange",function(s){Pd(e);let u=Lw();return Ld(u.autoWorktree.set(s))}),zu(),lI(),pC(19," Offer a worktree to every new top-level case "),zu(),os(20,"p",18),pC(21," The creator checks the box when creating the case; it is unchecked by default, and a case created without it has no Git. Applies to cases created from now on: turning this on later never equips existing cases, and turning it off never removes a worktree already created. "),zu()(),os(22,"ds-form-field",19)(23,"input",20),qh("ngModelChange",function(s){Pd(e);let u=Lw();return Ld(u.setupCommand.set(s))}),zu(),lI(),os(24,"p",13),pC(25," Runs on the server, as the service user, in each new worktree. It executes code from the branch \u2014 prefer a command that disables lifecycle scripts. "),zu()()(),os(26,"ds-form-actions")(27,"button",21),qh("click",function(){Pd(e);let s=Lw();return Ld(s.save())}),pC(28),zu(),Iw(29,pe,2,1,"button",22),zu();}if(i&2){let e=Lw();ww(e.errorMessage()?0:-1),IE(),ww(e.associationLoaded()?-1:1),IE(),ww(e.isAssociated()&&e.checkoutStatus()?2:-1),IE(),Vh("disabled",!e.associationLoaded()||e.isSaving()),IE(2),Vh("ngModel",e.repositoryUrl()),fI(),IE(2),Vh("ngModel",e.mainBranch()),fI(),IE(2),Vh("ngModel",e.serviceAuthSettingId()),fI(),IE(3),_w(e.eligibleAuthSettings()),IE(2),ww(e.eligibleAuthSettings().length===0?14:-1),IE(),Vh("disabled",!e.associationLoaded()||e.isSaving()),IE(3),Vh("ngModel",e.autoWorktree()),fI(),IE(5),Vh("ngModel",e.setupCommand()),fI(),IE(4),Vh("disabled",!e.canSave()),IE(),Yu(" ",e.isSaving()?"Saving\u2026":e.isAssociated()?"Update":"Associate"," "),IE(),ww(e.isAssociated()?29:-1);}}var ge=["BearerTokenAuthSetting","BasicAuthAuthSetting","ApiKeyAuthSetting"],he={BearerTokenAuthSetting:"token",BasicAuthAuthSetting:"basic auth",ApiKeyAuthSetting:"API key"},ne=class i{route=g(W);gitApi=g(J);authSettingState=g(I);destroyRef=g(we);isLoading=Mi(true);isSaving=Mi(false);confirmingRemove=Mi(false);associationLoaded=Mi(false);errorMessage=Mi(null);association=Mi(null);authSettings=Mi([]);repositoryUrl=Mi("");mainBranch=Mi("main");serviceAuthSettingId=Mi("");autoWorktree=Mi(false);setupCommand=Mi("");namespaceId="";isAssociated=VC(()=>this.association()?.associated===true);eligibleAuthSettings=VC(()=>this.authSettings().filter(t=>ge.includes(t.authType)));authTypeLabel(t){return he[t??""]??t??"unknown"}canSave=VC(()=>this.associationLoaded()&&!this.isLoading()&&!this.isSaving()&&this.repositoryUrl().trim().length>0&&this.serviceAuthSettingId().length>0);checkoutStatus=VC(()=>this.association()?.checkoutStatus??null);CheckoutStatus=ke;ngOnInit(){this.namespaceId=this.route.snapshot.paramMap.get("namespaceId")??"",this.load();}retryLoad(){this.isLoading()||this.isSaving()||this.load();}load(){this.isLoading.set(true),this.associationLoaded.set(false),this.errorMessage.set(null),Gm({association:this.gitApi.getAssociationNamespaceGit(this.namespaceId),authSettings:this.authSettingState.loadNamespaceSettings(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({association:t,authSettings:e})=>{this.authSettings.set(e??[]),this.acceptAssociation(t),this.isLoading.set(false);},error:t=>{console.error("Failed to load the Git repository settings",t),this.errorMessage.set(this.messageOf(t)),this.isLoading.set(false);}});}acceptAssociation(t){this.association.set(t);let e=t?.associated===false||t?.associated===true&&typeof t.repositoryUrl=="string"&&typeof t.mainBranch=="string"&&typeof t.serviceAuthSettingId=="string"&&typeof t.autoWorktreeForRootCases=="boolean"&&(t.setupCommand==null||typeof t.setupCommand=="string");this.associationLoaded.set(e),e?this.applyToForm(t):this.errorMessage.set("The repository settings could not be loaded completely. Retry before making changes.");}applyToForm(t){this.repositoryUrl.set(t.repositoryUrl??""),this.mainBranch.set(t.mainBranch??"main"),this.serviceAuthSettingId.set(t.serviceAuthSettingId??""),this.autoWorktree.set(t.autoWorktreeForRootCases??false),this.setupCommand.set(t.setupCommand??"");}save(){this.canSave()&&(this.isSaving.set(true),this.errorMessage.set(null),this.gitApi.setAssociationNamespaceGit(this.namespaceId,{repositoryUrl:this.repositoryUrl().trim(),mainBranch:this.mainBranch().trim()||void 0,serviceAuthSettingId:this.serviceAuthSettingId(),autoWorktreeForRootCases:this.autoWorktree(),setupCommand:this.setupCommand().trim()||void 0}).pipe(U(this.destroyRef),Zs(t=>(console.error("Failed to save the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),Dr(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}remove(){!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated()||this.confirmingRemove.set(true);}confirmRemove(){this.confirmingRemove.set(false),!(!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated())&&(this.isSaving.set(true),this.gitApi.removeAssociationNamespaceGit(this.namespaceId).pipe(U(this.destroyRef),Zs(t=>(console.error("Failed to remove the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),Dr(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}messageOf(t){return t.error?.message??t.message??"Unexpected error"}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=ew({type:i,selectors:[["agentos-namespace-git"]],decls:5,vars:2,consts:[["title","Git repository","description","Associating a repository enables Git workspaces for this namespace. When worktree creation is enabled, the new-case form offers a worktree, and a case created with one gets a repo/ directory shared by its sub-cases. Namespace files remain shared documents outside Git. Agents create branches and pull requests in their workflows."],[1,"ds-hint"],["title","Remove the repository association?","message","Existing workspaces keep their worktree.","confirmLabel","Remove","cancelLabel","Cancel",3,"confirmed","cancelled","open"],[3,"tone"],["legend","Repository",3,"disabled"],["label","Repository URL","controlId","git-url","hint","HTTPS only, without credentials in the URL."],["dsControl","","id","git-url","type","url","placeholder","https://forge.example/org/project.git","name","repositoryUrl",3,"ngModelChange","ngModel"],["label","Main branch","controlId","git-branch","hint","New worktrees start at this branch\u2019s commit, without creating a branch."],["dsControl","","id","git-branch","type","text","placeholder","main","name","mainBranch",3,"ngModelChange","ngModel"],["label","Service account","controlId","git-auth","hint","Shared by the namespace. Every Git operation uses this identity, never the identity of whoever opened the case."],["dsControl","","id","git-auth","name","serviceAuthSettingId",3,"ngModelChange","ngModel"],["value",""],[3,"value"],[1,"ds-hint","ds-hint--warning"],["legend","Automation",3,"disabled"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox","name","autoWorktree",3,"ngModelChange","ngModel"],[1,"ds-hint","ds-indent"],["label","Setup command (optional)","controlId","git-setup"],["dsControl","","mono","","id","git-setup","type","text","placeholder","pnpm install --ignore-scripts","name","setupCommand",3,"ngModelChange","ngModel"],["id","git-save","dsButton","","variant","primary","type","button",3,"click","disabled"],["id","git-remove","dsButton","","variant","danger","type","button",3,"disabled"],["id","git-retry","dsButton","","type","button",3,"click"],["id","git-remove","dsButton","","variant","danger","type","button",3,"click","disabled"]],template:function(e,c){e&1&&(os(0,"ds-page"),Hh(1,"ds-section-header",0),Iw(2,ae,2,0,"p",1)(3,ue,30,14),zu(),os(4,"ds-confirm-dialog",2),qh("confirmed",function(){return c.confirmRemove()})("cancelled",function(){return c.confirmingRemove.set(false)}),zu()),e&2&&(IE(2),ww(c.isLoading()?2:3),IE(2),Vh("open",c.confirmingRemove()));},dependencies:[gd,Mo,Do,Ut,Mn,Qt,fo,_a,Bi,vn,yn,fn,pn,hn,_n,at,un,cn],encapsulation:2})};
2
+ export{ne as NamespaceGitComponent};