@whoz-oss/coday-client 0.0.0-workstream-forge.246 → 0.0.0-workstream-forge.248
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.
- package/browser/{chunk-C1C0RiZa.js → chunk-3EDXMS-4.js} +1 -1
- package/browser/chunk-7iOKe3sk.js +1 -0
- package/browser/chunk-ABpRMh2B.js +1 -0
- package/browser/chunk-B0fXA2NX.js +2 -0
- package/browser/chunk-BABBgQ8U.js +1 -0
- package/browser/chunk-BNa9R5xr.js +1 -0
- package/browser/{chunk-Dyr7sRIs.js → chunk-BOeKfMLQ.js} +1 -1
- package/browser/{chunk-DO-ovLg3.js → chunk-Be6W3TsR.js} +1 -1
- package/browser/chunk-BlzNw99t.js +1 -0
- package/browser/{chunk-DT2PdsWA.js → chunk-BmOgwWdt.js} +1 -1
- package/browser/chunk-BoNn3F1p.js +1 -0
- package/browser/{chunk-COuqiVBt.js → chunk-Br_8ZFLi.js} +1 -1
- package/browser/{chunk-ujBeU4_3.js → chunk-BuxuH9BP.js} +1 -1
- package/browser/chunk-BvuZQAQ0.js +1 -0
- package/browser/{chunk-HBNTqJMB.js → chunk-Bw1EhndU.js} +1 -1
- package/browser/chunk-BzbDU55N.js +1 -0
- package/browser/{chunk-BZl7Iiay.js → chunk-C6QCrOzn.js} +1 -1
- package/browser/{chunk-BOu7cjfB.js → chunk-CF-LwfxF.js} +1 -1
- package/browser/chunk-CI4MRoOv.js +1 -0
- package/browser/{chunk-Cbx6LzEu.js → chunk-CKZuDwRH.js} +1 -1
- package/browser/chunk-CQ560xmp.js +1 -0
- package/browser/{chunk-DY9-csXz.js → chunk-CQks4NEB.js} +1 -1
- package/browser/chunk-CTDoIA2m.js +1 -0
- package/browser/{chunk-JvVR12Id.js → chunk-Co0vItak.js} +1 -1
- package/browser/chunk-CpV2kJbn.js +1 -0
- package/browser/chunk-CxzpsCxW.js +1 -0
- package/browser/{chunk-BXjaHG4X.js → chunk-CzE55g5c.js} +1 -1
- package/browser/chunk-D6Jj7Ejx.js +1 -0
- package/browser/{chunk-s9o_sIbq.js → chunk-D9-ZBfAY.js} +1 -1
- package/browser/{chunk-BOAakMd1.js → chunk-DFex7bTN.js} +1 -1
- package/browser/{chunk-Bb4ZghwW.js → chunk-DQDO93fa.js} +1 -1
- package/browser/chunk-DSG-j5Fi.js +1 -0
- package/browser/{chunk-DRRpPNnR.js → chunk-DindqaXv.js} +1 -1
- package/browser/{chunk-Bjb4ofPZ.js → chunk-DlzuAZs2.js} +1 -1
- package/browser/{chunk-oRtfYKfO.js → chunk-DvFBWfOh.js} +1 -1
- package/browser/{chunk-Dq6TitFH.js → chunk-DwBnbZ_M.js} +1 -1
- package/browser/{chunk-Blm_gDNW.js → chunk-DxEJ-WRR.js} +1 -1
- package/browser/{chunk-X1BEhfE5.js → chunk-H1lHRH9T.js} +1 -1
- package/browser/{chunk-CuO_LCF5.js → chunk-IobJmS5n.js} +1 -1
- package/browser/{chunk-DHe0DwEl.js → chunk-QzulhNzo.js} +1 -1
- package/browser/chunk-TCTz0Z6I.js +1 -0
- package/browser/{chunk-DE6sgNNV.js → chunk-TODRaWW4.js} +1 -1
- package/browser/{chunk-Bm9jTMyL.js → chunk-bs29fJzo.js} +1 -1
- package/browser/{chunk-BzRZcbeu.js → chunk-e4ml3919.js} +1 -1
- package/browser/chunk-isv7OUlX.js +2 -0
- package/browser/chunk-qAO_WS2x.js +674 -0
- package/browser/index.html +1 -1
- package/browser/{main-C57PASRG.js → main-VSQLTBR6.js} +15 -15
- package/package.json +1 -1
- package/browser/chunk-2rx1a3bg.js +0 -1
- package/browser/chunk-44iNe1uu.js +0 -1
- package/browser/chunk-6fEcW1af.js +0 -1
- package/browser/chunk-BRf--TAM.js +0 -1
- package/browser/chunk-BXEuZdL_.js +0 -1
- package/browser/chunk-BgUbG3v4.js +0 -2
- package/browser/chunk-Boa1rtr3.js +0 -1
- package/browser/chunk-C7-dVBzk.js +0 -1
- package/browser/chunk-CIVLU6Kt.js +0 -1
- package/browser/chunk-CjYCW_MM.js +0 -1
- package/browser/chunk-D-1TnBnZ.js +0 -1
- package/browser/chunk-D0tfduku.js +0 -1
- package/browser/chunk-DOAcv-0n.js +0 -1
- package/browser/chunk-DmcssVrC.js +0 -1
- package/browser/chunk-Ds02yuKZ.js +0 -1
- package/browser/chunk-HNE4DSTY.js +0 -2
- package/browser/chunk-TdvCGQY1.js +0 -674
- package/browser/chunk-eYQBIph9.js +0 -1
- package/browser/chunk-yXcf610a.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import {y}from'./chunk-
|
|
1
|
+
import {y}from'./chunk-qAO_WS2x.js';import {g,aB as ie,aC as T,aa as br,a1 as ga,ad as ne,a2 as ha,aD as $y,a6 as x}from'./main-VSQLTBR6.js';var v=class i{userState=g(y);membership=g(ie);currentUser$=T(this.userState.currentUser);cache=new Map;isAdminOfNamespace$(e){if(!e)return br(false);let t=this.cache.get(e);if(t)return t;let s=this.currentUser$.pipe(ga(a=>a?a.isAdmin?br(true):this.membership.getMembersNamespaceMembership(e).pipe(ne(d=>d.some(n=>n.id===a.id&&n.role==="ADMIN")),ha(()=>br(false))):br(false)),$y({bufferSize:1,refCount:false}));return this.cache.set(e,s),s}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};export{v};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {f,y,p as pt,T as Te,g as gn,q as qt,m as md,C as Co,M as Mo,H as Ht,F as Fn,U as Ut,a as po,h as ho,Z as Zr,A as An,O as On,b as hn,c as fn,u as un,d as cn,e as at,i as sn}from'./chunk-qAO_WS2x.js';import {g,W,t as F,I as J,K as we,o as oT,$ as $i,O as Of,U,L as w,N as x,D as Dw,E as Es,f as fg,a as Bw,c as hl,P as dg,d as VE,i as Vw,b as AC,Q as Qw,R as vg,S as NI,q as $w,v as tC,T as AI,n as lg,z as zw,u as Dl,F as Fg,w as pf,x as hf}from'./main-VSQLTBR6.js';var de=/^(\/|[A-Za-z]:[\\/]|\\\\)/;function me(i){return de.test(i)}function ie(i=()=>true){return t=>{let e=(t.value??"").trim();return !i()||e===""||me(e)?null:{absolutePath:true}}}var ce=(i,t)=>t.value;function ue(i,t){i&1&&(Es(0,"p",2),AC(1,"Loading\u2026"),hl());}function he(i,t){if(i&1&&(Es(0,"option",23),AC(1),hl()),i&2){let e=t.$implicit;dg("value",e.value),VE(),Fg(e.label);}}function pe(i,t){if(i&1){let e=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let p=tC();return hf(p.submit())}),Es(1,"ds-form-field",5),fg(2,"input",6),NI(),hl(),Es(3,"ds-form-field",7),fg(4,"textarea",8),NI(),hl(),Es(5,"ds-form-field",9),fg(6,"input",10),NI(),hl(),Es(7,"ds-form-field",11),fg(8,"input",12),NI(),hl(),Es(9,"ds-form-field",13),fg(10,"input",14),NI(),hl(),Es(11,"ds-form-field",15),fg(12,"input",16),NI(),hl(),Es(13,"ds-form-field",17),fg(14,"input",18),NI(),hl(),Es(15,"ds-form-field",19)(16,"input",20),vg("input",function(p){pf(e);let se=tC();return hf(se.onMaxToolRoundsInput(p))}),hl(),NI(),hl(),Es(17,"ds-form-field",21)(18,"select",22),$w(19,he,2,2,"option",23,ce),hl(),NI(),hl(),Es(21,"ds-form-actions")(22,"button",24),AC(23),hl(),Es(24,"button",25),vg("click",function(){pf(e);let p=tC();return hf(p.cancel())}),AC(25,"Cancel"),hl()()();}if(i&2){let e=tC();dg("formGroup",e.form),VE(2),dg("formControl",e.nameControl),AI(),VE(2),dg("formControl",e.descriptionControl),AI(),VE(2),dg("formControl",e.externalIdControl),AI(),VE(2),dg("formControl",e.defaultAgentNameControl),AI(),VE(2),dg("formControl",e.configPathControl),AI(),VE(),dg("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),VE(),dg("readOnly",!e.canEditSharedExchangePath())("formControl",e.sharedExchangePathControl),lg("aria-invalid",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid),AI(),VE(),dg("hint",e.runCostThresholdHint()),VE(),dg("placeholder",e.runCostThresholdPlaceholder())("formControl",e.runCostThresholdControl),AI(),VE(),dg("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),VE(),dg("formControl",e.maxToolRoundsControl),lg("aria-invalid",e.maxToolRoundsControl.invalid||e.maxToolRoundsUnparsable()),AI(),VE(2),dg("formControl",e.adminCaseListingControl),AI(),VE(),zw(e.adminCaseListingOptions),VE(3),dg("disabled",e.form.invalid||e.isSubmitting()),VE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var fe=1,ge=2147483647,Ce=[{value:"",label:"Default"},{value:"OWN",label:"Their own cases"},{value:"SWITCH",label:"Their own, with a switch to see all"},{value:"ALL",label:"All cases of the namespace"}],le=class i{route=g(W);router=g(F);namespaceController=g(J);destroyRef=g(we);usageConfiguration=g(f);userState=g(y);canEditSharedExchangePath=oT(()=>this.userState.currentUser()?.isAdmin===true);sharedExchangePathHint=oT(()=>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=oT(()=>{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=oT(()=>{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:[gn.required,gn.minLength(1)]}),description:new Te("",{nonNullable:true}),configPath:new Te("",{nonNullable:true}),sharedExchangePath:new Te("",{nonNullable:true,validators:[ie(()=>this.canEditSharedExchangePath())]}),externalId:new Te("",{nonNullable:true}),defaultAgentName:new Te("",{nonNullable:true}),runCostThreshold:new Te(null),maxToolRounds:new Te(null,{validators:[gn.min(fe),gn.max(ge),gn.pattern(/^\d+$/)]}),adminCaseListing:new Te("",{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get configPathControl(){return this.form.controls.configPath}get sharedExchangePathControl(){return this.form.controls.sharedExchangePath}get externalIdControl(){return this.form.controls.externalId}get defaultAgentNameControl(){return this.form.controls.defaultAgentName}get runCostThresholdControl(){return this.form.controls.runCostThreshold}get maxToolRoundsControl(){return this.form.controls.maxToolRounds}get adminCaseListingControl(){return this.form.controls.adminCaseListing}adminCaseListingOptions=Ce;maxToolRoundsUnparsable=$i(false);onMaxToolRoundsInput(t){this.maxToolRoundsUnparsable.set(t.target.validity.badInput);}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);existingNamespace=null;constructor(){Of(()=>{this.canEditSharedExchangePath(),this.sharedExchangePathControl.updateValueAndValidity();});}ngOnInit(){this.userState.currentUser()||this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({error:()=>{}});let t=this.route.snapshot.paramMap.get("namespaceId")??this.route.parent?.snapshot.paramMap.get("namespaceId");t&&(this.isEditMode.set(true),this.loadNamespace(t));}loadNamespace(t){this.isLoading.set(true),this.namespaceController.getByIdNamespace(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingNamespace=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??""),this.configPathControl.setValue(e.configPath??""),this.sharedExchangePathControl.setValue(e.sharedExchangePath??""),this.externalIdControl.setValue(e.externalId??""),this.defaultAgentNameControl.setValue(e.defaultAgentName??""),this.runCostThresholdControl.setValue(e.runCostThreshold??null),this.maxToolRoundsControl.setValue(e.maxToolRounds??null),this.adminCaseListingControl.setValue(e.adminCaseListing??""),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.maxToolRoundsUnparsable()||this.isSubmitting())return;this.isSubmitting.set(true);let t=w(x(w({},this.existingNamespace),{name:this.nameControl.value.trim(),description:this.descriptionControl.value.trim()||void 0,configPath:this.configPathControl.value.trim()||void 0,externalId:this.externalIdControl.value.trim()||void 0,defaultAgentName:this.defaultAgentNameControl.value.trim()||void 0,runCostThreshold:this.runCostThresholdControl.value??void 0,maxToolRounds:this.maxToolRoundsControl.value??void 0,adminCaseListing:this.adminCaseListingControl.value||void 0}),this.canEditSharedExchangePath()?{sharedExchangePath:this.sharedExchangePathPayload()}:{});(this.isEditMode()?this.namespaceController.updateNamespace(this.existingNamespace.id??"",t):this.namespaceController.createNamespace(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}sharedExchangePathPayload(){return this.sharedExchangePathControl.value.trim()||(this.existingNamespace?.sharedExchangePath?"":void 0)}cancel(){this.navigateBack();}navigateBack(){this.router.navigate(["/agentos/namespaces"]);}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=Dw({type:i,selectors:[["agentos-namespace-form"]],decls:4,vars:3,consts:[[3,"framed"],[3,"title"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","ns-name","required",""],["dsControl","","id","ns-name","type","text","placeholder","Namespace name","autocomplete","off",3,"formControl"],["label","Description","controlId","ns-description"],["dsControl","","id","ns-description","rows","4","placeholder","Optional description",3,"formControl"],["label","External ID","controlId","ns-external-id"],["dsControl","","id","ns-external-id","type","text","placeholder","Optional federation ID from an external system","autocomplete","off",3,"formControl"],["label","Default agent","controlId","ns-default-agent"],["dsControl","","id","ns-default-agent","type","text","placeholder","Logical name of the default agent (e.g. coday)","autocomplete","off",3,"formControl"],["label","Config path","controlId","ns-config-path"],["dsControl","","id","ns-config-path","type","text","placeholder","Optional path to base configuration directory","autocomplete","off",3,"formControl"],["label","Shared files folder","controlId","ns-shared-exchange-path","hintId","ns-shared-exchange-path-hint","errorId","ns-shared-exchange-path-error",3,"hint","error"],["dsControl","","id","ns-shared-exchange-path","type","text","placeholder","Default location managed by AgentOS","aria-describedby","ns-shared-exchange-path-hint","autocomplete","off",3,"readOnly","formControl"],["label","Run cost threshold","controlId","ns-run-cost-threshold","hintId","ns-run-cost-threshold-hint",3,"hint"],["dsControl","","id","ns-run-cost-threshold","type","number","min","0","step","0.01","aria-describedby","ns-run-cost-threshold-hint",3,"placeholder","formControl"],["label","Maximum tool rounds","controlId","ns-max-tool-rounds","hintId","ns-max-tool-rounds-hint","errorId","ns-max-tool-rounds-error","hint","Most tool rounds one agent run may take. Leave empty to inherit the server default. A change applies from the next agent run.",3,"error"],["dsControl","","id","ns-max-tool-rounds","type","number","min","1","step","1","placeholder","Server default","aria-describedby","ns-max-tool-rounds-hint",3,"input","formControl"],["label","Cases visible to admins","controlId","ns-admin-case-listing","hintId","ns-admin-case-listing-hint","hint","Choose which conversations the admins of this namespace see in their list. Members always see only their own."],["dsControl","","id","ns-admin-case-listing","aria-describedby","ns-admin-case-listing-hint",3,"formControl"],[3,"value"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"]],template:function(e,u){e&1&&(Es(0,"ds-page",0),fg(1,"ds-section-header",1),Bw(2,ue,2,0,"p",2)(3,pe,26,20,"form",3),hl()),e&2&&(dg("framed",!u.isEditMode()),VE(),dg("title",u.isEditMode()?"Edit namespace":"New namespace"),VE(),Vw(u.isLoading()?2:3));},dependencies:[qt,md,Co,Mo,Ht,Fn,Ut,po,ho,Zr,An,On,hn,fn,un,cn,at,sn],encapsulation:2})};export{Ce as ADMIN_CASE_LISTING_OPTIONS,le as NamespaceFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {c}from'./chunk-oRtfYKfO.js';import {p as pt,T as Te$1,g as gn,q as qt,m as md,C as Co,M as Mo,H as Ht,F as Fn,v as yn,U as Ut,a as po,h as ho,Z as Zr,A as An,O as On,b as hn,c as fn,u as un,o as dn,d as cn,D as pn,e as at,i as sn,t as an}from'./chunk-TdvCGQY1.js';import {g,W,q as F,I as we$1,ag as U,ah as Fe$1,ai as ke$1,$ as $i,aj as De$1,a9 as F$1,ak as yd,r as rT,ac as by,K as U$1,a2 as ha,aa as br,N as x,L as w,v as vw,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,s as Dl,c as Bw,Y as Yw,f as fg,R as MI,U as Uw,t as eC,S as xI,k as $w,F as Fg,u as pf,w as hf,y as sh}from'./main-C57PASRG.js';var V=(n,t)=>t.value,ve=(n,t)=>t.id;function be(n,t){n&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function _e(n,t){if(n&1&&(Es(0,"ds-form-field",9),fg(1,"input",38),hl()),n&2){let e=eC(2);BE(),dg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function Se(n,t){if(n&1&&(Es(0,"a",39),xC(1,"Add an agent config"),hl(),xC(2," first. ")),n&2){let e=eC(3);dg("href","/agentos/"+e.namespaceId+"/agent-configs/new",sh);}}function xe(n,t){if(n&1&&(Es(0,"ds-form-field",10)(1,"p",2),xC(2," No agent configs available in this scope yet. "),jw(3,Se,3,1),hl()()),n&2){let e=eC(2);BE(3),Bw(e.isPlatformMode?-1:3);}}function Ee(n,t){if(n&1&&(Es(0,"option",17),xC(1),hl()),n&2){let e=t.$implicit;dg("value",e.id),BE(),Fg(e.name);}}function De(n,t){if(n&1&&(Es(0,"ds-form-field",11)(1,"select",40)(2,"option",41),xC(3,"Select an agent config\u2026"),hl(),Uw(4,Ee,2,2,"option",17,ve),hl(),MI(),hl()),n&2){let e=eC(2);dg("error",e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?"Agent Config is required.":null),BE(),dg("formControl",e.agentConfigIdControl),xI(),BE(3),$w(e.availableAgentConfigs());}}function Te(n,t){if(n&1&&(Es(0,"option",17),xC(1),hl()),n&2){let e=t.$implicit;dg("value",e.value),BE(),Fg(e.label);}}function Ne(n,t){if(n&1){let e=Yw();Es(0,"label",31)(1,"input",43),vg("change",function(){let f=pf(e).$implicit,h=eC(3);return hf(h.toggleDay(f.value))}),hl(),xC(2),hl();}if(n&2){let e=t.$implicit,l=eC(3);BE(),dg("checked",l.isDaySelected(e.value)),BE(),Dl(" ",e.label," ");}}function Ie(n,t){if(n&1&&(Es(0,"ds-form-field",18)(1,"div",42),Uw(2,Ne,3,2,"label",31,V),hl()()),n&2){let e=eC(2);BE(2),$w(e.dayOptions);}}function Me(n,t){if(n&1&&(Es(0,"option",17),xC(1),hl()),n&2){let e=t.$implicit;dg("value",e.value),BE(),Fg(e.label);}}function Pe(n,t){if(n&1&&(Es(0,"ds-form-field",28),fg(1,"input",44),MI(),hl()),n&2){let e=eC(2);dg("error",e.form.hasError("endDateRequired")&&e.endDateControl.touched?"End date is required.":null),BE(),dg("formControl",e.endDateControl),xI();}}function we(n,t){if(n&1&&(Es(0,"ds-form-field",29),fg(1,"input",45),MI(),hl()),n&2){let e=eC(2);dg("error",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?"Must be at least 1.":null),BE(),dg("formControl",e.occurrenceCountControl),xI();}}function Fe(n,t){if(n&1&&(Es(0,"ds-notice"),xC(1),hl()),n&2){let e=eC(2);BE(),Fg(e.errorMessage());}}function Oe(n,t){if(n&1){let e=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let f=eC();return hf(f.submit())}),Es(1,"ds-form-field",5),fg(2,"input",6),MI(),hl(),Es(3,"ds-form-field",7),fg(4,"input",8),MI(),hl(),jw(5,_e,2,1,"ds-form-field",9)(6,xe,4,1,"ds-form-field",10)(7,De,6,2,"ds-form-field",11),Es(8,"ds-form-field",12),fg(9,"textarea",13),MI(),hl(),Es(10,"ds-fieldset",14)(11,"ds-form-field",15)(12,"select",16),Uw(13,Te,2,2,"option",17,V),hl(),MI(),hl(),jw(15,Ie,4,0,"ds-form-field",18),Es(16,"ds-form-field",19)(17,"div",20),fg(18,"input",21),MI(),Es(19,"span",22),xC(20,"UTC"),hl()()()(),Es(21,"ds-fieldset",23)(22,"ds-form-field",24),fg(23,"input",25),MI(),hl(),Es(24,"ds-form-field",26)(25,"select",27),Uw(26,Me,2,2,"option",17,V),hl(),MI(),hl(),jw(28,Pe,2,2,"ds-form-field",28),jw(29,we,2,2,"ds-form-field",29),hl(),Es(30,"div",30)(31,"label",31),fg(32,"input",32),MI(),xC(33," Enabled "),hl(),Es(34,"p",33),xC(35,"When disabled, the scheduled prompt is saved but will not run on schedule."),hl()(),Es(36,"ds-form-field",34),fg(37,"textarea",35),MI(),hl(),jw(38,Fe,2,1,"ds-notice"),Es(39,"ds-form-actions")(40,"button",36),xC(41),hl(),Es(42,"button",37),vg("click",function(){pf(e);let f=eC();return hf(f.cancel())}),xC(43,"Cancel"),hl()()();}if(n&2){let e=eC();dg("formGroup",e.form),BE(),dg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),BE(),dg("formControl",e.nameControl),xI(),BE(2),dg("formControl",e.descriptionControl),xI(),BE(),Bw(e.isEditMode()?5:e.availableAgentConfigs().length===0?6:7),BE(3),dg("error",e.promptContentControl.invalid&&e.promptContentControl.touched?"Opening message is required.":null),BE(),dg("formControl",e.promptContentControl),xI(),BE(3),dg("formControl",e.unitControl),xI(),BE(),$w(e.schedulerUnits),BE(2),Bw(e.showDayFilter()?15:-1),BE(),dg("error",e.timeUtcControl.invalid&&e.timeUtcControl.touched?"Valid time is required (HH:mm).":null),BE(2),dg("formControl",e.timeUtcControl),xI(),BE(4),dg("error",e.startDateControl.invalid&&e.startDateControl.touched?"Start date is required.":null),BE(),dg("formControl",e.startDateControl),xI(),BE(2),dg("formControl",e.endTypeControl),xI(),BE(),$w(e.endTypes),BE(2),Bw(e.showEndDate()?28:-1),BE(),Bw(e.showOccurrenceCount()?29:-1),BE(3),dg("formControl",e.enabledControl),xI(),BE(4),dg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),BE(),dg("formControl",e.externalMetadataJsonControl),xI(),BE(),Bw(e.errorMessage()?38:-1),BE(2),dg("disabled",e.form.invalid||e.isSubmitting()),BE(),Dl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var ye=class n{route=g(W);router=g(F);destroyRef=g(we$1);state=g(c);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te$1("",{nonNullable:true,validators:[gn.required]}),description:new Te$1(null),agentConfigId:new Te$1("",{nonNullable:true,validators:[gn.required]}),promptContent:new Te$1("",{nonNullable:true,validators:[gn.required]}),unit:new Te$1(ke$1.WEEK,{nonNullable:true,validators:[gn.required]}),days:new Te$1([],{nonNullable:true}),timeUtc:new Te$1("09:00",{nonNullable:true,validators:[gn.required,gn.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new Te$1("",{nonNullable:true,validators:[gn.required]}),endType:new Te$1(Fe$1.NEVER,{nonNullable:true,validators:[gn.required]}),endDate:new Te$1(null),occurrenceCount:new Te$1(null),enabled:new Te$1(true,{nonNullable:true}),externalMetadataJson:new Te$1("",{nonNullable:true,validators:[ke]})},{validators:[Ae,Ve]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);errorMessage=$i(null);SchedulerUnit=ke$1;SchedulerEndType=Fe$1;schedulerUnits=[{value:ke$1.WEEK,label:"Week(s)"},{value:ke$1.MONTH,label:"Month(s)"}];endTypes=[{value:Fe$1.NEVER,label:"Never"},{value:Fe$1.ON_DATE,label:"On date"},{value:Fe$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(De$1).map(([t,e])=>({value:t,label:e}));unitSignal=F$1(this.unitControl.valueChanges.pipe(yd(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(yd(this.endTypeControl.value)));showDayFilter=rT(()=>this.unitSignal()===ke$1.WEEK);showEndDate=rT(()=>this.endTypeSignal()===Fe$1.ON_DATE);showOccurrenceCount=rT(()=>this.endTypeSignal()===Fe$1.OCCURRENCES);agentConfigs=$i([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Re());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),by({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U$1(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U$1(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(ha(()=>br([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,l=e.includes(t)?e.filter(f=>f!==t):[...e,t];this.daysControl.setValue(l);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===Fe$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===Fe$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let h=this.externalMetadataJsonControl.value.trim();return h?JSON.parse(h):null})()});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:h=>{this.isSubmitting.set(false),h.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):h.status===400?this.errorMessage.set(h.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=vw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to scheduled prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","sp-name","required","","hint",'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.',3,"error"],["dsControl","","id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",3,"formControl"],["label","Description","controlId","sp-description"],["dsControl","","id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",3,"formControl"],["label","Agent Config","required","","hint","Agent Config cannot be changed after creation."],["label","Agent Config","required",""],["label","Agent Config","controlId","sp-agent-config","required","","hint","Immutable after creation.",3,"error"],["label","Opening message","controlId","sp-prompt-content","required","","hint","The message sent to the agent when the scheduled prompt fires.",3,"error"],["dsControl","","id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",3,"formControl"],["legend","Recurrence"],["label","Unit","controlId","sp-unit","required",""],["dsControl","","id","sp-unit",3,"formControl"],[3,"value"],["label","Days of week","hint","Leave empty to run every day of the week."],["label","Time (UTC)","controlId","sp-time","required","",3,"error"],[1,"ds-inline"],["dsControl","","id","sp-time","type","time",3,"formControl"],[1,"ds-meta"],["legend","Planning"],["label","Start date","controlId","sp-start-date","required","",3,"error"],["dsControl","","id","sp-start-date","type","date",3,"formControl"],["label","Ends","controlId","sp-end-type","required",""],["dsControl","","id","sp-end-type",3,"formControl"],["label","End date","controlId","sp-end-date","required","",3,"error"],["label","Number of occurrences","controlId","sp-occurrence-count","required","",3,"error"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","External Metadata","controlId","sp-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsControl","","type","text","readonly","",3,"value"],[3,"href"],["dsControl","","id","sp-agent-config",3,"formControl"],["value","","disabled",""],[1,"ds-inline","ds-inline--wrap"],["type","checkbox",3,"change","checked"],["dsControl","","id","sp-end-date","type","date",3,"formControl"],["dsControl","","id","sp-occurrence-count","type","number","min","1",1,"ds-control--narrow",3,"formControl"]],template:function(e,l){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return l.cancel()}),xC(3),hl()(),jw(4,be,2,0,"p",2)(5,Oe,44,22,"form",3),hl()),e&2&&(BE(),dg("title",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"),BE(2),Dl(" \u2190 ",l.isPlatformMode?"Platform scheduled prompts":"Scheduled prompts"," "),BE(),Bw(l.isLoading()?4:5));},dependencies:[qt,md,Co,Mo,Ht,Fn,yn,Ut,po,ho,Zr,An,On,hn,fn,un,dn,cn,pn,at,sn,an],encapsulation:2})};function Ae(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===Fe$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===Fe$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function ke(n){let t=n.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}function Re(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${l}`}export{ye as ScheduledPromptFormComponent};
|
|
1
|
+
import {c}from'./chunk-DvFBWfOh.js';import {p as pt,T as Te$1,g as gn,q as qt,m as md,C as Co,M as Mo,H as Ht,F as Fn,v as yn,U as Ut,a as po,h as ho,Z as Zr,A as An,O as On,b as hn,c as fn,u as un,o as dn,d as cn,D as pn,e as at,i as sn,t as an}from'./chunk-qAO_WS2x.js';import {g,W,t as F,K as we$1,ag as U,ah as Fe$1,ai as ke$1,$ as $i,aj as De$1,a9 as F$1,ak as yd,o as oT,ac as by,U as U$1,a2 as ha,aa as br,N as x,L as w,D as Dw,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,u as Dl,i as Vw,Q as Qw,f as fg,S as NI,q as $w,v as tC,T as AI,z as zw,F as Fg,w as pf,x as hf,y as sh}from'./main-VSQLTBR6.js';var V=(n,t)=>t.value,ve=(n,t)=>t.id;function be(n,t){n&1&&(Es(0,"p",2),AC(1,"Loading\u2026"),hl());}function _e(n,t){if(n&1&&(Es(0,"ds-form-field",9),fg(1,"input",38),hl()),n&2){let e=tC(2);VE(),dg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function Se(n,t){if(n&1&&(Es(0,"a",39),AC(1,"Add an agent config"),hl(),AC(2," first. ")),n&2){let e=tC(3);dg("href","/agentos/"+e.namespaceId+"/agent-configs/new",sh);}}function xe(n,t){if(n&1&&(Es(0,"ds-form-field",10)(1,"p",2),AC(2," No agent configs available in this scope yet. "),Bw(3,Se,3,1),hl()()),n&2){let e=tC(2);VE(3),Vw(e.isPlatformMode?-1:3);}}function Ee(n,t){if(n&1&&(Es(0,"option",17),AC(1),hl()),n&2){let e=t.$implicit;dg("value",e.id),VE(),Fg(e.name);}}function De(n,t){if(n&1&&(Es(0,"ds-form-field",11)(1,"select",40)(2,"option",41),AC(3,"Select an agent config\u2026"),hl(),$w(4,Ee,2,2,"option",17,ve),hl(),NI(),hl()),n&2){let e=tC(2);dg("error",e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?"Agent Config is required.":null),VE(),dg("formControl",e.agentConfigIdControl),AI(),VE(3),zw(e.availableAgentConfigs());}}function Te(n,t){if(n&1&&(Es(0,"option",17),AC(1),hl()),n&2){let e=t.$implicit;dg("value",e.value),VE(),Fg(e.label);}}function Ne(n,t){if(n&1){let e=Qw();Es(0,"label",31)(1,"input",43),vg("change",function(){let f=pf(e).$implicit,h=tC(3);return hf(h.toggleDay(f.value))}),hl(),AC(2),hl();}if(n&2){let e=t.$implicit,l=tC(3);VE(),dg("checked",l.isDaySelected(e.value)),VE(),Dl(" ",e.label," ");}}function Ie(n,t){if(n&1&&(Es(0,"ds-form-field",18)(1,"div",42),$w(2,Ne,3,2,"label",31,V),hl()()),n&2){let e=tC(2);VE(2),zw(e.dayOptions);}}function Me(n,t){if(n&1&&(Es(0,"option",17),AC(1),hl()),n&2){let e=t.$implicit;dg("value",e.value),VE(),Fg(e.label);}}function Pe(n,t){if(n&1&&(Es(0,"ds-form-field",28),fg(1,"input",44),NI(),hl()),n&2){let e=tC(2);dg("error",e.form.hasError("endDateRequired")&&e.endDateControl.touched?"End date is required.":null),VE(),dg("formControl",e.endDateControl),AI();}}function we(n,t){if(n&1&&(Es(0,"ds-form-field",29),fg(1,"input",45),NI(),hl()),n&2){let e=tC(2);dg("error",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?"Must be at least 1.":null),VE(),dg("formControl",e.occurrenceCountControl),AI();}}function Fe(n,t){if(n&1&&(Es(0,"ds-notice"),AC(1),hl()),n&2){let e=tC(2);VE(),Fg(e.errorMessage());}}function Oe(n,t){if(n&1){let e=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let f=tC();return hf(f.submit())}),Es(1,"ds-form-field",5),fg(2,"input",6),NI(),hl(),Es(3,"ds-form-field",7),fg(4,"input",8),NI(),hl(),Bw(5,_e,2,1,"ds-form-field",9)(6,xe,4,1,"ds-form-field",10)(7,De,6,2,"ds-form-field",11),Es(8,"ds-form-field",12),fg(9,"textarea",13),NI(),hl(),Es(10,"ds-fieldset",14)(11,"ds-form-field",15)(12,"select",16),$w(13,Te,2,2,"option",17,V),hl(),NI(),hl(),Bw(15,Ie,4,0,"ds-form-field",18),Es(16,"ds-form-field",19)(17,"div",20),fg(18,"input",21),NI(),Es(19,"span",22),AC(20,"UTC"),hl()()()(),Es(21,"ds-fieldset",23)(22,"ds-form-field",24),fg(23,"input",25),NI(),hl(),Es(24,"ds-form-field",26)(25,"select",27),$w(26,Me,2,2,"option",17,V),hl(),NI(),hl(),Bw(28,Pe,2,2,"ds-form-field",28),Bw(29,we,2,2,"ds-form-field",29),hl(),Es(30,"div",30)(31,"label",31),fg(32,"input",32),NI(),AC(33," Enabled "),hl(),Es(34,"p",33),AC(35,"When disabled, the scheduled prompt is saved but will not run on schedule."),hl()(),Es(36,"ds-form-field",34),fg(37,"textarea",35),NI(),hl(),Bw(38,Fe,2,1,"ds-notice"),Es(39,"ds-form-actions")(40,"button",36),AC(41),hl(),Es(42,"button",37),vg("click",function(){pf(e);let f=tC();return hf(f.cancel())}),AC(43,"Cancel"),hl()()();}if(n&2){let e=tC();dg("formGroup",e.form),VE(),dg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),VE(),dg("formControl",e.nameControl),AI(),VE(2),dg("formControl",e.descriptionControl),AI(),VE(),Vw(e.isEditMode()?5:e.availableAgentConfigs().length===0?6:7),VE(3),dg("error",e.promptContentControl.invalid&&e.promptContentControl.touched?"Opening message is required.":null),VE(),dg("formControl",e.promptContentControl),AI(),VE(3),dg("formControl",e.unitControl),AI(),VE(),zw(e.schedulerUnits),VE(2),Vw(e.showDayFilter()?15:-1),VE(),dg("error",e.timeUtcControl.invalid&&e.timeUtcControl.touched?"Valid time is required (HH:mm).":null),VE(2),dg("formControl",e.timeUtcControl),AI(),VE(4),dg("error",e.startDateControl.invalid&&e.startDateControl.touched?"Start date is required.":null),VE(),dg("formControl",e.startDateControl),AI(),VE(2),dg("formControl",e.endTypeControl),AI(),VE(),zw(e.endTypes),VE(2),Vw(e.showEndDate()?28:-1),VE(),Vw(e.showOccurrenceCount()?29:-1),VE(3),dg("formControl",e.enabledControl),AI(),VE(4),dg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),VE(),dg("formControl",e.externalMetadataJsonControl),AI(),VE(),Vw(e.errorMessage()?38:-1),VE(2),dg("disabled",e.form.invalid||e.isSubmitting()),VE(),Dl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var ye=class n{route=g(W);router=g(F);destroyRef=g(we$1);state=g(c);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te$1("",{nonNullable:true,validators:[gn.required]}),description:new Te$1(null),agentConfigId:new Te$1("",{nonNullable:true,validators:[gn.required]}),promptContent:new Te$1("",{nonNullable:true,validators:[gn.required]}),unit:new Te$1(ke$1.WEEK,{nonNullable:true,validators:[gn.required]}),days:new Te$1([],{nonNullable:true}),timeUtc:new Te$1("09:00",{nonNullable:true,validators:[gn.required,gn.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new Te$1("",{nonNullable:true,validators:[gn.required]}),endType:new Te$1(Fe$1.NEVER,{nonNullable:true,validators:[gn.required]}),endDate:new Te$1(null),occurrenceCount:new Te$1(null),enabled:new Te$1(true,{nonNullable:true}),externalMetadataJson:new Te$1("",{nonNullable:true,validators:[ke]})},{validators:[Ae,Ve]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);errorMessage=$i(null);SchedulerUnit=ke$1;SchedulerEndType=Fe$1;schedulerUnits=[{value:ke$1.WEEK,label:"Week(s)"},{value:ke$1.MONTH,label:"Month(s)"}];endTypes=[{value:Fe$1.NEVER,label:"Never"},{value:Fe$1.ON_DATE,label:"On date"},{value:Fe$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(De$1).map(([t,e])=>({value:t,label:e}));unitSignal=F$1(this.unitControl.valueChanges.pipe(yd(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(yd(this.endTypeControl.value)));showDayFilter=oT(()=>this.unitSignal()===ke$1.WEEK);showEndDate=oT(()=>this.endTypeSignal()===Fe$1.ON_DATE);showOccurrenceCount=oT(()=>this.endTypeSignal()===Fe$1.OCCURRENCES);agentConfigs=$i([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Re());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),by({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U$1(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U$1(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(ha(()=>br([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,l=e.includes(t)?e.filter(f=>f!==t):[...e,t];this.daysControl.setValue(l);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===Fe$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===Fe$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let h=this.externalMetadataJsonControl.value.trim();return h?JSON.parse(h):null})()});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:h=>{this.isSubmitting.set(false),h.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):h.status===400?this.errorMessage.set(h.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Dw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to scheduled prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","sp-name","required","","hint",'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.',3,"error"],["dsControl","","id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",3,"formControl"],["label","Description","controlId","sp-description"],["dsControl","","id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",3,"formControl"],["label","Agent Config","required","","hint","Agent Config cannot be changed after creation."],["label","Agent Config","required",""],["label","Agent Config","controlId","sp-agent-config","required","","hint","Immutable after creation.",3,"error"],["label","Opening message","controlId","sp-prompt-content","required","","hint","The message sent to the agent when the scheduled prompt fires.",3,"error"],["dsControl","","id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",3,"formControl"],["legend","Recurrence"],["label","Unit","controlId","sp-unit","required",""],["dsControl","","id","sp-unit",3,"formControl"],[3,"value"],["label","Days of week","hint","Leave empty to run every day of the week."],["label","Time (UTC)","controlId","sp-time","required","",3,"error"],[1,"ds-inline"],["dsControl","","id","sp-time","type","time",3,"formControl"],[1,"ds-meta"],["legend","Planning"],["label","Start date","controlId","sp-start-date","required","",3,"error"],["dsControl","","id","sp-start-date","type","date",3,"formControl"],["label","Ends","controlId","sp-end-type","required",""],["dsControl","","id","sp-end-type",3,"formControl"],["label","End date","controlId","sp-end-date","required","",3,"error"],["label","Number of occurrences","controlId","sp-occurrence-count","required","",3,"error"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","External Metadata","controlId","sp-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsControl","","type","text","readonly","",3,"value"],[3,"href"],["dsControl","","id","sp-agent-config",3,"formControl"],["value","","disabled",""],[1,"ds-inline","ds-inline--wrap"],["type","checkbox",3,"change","checked"],["dsControl","","id","sp-end-date","type","date",3,"formControl"],["dsControl","","id","sp-occurrence-count","type","number","min","1",1,"ds-control--narrow",3,"formControl"]],template:function(e,l){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return l.cancel()}),AC(3),hl()(),Bw(4,be,2,0,"p",2)(5,Oe,44,22,"form",3),hl()),e&2&&(VE(),dg("title",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"),VE(2),Dl(" \u2190 ",l.isPlatformMode?"Platform scheduled prompts":"Scheduled prompts"," "),VE(),Vw(l.isLoading()?4:5));},dependencies:[qt,md,Co,Mo,Ht,Fn,yn,Ut,po,ho,Zr,An,On,hn,fn,un,dn,cn,pn,at,sn,an],encapsulation:2})};function Ae(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===Fe$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===Fe$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function ke(n){let t=n.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}function Re(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${l}`}export{ye as ScheduledPromptFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {O as O$1}from'./chunk-
|
|
1
|
+
import {O as O$1}from'./chunk-DxEJ-WRR.js';import {g,t as F,K as we,af as G$1,Z as Tr,$ as $i,a1 as ga,U as U$1,D as Dw,E as Es,R as vg,c as hl,b as AC,a as Bw,d as VE,P as dg,i as Vw,v as tC,F as Fg,q as $w,z as zw,Q as Qw,n as lg,w as pf,x as hf}from'./main-VSQLTBR6.js';import {z as k,j as O$2,e as at,c as fn,k as ko,P,B as P$1}from'./chunk-qAO_WS2x.js';import'./chunk-ABpRMh2B.js';var j=(t,e)=>e.id??e.name;function A(t,e){if(t&1&&(Es(0,"p",3),AC(1),hl()),t&2){let n=tC();VE(),Fg(n.deletion.error());}}function K(t,e){t&1&&(Es(0,"p",4),AC(1,"Loading integrations\u2026"),hl());}function H(t,e){t&1&&(Es(0,"p",5),AC(1,"No platform integrations defined yet."),hl());}function U(t,e){t&1&&(Es(0,"p",4),AC(1,"No integrations match the current filter."),hl());}function z(t,e){if(t&1){let n=Qw();Es(0,"button",18),vg("click",function(){pf(n);let d=tC().$implicit,m=tC(2);return hf(m.edit(d))}),AC(1,"Edit"),hl();}if(t&2){let n=tC().$implicit;lg("aria-label","Edit "+n.name);}}function G(t,e){if(t&1){let n=Qw();Es(0,"agentos-row-delete-action",19),vg("deleteRequested",function(){pf(n);let d=tC().$implicit,m=tC(2);return hf(m.deletion.request(d.id))})("deleteConfirmed",function(){pf(n);let d=tC().$implicit,m=tC(2);return hf(m.confirmDelete(d))})("deleteCancelled",function(){pf(n);let d=tC(3);return hf(d.deletion.cancel())}),hl();}if(t&2){let n=tC().$implicit,r=tC(2);dg("rowKey",n.id)("rowLabel",n.name)("state",r.deletion);}}function J(t,e){if(t&1&&(Es(0,"tr",9)(1,"td",12),AC(2),hl(),Es(3,"td",13),AC(4),hl(),Es(5,"td",14)(6,"div",15),Bw(7,z,2,1,"button",16),Bw(8,G,1,3,"agentos-row-delete-action",17),hl()()()),t&2){let n=e.$implicit,r=tC(2);VE(2),Fg(n.name),VE(2),Fg(n.integrationType),VE(3),Vw(r.deletion.confirmingId()!==n.id?7:-1),VE(),Vw(n.id?8:-1);}}function O(t,e){if(t&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),AC(5,"Name"),hl(),Es(6,"th",10),AC(7,"Type"),hl(),Es(8,"th",10)(9,"span",11),AC(10,"Actions"),hl()()()(),Es(11,"tbody",8),$w(12,J,9,4,"tr",9,j),hl()()()),t&2){let n=tC();VE(12),zw(n.rowFilter.filteredRows());}}var B=class t{router=g(F);destroyRef=g(we);state=g(O$1);integrationConfigController=g(G$1);refresh$=new Tr(void 0);isLoading=$i(true);deletion=k();configs=$i([]);rowFilter=O$2(this.configs,e=>[e.name,e.integrationType].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(this.isLoading.set(true),this.state.loadPlatformConfigs())),U$1(this.destroyRef)).subscribe({next:e=>{this.configs.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","integration-configs","new"]);}edit(e){this.router.navigate(["/agentos","admin","integration-configs",e.id??"","edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.integrationConfigController.deleteIntegrationConfig(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=Dw({type:t,selectors:[["agentos-platform-integration-configs"]],decls:9,vars:3,consts:[["title","Platform integrations","description","Integration configurations shared across every namespace."],["label","Filter integrations","placeholder","Filter integrations\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform integrations"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Type",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(n,r){n&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(m){return r.rowFilter.query.set(m)}),hl(),Es(2,"button",2),vg("click",function(){return r.openCreateForm()}),AC(3,"New integration"),hl()(),Bw(4,A,2,1,"p",3),Bw(5,K,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,O,14,0,"div",6)),n&2&&(VE(),dg("query",r.rowFilter.query()),VE(3),Vw(r.deletion.error()?4:-1),VE(),Vw(r.isLoading()?5:r.configs().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,fn,ko,P,P$1],encapsulation:2})};export{B as PlatformIntegrationConfigsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {z as k,j as O$1,e as at,c as fn,k as ko,P,B as P$1}from'./chunk-
|
|
1
|
+
import {z as k,j as O$1,e as at,c as fn,k as ko,P,B as P$1}from'./chunk-qAO_WS2x.js';import {g,t as F,K as we,ag as U$1,Z as Tr,$ as $i,a1 as ga,U as U$2,D as Dw,E as Es,R as vg,c as hl,b as AC,a as Bw,d as VE,P as dg,i as Vw,v as tC,F as Fg,q as $w,z as zw,u as Dl,Q as Qw,w as pf,x as hf,n as lg}from'./main-VSQLTBR6.js';var B=(n,e)=>e.id??e.name;function j(n,e){if(n&1&&(Es(0,"p",3),AC(1),hl()),n&2){let t=tC();VE(),Fg(t.deletion.error());}}function K(n,e){n&1&&(Es(0,"p",4),AC(1,"Loading agent configs\u2026"),hl());}function H(n,e){n&1&&(Es(0,"p",5),AC(1,"No platform agent configs defined yet."),hl());}function U(n,e){n&1&&(Es(0,"p",4),AC(1,"No agent configs match the current filter."),hl());}function z(n,e){if(n&1){let t=Qw();Es(0,"button",19),vg("click",function(){pf(t);let d=tC().$implicit,c=tC(2);return hf(c.inspect(d))}),AC(1," Inspect "),hl(),Es(2,"button",19),vg("click",function(){pf(t);let d=tC().$implicit,c=tC(2);return hf(c.edit(d))}),AC(3,"Edit"),hl();}if(n&2){let t=tC().$implicit;lg("aria-label","Inspect "+t.name),VE(2),lg("aria-label","Edit "+t.name);}}function G(n,e){if(n&1){let t=Qw();Es(0,"agentos-row-delete-action",20),vg("deleteRequested",function(){pf(t);let d=tC().$implicit,c=tC(2);return hf(c.deletion.request(d.id))})("deleteConfirmed",function(){pf(t);let d=tC().$implicit,c=tC(2);return hf(c.confirmDelete(d))})("deleteCancelled",function(){pf(t);let d=tC(3);return hf(d.deletion.cancel())}),hl();}if(n&2){let t=tC().$implicit,a=tC(2);dg("rowKey",t.id)("rowLabel",t.name)("state",a.deletion);}}function J(n,e){if(n&1&&(Es(0,"tr",9)(1,"td",12),AC(2),hl(),Es(3,"td",13),AC(4),hl(),Es(5,"td",14),AC(6),hl(),Es(7,"td",15),AC(8),hl(),Es(9,"td",16)(10,"div",17),Bw(11,z,4,2),Bw(12,G,1,3,"agentos-row-delete-action",18),hl()()()),n&2){let t=e.$implicit,a=tC(2);VE(2),Fg(t.name),VE(2),Dl(" ",t.description||"\u2014"," "),VE(2),Fg(t.modelName||"\u2014"),VE(2),Fg(a.mode(t)),VE(3),Vw(a.deletion.confirmingId()!==t.id?11:-1),VE(),Vw(t.id?12:-1);}}function O(n,e){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),AC(5,"Name"),hl(),Es(6,"th",10),AC(7,"Description"),hl(),Es(8,"th",10),AC(9,"Model"),hl(),Es(10,"th",10),AC(11,"Execution mode"),hl(),Es(12,"th",10)(13,"span",11),AC(14,"Actions"),hl()()()(),Es(15,"tbody",8),$w(16,J,13,6,"tr",9,B),hl()()()),n&2){let t=tC();VE(16),zw(t.rowFilter.filteredRows());}}var I=class n{router=g(F);destroyRef=g(we);agentConfigController=g(U$1);refresh$=new Tr(void 0);isLoading=$i(true);deletion=k();configs=$i([]);rowFilter=O$1(this.configs,e=>[e.name,e.description,e.modelName,this.mode(e)].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(this.isLoading.set(true),this.agentConfigController.listPlatformAgentsAgentConfig(true))),U$2(this.destroyRef)).subscribe({next:e=>{this.configs.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}mode(e){return e.executionMode??(e.advancedExecution?"ADVANCED":"SIMPLE")}openCreateForm(){this.router.navigate(["/agentos","admin","agent-configs","new"]);}inspect(e){e.id&&this.router.navigate(["/agentos","admin","agent-configs",e.id,"inspect"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","agent-configs",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.agentConfigController.deleteAgentConfig(e.id).pipe(U$2(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=Dw({type:n,selectors:[["agentos-platform-agent-configs"]],decls:9,vars:3,consts:[["title","Platform agents","description","Agent configurations shared across every namespace."],["label","Filter agent configs","placeholder","Filter agent configs\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform agents"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Model"],["role","cell","data-label","Execution mode"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,a){t&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return a.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return a.openCreateForm()}),AC(3,"New agent config"),hl()(),Bw(4,j,2,1,"p",3),Bw(5,K,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,O,18,0,"div",6)),t&2&&(VE(),dg("query",a.rowFilter.query()),VE(3),Vw(a.deletion.error()?4:-1),VE(),Vw(a.isLoading()?5:a.configs().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,fn,ko,P,P$1],encapsulation:2})};export{I as PlatformAgentConfigsComponent};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {v}from'./chunk-QzulhNzo.js';import {I,n as nt,i as it}from'./chunk-DQDO93fa.js';import {g,W,t as F,K as we,$ as $i,a9 as F$1,o as oT,O as Of,U,N as x,L as w,D as Dw,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,i as Vw,Q as Qw,q as $w,ao as Uw,S as NI,f as fg,v as tC,T as AI,z as zw,u as Dl,ae as Lw,F as Fg,n as lg,w as pf,x as hf}from'./main-VSQLTBR6.js';import {T as Te,g as gn,p as pt,b as hn,c as fn,u as un,o as dn,d as cn,e as at,i as sn,t as an,q as qt,m as md,C as Co,M as Mo,H as Ht,U as Ut,x as ya,a as po,h as ho,A as An,O as On}from'./chunk-qAO_WS2x.js';import'./chunk-ABpRMh2B.js';function Ce(i,t){i&1&&(Es(0,"p",2),AC(1,"Loading\u2026"),hl());}function ye(i,t){if(i&1&&(Es(0,"label",16),fg(1,"input",17),NI(),AC(2),hl()),i&2){let e=t.$implicit,n=tC(3);VE(),dg("formControl",n.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!n.isAdmin()),AI(),VE(),Dl(" ",e.label," ");}}function ge(i,t){if(i&1&&(Es(0,"ds-fieldset",5),$w(1,ye,3,4,"label",16,Lw().trackByScope,true),hl()),i&2){let e=tC(2);dg("disabled",e.isEditMode()),VE(),zw(e.scopeOptions);}}function fe(i,t){if(i&1&&(Es(0,"option",8),AC(1),hl()),i&2){let e=t.$implicit,n=tC(2);dg("value",e),VE(),Fg(n.authTypeLabel[e]);}}function Se(i,t){if(i&1&&(Es(0,"ds-form-field",18),fg(1,"input",19),NI(),hl()),i&2){let e=tC().$implicit;dg("label",e.label)("controlId","as-cred-"+e.key)("required",e.required)("hint",e.hint??null)("hintId","as-hint-"+e.key),VE(),dg("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),lg("aria-describedby",e.hint?"as-hint-"+e.key:null),AI();}}function Ae(i,t){if(i&1&&Bw(0,Se,2,11,"ds-form-field",18),i&2){let e,n=t.$implicit,o=tC(3);Vw((e=o.controlForField(n.key))?0:-1,e);}}function ve(i,t){if(i&1&&(Es(0,"ds-fieldset",13),$w(1,Ae,1,1,null,null,Lw().trackByField,true),hl()),i&2){let e=tC(2);dg("hint","Values are stored encrypted and masked on read."+(e.isEditMode()?" Leave a field unchanged to keep the stored credential.":"")),VE(),zw(e.credentialFields());}}function be(i,t){if(i&1){let e=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let o=tC();return hf(o.submit())}),Bw(1,ge,3,1,"ds-fieldset",5),Es(2,"ds-form-field",6)(3,"select",7),$w(4,fe,2,2,"option",8,Uw),hl(),NI(),hl(),Es(6,"ds-form-field",9),fg(7,"input",10),NI(),hl(),Es(8,"ds-form-field",11),fg(9,"input",12),NI(),hl(),Bw(10,ve,3,1,"ds-fieldset",13),Es(11,"ds-form-actions")(12,"button",14),AC(13),hl(),Es(14,"button",15),vg("click",function(){pf(e);let o=tC();return hf(o.cancel())}),AC(15,"Cancel"),hl()()();}if(i&2){let e=tC();dg("formGroup",e.form),VE(),Vw(e.isPlatformMode?-1:1),VE(2),dg("formControl",e.authTypeControl),AI(),VE(),zw(e.authTypeOptions),VE(3),dg("formControl",e.nameControl),AI(),VE(2),dg("formControl",e.descriptionControl),AI(),VE(),Vw(e.credentialFields().length>0?10:-1),VE(2),dg("disabled",e.form.invalid||e.isSubmitting()),VE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var ke=new Set(["namespace","userOnNs","userGlobal"]),D=Object.freeze({platform:"Platform (read-only)",namespace:"Namespace configuration",userOnNs:"Personal \u2014 this namespace only",userGlobal:"Personal \u2014 all namespaces"}),_e={ApiKeyAuthSetting:[{key:"apiKey",label:"API Key",placeholder:"sk-\u2026",secret:true,required:false}],BasicAuthAuthSetting:[{key:"username",label:"Username",placeholder:"user@example.com",secret:false,required:false},{key:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",secret:true,required:false}],BearerTokenAuthSetting:[{key:"token",label:"Bearer token",placeholder:"eyJ\u2026",secret:true,required:false}],OAuthDiscoverableAuthSetting:[{key:"discoveryUrl",label:"Discovery URL",placeholder:"https://\u2026/.well-known/openid-configuration",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthCustomAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthRegisteredAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthMcpDiscoverableAuthSetting:[{key:"resourceUrl",label:"Resource URL",placeholder:"https://mcp.example.com",hint:"Use the base URL exactly as documented by your provider \u2014 do not append a path suffix. Examples: https://mcp.hubspot.com (HubSpot), https://mcp.atlassian.com/v1/mcp (Atlassian).",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",hint:"Leave empty to let the server register an OAuth client automatically (RFC 7591 dynamic registration). Fill in only if you have a pre-registered client ID from your provider.",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Leave empty in most cases \u2014 the MCP server declares the required scopes itself. Fill in only if your provider explicitly requires client-declared scopes.",secret:false,required:false}]},me=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?$i(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=nt;authTypeLabel=it;scopeOptions=[{value:"namespace",label:D.namespace},{value:"userOnNs",label:D.userOnNs},{value:"userGlobal",label:D.userGlobal}];nameControl=new Te("",{nonNullable:true,validators:[gn.required,gn.minLength(1)]});descriptionControl=new Te(null);authTypeControl=new Te("ApiKeyAuthSetting",{nonNullable:true,validators:[gn.required]});scopeControl=new Te("namespace",{nonNullable:true});form=new pt({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new Te("",{nonNullable:true});usernameControl=new Te("",{nonNullable:true});passwordControl=new Te("",{nonNullable:true});tokenControl=new Te("",{nonNullable:true});discoveryUrlControl=new Te("",{nonNullable:true});authorizationUrlControl=new Te("",{nonNullable:true});tokenUrlControl=new Te("",{nonNullable:true});clientIdControl=new Te("",{nonNullable:true});clientSecretControl=new Te("",{nonNullable:true});scopesControl=new Te("",{nonNullable:true});resourceUrlControl=new Te("",{nonNullable:true});selectedAuthType=F$1(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=oT(()=>_e[this.selectedAuthType()]);isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Of(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,n=t.get("authSettingId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let o=this.parseScope(e.get("scope"));this.scopeControl.setValue(o);let v=e.get("template");v&&this.hydrateFromTemplate(v);}parseScope(t){return t&&ke.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId&&!t.namespaceId?"platform":t.userId?t.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AuthSettingForm] Could not load auth setting '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.authTypeControl.setValue(e.authType),this.clearCredentialControls(),this.initialCredentials={},this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AuthSettingForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){switch(this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.authTypeControl.setValue(t.authType),this.clearCredentialControls(),this.initialCredentials={},t.authType){case "ApiKeyAuthSetting":{let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialCredentials.apiKey=e;break}case "BasicAuthAuthSetting":{let e=t,n=e.username??"",o=e.password??"";this.usernameControl.setValue(n),this.passwordControl.setValue(o),this.initialCredentials.username=n,this.initialCredentials.password=o;break}case "BearerTokenAuthSetting":{let e=t.token??"";this.tokenControl.setValue(e),this.initialCredentials.token=e;break}case "OAuthDiscoverableAuthSetting":{let e=t;this.discoveryUrlControl.setValue(e.discoveryUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.discoveryUrl=e.discoveryUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthCustomAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthRegisteredAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthMcpDiscoverableAuthSetting":{let e=t;this.resourceUrlControl.setValue(e.resourceUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.resourceUrl=e.resourceUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}}}clearCredentialControls(){this.apiKeyControl.setValue(""),this.usernameControl.setValue(""),this.passwordControl.setValue(""),this.tokenControl.setValue(""),this.discoveryUrlControl.setValue(""),this.authorizationUrlControl.setValue(""),this.tokenUrlControl.setValue(""),this.clientIdControl.setValue(""),this.clientSecretControl.setValue(""),this.scopesControl.setValue(""),this.resourceUrlControl.setValue("");}credentialValue(t,e){if(!(this.isEditMode()&&e===this.initialCredentials[t]))return e||void 0}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.nameControl.value.trim(),e=this.descriptionControl.value?.trim()||void 0,n=this.authTypeControl.value,o=this.form.getRawValue().scope,v=this.isPlatformMode?null:this.namespaceId??null,w=this.buildTypedPayload(n,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,this.existingConfig):this.state.create(w,o,v)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}buildTypedPayload(t,e,n){let o={name:e,description:n};switch(t){case "ApiKeyAuthSetting":return x(w({},o),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return x(w({},o),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return x(w({},o),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return x(w({},o),{authType:"OAuthDiscoverableAuthSetting",discoveryUrl:this.credentialValue("discoveryUrl",this.discoveryUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthCustomAuthSetting":return x(w({},o),{authType:"OAuthCustomAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthRegisteredAuthSetting":return x(w({},o),{authType:"OAuthRegisteredAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthMcpDiscoverableAuthSetting":return x(w({},o),{authType:"OAuthMcpDiscoverableAuthSetting",resourceUrl:this.credentialValue("resourceUrl",this.resourceUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)})}}controlForField(t){return {apiKey:this.apiKeyControl,username:this.usernameControl,password:this.passwordControl,token:this.tokenControl,discoveryUrl:this.discoveryUrlControl,authorizationUrl:this.authorizationUrlControl,tokenUrl:this.tokenUrlControl,clientId:this.clientIdControl,clientSecret:this.clientSecretControl,scopes:this.scopesControl,resourceUrl:this.resourceUrlControl}[t]}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","auth-settings"]):this.router.navigate(["/agentos",this.namespaceId,"auth-settings"]);}trackByScope(t,e){return e.value}trackByField(t,e){return e.key}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=Dw({type:i,selectors:[["agentos-auth-setting-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to auth settings",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Configuration scope",3,"disabled"],["label","Auth type","controlId","as-auth-type","required",""],["dsControl","","id","as-auth-type",3,"formControl"],[3,"value"],["label","Name","controlId","as-name","required",""],["dsControl","","id","as-name","type","text","placeholder","e.g. GitHub OAuth App","autocomplete","off",3,"formControl"],["label","Description","controlId","as-description"],["dsControl","","id","as-description","type","text","placeholder","Optional \u2014 short description of this auth setting","autocomplete","off",3,"formControl"],["legend","Credentials",3,"hint"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsCheck",""],["type","radio",3,"formControl","value","disabled"],[3,"label","controlId","required","hint","hintId"],["dsControl","",3,"id","type","placeholder","formControl","autocomplete"]],template:function(e,n){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return n.cancel()}),AC(3," \u2190 Auth settings "),hl()(),Bw(4,Ce,2,0,"p",2)(5,be,16,8,"form",3),hl()),e&2&&(VE(),dg("title",n.isEditMode()?"Edit auth setting":"New auth setting"),VE(3),Vw(n.isLoading()?4:5));},dependencies:[hn,fn,un,dn,cn,at,sn,an,qt,md,Co,Mo,Ht,Ut,ya,po,ho,An,On],encapsulation:2})};
|
|
2
|
+
export{me as AuthSettingFormComponent};
|