@whoz-oss/coday-client 0.0.0-workstream-forge.201 → 0.0.0-workstream-forge.204

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 (51) hide show
  1. package/browser/{chunk-_FIOLiYh.js → chunk-06r80pO9.js} +1 -1
  2. package/browser/{chunk-oj4c6uAi.js → chunk-4j3XQws2.js} +1 -1
  3. package/browser/{chunk-D8dC5epc.js → chunk-BJDs9gyo.js} +1 -1
  4. package/browser/{chunk-Cn4W5so0.js → chunk-BLAi8-AH.js} +1 -1
  5. package/browser/{chunk-Dw8GzIql.js → chunk-BULaSedZ.js} +1 -1
  6. package/browser/{chunk-C3MZTR8U.js → chunk-BbxJcgkD.js} +1 -1
  7. package/browser/{chunk-Cj3b_Qix.js → chunk-BjWRad4i.js} +1 -1
  8. package/browser/{chunk-BkWwMt8v.js → chunk-BlT9aAnX.js} +1 -1
  9. package/browser/{chunk-Df3qhzjA.js → chunk-Bo2DjBi6.js} +1 -1
  10. package/browser/{chunk-BSDUgftL.js → chunk-BrPnYn04.js} +1 -1
  11. package/browser/{chunk-CaxaxhOa.js → chunk-BspzeE1k.js} +1 -1
  12. package/browser/{chunk-CQi9YhmS.js → chunk-Bxu7LsYO.js} +1 -1
  13. package/browser/{chunk-DnZCKmfw.js → chunk-C2gby904.js} +1 -1
  14. package/browser/{chunk-BpiMHsf1.js → chunk-C90canit.js} +1 -1
  15. package/browser/{chunk-BfU222B7.js → chunk-CA-gmqLK.js} +1 -1
  16. package/browser/{chunk-xIogN9Vx.js → chunk-CDvD6jGh.js} +1 -1
  17. package/browser/{chunk-BvVO_93V.js → chunk-CHX9K5YU.js} +1 -1
  18. package/browser/{chunk-BHWtc4IC.js → chunk-CLsQ-Qj2.js} +1 -1
  19. package/browser/chunk-CQZDxK4J.js +1 -0
  20. package/browser/{chunk-Bjt2f04h.js → chunk-CQkK3pZv.js} +1 -1
  21. package/browser/{chunk-DanxWOkc.js → chunk-CS1D6IqE.js} +1 -1
  22. package/browser/{chunk-CvaAqsbw.js → chunk-CU5VTmsN.js} +1 -1
  23. package/browser/{chunk-WhkS8yjl.js → chunk-CXONvlNS.js} +1 -1
  24. package/browser/{chunk-B4p-fNyR.js → chunk-C_jGLVKk.js} +1 -1
  25. package/browser/chunk-Cq4k0Mf8.js +670 -0
  26. package/browser/{chunk-D5xSgJnG.js → chunk-Cx8YHfi-.js} +1 -1
  27. package/browser/{chunk-Do6N4aSH.js → chunk-D4LNa82l.js} +1 -1
  28. package/browser/{chunk-DMR_R6mw.js → chunk-D5NB1BF_.js} +1 -1
  29. package/browser/{chunk-C-Dz3TPb.js → chunk-D5XtMXVy.js} +1 -1
  30. package/browser/{chunk-SVJT5q4W.js → chunk-DBmtA_en.js} +1 -1
  31. package/browser/{chunk-BiEA3aQE.js → chunk-DDmCHZzr.js} +1 -1
  32. package/browser/{chunk-XzG0IFaC.js → chunk-DKSd6hBk.js} +1 -1
  33. package/browser/{chunk-CHupz_GU.js → chunk-DNED6AOD.js} +1 -1
  34. package/browser/{chunk-C6jJRCiO.js → chunk-DV-Eelxi.js} +1 -1
  35. package/browser/{chunk-_6yCeVu7.js → chunk-DjYnv-0F.js} +1 -1
  36. package/browser/{chunk-D2nQYaQh.js → chunk-DlluG4SU.js} +1 -1
  37. package/browser/{chunk-CYLw2oN0.js → chunk-DvxsvoBS.js} +1 -1
  38. package/browser/{chunk-BIYmUvfG.js → chunk-Oq3ZvW7J.js} +1 -1
  39. package/browser/{chunk-Cv_vef3m.js → chunk-UIQNJ87R.js} +1 -1
  40. package/browser/{chunk-D9sUF55R.js → chunk-bqhgjnlz.js} +1 -1
  41. package/browser/{chunk-D-yDhjOP.js → chunk-g7uSi0Xp.js} +1 -1
  42. package/browser/{chunk-zJXn33wx.js → chunk-hWg7zi7S.js} +1 -1
  43. package/browser/{chunk-TgdOFY-g.js → chunk-k_VZl2u9.js} +1 -1
  44. package/browser/{chunk-Y_xtT3ze.js → chunk-lFcHhl6c.js} +1 -1
  45. package/browser/{chunk-D-Jx5Mdg.js → chunk-s_xyr0FP.js} +1 -1
  46. package/browser/{chunk-B9q-_3rm.js → chunk-wtijUwLT.js} +1 -1
  47. package/browser/index.html +2 -2
  48. package/browser/{main-2IBYD645.js → main-CEEMKDJT.js} +1 -1
  49. package/package.json +1 -1
  50. package/browser/chunk-DxKo0dCS.js +0 -670
  51. package/browser/chunk-gjFAR1Z5.js +0 -1
@@ -1 +1 @@
1
- import {v}from'./chunk-CvaAqsbw.js';import {I}from'./chunk-C6jJRCiO.js';import {O}from'./chunk-D9sUF55R.js';import {g,W,F,I as Ie$1,a8 as _,a9 as F$1,aa as Cr,U as Ui,ab as ue,K as KC,a1 as fa,E as U,o as Af,ac as Ty,m as mw,D as Ds,R as mg,M as MC,a as pl,P as Pw,j as jE,Q as ug,L as Lw,a2 as da,ad as ne,q as qw,i as Vw,ae as kw,T as SI,l as lg,X as Xw,H as Hw,Y as MI,v as vl,O as Og,r as df,s as ff}from'./main-2IBYD645.js';import {p as pt,T as Te$1,a as fn,c as pn,h as hn,d as cn,r as ln,e as dn,o as on,g as at,i as an,t as rn,U as Ut,n as nd,l as bo,x as xo,L as Lt,u as vn,G as Gt,w as pa,m as mo,b as po,V as Vn,A as An,W as Wt}from'./chunk-DxKo0dCS.js';import'./chunk-gjFAR1Z5.js';var be=(i,e)=>e.value;function _e(i,e){i&1&&(Ds(0,"p",2),MC(1,"Loading\u2026"),pl());}function xe(i,e){if(i&1&&(Ds(0,"label",6),lg(1,"input",22),SI(),MC(2),pl()),i&2){let t=e.$implicit,n=Xw(2);jE(),ug("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),MI(),jE(),vl(" ",t.label," ");}}function Ie(i,e){if(i&1&&(Ds(0,"option",10),MC(1),pl()),i&2){let t=e.$implicit;ug("value",t.type),jE(),Og(t.displayName);}}function Ne(i,e){if(i&1&&(Ds(0,"option",10),MC(1),pl()),i&2){let t=e.$implicit;ug("value",t.value),jE(),Og(t.label);}}function Ae(i,e){if(i&1&&(Ds(0,"div",18)(1,"label",6),lg(2,"input",23),SI(),MC(3," Grant automatically "),pl(),Ds(4,"p",2),MC(5),pl()()),i&2){let t=Xw(2);jE(2),ug("formControl",t.autoGrantControl),MI(),jE(3),vl(" Give this integration to ",t.autoGrantReach(),", without each agent having to declare it. An agent can still opt out by mapping this configuration to an empty tool list. ");}}function Ee(i,e){if(i&1){let t=qw();Ds(0,"ds-card")(1,"ds-json-schema-form",24),mg("valueChange",function(a){df(t);let p=Xw(2);return ff(p.onParamsChange(a))}),pl()();}if(i&2){let t=Xw(2);jE(),ug("schema",e)("value",t.initialParams());}}function Fe(i,e){if(i&1){let t=qw();Ds(0,"button",25),mg("click",function(){df(t);let a=Xw(2);return ff(a.exportYaml())}),MC(1),pl();}if(i&2){let t=Xw(2);ug("disabled",t.isExporting()),jE(),vl(" ",t.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Te(i,e){if(i&1){let t=qw();Ds(0,"form",4),mg("ngSubmit",function(){df(t);let a=Xw();return ff(a.submit())}),Ds(1,"ds-fieldset",5),Vw(2,xe,3,4,"label",6,kw().trackByScope,true),pl(),Ds(4,"ds-form-field",7)(5,"select",8)(6,"option",9),MC(7,"Select type"),pl(),Vw(8,Ie,2,2,"option",10,kw().trackByType,true),pl(),SI(),pl(),Ds(10,"ds-form-field",11),lg(11,"input",12),SI(),pl(),Ds(12,"ds-form-field",13),lg(13,"textarea",14),SI(),pl(),Ds(14,"ds-form-field",15)(15,"select",16)(16,"option",17),MC(17,"None"),pl(),Vw(18,Ne,2,2,"option",10,be),pl(),SI(),pl(),Pw(20,Ae,6,2,"div",18),Pw(21,Ee,2,2,"ds-card"),Ds(22,"ds-form-actions")(23,"button",19),MC(24),pl(),Pw(25,Fe,2,2,"button",20),Ds(26,"button",21),mg("click",function(){df(t);let a=Xw();return ff(a.cancel())}),MC(27,"Cancel"),pl()()();}if(i&2){let t,n=Xw();ug("formGroup",n.form),jE(),ug("disabled",n.isEditMode()),jE(),Hw(n.scopeOptions),jE(3),ug("formControl",n.typeControl),MI(),jE(3),Hw(n.integrationTypes()),jE(3),ug("formControl",n.nameControl),MI(),jE(2),ug("formControl",n.descriptionControl),MI(),jE(2),ug("formControl",n.authSettingNameControl),MI(),jE(),ug("ngValue",null),jE(2),Hw(n.authSettingOptions()),jE(2),Lw(n.isAutoGrantable()?20:-1),jE(),Lw((t=n.schema())?21:-1,t),jE(2),ug("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),jE(),vl(" ",n.isEditMode()?"Save changes":"Create"," "),jE(),Lw(n.isEditMode()?25:-1);}}var Ve=new Set(["platform","namespace","userOnNs","userGlobal"]),w=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ve=class i{route=g(W);router=g(F);destroyRef=g(Ie$1);state=g(O);integrationTypeController=g(_);authSettingState=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?Cr(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new pt({name:new Te$1("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te$1(null),type:new Te$1("",{nonNullable:true,validators:[fn.required]}),scope:new Te$1("namespace",{nonNullable:true}),autoGrant:new Te$1(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);isExporting=Ui(false);scopeOptions=[{value:"platform",label:w.platform},{value:"namespace",label:w.namespace},{value:"userOnNs",label:w.userOnNs},{value:"userGlobal",label:w.userGlobal}];authSettingNameControl=new Te$1(null);loadedAuthSettings=Ui([]);authSettingsLoaded=Ui(false);savedAuthSettingName=Ui(null);authSettingsScope$=new ue;authSettingOptions=KC(()=>{let e=this.loadedAuthSettings(),t=this.savedAuthSettingName();return !t||!this.authSettingsLoaded()||e.some(n=>n.value===t)?e:[...e,{value:t,label:`${t} (not found)`}]});paramsValue=Ui(null);initialParams=Ui(null);integrationTypes=F$1(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=F$1(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});scopeValue=F$1(this.form.controls.scope.valueChanges,{initialValue:this.form.controls.scope.value});schema=KC(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});isAutoGrantable=KC(()=>{let e=this.selectedType();return e?this.integrationTypes().find(t=>t.type===e)?.autoGrantable??false:false});autoGrantReach=KC(()=>{switch(this.scopeValue()){case "platform":return "every agent of this environment";case "namespace":return "every agent of this namespace";default:return "your own runs"}});existingConfig=null;constructor(){this.authSettingsScope$.pipe(fa(e=>this.loadAuthSettingLayers(e)),U(this.destroyRef)).subscribe(e=>{this.loadedAuthSettings.set(this.toAuthSettingOptions(e)),this.authSettingsLoaded.set(true);}),Af(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let e=this.route.snapshot.paramMap,t=this.route.snapshot.queryParamMap,n=e.get("integrationId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable(),this.loadAuthSettingsForScope("platform");return}let a=this.parseScope(t.get("scope"));this.scopeControl.setValue(a),this.loadAuthSettingsForScope(a),this.scopeControl.valueChanges.pipe(U(this.destroyRef)).subscribe(D=>{this.loadAuthSettingsForScope(D);});let p=t.get("template");p&&this.hydrateFromTemplate(p);}parseScope(e){return e&&Ve.has(e)?e:"namespace"}deriveScopeFromConfig(e){return !e.userId&&!e.namespaceId?"platform":e.userId?e.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.existingConfig=t;let n=this.deriveScopeFromConfig(t);this.scopeControl.setValue(n),this.applyConfigToForm(t),this.loadAuthSettingsForScope(n),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[IntegrationForm] Could not load config '${e}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.applyConfigToForm(t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:t=>{console.warn(`[IntegrationForm] Could not hydrate from template ${e}:`,t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(e){this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.typeControl.setValue(e.integrationType),this.initialParams.set(e.parameters),this.paramsValue.set(e.parameters),this.authSettingNameControl.setValue(e.authSettingName??null),this.savedAuthSettingName.set(e.authSettingName??null),this.autoGrantControl.setValue(e.autoGrant??false);}loadAuthSettingsForScope(e){this.authSettingsLoaded.set(false),this.authSettingsScope$.next(e);}loadAuthSettingLayers(e){let t=(p,D)=>D.pipe(da(()=>Cr([])),ne(Se=>({label:p,settings:Se}))),n=t("platform",this.authSettingState.loadPlatformSettings()),a=t("mine",this.authSettingState.loadUserSettings("global"));return e==="platform"||e==="userGlobal"?Ty([a,n]):Ty([t("mine",this.authSettingState.loadUserSettings(this.namespaceId)),t("namespace",this.authSettingState.loadNamespaceSettings(this.namespaceId)),a,n])}toAuthSettingOptions(e){let t=new Map;for(let{label:n,settings:a}of e)for(let{name:p}of a)p&&t.set(p,(t.get(p)??new Set).add(n));return [...t.entries()].sort(([n],[a])=>n.localeCompare(a)).map(([n,a])=>({value:n,label:`${n} (${[...a].join(", ")})`}))}onParamsChange(e){this.paramsValue.set(e);}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let e=this.descriptionControl.value?.trim(),t={name:this.nameControl.value.trim(),description:e||null,integrationType:this.typeControl.value,parameters:this.paramsValue(),authSettingName:this.authSettingNameControl.value||null,autoGrant:this.isAutoGrantable()&&this.autoGrantControl.value},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,t,n,this.existingConfig):this.state.create(t,n,this.namespaceId??null)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let e=this.existingConfig?.id;!e||this.isExporting()||(this.isExporting.set(true),this.state.exportAsYaml(e).pipe(U(this.destroyRef)).subscribe({next:t=>{let n=new Blob([t],{type:"application/yaml"}),a=URL.createObjectURL(n),p=document.createElement("a");p.href=a,p.download=`${this.existingConfig?.name??"integration"}.yaml`,p.click(),URL.revokeObjectURL(a),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"]);}trackByType(e,t){return t.type}trackByScope(e,t){return t.value}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=mw({type:i,selectors:[["agentos-integration-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to integrations",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Scope",3,"disabled"],["dsCheck",""],["label","Type","controlId","integration-type","required",""],["dsControl","","id","integration-type",3,"formControl"],["value","","disabled",""],[3,"value"],["label","Name","controlId","integration-name","required",""],["dsControl","","id","integration-name","type","text","placeholder","Integration name","autocomplete","off",3,"formControl"],["label","Description","controlId","integration-description"],["dsControl","","id","integration-description","placeholder","Optional description","rows","3",3,"formControl"],["label","Auth Setting","controlId","integration-auth-setting","hint","Only the name is saved. It is resolved at run time for the user running the case, the most specific layer winning (user on this namespace > namespace > user > platform), so a shared integration can rely on each user's own auth setting of that name."],["dsControl","","id","integration-auth-setting",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-stack--sm"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["type","radio",3,"value","formControl","disabled"],["type","checkbox",3,"formControl"],[3,"valueChange","schema","value"],["dsButton","","type","button",3,"click","disabled"]],template:function(t,n){t&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return n.cancel()}),MC(3," \u2190 Integrations "),pl()(),Pw(4,_e,2,0,"p",2)(5,Te,28,12,"form",3),pl()),t&2&&(jE(),ug("title",n.isEditMode()?"Edit integration":"New integration"),jE(3),Lw(n.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,on,at,an,rn,Ut,nd,bo,xo,Lt,vn,Gt,pa,mo,po,Vn,An,Wt],encapsulation:2})};export{ve as IntegrationFormComponent};
1
+ import {v}from'./chunk-CU5VTmsN.js';import {I}from'./chunk-DV-Eelxi.js';import {O}from'./chunk-bqhgjnlz.js';import {g,W,F,I as Ie$1,a8 as _,a9 as F$1,aa as Cr,U as Ui,ab as ue,K as KC,a1 as fa,E as U,o as Af,ac as Ty,m as mw,D as Ds,R as mg,M as MC,a as pl,P as Pw,j as jE,Q as ug,L as Lw,a2 as da,ad as ne,q as qw,i as Vw,ae as kw,T as SI,l as lg,X as Xw,H as Hw,Y as MI,v as vl,O as Og,r as df,s as ff}from'./main-CEEMKDJT.js';import {p as pt,T as Te$1,a as fn,c as pn,h as hn,d as cn,r as ln,e as dn,o as on,g as at,i as an,t as rn,U as Ut,n as nd,l as bo,x as xo,L as Lt,u as vn,G as Gt,w as pa,m as mo,b as po,V as Vn,A as An,W as Wt}from'./chunk-Cq4k0Mf8.js';import'./chunk-CQZDxK4J.js';var be=(i,e)=>e.value;function _e(i,e){i&1&&(Ds(0,"p",2),MC(1,"Loading\u2026"),pl());}function xe(i,e){if(i&1&&(Ds(0,"label",6),lg(1,"input",22),SI(),MC(2),pl()),i&2){let t=e.$implicit,n=Xw(2);jE(),ug("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),MI(),jE(),vl(" ",t.label," ");}}function Ie(i,e){if(i&1&&(Ds(0,"option",10),MC(1),pl()),i&2){let t=e.$implicit;ug("value",t.type),jE(),Og(t.displayName);}}function Ne(i,e){if(i&1&&(Ds(0,"option",10),MC(1),pl()),i&2){let t=e.$implicit;ug("value",t.value),jE(),Og(t.label);}}function Ae(i,e){if(i&1&&(Ds(0,"div",18)(1,"label",6),lg(2,"input",23),SI(),MC(3," Grant automatically "),pl(),Ds(4,"p",2),MC(5),pl()()),i&2){let t=Xw(2);jE(2),ug("formControl",t.autoGrantControl),MI(),jE(3),vl(" Give this integration to ",t.autoGrantReach(),", without each agent having to declare it. An agent can still opt out by mapping this configuration to an empty tool list. ");}}function Ee(i,e){if(i&1){let t=qw();Ds(0,"ds-card")(1,"ds-json-schema-form",24),mg("valueChange",function(a){df(t);let p=Xw(2);return ff(p.onParamsChange(a))}),pl()();}if(i&2){let t=Xw(2);jE(),ug("schema",e)("value",t.initialParams());}}function Fe(i,e){if(i&1){let t=qw();Ds(0,"button",25),mg("click",function(){df(t);let a=Xw(2);return ff(a.exportYaml())}),MC(1),pl();}if(i&2){let t=Xw(2);ug("disabled",t.isExporting()),jE(),vl(" ",t.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Te(i,e){if(i&1){let t=qw();Ds(0,"form",4),mg("ngSubmit",function(){df(t);let a=Xw();return ff(a.submit())}),Ds(1,"ds-fieldset",5),Vw(2,xe,3,4,"label",6,kw().trackByScope,true),pl(),Ds(4,"ds-form-field",7)(5,"select",8)(6,"option",9),MC(7,"Select type"),pl(),Vw(8,Ie,2,2,"option",10,kw().trackByType,true),pl(),SI(),pl(),Ds(10,"ds-form-field",11),lg(11,"input",12),SI(),pl(),Ds(12,"ds-form-field",13),lg(13,"textarea",14),SI(),pl(),Ds(14,"ds-form-field",15)(15,"select",16)(16,"option",17),MC(17,"None"),pl(),Vw(18,Ne,2,2,"option",10,be),pl(),SI(),pl(),Pw(20,Ae,6,2,"div",18),Pw(21,Ee,2,2,"ds-card"),Ds(22,"ds-form-actions")(23,"button",19),MC(24),pl(),Pw(25,Fe,2,2,"button",20),Ds(26,"button",21),mg("click",function(){df(t);let a=Xw();return ff(a.cancel())}),MC(27,"Cancel"),pl()()();}if(i&2){let t,n=Xw();ug("formGroup",n.form),jE(),ug("disabled",n.isEditMode()),jE(),Hw(n.scopeOptions),jE(3),ug("formControl",n.typeControl),MI(),jE(3),Hw(n.integrationTypes()),jE(3),ug("formControl",n.nameControl),MI(),jE(2),ug("formControl",n.descriptionControl),MI(),jE(2),ug("formControl",n.authSettingNameControl),MI(),jE(),ug("ngValue",null),jE(2),Hw(n.authSettingOptions()),jE(2),Lw(n.isAutoGrantable()?20:-1),jE(),Lw((t=n.schema())?21:-1,t),jE(2),ug("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),jE(),vl(" ",n.isEditMode()?"Save changes":"Create"," "),jE(),Lw(n.isEditMode()?25:-1);}}var Ve=new Set(["platform","namespace","userOnNs","userGlobal"]),w=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ve=class i{route=g(W);router=g(F);destroyRef=g(Ie$1);state=g(O);integrationTypeController=g(_);authSettingState=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?Cr(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new pt({name:new Te$1("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te$1(null),type:new Te$1("",{nonNullable:true,validators:[fn.required]}),scope:new Te$1("namespace",{nonNullable:true}),autoGrant:new Te$1(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);isExporting=Ui(false);scopeOptions=[{value:"platform",label:w.platform},{value:"namespace",label:w.namespace},{value:"userOnNs",label:w.userOnNs},{value:"userGlobal",label:w.userGlobal}];authSettingNameControl=new Te$1(null);loadedAuthSettings=Ui([]);authSettingsLoaded=Ui(false);savedAuthSettingName=Ui(null);authSettingsScope$=new ue;authSettingOptions=KC(()=>{let e=this.loadedAuthSettings(),t=this.savedAuthSettingName();return !t||!this.authSettingsLoaded()||e.some(n=>n.value===t)?e:[...e,{value:t,label:`${t} (not found)`}]});paramsValue=Ui(null);initialParams=Ui(null);integrationTypes=F$1(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=F$1(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});scopeValue=F$1(this.form.controls.scope.valueChanges,{initialValue:this.form.controls.scope.value});schema=KC(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});isAutoGrantable=KC(()=>{let e=this.selectedType();return e?this.integrationTypes().find(t=>t.type===e)?.autoGrantable??false:false});autoGrantReach=KC(()=>{switch(this.scopeValue()){case "platform":return "every agent of this environment";case "namespace":return "every agent of this namespace";default:return "your own runs"}});existingConfig=null;constructor(){this.authSettingsScope$.pipe(fa(e=>this.loadAuthSettingLayers(e)),U(this.destroyRef)).subscribe(e=>{this.loadedAuthSettings.set(this.toAuthSettingOptions(e)),this.authSettingsLoaded.set(true);}),Af(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let e=this.route.snapshot.paramMap,t=this.route.snapshot.queryParamMap,n=e.get("integrationId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable(),this.loadAuthSettingsForScope("platform");return}let a=this.parseScope(t.get("scope"));this.scopeControl.setValue(a),this.loadAuthSettingsForScope(a),this.scopeControl.valueChanges.pipe(U(this.destroyRef)).subscribe(D=>{this.loadAuthSettingsForScope(D);});let p=t.get("template");p&&this.hydrateFromTemplate(p);}parseScope(e){return e&&Ve.has(e)?e:"namespace"}deriveScopeFromConfig(e){return !e.userId&&!e.namespaceId?"platform":e.userId?e.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.existingConfig=t;let n=this.deriveScopeFromConfig(t);this.scopeControl.setValue(n),this.applyConfigToForm(t),this.loadAuthSettingsForScope(n),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[IntegrationForm] Could not load config '${e}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.applyConfigToForm(t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:t=>{console.warn(`[IntegrationForm] Could not hydrate from template ${e}:`,t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(e){this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.typeControl.setValue(e.integrationType),this.initialParams.set(e.parameters),this.paramsValue.set(e.parameters),this.authSettingNameControl.setValue(e.authSettingName??null),this.savedAuthSettingName.set(e.authSettingName??null),this.autoGrantControl.setValue(e.autoGrant??false);}loadAuthSettingsForScope(e){this.authSettingsLoaded.set(false),this.authSettingsScope$.next(e);}loadAuthSettingLayers(e){let t=(p,D)=>D.pipe(da(()=>Cr([])),ne(Se=>({label:p,settings:Se}))),n=t("platform",this.authSettingState.loadPlatformSettings()),a=t("mine",this.authSettingState.loadUserSettings("global"));return e==="platform"||e==="userGlobal"?Ty([a,n]):Ty([t("mine",this.authSettingState.loadUserSettings(this.namespaceId)),t("namespace",this.authSettingState.loadNamespaceSettings(this.namespaceId)),a,n])}toAuthSettingOptions(e){let t=new Map;for(let{label:n,settings:a}of e)for(let{name:p}of a)p&&t.set(p,(t.get(p)??new Set).add(n));return [...t.entries()].sort(([n],[a])=>n.localeCompare(a)).map(([n,a])=>({value:n,label:`${n} (${[...a].join(", ")})`}))}onParamsChange(e){this.paramsValue.set(e);}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let e=this.descriptionControl.value?.trim(),t={name:this.nameControl.value.trim(),description:e||null,integrationType:this.typeControl.value,parameters:this.paramsValue(),authSettingName:this.authSettingNameControl.value||null,autoGrant:this.isAutoGrantable()&&this.autoGrantControl.value},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,t,n,this.existingConfig):this.state.create(t,n,this.namespaceId??null)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let e=this.existingConfig?.id;!e||this.isExporting()||(this.isExporting.set(true),this.state.exportAsYaml(e).pipe(U(this.destroyRef)).subscribe({next:t=>{let n=new Blob([t],{type:"application/yaml"}),a=URL.createObjectURL(n),p=document.createElement("a");p.href=a,p.download=`${this.existingConfig?.name??"integration"}.yaml`,p.click(),URL.revokeObjectURL(a),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"]);}trackByType(e,t){return t.type}trackByScope(e,t){return t.value}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=mw({type:i,selectors:[["agentos-integration-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to integrations",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Scope",3,"disabled"],["dsCheck",""],["label","Type","controlId","integration-type","required",""],["dsControl","","id","integration-type",3,"formControl"],["value","","disabled",""],[3,"value"],["label","Name","controlId","integration-name","required",""],["dsControl","","id","integration-name","type","text","placeholder","Integration name","autocomplete","off",3,"formControl"],["label","Description","controlId","integration-description"],["dsControl","","id","integration-description","placeholder","Optional description","rows","3",3,"formControl"],["label","Auth Setting","controlId","integration-auth-setting","hint","Only the name is saved. It is resolved at run time for the user running the case, the most specific layer winning (user on this namespace > namespace > user > platform), so a shared integration can rely on each user's own auth setting of that name."],["dsControl","","id","integration-auth-setting",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-stack--sm"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["type","radio",3,"value","formControl","disabled"],["type","checkbox",3,"formControl"],[3,"valueChange","schema","value"],["dsButton","","type","button",3,"click","disabled"]],template:function(t,n){t&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return n.cancel()}),MC(3," \u2190 Integrations "),pl()(),Pw(4,_e,2,0,"p",2)(5,Te,28,12,"form",3),pl()),t&2&&(jE(),ug("title",n.isEditMode()?"Edit integration":"New integration"),jE(3),Lw(n.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,on,at,an,rn,Ut,nd,bo,xo,Lt,vn,Gt,pa,mo,po,Vn,An,Wt],encapsulation:2})};export{ve as IntegrationFormComponent};
@@ -1 +1 @@
1
- import {o}from'./chunk-BIYmUvfG.js';import {p as pt,T as Te,a as fn,U as Ut,n as nd,L as Lt,m as mo,b as po,V as Vn,A as An,c as pn,h as hn,d as cn,e as dn,C as mn,g as at,i as an,j as ko}from'./chunk-DxKo0dCS.js';import {g,W,F,I as Ie,U as Ui,E as U,N as x,G as w,m as mw,au as $t,D as Ds,R as mg,M as MC,a as pl,P as Pw,j as jE,Q as ug,L as Lw,X as Xw,q as qw,l as lg,T as SI,i as Vw,am as jw,Y as MI,H as Hw,v as vl,r as df,s as ff,O as Og}from'./main-2IBYD645.js';function ie(i,t){if(i&1&&(Ds(0,"a",2),MC(1,"View skill \u2192"),pl()),i&2){let e=Xw();ug("routerLink",e.inspectRoute());}}function oe(i,t){i&1&&(Ds(0,"ds-tag",3),MC(1,"Platform level"),pl());}function ne(i,t){i&1&&(Ds(0,"p",4),MC(1,"Loading\u2026"),pl());}function re(i,t){if(i&1){let e=qw();Ds(0,"div",15)(1,"div",19),lg(2,"input",20),SI(),Ds(3,"button",21),mg("click",function(){let l=df(e).$implicit,te=Xw(2);return ff(te.removeResource(l))}),MC(4," \xD7 "),pl()(),lg(5,"textarea",22),SI(),pl();}if(i&2){let e=t.$implicit;jE(2),ug("formControl",e.path),MI(),jE(3),ug("formControl",e.content),MI();}}function ae(i,t){if(i&1&&(Ds(0,"ds-notice"),MC(1),pl()),i&2){let e=Xw(2);jE(),Og(e.errorMessage());}}function se(i,t){if(i&1){let e=qw();Ds(0,"form",6),mg("ngSubmit",function(){df(e);let l=Xw();return ff(l.submit())}),Ds(1,"ds-form-field",7),lg(2,"input",8),SI(),pl(),Ds(3,"ds-form-field",9),lg(4,"textarea",10),SI(),pl(),Ds(5,"ds-form-field",11),lg(6,"textarea",12),SI(),pl(),Ds(7,"ds-form-field",13)(8,"div",14),Vw(9,re,6,2,"div",15,jw),Ds(11,"div")(12,"button",16),mg("click",function(){df(e);let l=Xw();return ff(l.addResource())}),MC(13,"+ Add resource"),pl()()()(),Pw(14,ae,2,1,"ds-notice"),Ds(15,"ds-form-actions")(16,"button",17),MC(17),pl(),Ds(18,"button",18),mg("click",function(){df(e);let l=Xw();return ff(l.cancel())}),MC(19,"Cancel"),pl()()();}if(i&2){let e=Xw();ug("formGroup",e.form),jE(),ug("error",e.nameControl.invalid&&e.nameControl.touched?"A valid, non-empty name is required.":null),jE(),ug("formControl",e.nameControl),MI(),jE(2),ug("formControl",e.descriptionControl),MI(),jE(2),ug("formControl",e.bodyControl),MI(),jE(3),Hw(e.resourceRows()),jE(5),Lw(e.errorMessage()?14:-1),jE(2),ug("disabled",e.form.invalid||e.isSubmitting()),jE(),vl(" ",e.isSubmitting()?"Saving\u2026":e.isEditMode()?"Save changes":"Create"," ");}}var ee=class i{route=g(W);router=g(F);destroyRef=g(Ie);skillState=g(o);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isEditMode=Ui(false);isLoading=Ui(false);isSubmitting=Ui(false);errorMessage=Ui(null);existingSkill=null;form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.maxLength(100),fn.pattern(/^[a-zA-Z0-9_.-]+( [a-zA-Z0-9_.-]+)*$/)]}),description:new Te("",{nonNullable:true,validators:[fn.required,fn.maxLength(500),fn.pattern(/\S/)]}),body:new Te("",{nonNullable:true,validators:[fn.required,fn.pattern(/\S/)]})});resourceRows=Ui([]);get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get bodyControl(){return this.form.controls.body}ngOnInit(){let t=this.route.snapshot.paramMap.get("skillId");t&&(this.isEditMode.set(true),this.isLoading.set(true),this.skillState.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{if(e.readOnly){this.router.navigate(this.inspectRoute());return}this.existingSkill=e,this.form.patchValue({name:e.name,description:e.description,body:e.body}),this.resourceRows.set(Object.entries(e.resources??{}).map(([o,l])=>({path:new Te(o,{nonNullable:true}),content:new Te(l,{nonNullable:true})}))),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}}));}addResource(){this.resourceRows.update(t=>[...t,{path:new Te("",{nonNullable:true}),content:new Te("",{nonNullable:true})}]);}removeResource(t){this.resourceRows.update(e=>e.filter(o=>o!==t));}buildResourcesPayload(){let t=this.resourceRows().map(e=>[e.path.value.trim(),e.content.value]).filter(([e])=>e.length>0);return Object.fromEntries(t)}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=x(w({},this.existingSkill??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value.trim(),body:this.bodyControl.value,resources:this.buildResourcesPayload()});(this.isEditMode()?this.skillState.update(this.existingSkill?.id??"",t):this.skillState.create(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:o=>{this.isSubmitting.set(false),o.status===409?this.errorMessage.set(`A skill named "${this.nameControl.value.trim()}" already exists in this scope.`):o.status===400?this.errorMessage.set("The server rejected this skill. A filesystem-backed skill cannot be modified."):this.errorMessage.set("Saving the skill failed.");}});}cancel(){this.navigateBack();}inspectRoute(){let t=this.route.snapshot.paramMap.get("skillId")??"";return this.isPlatformMode?["/agentos","admin","skills",t,"inspect"]:["/agentos",this.namespaceId,"skills",t,"inspect"]}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","skills"]):this.router.navigate(["/agentos",this.namespaceId,"skills"]);}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=mw({type:i,selectors:[["agentos-skill-form"]],decls:8,vars:4,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to skills",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],["headerMeta","","variant","outline"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","skill-name","hint","The value an agent's skillSelectors entry must match. Letters, digits, dash, dot, underscore and single spaces; 100 characters max.",3,"error"],["dsControl","","id","skill-name","type","text","autocomplete","off",3,"formControl"],["label","Description","controlId","skill-description","hint","This is what the agent sees in its skill catalog \u2014 it decides from this line alone whether to read the skill. 500 characters max."],["dsControl","","id","skill-description","rows","2",3,"formControl"],["label","Body","controlId","skill-body","hint","Markdown instructions returned verbatim by the readSkill tool when the agent asks for this skill."],["dsControl","","mono","","id","skill-body","rows","16",3,"formControl"],["label","Resources","hint","Optional files the agent can read with readSkillResource, by relative path."],[1,"ds-stack"],[1,"ds-stack","ds-stack--sm"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],[1,"ds-inline"],["dsControl","","mono","","type","text","placeholder","e.g. references/checklist.md","aria-label","Resource path","autocomplete","off",3,"formControl"],["dsButton","","variant","icon-danger","type","button","title","Remove","aria-label","Remove resource",3,"click"],["dsControl","","mono","","rows","4","aria-label","Resource content",3,"formControl"]],template:function(e,o){e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return o.cancel()}),MC(3,"\u2190 Skills"),pl(),Pw(4,ie,2,1,"a",2),Pw(5,oe,2,0,"ds-tag",3),pl(),Pw(6,ne,2,0,"p",4)(7,se,20,8,"form",5),pl()),e&2&&(jE(),ug("title",o.isEditMode()?"Edit skill":"New skill"),jE(3),Lw(o.isEditMode()?4:-1),jE(),Lw(o.isPlatformMode?5:-1),jE(),Lw(o.isLoading()?6:7));},dependencies:[Ut,nd,Lt,mo,po,Vn,An,$t,pn,hn,cn,dn,mn,at,an,ko],encapsulation:2})};export{ee as SkillFormComponent};
1
+ import {o}from'./chunk-Oq3ZvW7J.js';import {p as pt,T as Te,a as fn,U as Ut,n as nd,L as Lt,m as mo,b as po,V as Vn,A as An,c as pn,h as hn,d as cn,e as dn,C as mn,g as at,i as an,j as ko}from'./chunk-Cq4k0Mf8.js';import {g,W,F,I as Ie,U as Ui,E as U,N as x,G as w,m as mw,au as $t,D as Ds,R as mg,M as MC,a as pl,P as Pw,j as jE,Q as ug,L as Lw,X as Xw,q as qw,l as lg,T as SI,i as Vw,am as jw,Y as MI,H as Hw,v as vl,r as df,s as ff,O as Og}from'./main-CEEMKDJT.js';function ie(i,t){if(i&1&&(Ds(0,"a",2),MC(1,"View skill \u2192"),pl()),i&2){let e=Xw();ug("routerLink",e.inspectRoute());}}function oe(i,t){i&1&&(Ds(0,"ds-tag",3),MC(1,"Platform level"),pl());}function ne(i,t){i&1&&(Ds(0,"p",4),MC(1,"Loading\u2026"),pl());}function re(i,t){if(i&1){let e=qw();Ds(0,"div",15)(1,"div",19),lg(2,"input",20),SI(),Ds(3,"button",21),mg("click",function(){let l=df(e).$implicit,te=Xw(2);return ff(te.removeResource(l))}),MC(4," \xD7 "),pl()(),lg(5,"textarea",22),SI(),pl();}if(i&2){let e=t.$implicit;jE(2),ug("formControl",e.path),MI(),jE(3),ug("formControl",e.content),MI();}}function ae(i,t){if(i&1&&(Ds(0,"ds-notice"),MC(1),pl()),i&2){let e=Xw(2);jE(),Og(e.errorMessage());}}function se(i,t){if(i&1){let e=qw();Ds(0,"form",6),mg("ngSubmit",function(){df(e);let l=Xw();return ff(l.submit())}),Ds(1,"ds-form-field",7),lg(2,"input",8),SI(),pl(),Ds(3,"ds-form-field",9),lg(4,"textarea",10),SI(),pl(),Ds(5,"ds-form-field",11),lg(6,"textarea",12),SI(),pl(),Ds(7,"ds-form-field",13)(8,"div",14),Vw(9,re,6,2,"div",15,jw),Ds(11,"div")(12,"button",16),mg("click",function(){df(e);let l=Xw();return ff(l.addResource())}),MC(13,"+ Add resource"),pl()()()(),Pw(14,ae,2,1,"ds-notice"),Ds(15,"ds-form-actions")(16,"button",17),MC(17),pl(),Ds(18,"button",18),mg("click",function(){df(e);let l=Xw();return ff(l.cancel())}),MC(19,"Cancel"),pl()()();}if(i&2){let e=Xw();ug("formGroup",e.form),jE(),ug("error",e.nameControl.invalid&&e.nameControl.touched?"A valid, non-empty name is required.":null),jE(),ug("formControl",e.nameControl),MI(),jE(2),ug("formControl",e.descriptionControl),MI(),jE(2),ug("formControl",e.bodyControl),MI(),jE(3),Hw(e.resourceRows()),jE(5),Lw(e.errorMessage()?14:-1),jE(2),ug("disabled",e.form.invalid||e.isSubmitting()),jE(),vl(" ",e.isSubmitting()?"Saving\u2026":e.isEditMode()?"Save changes":"Create"," ");}}var ee=class i{route=g(W);router=g(F);destroyRef=g(Ie);skillState=g(o);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isEditMode=Ui(false);isLoading=Ui(false);isSubmitting=Ui(false);errorMessage=Ui(null);existingSkill=null;form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.maxLength(100),fn.pattern(/^[a-zA-Z0-9_.-]+( [a-zA-Z0-9_.-]+)*$/)]}),description:new Te("",{nonNullable:true,validators:[fn.required,fn.maxLength(500),fn.pattern(/\S/)]}),body:new Te("",{nonNullable:true,validators:[fn.required,fn.pattern(/\S/)]})});resourceRows=Ui([]);get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get bodyControl(){return this.form.controls.body}ngOnInit(){let t=this.route.snapshot.paramMap.get("skillId");t&&(this.isEditMode.set(true),this.isLoading.set(true),this.skillState.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{if(e.readOnly){this.router.navigate(this.inspectRoute());return}this.existingSkill=e,this.form.patchValue({name:e.name,description:e.description,body:e.body}),this.resourceRows.set(Object.entries(e.resources??{}).map(([o,l])=>({path:new Te(o,{nonNullable:true}),content:new Te(l,{nonNullable:true})}))),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}}));}addResource(){this.resourceRows.update(t=>[...t,{path:new Te("",{nonNullable:true}),content:new Te("",{nonNullable:true})}]);}removeResource(t){this.resourceRows.update(e=>e.filter(o=>o!==t));}buildResourcesPayload(){let t=this.resourceRows().map(e=>[e.path.value.trim(),e.content.value]).filter(([e])=>e.length>0);return Object.fromEntries(t)}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=x(w({},this.existingSkill??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value.trim(),body:this.bodyControl.value,resources:this.buildResourcesPayload()});(this.isEditMode()?this.skillState.update(this.existingSkill?.id??"",t):this.skillState.create(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:o=>{this.isSubmitting.set(false),o.status===409?this.errorMessage.set(`A skill named "${this.nameControl.value.trim()}" already exists in this scope.`):o.status===400?this.errorMessage.set("The server rejected this skill. A filesystem-backed skill cannot be modified."):this.errorMessage.set("Saving the skill failed.");}});}cancel(){this.navigateBack();}inspectRoute(){let t=this.route.snapshot.paramMap.get("skillId")??"";return this.isPlatformMode?["/agentos","admin","skills",t,"inspect"]:["/agentos",this.namespaceId,"skills",t,"inspect"]}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","skills"]):this.router.navigate(["/agentos",this.namespaceId,"skills"]);}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=mw({type:i,selectors:[["agentos-skill-form"]],decls:8,vars:4,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to skills",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],["headerMeta","","variant","outline"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","skill-name","hint","The value an agent's skillSelectors entry must match. Letters, digits, dash, dot, underscore and single spaces; 100 characters max.",3,"error"],["dsControl","","id","skill-name","type","text","autocomplete","off",3,"formControl"],["label","Description","controlId","skill-description","hint","This is what the agent sees in its skill catalog \u2014 it decides from this line alone whether to read the skill. 500 characters max."],["dsControl","","id","skill-description","rows","2",3,"formControl"],["label","Body","controlId","skill-body","hint","Markdown instructions returned verbatim by the readSkill tool when the agent asks for this skill."],["dsControl","","mono","","id","skill-body","rows","16",3,"formControl"],["label","Resources","hint","Optional files the agent can read with readSkillResource, by relative path."],[1,"ds-stack"],[1,"ds-stack","ds-stack--sm"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],[1,"ds-inline"],["dsControl","","mono","","type","text","placeholder","e.g. references/checklist.md","aria-label","Resource path","autocomplete","off",3,"formControl"],["dsButton","","variant","icon-danger","type","button","title","Remove","aria-label","Remove resource",3,"click"],["dsControl","","mono","","rows","4","aria-label","Resource content",3,"formControl"]],template:function(e,o){e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return o.cancel()}),MC(3,"\u2190 Skills"),pl(),Pw(4,ie,2,1,"a",2),Pw(5,oe,2,0,"ds-tag",3),pl(),Pw(6,ne,2,0,"p",4)(7,se,20,8,"form",5),pl()),e&2&&(jE(),ug("title",o.isEditMode()?"Edit skill":"New skill"),jE(3),Lw(o.isEditMode()?4:-1),jE(),Lw(o.isPlatformMode?5:-1),jE(),Lw(o.isLoading()?6:7));},dependencies:[Ut,nd,Lt,mo,po,Vn,An,$t,pn,hn,cn,dn,mn,at,an,ko],encapsulation:2})};export{ee as SkillFormComponent};
@@ -1,2 +1,2 @@
1
- import {I}from'./chunk-C6jJRCiO.js';import {g,W,aW as L,I as Ie,U as Ui,K as KC,aX as $e,ac as Ty,E as U,a2 as da,aa as Cr,m as mw,D as Ds,l as lg,P as Pw,a as pl,R as mg,j as jE,L as Lw,Q as ug,M as MC,q as qw,T as SI,i as Vw,X as Xw,Y as MI,H as Hw,v as vl,as as kg,r as df,s as ff,O as Og}from'./main-2IBYD645.js';import {a4 as id,l as bo,x as xo,L as Lt,u as vn,G as Gt,m as mo,a6 as da$1,aa as Ni,c as pn,h as hn,d as cn,r as ln,e as dn,C as mn,g as at,i as an,t as rn}from'./chunk-DxKo0dCS.js';import'./chunk-gjFAR1Z5.js';var oe=(i,t)=>t.id;function ae(i,t){i&1&&(Ds(0,"p",1),MC(1,"Loading\u2026"),pl());}function se(i,t){if(i&1&&(Ds(0,"ds-notice"),MC(1),pl()),i&2){let e=Xw(2);jE(),Og(e.errorMessage());}}function re(i,t){if(i&1){let e=qw();Ds(0,"div")(1,"button",23),mg("click",function(){df(e);let s=Xw(2);return ff(s.retryLoad())}),MC(2,"Retry loading"),pl()();}}function ce(i,t){if(i&1&&(lg(0,"br"),MC(1)),i&2){let e=Xw(3);jE(),vl("",e.association()?.checkoutFailureReason," ");}}function de(i,t){if(i&1&&(Ds(0,"ds-notice",3),MC(1),Pw(2,ce,2,1),pl()),i&2){let e=Xw(2);ug("tone",e.checkoutStatus()===e.CheckoutStatus.FAILED?"error":e.checkoutStatus()===e.CheckoutStatus.READY?"success":"neutral"),jE(),vl(" Repository: ",e.checkoutStatus()," "),jE(),Lw(e.association()?.checkoutFailureReason?2:-1);}}function le(i,t){if(i&1&&(Ds(0,"option",12),MC(1),pl()),i&2){let e=t.$implicit,c=Xw(2);ug("value",e.id),jE(),kg("",e.name," (",c.authTypeLabel(e.authType),")");}}function me(i,t){i&1&&(Ds(0,"p",13),MC(1," No usable auth setting in this namespace. Create a BEARER_TOKEN one first. "),pl());}function pe(i,t){if(i&1){let e=qw();Ds(0,"button",24),mg("click",function(){df(e);let s=Xw(2);return ff(s.remove())}),MC(1," Remove association "),pl();}if(i&2){let e=Xw(2);ug("disabled",!e.associationLoaded()||e.isSaving());}}function ue(i,t){if(i&1){let e=qw();Pw(0,se,2,1,"ds-notice"),Pw(1,re,3,0,"div"),Pw(2,de,3,3,"ds-notice",3),Ds(3,"ds-fieldset",4)(4,"ds-form-field",5)(5,"input",6),mg("ngModelChange",function(s){df(e);let u=Xw();return ff(u.repositoryUrl.set(s))}),pl(),SI(),pl(),Ds(6,"ds-form-field",7)(7,"input",8),mg("ngModelChange",function(s){df(e);let u=Xw();return ff(u.mainBranch.set(s))}),pl(),SI(),pl(),Ds(8,"ds-form-field",9)(9,"select",10),mg("ngModelChange",function(s){df(e);let u=Xw();return ff(u.serviceAuthSettingId.set(s))}),Ds(10,"option",11),MC(11,"Select an auth setting\u2026"),pl(),Vw(12,le,2,3,"option",12,oe),pl(),SI(),Pw(14,me,2,0,"p",13),pl()(),Ds(15,"ds-fieldset",14)(16,"div",15)(17,"label",16)(18,"input",17),mg("ngModelChange",function(s){df(e);let u=Xw();return ff(u.autoWorktree.set(s))}),pl(),SI(),MC(19," Offer a worktree to every new top-level case "),pl(),Ds(20,"p",18),MC(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. "),pl()(),Ds(22,"ds-form-field",19)(23,"input",20),mg("ngModelChange",function(s){df(e);let u=Xw();return ff(u.setupCommand.set(s))}),pl(),SI(),Ds(24,"p",13),MC(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. "),pl()()(),Ds(26,"ds-form-actions")(27,"button",21),mg("click",function(){df(e);let s=Xw();return ff(s.save())}),MC(28),pl(),Pw(29,pe,2,1,"button",22),pl();}if(i&2){let e=Xw();Lw(e.errorMessage()?0:-1),jE(),Lw(e.associationLoaded()?-1:1),jE(),Lw(e.isAssociated()&&e.checkoutStatus()?2:-1),jE(),ug("disabled",!e.associationLoaded()||e.isSaving()),jE(2),ug("ngModel",e.repositoryUrl()),MI(),jE(2),ug("ngModel",e.mainBranch()),MI(),jE(2),ug("ngModel",e.serviceAuthSettingId()),MI(),jE(3),Hw(e.eligibleAuthSettings()),jE(2),Lw(e.eligibleAuthSettings().length===0?14:-1),jE(),ug("disabled",!e.associationLoaded()||e.isSaving()),jE(3),ug("ngModel",e.autoWorktree()),MI(),jE(5),ug("ngModel",e.setupCommand()),MI(),jE(4),ug("disabled",!e.canSave()),jE(),vl(" ",e.isSaving()?"Saving\u2026":e.isAssociated()?"Update":"Associate"," "),jE(),Lw(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(L);authSettingState=g(I);destroyRef=g(Ie);isLoading=Ui(true);isSaving=Ui(false);confirmingRemove=Ui(false);associationLoaded=Ui(false);errorMessage=Ui(null);association=Ui(null);authSettings=Ui([]);repositoryUrl=Ui("");mainBranch=Ui("main");serviceAuthSettingId=Ui("");autoWorktree=Ui(false);setupCommand=Ui("");namespaceId="";isAssociated=KC(()=>this.association()?.associated===true);eligibleAuthSettings=KC(()=>this.authSettings().filter(t=>ge.includes(t.authType)));authTypeLabel(t){return he[t??""]??t??"unknown"}canSave=KC(()=>this.associationLoaded()&&!this.isLoading()&&!this.isSaving()&&this.repositoryUrl().trim().length>0&&this.serviceAuthSettingId().length>0);checkoutStatus=KC(()=>this.association()?.checkoutStatus??null);CheckoutStatus=$e;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),Ty({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),da(t=>(console.error("Failed to save the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),Cr(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),da(t=>(console.error("Failed to remove the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),Cr(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=mw({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&&(Ds(0,"ds-page"),lg(1,"ds-section-header",0),Pw(2,ae,2,0,"p",1)(3,ue,30,14),pl(),Ds(4,"ds-confirm-dialog",2),mg("confirmed",function(){return c.confirmRemove()})("cancelled",function(){return c.confirmingRemove.set(false)}),pl()),e&2&&(jE(2),Lw(c.isLoading()?2:3),jE(2),ug("open",c.confirmingRemove()));},dependencies:[id,bo,xo,Lt,vn,Gt,mo,da$1,Ni,pn,hn,cn,ln,dn,mn,at,an,rn],encapsulation:2})};
1
+ import {I}from'./chunk-DV-Eelxi.js';import {g,W,aW as L,I as Ie,U as Ui,K as KC,aX as $e,ac as Ty,E as U,a2 as da,aa as Cr,m as mw,D as Ds,l as lg,P as Pw,a as pl,R as mg,j as jE,L as Lw,Q as ug,M as MC,q as qw,T as SI,i as Vw,X as Xw,Y as MI,H as Hw,v as vl,as as kg,r as df,s as ff,O as Og}from'./main-CEEMKDJT.js';import {a4 as id,l as bo,x as xo,L as Lt,u as vn,G as Gt,m as mo,a6 as da$1,aa as Ni,c as pn,h as hn,d as cn,r as ln,e as dn,C as mn,g as at,i as an,t as rn}from'./chunk-Cq4k0Mf8.js';import'./chunk-CQZDxK4J.js';var oe=(i,t)=>t.id;function ae(i,t){i&1&&(Ds(0,"p",1),MC(1,"Loading\u2026"),pl());}function se(i,t){if(i&1&&(Ds(0,"ds-notice"),MC(1),pl()),i&2){let e=Xw(2);jE(),Og(e.errorMessage());}}function re(i,t){if(i&1){let e=qw();Ds(0,"div")(1,"button",23),mg("click",function(){df(e);let s=Xw(2);return ff(s.retryLoad())}),MC(2,"Retry loading"),pl()();}}function ce(i,t){if(i&1&&(lg(0,"br"),MC(1)),i&2){let e=Xw(3);jE(),vl("",e.association()?.checkoutFailureReason," ");}}function de(i,t){if(i&1&&(Ds(0,"ds-notice",3),MC(1),Pw(2,ce,2,1),pl()),i&2){let e=Xw(2);ug("tone",e.checkoutStatus()===e.CheckoutStatus.FAILED?"error":e.checkoutStatus()===e.CheckoutStatus.READY?"success":"neutral"),jE(),vl(" Repository: ",e.checkoutStatus()," "),jE(),Lw(e.association()?.checkoutFailureReason?2:-1);}}function le(i,t){if(i&1&&(Ds(0,"option",12),MC(1),pl()),i&2){let e=t.$implicit,c=Xw(2);ug("value",e.id),jE(),kg("",e.name," (",c.authTypeLabel(e.authType),")");}}function me(i,t){i&1&&(Ds(0,"p",13),MC(1," No usable auth setting in this namespace. Create a BEARER_TOKEN one first. "),pl());}function pe(i,t){if(i&1){let e=qw();Ds(0,"button",24),mg("click",function(){df(e);let s=Xw(2);return ff(s.remove())}),MC(1," Remove association "),pl();}if(i&2){let e=Xw(2);ug("disabled",!e.associationLoaded()||e.isSaving());}}function ue(i,t){if(i&1){let e=qw();Pw(0,se,2,1,"ds-notice"),Pw(1,re,3,0,"div"),Pw(2,de,3,3,"ds-notice",3),Ds(3,"ds-fieldset",4)(4,"ds-form-field",5)(5,"input",6),mg("ngModelChange",function(s){df(e);let u=Xw();return ff(u.repositoryUrl.set(s))}),pl(),SI(),pl(),Ds(6,"ds-form-field",7)(7,"input",8),mg("ngModelChange",function(s){df(e);let u=Xw();return ff(u.mainBranch.set(s))}),pl(),SI(),pl(),Ds(8,"ds-form-field",9)(9,"select",10),mg("ngModelChange",function(s){df(e);let u=Xw();return ff(u.serviceAuthSettingId.set(s))}),Ds(10,"option",11),MC(11,"Select an auth setting\u2026"),pl(),Vw(12,le,2,3,"option",12,oe),pl(),SI(),Pw(14,me,2,0,"p",13),pl()(),Ds(15,"ds-fieldset",14)(16,"div",15)(17,"label",16)(18,"input",17),mg("ngModelChange",function(s){df(e);let u=Xw();return ff(u.autoWorktree.set(s))}),pl(),SI(),MC(19," Offer a worktree to every new top-level case "),pl(),Ds(20,"p",18),MC(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. "),pl()(),Ds(22,"ds-form-field",19)(23,"input",20),mg("ngModelChange",function(s){df(e);let u=Xw();return ff(u.setupCommand.set(s))}),pl(),SI(),Ds(24,"p",13),MC(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. "),pl()()(),Ds(26,"ds-form-actions")(27,"button",21),mg("click",function(){df(e);let s=Xw();return ff(s.save())}),MC(28),pl(),Pw(29,pe,2,1,"button",22),pl();}if(i&2){let e=Xw();Lw(e.errorMessage()?0:-1),jE(),Lw(e.associationLoaded()?-1:1),jE(),Lw(e.isAssociated()&&e.checkoutStatus()?2:-1),jE(),ug("disabled",!e.associationLoaded()||e.isSaving()),jE(2),ug("ngModel",e.repositoryUrl()),MI(),jE(2),ug("ngModel",e.mainBranch()),MI(),jE(2),ug("ngModel",e.serviceAuthSettingId()),MI(),jE(3),Hw(e.eligibleAuthSettings()),jE(2),Lw(e.eligibleAuthSettings().length===0?14:-1),jE(),ug("disabled",!e.associationLoaded()||e.isSaving()),jE(3),ug("ngModel",e.autoWorktree()),MI(),jE(5),ug("ngModel",e.setupCommand()),MI(),jE(4),ug("disabled",!e.canSave()),jE(),vl(" ",e.isSaving()?"Saving\u2026":e.isAssociated()?"Update":"Associate"," "),jE(),Lw(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(L);authSettingState=g(I);destroyRef=g(Ie);isLoading=Ui(true);isSaving=Ui(false);confirmingRemove=Ui(false);associationLoaded=Ui(false);errorMessage=Ui(null);association=Ui(null);authSettings=Ui([]);repositoryUrl=Ui("");mainBranch=Ui("main");serviceAuthSettingId=Ui("");autoWorktree=Ui(false);setupCommand=Ui("");namespaceId="";isAssociated=KC(()=>this.association()?.associated===true);eligibleAuthSettings=KC(()=>this.authSettings().filter(t=>ge.includes(t.authType)));authTypeLabel(t){return he[t??""]??t??"unknown"}canSave=KC(()=>this.associationLoaded()&&!this.isLoading()&&!this.isSaving()&&this.repositoryUrl().trim().length>0&&this.serviceAuthSettingId().length>0);checkoutStatus=KC(()=>this.association()?.checkoutStatus??null);CheckoutStatus=$e;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),Ty({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),da(t=>(console.error("Failed to save the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),Cr(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),da(t=>(console.error("Failed to remove the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),Cr(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=mw({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&&(Ds(0,"ds-page"),lg(1,"ds-section-header",0),Pw(2,ae,2,0,"p",1)(3,ue,30,14),pl(),Ds(4,"ds-confirm-dialog",2),mg("confirmed",function(){return c.confirmRemove()})("cancelled",function(){return c.confirmingRemove.set(false)}),pl()),e&2&&(jE(2),Lw(c.isLoading()?2:3),jE(2),ug("open",c.confirmingRemove()));},dependencies:[id,bo,xo,Lt,vn,Gt,mo,da$1,Ni,pn,hn,cn,ln,dn,mn,at,an,rn],encapsulation:2})};
2
2
  export{ne as NamespaceGitComponent};
@@ -1 +1 @@
1
- import {z as k,O,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-DxKo0dCS.js';import {g,W as W$1,F,I as Ie,ag as U$1,$ as wr,U as Ui,a1 as fa,ac as Ty,a2 as da,aa as Cr,E as U$2,m as mw,D as Ds,R as mg,a as pl,M as MC,P as Pw,j as jE,Q as ug,L as Lw,X as Xw,O as Og,i as Vw,H as Hw,v as vl,q as qw,r as df,s as ff,f as cg}from'./main-2IBYD645.js';var J=(n,e)=>e.key;function U(n,e){if(n&1&&(Ds(0,"p",3),MC(1),pl()),n&2){let t=Xw();jE(),Og(t.deletion.error());}}function z(n,e){n&1&&(Ds(0,"p",4),MC(1,"Loading agent configs\u2026"),pl());}function G(n,e){n&1&&(Ds(0,"p",5),MC(1,"No agent configs available."),pl());}function Q(n,e){n&1&&(Ds(0,"p",4),MC(1,"No agent configs match the current filter."),pl());}function W(n,e){n&1&&(Ds(0,"ds-tag",18),MC(1,"Read-only"),pl());}function X(n,e){if(n&1){let t=qw();Ds(0,"button",22),mg("click",function(){df(t);let s=Xw(2).$implicit,d=Xw(2);return ff(d.launch(s))}),MC(1," Launch "),pl();}if(n&2){let t=Xw(2).$implicit;cg("aria-label","Launch "+t.config.name);}}function Y(n,e){if(n&1){let t=qw();Ds(0,"button",22),mg("click",function(){df(t);let s=Xw(2).$implicit,d=Xw(2);return ff(d.edit(s))}),MC(1," Edit "),pl();}if(n&2){let t=Xw(2).$implicit;cg("aria-label","Edit "+t.config.name);}}function Z(n,e){if(n&1){let t=qw();Ds(0,"button",22),mg("click",function(){df(t);let s=Xw().$implicit,d=Xw(2);return ff(d.inspect(s))}),MC(1," Inspect "),pl(),Pw(2,X,2,1,"button",23),Pw(3,Y,2,1,"button",23);}if(n&2){let t=Xw().$implicit,i=Xw(2);cg("aria-label","Inspect "+t.config.name),jE(2),Lw(i.canLaunch(t)?2:-1),jE(),Lw(t.scope==="namespace"?3:-1);}}function ee(n,e){if(n&1){let t=qw();Ds(0,"agentos-row-delete-action",24),mg("deleteRequested",function(){df(t);let s=Xw().$implicit,d=Xw(2);return ff(d.deletion.request(s.key))})("deleteConfirmed",function(){df(t);let s=Xw().$implicit,d=Xw(2);return ff(d.confirmDelete(s))})("deleteCancelled",function(){df(t);let s=Xw(3);return ff(s.deletion.cancel())}),pl();}if(n&2){let t=Xw().$implicit,i=Xw(2);ug("rowKey",t.key)("rowLabel",t.config.name)("state",i.deletion);}}function te(n,e){if(n&1&&(Ds(0,"tr",9)(1,"td",12),MC(2),pl(),Ds(3,"td",13),MC(4),pl(),Ds(5,"td",14),MC(6),pl(),Ds(7,"td",15)(8,"div",16)(9,"ds-tag",17),MC(10),pl(),Pw(11,W,2,0,"ds-tag",18),pl()(),Ds(12,"td",19)(13,"div",20),Pw(14,Z,4,3),Pw(15,ee,1,3,"agentos-row-delete-action",21),pl()()()),n&2){let t=e.$implicit,i=Xw(2);jE(2),Og(t.config.name),jE(2),vl(" ",t.config.description||"\u2014"," "),jE(2),Og(i.mode(t)),jE(3),ug("variant",t.scope==="platform"?"neutral":"accent"),jE(),Og(t.scope==="platform"?"Platform":"Namespace"),jE(),Lw(t.scope==="platform"?11:-1),jE(3),Lw(i.deletion.confirmingId()!==t.key?14:-1),jE(),Lw(t.scope==="namespace"?15:-1);}}function ne(n,e){if(n&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),MC(5,"Name"),pl(),Ds(6,"th",10),MC(7,"Description"),pl(),Ds(8,"th",10),MC(9,"Execution mode"),pl(),Ds(10,"th",10),MC(11,"Scope"),pl(),Ds(12,"th",10)(13,"span",11),MC(14,"Actions"),pl()()()(),Ds(15,"tbody",8),Vw(16,te,16,8,"tr",9,J),pl()()()),n&2){let t=Xw();jE(16),Hw(t.rowFilter.filteredRows());}}var H=class n{route=g(W$1);router=g(F);destroyRef=g(Ie);controller=g(U$1);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new wr(void 0);isLoading=Ui(true);deletion=k();rows=Ui([]);rowFilter=O(this.rows,e=>[e.config.name,e.config.description,this.mode(e),e.scope].filter(Boolean).join(" "));allConfigs$=this.refresh$.pipe(fa(()=>(this.isLoading.set(true),Ty({namespace:this.controller.listByParentAgentConfig(this.namespaceId),platform:this.controller.listPlatformAgentsAgentConfig().pipe(da(()=>Cr([])))}))));constructor(){this.allConfigs$.pipe(U$2(this.destroyRef)).subscribe({next:({namespace:e,platform:t})=>{this.rows.set([...t.map((i,s)=>({key:`platform:${i.id??s}`,config:i,scope:"platform"})),...e.map((i,s)=>({key:`namespace:${i.id??s}`,config:i,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"agent-configs","new"]);}inspect(e){e.config.id&&this.router.navigate(e.scope==="platform"?["/agentos","admin","agent-configs",e.config.id,"inspect"]:["/agentos",this.namespaceId,"agent-configs",e.config.id,"inspect"]);}launch(e){e.scope==="platform"||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"agent-configs",e.config.id,"launch"]);}edit(e){e.scope==="platform"||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"agent-configs",e.config.id,"edit"]);}confirmDelete(e){e.scope==="platform"||!e.config.id||this.deletion.execute(e.key,{request$:this.controller.deleteAgentConfig(e.config.id).pipe(U$2(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.config.name}" failed. Try again.`});}canLaunch(e){return e.scope==="namespace"&&e.config.executionMode==="LOOP"}mode(e){return e.config.executionMode??(e.config.advancedExecution?"ADVANCED":"SIMPLE")}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=mw({type:n,selectors:[["agentos-namespace-agent-configs"]],decls:9,vars:3,consts:[["title","Agent configs","description","Agent configurations available in this namespace, including configurations inherited from the platform."],["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","Agent configs"],["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","Execution mode"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,i){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(d){return i.rowFilter.query.set(d)}),pl(),Ds(2,"button",2),mg("click",function(){return i.openCreateForm()}),MC(3,"New agent config"),pl()(),Pw(4,U,2,1,"p",3),Pw(5,z,2,0,"p",4)(6,G,2,0,"p",5)(7,Q,2,0,"p",4)(8,ne,18,0,"div",6)),t&2&&(jE(),ug("query",i.rowFilter.query()),jE(3),Lw(i.deletion.error()?4:-1),jE(),Lw(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{H as NamespaceAgentConfigsComponent};
1
+ import {z as k,O,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-Cq4k0Mf8.js';import {g,W as W$1,F,I as Ie,ag as U$1,$ as wr,U as Ui,a1 as fa,ac as Ty,a2 as da,aa as Cr,E as U$2,m as mw,D as Ds,R as mg,a as pl,M as MC,P as Pw,j as jE,Q as ug,L as Lw,X as Xw,O as Og,i as Vw,H as Hw,v as vl,q as qw,r as df,s as ff,f as cg}from'./main-CEEMKDJT.js';var J=(n,e)=>e.key;function U(n,e){if(n&1&&(Ds(0,"p",3),MC(1),pl()),n&2){let t=Xw();jE(),Og(t.deletion.error());}}function z(n,e){n&1&&(Ds(0,"p",4),MC(1,"Loading agent configs\u2026"),pl());}function G(n,e){n&1&&(Ds(0,"p",5),MC(1,"No agent configs available."),pl());}function Q(n,e){n&1&&(Ds(0,"p",4),MC(1,"No agent configs match the current filter."),pl());}function W(n,e){n&1&&(Ds(0,"ds-tag",18),MC(1,"Read-only"),pl());}function X(n,e){if(n&1){let t=qw();Ds(0,"button",22),mg("click",function(){df(t);let s=Xw(2).$implicit,d=Xw(2);return ff(d.launch(s))}),MC(1," Launch "),pl();}if(n&2){let t=Xw(2).$implicit;cg("aria-label","Launch "+t.config.name);}}function Y(n,e){if(n&1){let t=qw();Ds(0,"button",22),mg("click",function(){df(t);let s=Xw(2).$implicit,d=Xw(2);return ff(d.edit(s))}),MC(1," Edit "),pl();}if(n&2){let t=Xw(2).$implicit;cg("aria-label","Edit "+t.config.name);}}function Z(n,e){if(n&1){let t=qw();Ds(0,"button",22),mg("click",function(){df(t);let s=Xw().$implicit,d=Xw(2);return ff(d.inspect(s))}),MC(1," Inspect "),pl(),Pw(2,X,2,1,"button",23),Pw(3,Y,2,1,"button",23);}if(n&2){let t=Xw().$implicit,i=Xw(2);cg("aria-label","Inspect "+t.config.name),jE(2),Lw(i.canLaunch(t)?2:-1),jE(),Lw(t.scope==="namespace"?3:-1);}}function ee(n,e){if(n&1){let t=qw();Ds(0,"agentos-row-delete-action",24),mg("deleteRequested",function(){df(t);let s=Xw().$implicit,d=Xw(2);return ff(d.deletion.request(s.key))})("deleteConfirmed",function(){df(t);let s=Xw().$implicit,d=Xw(2);return ff(d.confirmDelete(s))})("deleteCancelled",function(){df(t);let s=Xw(3);return ff(s.deletion.cancel())}),pl();}if(n&2){let t=Xw().$implicit,i=Xw(2);ug("rowKey",t.key)("rowLabel",t.config.name)("state",i.deletion);}}function te(n,e){if(n&1&&(Ds(0,"tr",9)(1,"td",12),MC(2),pl(),Ds(3,"td",13),MC(4),pl(),Ds(5,"td",14),MC(6),pl(),Ds(7,"td",15)(8,"div",16)(9,"ds-tag",17),MC(10),pl(),Pw(11,W,2,0,"ds-tag",18),pl()(),Ds(12,"td",19)(13,"div",20),Pw(14,Z,4,3),Pw(15,ee,1,3,"agentos-row-delete-action",21),pl()()()),n&2){let t=e.$implicit,i=Xw(2);jE(2),Og(t.config.name),jE(2),vl(" ",t.config.description||"\u2014"," "),jE(2),Og(i.mode(t)),jE(3),ug("variant",t.scope==="platform"?"neutral":"accent"),jE(),Og(t.scope==="platform"?"Platform":"Namespace"),jE(),Lw(t.scope==="platform"?11:-1),jE(3),Lw(i.deletion.confirmingId()!==t.key?14:-1),jE(),Lw(t.scope==="namespace"?15:-1);}}function ne(n,e){if(n&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),MC(5,"Name"),pl(),Ds(6,"th",10),MC(7,"Description"),pl(),Ds(8,"th",10),MC(9,"Execution mode"),pl(),Ds(10,"th",10),MC(11,"Scope"),pl(),Ds(12,"th",10)(13,"span",11),MC(14,"Actions"),pl()()()(),Ds(15,"tbody",8),Vw(16,te,16,8,"tr",9,J),pl()()()),n&2){let t=Xw();jE(16),Hw(t.rowFilter.filteredRows());}}var H=class n{route=g(W$1);router=g(F);destroyRef=g(Ie);controller=g(U$1);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new wr(void 0);isLoading=Ui(true);deletion=k();rows=Ui([]);rowFilter=O(this.rows,e=>[e.config.name,e.config.description,this.mode(e),e.scope].filter(Boolean).join(" "));allConfigs$=this.refresh$.pipe(fa(()=>(this.isLoading.set(true),Ty({namespace:this.controller.listByParentAgentConfig(this.namespaceId),platform:this.controller.listPlatformAgentsAgentConfig().pipe(da(()=>Cr([])))}))));constructor(){this.allConfigs$.pipe(U$2(this.destroyRef)).subscribe({next:({namespace:e,platform:t})=>{this.rows.set([...t.map((i,s)=>({key:`platform:${i.id??s}`,config:i,scope:"platform"})),...e.map((i,s)=>({key:`namespace:${i.id??s}`,config:i,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"agent-configs","new"]);}inspect(e){e.config.id&&this.router.navigate(e.scope==="platform"?["/agentos","admin","agent-configs",e.config.id,"inspect"]:["/agentos",this.namespaceId,"agent-configs",e.config.id,"inspect"]);}launch(e){e.scope==="platform"||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"agent-configs",e.config.id,"launch"]);}edit(e){e.scope==="platform"||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"agent-configs",e.config.id,"edit"]);}confirmDelete(e){e.scope==="platform"||!e.config.id||this.deletion.execute(e.key,{request$:this.controller.deleteAgentConfig(e.config.id).pipe(U$2(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.config.name}" failed. Try again.`});}canLaunch(e){return e.scope==="namespace"&&e.config.executionMode==="LOOP"}mode(e){return e.config.executionMode??(e.config.advancedExecution?"ADVANCED":"SIMPLE")}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=mw({type:n,selectors:[["agentos-namespace-agent-configs"]],decls:9,vars:3,consts:[["title","Agent configs","description","Agent configurations available in this namespace, including configurations inherited from the platform."],["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","Agent configs"],["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","Execution mode"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,i){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(d){return i.rowFilter.query.set(d)}),pl(),Ds(2,"button",2),mg("click",function(){return i.openCreateForm()}),MC(3,"New agent config"),pl()(),Pw(4,U,2,1,"p",3),Pw(5,z,2,0,"p",4)(6,G,2,0,"p",5)(7,Q,2,0,"p",4)(8,ne,18,0,"div",6)),t&2&&(jE(),ug("query",i.rowFilter.query()),jE(3),Lw(i.deletion.error()?4:-1),jE(),Lw(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{H as NamespaceAgentConfigsComponent};
@@ -1 +1 @@
1
- import {O as O$1}from'./chunk-D8dC5epc.js';import {I}from'./chunk-C6jJRCiO.js';import {O}from'./chunk-D9sUF55R.js';import {g,I as Ie$1,U as Ui,K as KC,a9 as F,at as wy,ad as ne,E as U,m as mw,D as Ds,l as lg,P as Pw,a as pl,j as jE,L as Lw,M as MC,q as qw,R as mg,X as Xw,Q as ug,T as SI,i as Vw,O as Og,Y as MI,H as Hw,v as vl,ae as kw,r as df,s as ff,N as x,G as w}from'./main-2IBYD645.js';import {y,N as D,Q as B,R as a,p as pt,T as Te$1,X as f,Y as A,U as Ut,n as nd,l as bo,x as xo,L as Lt,G as Gt,m as mo,b as po,A as An,v as va,c as pn,h as hn,d as cn,Z as un,e as dn,g as at,i as an,q as sn,a0 as Ti,K as Oi,a1 as d,a2 as v}from'./chunk-DxKo0dCS.js';import'./chunk-gjFAR1Z5.js';var ye=(o,e)=>e.value,Ce=(o,e)=>e.title;function be(o,e){o&1&&(Ds(0,"p",2),MC(1,"Loading\u2026"),pl());}function xe(o,e){if(o&1&&(Ds(0,"option",27),MC(1),pl()),o&2){let t=e.$implicit;ug("value",t.value),jE(),Og(t.label);}}function Se(o,e){if(o&1){let t=qw();Ds(0,"form",15),mg("ngSubmit",function(){df(t);let s=Xw(2);return ff(s.save())}),Ds(1,"ds-group",16)(2,"dl",17)(3,"dt"),MC(4,"Email"),pl(),Ds(5,"dd"),MC(6),pl(),Ds(7,"dt"),MC(8,"External ID"),pl(),Ds(9,"dd"),MC(10),pl()()(),Ds(11,"ds-group",18)(12,"ds-form-field",19),lg(13,"input",20),SI(),pl(),Ds(14,"ds-form-field",21),lg(15,"input",22),SI(),pl(),Ds(16,"ds-form-field",23),lg(17,"textarea",24),SI(),pl(),Ds(18,"ds-form-field",25)(19,"select",26),Vw(20,xe,2,2,"option",27,ye),pl(),SI(),pl()(),Ds(22,"ds-form-actions")(23,"button",28),MC(24),pl(),Ds(25,"button",29),mg("click",function(){df(t);let s=Xw(2);return ff(s.cancelEditing())}),MC(26,"Cancel"),pl()()();}if(o&2){let t=Xw(),l=Xw();ug("formGroup",l.form),jE(6),Og(t.email),jE(4),Og(t.externalId),jE(3),MI(),jE(2),MI(),jE(2),MI(),jE(2),MI(),jE(),Hw(l.languageOptions),jE(3),ug("disabled",l.isSaving()),jE(),vl(" ",l.isSaving()?"Saving\u2026":"Save changes"," ");}}function Ee(o,e){o&1&&(Ds(0,"p",2),MC(1," No global configuration yet. Create one from the Integrations / AI Providers / Auth Settings pages of your namespaces. "),pl());}function Pe(o,e){if(o&1){let t=qw();Ds(0,"span",38),MC(1,"Delete?"),pl(),Ds(2,"button",39),mg("click",function(){df(t);let s=Xw().$implicit,m=Xw(5);return ff(m.confirmDelete(s))}),MC(3,"Confirm"),pl(),Ds(4,"button",40),mg("click",function(){df(t);let s=Xw(6);return ff(s.cancelDelete())}),MC(5,"Cancel"),pl();}}function Te(o,e){if(o&1){let t=qw();Ds(0,"button",40),mg("click",function(){df(t);let s=Xw().$implicit,m=Xw(5);return ff(m.armDelete(s))}),MC(1,"Delete"),pl();}}function De(o,e){if(o&1&&(Ds(0,"li",34)(1,"span",35),MC(2),pl(),Ds(3,"span",36),MC(4),pl(),Pw(5,Pe,6,0)(6,Te,2,0,"button",37),pl()),o&2){let t=e.$implicit,l=Xw(5);jE(2),Og(t.name),jE(2),Og(t.subtitle),jE(),Lw(l.isPendingDelete(t)?5:6);}}function we(o,e){if(o&1&&(Ds(0,"span",32),MC(1),pl(),Ds(2,"ul",33),Vw(3,De,7,3,"li",34,kw().trackEntry,true),pl()),o&2){let t=e.$implicit;jE(),Og(t.title),jE(2),Hw(t.entries);}}function Ve(o,e){if(o&1&&Vw(0,we,5,1,null,null,Ce),o&2){let t=Xw(3);Hw(t.recapSections());}}function Ue(o,e){if(o&1){let t=qw();Ds(0,"ds-group",16)(1,"dl",17)(2,"dt"),MC(3,"Email"),pl(),Ds(4,"dd"),MC(5),pl(),Ds(6,"dt"),MC(7,"External ID"),pl(),Ds(8,"dd"),MC(9),pl()()(),Ds(10,"ds-group",18)(11,"dl",17)(12,"dt"),MC(13,"First name"),pl(),Ds(14,"dd"),MC(15),pl(),Ds(16,"dt"),MC(17,"Last name"),pl(),Ds(18,"dd"),MC(19),pl(),Ds(20,"dt"),MC(21,"Bio"),pl(),Ds(22,"dd"),MC(23),pl(),Ds(24,"dt"),MC(25,"Language"),pl(),Ds(26,"dd"),MC(27),pl()()(),Ds(28,"ds-form-actions")(29,"button",30),mg("click",function(){df(t);let s=Xw(2);return ff(s.startEditing())}),MC(30,"Edit profile"),pl()(),Ds(31,"ds-disclosure",31),mg("toggled",function(){df(t);let s=Xw(2);return ff(s.toggleOverrides())}),Pw(32,Ee,2,0,"p",2)(33,Ve,2,0),pl();}if(o&2){let t=Xw(),l=Xw();jE(5),Og(t.email),jE(4),Og(t.externalId),jE(6),Og(t.firstname||"\u2014"),jE(4),Og(t.lastname||"\u2014"),jE(4),Og(t.bio||"\u2014"),jE(4),Og(t.preferredLanguage||"\u2014"),jE(4),ug("heading","My global user configurations ("+l.recap().total+")")("open",l.isOverridesExpanded()),jE(),Lw(l.recap().total===0?32:33);}}function Me(o,e){if(o&1){let t=qw();Ds(0,"ds-group",3)(1,"ds-form-field",4)(2,"ds-segmented",5),mg("valueChange",function(s){df(t);let m=Xw();return ff(m.setThemeVariant(s))}),pl()(),Ds(3,"ds-form-field",6)(4,"ds-segmented",7),mg("valueChange",function(s){df(t);let m=Xw();return ff(m.setTheme(s))}),pl()()(),Ds(5,"ds-group",8)(6,"ds-form-field",9)(7,"ds-segmented",10),mg("valueChange",function(s){df(t);let m=Xw();return ff(m.setEnterKeyBehavior(s))}),pl()()(),Ds(8,"ds-group",11)(9,"ds-form-field",12)(10,"ds-segmented",13),mg("valueChange",function(s){df(t);let m=Xw();return ff(m.setShowTechnical(s))}),pl()()(),Pw(11,Se,27,5,"form",14)(12,Ue,34,9);}if(o&2){let t=Xw();jE(),ug("hint",t.activeVariantDescription()),jE(),ug("options",t.themeVariantOptions)("value",t.themeVariant()),jE(),ug("hint",t.modeOverridden()?t.activeVariantLabel()+" does not support this mode; your choice is kept for other skins.":null),jE(),ug("options",t.modeOptions())("value",t.shownMode()),jE(3),ug("options",t.enterKeyOptions)("value",t.enterKeyBehavior()),jE(3),ug("options",t.showTechnicalOptions)("value",t.showTechnical()),jE(),Lw(t.isEditing()?11:12);}}function Ie(o,e){o&1&&(Ds(0,"p",2),MC(1,"Unable to load profile."),pl());}var ve=class o{userState=g(y);destroyRef=g(Ie$1);integrationState=g(O);providerState=g(O$1);authSettingState=g(I);themePort=g(D);preferencesPort=g(B);isEditing=Ui(false);isLoading=Ui(false);isSaving=Ui(false);isOverridesExpanded=Ui(false);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeMode=KC(()=>this.themePort.theme().mode);themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];themeVariant=KC(()=>this.themePort.theme().variant);themeVariantOptions=a.map(({id:e,label:t,description:l})=>({value:e,label:t,description:l}));modeOverridden=KC(()=>!A(this.themeVariant(),this.themeMode()));activeVariantLabel=KC(()=>d(this.themeVariant()).label);activeVariantDescription=KC(()=>d(this.themeVariant()).description);modeOptions=KC(()=>this.themeOptions.map(e=>x(w({},e),{disabled:this.isModeDisabled(e.value)})));shownMode=KC(()=>this.modeOverridden()?v(this.themeVariant(),this.themeMode(),false):this.themeMode());enterKeyBehavior=this.preferencesPort.enterKeyBehavior;enterKeyOptions=[{value:"send",label:"Send"},{value:"newline",label:"New line"}];showTechnical=this.preferencesPort.showTechnical;showTechnicalOptions=[{value:true,label:"Shown"},{value:false,label:"Hidden"}];languageOptions=[{value:"",label:"No preference (English fallback)"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"es",label:"Spanish"},{value:"pt",label:"Portuguese"},{value:"it",label:"Italian"},{value:"nl",label:"Dutch"},{value:"pl",label:"Polish"},{value:"ja",label:"Japanese"},{value:"zh",label:"Chinese"}];form=new pt({firstname:new Te$1("",{nonNullable:true}),lastname:new Te$1("",{nonNullable:true}),bio:new Te$1("",{nonNullable:true}),preferredLanguage:new Te$1("",{nonNullable:true})});recap=F(wy([this.integrationState.userGlobal$,this.providerState.userGlobal$,this.authSettingState.userGlobal$]).pipe(ne(([e,t,l])=>{let s=e.map(g=>({category:"integration",id:g.id??"",name:g.name,subtitle:g.integrationType})),m=t.map(g=>({category:"aiProvider",id:g.id??"",name:g.name,subtitle:g.apiType})),I=l.map(g=>({category:"authSetting",id:g.id??"",name:g.name,subtitle:g.authType}));return {integrations:s,aiProviders:m,authSettings:I,total:s.length+m.length+I.length}})),{initialValue:{integrations:[],aiProviders:[],authSettings:[],total:0}});recapSections=KC(()=>{let e=this.recap();return [{title:"Integrations",entries:e.integrations},{title:"AI Providers",entries:e.aiProviders},{title:"My global auth settings",entries:e.authSettings}].filter(t=>t.entries.length>0)});ngOnInit(){if(this.currentUser()){this.syncFormFromState();return}this.isLoading.set(true),this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:()=>{this.syncFormFromState(),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}startEditing(){this.syncFormFromState(),this.isEditing.set(true);}cancelEditing(){this.isEditing.set(false);}setTheme(e){this.themePort.setTheme({variant:this.themePort.theme().variant,mode:e});}setThemeVariant(e){f(e)&&this.themePort.setTheme({variant:e,mode:this.themePort.theme().mode});}isModeDisabled(e){return !A(this.themeVariant(),e)}setEnterKeyBehavior(e){this.preferencesPort.setEnterKeyBehavior(e);}setShowTechnical(e){this.preferencesPort.setShowTechnical(e);}save(){if(this.isSaving())return;this.isSaving.set(true);let e=this.form.controls.preferredLanguage.value.trim();this.userState.updateMe({firstname:this.form.controls.firstname.value.trim()||void 0,lastname:this.form.controls.lastname.value.trim()||void 0,bio:this.form.controls.bio.value.trim()||void 0,preferredLanguage:e||void 0}).pipe(U(this.destroyRef)).subscribe({next:()=>{this.isSaving.set(false),this.isEditing.set(false);},error:()=>this.isSaving.set(false)});}toggleOverrides(){this.isOverridesExpanded.update(e=>!e),this.pendingDeleteKey.set(null);}pendingDeleteKey=Ui(null);isPendingDelete(e){return this.pendingDeleteKey()===this.entryKey(e)}armDelete(e){e.id&&this.pendingDeleteKey.set(this.entryKey(e));}cancelDelete(){this.pendingDeleteKey.set(null);}confirmDelete(e){if(!e.id)return;this.pendingDeleteKey.set(null),(e.category==="integration"?this.integrationState.delete(e.id,"userGlobal"):e.category==="authSetting"?this.authSettingState.delete(e.id,"userGlobal"):this.providerState.delete(e.id,"userGlobal")).pipe(U(this.destroyRef)).subscribe({error:l=>{console.error(`[UserProfile] Delete failed for ${e.category}:${e.id}:`,l);}});}entryKey(e){return `${e.category}:${e.id}`}trackEntry(e,t){return this.entryKey(t)}syncFormFromState(){let e=this.currentUser();e&&this.form.setValue({firstname:e.firstname??"",lastname:e.lastname??"",bio:e.bio??"",preferredLanguage:e.preferredLanguage??""});}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=mw({type:o,selectors:[["agentos-user-profile"]],decls:5,vars:1,consts:[["framed",""],["title","My profile"],[1,"ds-hint"],["heading","Appearance"],["label","Skin",3,"hint"],["label","Skin",3,"valueChange","options","value"],["label","Mode",3,"hint"],["label","Color mode",3,"valueChange","options","value"],["heading","Composer"],["label","Enter key","hint",'In "New line" mode, press Ctrl or Cmd + Enter to send.'],["label","Enter key behavior",3,"valueChange","options","value"],["heading","Case chat"],["label","Technical logs","hint","Show system log lines (agent status, tool selection...) in the case chat."],["label","Technical logs",3,"valueChange","options","value"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["heading","Identity"],["dsDefinitionList",""],["heading","Profile"],["label","First name","controlId","up-firstname"],["dsControl","","id","up-firstname","type","text","placeholder","Your first name","formControlName","firstname","autocomplete","given-name"],["label","Last name","controlId","up-lastname"],["dsControl","","id","up-lastname","type","text","placeholder","Your last name","formControlName","lastname","autocomplete","family-name"],["label","Bio","controlId","up-bio"],["dsControl","","id","up-bio","placeholder","A short description about yourself","formControlName","bio","rows","4"],["label","Language","controlId","up-preferredLanguage"],["dsControl","","id","up-preferredLanguage","formControlName","preferredLanguage"],[3,"value"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsButton","","variant","primary","type","button",3,"click"],[3,"toggled","heading","open"],[1,"ds-micro"],[1,"ds-list"],[1,"ds-row"],[1,"ds-strong","ds-row__grow"],[1,"ds-meta"],["dsButton","","variant","ghost","type","button"],[1,"ds-error"],["dsButton","","variant","danger","type","button",3,"click"],["dsButton","","variant","ghost","type","button",3,"click"]],template:function(t,l){if(t&1&&(Ds(0,"ds-page",0),lg(1,"ds-section-header",1),Pw(2,be,2,0,"p",2)(3,Me,13,11)(4,Ie,2,0,"p",2),pl()),t&2){let s;jE(2),Lw(l.isLoading()?2:(s=l.currentUser())?3:4,s);}},dependencies:[Ut,nd,bo,xo,Lt,Gt,mo,po,An,va,pn,hn,cn,un,dn,at,an,sn,Ti,Oi],encapsulation:2})};export{ve as UserProfileComponent};
1
+ import {O as O$1}from'./chunk-BJDs9gyo.js';import {I}from'./chunk-DV-Eelxi.js';import {O}from'./chunk-bqhgjnlz.js';import {g,I as Ie$1,U as Ui,K as KC,a9 as F,at as wy,ad as ne,E as U,m as mw,D as Ds,l as lg,P as Pw,a as pl,j as jE,L as Lw,M as MC,q as qw,R as mg,X as Xw,Q as ug,T as SI,i as Vw,O as Og,Y as MI,H as Hw,v as vl,ae as kw,r as df,s as ff,N as x,G as w}from'./main-CEEMKDJT.js';import {y,N as D,Q as B,R as a,p as pt,T as Te$1,X as f,Y as A,U as Ut,n as nd,l as bo,x as xo,L as Lt,G as Gt,m as mo,b as po,A as An,v as va,c as pn,h as hn,d as cn,Z as un,e as dn,g as at,i as an,q as sn,a0 as Ti,K as Oi,a1 as d,a2 as v}from'./chunk-Cq4k0Mf8.js';import'./chunk-CQZDxK4J.js';var ye=(o,e)=>e.value,Ce=(o,e)=>e.title;function be(o,e){o&1&&(Ds(0,"p",2),MC(1,"Loading\u2026"),pl());}function xe(o,e){if(o&1&&(Ds(0,"option",27),MC(1),pl()),o&2){let t=e.$implicit;ug("value",t.value),jE(),Og(t.label);}}function Se(o,e){if(o&1){let t=qw();Ds(0,"form",15),mg("ngSubmit",function(){df(t);let s=Xw(2);return ff(s.save())}),Ds(1,"ds-group",16)(2,"dl",17)(3,"dt"),MC(4,"Email"),pl(),Ds(5,"dd"),MC(6),pl(),Ds(7,"dt"),MC(8,"External ID"),pl(),Ds(9,"dd"),MC(10),pl()()(),Ds(11,"ds-group",18)(12,"ds-form-field",19),lg(13,"input",20),SI(),pl(),Ds(14,"ds-form-field",21),lg(15,"input",22),SI(),pl(),Ds(16,"ds-form-field",23),lg(17,"textarea",24),SI(),pl(),Ds(18,"ds-form-field",25)(19,"select",26),Vw(20,xe,2,2,"option",27,ye),pl(),SI(),pl()(),Ds(22,"ds-form-actions")(23,"button",28),MC(24),pl(),Ds(25,"button",29),mg("click",function(){df(t);let s=Xw(2);return ff(s.cancelEditing())}),MC(26,"Cancel"),pl()()();}if(o&2){let t=Xw(),l=Xw();ug("formGroup",l.form),jE(6),Og(t.email),jE(4),Og(t.externalId),jE(3),MI(),jE(2),MI(),jE(2),MI(),jE(2),MI(),jE(),Hw(l.languageOptions),jE(3),ug("disabled",l.isSaving()),jE(),vl(" ",l.isSaving()?"Saving\u2026":"Save changes"," ");}}function Ee(o,e){o&1&&(Ds(0,"p",2),MC(1," No global configuration yet. Create one from the Integrations / AI Providers / Auth Settings pages of your namespaces. "),pl());}function Pe(o,e){if(o&1){let t=qw();Ds(0,"span",38),MC(1,"Delete?"),pl(),Ds(2,"button",39),mg("click",function(){df(t);let s=Xw().$implicit,m=Xw(5);return ff(m.confirmDelete(s))}),MC(3,"Confirm"),pl(),Ds(4,"button",40),mg("click",function(){df(t);let s=Xw(6);return ff(s.cancelDelete())}),MC(5,"Cancel"),pl();}}function Te(o,e){if(o&1){let t=qw();Ds(0,"button",40),mg("click",function(){df(t);let s=Xw().$implicit,m=Xw(5);return ff(m.armDelete(s))}),MC(1,"Delete"),pl();}}function De(o,e){if(o&1&&(Ds(0,"li",34)(1,"span",35),MC(2),pl(),Ds(3,"span",36),MC(4),pl(),Pw(5,Pe,6,0)(6,Te,2,0,"button",37),pl()),o&2){let t=e.$implicit,l=Xw(5);jE(2),Og(t.name),jE(2),Og(t.subtitle),jE(),Lw(l.isPendingDelete(t)?5:6);}}function we(o,e){if(o&1&&(Ds(0,"span",32),MC(1),pl(),Ds(2,"ul",33),Vw(3,De,7,3,"li",34,kw().trackEntry,true),pl()),o&2){let t=e.$implicit;jE(),Og(t.title),jE(2),Hw(t.entries);}}function Ve(o,e){if(o&1&&Vw(0,we,5,1,null,null,Ce),o&2){let t=Xw(3);Hw(t.recapSections());}}function Ue(o,e){if(o&1){let t=qw();Ds(0,"ds-group",16)(1,"dl",17)(2,"dt"),MC(3,"Email"),pl(),Ds(4,"dd"),MC(5),pl(),Ds(6,"dt"),MC(7,"External ID"),pl(),Ds(8,"dd"),MC(9),pl()()(),Ds(10,"ds-group",18)(11,"dl",17)(12,"dt"),MC(13,"First name"),pl(),Ds(14,"dd"),MC(15),pl(),Ds(16,"dt"),MC(17,"Last name"),pl(),Ds(18,"dd"),MC(19),pl(),Ds(20,"dt"),MC(21,"Bio"),pl(),Ds(22,"dd"),MC(23),pl(),Ds(24,"dt"),MC(25,"Language"),pl(),Ds(26,"dd"),MC(27),pl()()(),Ds(28,"ds-form-actions")(29,"button",30),mg("click",function(){df(t);let s=Xw(2);return ff(s.startEditing())}),MC(30,"Edit profile"),pl()(),Ds(31,"ds-disclosure",31),mg("toggled",function(){df(t);let s=Xw(2);return ff(s.toggleOverrides())}),Pw(32,Ee,2,0,"p",2)(33,Ve,2,0),pl();}if(o&2){let t=Xw(),l=Xw();jE(5),Og(t.email),jE(4),Og(t.externalId),jE(6),Og(t.firstname||"\u2014"),jE(4),Og(t.lastname||"\u2014"),jE(4),Og(t.bio||"\u2014"),jE(4),Og(t.preferredLanguage||"\u2014"),jE(4),ug("heading","My global user configurations ("+l.recap().total+")")("open",l.isOverridesExpanded()),jE(),Lw(l.recap().total===0?32:33);}}function Me(o,e){if(o&1){let t=qw();Ds(0,"ds-group",3)(1,"ds-form-field",4)(2,"ds-segmented",5),mg("valueChange",function(s){df(t);let m=Xw();return ff(m.setThemeVariant(s))}),pl()(),Ds(3,"ds-form-field",6)(4,"ds-segmented",7),mg("valueChange",function(s){df(t);let m=Xw();return ff(m.setTheme(s))}),pl()()(),Ds(5,"ds-group",8)(6,"ds-form-field",9)(7,"ds-segmented",10),mg("valueChange",function(s){df(t);let m=Xw();return ff(m.setEnterKeyBehavior(s))}),pl()()(),Ds(8,"ds-group",11)(9,"ds-form-field",12)(10,"ds-segmented",13),mg("valueChange",function(s){df(t);let m=Xw();return ff(m.setShowTechnical(s))}),pl()()(),Pw(11,Se,27,5,"form",14)(12,Ue,34,9);}if(o&2){let t=Xw();jE(),ug("hint",t.activeVariantDescription()),jE(),ug("options",t.themeVariantOptions)("value",t.themeVariant()),jE(),ug("hint",t.modeOverridden()?t.activeVariantLabel()+" does not support this mode; your choice is kept for other skins.":null),jE(),ug("options",t.modeOptions())("value",t.shownMode()),jE(3),ug("options",t.enterKeyOptions)("value",t.enterKeyBehavior()),jE(3),ug("options",t.showTechnicalOptions)("value",t.showTechnical()),jE(),Lw(t.isEditing()?11:12);}}function Ie(o,e){o&1&&(Ds(0,"p",2),MC(1,"Unable to load profile."),pl());}var ve=class o{userState=g(y);destroyRef=g(Ie$1);integrationState=g(O);providerState=g(O$1);authSettingState=g(I);themePort=g(D);preferencesPort=g(B);isEditing=Ui(false);isLoading=Ui(false);isSaving=Ui(false);isOverridesExpanded=Ui(false);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeMode=KC(()=>this.themePort.theme().mode);themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];themeVariant=KC(()=>this.themePort.theme().variant);themeVariantOptions=a.map(({id:e,label:t,description:l})=>({value:e,label:t,description:l}));modeOverridden=KC(()=>!A(this.themeVariant(),this.themeMode()));activeVariantLabel=KC(()=>d(this.themeVariant()).label);activeVariantDescription=KC(()=>d(this.themeVariant()).description);modeOptions=KC(()=>this.themeOptions.map(e=>x(w({},e),{disabled:this.isModeDisabled(e.value)})));shownMode=KC(()=>this.modeOverridden()?v(this.themeVariant(),this.themeMode(),false):this.themeMode());enterKeyBehavior=this.preferencesPort.enterKeyBehavior;enterKeyOptions=[{value:"send",label:"Send"},{value:"newline",label:"New line"}];showTechnical=this.preferencesPort.showTechnical;showTechnicalOptions=[{value:true,label:"Shown"},{value:false,label:"Hidden"}];languageOptions=[{value:"",label:"No preference (English fallback)"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"es",label:"Spanish"},{value:"pt",label:"Portuguese"},{value:"it",label:"Italian"},{value:"nl",label:"Dutch"},{value:"pl",label:"Polish"},{value:"ja",label:"Japanese"},{value:"zh",label:"Chinese"}];form=new pt({firstname:new Te$1("",{nonNullable:true}),lastname:new Te$1("",{nonNullable:true}),bio:new Te$1("",{nonNullable:true}),preferredLanguage:new Te$1("",{nonNullable:true})});recap=F(wy([this.integrationState.userGlobal$,this.providerState.userGlobal$,this.authSettingState.userGlobal$]).pipe(ne(([e,t,l])=>{let s=e.map(g=>({category:"integration",id:g.id??"",name:g.name,subtitle:g.integrationType})),m=t.map(g=>({category:"aiProvider",id:g.id??"",name:g.name,subtitle:g.apiType})),I=l.map(g=>({category:"authSetting",id:g.id??"",name:g.name,subtitle:g.authType}));return {integrations:s,aiProviders:m,authSettings:I,total:s.length+m.length+I.length}})),{initialValue:{integrations:[],aiProviders:[],authSettings:[],total:0}});recapSections=KC(()=>{let e=this.recap();return [{title:"Integrations",entries:e.integrations},{title:"AI Providers",entries:e.aiProviders},{title:"My global auth settings",entries:e.authSettings}].filter(t=>t.entries.length>0)});ngOnInit(){if(this.currentUser()){this.syncFormFromState();return}this.isLoading.set(true),this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:()=>{this.syncFormFromState(),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}startEditing(){this.syncFormFromState(),this.isEditing.set(true);}cancelEditing(){this.isEditing.set(false);}setTheme(e){this.themePort.setTheme({variant:this.themePort.theme().variant,mode:e});}setThemeVariant(e){f(e)&&this.themePort.setTheme({variant:e,mode:this.themePort.theme().mode});}isModeDisabled(e){return !A(this.themeVariant(),e)}setEnterKeyBehavior(e){this.preferencesPort.setEnterKeyBehavior(e);}setShowTechnical(e){this.preferencesPort.setShowTechnical(e);}save(){if(this.isSaving())return;this.isSaving.set(true);let e=this.form.controls.preferredLanguage.value.trim();this.userState.updateMe({firstname:this.form.controls.firstname.value.trim()||void 0,lastname:this.form.controls.lastname.value.trim()||void 0,bio:this.form.controls.bio.value.trim()||void 0,preferredLanguage:e||void 0}).pipe(U(this.destroyRef)).subscribe({next:()=>{this.isSaving.set(false),this.isEditing.set(false);},error:()=>this.isSaving.set(false)});}toggleOverrides(){this.isOverridesExpanded.update(e=>!e),this.pendingDeleteKey.set(null);}pendingDeleteKey=Ui(null);isPendingDelete(e){return this.pendingDeleteKey()===this.entryKey(e)}armDelete(e){e.id&&this.pendingDeleteKey.set(this.entryKey(e));}cancelDelete(){this.pendingDeleteKey.set(null);}confirmDelete(e){if(!e.id)return;this.pendingDeleteKey.set(null),(e.category==="integration"?this.integrationState.delete(e.id,"userGlobal"):e.category==="authSetting"?this.authSettingState.delete(e.id,"userGlobal"):this.providerState.delete(e.id,"userGlobal")).pipe(U(this.destroyRef)).subscribe({error:l=>{console.error(`[UserProfile] Delete failed for ${e.category}:${e.id}:`,l);}});}entryKey(e){return `${e.category}:${e.id}`}trackEntry(e,t){return this.entryKey(t)}syncFormFromState(){let e=this.currentUser();e&&this.form.setValue({firstname:e.firstname??"",lastname:e.lastname??"",bio:e.bio??"",preferredLanguage:e.preferredLanguage??""});}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=mw({type:o,selectors:[["agentos-user-profile"]],decls:5,vars:1,consts:[["framed",""],["title","My profile"],[1,"ds-hint"],["heading","Appearance"],["label","Skin",3,"hint"],["label","Skin",3,"valueChange","options","value"],["label","Mode",3,"hint"],["label","Color mode",3,"valueChange","options","value"],["heading","Composer"],["label","Enter key","hint",'In "New line" mode, press Ctrl or Cmd + Enter to send.'],["label","Enter key behavior",3,"valueChange","options","value"],["heading","Case chat"],["label","Technical logs","hint","Show system log lines (agent status, tool selection...) in the case chat."],["label","Technical logs",3,"valueChange","options","value"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["heading","Identity"],["dsDefinitionList",""],["heading","Profile"],["label","First name","controlId","up-firstname"],["dsControl","","id","up-firstname","type","text","placeholder","Your first name","formControlName","firstname","autocomplete","given-name"],["label","Last name","controlId","up-lastname"],["dsControl","","id","up-lastname","type","text","placeholder","Your last name","formControlName","lastname","autocomplete","family-name"],["label","Bio","controlId","up-bio"],["dsControl","","id","up-bio","placeholder","A short description about yourself","formControlName","bio","rows","4"],["label","Language","controlId","up-preferredLanguage"],["dsControl","","id","up-preferredLanguage","formControlName","preferredLanguage"],[3,"value"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsButton","","variant","primary","type","button",3,"click"],[3,"toggled","heading","open"],[1,"ds-micro"],[1,"ds-list"],[1,"ds-row"],[1,"ds-strong","ds-row__grow"],[1,"ds-meta"],["dsButton","","variant","ghost","type","button"],[1,"ds-error"],["dsButton","","variant","danger","type","button",3,"click"],["dsButton","","variant","ghost","type","button",3,"click"]],template:function(t,l){if(t&1&&(Ds(0,"ds-page",0),lg(1,"ds-section-header",1),Pw(2,be,2,0,"p",2)(3,Me,13,11)(4,Ie,2,0,"p",2),pl()),t&2){let s;jE(2),Lw(l.isLoading()?2:(s=l.currentUser())?3:4,s);}},dependencies:[Ut,nd,bo,xo,Lt,Gt,mo,po,An,va,pn,hn,cn,un,dn,at,an,sn,Ti,Oi],encapsulation:2})};export{ve as UserProfileComponent};
@@ -1 +1 @@
1
- import {e}from'./chunk-C6dIhkYp.js';import {O as O$1}from'./chunk-D9sUF55R.js';import {g,W,I as Ie,U as Ui,E as U,m as mw,D as Ds,l as lg,P as Pw,a as pl,j as jE,L as Lw,M as MC,X as Xw,O as Og}from'./main-2IBYD645.js';import {c as pn,h as hn,o as on,C as mn,q as sn,j as ko}from'./chunk-DxKo0dCS.js';import'./chunk-gjFAR1Z5.js';function O(r,e){r&1&&(Ds(0,"p",1),MC(1,"Loading integration\u2026"),pl());}function T(r,e){r&1&&(Ds(0,"ds-notice"),MC(1,"Failed to load this integration configuration."),pl());}function L(r,e){r&1&&(Ds(0,"div",3)(1,"ds-tag",9),MC(2,"YAML"),pl(),Ds(3,"ds-tag",10),MC(4,"Read-only"),pl()());}function k(r,e){if(r&1&&(Ds(0,"ds-card",2),Pw(1,L,5,0,"div",3),Ds(2,"dl",4)(3,"dt"),MC(4,"Name"),pl(),Ds(5,"dd"),MC(6),pl(),Ds(7,"dt"),MC(8,"Type"),pl(),Ds(9,"dd",5),MC(10),pl(),Ds(11,"dt"),MC(12,"Description"),pl(),Ds(13,"dd"),MC(14),pl(),Ds(15,"dt"),MC(16,"Scope"),pl(),Ds(17,"dd"),MC(18),pl(),Ds(19,"dt"),MC(20,"Source"),pl(),Ds(21,"dd"),MC(22),pl(),Ds(23,"dt"),MC(24,"Auto grant"),pl(),Ds(25,"dd"),MC(26),pl(),Ds(27,"dt"),MC(28,"Auth setting"),pl(),Ds(29,"dd"),MC(30),pl()()(),Ds(31,"ds-card",6)(32,"p",7),MC(33,"Sensitive values are always redacted."),pl(),Ds(34,"pre",8),MC(35),pl()()),r&2){let o=e,a=Xw();jE(),Lw(a.source()==="FILESYSTEM"?1:-1),jE(5),Og(o.name),jE(4),Og(o.integrationType),jE(4),Og(o.description||"\u2014"),jE(4),Og(a.scopeOf(o)),jE(4),Og(a.source()),jE(4),Og(o.autoGrant?"Enabled":"Disabled"),jE(4),Og(o.authSettingName||"None"),jE(5),Og(a.parameters());}}var w="\u2022\u2022\u2022\u2022\u2022\u2022",A=/(?:api[-_]?key|token|secret|password|passphrase|credential|private[-_]?key|client[-_]?secret|authorization|cookie)/i,V=class r{route=g(W);destroyRef=g(Ie);state=g(O$1);integrationId=this.route.snapshot.params.integrationId;isLoading=Ui(true);hasError=Ui(false);config=Ui(null);source=Ui("NEO4J");parameters=Ui("{}");ngOnInit(){this.state.getById(this.integrationId).pipe(U(this.destroyRef)).subscribe({next:e$1=>{this.config.set(e$1),this.source.set(e(e$1)),this.parameters.set(JSON.stringify(this.redact(e$1.parameters),null,2)),this.isLoading.set(false);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}scopeOf(e){let o=e.userId?e.namespaceId?"userOnNs":"userGlobal":e.namespaceId?"namespace":"platform";return {platform:"Platform",namespace:"Namespace",userOnNs:"Personal on namespace",userGlobal:"Personal global"}[o]}redact(e,o=""){return A.test(o)?w:e===null||typeof e=="boolean"||typeof e=="number"?e:typeof e=="string"?this.containsCredential(e)?w:e:Array.isArray(e)?e.map(a=>this.redact(a,o)):typeof e=="object"?Object.fromEntries(Object.entries(e).map(([a,m])=>[a,this.redact(m,a)])):String(e??"")}containsCredential(e){return /^(?:bearer\s+|basic\s+|sk[-_]|gh[opusr]_|xox[baprs]-|-----begin (?:rsa |ec |openssh )?private key-----)/i.test(e.trim())}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=mw({type:r,selectors:[["agentos-integration-config-view"]],decls:5,vars:1,consts:[["title","Integration configuration"],["role","status",1,"ds-hint"],["heading","General"],[1,"settings-table__tags"],["dsDefinitionList",""],[1,"ds-mono"],["heading","Parameters"],[1,"ds-hint"],[1,"ds-pre"],["variant","neutral"],["variant","outline"]],template:function(o,a){if(o&1&&(Ds(0,"ds-page"),lg(1,"ds-section-header",0),Pw(2,O,2,0,"p",1)(3,T,2,0,"ds-notice")(4,k,36,9),pl()),o&2){let m;jE(2),Lw(a.isLoading()?2:a.hasError()?3:(m=a.config())?4:-1,m);}},dependencies:[pn,hn,on,mn,sn,ko],encapsulation:2})};export{V as IntegrationConfigViewComponent};
1
+ import {e}from'./chunk-C6dIhkYp.js';import {O as O$1}from'./chunk-bqhgjnlz.js';import {g,W,I as Ie,U as Ui,E as U,m as mw,D as Ds,l as lg,P as Pw,a as pl,j as jE,L as Lw,M as MC,X as Xw,O as Og}from'./main-CEEMKDJT.js';import {c as pn,h as hn,o as on,C as mn,q as sn,j as ko}from'./chunk-Cq4k0Mf8.js';import'./chunk-CQZDxK4J.js';function O(r,e){r&1&&(Ds(0,"p",1),MC(1,"Loading integration\u2026"),pl());}function T(r,e){r&1&&(Ds(0,"ds-notice"),MC(1,"Failed to load this integration configuration."),pl());}function L(r,e){r&1&&(Ds(0,"div",3)(1,"ds-tag",9),MC(2,"YAML"),pl(),Ds(3,"ds-tag",10),MC(4,"Read-only"),pl()());}function k(r,e){if(r&1&&(Ds(0,"ds-card",2),Pw(1,L,5,0,"div",3),Ds(2,"dl",4)(3,"dt"),MC(4,"Name"),pl(),Ds(5,"dd"),MC(6),pl(),Ds(7,"dt"),MC(8,"Type"),pl(),Ds(9,"dd",5),MC(10),pl(),Ds(11,"dt"),MC(12,"Description"),pl(),Ds(13,"dd"),MC(14),pl(),Ds(15,"dt"),MC(16,"Scope"),pl(),Ds(17,"dd"),MC(18),pl(),Ds(19,"dt"),MC(20,"Source"),pl(),Ds(21,"dd"),MC(22),pl(),Ds(23,"dt"),MC(24,"Auto grant"),pl(),Ds(25,"dd"),MC(26),pl(),Ds(27,"dt"),MC(28,"Auth setting"),pl(),Ds(29,"dd"),MC(30),pl()()(),Ds(31,"ds-card",6)(32,"p",7),MC(33,"Sensitive values are always redacted."),pl(),Ds(34,"pre",8),MC(35),pl()()),r&2){let o=e,a=Xw();jE(),Lw(a.source()==="FILESYSTEM"?1:-1),jE(5),Og(o.name),jE(4),Og(o.integrationType),jE(4),Og(o.description||"\u2014"),jE(4),Og(a.scopeOf(o)),jE(4),Og(a.source()),jE(4),Og(o.autoGrant?"Enabled":"Disabled"),jE(4),Og(o.authSettingName||"None"),jE(5),Og(a.parameters());}}var w="\u2022\u2022\u2022\u2022\u2022\u2022",A=/(?:api[-_]?key|token|secret|password|passphrase|credential|private[-_]?key|client[-_]?secret|authorization|cookie)/i,V=class r{route=g(W);destroyRef=g(Ie);state=g(O$1);integrationId=this.route.snapshot.params.integrationId;isLoading=Ui(true);hasError=Ui(false);config=Ui(null);source=Ui("NEO4J");parameters=Ui("{}");ngOnInit(){this.state.getById(this.integrationId).pipe(U(this.destroyRef)).subscribe({next:e$1=>{this.config.set(e$1),this.source.set(e(e$1)),this.parameters.set(JSON.stringify(this.redact(e$1.parameters),null,2)),this.isLoading.set(false);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}scopeOf(e){let o=e.userId?e.namespaceId?"userOnNs":"userGlobal":e.namespaceId?"namespace":"platform";return {platform:"Platform",namespace:"Namespace",userOnNs:"Personal on namespace",userGlobal:"Personal global"}[o]}redact(e,o=""){return A.test(o)?w:e===null||typeof e=="boolean"||typeof e=="number"?e:typeof e=="string"?this.containsCredential(e)?w:e:Array.isArray(e)?e.map(a=>this.redact(a,o)):typeof e=="object"?Object.fromEntries(Object.entries(e).map(([a,m])=>[a,this.redact(m,a)])):String(e??"")}containsCredential(e){return /^(?:bearer\s+|basic\s+|sk[-_]|gh[opusr]_|xox[baprs]-|-----begin (?:rsa |ec |openssh )?private key-----)/i.test(e.trim())}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=mw({type:r,selectors:[["agentos-integration-config-view"]],decls:5,vars:1,consts:[["title","Integration configuration"],["role","status",1,"ds-hint"],["heading","General"],[1,"settings-table__tags"],["dsDefinitionList",""],[1,"ds-mono"],["heading","Parameters"],[1,"ds-hint"],[1,"ds-pre"],["variant","neutral"],["variant","outline"]],template:function(o,a){if(o&1&&(Ds(0,"ds-page"),lg(1,"ds-section-header",0),Pw(2,O,2,0,"p",1)(3,T,2,0,"ds-notice")(4,k,36,9),pl()),o&2){let m;jE(2),Lw(a.isLoading()?2:a.hasError()?3:(m=a.config())?4:-1,m);}},dependencies:[pn,hn,on,mn,sn,ko],encapsulation:2})};export{V as IntegrationConfigViewComponent};
@@ -1 +1 @@
1
- import {f,y,p as pt,T as Te,a as fn,U as Ut,n as nd,L as Lt,k as kn,m as mo,b as po,$ as $r,V as Vn,A as An,c as pn,h as hn,d as cn,e as dn,g as at,i as an}from'./chunk-DxKo0dCS.js';import {g,W,F,J,I as Ie,K as KC,U as Ui,o as Af,E as U,G as w,N as x,m as mw,D as Ds,l as lg,P as Pw,a as pl,Q as ug,j as jE,L as Lw,M as MC,q as qw,R as mg,T as SI,X as Xw,Y as MI,f as cg,v as vl,r as df,s as ff}from'./main-2IBYD645.js';var ne=/^(\/|[A-Za-z]:[\\/]|\\\\)/;function re(i){return ne.test(i)}function ee(i=()=>true){return t=>{let e=(t.value??"").trim();return !i()||e===""||re(e)?null:{absolutePath:true}}}function ae(i,t){i&1&&(Ds(0,"p",2),MC(1,"Loading\u2026"),pl());}function ie(i,t){if(i&1){let e=qw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let p=Xw();return ff(p.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),SI(),pl(),Ds(3,"ds-form-field",7),lg(4,"textarea",8),SI(),pl(),Ds(5,"ds-form-field",9),lg(6,"input",10),SI(),pl(),Ds(7,"ds-form-field",11),lg(8,"input",12),SI(),pl(),Ds(9,"ds-form-field",13),lg(10,"input",14),SI(),pl(),Ds(11,"ds-form-field",15),lg(12,"input",16),SI(),pl(),Ds(13,"ds-form-field",17),lg(14,"input",18),SI(),pl(),Ds(15,"ds-form-field",19)(16,"input",20),mg("input",function(p){df(e);let oe=Xw();return ff(oe.onMaxToolRoundsInput(p))}),pl(),SI(),pl(),Ds(17,"ds-form-actions")(18,"button",21),MC(19),pl(),Ds(20,"button",22),mg("click",function(){df(e);let p=Xw();return ff(p.cancel())}),MC(21,"Cancel"),pl()()();}if(i&2){let e=Xw();ug("formGroup",e.form),jE(2),ug("formControl",e.nameControl),MI(),jE(2),ug("formControl",e.descriptionControl),MI(),jE(2),ug("formControl",e.externalIdControl),MI(),jE(2),ug("formControl",e.defaultAgentNameControl),MI(),jE(2),ug("formControl",e.configPathControl),MI(),jE(),ug("hint",e.sharedExchangePathHint())("error",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid&&(e.sharedExchangePathControl.dirty||e.sharedExchangePathControl.touched)?"Enter an absolute path (e.g. /home/me/Coday or C:\\Coday), or leave the field empty.":null),jE(),ug("readOnly",!e.canEditSharedExchangePath())("formControl",e.sharedExchangePathControl),cg("aria-invalid",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid),MI(),jE(),ug("hint",e.runCostThresholdHint()),jE(),ug("placeholder",e.runCostThresholdPlaceholder())("formControl",e.runCostThresholdControl),MI(),jE(),ug("error",e.maxToolRoundsUnparsable()||e.maxToolRoundsControl.invalid&&(e.maxToolRoundsControl.dirty||e.maxToolRoundsControl.touched)?"Enter a whole number of at least 1, or leave the field empty.":null),jE(),ug("formControl",e.maxToolRoundsControl),cg("aria-invalid",e.maxToolRoundsControl.invalid||e.maxToolRoundsUnparsable()),MI(),jE(2),ug("disabled",e.form.invalid||e.isSubmitting()),jE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var le=1,se=2147483647,te=class i{route=g(W);router=g(F);namespaceController=g(J);destroyRef=g(Ie);usageConfiguration=g(f);userState=g(y);canEditSharedExchangePath=KC(()=>this.userState.currentUser()?.isAdmin===true);sharedExchangePathHint=KC(()=>this.canEditSharedExchangePath()?"Absolute path of a folder on the server that holds the files shared by the namespace. Leave empty for the default location.":"Only a super-admin can change this folder.");runCostThresholdPlaceholder=KC(()=>{let t=this.usageConfiguration.runCostThreshold();return this.usageConfiguration.enabled()?t===null?"No platform limit":`Platform default: ${t}`:"Optional maximum cost per run (e.g. 0.50)"});runCostThresholdHint=KC(()=>{let t="Leave empty to inherit the platform default",e=this.usageConfiguration.runCostThreshold();switch(this.usageConfiguration.state()){case "enabled":return e===null?`${t}: no limit.`:`${t} (${e}).`;case "disabled":return `${t}. Cost limits are inactive while usage tracking is disabled.`;default:return `${t}.`}});form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te("",{nonNullable:true}),configPath:new Te("",{nonNullable:true}),sharedExchangePath:new Te("",{nonNullable:true,validators:[ee(()=>this.canEditSharedExchangePath())]}),externalId:new Te("",{nonNullable:true}),defaultAgentName:new Te("",{nonNullable:true}),runCostThreshold:new Te(null),maxToolRounds:new Te(null,{validators:[fn.min(le),fn.max(se),fn.pattern(/^\d+$/)]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get configPathControl(){return this.form.controls.configPath}get sharedExchangePathControl(){return this.form.controls.sharedExchangePath}get externalIdControl(){return this.form.controls.externalId}get defaultAgentNameControl(){return this.form.controls.defaultAgentName}get runCostThresholdControl(){return this.form.controls.runCostThreshold}get maxToolRoundsControl(){return this.form.controls.maxToolRounds}maxToolRoundsUnparsable=Ui(false);onMaxToolRoundsInput(t){this.maxToolRoundsUnparsable.set(t.target.validity.badInput);}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);existingNamespace=null;constructor(){Af(()=>{this.canEditSharedExchangePath(),this.sharedExchangePathControl.updateValueAndValidity();});}ngOnInit(){this.userState.currentUser()||this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({error:()=>{}});let t=this.route.snapshot.paramMap.get("namespaceId")??this.route.parent?.snapshot.paramMap.get("namespaceId");t&&(this.isEditMode.set(true),this.loadNamespace(t));}loadNamespace(t){this.isLoading.set(true),this.namespaceController.getByIdNamespace(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingNamespace=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??""),this.configPathControl.setValue(e.configPath??""),this.sharedExchangePathControl.setValue(e.sharedExchangePath??""),this.externalIdControl.setValue(e.externalId??""),this.defaultAgentNameControl.setValue(e.defaultAgentName??""),this.runCostThresholdControl.setValue(e.runCostThreshold??null),this.maxToolRoundsControl.setValue(e.maxToolRounds??null),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.maxToolRoundsUnparsable()||this.isSubmitting())return;this.isSubmitting.set(true);let t=w(x(w({},this.existingNamespace),{name:this.nameControl.value.trim(),description:this.descriptionControl.value.trim()||void 0,configPath:this.configPathControl.value.trim()||void 0,externalId:this.externalIdControl.value.trim()||void 0,defaultAgentName:this.defaultAgentNameControl.value.trim()||void 0,runCostThreshold:this.runCostThresholdControl.value??void 0,maxToolRounds:this.maxToolRoundsControl.value??void 0}),this.canEditSharedExchangePath()?{sharedExchangePath:this.sharedExchangePathPayload()}:{});(this.isEditMode()?this.namespaceController.updateNamespace(this.existingNamespace.id??"",t):this.namespaceController.createNamespace(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}sharedExchangePathPayload(){return this.sharedExchangePathControl.value.trim()||(this.existingNamespace?.sharedExchangePath?"":void 0)}cancel(){this.navigateBack();}navigateBack(){this.router.navigate(["/agentos/namespaces"]);}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=mw({type:i,selectors:[["agentos-namespace-form"]],decls:4,vars:3,consts:[[3,"framed"],[3,"title"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","ns-name","required",""],["dsControl","","id","ns-name","type","text","placeholder","Namespace name","autocomplete","off",3,"formControl"],["label","Description","controlId","ns-description"],["dsControl","","id","ns-description","rows","4","placeholder","Optional description",3,"formControl"],["label","External ID","controlId","ns-external-id"],["dsControl","","id","ns-external-id","type","text","placeholder","Optional federation ID from an external system","autocomplete","off",3,"formControl"],["label","Default agent","controlId","ns-default-agent"],["dsControl","","id","ns-default-agent","type","text","placeholder","Logical name of the default agent (e.g. coday)","autocomplete","off",3,"formControl"],["label","Config path","controlId","ns-config-path"],["dsControl","","id","ns-config-path","type","text","placeholder","Optional path to base configuration directory","autocomplete","off",3,"formControl"],["label","Shared files folder","controlId","ns-shared-exchange-path","hintId","ns-shared-exchange-path-hint","errorId","ns-shared-exchange-path-error",3,"hint","error"],["dsControl","","id","ns-shared-exchange-path","type","text","placeholder","Default location managed by AgentOS","aria-describedby","ns-shared-exchange-path-hint","autocomplete","off",3,"readOnly","formControl"],["label","Run cost threshold","controlId","ns-run-cost-threshold","hintId","ns-run-cost-threshold-hint",3,"hint"],["dsControl","","id","ns-run-cost-threshold","type","number","min","0","step","0.01","aria-describedby","ns-run-cost-threshold-hint",3,"placeholder","formControl"],["label","Maximum tool rounds","controlId","ns-max-tool-rounds","hintId","ns-max-tool-rounds-hint","errorId","ns-max-tool-rounds-error","hint","Most tool rounds one agent run may take. Leave empty to inherit the server default. A change applies from the next agent run.",3,"error"],["dsControl","","id","ns-max-tool-rounds","type","number","min","1","step","1","placeholder","Server default","aria-describedby","ns-max-tool-rounds-hint",3,"input","formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"]],template:function(e,u){e&1&&(Ds(0,"ds-page",0),lg(1,"ds-section-header",1),Pw(2,ae,2,0,"p",2)(3,ie,22,19,"form",3),pl()),e&2&&(ug("framed",!u.isEditMode()),jE(),ug("title",u.isEditMode()?"Edit namespace":"New namespace"),jE(),Lw(u.isLoading()?2:3));},dependencies:[Ut,nd,Lt,kn,mo,po,$r,Vn,An,pn,hn,cn,dn,at,an],encapsulation:2})};export{te as NamespaceFormComponent};
1
+ import {f,y,p as pt,T as Te,a as fn,U as Ut,n as nd,L as Lt,k as kn,m as mo,b as po,$ as $r,V as Vn,A as An,c as pn,h as hn,d as cn,e as dn,g as at,i as an}from'./chunk-Cq4k0Mf8.js';import {g,W,F,J,I as Ie,K as KC,U as Ui,o as Af,E as U,G as w,N as x,m as mw,D as Ds,l as lg,P as Pw,a as pl,Q as ug,j as jE,L as Lw,M as MC,q as qw,R as mg,T as SI,X as Xw,Y as MI,f as cg,v as vl,r as df,s as ff}from'./main-CEEMKDJT.js';var ne=/^(\/|[A-Za-z]:[\\/]|\\\\)/;function re(i){return ne.test(i)}function ee(i=()=>true){return t=>{let e=(t.value??"").trim();return !i()||e===""||re(e)?null:{absolutePath:true}}}function ae(i,t){i&1&&(Ds(0,"p",2),MC(1,"Loading\u2026"),pl());}function ie(i,t){if(i&1){let e=qw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let p=Xw();return ff(p.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),SI(),pl(),Ds(3,"ds-form-field",7),lg(4,"textarea",8),SI(),pl(),Ds(5,"ds-form-field",9),lg(6,"input",10),SI(),pl(),Ds(7,"ds-form-field",11),lg(8,"input",12),SI(),pl(),Ds(9,"ds-form-field",13),lg(10,"input",14),SI(),pl(),Ds(11,"ds-form-field",15),lg(12,"input",16),SI(),pl(),Ds(13,"ds-form-field",17),lg(14,"input",18),SI(),pl(),Ds(15,"ds-form-field",19)(16,"input",20),mg("input",function(p){df(e);let oe=Xw();return ff(oe.onMaxToolRoundsInput(p))}),pl(),SI(),pl(),Ds(17,"ds-form-actions")(18,"button",21),MC(19),pl(),Ds(20,"button",22),mg("click",function(){df(e);let p=Xw();return ff(p.cancel())}),MC(21,"Cancel"),pl()()();}if(i&2){let e=Xw();ug("formGroup",e.form),jE(2),ug("formControl",e.nameControl),MI(),jE(2),ug("formControl",e.descriptionControl),MI(),jE(2),ug("formControl",e.externalIdControl),MI(),jE(2),ug("formControl",e.defaultAgentNameControl),MI(),jE(2),ug("formControl",e.configPathControl),MI(),jE(),ug("hint",e.sharedExchangePathHint())("error",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid&&(e.sharedExchangePathControl.dirty||e.sharedExchangePathControl.touched)?"Enter an absolute path (e.g. /home/me/Coday or C:\\Coday), or leave the field empty.":null),jE(),ug("readOnly",!e.canEditSharedExchangePath())("formControl",e.sharedExchangePathControl),cg("aria-invalid",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid),MI(),jE(),ug("hint",e.runCostThresholdHint()),jE(),ug("placeholder",e.runCostThresholdPlaceholder())("formControl",e.runCostThresholdControl),MI(),jE(),ug("error",e.maxToolRoundsUnparsable()||e.maxToolRoundsControl.invalid&&(e.maxToolRoundsControl.dirty||e.maxToolRoundsControl.touched)?"Enter a whole number of at least 1, or leave the field empty.":null),jE(),ug("formControl",e.maxToolRoundsControl),cg("aria-invalid",e.maxToolRoundsControl.invalid||e.maxToolRoundsUnparsable()),MI(),jE(2),ug("disabled",e.form.invalid||e.isSubmitting()),jE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var le=1,se=2147483647,te=class i{route=g(W);router=g(F);namespaceController=g(J);destroyRef=g(Ie);usageConfiguration=g(f);userState=g(y);canEditSharedExchangePath=KC(()=>this.userState.currentUser()?.isAdmin===true);sharedExchangePathHint=KC(()=>this.canEditSharedExchangePath()?"Absolute path of a folder on the server that holds the files shared by the namespace. Leave empty for the default location.":"Only a super-admin can change this folder.");runCostThresholdPlaceholder=KC(()=>{let t=this.usageConfiguration.runCostThreshold();return this.usageConfiguration.enabled()?t===null?"No platform limit":`Platform default: ${t}`:"Optional maximum cost per run (e.g. 0.50)"});runCostThresholdHint=KC(()=>{let t="Leave empty to inherit the platform default",e=this.usageConfiguration.runCostThreshold();switch(this.usageConfiguration.state()){case "enabled":return e===null?`${t}: no limit.`:`${t} (${e}).`;case "disabled":return `${t}. Cost limits are inactive while usage tracking is disabled.`;default:return `${t}.`}});form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te("",{nonNullable:true}),configPath:new Te("",{nonNullable:true}),sharedExchangePath:new Te("",{nonNullable:true,validators:[ee(()=>this.canEditSharedExchangePath())]}),externalId:new Te("",{nonNullable:true}),defaultAgentName:new Te("",{nonNullable:true}),runCostThreshold:new Te(null),maxToolRounds:new Te(null,{validators:[fn.min(le),fn.max(se),fn.pattern(/^\d+$/)]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get configPathControl(){return this.form.controls.configPath}get sharedExchangePathControl(){return this.form.controls.sharedExchangePath}get externalIdControl(){return this.form.controls.externalId}get defaultAgentNameControl(){return this.form.controls.defaultAgentName}get runCostThresholdControl(){return this.form.controls.runCostThreshold}get maxToolRoundsControl(){return this.form.controls.maxToolRounds}maxToolRoundsUnparsable=Ui(false);onMaxToolRoundsInput(t){this.maxToolRoundsUnparsable.set(t.target.validity.badInput);}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);existingNamespace=null;constructor(){Af(()=>{this.canEditSharedExchangePath(),this.sharedExchangePathControl.updateValueAndValidity();});}ngOnInit(){this.userState.currentUser()||this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({error:()=>{}});let t=this.route.snapshot.paramMap.get("namespaceId")??this.route.parent?.snapshot.paramMap.get("namespaceId");t&&(this.isEditMode.set(true),this.loadNamespace(t));}loadNamespace(t){this.isLoading.set(true),this.namespaceController.getByIdNamespace(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingNamespace=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??""),this.configPathControl.setValue(e.configPath??""),this.sharedExchangePathControl.setValue(e.sharedExchangePath??""),this.externalIdControl.setValue(e.externalId??""),this.defaultAgentNameControl.setValue(e.defaultAgentName??""),this.runCostThresholdControl.setValue(e.runCostThreshold??null),this.maxToolRoundsControl.setValue(e.maxToolRounds??null),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.maxToolRoundsUnparsable()||this.isSubmitting())return;this.isSubmitting.set(true);let t=w(x(w({},this.existingNamespace),{name:this.nameControl.value.trim(),description:this.descriptionControl.value.trim()||void 0,configPath:this.configPathControl.value.trim()||void 0,externalId:this.externalIdControl.value.trim()||void 0,defaultAgentName:this.defaultAgentNameControl.value.trim()||void 0,runCostThreshold:this.runCostThresholdControl.value??void 0,maxToolRounds:this.maxToolRoundsControl.value??void 0}),this.canEditSharedExchangePath()?{sharedExchangePath:this.sharedExchangePathPayload()}:{});(this.isEditMode()?this.namespaceController.updateNamespace(this.existingNamespace.id??"",t):this.namespaceController.createNamespace(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}sharedExchangePathPayload(){return this.sharedExchangePathControl.value.trim()||(this.existingNamespace?.sharedExchangePath?"":void 0)}cancel(){this.navigateBack();}navigateBack(){this.router.navigate(["/agentos/namespaces"]);}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=mw({type:i,selectors:[["agentos-namespace-form"]],decls:4,vars:3,consts:[[3,"framed"],[3,"title"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","ns-name","required",""],["dsControl","","id","ns-name","type","text","placeholder","Namespace name","autocomplete","off",3,"formControl"],["label","Description","controlId","ns-description"],["dsControl","","id","ns-description","rows","4","placeholder","Optional description",3,"formControl"],["label","External ID","controlId","ns-external-id"],["dsControl","","id","ns-external-id","type","text","placeholder","Optional federation ID from an external system","autocomplete","off",3,"formControl"],["label","Default agent","controlId","ns-default-agent"],["dsControl","","id","ns-default-agent","type","text","placeholder","Logical name of the default agent (e.g. coday)","autocomplete","off",3,"formControl"],["label","Config path","controlId","ns-config-path"],["dsControl","","id","ns-config-path","type","text","placeholder","Optional path to base configuration directory","autocomplete","off",3,"formControl"],["label","Shared files folder","controlId","ns-shared-exchange-path","hintId","ns-shared-exchange-path-hint","errorId","ns-shared-exchange-path-error",3,"hint","error"],["dsControl","","id","ns-shared-exchange-path","type","text","placeholder","Default location managed by AgentOS","aria-describedby","ns-shared-exchange-path-hint","autocomplete","off",3,"readOnly","formControl"],["label","Run cost threshold","controlId","ns-run-cost-threshold","hintId","ns-run-cost-threshold-hint",3,"hint"],["dsControl","","id","ns-run-cost-threshold","type","number","min","0","step","0.01","aria-describedby","ns-run-cost-threshold-hint",3,"placeholder","formControl"],["label","Maximum tool rounds","controlId","ns-max-tool-rounds","hintId","ns-max-tool-rounds-hint","errorId","ns-max-tool-rounds-error","hint","Most tool rounds one agent run may take. Leave empty to inherit the server default. A change applies from the next agent run.",3,"error"],["dsControl","","id","ns-max-tool-rounds","type","number","min","1","step","1","placeholder","Server default","aria-describedby","ns-max-tool-rounds-hint",3,"input","formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"]],template:function(e,u){e&1&&(Ds(0,"ds-page",0),lg(1,"ds-section-header",1),Pw(2,ae,2,0,"p",2)(3,ie,22,19,"form",3),pl()),e&2&&(ug("framed",!u.isEditMode()),jE(),ug("title",u.isEditMode()?"Edit namespace":"New namespace"),jE(),Lw(u.isLoading()?2:3));},dependencies:[Ut,nd,Lt,kn,mo,po,$r,Vn,An,pn,hn,cn,dn,at,an],encapsulation:2})};export{te as NamespaceFormComponent};
@@ -1 +1 @@
1
- import {O as O$1,g as at,h as hn,I as Io,j as ko,P}from'./chunk-DxKo0dCS.js';import {g,I as Ie,_ as W,$ as wr,U as Ui,K as KC,a0 as Me,a1 as fa,a2 as da,a3 as nn,E as U$1,m as mw,D as Ds,R as mg,a as pl,M as MC,P as Pw,j as jE,Q as ug,L as Lw,i as Vw,X as Xw,H as Hw,v as vl,O as Og}from'./main-2IBYD645.js';function q(e){if(e.sensitive)return e.configured?{status:"hidden",text:"set (hidden)"}:{status:"unset",text:"not set"};if(!e.configured)return {status:"unset",text:"unset"};let t=e.value??"",i=t.trim().toLowerCase();return i==="true"?{status:"on",text:"on"}:i==="false"?{status:"off",text:"off"}:{status:"value",text:t===""?"(empty)":t}}var U=(e,t)=>t.key;function B(e,t){e&1&&(Ds(0,"p",10),MC(1,"Loading the configuration failed. Try refreshing."),pl());}function V(e,t){e&1&&(Ds(0,"p",11),MC(1,"Loading configuration\u2026"),pl());}function j(e,t){e&1&&(Ds(0,"p",12),MC(1,"The service reported no settings."),pl());}function O(e,t){e&1&&(Ds(0,"p",11),MC(1,"No settings match the current filters."),pl());}function Y(e,t){e&1&&(Ds(0,"ds-tag",22),MC(1,"on"),pl());}function z(e,t){e&1&&(Ds(0,"ds-tag",20),MC(1,"off"),pl());}function H(e,t){if(e&1&&(Ds(0,"ds-tag",20),MC(1),pl()),e&2){let i=Xw().$implicit;jE(),Og(i.display.text);}}function G(e,t){if(e&1&&(Ds(0,"ds-tag",23),MC(1),pl()),e&2){let i=Xw().$implicit;jE(),Og(i.display.text);}}function J(e,t){if(e&1&&(Ds(0,"span",24),MC(1),pl()),e&2){let i=Xw().$implicit;jE(),Og(i.display.text);}}function K(e,t){if(e&1&&(Ds(0,"tr",16)(1,"td",18),MC(2),pl(),Ds(3,"td",19)(4,"ds-tag",20),MC(5),pl()(),Ds(6,"td",21),Pw(7,Y,2,0,"ds-tag",22)(8,z,2,0,"ds-tag",20)(9,H,2,1,"ds-tag",20)(10,G,2,1,"ds-tag",23)(11,J,2,1,"span",24),pl(),Ds(12,"td",25),MC(13),pl()()),e&2){let i,a=t.$implicit,m=Xw(2);jE(2),vl(" ",a.entry.key," "),jE(3),vl(" ",a.entry.source===m.Source.ENVIRONMENT?"Environment":"Property"," "),jE(2),Lw((i=a.display.status)==="on"?7:i==="off"?8:i==="hidden"?9:i==="unset"?10:11),jE(6),vl(" ",a.entry.description||"\u2014"," ");}}function Q(e,t){if(e&1&&(Ds(0,"div",13)(1,"table",14)(2,"thead",15)(3,"tr",16)(4,"th",17),MC(5,"Setting"),pl(),Ds(6,"th",17),MC(7,"Source"),pl(),Ds(8,"th",17),MC(9,"Value"),pl(),Ds(10,"th",17),MC(11,"Description"),pl()()(),Ds(12,"tbody",15),Vw(13,K,14,4,"tr",16,U),pl()()()),e&2){let i=Xw();jE(13),Hw(i.visibleRows());}}var A=class e{destroyRef=g(Ie);configurationController=g(W);refresh$=new wr(void 0);isLoading=Ui(true);loadError=Ui(false);rows=Ui([]);source=Ui("ALL");status=Ui("ALL");rowFilter=O$1(this.rows,t=>[t.entry.key,t.entry.description,t.entry.value].filter(Boolean).join(" "));visibleRows=KC(()=>this.rowFilter.filteredRows().filter(t=>{let i=this.source(),a=this.status();return i!=="ALL"&&t.entry.source!==i?false:a==="SET"?t.entry.configured:a==="UNSET"?!t.entry.configured:true}));Source=Me;constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.loadError.set(false),this.configurationController.listEffectiveConfiguration().pipe(da(()=>(this.loadError.set(true),this.isLoading.set(false),nn))))),U$1(this.destroyRef)).subscribe(t=>{this.rows.set(t.map(i=>({key:`${i.source}:${i.key}`,entry:i,display:q(i)}))),this.isLoading.set(false);});}reload(){this.refresh$.next();}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=mw({type:e,selectors:[["agentos-platform-configuration"]],decls:24,vars:6,consts:[["title","Configuration","description","Effective environment variables and Spring properties of the running service. Secrets are never shown, only whether they are set."],["label","Filter settings","placeholder","Filter settings\u2026",3,"queryChange","query"],["dsButton","","type","button",3,"click"],[1,"settings-table__toolbar"],["aria-label","Filter by source",1,"ds-control",2,"width","auto",3,"change","value"],["value","ALL"],[3,"value"],["aria-label","Filter by state",1,"ds-control",2,"width","auto",3,"change","value"],["value","SET"],["value","UNSET"],["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","Effective configuration"],["role","rowgroup"],["role","row"],["role","columnheader"],["role","cell","data-label","Setting","data-title","",1,"settings-table__name","ds-mono"],["role","cell","data-label","Source"],["variant","neutral"],["role","cell","data-label","Value"],["variant","accent"],["variant","outline"],[1,"ds-mono"],["role","cell","data-label","Description",1,"settings-table__secondary"]],template:function(i,a){i&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(c){return a.rowFilter.query.set(c)}),pl(),Ds(2,"button",2),mg("click",function(){return a.reload()}),MC(3,"Refresh"),pl()(),Ds(4,"div",3)(5,"select",4),mg("change",function(c){return a.source.set(c.target.value)}),Ds(6,"option",5),MC(7,"All sources"),pl(),Ds(8,"option",6),MC(9,"Environment variables"),pl(),Ds(10,"option",6),MC(11,"Spring properties"),pl()(),Ds(12,"select",7),mg("change",function(c){return a.status.set(c.target.value)}),Ds(13,"option",5),MC(14,"Set and unset"),pl(),Ds(15,"option",8),MC(16,"Set only"),pl(),Ds(17,"option",9),MC(18,"Unset only"),pl()()(),Pw(19,B,2,0,"p",10)(20,V,2,0,"p",11)(21,j,2,0,"p",12)(22,O,2,0,"p",11)(23,Q,15,0,"div",13)),i&2&&(jE(),ug("query",a.rowFilter.query()),jE(4),ug("value",a.source()),jE(3),ug("value",a.Source.ENVIRONMENT),jE(2),ug("value",a.Source.PROPERTY),jE(2),ug("value",a.status()),jE(7),Lw(a.loadError()?19:a.isLoading()?20:a.rows().length===0?21:a.visibleRows().length===0?22:23));},dependencies:[at,hn,Io,ko,P],encapsulation:2})};export{A as PlatformConfigurationComponent};
1
+ import {O as O$1,g as at,h as hn,I as Io,j as ko,P}from'./chunk-Cq4k0Mf8.js';import {g,I as Ie,_ as W,$ as wr,U as Ui,K as KC,a0 as Me,a1 as fa,a2 as da,a3 as nn,E as U$1,m as mw,D as Ds,R as mg,a as pl,M as MC,P as Pw,j as jE,Q as ug,L as Lw,i as Vw,X as Xw,H as Hw,v as vl,O as Og}from'./main-CEEMKDJT.js';function q(e){if(e.sensitive)return e.configured?{status:"hidden",text:"set (hidden)"}:{status:"unset",text:"not set"};if(!e.configured)return {status:"unset",text:"unset"};let t=e.value??"",i=t.trim().toLowerCase();return i==="true"?{status:"on",text:"on"}:i==="false"?{status:"off",text:"off"}:{status:"value",text:t===""?"(empty)":t}}var U=(e,t)=>t.key;function B(e,t){e&1&&(Ds(0,"p",10),MC(1,"Loading the configuration failed. Try refreshing."),pl());}function V(e,t){e&1&&(Ds(0,"p",11),MC(1,"Loading configuration\u2026"),pl());}function j(e,t){e&1&&(Ds(0,"p",12),MC(1,"The service reported no settings."),pl());}function O(e,t){e&1&&(Ds(0,"p",11),MC(1,"No settings match the current filters."),pl());}function Y(e,t){e&1&&(Ds(0,"ds-tag",22),MC(1,"on"),pl());}function z(e,t){e&1&&(Ds(0,"ds-tag",20),MC(1,"off"),pl());}function H(e,t){if(e&1&&(Ds(0,"ds-tag",20),MC(1),pl()),e&2){let i=Xw().$implicit;jE(),Og(i.display.text);}}function G(e,t){if(e&1&&(Ds(0,"ds-tag",23),MC(1),pl()),e&2){let i=Xw().$implicit;jE(),Og(i.display.text);}}function J(e,t){if(e&1&&(Ds(0,"span",24),MC(1),pl()),e&2){let i=Xw().$implicit;jE(),Og(i.display.text);}}function K(e,t){if(e&1&&(Ds(0,"tr",16)(1,"td",18),MC(2),pl(),Ds(3,"td",19)(4,"ds-tag",20),MC(5),pl()(),Ds(6,"td",21),Pw(7,Y,2,0,"ds-tag",22)(8,z,2,0,"ds-tag",20)(9,H,2,1,"ds-tag",20)(10,G,2,1,"ds-tag",23)(11,J,2,1,"span",24),pl(),Ds(12,"td",25),MC(13),pl()()),e&2){let i,a=t.$implicit,m=Xw(2);jE(2),vl(" ",a.entry.key," "),jE(3),vl(" ",a.entry.source===m.Source.ENVIRONMENT?"Environment":"Property"," "),jE(2),Lw((i=a.display.status)==="on"?7:i==="off"?8:i==="hidden"?9:i==="unset"?10:11),jE(6),vl(" ",a.entry.description||"\u2014"," ");}}function Q(e,t){if(e&1&&(Ds(0,"div",13)(1,"table",14)(2,"thead",15)(3,"tr",16)(4,"th",17),MC(5,"Setting"),pl(),Ds(6,"th",17),MC(7,"Source"),pl(),Ds(8,"th",17),MC(9,"Value"),pl(),Ds(10,"th",17),MC(11,"Description"),pl()()(),Ds(12,"tbody",15),Vw(13,K,14,4,"tr",16,U),pl()()()),e&2){let i=Xw();jE(13),Hw(i.visibleRows());}}var A=class e{destroyRef=g(Ie);configurationController=g(W);refresh$=new wr(void 0);isLoading=Ui(true);loadError=Ui(false);rows=Ui([]);source=Ui("ALL");status=Ui("ALL");rowFilter=O$1(this.rows,t=>[t.entry.key,t.entry.description,t.entry.value].filter(Boolean).join(" "));visibleRows=KC(()=>this.rowFilter.filteredRows().filter(t=>{let i=this.source(),a=this.status();return i!=="ALL"&&t.entry.source!==i?false:a==="SET"?t.entry.configured:a==="UNSET"?!t.entry.configured:true}));Source=Me;constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.loadError.set(false),this.configurationController.listEffectiveConfiguration().pipe(da(()=>(this.loadError.set(true),this.isLoading.set(false),nn))))),U$1(this.destroyRef)).subscribe(t=>{this.rows.set(t.map(i=>({key:`${i.source}:${i.key}`,entry:i,display:q(i)}))),this.isLoading.set(false);});}reload(){this.refresh$.next();}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=mw({type:e,selectors:[["agentos-platform-configuration"]],decls:24,vars:6,consts:[["title","Configuration","description","Effective environment variables and Spring properties of the running service. Secrets are never shown, only whether they are set."],["label","Filter settings","placeholder","Filter settings\u2026",3,"queryChange","query"],["dsButton","","type","button",3,"click"],[1,"settings-table__toolbar"],["aria-label","Filter by source",1,"ds-control",2,"width","auto",3,"change","value"],["value","ALL"],[3,"value"],["aria-label","Filter by state",1,"ds-control",2,"width","auto",3,"change","value"],["value","SET"],["value","UNSET"],["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","Effective configuration"],["role","rowgroup"],["role","row"],["role","columnheader"],["role","cell","data-label","Setting","data-title","",1,"settings-table__name","ds-mono"],["role","cell","data-label","Source"],["variant","neutral"],["role","cell","data-label","Value"],["variant","accent"],["variant","outline"],[1,"ds-mono"],["role","cell","data-label","Description",1,"settings-table__secondary"]],template:function(i,a){i&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(c){return a.rowFilter.query.set(c)}),pl(),Ds(2,"button",2),mg("click",function(){return a.reload()}),MC(3,"Refresh"),pl()(),Ds(4,"div",3)(5,"select",4),mg("change",function(c){return a.source.set(c.target.value)}),Ds(6,"option",5),MC(7,"All sources"),pl(),Ds(8,"option",6),MC(9,"Environment variables"),pl(),Ds(10,"option",6),MC(11,"Spring properties"),pl()(),Ds(12,"select",7),mg("change",function(c){return a.status.set(c.target.value)}),Ds(13,"option",5),MC(14,"Set and unset"),pl(),Ds(15,"option",8),MC(16,"Set only"),pl(),Ds(17,"option",9),MC(18,"Unset only"),pl()()(),Pw(19,B,2,0,"p",10)(20,V,2,0,"p",11)(21,j,2,0,"p",12)(22,O,2,0,"p",11)(23,Q,15,0,"div",13)),i&2&&(jE(),ug("query",a.rowFilter.query()),jE(4),ug("value",a.source()),jE(3),ug("value",a.Source.ENVIRONMENT),jE(2),ug("value",a.Source.PROPERTY),jE(2),ug("value",a.status()),jE(7),Lw(a.loadError()?19:a.isLoading()?20:a.rows().length===0?21:a.visibleRows().length===0?22:23));},dependencies:[at,hn,Io,ko,P],encapsulation:2})};export{A as PlatformConfigurationComponent};
@@ -1 +1 @@
1
- import {S}from'./chunk-DxKo0dCS.js';import {m as mw,Z as br,D as Ds,M as MC,a as pl,l as lg,Q as ug}from'./main-2IBYD645.js';var c=class a{groups=[{label:"Access",items:[{label:"Users & Groups",commands:["users"]},{label:"Auth settings",commands:["auth-settings"]}]},{label:"Connections",items:[{label:"Platform integrations",commands:["integration-configs"]}]},{label:"AI",items:[{label:"Platform agents",commands:["agent-configs"]},{label:"Platform AI providers",commands:["ai-providers"]},{label:"Platform AI models",commands:["ai-models"]},{label:"Platform skills",commands:["skills"]},{label:"Platform prompts",commands:["prompts"]}]},{label:"Automation",items:[{label:"Scheduled prompts",commands:["scheduled-prompts"]},{label:"Tool invoke",commands:["tool-invoke"]}]},{label:"System",items:[{label:"Configuration",commands:["configuration"]}]}];static \u0275fac=function(e){return new(e||a)};static \u0275cmp=mw({type:a,selectors:[["agentos-admin-settings-layout"]],decls:9,vars:1,consts:[["title","Admin \xB7 Configuration","mark","A","navigationLabel","Admin settings",3,"groups"],["settingsBreadcrumb","","aria-label","Breadcrumb"],["aria-hidden","true"]],template:function(e,g){e&1&&(Ds(0,"agentos-settings-layout",0)(1,"nav",1)(2,"span"),MC(3,"Platform"),pl(),Ds(4,"span",2),MC(5,"/"),pl(),Ds(6,"span"),MC(7,"Administration"),pl()(),lg(8,"router-outlet"),pl()),e&2&&ug("groups",g.groups);},dependencies:[br,S],styles:["nav[settingsBreadcrumb][_ngcontent-%COMP%]{display:flex;gap:8px;align-items:center}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-accent-700);text-decoration:none}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:2px}"]})};export{c as AdminSettingsLayoutComponent};
1
+ import {S}from'./chunk-Cq4k0Mf8.js';import {m as mw,Z as br,D as Ds,M as MC,a as pl,l as lg,Q as ug}from'./main-CEEMKDJT.js';var c=class a{groups=[{label:"Access",items:[{label:"Users & Groups",commands:["users"]},{label:"Auth settings",commands:["auth-settings"]}]},{label:"Connections",items:[{label:"Platform integrations",commands:["integration-configs"]}]},{label:"AI",items:[{label:"Platform agents",commands:["agent-configs"]},{label:"Platform AI providers",commands:["ai-providers"]},{label:"Platform AI models",commands:["ai-models"]},{label:"Platform skills",commands:["skills"]},{label:"Platform prompts",commands:["prompts"]}]},{label:"Automation",items:[{label:"Scheduled prompts",commands:["scheduled-prompts"]},{label:"Tool invoke",commands:["tool-invoke"]}]},{label:"System",items:[{label:"Configuration",commands:["configuration"]}]}];static \u0275fac=function(e){return new(e||a)};static \u0275cmp=mw({type:a,selectors:[["agentos-admin-settings-layout"]],decls:9,vars:1,consts:[["title","Admin \xB7 Configuration","mark","A","navigationLabel","Admin settings",3,"groups"],["settingsBreadcrumb","","aria-label","Breadcrumb"],["aria-hidden","true"]],template:function(e,g){e&1&&(Ds(0,"agentos-settings-layout",0)(1,"nav",1)(2,"span"),MC(3,"Platform"),pl(),Ds(4,"span",2),MC(5,"/"),pl(),Ds(6,"span"),MC(7,"Administration"),pl()(),lg(8,"router-outlet"),pl()),e&2&&ug("groups",g.groups);},dependencies:[br,S],styles:["nav[settingsBreadcrumb][_ngcontent-%COMP%]{display:flex;gap:8px;align-items:center}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-accent-700);text-decoration:none}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:2px}"]})};export{c as AdminSettingsLayoutComponent};
@@ -1 +1 @@
1
- import {e}from'./chunk-C6dIhkYp.js';import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-CvaAqsbw.js';import {O}from'./chunk-D9sUF55R.js';import {g,W as W$1,F,I as Ie,J,U as Ui,E as U$1,ad as ne$1,a1 as fa,aa as Cr,m as mw,D as Ds,R as mg,a as pl,M as MC,P as Pw,Q as ug,j as jE,L as Lw,X as Xw,O as Og,i as Vw,H as Hw,v as vl,q as qw,f as cg,r as df,s as ff}from'./main-2IBYD645.js';import {z as k,O as O$1,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-DxKo0dCS.js';import'./chunk-gjFAR1Z5.js';var Q=(n,e)=>e.key;function W(n,e){if(n&1&&(Ds(0,"p",3),MC(1),pl()),n&2){let t=Xw();jE(),Og(t.deletion.error());}}function X(n,e){n&1&&(Ds(0,"p",4),MC(1,"Loading integrations\u2026"),pl());}function Z(n,e){n&1&&(Ds(0,"p",5),MC(1,"No integrations available."),pl());}function ee(n,e){n&1&&(Ds(0,"p",4),MC(1,"No integrations match the current filter."),pl());}function te(n,e){n&1&&(Ds(0,"ds-tag",20),MC(1,"YAML"),pl(),Ds(2,"ds-tag",21),MC(3,"Read-only"),pl());}function ne(n,e){if(n&1){let t=qw();Ds(0,"button",22),mg("click",function(){df(t);let s=Xw().$implicit,c=Xw(2);return ff(c.view(s))}),MC(1,"View"),pl();}if(n&2){let t=Xw().$implicit;cg("aria-label","View "+t.config.name);}}function ie(n,e){if(n&1){let t=qw();Ds(0,"button",22),mg("click",function(){df(t);let s=Xw(3).$implicit,c=Xw(2);return ff(c.edit(s))}),MC(1," Edit "),pl();}if(n&2){let t=Xw(3).$implicit;cg("aria-label","Edit "+t.config.name);}}function oe(n,e){if(n&1){let t=qw();Ds(0,"button",22),mg("click",function(){df(t);let s=Xw(2).$implicit,c=Xw(2);return ff(c.duplicate(s))}),MC(1," Duplicate "),pl(),Pw(2,ie,2,1,"button",19);}if(n&2){let t=Xw(2).$implicit;cg("aria-label","Duplicate "+t.config.name),jE(2),Lw(t.canEdit?2:-1);}}function ae(n,e){if(n&1){let t=qw();Ds(0,"agentos-row-delete-action",25),mg("deleteRequested",function(){df(t);let s=Xw(2).$implicit,c=Xw(2);return ff(c.deletion.request(s.key))})("deleteConfirmed",function(){df(t);let s=Xw(2).$implicit,c=Xw(2);return ff(c.confirmDelete(s))})("deleteCancelled",function(){df(t);let s=Xw(4);return ff(s.deletion.cancel())}),pl();}if(n&2){let t=Xw(2).$implicit,a=Xw(2);ug("rowKey",t.key)("rowLabel",t.config.name)("state",a.deletion);}}function re(n,e){n&1&&(Ds(0,"button",24),MC(1,"Inherited"),pl());}function le(n,e){if(n&1&&(Pw(0,oe,3,2),Pw(1,ae,1,3,"agentos-row-delete-action",23),Pw(2,re,2,0,"button",24)),n&2){let t=Xw().$implicit,a=Xw(2);Lw(a.deletion.confirmingId()!==t.key?0:-1),jE(),Lw(t.canDelete?1:-1),jE(),Lw(!t.canEdit&&!t.canDelete?2:-1);}}function se(n,e){if(n&1&&(Ds(0,"tr",9)(1,"td",12),MC(2),pl(),Ds(3,"td",13),MC(4),pl(),Ds(5,"td",14)(6,"div",15)(7,"ds-tag",16),MC(8),pl(),Pw(9,te,4,0),pl()(),Ds(10,"td",17)(11,"div",18),Pw(12,ne,2,1,"button",19)(13,le,3,3),pl()()()),n&2){let t=e.$implicit;jE(2),Og(t.config.name),jE(2),vl(" ",t.config.integrationType," "),jE(3),ug("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),jE(),vl(" ",t.scopeLabel," "),jE(),Lw(t.source==="FILESYSTEM"?9:-1),jE(3),Lw(t.source==="FILESYSTEM"?12:13);}}function ce(n,e){if(n&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),MC(5,"Name"),pl(),Ds(6,"th",10),MC(7,"Type"),pl(),Ds(8,"th",10),MC(9,"Scope"),pl(),Ds(10,"th",10)(11,"span",11),MC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Vw(14,se,14,6,"tr",9,Q),pl()()()),n&2){let t=Xw();jE(14),Hw(t.rowFilter.filteredRows());}}var U=class n$1{route=g(W$1);router=g(F);destroyRef=g(Ie);state=g(O);namespaceRole=g(v);namespaceApi=g(J);namespaceId=this.route.snapshot.params.namespaceId;namespaceName=Ui("this namespace");isAdmin=Ui(false);isLoading=Ui(true);rows=Ui([]);deletion=k();rowFilter=O$1(this.rows,e=>[e.config.name,e.config.integrationType,e.scopeLabel,e.source].join(" "));ngOnInit(){this.state.setNamespace(this.namespaceId),this.namespaceId&&this.namespaceApi.getByIdNamespace(this.namespaceId).pipe(U$1(this.destroyRef)).subscribe({next:e=>this.namespaceName.set(e.name)}),this.route.paramMap.pipe(ne$1(e=>e.get("namespaceId")??""),fa(e=>e?this.namespaceRole.isAdminOfNamespace$(e):Cr(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=mw({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&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(c){return a.rowFilter.query.set(c)}),pl(),Ds(2,"button",2),mg("click",function(){return a.openCreateForm()}),MC(3,"New integration"),pl()(),Pw(4,W,2,1,"p",3),Pw(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&&(ug("description","Integrations for "+a.namespaceName()+", including entries inherited from the platform."),jE(),ug("query",a.rowFilter.query()),jE(3),Lw(a.deletion.error()?4:-1),jE(),Lw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{U as IntegrationsAllScopesComponent};
1
+ import {e}from'./chunk-C6dIhkYp.js';import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-CU5VTmsN.js';import {O}from'./chunk-bqhgjnlz.js';import {g,W as W$1,F,I as Ie,J,U as Ui,E as U$1,ad as ne$1,a1 as fa,aa as Cr,m as mw,D as Ds,R as mg,a as pl,M as MC,P as Pw,Q as ug,j as jE,L as Lw,X as Xw,O as Og,i as Vw,H as Hw,v as vl,q as qw,f as cg,r as df,s as ff}from'./main-CEEMKDJT.js';import {z as k,O as O$1,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-Cq4k0Mf8.js';import'./chunk-CQZDxK4J.js';var Q=(n,e)=>e.key;function W(n,e){if(n&1&&(Ds(0,"p",3),MC(1),pl()),n&2){let t=Xw();jE(),Og(t.deletion.error());}}function X(n,e){n&1&&(Ds(0,"p",4),MC(1,"Loading integrations\u2026"),pl());}function Z(n,e){n&1&&(Ds(0,"p",5),MC(1,"No integrations available."),pl());}function ee(n,e){n&1&&(Ds(0,"p",4),MC(1,"No integrations match the current filter."),pl());}function te(n,e){n&1&&(Ds(0,"ds-tag",20),MC(1,"YAML"),pl(),Ds(2,"ds-tag",21),MC(3,"Read-only"),pl());}function ne(n,e){if(n&1){let t=qw();Ds(0,"button",22),mg("click",function(){df(t);let s=Xw().$implicit,c=Xw(2);return ff(c.view(s))}),MC(1,"View"),pl();}if(n&2){let t=Xw().$implicit;cg("aria-label","View "+t.config.name);}}function ie(n,e){if(n&1){let t=qw();Ds(0,"button",22),mg("click",function(){df(t);let s=Xw(3).$implicit,c=Xw(2);return ff(c.edit(s))}),MC(1," Edit "),pl();}if(n&2){let t=Xw(3).$implicit;cg("aria-label","Edit "+t.config.name);}}function oe(n,e){if(n&1){let t=qw();Ds(0,"button",22),mg("click",function(){df(t);let s=Xw(2).$implicit,c=Xw(2);return ff(c.duplicate(s))}),MC(1," Duplicate "),pl(),Pw(2,ie,2,1,"button",19);}if(n&2){let t=Xw(2).$implicit;cg("aria-label","Duplicate "+t.config.name),jE(2),Lw(t.canEdit?2:-1);}}function ae(n,e){if(n&1){let t=qw();Ds(0,"agentos-row-delete-action",25),mg("deleteRequested",function(){df(t);let s=Xw(2).$implicit,c=Xw(2);return ff(c.deletion.request(s.key))})("deleteConfirmed",function(){df(t);let s=Xw(2).$implicit,c=Xw(2);return ff(c.confirmDelete(s))})("deleteCancelled",function(){df(t);let s=Xw(4);return ff(s.deletion.cancel())}),pl();}if(n&2){let t=Xw(2).$implicit,a=Xw(2);ug("rowKey",t.key)("rowLabel",t.config.name)("state",a.deletion);}}function re(n,e){n&1&&(Ds(0,"button",24),MC(1,"Inherited"),pl());}function le(n,e){if(n&1&&(Pw(0,oe,3,2),Pw(1,ae,1,3,"agentos-row-delete-action",23),Pw(2,re,2,0,"button",24)),n&2){let t=Xw().$implicit,a=Xw(2);Lw(a.deletion.confirmingId()!==t.key?0:-1),jE(),Lw(t.canDelete?1:-1),jE(),Lw(!t.canEdit&&!t.canDelete?2:-1);}}function se(n,e){if(n&1&&(Ds(0,"tr",9)(1,"td",12),MC(2),pl(),Ds(3,"td",13),MC(4),pl(),Ds(5,"td",14)(6,"div",15)(7,"ds-tag",16),MC(8),pl(),Pw(9,te,4,0),pl()(),Ds(10,"td",17)(11,"div",18),Pw(12,ne,2,1,"button",19)(13,le,3,3),pl()()()),n&2){let t=e.$implicit;jE(2),Og(t.config.name),jE(2),vl(" ",t.config.integrationType," "),jE(3),ug("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),jE(),vl(" ",t.scopeLabel," "),jE(),Lw(t.source==="FILESYSTEM"?9:-1),jE(3),Lw(t.source==="FILESYSTEM"?12:13);}}function ce(n,e){if(n&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),MC(5,"Name"),pl(),Ds(6,"th",10),MC(7,"Type"),pl(),Ds(8,"th",10),MC(9,"Scope"),pl(),Ds(10,"th",10)(11,"span",11),MC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Vw(14,se,14,6,"tr",9,Q),pl()()()),n&2){let t=Xw();jE(14),Hw(t.rowFilter.filteredRows());}}var U=class n$1{route=g(W$1);router=g(F);destroyRef=g(Ie);state=g(O);namespaceRole=g(v);namespaceApi=g(J);namespaceId=this.route.snapshot.params.namespaceId;namespaceName=Ui("this namespace");isAdmin=Ui(false);isLoading=Ui(true);rows=Ui([]);deletion=k();rowFilter=O$1(this.rows,e=>[e.config.name,e.config.integrationType,e.scopeLabel,e.source].join(" "));ngOnInit(){this.state.setNamespace(this.namespaceId),this.namespaceId&&this.namespaceApi.getByIdNamespace(this.namespaceId).pipe(U$1(this.destroyRef)).subscribe({next:e=>this.namespaceName.set(e.name)}),this.route.paramMap.pipe(ne$1(e=>e.get("namespaceId")??""),fa(e=>e?this.namespaceRole.isAdminOfNamespace$(e):Cr(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=mw({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&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(c){return a.rowFilter.query.set(c)}),pl(),Ds(2,"button",2),mg("click",function(){return a.openCreateForm()}),MC(3,"New integration"),pl()(),Pw(4,W,2,1,"p",3),Pw(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&&(ug("description","Integrations for "+a.namespaceName()+", including entries inherited from the platform."),jE(),ug("query",a.rowFilter.query()),jE(3),Lw(a.deletion.error()?4:-1),jE(),Lw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{U as IntegrationsAllScopesComponent};
@@ -1 +1 @@
1
- import {z as k$1,O as O$1,g as at,h as hn,I as Io,P,B as P$1}from'./chunk-DxKo0dCS.js';import {g,F,I as Ie,aq as k,ap as F$1,$ as wr,U as Ui,a1 as fa,at as wy,E as U$1,m as mw,D as Ds,R as mg,a as pl,M as MC,P as Pw,j as jE,Q as ug,L as Lw,X as Xw,O as Og,i as Vw,H as Hw,q as qw,r as df,s as ff,v as vl,f as cg}from'./main-2IBYD645.js';var K=(o,t)=>t.key;function H(o,t){if(o&1&&(Ds(0,"p",3),MC(1),pl()),o&2){let e=Xw();jE(),Og(e.deletion.error());}}function U(o,t){o&1&&(Ds(0,"p",4),MC(1,"Loading AI models\u2026"),pl());}function z(o,t){o&1&&(Ds(0,"p",5),MC(1,"No platform AI models defined yet."),pl());}function G(o,t){o&1&&(Ds(0,"p",4),MC(1,"No AI models match the current filter."),pl());}function J(o,t){if(o&1){let e=qw();Ds(0,"button",21),mg("click",function(){df(e);let r=Xw().$implicit,m=Xw(2);return ff(m.edit(r))}),MC(1,"Edit"),pl();}if(o&2){let e=Xw().$implicit;cg("aria-label","Edit "+e.title);}}function O(o,t){if(o&1){let e=qw();Ds(0,"tr",9)(1,"td",12),MC(2),pl(),Ds(3,"td",13),MC(4),pl(),Ds(5,"td",14),MC(6),pl(),Ds(7,"td",15),MC(8),pl(),Ds(9,"td",16),MC(10),pl(),Ds(11,"td",17)(12,"div",18),Pw(13,J,2,1,"button",19),Ds(14,"agentos-row-delete-action",20),mg("deleteRequested",function(){let r=df(e).$implicit,m=Xw(2);return ff(m.deletion.request(r.key))})("deleteConfirmed",function(){let r=df(e).$implicit,m=Xw(2);return ff(m.confirmDelete(r))})("deleteCancelled",function(){df(e);let r=Xw(2);return ff(r.deletion.cancel())}),pl()()()();}if(o&2){let e=t.$implicit,a=Xw(2);jE(2),Og(e.title),jE(2),Og(e.providerName),jE(2),vl(" ",e.model.apiModelName," "),jE(2),Og(e.model.priority),jE(2),vl(" ",e.model.reasoningEffort?e.model.reasoningEffort.toLowerCase():"\u2014"," "),jE(3),Lw(a.deletion.confirmingId()!==e.key?13:-1),jE(),ug("rowKey",e.key)("rowLabel",e.title)("state",a.deletion);}}function Q(o,t){if(o&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),MC(5,"Name"),pl(),Ds(6,"th",10),MC(7,"Provider"),pl(),Ds(8,"th",10),MC(9,"API model name"),pl(),Ds(10,"th",10),MC(11,"Priority"),pl(),Ds(12,"th",10),MC(13,"Reasoning effort"),pl(),Ds(14,"th",10)(15,"span",11),MC(16,"Actions"),pl()()()(),Ds(17,"tbody",8),Vw(18,O,15,9,"tr",9,K),pl()()()),o&2){let e=Xw();jE(18),Hw(e.rowFilter.filteredRows());}}var j=class o{router=g(F);destroyRef=g(Ie);aiModelController=g(k);aiProviderController=g(F$1);refresh$=new wr(void 0);isLoading=Ui(true);deletion=k$1();rows=Ui([]);rowFilter=O$1(this.rows,t=>[t.title,t.model.apiModelName,t.providerName].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),wy([this.aiModelController.listPlatformLevelAiModel(),this.aiProviderController.listAiProvider("none")]))),U$1(this.destroyRef)).subscribe({next:([t,e])=>{let a=new Map(e.map(r=>[r.id??"",r.name]));this.rows.set(t.map((r,m)=>({key:r.id??`model:${m}`,model:r,title:r.alias??r.apiModelName,providerName:a.get(r.aiProviderId)??r.aiProviderId}))),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","ai-models","new"]);}edit(t){t.model.id&&this.router.navigate(["/agentos","admin","ai-models",t.model.id,"edit"]);}confirmDelete(t){t.model.id&&this.deletion.execute(t.key,{request$:this.aiModelController.deleteAiModel(t.model.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${t.title}" failed. Try again.`});}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=mw({type:o,selectors:[["agentos-platform-ai-models"]],decls:9,vars:3,consts:[["title","Platform AI models","description","AI models shared across every namespace."],["label","Filter AI models","placeholder","Filter AI models\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform AI models"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Provider"],["role","cell","data-label","API model name",1,"settings-table__secondary"],["role","cell","data-label","Priority"],["role","cell","data-label","Reasoning effort"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(e,a){e&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return a.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return a.openCreateForm()}),MC(3,"New AI model"),pl()(),Pw(4,H,2,1,"p",3),Pw(5,U,2,0,"p",4)(6,z,2,0,"p",5)(7,G,2,0,"p",4)(8,Q,20,0,"div",6)),e&2&&(jE(),ug("query",a.rowFilter.query()),jE(3),Lw(a.deletion.error()?4:-1),jE(),Lw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{j as PlatformAiModelsComponent};
1
+ import {z as k$1,O as O$1,g as at,h as hn,I as Io,P,B as P$1}from'./chunk-Cq4k0Mf8.js';import {g,F,I as Ie,aq as k,ap as F$1,$ as wr,U as Ui,a1 as fa,at as wy,E as U$1,m as mw,D as Ds,R as mg,a as pl,M as MC,P as Pw,j as jE,Q as ug,L as Lw,X as Xw,O as Og,i as Vw,H as Hw,q as qw,r as df,s as ff,v as vl,f as cg}from'./main-CEEMKDJT.js';var K=(o,t)=>t.key;function H(o,t){if(o&1&&(Ds(0,"p",3),MC(1),pl()),o&2){let e=Xw();jE(),Og(e.deletion.error());}}function U(o,t){o&1&&(Ds(0,"p",4),MC(1,"Loading AI models\u2026"),pl());}function z(o,t){o&1&&(Ds(0,"p",5),MC(1,"No platform AI models defined yet."),pl());}function G(o,t){o&1&&(Ds(0,"p",4),MC(1,"No AI models match the current filter."),pl());}function J(o,t){if(o&1){let e=qw();Ds(0,"button",21),mg("click",function(){df(e);let r=Xw().$implicit,m=Xw(2);return ff(m.edit(r))}),MC(1,"Edit"),pl();}if(o&2){let e=Xw().$implicit;cg("aria-label","Edit "+e.title);}}function O(o,t){if(o&1){let e=qw();Ds(0,"tr",9)(1,"td",12),MC(2),pl(),Ds(3,"td",13),MC(4),pl(),Ds(5,"td",14),MC(6),pl(),Ds(7,"td",15),MC(8),pl(),Ds(9,"td",16),MC(10),pl(),Ds(11,"td",17)(12,"div",18),Pw(13,J,2,1,"button",19),Ds(14,"agentos-row-delete-action",20),mg("deleteRequested",function(){let r=df(e).$implicit,m=Xw(2);return ff(m.deletion.request(r.key))})("deleteConfirmed",function(){let r=df(e).$implicit,m=Xw(2);return ff(m.confirmDelete(r))})("deleteCancelled",function(){df(e);let r=Xw(2);return ff(r.deletion.cancel())}),pl()()()();}if(o&2){let e=t.$implicit,a=Xw(2);jE(2),Og(e.title),jE(2),Og(e.providerName),jE(2),vl(" ",e.model.apiModelName," "),jE(2),Og(e.model.priority),jE(2),vl(" ",e.model.reasoningEffort?e.model.reasoningEffort.toLowerCase():"\u2014"," "),jE(3),Lw(a.deletion.confirmingId()!==e.key?13:-1),jE(),ug("rowKey",e.key)("rowLabel",e.title)("state",a.deletion);}}function Q(o,t){if(o&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),MC(5,"Name"),pl(),Ds(6,"th",10),MC(7,"Provider"),pl(),Ds(8,"th",10),MC(9,"API model name"),pl(),Ds(10,"th",10),MC(11,"Priority"),pl(),Ds(12,"th",10),MC(13,"Reasoning effort"),pl(),Ds(14,"th",10)(15,"span",11),MC(16,"Actions"),pl()()()(),Ds(17,"tbody",8),Vw(18,O,15,9,"tr",9,K),pl()()()),o&2){let e=Xw();jE(18),Hw(e.rowFilter.filteredRows());}}var j=class o{router=g(F);destroyRef=g(Ie);aiModelController=g(k);aiProviderController=g(F$1);refresh$=new wr(void 0);isLoading=Ui(true);deletion=k$1();rows=Ui([]);rowFilter=O$1(this.rows,t=>[t.title,t.model.apiModelName,t.providerName].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),wy([this.aiModelController.listPlatformLevelAiModel(),this.aiProviderController.listAiProvider("none")]))),U$1(this.destroyRef)).subscribe({next:([t,e])=>{let a=new Map(e.map(r=>[r.id??"",r.name]));this.rows.set(t.map((r,m)=>({key:r.id??`model:${m}`,model:r,title:r.alias??r.apiModelName,providerName:a.get(r.aiProviderId)??r.aiProviderId}))),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","ai-models","new"]);}edit(t){t.model.id&&this.router.navigate(["/agentos","admin","ai-models",t.model.id,"edit"]);}confirmDelete(t){t.model.id&&this.deletion.execute(t.key,{request$:this.aiModelController.deleteAiModel(t.model.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${t.title}" failed. Try again.`});}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=mw({type:o,selectors:[["agentos-platform-ai-models"]],decls:9,vars:3,consts:[["title","Platform AI models","description","AI models shared across every namespace."],["label","Filter AI models","placeholder","Filter AI models\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform AI models"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Provider"],["role","cell","data-label","API model name",1,"settings-table__secondary"],["role","cell","data-label","Priority"],["role","cell","data-label","Reasoning effort"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(e,a){e&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return a.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return a.openCreateForm()}),MC(3,"New AI model"),pl()(),Pw(4,H,2,1,"p",3),Pw(5,U,2,0,"p",4)(6,z,2,0,"p",5)(7,G,2,0,"p",4)(8,Q,20,0,"div",6)),e&2&&(jE(),ug("query",a.rowFilter.query()),jE(3),Lw(a.deletion.error()?4:-1),jE(),Lw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{j as PlatformAiModelsComponent};
@@ -1 +1 @@
1
- import {D as m,z as k,O as O$1,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-DxKo0dCS.js';import {g,W as W$1,F,I as Ie,$ as wr,U as Ui,a1 as fa,ac as Ty,a2 as da,aa as Cr,E as U$1,m as mw,D as Ds,R as mg,a as pl,M as MC,P as Pw,j as jE,Q as ug,L as Lw,X as Xw,O as Og,i as Vw,H as Hw,v as vl,q as qw,r as df,s as ff,f as cg}from'./main-2IBYD645.js';var U=(n,e)=>e.key;function z(n,e){if(n&1&&(Ds(0,"p",3),MC(1),pl()),n&2){let t=Xw();jE(),Og(t.deletion.error());}}function G(n,e){n&1&&(Ds(0,"p",4),MC(1,"Loading prompts\u2026"),pl());}function O(n,e){n&1&&(Ds(0,"p",5),MC(1,"No prompts available."),pl());}function Q(n,e){n&1&&(Ds(0,"p",4),MC(1,"No prompts match the current filter."),pl());}function W(n,e){n&1&&(Ds(0,"ds-tag",17),MC(1,"Read-only"),pl());}function X(n,e){if(n&1){let t=qw();Ds(0,"button",23),mg("click",function(){df(t);let l=Xw(2).$implicit,m=Xw(2);return ff(m.edit(l))}),MC(1," Edit "),pl();}if(n&2){let t=Xw(2).$implicit;cg("aria-label","Edit "+t.prompt.name);}}function Y(n,e){if(n&1){let t=qw();Pw(0,X,2,1,"button",21),Ds(1,"agentos-row-delete-action",22),mg("deleteRequested",function(){df(t);let l=Xw().$implicit,m=Xw(2);return ff(m.deletion.request(l.key))})("deleteConfirmed",function(){df(t);let l=Xw().$implicit,m=Xw(2);return ff(m.confirmDelete(l))})("deleteCancelled",function(){df(t);let l=Xw(3);return ff(l.deletion.cancel())}),pl();}if(n&2){let t=Xw().$implicit,i=Xw(2);Lw(i.deletion.confirmingId()!==t.key?0:-1),jE(),ug("rowKey",t.key)("rowLabel",t.prompt.name)("state",i.deletion);}}function Z(n,e){n&1&&(Ds(0,"button",20),MC(1,"Inherited"),pl());}function ee(n,e){if(n&1&&(Ds(0,"tr",9)(1,"td",12),MC(2),pl(),Ds(3,"td",13),MC(4),pl(),Ds(5,"td",14)(6,"div",15)(7,"ds-tag",16),MC(8),pl(),Pw(9,W,2,0,"ds-tag",17),pl()(),Ds(10,"td",18)(11,"div",19),Pw(12,Y,2,4)(13,Z,2,0,"button",20),pl()()()),n&2){let t=e.$implicit;jE(2),Og(t.prompt.name),jE(2),vl(" ",t.prompt.description||"\u2014"," "),jE(3),ug("variant",t.scope==="platform"?"neutral":"accent"),jE(),Og(t.scope==="platform"?"Platform":"Namespace"),jE(),Lw(t.scope==="platform"?9:-1),jE(3),Lw(t.scope==="namespace"?12:13);}}function te(n,e){if(n&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),MC(5,"Name"),pl(),Ds(6,"th",10),MC(7,"Description"),pl(),Ds(8,"th",10),MC(9,"Scope"),pl(),Ds(10,"th",10)(11,"span",11),MC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Vw(14,ee,14,6,"tr",9,U),pl()()()),n&2){let t=Xw();jE(14),Hw(t.rowFilter.filteredRows());}}var J=class n{route=g(W$1);router=g(F);destroyRef=g(Ie);promptState=g(m);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new wr(void 0);isLoading=Ui(true);deletion=k();rows=Ui([]);rowFilter=O$1(this.rows,e=>[e.prompt.name,e.prompt.description,e.scope].filter(Boolean).join(" "));allPrompts$=this.refresh$.pipe(fa(()=>(this.isLoading.set(true),Ty({platform:this.promptState.listPlatform().pipe(da(()=>Cr([]))),namespace:this.promptState.listByNamespace(this.namespaceId)}))));constructor(){this.allPrompts$.pipe(U$1(this.destroyRef)).subscribe({next:({platform:e,namespace:t})=>{this.rows.set([...e.map((i,l)=>({key:`platform:${i.id??l}`,prompt:i,scope:"platform"})),...t.map((i,l)=>({key:`namespace:${i.id??l}`,prompt:i,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"prompts","new"]);}edit(e){e.scope==="platform"||!e.prompt.id||this.router.navigate(["/agentos",this.namespaceId,"prompts",e.prompt.id,"edit"]);}confirmDelete(e){e.scope==="platform"||!e.prompt.id||this.deletion.execute(e.key,{request$:this.promptState.delete(e.prompt.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.prompt.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=mw({type:n,selectors:[["agentos-namespace-prompts"]],decls:9,vars:3,consts:[["title","Prompts","description","Prompts available in this namespace, including prompts inherited from the platform."],["label","Filter prompts","placeholder","Filter prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(t,i){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return i.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return i.openCreateForm()}),MC(3,"New prompt"),pl()(),Pw(4,z,2,1,"p",3),Pw(5,G,2,0,"p",4)(6,O,2,0,"p",5)(7,Q,2,0,"p",4)(8,te,16,0,"div",6)),t&2&&(jE(),ug("query",i.rowFilter.query()),jE(3),Lw(i.deletion.error()?4:-1),jE(),Lw(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{J as NamespacePromptsComponent};
1
+ import {D as m,z as k,O as O$1,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-Cq4k0Mf8.js';import {g,W as W$1,F,I as Ie,$ as wr,U as Ui,a1 as fa,ac as Ty,a2 as da,aa as Cr,E as U$1,m as mw,D as Ds,R as mg,a as pl,M as MC,P as Pw,j as jE,Q as ug,L as Lw,X as Xw,O as Og,i as Vw,H as Hw,v as vl,q as qw,r as df,s as ff,f as cg}from'./main-CEEMKDJT.js';var U=(n,e)=>e.key;function z(n,e){if(n&1&&(Ds(0,"p",3),MC(1),pl()),n&2){let t=Xw();jE(),Og(t.deletion.error());}}function G(n,e){n&1&&(Ds(0,"p",4),MC(1,"Loading prompts\u2026"),pl());}function O(n,e){n&1&&(Ds(0,"p",5),MC(1,"No prompts available."),pl());}function Q(n,e){n&1&&(Ds(0,"p",4),MC(1,"No prompts match the current filter."),pl());}function W(n,e){n&1&&(Ds(0,"ds-tag",17),MC(1,"Read-only"),pl());}function X(n,e){if(n&1){let t=qw();Ds(0,"button",23),mg("click",function(){df(t);let l=Xw(2).$implicit,m=Xw(2);return ff(m.edit(l))}),MC(1," Edit "),pl();}if(n&2){let t=Xw(2).$implicit;cg("aria-label","Edit "+t.prompt.name);}}function Y(n,e){if(n&1){let t=qw();Pw(0,X,2,1,"button",21),Ds(1,"agentos-row-delete-action",22),mg("deleteRequested",function(){df(t);let l=Xw().$implicit,m=Xw(2);return ff(m.deletion.request(l.key))})("deleteConfirmed",function(){df(t);let l=Xw().$implicit,m=Xw(2);return ff(m.confirmDelete(l))})("deleteCancelled",function(){df(t);let l=Xw(3);return ff(l.deletion.cancel())}),pl();}if(n&2){let t=Xw().$implicit,i=Xw(2);Lw(i.deletion.confirmingId()!==t.key?0:-1),jE(),ug("rowKey",t.key)("rowLabel",t.prompt.name)("state",i.deletion);}}function Z(n,e){n&1&&(Ds(0,"button",20),MC(1,"Inherited"),pl());}function ee(n,e){if(n&1&&(Ds(0,"tr",9)(1,"td",12),MC(2),pl(),Ds(3,"td",13),MC(4),pl(),Ds(5,"td",14)(6,"div",15)(7,"ds-tag",16),MC(8),pl(),Pw(9,W,2,0,"ds-tag",17),pl()(),Ds(10,"td",18)(11,"div",19),Pw(12,Y,2,4)(13,Z,2,0,"button",20),pl()()()),n&2){let t=e.$implicit;jE(2),Og(t.prompt.name),jE(2),vl(" ",t.prompt.description||"\u2014"," "),jE(3),ug("variant",t.scope==="platform"?"neutral":"accent"),jE(),Og(t.scope==="platform"?"Platform":"Namespace"),jE(),Lw(t.scope==="platform"?9:-1),jE(3),Lw(t.scope==="namespace"?12:13);}}function te(n,e){if(n&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),MC(5,"Name"),pl(),Ds(6,"th",10),MC(7,"Description"),pl(),Ds(8,"th",10),MC(9,"Scope"),pl(),Ds(10,"th",10)(11,"span",11),MC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Vw(14,ee,14,6,"tr",9,U),pl()()()),n&2){let t=Xw();jE(14),Hw(t.rowFilter.filteredRows());}}var J=class n{route=g(W$1);router=g(F);destroyRef=g(Ie);promptState=g(m);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new wr(void 0);isLoading=Ui(true);deletion=k();rows=Ui([]);rowFilter=O$1(this.rows,e=>[e.prompt.name,e.prompt.description,e.scope].filter(Boolean).join(" "));allPrompts$=this.refresh$.pipe(fa(()=>(this.isLoading.set(true),Ty({platform:this.promptState.listPlatform().pipe(da(()=>Cr([]))),namespace:this.promptState.listByNamespace(this.namespaceId)}))));constructor(){this.allPrompts$.pipe(U$1(this.destroyRef)).subscribe({next:({platform:e,namespace:t})=>{this.rows.set([...e.map((i,l)=>({key:`platform:${i.id??l}`,prompt:i,scope:"platform"})),...t.map((i,l)=>({key:`namespace:${i.id??l}`,prompt:i,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"prompts","new"]);}edit(e){e.scope==="platform"||!e.prompt.id||this.router.navigate(["/agentos",this.namespaceId,"prompts",e.prompt.id,"edit"]);}confirmDelete(e){e.scope==="platform"||!e.prompt.id||this.deletion.execute(e.key,{request$:this.promptState.delete(e.prompt.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.prompt.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=mw({type:n,selectors:[["agentos-namespace-prompts"]],decls:9,vars:3,consts:[["title","Prompts","description","Prompts available in this namespace, including prompts inherited from the platform."],["label","Filter prompts","placeholder","Filter prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(t,i){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return i.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return i.openCreateForm()}),MC(3,"New prompt"),pl()(),Pw(4,z,2,1,"p",3),Pw(5,G,2,0,"p",4)(6,O,2,0,"p",5)(7,Q,2,0,"p",4)(8,te,16,0,"div",6)),t&2&&(jE(),ug("query",i.rowFilter.query()),jE(3),Lw(i.deletion.error()?4:-1),jE(),Lw(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{J as NamespacePromptsComponent};