@whoz-oss/coday-client 0.0.0-workstream-forge.249 → 0.0.0-workstream-forge.252
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-isv7OUlX.js → chunk-0PGnFUES.js} +1 -1
- package/browser/{chunk-qAO_WS2x.js → chunk-7jUvxE8F.js} +11 -11
- package/browser/{chunk-BlzNw99t.js → chunk-B-EYVKME.js} +1 -1
- package/browser/{chunk-BuxuH9BP.js → chunk-B04JLnyV.js} +1 -1
- package/browser/{chunk-TCTz0Z6I.js → chunk-B8qCpVGq.js} +1 -1
- package/browser/{chunk-Be6W3TsR.js → chunk-BA0W_yCm.js} +1 -1
- package/browser/{chunk-Co0vItak.js → chunk-BCdQDAxq.js} +1 -1
- package/browser/{chunk-DQDO93fa.js → chunk-BQdF-isH.js} +1 -1
- package/browser/{chunk-CQ560xmp.js → chunk-Bb_4LQTi.js} +1 -1
- package/browser/{chunk-CzE55g5c.js → chunk-Bl1r_e1F.js} +1 -1
- package/browser/{chunk-CTDoIA2m.js → chunk-C-OvQKFa.js} +1 -1
- package/browser/{chunk-bs29fJzo.js → chunk-C0O3Eqof.js} +1 -1
- package/browser/{chunk-BOeKfMLQ.js → chunk-C2aFGVSn.js} +1 -1
- package/browser/{chunk-CF-LwfxF.js → chunk-C9gXeaxT.js} +1 -1
- package/browser/{chunk-CQks4NEB.js → chunk-CB4cyWpw.js} +1 -1
- package/browser/{chunk-DFex7bTN.js → chunk-CDT8qslW.js} +1 -1
- package/browser/{chunk-QzulhNzo.js → chunk-CEqneXgA.js} +1 -1
- package/browser/{chunk-DxEJ-WRR.js → chunk-CIY43vEB.js} +1 -1
- package/browser/{chunk-7iOKe3sk.js → chunk-CNBYs6t8.js} +1 -1
- package/browser/{chunk-IobJmS5n.js → chunk-CWGwIkyA.js} +1 -1
- package/browser/{chunk-TODRaWW4.js → chunk-CYKSujxe.js} +1 -1
- package/browser/{chunk-CI4MRoOv.js → chunk-CYYD_3Vr.js} +1 -1
- package/browser/{chunk-Br_8ZFLi.js → chunk-Ce_VtAp4.js} +1 -1
- package/browser/{chunk-BoNn3F1p.js → chunk-CkH04L_E.js} +1 -1
- package/browser/{chunk-DlzuAZs2.js → chunk-CklMXprZ.js} +1 -1
- package/browser/{chunk-DindqaXv.js → chunk-CwrNUco6.js} +1 -1
- package/browser/{chunk-BmOgwWdt.js → chunk-D-3dhk2F.js} +1 -1
- package/browser/chunk-D3iYEK2Q.js +1 -0
- package/browser/{chunk-CxzpsCxW.js → chunk-DDD9qfze.js} +1 -1
- package/browser/{chunk-DvFBWfOh.js → chunk-DQJE-N1a.js} +1 -1
- package/browser/{chunk-C6QCrOzn.js → chunk-DeaKTM3T.js} +1 -1
- package/browser/{chunk-CpV2kJbn.js → chunk-DhCxC7Gl.js} +1 -1
- package/browser/{chunk-Bw1EhndU.js → chunk-DjFydCPj.js} +1 -1
- package/browser/{chunk-DSG-j5Fi.js → chunk-Dp9KXF16.js} +1 -1
- package/browser/{chunk-BzbDU55N.js → chunk-DxIgARQ4.js} +1 -1
- package/browser/{chunk-D9-ZBfAY.js → chunk-F7rfSSxt.js} +1 -1
- package/browser/{chunk-e4ml3919.js → chunk-IHPi4qHF.js} +1 -1
- package/browser/{chunk-D6Jj7Ejx.js → chunk-JJlqZa2p.js} +1 -1
- package/browser/{chunk-BNa9R5xr.js → chunk-NXB--tnM.js} +1 -1
- package/browser/{chunk-CKZuDwRH.js → chunk-SvfUCd0A.js} +1 -1
- package/browser/{chunk-H1lHRH9T.js → chunk-fxc_8ZX_.js} +1 -1
- package/browser/{chunk-B0fXA2NX.js → chunk-h4AUp61g.js} +1 -1
- package/browser/{chunk-3EDXMS-4.js → chunk-ixyF_QjT.js} +1 -1
- package/browser/{chunk-BvuZQAQ0.js → chunk-k-tWVPSJ.js} +1 -1
- package/browser/{chunk-BABBgQ8U.js → chunk-qWBNWkQK.js} +1 -1
- package/browser/{chunk-DwBnbZ_M.js → chunk-uZ2Y3Ych.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/{main-VSQLTBR6.js → main-VAVXYALE.js} +1 -1
- package/package.json +1 -1
- package/browser/chunk-ABpRMh2B.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import {i}from'./chunk-
|
|
1
|
+
import {i}from'./chunk-D3iYEK2Q.js';import {y}from'./chunk-7jUvxE8F.js';import {g,af as G,aI as Pe,Z as Tr,at as Cy,a1 as ga,a2 as ha,aa as br,ad as ne,aD as $y,a5 as vd,a6 as x}from'./main-VAVXYALE.js';var u=s=>s,N="none",w="me",O=class s{nsController=g(G);exportService=g(Pe);userState=g(y);refresh$=new Tr(void 0);namespaceId$=new Tr(null);vm$=Cy([this.namespaceId$,this.refresh$]).pipe(ga(([e])=>{let n=this.loadPlatformConfigs().pipe(ha(()=>br([]))),t=this.loadUserConfigs("global").pipe(ha(()=>br([])));return e?Cy([n,this.loadNamespaceConfigs(e).pipe(ha(()=>br([]))),this.loadUserConfigs(e).pipe(ha(()=>br([]))),t]).pipe(ne(([i,r,c,g])=>({platform:i,namespace:r,userOnNs:c,userGlobal:g}))):Cy([n,t]).pipe(ne(([i,r])=>({platform:i,namespace:[],userOnNs:[],userGlobal:r})))}),$y({bufferSize:1,refCount:true}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e);}refresh(){this.refresh$.next();}loadPlatformConfigs(){return this.nsController.listIntegrationConfig(N)}loadUserConfigs(e){let n=e==="global"?N:e;return this.nsController.listIntegrationConfig(n,w)}userGlobal$=i(this.refresh$,()=>this.loadUserConfigs("global"),[]);loadNamespaceConfigs(e){return e?this.nsController.listIntegrationConfig(e):br([])}getById(e,n){return this.nsController.getByIdIntegrationConfig(e)}create(e,n,t){let r=this.userState.currentUser()?.id;if((n==="userOnNs"||n==="userGlobal")&&!r)throw new Error(`Cannot create ${n} config before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(n==="platform"){let g={name:e.name,integrationType:e.integrationType,description:e.description,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(g)).pipe(vd(()=>this.refresh()))}if(n==="namespace"){if(!t)throw new Error("Cannot create namespace-scoped config without a namespaceId");let g={name:e.name,integrationType:e.integrationType,description:e.description,namespaceId:t,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(g)).pipe(vd(()=>this.refresh()))}if(n==="userOnNs"&&!t)throw new Error("Cannot create userOnNs config without a namespaceId");let c={name:e.name,integrationType:e.integrationType,description:e.description,userId:r,namespaceId:n==="userOnNs"?t:void 0,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(c)).pipe(vd(()=>this.refresh()))}update(e,n,t,i){let r={name:n.name,integrationType:n.integrationType,description:n.description,userId:i.userId,namespaceId:i.namespaceId,parameters:n.parameters,authSettingName:n.authSettingName??void 0,autoGrant:n.autoGrant??false};return this.nsController.updateIntegrationConfig(e,u(r)).pipe(vd(()=>this.refresh()))}delete(e,n){return this.nsController.deleteIntegrationConfig(e).pipe(vd(()=>this.refresh()))}exportAsYaml(e){return this.exportService.exportAsYaml(e)}static \u0275fac=function(n){return new(n||s)};static \u0275prov=x({token:s,factory:s.\u0275fac,providedIn:"root"})};export{O};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {e}from'./chunk-C6dIhkYp.js';import {O as O$1}from'./chunk-
|
|
1
|
+
import {e}from'./chunk-C6dIhkYp.js';import {O as O$1}from'./chunk-CIY43vEB.js';import {g,W,K as we,$ as $i,U,D as Dw,E as Es,f as fg,a as Bw,c as hl,d as VE,i as Vw,b as AC,v as tC,F as Fg}from'./main-VAVXYALE.js';import {b as hn,c as fn,r as rn,D as pn,n as ln,l as Fo}from'./chunk-7jUvxE8F.js';import'./chunk-D3iYEK2Q.js';function O(r,e){r&1&&(Es(0,"p",1),AC(1,"Loading integration\u2026"),hl());}function T(r,e){r&1&&(Es(0,"ds-notice"),AC(1,"Failed to load this integration configuration."),hl());}function L(r,e){r&1&&(Es(0,"div",3)(1,"ds-tag",9),AC(2,"YAML"),hl(),Es(3,"ds-tag",10),AC(4,"Read-only"),hl()());}function k(r,e){if(r&1&&(Es(0,"ds-card",2),Bw(1,L,5,0,"div",3),Es(2,"dl",4)(3,"dt"),AC(4,"Name"),hl(),Es(5,"dd"),AC(6),hl(),Es(7,"dt"),AC(8,"Type"),hl(),Es(9,"dd",5),AC(10),hl(),Es(11,"dt"),AC(12,"Description"),hl(),Es(13,"dd"),AC(14),hl(),Es(15,"dt"),AC(16,"Scope"),hl(),Es(17,"dd"),AC(18),hl(),Es(19,"dt"),AC(20,"Source"),hl(),Es(21,"dd"),AC(22),hl(),Es(23,"dt"),AC(24,"Auto grant"),hl(),Es(25,"dd"),AC(26),hl(),Es(27,"dt"),AC(28,"Auth setting"),hl(),Es(29,"dd"),AC(30),hl()()(),Es(31,"ds-card",6)(32,"p",7),AC(33,"Sensitive values are always redacted."),hl(),Es(34,"pre",8),AC(35),hl()()),r&2){let o=e,a=tC();VE(),Vw(a.source()==="FILESYSTEM"?1:-1),VE(5),Fg(o.name),VE(4),Fg(o.integrationType),VE(4),Fg(o.description||"\u2014"),VE(4),Fg(a.scopeOf(o)),VE(4),Fg(a.source()),VE(4),Fg(o.autoGrant?"Enabled":"Disabled"),VE(4),Fg(o.authSettingName||"None"),VE(5),Fg(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(we);state=g(O$1);integrationId=this.route.snapshot.params.integrationId;isLoading=$i(true);hasError=$i(false);config=$i(null);source=$i("NEO4J");parameters=$i("{}");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=Dw({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&&(Es(0,"ds-page"),fg(1,"ds-section-header",0),Bw(2,O,2,0,"p",1)(3,T,2,0,"ds-notice")(4,k,36,9),hl()),o&2){let m;VE(2),Vw(a.isLoading()?2:a.hasError()?3:(m=a.config())?4:-1,m);}},dependencies:[hn,fn,rn,pn,ln,Fo],encapsulation:2})};export{V as IntegrationConfigViewComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {E as m,p as pt,L as Lt,T as Te,g as gn,q as qt,m as md,C as Co,M as Mo,H as Ht,U as Ut,a as po,h as ho,A as An,O as On,w as wa,_ as _o,G as vo,b as hn,c as fn,u as un,o as dn,d as cn,D as pn,e as at,i as sn}from'./chunk-qAO_WS2x.js';import {g,W,t as F,K as we,ag as U,$ as $i,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,am as Hw,v as tC,T as AI,F as Fg,z as zw,n as lg,w as pf,x as hf}from'./main-VSQLTBR6.js';var ce=(o,t)=>t.id;function ue(o,t){o&1&&(Es(0,"p",2),AC(1,"Loading\u2026"),hl());}function fe(o,t){if(o&1&&(Es(0,"ds-form-field",20),fg(1,"input",22),hl()),o&2){let e=tC(3);VE(),dg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function ge(o,t){if(o&1&&(Es(0,"option",24),AC(1),hl()),o&2){let e=t.$implicit;dg("ngValue",e.id),VE(),Fg(e.name);}}function Ce(o,t){if(o&1&&(Es(0,"ds-form-field",21)(1,"select",23)(2,"option",24),AC(3,"\u2014 None \u2014"),hl(),$w(4,ge,2,2,"option",24,ce),hl(),NI(),hl()),o&2){let e=tC(3);VE(),dg("formControl",e.agentConfigIdControl),AI(),VE(),dg("ngValue",null),VE(2),zw(e.availableAgentConfigs());}}function ye(o,t){if(o&1&&Bw(0,fe,2,1,"ds-form-field",20)(1,Ce,6,2,"ds-form-field",21),o&2){let e=tC(2);Vw(e.isEditMode()&&e.agentConfigIdControl.value?0:e.isEditMode()?-1:1);}}function ve(o,t){o&1&&(Es(0,"p",2),AC(1,"No parameters defined."),hl());}function he(o,t){if(o&1){let e=Qw();Es(0,"div",11)(1,"div",25)(2,"ds-form-field",26),fg(3,"input",27),NI(),hl(),Es(4,"ds-form-field",28),fg(5,"input",29),NI(),hl(),Es(6,"ds-form-field",30),fg(7,"input",31),NI(),hl()(),Es(8,"button",32),vg("click",function(){let d=pf(e).$index,m=tC(2);return hf(m.removeParameter(d))}),AC(9," \xD7 "),hl()();}if(o&2){let e=t.$implicit,r=t.$index;dg("formGroupName",r),VE(2),dg("controlId","param-name-"+r)("error",e.controls.name.invalid&&e.controls.name.touched?"Parameter name is required.":null),VE(),dg("id","param-name-"+r),AI(),VE(),dg("controlId","param-desc-"+r),VE(),dg("id","param-desc-"+r),AI(),VE(),dg("controlId","param-default-"+r),VE(),dg("id","param-default-"+r),AI();}}function _e(o,t){if(o&1){let e=Qw();Es(0,"div",14)(1,"span",33),AC(2),hl(),Es(3,"ds-form-field",34),fg(4,"textarea",35),NI(),hl(),Es(5,"button",36),vg("click",function(){let d=pf(e).$index,m=tC(2);return hf(m.removeContentEntry(d))}),AC(6," \xD7 "),hl()();}if(o&2){let e=t.$implicit,r=t.$index,d=tC(2);VE(2),Fg(r+1),VE(),dg("error",e.invalid&&e.touched?"Content entry must not be blank.":null),VE(),dg("formControlName",r),lg("aria-label","Content entry "+(r+1)),AI(),VE(),dg("disabled",d.contentArray.length===1);}}function xe(o,t){if(o&1&&(Es(0,"ds-notice"),AC(1),hl()),o&2){let e=tC(2);VE(),Fg(e.errorMessage());}}function be(o,t){if(o&1){let e=Qw();Es(0,"button",37),vg("click",function(){pf(e);let d=tC(2);return hf(d.exportYaml())}),AC(1),hl();}if(o&2){let e=tC(2);dg("disabled",e.isExporting()),VE(),Dl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ee(o,t){if(o&1){let e=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let d=tC();return hf(d.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,ye,2,1),Es(6,"ds-fieldset",9)(7,"p",2),AC(8," Each parameter must have a name and a default value. Use "),Es(9,"code"),AC(10),hl(),AC(11," in content entries to reference them. "),hl(),Es(12,"div",10),Bw(13,ve,2,0,"p",2),$w(14,he,10,8,"div",11,Hw),Es(16,"div")(17,"button",12),vg("click",function(){pf(e);let d=tC();return hf(d.addParameter())}),AC(18,"+ Add parameter"),hl()()()(),Es(19,"ds-fieldset",13)(20,"p",2),AC(21," Each content entry is a command. Use "),Es(22,"code"),AC(23,"@AgentName"),hl(),AC(24," to target an agent, "),Es(25,"code"),AC(26,"/promptName param1 param2"),hl(),AC(27," to call another prompt, and "),Es(28,"code"),AC(29),hl(),AC(30," for parameter placeholders. "),hl(),Es(31,"div",10),$w(32,_e,7,5,"div",14,Hw),Es(34,"div")(35,"button",12),vg("click",function(){pf(e);let d=tC();return hf(d.addContentEntry())}),AC(36,"+ Add content entry"),hl()()()(),Bw(37,xe,2,1,"ds-notice"),Es(38,"ds-form-field",15),fg(39,"textarea",16),NI(),hl(),Es(40,"ds-form-actions")(41,"button",17),AC(42),hl(),Bw(43,be,2,2,"button",18),Es(44,"button",19),vg("click",function(){pf(e);let d=tC();return hf(d.cancel())}),AC(45,"Cancel"),hl()()();}if(o&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.availableAgentConfigs().length>0?5:-1),VE(5),Fg(e.paramPlaceholderSyntax),VE(2),dg("formArrayName","parameters"),VE(),Vw(e.parametersArray.length===0?13:-1),VE(),zw(e.parametersArray.controls),VE(15),Fg(e.paramPlaceholderSyntax),VE(2),dg("formArrayName","content"),VE(),zw(e.contentArray.controls),VE(5),Vw(e.errorMessage()?37:-1),VE(),dg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),VE(),dg("formControl",e.externalMetadataJsonControl),AI(),VE(2),dg("disabled",e.form.invalid||e.isSubmitting()),VE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," "),VE(),Vw(e.isEditMode()?43:-1);}}var pe=class o{route=g(W);router=g(F);destroyRef=g(we);promptState=g(m);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te("",{nonNullable:true,validators:[gn.required,gn.minLength(1)]}),description:new Te(null),agentConfigId:new Te(null),externalMetadataJson:new Te("",{nonNullable:true,validators:[Pe]}),content:new Lt([this.createContentControl()],{validators:[gn.required]}),parameters:new Lt([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);isExporting=$i(false);errorMessage=$i(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=$i([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(true),this.loadPrompt(t)),this.isPlatformMode?this.loadPlatformAgentConfigs():this.namespaceId&&this.loadAgentConfigs(this.namespaceId);}loadPrompt(t){this.isLoading.set(true),this.promptState.getById(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadAgentConfigs(t){this.agentConfigController.listByParentAgentConfig(t).pipe(U$1(this.destroyRef),ha(()=>br([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U$1(this.destroyRef),ha(()=>br([]))).subscribe(t=>this.agentConfigs.set(t));}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(r=>this.contentArray.push(this.createContentControl(r))),this.parametersArray.clear(),(t.parameters??[]).forEach(r=>this.parametersArray.push(this.createParameterGroup(r))),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}createContentControl(t=""){return new Te(t,{nonNullable:true,validators:[gn.required,gn.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl());}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t);}createParameterGroup(t){return new pt({name:new Te(t?.name??"",{nonNullable:true,validators:[gn.required,gn.minLength(1)]}),description:new Te(t?.description??null),defaultValue:new Te(t?.defaultValue??"",{nonNullable:true,validators:[gn.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup());}removeParameter(t){this.parametersArray.removeAt(t);}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId,sourceLanguage:this.existingPrompt?.sourceLanguage??"en",name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(m=>m.value.trim()),parameters:this.parametersArray.controls.map(m=>({name:m.controls.name.value.trim(),description:m.controls.description.value?.trim()||void 0,defaultValue:m.controls.defaultValue.value.trim()}))});t||(e.agentConfigId=this.agentConfigIdControl.value||null);let r=this.externalMetadataJsonControl.value.trim();e.externalMetadata=r?JSON.parse(r):null;let d=t?this.promptState.update(this.existingPrompt.id,e):this.promptState.create(e);this.errorMessage.set(null),d.pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:m=>{this.isSubmitting.set(false),m.status===409?this.errorMessage.set(`A prompt named "${e.name}" already exists in this scope.`):m.status===400?this.errorMessage.set(m.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}exportYaml(){let t=this.existingPrompt?.id;!t||this.isExporting()||(this.isExporting.set(true),this.promptState.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let r=new Blob([e],{type:"application/yaml"}),d=URL.createObjectURL(r),m=document.createElement("a");m.href=d,m.download=`${this.existingPrompt?.name??"prompt"}.yaml`,m.click(),URL.revokeObjectURL(d),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"]);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=Dw({type:o,selectors:[["agentos-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","prompt-name","required","",3,"error"],["dsControl","","id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",3,"formControl"],["label","Description","controlId","prompt-description"],["dsControl","","id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",3,"formControl"],["legend","Parameters","legendHint","Named placeholders used in content"],[1,"ds-stack",3,"formArrayName"],[1,"ds-panel","ds-inline","ds-inline--start",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["legend","Content","legendHint","Ordered list of text commands"],[1,"ds-inline","ds-inline--start"],["label","External Metadata","controlId","prompt-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["label","Agent Config","hint","Agent Config cannot be changed after creation."],["label","Agent Config","controlId","prompt-agent-config","hint","Optional. Links this prompt to an agent as a starter. Immutable after creation."],["dsControl","","type","text","readonly","",3,"value"],["dsControl","","id","prompt-agent-config",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-grow"],["label","Name","required","",3,"controlId","error"],["dsControl","","type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",3,"id"],["label","Description",3,"controlId"],["dsControl","","type","text","placeholder","Optional","formControlName","description","autocomplete","off",3,"id"],["label","Default value",3,"controlId"],["dsControl","","type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",3,"id"],["dsButton","","variant","icon-danger","type","button","title","Remove this parameter","aria-label","Remove this parameter",3,"click"],[1,"ds-index"],["grow","",3,"error"],["dsControl","","rows","4","placeholder","Enter a command\u2026",3,"formControlName"],["dsButton","","variant","icon-danger","type","button","title","Remove this entry","aria-label","Remove this entry",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,r){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return r.cancel()}),AC(3),hl()(),Bw(4,ue,2,0,"p",2)(5,Ee,46,16,"form",3),hl()),e&2&&(VE(),dg("title",r.isEditMode()?"Edit prompt":"New prompt"),VE(2),Dl(" \u2190 ",r.isPlatformMode?"Platform prompts":"Prompts"," "),VE(),Vw(r.isLoading()?4:5));},dependencies:[qt,md,Co,Mo,Ht,Ut,po,ho,An,On,wa,_o,vo,hn,fn,un,dn,cn,pn,at,sn],encapsulation:2})};function Pe(o){let t=o.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}export{pe as PromptFormComponent};
|
|
1
|
+
import {E as m,p as pt,L as Lt,T as Te,g as gn,q as qt,m as md,C as Co,M as Mo,H as Ht,U as Ut,a as po,h as ho,A as An,O as On,w as wa,_ as _o,G as vo,b as hn,c as fn,u as un,o as dn,d as cn,D as pn,e as at,i as sn}from'./chunk-7jUvxE8F.js';import {g,W,t as F,K as we,ag as U,$ as $i,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,am as Hw,v as tC,T as AI,F as Fg,z as zw,n as lg,w as pf,x as hf}from'./main-VAVXYALE.js';var ce=(o,t)=>t.id;function ue(o,t){o&1&&(Es(0,"p",2),AC(1,"Loading\u2026"),hl());}function fe(o,t){if(o&1&&(Es(0,"ds-form-field",20),fg(1,"input",22),hl()),o&2){let e=tC(3);VE(),dg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function ge(o,t){if(o&1&&(Es(0,"option",24),AC(1),hl()),o&2){let e=t.$implicit;dg("ngValue",e.id),VE(),Fg(e.name);}}function Ce(o,t){if(o&1&&(Es(0,"ds-form-field",21)(1,"select",23)(2,"option",24),AC(3,"\u2014 None \u2014"),hl(),$w(4,ge,2,2,"option",24,ce),hl(),NI(),hl()),o&2){let e=tC(3);VE(),dg("formControl",e.agentConfigIdControl),AI(),VE(),dg("ngValue",null),VE(2),zw(e.availableAgentConfigs());}}function ye(o,t){if(o&1&&Bw(0,fe,2,1,"ds-form-field",20)(1,Ce,6,2,"ds-form-field",21),o&2){let e=tC(2);Vw(e.isEditMode()&&e.agentConfigIdControl.value?0:e.isEditMode()?-1:1);}}function ve(o,t){o&1&&(Es(0,"p",2),AC(1,"No parameters defined."),hl());}function he(o,t){if(o&1){let e=Qw();Es(0,"div",11)(1,"div",25)(2,"ds-form-field",26),fg(3,"input",27),NI(),hl(),Es(4,"ds-form-field",28),fg(5,"input",29),NI(),hl(),Es(6,"ds-form-field",30),fg(7,"input",31),NI(),hl()(),Es(8,"button",32),vg("click",function(){let d=pf(e).$index,m=tC(2);return hf(m.removeParameter(d))}),AC(9," \xD7 "),hl()();}if(o&2){let e=t.$implicit,r=t.$index;dg("formGroupName",r),VE(2),dg("controlId","param-name-"+r)("error",e.controls.name.invalid&&e.controls.name.touched?"Parameter name is required.":null),VE(),dg("id","param-name-"+r),AI(),VE(),dg("controlId","param-desc-"+r),VE(),dg("id","param-desc-"+r),AI(),VE(),dg("controlId","param-default-"+r),VE(),dg("id","param-default-"+r),AI();}}function _e(o,t){if(o&1){let e=Qw();Es(0,"div",14)(1,"span",33),AC(2),hl(),Es(3,"ds-form-field",34),fg(4,"textarea",35),NI(),hl(),Es(5,"button",36),vg("click",function(){let d=pf(e).$index,m=tC(2);return hf(m.removeContentEntry(d))}),AC(6," \xD7 "),hl()();}if(o&2){let e=t.$implicit,r=t.$index,d=tC(2);VE(2),Fg(r+1),VE(),dg("error",e.invalid&&e.touched?"Content entry must not be blank.":null),VE(),dg("formControlName",r),lg("aria-label","Content entry "+(r+1)),AI(),VE(),dg("disabled",d.contentArray.length===1);}}function xe(o,t){if(o&1&&(Es(0,"ds-notice"),AC(1),hl()),o&2){let e=tC(2);VE(),Fg(e.errorMessage());}}function be(o,t){if(o&1){let e=Qw();Es(0,"button",37),vg("click",function(){pf(e);let d=tC(2);return hf(d.exportYaml())}),AC(1),hl();}if(o&2){let e=tC(2);dg("disabled",e.isExporting()),VE(),Dl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ee(o,t){if(o&1){let e=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let d=tC();return hf(d.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,ye,2,1),Es(6,"ds-fieldset",9)(7,"p",2),AC(8," Each parameter must have a name and a default value. Use "),Es(9,"code"),AC(10),hl(),AC(11," in content entries to reference them. "),hl(),Es(12,"div",10),Bw(13,ve,2,0,"p",2),$w(14,he,10,8,"div",11,Hw),Es(16,"div")(17,"button",12),vg("click",function(){pf(e);let d=tC();return hf(d.addParameter())}),AC(18,"+ Add parameter"),hl()()()(),Es(19,"ds-fieldset",13)(20,"p",2),AC(21," Each content entry is a command. Use "),Es(22,"code"),AC(23,"@AgentName"),hl(),AC(24," to target an agent, "),Es(25,"code"),AC(26,"/promptName param1 param2"),hl(),AC(27," to call another prompt, and "),Es(28,"code"),AC(29),hl(),AC(30," for parameter placeholders. "),hl(),Es(31,"div",10),$w(32,_e,7,5,"div",14,Hw),Es(34,"div")(35,"button",12),vg("click",function(){pf(e);let d=tC();return hf(d.addContentEntry())}),AC(36,"+ Add content entry"),hl()()()(),Bw(37,xe,2,1,"ds-notice"),Es(38,"ds-form-field",15),fg(39,"textarea",16),NI(),hl(),Es(40,"ds-form-actions")(41,"button",17),AC(42),hl(),Bw(43,be,2,2,"button",18),Es(44,"button",19),vg("click",function(){pf(e);let d=tC();return hf(d.cancel())}),AC(45,"Cancel"),hl()()();}if(o&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.availableAgentConfigs().length>0?5:-1),VE(5),Fg(e.paramPlaceholderSyntax),VE(2),dg("formArrayName","parameters"),VE(),Vw(e.parametersArray.length===0?13:-1),VE(),zw(e.parametersArray.controls),VE(15),Fg(e.paramPlaceholderSyntax),VE(2),dg("formArrayName","content"),VE(),zw(e.contentArray.controls),VE(5),Vw(e.errorMessage()?37:-1),VE(),dg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),VE(),dg("formControl",e.externalMetadataJsonControl),AI(),VE(2),dg("disabled",e.form.invalid||e.isSubmitting()),VE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," "),VE(),Vw(e.isEditMode()?43:-1);}}var pe=class o{route=g(W);router=g(F);destroyRef=g(we);promptState=g(m);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te("",{nonNullable:true,validators:[gn.required,gn.minLength(1)]}),description:new Te(null),agentConfigId:new Te(null),externalMetadataJson:new Te("",{nonNullable:true,validators:[Pe]}),content:new Lt([this.createContentControl()],{validators:[gn.required]}),parameters:new Lt([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);isExporting=$i(false);errorMessage=$i(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=$i([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(true),this.loadPrompt(t)),this.isPlatformMode?this.loadPlatformAgentConfigs():this.namespaceId&&this.loadAgentConfigs(this.namespaceId);}loadPrompt(t){this.isLoading.set(true),this.promptState.getById(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadAgentConfigs(t){this.agentConfigController.listByParentAgentConfig(t).pipe(U$1(this.destroyRef),ha(()=>br([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U$1(this.destroyRef),ha(()=>br([]))).subscribe(t=>this.agentConfigs.set(t));}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(r=>this.contentArray.push(this.createContentControl(r))),this.parametersArray.clear(),(t.parameters??[]).forEach(r=>this.parametersArray.push(this.createParameterGroup(r))),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}createContentControl(t=""){return new Te(t,{nonNullable:true,validators:[gn.required,gn.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl());}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t);}createParameterGroup(t){return new pt({name:new Te(t?.name??"",{nonNullable:true,validators:[gn.required,gn.minLength(1)]}),description:new Te(t?.description??null),defaultValue:new Te(t?.defaultValue??"",{nonNullable:true,validators:[gn.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup());}removeParameter(t){this.parametersArray.removeAt(t);}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId,sourceLanguage:this.existingPrompt?.sourceLanguage??"en",name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(m=>m.value.trim()),parameters:this.parametersArray.controls.map(m=>({name:m.controls.name.value.trim(),description:m.controls.description.value?.trim()||void 0,defaultValue:m.controls.defaultValue.value.trim()}))});t||(e.agentConfigId=this.agentConfigIdControl.value||null);let r=this.externalMetadataJsonControl.value.trim();e.externalMetadata=r?JSON.parse(r):null;let d=t?this.promptState.update(this.existingPrompt.id,e):this.promptState.create(e);this.errorMessage.set(null),d.pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:m=>{this.isSubmitting.set(false),m.status===409?this.errorMessage.set(`A prompt named "${e.name}" already exists in this scope.`):m.status===400?this.errorMessage.set(m.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}exportYaml(){let t=this.existingPrompt?.id;!t||this.isExporting()||(this.isExporting.set(true),this.promptState.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let r=new Blob([e],{type:"application/yaml"}),d=URL.createObjectURL(r),m=document.createElement("a");m.href=d,m.download=`${this.existingPrompt?.name??"prompt"}.yaml`,m.click(),URL.revokeObjectURL(d),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"]);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=Dw({type:o,selectors:[["agentos-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","prompt-name","required","",3,"error"],["dsControl","","id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",3,"formControl"],["label","Description","controlId","prompt-description"],["dsControl","","id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",3,"formControl"],["legend","Parameters","legendHint","Named placeholders used in content"],[1,"ds-stack",3,"formArrayName"],[1,"ds-panel","ds-inline","ds-inline--start",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["legend","Content","legendHint","Ordered list of text commands"],[1,"ds-inline","ds-inline--start"],["label","External Metadata","controlId","prompt-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["label","Agent Config","hint","Agent Config cannot be changed after creation."],["label","Agent Config","controlId","prompt-agent-config","hint","Optional. Links this prompt to an agent as a starter. Immutable after creation."],["dsControl","","type","text","readonly","",3,"value"],["dsControl","","id","prompt-agent-config",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-grow"],["label","Name","required","",3,"controlId","error"],["dsControl","","type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",3,"id"],["label","Description",3,"controlId"],["dsControl","","type","text","placeholder","Optional","formControlName","description","autocomplete","off",3,"id"],["label","Default value",3,"controlId"],["dsControl","","type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",3,"id"],["dsButton","","variant","icon-danger","type","button","title","Remove this parameter","aria-label","Remove this parameter",3,"click"],[1,"ds-index"],["grow","",3,"error"],["dsControl","","rows","4","placeholder","Enter a command\u2026",3,"formControlName"],["dsButton","","variant","icon-danger","type","button","title","Remove this entry","aria-label","Remove this entry",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,r){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return r.cancel()}),AC(3),hl()(),Bw(4,ue,2,0,"p",2)(5,Ee,46,16,"form",3),hl()),e&2&&(VE(),dg("title",r.isEditMode()?"Edit prompt":"New prompt"),VE(2),Dl(" \u2190 ",r.isPlatformMode?"Platform prompts":"Prompts"," "),VE(),Vw(r.isLoading()?4:5));},dependencies:[qt,md,Co,Mo,Ht,Ut,po,ho,An,On,wa,_o,vo,hn,fn,un,dn,cn,pn,at,sn],encapsulation:2})};function Pe(o){let t=o.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}export{pe as PromptFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {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
|
+
import {c}from'./chunk-DQJE-N1a.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-7jUvxE8F.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-VAVXYALE.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 {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-QzulhNzo.js';import {I}from'./chunk-DQDO93fa.js';import {g,W,t as F,K as we,$ as $i,U,ad as ne$1,a1 as ga,aa as br,aL as ui,a2 as ha,ac as by,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,G as EC,n as lg,u as Dl,q as $w,z as zw,Q as Qw,w as pf,x as hf}from'./main-VSQLTBR6.js';import {z as k,j as O,a5 as w,e as at,c as fn,k as ko,l as Fo,P,B as P$1}from'./chunk-qAO_WS2x.js';import'./chunk-ABpRMh2B.js';var Q=(i,t)=>t.key;function X(i,t){if(i&1&&(Es(0,"p",3),AC(1),hl()),i&2){let e=tC();VE(),Fg(e.deletion.error());}}function Z(i,t){if(i&1&&(Es(0,"p"),AC(1),hl()),i&2){let e=t;EC(e.kind==="error"?"settings-table__error":"settings-table__status"),lg("role",e.kind==="error"?"alert":"status"),VE(),Dl(" ",e.text," ");}}function ee(i,t){i&1&&(Es(0,"p",5),AC(1,"Loading auth settings\u2026"),hl());}function te(i,t){i&1&&(Es(0,"p",6),AC(1,"No auth settings available."),hl());}function ne(i,t){i&1&&(Es(0,"p",5),AC(1,"No auth settings match the current filter."),hl());}function ie(i,t){i&1&&(Es(0,"ds-tag",18),AC(1,"Read-only"),hl());}function oe(i,t){i&1&&(Es(0,"ds-tag",20),AC(1,"Connected"),hl());}function ae(i,t){i&1&&(Es(0,"ds-tag",18),AC(1,"Not connected"),hl());}function se(i,t){i&1&&(Es(0,"span",21),AC(1,"\u2014"),hl());}function re(i,t){if(i&1){let e=Qw();Es(0,"span",26),AC(1,"Waiting for authorization\u2026"),hl(),Es(2,"button",27),vg("click",function(){pf(e);let r=tC(4);return hf(r.cancelConnect())}),AC(3," Cancel "),hl();}if(i&2){let e=tC(2).$implicit;VE(2),lg("aria-label","Stop waiting for the authorization of "+e.config.name);}}function le(i,t){if(i&1){let e=Qw();Es(0,"span",28),AC(1,"Disconnect?"),hl(),Es(2,"button",29),vg("click",function(){pf(e);let r=tC(2).$implicit,d=tC(2);return hf(d.confirmReset(r))}),AC(3),hl(),Es(4,"button",29),vg("click",function(){pf(e);let r=tC(4);return hf(r.cancelReset())}),AC(5," Cancel "),hl();}if(i&2){let e=tC(2).$implicit,n=tC(2);VE(2),dg("disabled",n.resettingKey()===e.key),lg("aria-label","Confirm disconnecting "+e.config.name),VE(),Dl(" ",n.resettingKey()===e.key?"Disconnecting\u2026":"Confirm"," "),VE(),dg("disabled",n.resettingKey()===e.key),lg("aria-label","Cancel disconnecting "+e.config.name);}}function ce(i,t){if(i&1){let e=Qw();Es(0,"button",29),vg("click",function(){pf(e);let r=tC(3).$implicit,d=tC(2);return hf(d.requestReset(r))}),AC(1," Disconnect "),hl();}if(i&2){let e=tC(3).$implicit,n=tC(2);dg("disabled",n.connectingKey()!==null),lg("aria-label","Disconnect "+e.config.name);}}function de(i,t){if(i&1){let e=Qw();Es(0,"button",29),vg("click",function(){pf(e);let r=tC(2).$implicit,d=tC(2);return hf(d.connect(r))}),AC(1),hl(),Bw(2,ce,2,2,"button",30);}if(i&2){let e=tC(2).$implicit,n=tC(2);dg("disabled",n.connectingKey()!==null||n.resettingKey()!==null),lg("aria-label",(n.connectionOf(e)==="connected"?"Reconnect ":"Connect ")+e.config.name),VE(),Dl(" ",n.connectionOf(e)==="connected"?"Reconnect":"Connect"," "),VE(),Vw(n.connectionOf(e)==="connected"?2:-1);}}function pe(i,t){if(i&1&&Bw(0,re,4,1)(1,le,6,5)(2,de,3,4),i&2){let e=tC().$implicit,n=tC(2);Vw(n.connectingKey()===e.key?0:n.resetConfirmingKey()===e.key?1:n.deletion.confirmingId()!==e.key?2:-1);}}function ue(i,t){if(i&1){let e=Qw();Es(0,"button",27),vg("click",function(){pf(e);let r=tC().$implicit,d=tC(2);return hf(d.duplicate(r))}),AC(1," Duplicate "),hl();}if(i&2){let e=tC().$implicit;lg("aria-label","Duplicate "+e.config.name);}}function _e(i,t){if(i&1){let e=Qw();Es(0,"button",27),vg("click",function(){pf(e);let r=tC(2).$implicit,d=tC(2);return hf(d.edit(r))}),AC(1," Edit "),hl();}if(i&2){let e=tC(2).$implicit;lg("aria-label","Edit "+e.config.name);}}function me(i,t){if(i&1){let e=Qw();Bw(0,_e,2,1,"button",24),Es(1,"agentos-row-delete-action",31),vg("deleteRequested",function(){pf(e);let r=tC().$implicit,d=tC(2);return hf(d.deletion.request(r.key))})("deleteConfirmed",function(){pf(e);let r=tC().$implicit,d=tC(2);return hf(d.confirmDelete(r))})("deleteCancelled",function(){pf(e);let r=tC(3);return hf(r.deletion.cancel())}),hl();}if(i&2){let e=tC().$implicit,n=tC(2);Vw(n.deletion.confirmingId()!==e.key?0:-1),VE(),dg("rowKey",e.key)("rowLabel",e.config.name)("state",n.deletion);}}function ge(i,t){i&1&&(Es(0,"button",25),AC(1,"Inherited"),hl());}function he(i,t){if(i&1&&(Es(0,"tr",10)(1,"td",13),AC(2),hl(),Es(3,"td",14),AC(4),hl(),Es(5,"td",15)(6,"div",16)(7,"ds-tag",17),AC(8),hl(),Bw(9,ie,2,0,"ds-tag",18),hl()(),Es(10,"td",19),Bw(11,oe,2,0,"ds-tag",20)(12,ae,2,0,"ds-tag",18)(13,se,2,0,"span",21),hl(),Es(14,"td",22)(15,"div",23),Bw(16,pe,3,1),Bw(17,ue,2,1,"button",24),Bw(18,me,2,4)(19,ge,2,0,"button",25),hl()()()),i&2){let e=t.$implicit,n=tC(2);VE(2),Fg(e.config.name),VE(2),Dl(" ",e.config.authType," "),VE(3),dg("variant",e.scopeLabel==="Platform"?"neutral":e.scopeLabel==="Personal"?"outline":"accent"),VE(),Fg(e.scopeLabel),VE(),Vw(e.canMutate?-1:9),VE(2),Vw(n.isOAuth(e)&&n.connectionOf(e)==="connected"?11:n.isOAuth(e)&&n.connectionOf(e)==="disconnected"?12:13),VE(5),Vw(n.isOAuth(e)?16:-1),VE(),Vw(n.deletion.confirmingId()!==e.key&&n.resetConfirmingKey()!==e.key&&n.connectingKey()!==e.key?17:-1),VE(),Vw(e.canMutate?18:19);}}function Ce(i,t){if(i&1&&(Es(0,"div",7)(1,"table",8)(2,"thead",9)(3,"tr",10)(4,"th",11),AC(5,"Name"),hl(),Es(6,"th",11),AC(7,"Authentication type"),hl(),Es(8,"th",11),AC(9,"Scope"),hl(),Es(10,"th",11),AC(11,"Connection"),hl(),Es(12,"th",11)(13,"span",12),AC(14,"Actions"),hl()()()(),Es(15,"tbody",9),$w(16,he,20,9,"tr",10,Q),hl()()()),i&2){let e=tC();VE(16),zw(e.rowFilter.filteredRows());}}var fe=new Set(["OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"]),J=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=$i(false);isLoading=$i(true);rows=$i([]);deletion=k();connections=$i({});connectingKey=$i(null);resetConfirmingKey=$i(null);resettingKey=$i(null);actionMessage=$i(null);connectAttempt=null;connectPopup=null;connectionsLoad=null;rowFilter=O(this.rows,t=>[t.config.name,t.config.authType,t.scopeLabel].join(" "));ngOnInit(){this.route.paramMap.pipe(U(this.destroyRef)).subscribe(t=>{let e=t.get("namespaceId")??"";e&&e!==this.namespaceId&&(this.namespaceId=e),this.state.setNamespace(e);}),this.route.paramMap.pipe(ne$1(t=>t.get("namespaceId")??""),ga(t=>t?this.namespaceRole.isAdminOfNamespace$(t):br(false)),U(this.destroyRef)).subscribe(t=>this.isAdmin.set(t)),this.state.vm$.pipe(U(this.destroyRef)).subscribe({next:t=>{this.rows.set(this.toRows(t)),this.isLoading.set(false),this.loadConnections();},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:n(this.isAdmin())}});}edit(t){!t.canMutate||!t.config.id||this.router.navigate(["/agentos",this.namespaceId,"auth-settings",t.config.id,"edit"],{queryParams:{scope:t.scope}});}confirmDelete(t){!t.canMutate||!t.config.id||this.deletion.execute(t.key,{request$:this.state.delete(t.config.id,t.scope).pipe(U(this.destroyRef)),errorMessage:`Deleting "${t.config.name}" failed. Try again.`});}isOAuth(t){return fe.has(t.config.authType)}connectionOf(t){return this.connections()[t.key]??"unknown"}connect(t){let e=t.config.id;if(!e||this.connectingKey()||this.resettingKey())return;let n=w();if(!n){this.actionMessage.set({kind:"error",text:"The browser blocked the authorization window. Allow pop-ups for this site and try again."});return}this.actionMessage.set(null),this.resetConfirmingKey.set(null),this.connectPopup=n,this.connectingKey.set(t.key),this.connectAttempt=this.state.connect(e,this.namespaceParam(),r=>n.location.href=r,()=>n.closed).pipe(ui(()=>{this.connectingKey.set(null),this.connectAttempt=null,this.connectPopup=null;}),U(this.destroyRef)).subscribe({next:r=>this.onConnectOutcome(t,r,n),error:()=>{n.close(),this.actionMessage.set({kind:"error",text:`Connecting "${t.config.name}" failed. Check that its OAuth settings are complete, then try again.`});}});}cancelConnect(){this.connectAttempt?.unsubscribe(),this.connectPopup?.close();}requestReset(t){this.resettingKey()||this.connectingKey()||(this.actionMessage.set(null),this.resetConfirmingKey.set(t.key));}cancelReset(){this.resettingKey()||this.resetConfirmingKey.set(null);}confirmReset(t){let e=t.config.id;!e||this.resettingKey()||this.resetConfirmingKey()!==t.key||(this.resettingKey.set(t.key),this.state.resetCredential(e,this.namespaceParam()).pipe(U(this.destroyRef)).subscribe({next:()=>{this.resettingKey.set(null),this.resetConfirmingKey.set(null),this.loadConnections();},error:()=>{this.resettingKey.set(null),this.actionMessage.set({kind:"error",text:`Disconnecting "${t.config.name}" failed. Try again.`});}}));}duplicate(t){if(!t.config.id)return;let e=t.scope==="platform"||t.scope==="namespace"&&!this.isAdmin()?"userOnNs":t.scope;this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:e,template:t.config.id,templateScope:t.scope}});}onConnectOutcome(t,e,n){n.close(),this.loadConnections(),e==="abandoned"?this.actionMessage.set({kind:"info",text:`The authorization window was closed before "${t.config.name}" got connected.`}):e==="timeout"&&this.actionMessage.set({kind:"info",text:`No authorization was received for "${t.config.name}" in time. Try again.`});}namespaceParam(){return this.namespaceId||void 0}loadConnections(){this.connectionsLoad?.unsubscribe();let t=this.rows().filter(e=>this.isOAuth(e)&&e.config.id).map(e=>this.state.getConnection(e.config.id,this.namespaceParam()).pipe(ne$1(n=>[e.key,n.connected?"connected":"disconnected"]),ha(()=>br([e.key,"unknown"]))));if(t.length===0){this.connections.set({});return}this.connectionsLoad=by(t).pipe(U(this.destroyRef)).subscribe(e=>this.connections.set(Object.fromEntries(e)));}toRows(t){return [...this.mapScope(t.platform,"platform","Platform",false),...this.mapScope(t.namespace,"namespace","Namespace",this.isAdmin()),...this.mapScope(t.userOnNs,"userOnNs","Personal",true),...this.mapScope(t.userGlobal,"userGlobal","Personal",true)]}mapScope(t,e,n,r){return t.map((d,Y)=>({key:`${e}:${d.id??Y}`,config:d,scope:e,scopeLabel:n,canMutate:r}))}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=Dw({type:i,selectors:[["agentos-auth-settings-all-scopes"]],decls:10,vars:4,consts:[["title","Auth settings","description","Authentication settings available in this namespace, including inherited platform and personal entries."],["label","Filter auth settings","placeholder","Filter auth settings\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],[3,"class"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Auth settings"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Authentication type",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Connection"],["variant","accent"],[1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["type","button","disabled",""],["role","status",1,"settings-table__confirm-label"],["type","button",3,"click"],[1,"settings-table__confirm-label"],["type","button",3,"click","disabled"],["type","button",3,"disabled"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(e,n){if(e&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(d){return n.rowFilter.query.set(d)}),hl(),Es(2,"button",2),vg("click",function(){return n.openCreateForm()}),AC(3,"New auth setting"),hl()(),Bw(4,X,2,1,"p",3),Bw(5,Z,2,4,"p",4),Bw(6,ee,2,0,"p",5)(7,te,2,0,"p",6)(8,ne,2,0,"p",5)(9,Ce,18,0,"div",7)),e&2){let r;VE(),dg("query",n.rowFilter.query()),VE(3),Vw(n.deletion.error()?4:-1),VE(),Vw((r=n.actionMessage())?5:-1,r),VE(),Vw(n.isLoading()?6:n.rows().length===0?7:n.rowFilter.filteredRows().length===0?8:9);}},dependencies:[at,fn,ko,Fo,P,P$1],encapsulation:2})};export{J as AuthSettingsAllScopesComponent};
|
|
1
|
+
import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-CEqneXgA.js';import {I}from'./chunk-BQdF-isH.js';import {g,W,t as F,K as we,$ as $i,U,ad as ne$1,a1 as ga,aa as br,aL as ui,a2 as ha,ac as by,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,G as EC,n as lg,u as Dl,q as $w,z as zw,Q as Qw,w as pf,x as hf}from'./main-VAVXYALE.js';import {z as k,j as O,a5 as w,e as at,c as fn,k as ko,l as Fo,P,B as P$1}from'./chunk-7jUvxE8F.js';import'./chunk-D3iYEK2Q.js';var Q=(i,t)=>t.key;function X(i,t){if(i&1&&(Es(0,"p",3),AC(1),hl()),i&2){let e=tC();VE(),Fg(e.deletion.error());}}function Z(i,t){if(i&1&&(Es(0,"p"),AC(1),hl()),i&2){let e=t;EC(e.kind==="error"?"settings-table__error":"settings-table__status"),lg("role",e.kind==="error"?"alert":"status"),VE(),Dl(" ",e.text," ");}}function ee(i,t){i&1&&(Es(0,"p",5),AC(1,"Loading auth settings\u2026"),hl());}function te(i,t){i&1&&(Es(0,"p",6),AC(1,"No auth settings available."),hl());}function ne(i,t){i&1&&(Es(0,"p",5),AC(1,"No auth settings match the current filter."),hl());}function ie(i,t){i&1&&(Es(0,"ds-tag",18),AC(1,"Read-only"),hl());}function oe(i,t){i&1&&(Es(0,"ds-tag",20),AC(1,"Connected"),hl());}function ae(i,t){i&1&&(Es(0,"ds-tag",18),AC(1,"Not connected"),hl());}function se(i,t){i&1&&(Es(0,"span",21),AC(1,"\u2014"),hl());}function re(i,t){if(i&1){let e=Qw();Es(0,"span",26),AC(1,"Waiting for authorization\u2026"),hl(),Es(2,"button",27),vg("click",function(){pf(e);let r=tC(4);return hf(r.cancelConnect())}),AC(3," Cancel "),hl();}if(i&2){let e=tC(2).$implicit;VE(2),lg("aria-label","Stop waiting for the authorization of "+e.config.name);}}function le(i,t){if(i&1){let e=Qw();Es(0,"span",28),AC(1,"Disconnect?"),hl(),Es(2,"button",29),vg("click",function(){pf(e);let r=tC(2).$implicit,d=tC(2);return hf(d.confirmReset(r))}),AC(3),hl(),Es(4,"button",29),vg("click",function(){pf(e);let r=tC(4);return hf(r.cancelReset())}),AC(5," Cancel "),hl();}if(i&2){let e=tC(2).$implicit,n=tC(2);VE(2),dg("disabled",n.resettingKey()===e.key),lg("aria-label","Confirm disconnecting "+e.config.name),VE(),Dl(" ",n.resettingKey()===e.key?"Disconnecting\u2026":"Confirm"," "),VE(),dg("disabled",n.resettingKey()===e.key),lg("aria-label","Cancel disconnecting "+e.config.name);}}function ce(i,t){if(i&1){let e=Qw();Es(0,"button",29),vg("click",function(){pf(e);let r=tC(3).$implicit,d=tC(2);return hf(d.requestReset(r))}),AC(1," Disconnect "),hl();}if(i&2){let e=tC(3).$implicit,n=tC(2);dg("disabled",n.connectingKey()!==null),lg("aria-label","Disconnect "+e.config.name);}}function de(i,t){if(i&1){let e=Qw();Es(0,"button",29),vg("click",function(){pf(e);let r=tC(2).$implicit,d=tC(2);return hf(d.connect(r))}),AC(1),hl(),Bw(2,ce,2,2,"button",30);}if(i&2){let e=tC(2).$implicit,n=tC(2);dg("disabled",n.connectingKey()!==null||n.resettingKey()!==null),lg("aria-label",(n.connectionOf(e)==="connected"?"Reconnect ":"Connect ")+e.config.name),VE(),Dl(" ",n.connectionOf(e)==="connected"?"Reconnect":"Connect"," "),VE(),Vw(n.connectionOf(e)==="connected"?2:-1);}}function pe(i,t){if(i&1&&Bw(0,re,4,1)(1,le,6,5)(2,de,3,4),i&2){let e=tC().$implicit,n=tC(2);Vw(n.connectingKey()===e.key?0:n.resetConfirmingKey()===e.key?1:n.deletion.confirmingId()!==e.key?2:-1);}}function ue(i,t){if(i&1){let e=Qw();Es(0,"button",27),vg("click",function(){pf(e);let r=tC().$implicit,d=tC(2);return hf(d.duplicate(r))}),AC(1," Duplicate "),hl();}if(i&2){let e=tC().$implicit;lg("aria-label","Duplicate "+e.config.name);}}function _e(i,t){if(i&1){let e=Qw();Es(0,"button",27),vg("click",function(){pf(e);let r=tC(2).$implicit,d=tC(2);return hf(d.edit(r))}),AC(1," Edit "),hl();}if(i&2){let e=tC(2).$implicit;lg("aria-label","Edit "+e.config.name);}}function me(i,t){if(i&1){let e=Qw();Bw(0,_e,2,1,"button",24),Es(1,"agentos-row-delete-action",31),vg("deleteRequested",function(){pf(e);let r=tC().$implicit,d=tC(2);return hf(d.deletion.request(r.key))})("deleteConfirmed",function(){pf(e);let r=tC().$implicit,d=tC(2);return hf(d.confirmDelete(r))})("deleteCancelled",function(){pf(e);let r=tC(3);return hf(r.deletion.cancel())}),hl();}if(i&2){let e=tC().$implicit,n=tC(2);Vw(n.deletion.confirmingId()!==e.key?0:-1),VE(),dg("rowKey",e.key)("rowLabel",e.config.name)("state",n.deletion);}}function ge(i,t){i&1&&(Es(0,"button",25),AC(1,"Inherited"),hl());}function he(i,t){if(i&1&&(Es(0,"tr",10)(1,"td",13),AC(2),hl(),Es(3,"td",14),AC(4),hl(),Es(5,"td",15)(6,"div",16)(7,"ds-tag",17),AC(8),hl(),Bw(9,ie,2,0,"ds-tag",18),hl()(),Es(10,"td",19),Bw(11,oe,2,0,"ds-tag",20)(12,ae,2,0,"ds-tag",18)(13,se,2,0,"span",21),hl(),Es(14,"td",22)(15,"div",23),Bw(16,pe,3,1),Bw(17,ue,2,1,"button",24),Bw(18,me,2,4)(19,ge,2,0,"button",25),hl()()()),i&2){let e=t.$implicit,n=tC(2);VE(2),Fg(e.config.name),VE(2),Dl(" ",e.config.authType," "),VE(3),dg("variant",e.scopeLabel==="Platform"?"neutral":e.scopeLabel==="Personal"?"outline":"accent"),VE(),Fg(e.scopeLabel),VE(),Vw(e.canMutate?-1:9),VE(2),Vw(n.isOAuth(e)&&n.connectionOf(e)==="connected"?11:n.isOAuth(e)&&n.connectionOf(e)==="disconnected"?12:13),VE(5),Vw(n.isOAuth(e)?16:-1),VE(),Vw(n.deletion.confirmingId()!==e.key&&n.resetConfirmingKey()!==e.key&&n.connectingKey()!==e.key?17:-1),VE(),Vw(e.canMutate?18:19);}}function Ce(i,t){if(i&1&&(Es(0,"div",7)(1,"table",8)(2,"thead",9)(3,"tr",10)(4,"th",11),AC(5,"Name"),hl(),Es(6,"th",11),AC(7,"Authentication type"),hl(),Es(8,"th",11),AC(9,"Scope"),hl(),Es(10,"th",11),AC(11,"Connection"),hl(),Es(12,"th",11)(13,"span",12),AC(14,"Actions"),hl()()()(),Es(15,"tbody",9),$w(16,he,20,9,"tr",10,Q),hl()()()),i&2){let e=tC();VE(16),zw(e.rowFilter.filteredRows());}}var fe=new Set(["OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"]),J=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=$i(false);isLoading=$i(true);rows=$i([]);deletion=k();connections=$i({});connectingKey=$i(null);resetConfirmingKey=$i(null);resettingKey=$i(null);actionMessage=$i(null);connectAttempt=null;connectPopup=null;connectionsLoad=null;rowFilter=O(this.rows,t=>[t.config.name,t.config.authType,t.scopeLabel].join(" "));ngOnInit(){this.route.paramMap.pipe(U(this.destroyRef)).subscribe(t=>{let e=t.get("namespaceId")??"";e&&e!==this.namespaceId&&(this.namespaceId=e),this.state.setNamespace(e);}),this.route.paramMap.pipe(ne$1(t=>t.get("namespaceId")??""),ga(t=>t?this.namespaceRole.isAdminOfNamespace$(t):br(false)),U(this.destroyRef)).subscribe(t=>this.isAdmin.set(t)),this.state.vm$.pipe(U(this.destroyRef)).subscribe({next:t=>{this.rows.set(this.toRows(t)),this.isLoading.set(false),this.loadConnections();},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:n(this.isAdmin())}});}edit(t){!t.canMutate||!t.config.id||this.router.navigate(["/agentos",this.namespaceId,"auth-settings",t.config.id,"edit"],{queryParams:{scope:t.scope}});}confirmDelete(t){!t.canMutate||!t.config.id||this.deletion.execute(t.key,{request$:this.state.delete(t.config.id,t.scope).pipe(U(this.destroyRef)),errorMessage:`Deleting "${t.config.name}" failed. Try again.`});}isOAuth(t){return fe.has(t.config.authType)}connectionOf(t){return this.connections()[t.key]??"unknown"}connect(t){let e=t.config.id;if(!e||this.connectingKey()||this.resettingKey())return;let n=w();if(!n){this.actionMessage.set({kind:"error",text:"The browser blocked the authorization window. Allow pop-ups for this site and try again."});return}this.actionMessage.set(null),this.resetConfirmingKey.set(null),this.connectPopup=n,this.connectingKey.set(t.key),this.connectAttempt=this.state.connect(e,this.namespaceParam(),r=>n.location.href=r,()=>n.closed).pipe(ui(()=>{this.connectingKey.set(null),this.connectAttempt=null,this.connectPopup=null;}),U(this.destroyRef)).subscribe({next:r=>this.onConnectOutcome(t,r,n),error:()=>{n.close(),this.actionMessage.set({kind:"error",text:`Connecting "${t.config.name}" failed. Check that its OAuth settings are complete, then try again.`});}});}cancelConnect(){this.connectAttempt?.unsubscribe(),this.connectPopup?.close();}requestReset(t){this.resettingKey()||this.connectingKey()||(this.actionMessage.set(null),this.resetConfirmingKey.set(t.key));}cancelReset(){this.resettingKey()||this.resetConfirmingKey.set(null);}confirmReset(t){let e=t.config.id;!e||this.resettingKey()||this.resetConfirmingKey()!==t.key||(this.resettingKey.set(t.key),this.state.resetCredential(e,this.namespaceParam()).pipe(U(this.destroyRef)).subscribe({next:()=>{this.resettingKey.set(null),this.resetConfirmingKey.set(null),this.loadConnections();},error:()=>{this.resettingKey.set(null),this.actionMessage.set({kind:"error",text:`Disconnecting "${t.config.name}" failed. Try again.`});}}));}duplicate(t){if(!t.config.id)return;let e=t.scope==="platform"||t.scope==="namespace"&&!this.isAdmin()?"userOnNs":t.scope;this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:e,template:t.config.id,templateScope:t.scope}});}onConnectOutcome(t,e,n){n.close(),this.loadConnections(),e==="abandoned"?this.actionMessage.set({kind:"info",text:`The authorization window was closed before "${t.config.name}" got connected.`}):e==="timeout"&&this.actionMessage.set({kind:"info",text:`No authorization was received for "${t.config.name}" in time. Try again.`});}namespaceParam(){return this.namespaceId||void 0}loadConnections(){this.connectionsLoad?.unsubscribe();let t=this.rows().filter(e=>this.isOAuth(e)&&e.config.id).map(e=>this.state.getConnection(e.config.id,this.namespaceParam()).pipe(ne$1(n=>[e.key,n.connected?"connected":"disconnected"]),ha(()=>br([e.key,"unknown"]))));if(t.length===0){this.connections.set({});return}this.connectionsLoad=by(t).pipe(U(this.destroyRef)).subscribe(e=>this.connections.set(Object.fromEntries(e)));}toRows(t){return [...this.mapScope(t.platform,"platform","Platform",false),...this.mapScope(t.namespace,"namespace","Namespace",this.isAdmin()),...this.mapScope(t.userOnNs,"userOnNs","Personal",true),...this.mapScope(t.userGlobal,"userGlobal","Personal",true)]}mapScope(t,e,n,r){return t.map((d,Y)=>({key:`${e}:${d.id??Y}`,config:d,scope:e,scopeLabel:n,canMutate:r}))}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=Dw({type:i,selectors:[["agentos-auth-settings-all-scopes"]],decls:10,vars:4,consts:[["title","Auth settings","description","Authentication settings available in this namespace, including inherited platform and personal entries."],["label","Filter auth settings","placeholder","Filter auth settings\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],[3,"class"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Auth settings"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Authentication type",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Connection"],["variant","accent"],[1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["type","button","disabled",""],["role","status",1,"settings-table__confirm-label"],["type","button",3,"click"],[1,"settings-table__confirm-label"],["type","button",3,"click","disabled"],["type","button",3,"disabled"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(e,n){if(e&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(d){return n.rowFilter.query.set(d)}),hl(),Es(2,"button",2),vg("click",function(){return n.openCreateForm()}),AC(3,"New auth setting"),hl()(),Bw(4,X,2,1,"p",3),Bw(5,Z,2,4,"p",4),Bw(6,ee,2,0,"p",5)(7,te,2,0,"p",6)(8,ne,2,0,"p",5)(9,Ce,18,0,"div",7)),e&2){let r;VE(),dg("query",n.rowFilter.query()),VE(3),Vw(n.deletion.error()?4:-1),VE(),Vw((r=n.actionMessage())?5:-1,r),VE(),Vw(n.isLoading()?6:n.rows().length===0?7:n.rowFilter.filteredRows().length===0?8:9);}},dependencies:[at,fn,ko,Fo,P,P$1],encapsulation:2})};export{J as AuthSettingsAllScopesComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {c}from'./chunk-
|
|
1
|
+
import {c}from'./chunk-DQJE-N1a.js';import {z as k,j as O$1,e as at,c as fn,k as ko,l as Fo,P,B as P$1}from'./chunk-7jUvxE8F.js';import {g,t as F,K as we,$ as $i,U as U$1,ai as ke,al as We,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,w as pf,x as hf,n as lg}from'./main-VAVXYALE.js';var M=(n,t)=>t.id??t.name;function U(n,t){if(n&1&&(Es(0,"p",3),AC(1),hl()),n&2){let e=tC();VE(),Fg(e.deletion.error());}}function B(n,t){n&1&&(Es(0,"p",4),AC(1,"Loading scheduled prompts\u2026"),hl());}function j(n,t){n&1&&(Es(0,"p",5),AC(1,"No platform scheduled prompts defined yet."),hl());}function W(n,t){n&1&&(Es(0,"p",4),AC(1,"No scheduled prompts match the current filter."),hl());}function H(n,t){if(n&1&&(Es(0,"span",14),AC(1),hl()),n&2){let e=tC().$implicit;VE(),Fg(e.description);}}function O(n,t){if(n&1){let e=Qw();Es(0,"button",21),vg("click",function(){pf(e);let s=tC().$implicit,c=tC(2);return hf(c.toggle(s))}),AC(1),hl(),Es(2,"button",21),vg("click",function(){pf(e);let s=tC().$implicit,c=tC(2);return hf(c.edit(s))}),AC(3,"Edit"),hl();}if(n&2){let e=tC().$implicit;VE(),Fg(e.enabled?"Disable":"Enable"),VE(),lg("aria-label","Edit "+e.name);}}function Y(n,t){if(n&1){let e=Qw();Es(0,"agentos-row-delete-action",22),vg("deleteRequested",function(){pf(e);let s=tC().$implicit,c=tC(2);return hf(c.deletion.request(s.id))})("deleteConfirmed",function(){pf(e);let s=tC().$implicit,c=tC(2);return hf(c.confirmDelete(s))})("deleteCancelled",function(){pf(e);let s=tC(3);return hf(s.deletion.cancel())}),hl();}if(n&2){let e=tC().$implicit,i=tC(2);dg("rowKey",e.id)("rowLabel",e.name)("state",i.deletion);}}function z(n,t){if(n&1&&(Es(0,"tr",9)(1,"td",12)(2,"span",13),AC(3),hl(),Bw(4,H,2,1,"span",14),hl(),Es(5,"td",15),AC(6),hl(),Es(7,"td",16)(8,"ds-tag",17),AC(9),hl()(),Es(10,"td",18)(11,"div",19),Bw(12,O,4,2),Bw(13,Y,1,3,"agentos-row-delete-action",20),hl()()()),n&2){let e=t.$implicit,i=tC(2);VE(3),Fg(e.name),VE(),Vw(e.description?4:-1),VE(2),Fg(i.scheduleLabel(e)),VE(2),dg("variant",e.enabled?"accent":"outline"),VE(),Fg(e.enabled?"Enabled":"Disabled"),VE(3),Vw(i.deletion.confirmingId()!==e.id?12:-1),VE(),Vw(e.id?13:-1);}}function G(n,t){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,"Schedule"),hl(),Es(8,"th",10),AC(9,"Status"),hl(),Es(10,"th",10)(11,"span",11),AC(12,"Actions"),hl()()()(),Es(13,"tbody",8),$w(14,z,14,7,"tr",9,M),hl()()()),n&2){let e=tC();VE(14),zw(e.rowFilter.filteredRows());}}var A=class n{router=g(F);destroyRef=g(we);state=g(c);prompts=$i([]);isLoading=$i(true);deletion=k();rowFilter=O$1(this.prompts,t=>[t.name,t.description,this.scheduleLabel(t),t.enabled?"Enabled":"Disabled"].filter(Boolean).join(" "));constructor(){this.state.listPlatform().pipe(U$1(this.destroyRef)).subscribe({next:t=>{this.prompts.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}scheduleLabel(t){let{recurrence:e}=t,i=e.unit===ke.WEEK?"week":"month",s=e.unit===ke.WEEK&&e.days?.length?` (${e.days.map(c=>We[c]??c).join(", ")})`:"";return `Every ${i}${s} at ${e.timeUtc} UTC`}openCreateForm(){this.router.navigate(["/agentos","admin","scheduled-prompts","new"]);}edit(t){t.id&&this.router.navigate(["/agentos","admin","scheduled-prompts",t.id,"edit"]);}toggle(t){(t.enabled?this.state.disable(t.id??""):this.state.enable(t.id??"")).pipe(U$1(this.destroyRef)).subscribe(i=>this.patchPrompt(i));}confirmDelete(t){if(!t.id)return;let e=t.id;this.deletion.execute(e,{request$:this.state.delete(e).pipe(U$1(this.destroyRef)),onSuccess:()=>this.prompts.update(i=>i.filter(s=>s.id!==e)),errorMessage:`Deleting "${t.name}" failed. Try again.`});}patchPrompt(t){this.prompts.update(e=>e.map(i=>i.id===t.id?t:i));}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Dw({type:n,selectors:[["agentos-platform-scheduled-prompts"]],decls:9,vars:3,consts:[["title","Platform scheduled prompts","description","Scheduled prompts shared across every namespace."],["label","Filter scheduled prompts","placeholder","Filter scheduled prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform scheduled prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Schedule"],["role","cell","data-label","Status"],[3,"variant"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(e,i){e&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return i.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return i.openCreateForm()}),AC(3,"New scheduled prompt"),hl()(),Bw(4,U,2,1,"p",3),Bw(5,B,2,0,"p",4)(6,j,2,0,"p",5)(7,W,2,0,"p",4)(8,G,16,0,"div",6)),e&2&&(VE(),dg("query",i.rowFilter.query()),VE(3),Vw(i.deletion.error()?4:-1),VE(),Vw(i.isLoading()?5:i.prompts().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,fn,ko,Fo,P,P$1],encapsulation:2})};export{A as PlatformScheduledPromptsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {p as pt,T as Te,g as gn,b as hn,c as fn,u as un,o as dn,d as cn,e as at,i as sn,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,Y as Yr,A as An,O as On,w as wa}from'./chunk-qAO_WS2x.js';import {g,W,t as F,K as we,aq as k,ap as F$1,a9 as F$2,a2 as ha,aa as br,ar as Ne,o as oT,$ as $i,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,f as fg,S as NI,q as $w,ao as Uw,v as tC,T as AI,z as zw,u as Dl,ae as Lw,F as Fg,as as Pg,w as pf,x as hf}from'./main-VSQLTBR6.js';function he(r,t){r&1&&(Es(0,"p",2),AC(1,"Loading\u2026"),hl());}function ve(r,t){if(r&1&&fg(0,"input",6),r&2){let e=tC(2);dg("value",e.selectedProviderLabel());}}function ye(r,t){if(r&1&&(Es(0,"option",44),AC(1),hl()),r&2){let e=t.$implicit;dg("value",e.id),VE(),Pg("",e.name," (",e.apiType,")");}}function be(r,t){if(r&1&&(Es(0,"select",7)(1,"option",43),AC(2,"Select provider"),hl(),$w(3,ye,2,3,"option",44,Lw().trackByProvider,true),hl(),NI()),r&2){let e=tC(2);dg("formControl",e.aiProviderIdControl),AI(),VE(3),zw(e.providers());}}function xe(r,t){if(r&1&&(Es(0,"option",25),AC(1),hl()),r&2){let e=t.$implicit;dg("ngValue",e),VE(),Fg(e.toLowerCase());}}function _e(r,t){r&1&&(Es(0,"p",2),AC(1,"Not supported yet for Anthropic and Gemini providers."),hl());}function Me(r,t){r&1&&(Es(0,"p",2),AC(1," Sent as is to OpenAI-compatible providers, which reject levels the model does not support. Through Requesty, Claude models do not apply it faithfully. "),hl());}function Ee(r,t){r&1&&(Es(0,"p",26),AC(1," OpenAI reasoning models (GPT-5.1 and later) reject a temperature other than 1 with an effort: leave Temperature empty or set it to 1. "),hl());}function Ae(r,t){if(r&1){let e=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let u=tC();return hf(u.submit())}),Es(1,"ds-form-field",5),Bw(2,ve,1,1,"input",6)(3,be,5,1,"select",7),hl(),Es(4,"ds-form-field",8),fg(5,"input",9),NI(),hl(),Es(6,"ds-form-field",10),fg(7,"input",11),NI(),hl(),Es(8,"ds-form-field",12),fg(9,"input",13),NI(),hl(),Es(10,"ds-form-field",14),fg(11,"input",15),NI(),hl(),Es(12,"div",16)(13,"ds-form-field",17),fg(14,"input",18),NI(),hl(),Es(15,"ds-form-field",19),fg(16,"input",20),NI(),hl()(),Es(17,"ds-form-field",21),fg(18,"input",22),NI(),hl(),Es(19,"ds-form-field",23)(20,"select",24)(21,"option",25),AC(22,"Provider default"),hl(),$w(23,xe,2,2,"option",25,Uw),hl(),NI(),Bw(25,_e,2,0,"p",2)(26,Me,2,0,"p",2),Bw(27,Ee,2,0,"p",26),hl(),Es(28,"div",27)(29,"label",28),fg(30,"input",29),NI(),Es(31,"span",30),AC(32,"Supports advanced execution"),hl()(),Es(33,"p",31),AC(34," Agents configured in ADVANCED execution mode fail to run on a model that does not support it. SIMPLE agents are not concerned. "),hl()(),Es(35,"ds-fieldset",32)(36,"div",16)(37,"ds-form-field",33),fg(38,"input",34),NI(),hl(),Es(39,"ds-form-field",35),fg(40,"input",36),NI(),hl()(),Es(41,"div",16)(42,"ds-form-field",37),fg(43,"input",38),NI(),hl(),Es(44,"ds-form-field",39),fg(45,"input",40),NI(),hl()()(),Es(46,"ds-form-actions")(47,"button",41),AC(48),hl(),Es(49,"button",42),vg("click",function(){pf(e);let u=tC();return hf(u.cancel())}),AC(50,"Cancel"),hl()()();}if(r&2){let e=tC();dg("formGroup",e.form),VE(2),Vw(e.isEditMode()?2:3),VE(3),dg("formControl",e.apiModelNameControl),AI(),VE(2),dg("formControl",e.descriptionControl),AI(),VE(2),dg("formControl",e.aliasControl),AI(),VE(2),dg("formControl",e.priorityControl),AI(),VE(3),dg("formControl",e.temperatureControl),AI(),VE(2),dg("formControl",e.contextWindowControl),AI(),VE(2),dg("formControl",e.maxCompletionTokensControl),AI(),VE(2),dg("formControl",e.reasoningEffortControl),AI(),VE(),dg("ngValue",null),VE(2),zw(e.reasoningEffortOptions),VE(2),Vw(e.reasoningEffortUnsupported()?25:26),VE(2),Vw(e.temperatureMayConflictWithEffort()?27:-1),VE(3),dg("formControl",e.supportsAdvancedExecutionControl),AI(),VE(5),dg("formGroup",e.pricingGroup),VE(3),AI(),VE(2),AI(),VE(3),AI(),VE(2),AI(),VE(2),dg("disabled",e.form.invalid||e.isSubmitting()),VE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var Ie=["Anthropic","Gemini"],ge=class r{route=g(W);router=g(F);destroyRef=g(we);aiModelController=g(k);aiProviderController=g(F$1);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;providers=F$2(this.aiProviderController.listAiProvider(this.isPlatformMode?"none":this.namespaceId).pipe(ha(()=>br([]))),{initialValue:[]});form=new pt({aiProviderId:new Te("",{nonNullable:true,validators:[gn.required]}),apiModelName:new Te("",{nonNullable:true,validators:[gn.required,gn.minLength(1)]}),description:new Te(null),alias:new Te("",{nonNullable:true}),priority:new Te(0,{nonNullable:true}),temperature:new Te(null),contextWindow:new Te(null),maxCompletionTokens:new Te(null),reasoningEffort:new Te(null),supportsAdvancedExecution:new Te(false,{nonNullable:true}),pricing:new pt({inputMTokens:new Te(null),outputMTokens:new Te(null),cacheWrite:new Te(null),cacheRead:new Te(null)})});get aiProviderIdControl(){return this.form.controls.aiProviderId}get apiModelNameControl(){return this.form.controls.apiModelName}get descriptionControl(){return this.form.controls.description}get aliasControl(){return this.form.controls.alias}get priorityControl(){return this.form.controls.priority}get temperatureControl(){return this.form.controls.temperature}get contextWindowControl(){return this.form.controls.contextWindow}get maxCompletionTokensControl(){return this.form.controls.maxCompletionTokens}get reasoningEffortControl(){return this.form.controls.reasoningEffort}get supportsAdvancedExecutionControl(){return this.form.controls.supportsAdvancedExecution}get pricingGroup(){return this.form.controls.pricing}reasoningEffortOptions=Object.values(Ne);selectedProviderId=F$2(this.form.controls.aiProviderId.valueChanges,{initialValue:this.form.controls.aiProviderId.value});reasoningEffortUnsupported=oT(()=>{let t=this.providers().find(e=>e.id===this.selectedProviderId())?.apiType;return t!==void 0&&Ie.includes(t)});temperatureValue=F$2(this.form.controls.temperature.valueChanges,{initialValue:this.form.controls.temperature.value});reasoningEffortValue=F$2(this.form.controls.reasoningEffort.valueChanges,{initialValue:this.form.controls.reasoningEffort.value});temperatureMayConflictWithEffort=oT(()=>{let t=this.temperatureValue();return this.reasoningEffortValue()!=null&&t!=null&&t!==1});isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);selectedProviderLabel=oT(()=>{let t=this.aiProviderIdControl.value,e=this.providers().find(c=>c.id===t);return e?`${e.name} (${e.apiType})`:t});existingModel=null;constructor(){Of(()=>{this.reasoningEffortUnsupported()?(this.reasoningEffortControl.setValue(null),this.reasoningEffortControl.disable()):this.reasoningEffortControl.enable();});}ngOnInit(){let t=this.route.snapshot.paramMap.get("modelId");t&&(this.isEditMode.set(true),this.loadModel(t));}loadModel(t){this.isLoading.set(true),this.aiModelController.getByIdAiModel(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingModel=e,this.aiProviderIdControl.setValue(e.aiProviderId),this.aiProviderIdControl.disable(),this.apiModelNameControl.setValue(e.apiModelName),this.descriptionControl.setValue(e.description??null),this.aliasControl.setValue(e.alias??""),this.priorityControl.setValue(e.priority??0),this.temperatureControl.setValue(e.temperature??null),this.contextWindowControl.setValue(e.contextWindow??null),this.maxCompletionTokensControl.setValue(e.maxCompletionTokens??null),this.reasoningEffortControl.setValue(e.reasoningEffort??null),this.supportsAdvancedExecutionControl.setValue(e.supportsAdvancedExecution??false),this.pricingGroup.setValue({inputMTokens:e.pricing?.inputMTokens??null,outputMTokens:e.pricing?.outputMTokens??null,cacheWrite:e.pricing?.cacheWrite??null,cacheRead:e.pricing?.cacheRead??null}),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.form.getRawValue(),e=t.pricing,u=e.inputMTokens!=null||e.outputMTokens!=null||e.cacheWrite!=null||e.cacheRead!=null?{isEmpty:false,inputMTokens:e.inputMTokens??void 0,outputMTokens:e.outputMTokens??void 0,cacheWrite:e.cacheWrite??void 0,cacheRead:e.cacheRead??void 0}:void 0,w$1=x(w({},this.existingModel??{}),{aiProviderId:t.aiProviderId,namespaceId:this.isPlatformMode?void 0:this.existingModel?.namespaceId??this.namespaceId,apiModelName:t.apiModelName.trim(),description:t.description?.trim()||void 0,alias:t.alias.trim()||void 0,priority:t.priority,temperature:t.temperature??void 0,contextWindow:t.contextWindow??void 0,maxCompletionTokens:t.maxCompletionTokens??void 0,reasoningEffort:t.reasoningEffort??void 0,supportsAdvancedExecution:t.supportsAdvancedExecution,pricing:u});(this.isEditMode()?this.aiModelController.updateAiModel(this.existingModel.id??"",w$1):this.aiModelController.createAiModel(w$1)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-models"]):this.router.navigate(["/agentos",this.namespaceId,"ai-models"]);}trackByProvider(t,e){return e.id??""}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=Dw({type:r,selectors:[["agentos-ai-model-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to AI models",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Provider","controlId","model-provider","required",""],["dsControl","","id","model-provider","type","text","readonly","","tabindex","-1",3,"value"],["dsControl","","id","model-provider",3,"formControl"],["label","API name","controlId","model-api-name","required",""],["dsControl","","mono","","id","model-api-name","type","text","placeholder","e.g. gpt-4o, claude-3-5-sonnet-20241022","autocomplete","off",3,"formControl"],["label","Description","controlId","model-description"],["dsControl","","id","model-description","type","text","placeholder","Optional \u2014 short description of this model config","autocomplete","off",3,"formControl"],["label","Alias","controlId","model-alias"],["dsControl","","id","model-alias","type","text","placeholder","e.g. fast, smart \u2014 short identifier used internally","autocomplete","off",3,"formControl"],["label","Priority","controlId","model-priority"],["dsControl","","id","model-priority","type","number","placeholder","0 \u2014 higher wins when multiple configs share the same alias","min","0","step","1",3,"formControl"],[1,"ds-grid-2"],["label","Temperature","controlId","model-temperature"],["dsControl","","id","model-temperature","type","number","placeholder","0 \u2013 2","min","0","max","2","step","0.1",3,"formControl"],["label","Context window","controlId","model-context-window"],["dsControl","","id","model-context-window","type","number","placeholder","e.g. 128000","min","1","step","1",3,"formControl"],["label","Max completion tokens","controlId","model-max-completion-tokens"],["dsControl","","id","model-max-completion-tokens","type","number","placeholder","e.g. 4096","min","1","step","1",3,"formControl"],["label","Reasoning effort","controlId","model-reasoning-effort"],["dsControl","","id","model-reasoning-effort",3,"formControl"],[3,"ngValue"],[1,"ds-hint","ds-hint--warning"],[1,"ai-model-form__field"],[1,"ai-model-form__toggle-label"],["type","checkbox",1,"ai-model-form__toggle-checkbox",3,"formControl"],[1,"ai-model-form__toggle-text"],[1,"ai-model-form__toggle-hint"],["legend","Pricing","legendHint","per million tokens \u2014 leave blank to skip cost monitoring",3,"formGroup"],["label","Input","controlId","pricing-input"],["dsControl","","id","pricing-input","type","number","placeholder","e.g. 2.50","min","0","step","0.01","formControlName","inputMTokens"],["label","Output","controlId","pricing-output"],["dsControl","","id","pricing-output","type","number","placeholder","e.g. 10.00","min","0","step","0.01","formControlName","outputMTokens"],["label","Cache write","controlId","pricing-cache-write"],["dsControl","","id","pricing-cache-write","type","number","placeholder","e.g. 3.75","min","0","step","0.01","formControlName","cacheWrite"],["label","Cache read","controlId","pricing-cache-read"],["dsControl","","id","pricing-cache-read","type","number","placeholder","e.g. 0.30","min","0","step","0.01","formControlName","cacheRead"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["value","","disabled",""],[3,"value"]],template:function(e,c){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return c.cancel()}),AC(3," \u2190 AI models "),hl()(),Bw(4,he,2,0,"p",2)(5,Ae,51,17,"form",3),hl()),e&2&&(VE(),dg("title",c.isEditMode()?"Edit AI model":"New AI model"),VE(3),Vw(c.isLoading()?4:5));},dependencies:[hn,fn,un,dn,cn,at,sn,qt,md,Co,Mo,Ht,Fn,yn,Ut,po,ho,Zr,Yr,An,On,wa],encapsulation:2})};export{ge as AiModelFormComponent};
|
|
1
|
+
import {p as pt,T as Te,g as gn,b as hn,c as fn,u as un,o as dn,d as cn,e as at,i as sn,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,Y as Yr,A as An,O as On,w as wa}from'./chunk-7jUvxE8F.js';import {g,W,t as F,K as we,aq as k,ap as F$1,a9 as F$2,a2 as ha,aa as br,ar as Ne,o as oT,$ as $i,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,f as fg,S as NI,q as $w,ao as Uw,v as tC,T as AI,z as zw,u as Dl,ae as Lw,F as Fg,as as Pg,w as pf,x as hf}from'./main-VAVXYALE.js';function he(r,t){r&1&&(Es(0,"p",2),AC(1,"Loading\u2026"),hl());}function ve(r,t){if(r&1&&fg(0,"input",6),r&2){let e=tC(2);dg("value",e.selectedProviderLabel());}}function ye(r,t){if(r&1&&(Es(0,"option",44),AC(1),hl()),r&2){let e=t.$implicit;dg("value",e.id),VE(),Pg("",e.name," (",e.apiType,")");}}function be(r,t){if(r&1&&(Es(0,"select",7)(1,"option",43),AC(2,"Select provider"),hl(),$w(3,ye,2,3,"option",44,Lw().trackByProvider,true),hl(),NI()),r&2){let e=tC(2);dg("formControl",e.aiProviderIdControl),AI(),VE(3),zw(e.providers());}}function xe(r,t){if(r&1&&(Es(0,"option",25),AC(1),hl()),r&2){let e=t.$implicit;dg("ngValue",e),VE(),Fg(e.toLowerCase());}}function _e(r,t){r&1&&(Es(0,"p",2),AC(1,"Not supported yet for Anthropic and Gemini providers."),hl());}function Me(r,t){r&1&&(Es(0,"p",2),AC(1," Sent as is to OpenAI-compatible providers, which reject levels the model does not support. Through Requesty, Claude models do not apply it faithfully. "),hl());}function Ee(r,t){r&1&&(Es(0,"p",26),AC(1," OpenAI reasoning models (GPT-5.1 and later) reject a temperature other than 1 with an effort: leave Temperature empty or set it to 1. "),hl());}function Ae(r,t){if(r&1){let e=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let u=tC();return hf(u.submit())}),Es(1,"ds-form-field",5),Bw(2,ve,1,1,"input",6)(3,be,5,1,"select",7),hl(),Es(4,"ds-form-field",8),fg(5,"input",9),NI(),hl(),Es(6,"ds-form-field",10),fg(7,"input",11),NI(),hl(),Es(8,"ds-form-field",12),fg(9,"input",13),NI(),hl(),Es(10,"ds-form-field",14),fg(11,"input",15),NI(),hl(),Es(12,"div",16)(13,"ds-form-field",17),fg(14,"input",18),NI(),hl(),Es(15,"ds-form-field",19),fg(16,"input",20),NI(),hl()(),Es(17,"ds-form-field",21),fg(18,"input",22),NI(),hl(),Es(19,"ds-form-field",23)(20,"select",24)(21,"option",25),AC(22,"Provider default"),hl(),$w(23,xe,2,2,"option",25,Uw),hl(),NI(),Bw(25,_e,2,0,"p",2)(26,Me,2,0,"p",2),Bw(27,Ee,2,0,"p",26),hl(),Es(28,"div",27)(29,"label",28),fg(30,"input",29),NI(),Es(31,"span",30),AC(32,"Supports advanced execution"),hl()(),Es(33,"p",31),AC(34," Agents configured in ADVANCED execution mode fail to run on a model that does not support it. SIMPLE agents are not concerned. "),hl()(),Es(35,"ds-fieldset",32)(36,"div",16)(37,"ds-form-field",33),fg(38,"input",34),NI(),hl(),Es(39,"ds-form-field",35),fg(40,"input",36),NI(),hl()(),Es(41,"div",16)(42,"ds-form-field",37),fg(43,"input",38),NI(),hl(),Es(44,"ds-form-field",39),fg(45,"input",40),NI(),hl()()(),Es(46,"ds-form-actions")(47,"button",41),AC(48),hl(),Es(49,"button",42),vg("click",function(){pf(e);let u=tC();return hf(u.cancel())}),AC(50,"Cancel"),hl()()();}if(r&2){let e=tC();dg("formGroup",e.form),VE(2),Vw(e.isEditMode()?2:3),VE(3),dg("formControl",e.apiModelNameControl),AI(),VE(2),dg("formControl",e.descriptionControl),AI(),VE(2),dg("formControl",e.aliasControl),AI(),VE(2),dg("formControl",e.priorityControl),AI(),VE(3),dg("formControl",e.temperatureControl),AI(),VE(2),dg("formControl",e.contextWindowControl),AI(),VE(2),dg("formControl",e.maxCompletionTokensControl),AI(),VE(2),dg("formControl",e.reasoningEffortControl),AI(),VE(),dg("ngValue",null),VE(2),zw(e.reasoningEffortOptions),VE(2),Vw(e.reasoningEffortUnsupported()?25:26),VE(2),Vw(e.temperatureMayConflictWithEffort()?27:-1),VE(3),dg("formControl",e.supportsAdvancedExecutionControl),AI(),VE(5),dg("formGroup",e.pricingGroup),VE(3),AI(),VE(2),AI(),VE(3),AI(),VE(2),AI(),VE(2),dg("disabled",e.form.invalid||e.isSubmitting()),VE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var Ie=["Anthropic","Gemini"],ge=class r{route=g(W);router=g(F);destroyRef=g(we);aiModelController=g(k);aiProviderController=g(F$1);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;providers=F$2(this.aiProviderController.listAiProvider(this.isPlatformMode?"none":this.namespaceId).pipe(ha(()=>br([]))),{initialValue:[]});form=new pt({aiProviderId:new Te("",{nonNullable:true,validators:[gn.required]}),apiModelName:new Te("",{nonNullable:true,validators:[gn.required,gn.minLength(1)]}),description:new Te(null),alias:new Te("",{nonNullable:true}),priority:new Te(0,{nonNullable:true}),temperature:new Te(null),contextWindow:new Te(null),maxCompletionTokens:new Te(null),reasoningEffort:new Te(null),supportsAdvancedExecution:new Te(false,{nonNullable:true}),pricing:new pt({inputMTokens:new Te(null),outputMTokens:new Te(null),cacheWrite:new Te(null),cacheRead:new Te(null)})});get aiProviderIdControl(){return this.form.controls.aiProviderId}get apiModelNameControl(){return this.form.controls.apiModelName}get descriptionControl(){return this.form.controls.description}get aliasControl(){return this.form.controls.alias}get priorityControl(){return this.form.controls.priority}get temperatureControl(){return this.form.controls.temperature}get contextWindowControl(){return this.form.controls.contextWindow}get maxCompletionTokensControl(){return this.form.controls.maxCompletionTokens}get reasoningEffortControl(){return this.form.controls.reasoningEffort}get supportsAdvancedExecutionControl(){return this.form.controls.supportsAdvancedExecution}get pricingGroup(){return this.form.controls.pricing}reasoningEffortOptions=Object.values(Ne);selectedProviderId=F$2(this.form.controls.aiProviderId.valueChanges,{initialValue:this.form.controls.aiProviderId.value});reasoningEffortUnsupported=oT(()=>{let t=this.providers().find(e=>e.id===this.selectedProviderId())?.apiType;return t!==void 0&&Ie.includes(t)});temperatureValue=F$2(this.form.controls.temperature.valueChanges,{initialValue:this.form.controls.temperature.value});reasoningEffortValue=F$2(this.form.controls.reasoningEffort.valueChanges,{initialValue:this.form.controls.reasoningEffort.value});temperatureMayConflictWithEffort=oT(()=>{let t=this.temperatureValue();return this.reasoningEffortValue()!=null&&t!=null&&t!==1});isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);selectedProviderLabel=oT(()=>{let t=this.aiProviderIdControl.value,e=this.providers().find(c=>c.id===t);return e?`${e.name} (${e.apiType})`:t});existingModel=null;constructor(){Of(()=>{this.reasoningEffortUnsupported()?(this.reasoningEffortControl.setValue(null),this.reasoningEffortControl.disable()):this.reasoningEffortControl.enable();});}ngOnInit(){let t=this.route.snapshot.paramMap.get("modelId");t&&(this.isEditMode.set(true),this.loadModel(t));}loadModel(t){this.isLoading.set(true),this.aiModelController.getByIdAiModel(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingModel=e,this.aiProviderIdControl.setValue(e.aiProviderId),this.aiProviderIdControl.disable(),this.apiModelNameControl.setValue(e.apiModelName),this.descriptionControl.setValue(e.description??null),this.aliasControl.setValue(e.alias??""),this.priorityControl.setValue(e.priority??0),this.temperatureControl.setValue(e.temperature??null),this.contextWindowControl.setValue(e.contextWindow??null),this.maxCompletionTokensControl.setValue(e.maxCompletionTokens??null),this.reasoningEffortControl.setValue(e.reasoningEffort??null),this.supportsAdvancedExecutionControl.setValue(e.supportsAdvancedExecution??false),this.pricingGroup.setValue({inputMTokens:e.pricing?.inputMTokens??null,outputMTokens:e.pricing?.outputMTokens??null,cacheWrite:e.pricing?.cacheWrite??null,cacheRead:e.pricing?.cacheRead??null}),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.form.getRawValue(),e=t.pricing,u=e.inputMTokens!=null||e.outputMTokens!=null||e.cacheWrite!=null||e.cacheRead!=null?{isEmpty:false,inputMTokens:e.inputMTokens??void 0,outputMTokens:e.outputMTokens??void 0,cacheWrite:e.cacheWrite??void 0,cacheRead:e.cacheRead??void 0}:void 0,w$1=x(w({},this.existingModel??{}),{aiProviderId:t.aiProviderId,namespaceId:this.isPlatformMode?void 0:this.existingModel?.namespaceId??this.namespaceId,apiModelName:t.apiModelName.trim(),description:t.description?.trim()||void 0,alias:t.alias.trim()||void 0,priority:t.priority,temperature:t.temperature??void 0,contextWindow:t.contextWindow??void 0,maxCompletionTokens:t.maxCompletionTokens??void 0,reasoningEffort:t.reasoningEffort??void 0,supportsAdvancedExecution:t.supportsAdvancedExecution,pricing:u});(this.isEditMode()?this.aiModelController.updateAiModel(this.existingModel.id??"",w$1):this.aiModelController.createAiModel(w$1)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-models"]):this.router.navigate(["/agentos",this.namespaceId,"ai-models"]);}trackByProvider(t,e){return e.id??""}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=Dw({type:r,selectors:[["agentos-ai-model-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to AI models",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Provider","controlId","model-provider","required",""],["dsControl","","id","model-provider","type","text","readonly","","tabindex","-1",3,"value"],["dsControl","","id","model-provider",3,"formControl"],["label","API name","controlId","model-api-name","required",""],["dsControl","","mono","","id","model-api-name","type","text","placeholder","e.g. gpt-4o, claude-3-5-sonnet-20241022","autocomplete","off",3,"formControl"],["label","Description","controlId","model-description"],["dsControl","","id","model-description","type","text","placeholder","Optional \u2014 short description of this model config","autocomplete","off",3,"formControl"],["label","Alias","controlId","model-alias"],["dsControl","","id","model-alias","type","text","placeholder","e.g. fast, smart \u2014 short identifier used internally","autocomplete","off",3,"formControl"],["label","Priority","controlId","model-priority"],["dsControl","","id","model-priority","type","number","placeholder","0 \u2014 higher wins when multiple configs share the same alias","min","0","step","1",3,"formControl"],[1,"ds-grid-2"],["label","Temperature","controlId","model-temperature"],["dsControl","","id","model-temperature","type","number","placeholder","0 \u2013 2","min","0","max","2","step","0.1",3,"formControl"],["label","Context window","controlId","model-context-window"],["dsControl","","id","model-context-window","type","number","placeholder","e.g. 128000","min","1","step","1",3,"formControl"],["label","Max completion tokens","controlId","model-max-completion-tokens"],["dsControl","","id","model-max-completion-tokens","type","number","placeholder","e.g. 4096","min","1","step","1",3,"formControl"],["label","Reasoning effort","controlId","model-reasoning-effort"],["dsControl","","id","model-reasoning-effort",3,"formControl"],[3,"ngValue"],[1,"ds-hint","ds-hint--warning"],[1,"ai-model-form__field"],[1,"ai-model-form__toggle-label"],["type","checkbox",1,"ai-model-form__toggle-checkbox",3,"formControl"],[1,"ai-model-form__toggle-text"],[1,"ai-model-form__toggle-hint"],["legend","Pricing","legendHint","per million tokens \u2014 leave blank to skip cost monitoring",3,"formGroup"],["label","Input","controlId","pricing-input"],["dsControl","","id","pricing-input","type","number","placeholder","e.g. 2.50","min","0","step","0.01","formControlName","inputMTokens"],["label","Output","controlId","pricing-output"],["dsControl","","id","pricing-output","type","number","placeholder","e.g. 10.00","min","0","step","0.01","formControlName","outputMTokens"],["label","Cache write","controlId","pricing-cache-write"],["dsControl","","id","pricing-cache-write","type","number","placeholder","e.g. 3.75","min","0","step","0.01","formControlName","cacheWrite"],["label","Cache read","controlId","pricing-cache-read"],["dsControl","","id","pricing-cache-read","type","number","placeholder","e.g. 0.30","min","0","step","0.01","formControlName","cacheRead"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["value","","disabled",""],[3,"value"]],template:function(e,c){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return c.cancel()}),AC(3," \u2190 AI models "),hl()(),Bw(4,he,2,0,"p",2)(5,Ae,51,17,"form",3),hl()),e&2&&(VE(),dg("title",c.isEditMode()?"Edit AI model":"New AI model"),VE(3),Vw(c.isLoading()?4:5));},dependencies:[hn,fn,un,dn,cn,at,sn,qt,md,Co,Mo,Ht,Fn,yn,Ut,po,ho,Zr,Yr,An,On,wa],encapsulation:2})};export{ge as AiModelFormComponent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {aY as A,aZ as z$1}from'./main-
|
|
1
|
+
import {aY as A,aZ as z$1}from'./main-VAVXYALE.js';var ut=z$1(Xe=>{"use strict";(function(i){var n=/\S/,t=/\"/g,e=/\n/g,r=/\r/g,a=/\\/g,s=/\u2028/,u=/\u2029/;i.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},i.scan=function(h,g){var S=h.length,U=0,R=1,q=2,E=U,$=null,ee=null,B="",I=[],J=!1,O=0,C=0,L="{{",b="}}";function te(){B.length>0&&(I.push({tag:"_t",text:new String(B)}),B="");}function ge(){for(var A=!0,k=C;k<I.length;k++)if(A=i.tags[I[k].tag]<i.tags._v||I[k].tag=="_t"&&I[k].text.match(n)===null,!A)return !1;return A}function be(A,k){if(te(),A&&ge())for(var _=C,ie;_<I.length;_++)I[_].text&&((ie=I[_+1])&&ie.tag==">"&&(ie.indent=I[_].text.toString()),I.splice(_,1));else k||I.push({tag:`
|
|
2
2
|
`});J=!1,C=I.length;}function ne(A,k){var _="="+b,ie=A.indexOf(_,k),De=f(A.substring(A.indexOf("=",k)+1,ie)).split(" ");return L=De[0],b=De[De.length-1],ie+_.length-1}for(g&&(g=g.split(" "),L=g[0],b=g[1]),O=0;O<S;O++)E==U?v(L,h,O)?(--O,te(),E=R):h.charAt(O)==`
|
|
3
3
|
`?be(J):B+=h.charAt(O):E==R?(O+=L.length-1,ee=i.tags[h.charAt(O+1)],$=ee?h.charAt(O+1):"_v",$=="="?(O=ne(h,O),E=U):(ee&&O++,E=q),J=O):v(b,h,O)?(I.push({tag:$,n:f(B),otag:L,ctag:b,i:$=="/"?J-L.length:O+b.length}),B="",O+=b.length-1,E=U,$=="{"&&(b=="}}"?O++:d(I[I.length-1]))):B+=h.charAt(O);return be(J,!0),I};function d(l){l.n.substr(l.n.length-1)==="}"&&(l.n=l.n.substring(0,l.n.length-1));}function f(l){return l.trim?l.trim():l.replace(/^\s*|\s*$/g,"")}function v(l,h,g){if(h.charAt(g)!=l.charAt(0))return !1;for(var S=1,U=l.length;S<U;S++)if(h.charAt(g+S)!=l.charAt(S))return !1;return !0}var y={_t:!0,"\n":!0,$:!0,"/":!0};function o(l,h,g,S){var U=[],R=null,q=null,E=null;for(q=g[g.length-1];l.length>0;){if(E=l.shift(),q&&q.tag=="<"&&!(E.tag in y))throw new Error("Illegal content in < super tag.");if(i.tags[E.tag]<=i.tags.$||c(E,S))g.push(E),E.nodes=o(l,E.tag,g,S);else if(E.tag=="/"){if(g.length===0)throw new Error("Closing tag without opener: /"+E.n);if(R=g.pop(),E.n!=R.n&&!m(E.n,R.n,S))throw new Error("Nesting error: "+R.n+" vs. "+E.n);return R.end=E.i,U}else E.tag==`
|
|
4
4
|
`&&(E.last=l.length==0||l[0].tag==`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {e}from'./chunk-C6dIhkYp.js';import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-
|
|
1
|
+
import {e}from'./chunk-C6dIhkYp.js';import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-CEqneXgA.js';import {O}from'./chunk-CIY43vEB.js';import {g,W as W$1,t as F,K as we,I as J,$ as $i,U as U$1,ad as ne$1,a1 as ga,aa as br,D as Dw,E as Es,R as vg,c as hl,b as AC,a as Bw,P as dg,d as VE,i as Vw,v as tC,F as Fg,q as $w,z as zw,u as Dl,Q as Qw,n as lg,w as pf,x as hf}from'./main-VAVXYALE.js';import {z as k,j as O$1,e as at,c as fn,k as ko,l as Fo,P,B as P$1}from'./chunk-7jUvxE8F.js';import'./chunk-D3iYEK2Q.js';var Q=(n,e)=>e.key;function W(n,e){if(n&1&&(Es(0,"p",3),AC(1),hl()),n&2){let t=tC();VE(),Fg(t.deletion.error());}}function X(n,e){n&1&&(Es(0,"p",4),AC(1,"Loading integrations\u2026"),hl());}function Z(n,e){n&1&&(Es(0,"p",5),AC(1,"No integrations available."),hl());}function ee(n,e){n&1&&(Es(0,"p",4),AC(1,"No integrations match the current filter."),hl());}function te(n,e){n&1&&(Es(0,"ds-tag",20),AC(1,"YAML"),hl(),Es(2,"ds-tag",21),AC(3,"Read-only"),hl());}function ne(n,e){if(n&1){let t=Qw();Es(0,"button",22),vg("click",function(){pf(t);let s=tC().$implicit,c=tC(2);return hf(c.view(s))}),AC(1,"View"),hl();}if(n&2){let t=tC().$implicit;lg("aria-label","View "+t.config.name);}}function ie(n,e){if(n&1){let t=Qw();Es(0,"button",22),vg("click",function(){pf(t);let s=tC(3).$implicit,c=tC(2);return hf(c.edit(s))}),AC(1," Edit "),hl();}if(n&2){let t=tC(3).$implicit;lg("aria-label","Edit "+t.config.name);}}function oe(n,e){if(n&1){let t=Qw();Es(0,"button",22),vg("click",function(){pf(t);let s=tC(2).$implicit,c=tC(2);return hf(c.duplicate(s))}),AC(1," Duplicate "),hl(),Bw(2,ie,2,1,"button",19);}if(n&2){let t=tC(2).$implicit;lg("aria-label","Duplicate "+t.config.name),VE(2),Vw(t.canEdit?2:-1);}}function ae(n,e){if(n&1){let t=Qw();Es(0,"agentos-row-delete-action",25),vg("deleteRequested",function(){pf(t);let s=tC(2).$implicit,c=tC(2);return hf(c.deletion.request(s.key))})("deleteConfirmed",function(){pf(t);let s=tC(2).$implicit,c=tC(2);return hf(c.confirmDelete(s))})("deleteCancelled",function(){pf(t);let s=tC(4);return hf(s.deletion.cancel())}),hl();}if(n&2){let t=tC(2).$implicit,a=tC(2);dg("rowKey",t.key)("rowLabel",t.config.name)("state",a.deletion);}}function re(n,e){n&1&&(Es(0,"button",24),AC(1,"Inherited"),hl());}function le(n,e){if(n&1&&(Bw(0,oe,3,2),Bw(1,ae,1,3,"agentos-row-delete-action",23),Bw(2,re,2,0,"button",24)),n&2){let t=tC().$implicit,a=tC(2);Vw(a.deletion.confirmingId()!==t.key?0:-1),VE(),Vw(t.canDelete?1:-1),VE(),Vw(!t.canEdit&&!t.canDelete?2:-1);}}function se(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)(6,"div",15)(7,"ds-tag",16),AC(8),hl(),Bw(9,te,4,0),hl()(),Es(10,"td",17)(11,"div",18),Bw(12,ne,2,1,"button",19)(13,le,3,3),hl()()()),n&2){let t=e.$implicit;VE(2),Fg(t.config.name),VE(2),Dl(" ",t.config.integrationType," "),VE(3),dg("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),VE(),Dl(" ",t.scopeLabel," "),VE(),Vw(t.source==="FILESYSTEM"?9:-1),VE(3),Vw(t.source==="FILESYSTEM"?12:13);}}function ce(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,"Type"),hl(),Es(8,"th",10),AC(9,"Scope"),hl(),Es(10,"th",10)(11,"span",11),AC(12,"Actions"),hl()()()(),Es(13,"tbody",8),$w(14,se,14,6,"tr",9,Q),hl()()()),n&2){let t=tC();VE(14),zw(t.rowFilter.filteredRows());}}var U=class n$1{route=g(W$1);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceApi=g(J);namespaceId=this.route.snapshot.params.namespaceId;namespaceName=$i("this namespace");isAdmin=$i(false);isLoading=$i(true);rows=$i([]);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")??""),ga(e=>e?this.namespaceRole.isAdminOfNamespace$(e):br(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=Dw({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&&(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 integration"),hl()(),Bw(4,W,2,1,"p",3),Bw(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&&(dg("description","Integrations for "+a.namespaceName()+", including entries inherited from the platform."),VE(),dg("query",a.rowFilter.query()),VE(3),Vw(a.deletion.error()?4:-1),VE(),Vw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,fn,ko,Fo,P,P$1],encapsulation:2})};export{U as IntegrationsAllScopesComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {z as k$1,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$1,j as O$1,e as at,c as fn,k as ko,P,B as P$1}from'./chunk-7jUvxE8F.js';import {g,t as F,K as we,aq as k,ap as F$1,Z as Tr,$ as $i,a1 as ga,at as Cy,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,w as pf,x as hf,u as Dl,n as lg}from'./main-VAVXYALE.js';var K=(o,t)=>t.key;function H(o,t){if(o&1&&(Es(0,"p",3),AC(1),hl()),o&2){let e=tC();VE(),Fg(e.deletion.error());}}function U(o,t){o&1&&(Es(0,"p",4),AC(1,"Loading AI models\u2026"),hl());}function z(o,t){o&1&&(Es(0,"p",5),AC(1,"No platform AI models defined yet."),hl());}function G(o,t){o&1&&(Es(0,"p",4),AC(1,"No AI models match the current filter."),hl());}function J(o,t){if(o&1){let e=Qw();Es(0,"button",21),vg("click",function(){pf(e);let r=tC().$implicit,m=tC(2);return hf(m.edit(r))}),AC(1,"Edit"),hl();}if(o&2){let e=tC().$implicit;lg("aria-label","Edit "+e.title);}}function O(o,t){if(o&1){let e=Qw();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),AC(10),hl(),Es(11,"td",17)(12,"div",18),Bw(13,J,2,1,"button",19),Es(14,"agentos-row-delete-action",20),vg("deleteRequested",function(){let r=pf(e).$implicit,m=tC(2);return hf(m.deletion.request(r.key))})("deleteConfirmed",function(){let r=pf(e).$implicit,m=tC(2);return hf(m.confirmDelete(r))})("deleteCancelled",function(){pf(e);let r=tC(2);return hf(r.deletion.cancel())}),hl()()()();}if(o&2){let e=t.$implicit,a=tC(2);VE(2),Fg(e.title),VE(2),Fg(e.providerName),VE(2),Dl(" ",e.model.apiModelName," "),VE(2),Fg(e.model.priority),VE(2),Dl(" ",e.model.reasoningEffort?e.model.reasoningEffort.toLowerCase():"\u2014"," "),VE(3),Vw(a.deletion.confirmingId()!==e.key?13:-1),VE(),dg("rowKey",e.key)("rowLabel",e.title)("state",a.deletion);}}function Q(o,t){if(o&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,"Provider"),hl(),Es(8,"th",10),AC(9,"API model name"),hl(),Es(10,"th",10),AC(11,"Priority"),hl(),Es(12,"th",10),AC(13,"Reasoning effort"),hl(),Es(14,"th",10)(15,"span",11),AC(16,"Actions"),hl()()()(),Es(17,"tbody",8),$w(18,O,15,9,"tr",9,K),hl()()()),o&2){let e=tC();VE(18),zw(e.rowFilter.filteredRows());}}var j=class o{router=g(F);destroyRef=g(we);aiModelController=g(k);aiProviderController=g(F$1);refresh$=new Tr(void 0);isLoading=$i(true);deletion=k$1();rows=$i([]);rowFilter=O$1(this.rows,t=>[t.title,t.model.apiModelName,t.providerName].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(this.isLoading.set(true),Cy([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=Dw({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&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(m){return a.rowFilter.query.set(m)}),hl(),Es(2,"button",2),vg("click",function(){return a.openCreateForm()}),AC(3,"New AI model"),hl()(),Bw(4,H,2,1,"p",3),Bw(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&&(VE(),dg("query",a.rowFilter.query()),VE(3),Vw(a.deletion.error()?4:-1),VE(),Vw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,fn,ko,P,P$1],encapsulation:2})};export{j as PlatformAiModelsComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a1 as ga,a2 as ha,aa as br,aD as $y}from'./main-VAVXYALE.js';function i(t,o,p){return t.pipe(ga(()=>o().pipe(ha(()=>br(p)))),$y({bufferSize:1,refCount:true}))}export{i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {c}from'./chunk-
|
|
1
|
+
import {c}from'./chunk-DQJE-N1a.js';import {z as k,j as O$1,e as at,c as fn,k as ko,l as Fo,P,B as P$1}from'./chunk-7jUvxE8F.js';import {g,W,t as F,K as we,$ as $i,ac as by,a2 as ha,aa as br,U,N as x,L as w,ai as ke,al as We,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,w as pf,x as hf,n as lg}from'./main-VAVXYALE.js';var J=(n,t)=>t.key;function O(n,t){if(n&1&&(Es(0,"p",3),AC(1),hl()),n&2){let e=tC();VE(),Fg(e.deletion.error());}}function Y(n,t){n&1&&(Es(0,"p",4),AC(1,"Loading scheduled prompts\u2026"),hl());}function z(n,t){n&1&&(Es(0,"p",5),AC(1,"No scheduled prompts available."),hl());}function G(n,t){n&1&&(Es(0,"p",4),AC(1,"No scheduled prompts match the current filter."),hl());}function Q(n,t){if(n&1&&(Es(0,"span",14),AC(1),hl()),n&2){let e=tC().$implicit;VE(),Fg(e.prompt.description);}}function X(n,t){n&1&&(Es(0,"ds-tag",20),AC(1,"Read-only"),hl());}function Z(n,t){if(n&1){let e=Qw();Es(0,"button",25),vg("click",function(){pf(e);let l=tC(2).$implicit,p=tC(2);return hf(p.toggle(l))}),AC(1),hl(),Es(2,"button",25),vg("click",function(){pf(e);let l=tC(2).$implicit,p=tC(2);return hf(p.edit(l))}),AC(3," Edit "),hl();}if(n&2){let e=tC(2).$implicit;VE(),Fg(e.prompt.enabled?"Disable":"Enable"),VE(),lg("aria-label","Edit "+e.prompt.name);}}function ee(n,t){if(n&1){let e=Qw();Bw(0,Z,4,2),Es(1,"agentos-row-delete-action",24),vg("deleteRequested",function(){pf(e);let l=tC().$implicit,p=tC(2);return hf(p.deletion.request(l.key))})("deleteConfirmed",function(){pf(e);let l=tC().$implicit,p=tC(2);return hf(p.confirmDelete(l))})("deleteCancelled",function(){pf(e);let l=tC(3);return hf(l.deletion.cancel())}),hl();}if(n&2){let e=tC().$implicit,i=tC(2);Vw(i.deletion.confirmingId()!==e.key?0:-1),VE(),dg("rowKey",e.key)("rowLabel",e.prompt.name)("state",i.deletion);}}function te(n,t){n&1&&(Es(0,"button",23),AC(1,"Inherited"),hl());}function ne(n,t){if(n&1&&(Es(0,"tr",9)(1,"td",12)(2,"span",13),AC(3),hl(),Bw(4,Q,2,1,"span",14),hl(),Es(5,"td",15),AC(6),hl(),Es(7,"td",16)(8,"ds-tag",17),AC(9),hl()(),Es(10,"td",18)(11,"div",19)(12,"ds-tag",17),AC(13),hl(),Bw(14,X,2,0,"ds-tag",20),hl()(),Es(15,"td",21)(16,"div",22),Bw(17,ee,2,4)(18,te,2,0,"button",23),hl()()()),n&2){let e=t.$implicit,i=tC(2);VE(3),Fg(e.prompt.name),VE(),Vw(e.prompt.description?4:-1),VE(2),Fg(i.scheduleLabel(e.prompt)),VE(2),dg("variant",e.prompt.enabled?"accent":"outline"),VE(),Fg(e.prompt.enabled?"Enabled":"Disabled"),VE(3),dg("variant",e.scope==="platform"?"neutral":"accent"),VE(),Fg(e.scope==="platform"?"Platform":"Namespace"),VE(),Vw(e.scope==="platform"?14:-1),VE(3),Vw(e.scope==="namespace"?17:18);}}function ie(n,t){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,"Schedule"),hl(),Es(8,"th",10),AC(9,"Status"),hl(),Es(10,"th",10),AC(11,"Scope"),hl(),Es(12,"th",10)(13,"span",11),AC(14,"Actions"),hl()()()(),Es(15,"tbody",8),$w(16,ne,19,9,"tr",9,J),hl()()()),n&2){let e=tC();VE(16),zw(e.rowFilter.filteredRows());}}var H=class n{route=g(W);router=g(F);destroyRef=g(we);state=g(c);namespaceId=this.route.snapshot.params.namespaceId;rows=$i([]);isLoading=$i(true);deletion=k();rowFilter=O$1(this.rows,t=>[t.prompt.name,t.prompt.description,this.scheduleLabel(t.prompt),t.prompt.enabled?"Enabled":"Disabled",t.scope].filter(Boolean).join(" "));constructor(){by({platform:this.state.listPlatform().pipe(ha(()=>br([]))),namespace:this.state.listByNamespace(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({platform:t,namespace:e})=>{this.rows.set([...t.map((i,l)=>({key:`platform:${i.id??l}`,prompt:i,scope:"platform"})),...e.map((i,l)=>({key:`namespace:${i.id??l}`,prompt:i,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts","new"]);}edit(t){t.scope==="platform"||!t.prompt.id||this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts",t.prompt.id,"edit"]);}toggle(t){if(t.scope==="platform")return;(t.prompt.enabled?this.state.disable(t.prompt.id??""):this.state.enable(t.prompt.id??"")).pipe(U(this.destroyRef)).subscribe(i=>this.rows.update(l=>l.map(p=>p.key===t.key?x(w({},p),{prompt:i}):p)));}confirmDelete(t){t.scope==="platform"||!t.prompt.id||this.deletion.execute(t.key,{request$:this.state.delete(t.prompt.id).pipe(U(this.destroyRef)),onSuccess:()=>this.rows.update(e=>e.filter(i=>i.key!==t.key)),errorMessage:`Deleting "${t.prompt.name}" failed. Try again.`});}scheduleLabel(t){let e=t.recurrence,i=e.unit===ke.WEEK?"week":"month",l=e.unit===ke.WEEK&&e.days?.length?` (${e.days.map(p=>We[p]??p).join(", ")})`:"";return `Every ${i}${l} at ${e.timeUtc} UTC`}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Dw({type:n,selectors:[["agentos-scheduled-prompt-list"]],decls:9,vars:3,consts:[["title","Scheduled prompts","description","Scheduled prompts for this namespace, including schedules inherited from the platform."],["label","Filter scheduled prompts","placeholder","Filter scheduled prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Scheduled prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Schedule"],["role","cell","data-label","Status"],[3,"variant"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(e,i){e&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(p){return i.rowFilter.query.set(p)}),hl(),Es(2,"button",2),vg("click",function(){return i.openCreateForm()}),AC(3,"New scheduled prompt"),hl()(),Bw(4,O,2,1,"p",3),Bw(5,Y,2,0,"p",4)(6,z,2,0,"p",5)(7,G,2,0,"p",4)(8,ie,18,0,"div",6)),e&2&&(VE(),dg("query",i.rowFilter.query()),VE(3),Vw(i.deletion.error()?4:-1),VE(),Vw(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,fn,ko,Fo,P,P$1],encapsulation:2})};export{H as ScheduledPromptListComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,aJ as fe,a6 as x}from'./main-
|
|
1
|
+
import {g,aJ as fe,a6 as x}from'./main-VAVXYALE.js';var c=class r{api=g(fe);getById(e){return this.api.getByIdScheduledPrompt(e)}listPlatform(){return this.api.searchScheduledPrompt({namespaceId:null,userId:null})}listByNamespace(e){return this.api.searchScheduledPrompt({namespaceId:e,userId:null})}search(e){return this.api.searchScheduledPrompt(e)}listEffective(e){return this.api.resolveEffectiveScheduledPrompt(e)}create(e){return this.api.createScheduledPrompt(e)}update(e,t){return this.api.updateScheduledPrompt(e,t)}enable(e){return this.api.enableScheduledPrompt(e)}disable(e){return this.api.disableScheduledPrompt(e)}delete(e){return this.api.deleteScheduledPrompt(e)}static \u0275fac=function(t){return new(t||r)};static \u0275prov=x({token:r,factory:r.\u0275fac,providedIn:"root"})};export{c};
|