@whoz-oss/coday-client 0.0.0-workstream-forge.285 → 0.0.0-workstream-forge.288
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/3rdpartylicenses.txt +52 -0
- package/browser/{chunk-Cnq159eN.js → chunk--N43m_5o.js} +1 -1
- package/browser/{chunk-D-9iMQv_.js → chunk-ARX7xO57.js} +1 -1
- package/browser/{chunk-DLUw6xZL.js → chunk-B0gKv16w.js} +1 -1
- package/browser/{chunk-Bj2SgFTY.js → chunk-B84wcmlL.js} +1 -1
- package/browser/{chunk-Deoyp47K.js → chunk-BAW_bOac.js} +1 -1
- package/browser/{chunk-BpRfgEmz.js → chunk-BNV6A7zQ.js} +1 -1
- package/browser/chunk-BSz21_Vu.js +1 -0
- package/browser/{chunk-BGaBu_yG.js → chunk-BWCkWdmU.js} +1 -1
- package/browser/{chunk-DCU0O5Ka.js → chunk-BZ7MHHlT.js} +1 -1
- package/browser/{chunk-CX2QtdIw.js → chunk-BbgQs8ay.js} +1 -1
- package/browser/{chunk-BRhWdEcv.js → chunk-Bc30sqfv.js} +1 -1
- package/browser/{chunk-DNO_UKkx.js → chunk-BgfuCnTj.js} +1 -1
- package/browser/chunk-BtNRYep-.js +16 -0
- package/browser/{chunk-C3n9w6Vo.js → chunk-Bw2kVgKL.js} +1 -1
- package/browser/{chunk-BsMXvlMY.js → chunk-By9Xd-3K.js} +1 -1
- package/browser/{chunk-BQrs6HKm.js → chunk-BzrVRPNK.js} +1 -1
- package/browser/{chunk-D7CYFO8e.js → chunk-C8EjYY3L.js} +1 -1
- package/browser/{chunk-UivSyOHl.js → chunk-CBHdjoSo.js} +1 -1
- package/browser/{chunk-DT7DFzXk.js → chunk-CGhT80Z4.js} +1 -1
- package/browser/{chunk-BWZH94Ql.js → chunk-CT-NYgHo.js} +1 -1
- package/browser/{chunk-BozaX28A.js → chunk-CWBuB3TV.js} +1 -1
- package/browser/{chunk-BuXYpWqH.js → chunk-CWRaz0m6.js} +1 -1
- package/browser/{chunk-DC3rgpMh.js → chunk-CfJrOSzi.js} +1 -1
- package/browser/{chunk-VqtB1BzG.js → chunk-Ch_tCQDO.js} +1 -1
- package/browser/{chunk-ByMpO_2J.js → chunk-CknQyFqR.js} +1 -1
- package/browser/{chunk-9lPOnBh7.js → chunk-CqXT8Tpx.js} +1 -1
- package/browser/chunk-CqeuplQz.js +1 -0
- package/browser/{chunk-Ca-YJxkj.js → chunk-D-F4_F5P.js} +1 -1
- package/browser/{chunk-BvWC7yF9.js → chunk-D0PFoBR9.js} +1 -1
- package/browser/{chunk-BU4BNqKl.js → chunk-DJblpySR.js} +1 -1
- package/browser/{chunk-DXhOdsyd.js → chunk-DLffGFin.js} +1 -1
- package/browser/chunk-DNpsnpVA.js +690 -0
- package/browser/{chunk-CHXLjpvB.js → chunk-DT4fihVQ.js} +1 -1
- package/browser/chunk-DTHI-QLx.js +61 -0
- package/browser/{chunk-DYFgJfm3.js → chunk-DUVTlyRi.js} +1 -1
- package/browser/{chunk-KqBRRBxT.js → chunk-D_KNMuBZ.js} +1 -1
- package/browser/{chunk-E7h9aRjY.js → chunk-DaMifMs9.js} +1 -1
- package/browser/chunk-DdMcbWCx.js +1 -0
- package/browser/{chunk-DpaqV0I8.js → chunk-Dkderx1H.js} +1 -1
- package/browser/{chunk-CimgVrmo.js → chunk-Dnbp1gjx.js} +1 -1
- package/browser/{chunk-Ch9IS2VK.js → chunk-DqNu3dCC.js} +1 -1
- package/browser/{chunk-waXaFQA6.js → chunk-Dxv38Ish.js} +1 -1
- package/browser/{chunk-C6jMH6l0.js → chunk-H7KUSNF6.js} +1 -1
- package/browser/{chunk-DaKshFXh.js → chunk-I4zoVvDE.js} +1 -1
- package/browser/{chunk-B4IxKhfN.js → chunk-JWkB7UsB.js} +1 -1
- package/browser/{chunk-CfcxICq5.js → chunk-dhcgEEkx.js} +1 -1
- package/browser/{chunk-DoEqcxIp.js → chunk-lsjaR1SF.js} +1 -1
- package/browser/chunk-pXoj-NgV.js +1 -0
- package/browser/index.html +1 -1
- package/browser/{main-OLEL3JTU.js → main-IUUK3O6C.js} +1 -1
- package/package.json +1 -1
- package/browser/chunk-Bx5RArn6.js +0 -1
- package/browser/chunk-C7Y0YglE.js +0 -1
- package/browser/chunk-CFyknSSV.js +0 -1
- package/browser/chunk-DaMEeyR0.js +0 -1
- package/browser/chunk-anaDHfEv.js +0 -680
|
@@ -1 +1 @@
|
|
|
1
|
-
import {w as m,p as pt,W as Wt,T as Te,b as bn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,Q as Qt,c as fo,g as go,N as Nn,R as Rn,E as Ea,x as yo,z as bo,v as vn,d as yn,e as fn,l as pn,h as hn,_ as _n,i as at,u as un}from'./chunk-anaDHfEv.js';import {g,W,F,K as we,ag as U,z as zi,U as U$1,a2 as ga,aa as _r,O as x,M as w,N as Nw,I as Is,R as Eg,H as HC,m as ml,Y as Yw,Q as QE,P as pg,o as Il,b as Qw,s as sC,a as hg,S as BI,J as Jw,am as Kw,p as dC,T as HI,L as Lg,k as eC,i as fg,q as mf,r as yf}from'./main-OLEL3JTU.js';var ce=(o,t)=>t.id;function ue(o,t){o&1&&(Is(0,"p",2),HC(1,"Loading\u2026"),ml());}function fe(o,t){if(o&1&&(Is(0,"ds-form-field",20),hg(1,"input",22),ml()),o&2){let e=dC(3);QE(),pg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function ge(o,t){if(o&1&&(Is(0,"option",24),HC(1),ml()),o&2){let e=t.$implicit;pg("ngValue",e.id),QE(),Lg(e.name);}}function Ce(o,t){if(o&1&&(Is(0,"ds-form-field",21)(1,"select",23)(2,"option",24),HC(3,"\u2014 None \u2014"),ml(),Jw(4,ge,2,2,"option",24,ce),ml(),BI(),ml()),o&2){let e=dC(3);QE(),pg("formControl",e.agentConfigIdControl),HI(),QE(),pg("ngValue",null),QE(2),eC(e.availableAgentConfigs());}}function ye(o,t){if(o&1&&Yw(0,fe,2,1,"ds-form-field",20)(1,Ce,6,2,"ds-form-field",21),o&2){let e=dC(2);Qw(e.isEditMode()&&e.agentConfigIdControl.value?0:e.isEditMode()?-1:1);}}function ve(o,t){o&1&&(Is(0,"p",2),HC(1,"No parameters defined."),ml());}function he(o,t){if(o&1){let e=sC();Is(0,"div",11)(1,"div",25)(2,"ds-form-field",26),hg(3,"input",27),BI(),ml(),Is(4,"ds-form-field",28),hg(5,"input",29),BI(),ml(),Is(6,"ds-form-field",30),hg(7,"input",31),BI(),ml()(),Is(8,"button",32),Eg("click",function(){let d=mf(e).$index,m=dC(2);return yf(m.removeParameter(d))}),HC(9," \xD7 "),ml()();}if(o&2){let e=t.$implicit,r=t.$index;pg("formGroupName",r),QE(2),pg("controlId","param-name-"+r)("error",e.controls.name.invalid&&e.controls.name.touched?"Parameter name is required.":null),QE(),pg("id","param-name-"+r),HI(),QE(),pg("controlId","param-desc-"+r),QE(),pg("id","param-desc-"+r),HI(),QE(),pg("controlId","param-default-"+r),QE(),pg("id","param-default-"+r),HI();}}function _e(o,t){if(o&1){let e=sC();Is(0,"div",14)(1,"span",33),HC(2),ml(),Is(3,"ds-form-field",34),hg(4,"textarea",35),BI(),ml(),Is(5,"button",36),Eg("click",function(){let d=mf(e).$index,m=dC(2);return yf(m.removeContentEntry(d))}),HC(6," \xD7 "),ml()();}if(o&2){let e=t.$implicit,r=t.$index,d=dC(2);QE(2),Lg(r+1),QE(),pg("error",e.invalid&&e.touched?"Content entry must not be blank.":null),QE(),pg("formControlName",r),fg("aria-label","Content entry "+(r+1)),HI(),QE(),pg("disabled",d.contentArray.length===1);}}function xe(o,t){if(o&1&&(Is(0,"ds-notice"),HC(1),ml()),o&2){let e=dC(2);QE(),Lg(e.errorMessage());}}function be(o,t){if(o&1){let e=sC();Is(0,"button",37),Eg("click",function(){mf(e);let d=dC(2);return yf(d.exportYaml())}),HC(1),ml();}if(o&2){let e=dC(2);pg("disabled",e.isExporting()),QE(),Il(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ee(o,t){if(o&1){let e=sC();Is(0,"form",4),Eg("ngSubmit",function(){mf(e);let d=dC();return yf(d.submit())}),Is(1,"ds-form-field",5),hg(2,"input",6),BI(),ml(),Is(3,"ds-form-field",7),hg(4,"input",8),BI(),ml(),Yw(5,ye,2,1),Is(6,"ds-fieldset",9)(7,"p",2),HC(8," Each parameter must have a name and a default value. Use "),Is(9,"code"),HC(10),ml(),HC(11," in content entries to reference them. "),ml(),Is(12,"div",10),Yw(13,ve,2,0,"p",2),Jw(14,he,10,8,"div",11,Kw),Is(16,"div")(17,"button",12),Eg("click",function(){mf(e);let d=dC();return yf(d.addParameter())}),HC(18,"+ Add parameter"),ml()()()(),Is(19,"ds-fieldset",13)(20,"p",2),HC(21," Each content entry is a command. Use "),Is(22,"code"),HC(23,"@AgentName"),ml(),HC(24," to target an agent, "),Is(25,"code"),HC(26,"/promptName param1 param2"),ml(),HC(27," to call another prompt, and "),Is(28,"code"),HC(29),ml(),HC(30," for parameter placeholders. "),ml(),Is(31,"div",10),Jw(32,_e,7,5,"div",14,Kw),Is(34,"div")(35,"button",12),Eg("click",function(){mf(e);let d=dC();return yf(d.addContentEntry())}),HC(36,"+ Add content entry"),ml()()()(),Yw(37,xe,2,1,"ds-notice"),Is(38,"ds-form-field",15),hg(39,"textarea",16),BI(),ml(),Is(40,"ds-form-actions")(41,"button",17),HC(42),ml(),Yw(43,be,2,2,"button",18),Is(44,"button",19),Eg("click",function(){mf(e);let d=dC();return yf(d.cancel())}),HC(45,"Cancel"),ml()()();}if(o&2){let e=dC();pg("formGroup",e.form),QE(),pg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),QE(),pg("formControl",e.nameControl),HI(),QE(2),pg("formControl",e.descriptionControl),HI(),QE(),Qw(e.availableAgentConfigs().length>0?5:-1),QE(5),Lg(e.paramPlaceholderSyntax),QE(2),pg("formArrayName","parameters"),QE(),Qw(e.parametersArray.length===0?13:-1),QE(),eC(e.parametersArray.controls),QE(15),Lg(e.paramPlaceholderSyntax),QE(2),pg("formArrayName","content"),QE(),eC(e.contentArray.controls),QE(5),Qw(e.errorMessage()?37:-1),QE(),pg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),QE(),pg("formControl",e.externalMetadataJsonControl),HI(),QE(2),pg("disabled",e.form.invalid||e.isSubmitting()),QE(),Il(" ",e.isEditMode()?"Save changes":"Create"," "),QE(),Qw(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:[bn.required,bn.minLength(1)]}),description:new Te(null),agentConfigId:new Te(null),externalMetadataJson:new Te("",{nonNullable:true,validators:[Pe]}),content:new Wt([this.createContentControl()],{validators:[bn.required]}),parameters:new Wt([])});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=zi(false);isSubmitting=zi(false);isLoading=zi(false);isExporting=zi(false);errorMessage=zi(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=zi([]);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),ga(()=>_r([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U$1(this.destroyRef),ga(()=>_r([]))).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:[bn.required,bn.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:[bn.required,bn.minLength(1)]}),description:new Te(t?.description??null),defaultValue:new Te(t?.defaultValue??"",{nonNullable:true,validators:[bn.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=Nw({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&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return r.cancel()}),HC(3),ml()(),Yw(4,ue,2,0,"p",2)(5,Ee,46,16,"form",3),ml()),e&2&&(QE(),pg("title",r.isEditMode()?"Edit prompt":"New prompt"),QE(2),Il(" \u2190 ",r.isPlatformMode?"Platform prompts":"Prompts"," "),QE(),Qw(r.isLoading()?4:5));},dependencies:[Kt,fd,Mo,Do,Ut,Qt,fo,go,Nn,Rn,Ea,yo,bo,vn,yn,fn,pn,hn,_n,at,un],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 {w as m,p as pt,W as Wt,T as Te,b as bn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,Q as Qt,c as fo,g as go,N as Nn,R as Rn,E as Ea,x as yo,z as bo,v as vn,d as yn,e as fn,l as pn,h as hn,_ as _n,i as at,u as un}from'./chunk-DNpsnpVA.js';import {g,W,F,K as we,ag as U,z as zi,U as U$1,a2 as ga,aa as _r,O as x,M as w,N as Nw,I as Is,R as Eg,H as HC,m as ml,Y as Yw,Q as QE,P as pg,o as Il,b as Qw,s as sC,a as hg,S as BI,J as Jw,am as Kw,p as dC,T as HI,L as Lg,k as eC,i as fg,q as mf,r as yf}from'./main-IUUK3O6C.js';var ce=(o,t)=>t.id;function ue(o,t){o&1&&(Is(0,"p",2),HC(1,"Loading\u2026"),ml());}function fe(o,t){if(o&1&&(Is(0,"ds-form-field",20),hg(1,"input",22),ml()),o&2){let e=dC(3);QE(),pg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function ge(o,t){if(o&1&&(Is(0,"option",24),HC(1),ml()),o&2){let e=t.$implicit;pg("ngValue",e.id),QE(),Lg(e.name);}}function Ce(o,t){if(o&1&&(Is(0,"ds-form-field",21)(1,"select",23)(2,"option",24),HC(3,"\u2014 None \u2014"),ml(),Jw(4,ge,2,2,"option",24,ce),ml(),BI(),ml()),o&2){let e=dC(3);QE(),pg("formControl",e.agentConfigIdControl),HI(),QE(),pg("ngValue",null),QE(2),eC(e.availableAgentConfigs());}}function ye(o,t){if(o&1&&Yw(0,fe,2,1,"ds-form-field",20)(1,Ce,6,2,"ds-form-field",21),o&2){let e=dC(2);Qw(e.isEditMode()&&e.agentConfigIdControl.value?0:e.isEditMode()?-1:1);}}function ve(o,t){o&1&&(Is(0,"p",2),HC(1,"No parameters defined."),ml());}function he(o,t){if(o&1){let e=sC();Is(0,"div",11)(1,"div",25)(2,"ds-form-field",26),hg(3,"input",27),BI(),ml(),Is(4,"ds-form-field",28),hg(5,"input",29),BI(),ml(),Is(6,"ds-form-field",30),hg(7,"input",31),BI(),ml()(),Is(8,"button",32),Eg("click",function(){let d=mf(e).$index,m=dC(2);return yf(m.removeParameter(d))}),HC(9," \xD7 "),ml()();}if(o&2){let e=t.$implicit,r=t.$index;pg("formGroupName",r),QE(2),pg("controlId","param-name-"+r)("error",e.controls.name.invalid&&e.controls.name.touched?"Parameter name is required.":null),QE(),pg("id","param-name-"+r),HI(),QE(),pg("controlId","param-desc-"+r),QE(),pg("id","param-desc-"+r),HI(),QE(),pg("controlId","param-default-"+r),QE(),pg("id","param-default-"+r),HI();}}function _e(o,t){if(o&1){let e=sC();Is(0,"div",14)(1,"span",33),HC(2),ml(),Is(3,"ds-form-field",34),hg(4,"textarea",35),BI(),ml(),Is(5,"button",36),Eg("click",function(){let d=mf(e).$index,m=dC(2);return yf(m.removeContentEntry(d))}),HC(6," \xD7 "),ml()();}if(o&2){let e=t.$implicit,r=t.$index,d=dC(2);QE(2),Lg(r+1),QE(),pg("error",e.invalid&&e.touched?"Content entry must not be blank.":null),QE(),pg("formControlName",r),fg("aria-label","Content entry "+(r+1)),HI(),QE(),pg("disabled",d.contentArray.length===1);}}function xe(o,t){if(o&1&&(Is(0,"ds-notice"),HC(1),ml()),o&2){let e=dC(2);QE(),Lg(e.errorMessage());}}function be(o,t){if(o&1){let e=sC();Is(0,"button",37),Eg("click",function(){mf(e);let d=dC(2);return yf(d.exportYaml())}),HC(1),ml();}if(o&2){let e=dC(2);pg("disabled",e.isExporting()),QE(),Il(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ee(o,t){if(o&1){let e=sC();Is(0,"form",4),Eg("ngSubmit",function(){mf(e);let d=dC();return yf(d.submit())}),Is(1,"ds-form-field",5),hg(2,"input",6),BI(),ml(),Is(3,"ds-form-field",7),hg(4,"input",8),BI(),ml(),Yw(5,ye,2,1),Is(6,"ds-fieldset",9)(7,"p",2),HC(8," Each parameter must have a name and a default value. Use "),Is(9,"code"),HC(10),ml(),HC(11," in content entries to reference them. "),ml(),Is(12,"div",10),Yw(13,ve,2,0,"p",2),Jw(14,he,10,8,"div",11,Kw),Is(16,"div")(17,"button",12),Eg("click",function(){mf(e);let d=dC();return yf(d.addParameter())}),HC(18,"+ Add parameter"),ml()()()(),Is(19,"ds-fieldset",13)(20,"p",2),HC(21," Each content entry is a command. Use "),Is(22,"code"),HC(23,"@AgentName"),ml(),HC(24," to target an agent, "),Is(25,"code"),HC(26,"/promptName param1 param2"),ml(),HC(27," to call another prompt, and "),Is(28,"code"),HC(29),ml(),HC(30," for parameter placeholders. "),ml(),Is(31,"div",10),Jw(32,_e,7,5,"div",14,Kw),Is(34,"div")(35,"button",12),Eg("click",function(){mf(e);let d=dC();return yf(d.addContentEntry())}),HC(36,"+ Add content entry"),ml()()()(),Yw(37,xe,2,1,"ds-notice"),Is(38,"ds-form-field",15),hg(39,"textarea",16),BI(),ml(),Is(40,"ds-form-actions")(41,"button",17),HC(42),ml(),Yw(43,be,2,2,"button",18),Is(44,"button",19),Eg("click",function(){mf(e);let d=dC();return yf(d.cancel())}),HC(45,"Cancel"),ml()()();}if(o&2){let e=dC();pg("formGroup",e.form),QE(),pg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),QE(),pg("formControl",e.nameControl),HI(),QE(2),pg("formControl",e.descriptionControl),HI(),QE(),Qw(e.availableAgentConfigs().length>0?5:-1),QE(5),Lg(e.paramPlaceholderSyntax),QE(2),pg("formArrayName","parameters"),QE(),Qw(e.parametersArray.length===0?13:-1),QE(),eC(e.parametersArray.controls),QE(15),Lg(e.paramPlaceholderSyntax),QE(2),pg("formArrayName","content"),QE(),eC(e.contentArray.controls),QE(5),Qw(e.errorMessage()?37:-1),QE(),pg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),QE(),pg("formControl",e.externalMetadataJsonControl),HI(),QE(2),pg("disabled",e.form.invalid||e.isSubmitting()),QE(),Il(" ",e.isEditMode()?"Save changes":"Create"," "),QE(),Qw(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:[bn.required,bn.minLength(1)]}),description:new Te(null),agentConfigId:new Te(null),externalMetadataJson:new Te("",{nonNullable:true,validators:[Pe]}),content:new Wt([this.createContentControl()],{validators:[bn.required]}),parameters:new Wt([])});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=zi(false);isSubmitting=zi(false);isLoading=zi(false);isExporting=zi(false);errorMessage=zi(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=zi([]);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),ga(()=>_r([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U$1(this.destroyRef),ga(()=>_r([]))).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:[bn.required,bn.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:[bn.required,bn.minLength(1)]}),description:new Te(t?.description??null),defaultValue:new Te(t?.defaultValue??"",{nonNullable:true,validators:[bn.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=Nw({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&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return r.cancel()}),HC(3),ml()(),Yw(4,ue,2,0,"p",2)(5,Ee,46,16,"form",3),ml()),e&2&&(QE(),pg("title",r.isEditMode()?"Edit prompt":"New prompt"),QE(2),Il(" \u2190 ",r.isPlatformMode?"Platform prompts":"Prompts"," "),QE(),Qw(r.isLoading()?4:5));},dependencies:[Kt,fd,Mo,Do,Ut,Qt,fo,go,Nn,Rn,Ea,yo,bo,vn,yn,fn,pn,hn,_n,at,un],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 {f,a6 as gd,a as fd,U as Ut,c as fo,g as go,a7 as uo,a8 as _a,a9 as pa,v as vn,d as yn,e as fn,_ as _n,i as at,u as un,V as Vo,aa as f$1}from'./chunk-
|
|
1
|
+
import {f,a6 as gd,a as fd,U as Ut,c as fo,g as go,a7 as uo,a8 as _a,a9 as pa,v as vn,d as yn,e as fn,_ as _n,i as at,u as un,V as Vo,aa as f$1}from'./chunk-DNpsnpVA.js';import {g,W,aN as Y,z as zi,ab as le,n as Ff,N as Nw,aO as Rb,I as Is,a as hg,Y as Yw,m as ml,Q as QE,b as Qw,ak as Dd,a1 as ma,a3 as rn,ac as Ny,a2 as ga,H as HC,s as sC,R as Eg,aP as $g,S as BI,p as dC,aQ as Ug,T as HI,J as Jw,k as eC,aR as rT,aS as nT,L as Lg,i as fg,av as cT,aw as lT,as as jg,o as Il,aT as dT,q as mf,r as yf,aU as qC}from'./main-IUUK3O6C.js';var ce=e=>({title:"By agent",rows:e}),pe=e=>({title:"By model",rows:e}),ge=(e,a)=>[e,a],ue=(e,a)=>a.title,_e=(e,a)=>a.key;function Ce(e,a){e&1&&(Is(0,"p",2),HC(1,"Loading usage settings\u2026"),ml());}function fe(e,a){if(e&1){let t=sC();Is(0,"ds-notice"),HC(1,"Could not load usage settings. Please try again."),ml(),Is(2,"div")(3,"button",3),Eg("click",function(){mf(t);let s=dC();return yf(s.configuration.retry())}),HC(4,"Retry usage settings"),ml()();}}function ye(e,a){e&1&&(Is(0,"p",2),HC(1,"Usage tracking is disabled."),ml());}function be(e,a){e&1&&(Is(0,"ds-notice"),HC(1),ml()),e&2&&(QE(),Lg(a));}function xe(e,a){e&1&&(Is(0,"p",2),HC(1,"Loading usage\u2026"),ml());}function he(e,a){e&1&&(Is(0,"p",12),HC(1,"No recorded usage for this period."),ml());}function Se(e,a){if(e&1&&(Is(0,"p",10),HC(1),ml()),e&2){let t=dC().$implicit;QE(),Il("",t.aggregate.unknownCostCount," record(s) with unknown cost");}}function we(e,a){if(e&1&&(Is(0,"tr",16)(1,"td",18),HC(2),ml(),Is(3,"td",19),HC(4),cT(5,"number"),ml(),Is(6,"td",20),HC(7),cT(8,"number"),cT(9,"number"),ml(),Is(10,"td",21),HC(11),cT(12,"number"),cT(13,"number"),ml(),Is(14,"td",22),HC(15),cT(16,"agentosCost"),Yw(17,Se,2,1,"p",10),ml()()),e&2){let t=a.$implicit;QE(2),Lg(t.key),QE(2),Lg(lT(5,8,t.aggregate.totalTokens)),QE(3),jg(" ",lT(8,10,t.aggregate.inputTokens)," / ",lT(9,12,t.aggregate.outputTokens)," "),QE(4),jg(" ",lT(12,14,t.aggregate.cacheReadTokens)," / ",lT(13,16,t.aggregate.cacheWriteTokens)," "),QE(4),Il(" ",dT(16,18,t.aggregate.cost,t.aggregate.unknownCostCount)," "),QE(2),Qw(t.aggregate.unknownCostCount>0?17:-1);}}function ve(e,a){if(e&1&&(Is(0,"div",13)(1,"table",14)(2,"thead",15)(3,"tr",16)(4,"th",17),HC(5,"Name"),ml(),Is(6,"th",17),HC(7,"Tokens"),ml(),Is(8,"th",17),HC(9,"Input / output"),ml(),Is(10,"th",17),HC(11,"Cache read / write"),ml(),Is(12,"th",17),HC(13,"Estimated cost"),ml()()(),Is(14,"tbody",15),Jw(15,we,18,21,"tr",16,_e),ml()()()),e&2){let t=dC().$implicit;QE(),fg("aria-label","Usage "+t.title.toLowerCase()),QE(14),eC(t.rows);}}function Ne(e,a){if(e&1&&(Is(0,"h3",11),HC(1),ml(),Yw(2,he,2,0,"p",12)(3,ve,17,1,"div",13)),e&2){let t=a.$implicit;QE(),Lg(t.title),QE(),Qw(t.rows.length===0?2:3);}}function Te(e,a){if(e&1&&(Jw(0,Ne,4,2,null,null,ue),Is(2,"p",10),HC(3," Unpriced usage is kept separate from known costs. Active agent runs appear here after they finish. "),ml()),e&2){let t=dC(2);eC(rT(4,ge,nT(0,ce,t.agents()),nT(2,pe,t.models())));}}function Ee(e,a){if(e&1){let t=sC();Is(0,"form",4),Eg("ngSubmit",function(){mf(t);let s=dC();return yf(s.load())}),Is(1,"ds-form-field",5)(2,"input",6),$g("ngModelChange",function(s){mf(t);let m=dC();return qC(m.from,s)||(m.from=s),yf(s)}),ml(),BI(),ml(),Is(3,"ds-form-field",7)(4,"input",8),$g("ngModelChange",function(s){mf(t);let m=dC();return qC(m.to,s)||(m.to=s),yf(s)}),ml(),BI(),ml(),Is(5,"button",9),HC(6,"Refresh"),ml()(),Yw(7,be,2,1,"ds-notice"),Yw(8,xe,2,0,"p",2)(9,Te,4,7);}if(e&2){let t,r=dC();QE(2),Ug("ngModel",r.from),HI(),QE(2),Ug("ngModel",r.to),HI(),QE(3),Qw((t=r.error())?7:-1,t),QE(),Qw(r.loading()?8:r.error()?-1:9);}}var me=class e{route=g(W);api=g(Y);configuration=g(f);namespaceId=this.route.snapshot.params.namespaceId;agents=zi([]);models=zi([]);error=zi(null);loading=zi(false);from=new Date(Date.now()-30*864e5).toISOString().slice(0,10);to=new Date().toISOString().slice(0,10);refresh=new le;constructor(){Ff(a=>{if(!this.configuration.enabled())return;let t=this.refresh.pipe(Dd(void 0),ma(()=>{this.error.set(null),this.agents.set([]),this.models.set([]);let r=new Date(`${this.from}T00:00:00.000Z`),s=new Date(`${this.to}T23:59:59.999Z`);return !Number.isFinite(r.getTime())||!Number.isFinite(s.getTime())||r>s?(this.error.set("Select a valid date range."),this.loading.set(false),rn):(this.loading.set(true),Ny({agents:this.api.aggregateByAgentUsageRecord(this.namespaceId,r.toISOString(),s.toISOString()),models:this.api.aggregateByModelUsageRecord(this.namespaceId,r.toISOString(),s.toISOString())}).pipe(ga(m=>(this.loading.set(false),this.error.set(m.status===403?"Namespace admin permission is required to view this report.":"Could not load usage. Please try again."),rn))))})).subscribe(({agents:r,models:s})=>{this.agents.set(r),this.models.set(s),this.loading.set(false);});a(()=>t.unsubscribe());});}load(){this.configuration.enabled()&&this.refresh.next();}static \u0275fac=function(t){return new(t||e)};static \u0275cmp=Nw({type:e,selectors:[["agentos-namespace-usage"]],decls:6,vars:1,consts:[["full",""],["title","Usage and costs","description","Recorded LLM usage across this namespace. Costs are estimates in the platform currency."],["role","status",1,"settings-table__status"],["dsButton","","type","button",3,"click"],[1,"ds-inline","ds-inline--wrap","ds-inline--end",3,"ngSubmit"],["label","From (UTC)","controlId","usage-from"],["dsControl","","id","usage-from","type","date","name","from","required","",3,"ngModelChange","ngModel"],["label","To (UTC)","controlId","usage-to"],["dsControl","","id","usage-to","type","date","name","to","required","",3,"ngModelChange","ngModel"],["dsButton","","variant","primary","type","submit"],[1,"ds-hint"],[1,"ds-micro"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table"],["role","rowgroup"],["role","row"],["role","columnheader"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Tokens"],["role","cell","data-label","Input / output"],["role","cell","data-label","Cache read / write"],["role","cell","data-label","Estimated cost"]],template:function(t,r){t&1&&(Is(0,"ds-page",0),hg(1,"ds-section-header",1),Yw(2,Ce,2,0,"p",2)(3,fe,5,0)(4,ye,2,0,"p",2)(5,Ee,10,4),ml()),t&2&&(QE(2),Qw(r.configuration.state()==="loading"?2:r.configuration.state()==="error"?3:r.configuration.state()==="disabled"?4:5));},dependencies:[gd,fd,Ut,fo,go,uo,_a,pa,vn,yn,fn,_n,at,un,Vo,Rb,f$1],encapsulation:2})};export{me as NamespaceUsageComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {q as k$1,O,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-
|
|
1
|
+
import {q as k$1,O,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-DNpsnpVA.js';import {g,W as W$1,F,K as we,aq as F$1,ap as k,$ as Sr,z as zi,a1 as ma,ac as Ny,a2 as ga,aa as _r,U,N as Nw,I as Is,R as Eg,m as ml,H as HC,Y as Yw,Q as QE,P as pg,b as Qw,p as dC,L as Lg,J as Jw,k as eC,o as Il,s as sC,q as mf,r as yf,i as fg}from'./main-IUUK3O6C.js';var G=(i,e)=>e.key;function Q(i,e){if(i&1&&(Is(0,"p",3),HC(1),ml()),i&2){let t=dC();QE(),Lg(t.deletion.error());}}function W(i,e){i&1&&(Is(0,"p",4),HC(1,"Loading AI models\u2026"),ml());}function X(i,e){i&1&&(Is(0,"p",5),HC(1,"No AI models configured."),ml());}function Y(i,e){i&1&&(Is(0,"p",4),HC(1,"No AI models match the current filter."),ml());}function Z(i,e){i&1&&(Is(0,"ds-tag",18),HC(1,"Read-only"),ml());}function ee(i,e){if(i&1){let t=sC();Is(0,"button",24),Eg("click",function(){mf(t);let s=dC(2).$implicit,m=dC(2);return yf(m.edit(s))}),HC(1,"Edit"),ml();}if(i&2){let t=dC(2).$implicit,n=dC(2);fg("aria-label","Edit "+n.title(t));}}function te(i,e){if(i&1){let t=sC();Yw(0,ee,2,1,"button",22),Is(1,"agentos-row-delete-action",23),Eg("deleteRequested",function(){mf(t);let s=dC().$implicit,m=dC(2);return yf(m.deletion.request(s.key))})("deleteConfirmed",function(){mf(t);let s=dC().$implicit,m=dC(2);return yf(m.confirmDelete(s))})("deleteCancelled",function(){mf(t);let s=dC(3);return yf(s.deletion.cancel())}),ml();}if(i&2){let t=dC().$implicit,n=dC(2);Qw(n.deletion.confirmingId()!==t.key?0:-1),QE(),pg("rowKey",t.key)("rowLabel",n.title(t))("state",n.deletion);}}function ie(i,e){i&1&&(Is(0,"button",21),HC(1,"Inherited"),ml());}function ne(i,e){if(i&1&&(Is(0,"tr",9)(1,"td",12),HC(2),ml(),Is(3,"td",13),HC(4),ml(),Is(5,"td",14),HC(6),ml(),Is(7,"td",15)(8,"div",16)(9,"ds-tag",17),HC(10),ml(),Yw(11,Z,2,0,"ds-tag",18),ml()(),Is(12,"td",19)(13,"div",20),Yw(14,te,2,4)(15,ie,2,0,"button",21),ml()()()),i&2){let t=e.$implicit,n=dC(2);QE(2),Lg(n.title(t)),QE(2),Lg(t.providerName),QE(2),Il(" ",t.model.apiModelName," "),QE(3),pg("variant",t.scope==="platform"?"neutral":"accent"),QE(),Lg(t.scope==="platform"?"Platform":"Namespace"),QE(),Qw(t.scope==="platform"?11:-1),QE(3),Qw(t.scope==="namespace"?14:15);}}function oe(i,e){if(i&1&&(Is(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),HC(5,"Name"),ml(),Is(6,"th",10),HC(7,"Provider"),ml(),Is(8,"th",10),HC(9,"API model name"),ml(),Is(10,"th",10),HC(11,"Scope"),ml(),Is(12,"th",10)(13,"span",11),HC(14,"Actions"),ml()()()(),Is(15,"tbody",8),Jw(16,ne,16,7,"tr",9,G),ml()()()),i&2){let t=dC();QE(16),eC(t.rowFilter.filteredRows());}}var z=class i{route=g(W$1);router=g(F);destroyRef=g(we);aiModelController=g(F$1);aiProviderController=g(k);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Sr(void 0);isLoading=zi(true);deletion=k$1();rows=zi([]);rowFilter=O(this.rows,e=>[e.model.alias,e.model.apiModelName,e.providerName,e.scope].filter(Boolean).join(" "));data$=this.refresh$.pipe(ma(()=>(this.isLoading.set(true),Ny({namespace:this.aiModelController.listByNamespaceIdAiModel(this.namespaceId),platform:this.aiModelController.listPlatformLevelAiModel().pipe(ga(()=>_r([]))),providers:this.aiProviderController.listAiProvider(this.namespaceId)}).pipe(ma(({namespace:e,platform:t,providers:n})=>{let s=[...new Set([...t,...e].map(m=>m.aiProviderId))];return Ny({namespace:_r(e),platform:_r(t),providers:_r(n),referencedProviders:this.aiProviderController.getByIdsAiProvider({ids:s,withRemoved:false}).pipe(ga(()=>_r([])))})})))));constructor(){this.data$.pipe(U(this.destroyRef)).subscribe({next:({namespace:e,platform:t,providers:n,referencedProviders:s})=>{let m=new Map([...s,...n].map(c=>[c.id??"",c.name]));this.rows.set([...t.map((c,g)=>({key:`platform:${c.id??g}`,model:c,providerName:m.get(c.aiProviderId)??c.aiProviderId,scope:"platform"})),...e.map((c,g)=>({key:`namespace:${c.id??g}`,model:c,providerName:m.get(c.aiProviderId)??c.aiProviderId,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-models","new"]);}edit(e){e.scope==="platform"||!e.model.id||this.router.navigate(["/agentos",this.namespaceId,"ai-models",e.model.id,"edit"]);}title(e){return e.model.alias??e.model.apiModelName}confirmDelete(e){e.scope==="platform"||!e.model.id||this.deletion.execute(e.key,{request$:this.aiModelController.deleteAiModel(e.model.id).pipe(U(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${this.title(e)}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=Nw({type:i,selectors:[["agentos-namespace-ai-models"]],decls:9,vars:3,consts:[["title","AI models","description","AI models configured for this namespace, including models inherited from the platform."],["label","Filter AI models","placeholder","Filter AI models\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","AI models"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Provider"],["role","cell","data-label","API model name",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(t,n){t&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(m){return n.rowFilter.query.set(m)}),ml(),Is(2,"button",2),Eg("click",function(){return n.openCreateForm()}),HC(3,"New AI model"),ml()(),Yw(4,Q,2,1,"p",3),Yw(5,W,2,0,"p",4)(6,X,2,0,"p",5)(7,Y,2,0,"p",4)(8,oe,18,0,"div",6)),t&2&&(QE(),pg("query",n.rowFilter.query()),QE(3),Qw(n.deletion.error()?4:-1),QE(),Qw(n.isLoading()?5:n.rows().length===0?6:n.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{z as NamespaceAiModelsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {c}from'./chunk-DaKshFXh.js';import {p as pt,T as Te$1,b as bn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,P as Pn,o as Mn,Q as Qt,c as fo,g as go,t as ta,N as Nn,R as Rn,v as vn,d as yn,e as fn,l as pn,h as hn,_ as _n,i as at,u as un,n as cn}from'./chunk-anaDHfEv.js';import {g,W,F,K as we$1,ag as U,ah as ke$1,ai as Fe$1,z as zi,aj as De$1,a9 as F$1,ak as Dd,j as mT,ac as Ny,U as U$1,a2 as ga,aa as _r,O as x,M as w,N as Nw,I as Is,R as Eg,H as HC,m as ml,Y as Yw,Q as QE,P as pg,o as Il,b as Qw,s as sC,a as hg,S as BI,J as Jw,p as dC,T as HI,k as eC,L as Lg,q as mf,r as yf,u as ch}from'./main-OLEL3JTU.js';var V=(n,t)=>t.value,ve=(n,t)=>t.id;function be(n,t){n&1&&(Is(0,"p",2),HC(1,"Loading\u2026"),ml());}function _e(n,t){if(n&1&&(Is(0,"ds-form-field",9),hg(1,"input",38),ml()),n&2){let e=dC(2);QE(),pg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function Se(n,t){if(n&1&&(Is(0,"a",39),HC(1,"Add an agent config"),ml(),HC(2," first. ")),n&2){let e=dC(3);pg("href","/agentos/"+e.namespaceId+"/agent-configs/new",ch);}}function xe(n,t){if(n&1&&(Is(0,"ds-form-field",10)(1,"p",2),HC(2," No agent configs available in this scope yet. "),Yw(3,Se,3,1),ml()()),n&2){let e=dC(2);QE(3),Qw(e.isPlatformMode?-1:3);}}function Ee(n,t){if(n&1&&(Is(0,"option",17),HC(1),ml()),n&2){let e=t.$implicit;pg("value",e.id),QE(),Lg(e.name);}}function De(n,t){if(n&1&&(Is(0,"ds-form-field",11)(1,"select",40)(2,"option",41),HC(3,"Select an agent config\u2026"),ml(),Jw(4,Ee,2,2,"option",17,ve),ml(),BI(),ml()),n&2){let e=dC(2);pg("error",e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?"Agent Config is required.":null),QE(),pg("formControl",e.agentConfigIdControl),HI(),QE(3),eC(e.availableAgentConfigs());}}function Te(n,t){if(n&1&&(Is(0,"option",17),HC(1),ml()),n&2){let e=t.$implicit;pg("value",e.value),QE(),Lg(e.label);}}function Ne(n,t){if(n&1){let e=sC();Is(0,"label",31)(1,"input",43),Eg("change",function(){let f=mf(e).$implicit,h=dC(3);return yf(h.toggleDay(f.value))}),ml(),HC(2),ml();}if(n&2){let e=t.$implicit,l=dC(3);QE(),pg("checked",l.isDaySelected(e.value)),QE(),Il(" ",e.label," ");}}function Ie(n,t){if(n&1&&(Is(0,"ds-form-field",18)(1,"div",42),Jw(2,Ne,3,2,"label",31,V),ml()()),n&2){let e=dC(2);QE(2),eC(e.dayOptions);}}function Me(n,t){if(n&1&&(Is(0,"option",17),HC(1),ml()),n&2){let e=t.$implicit;pg("value",e.value),QE(),Lg(e.label);}}function Pe(n,t){if(n&1&&(Is(0,"ds-form-field",28),hg(1,"input",44),BI(),ml()),n&2){let e=dC(2);pg("error",e.form.hasError("endDateRequired")&&e.endDateControl.touched?"End date is required.":null),QE(),pg("formControl",e.endDateControl),HI();}}function we(n,t){if(n&1&&(Is(0,"ds-form-field",29),hg(1,"input",45),BI(),ml()),n&2){let e=dC(2);pg("error",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?"Must be at least 1.":null),QE(),pg("formControl",e.occurrenceCountControl),HI();}}function Fe(n,t){if(n&1&&(Is(0,"ds-notice"),HC(1),ml()),n&2){let e=dC(2);QE(),Lg(e.errorMessage());}}function Oe(n,t){if(n&1){let e=sC();Is(0,"form",4),Eg("ngSubmit",function(){mf(e);let f=dC();return yf(f.submit())}),Is(1,"ds-form-field",5),hg(2,"input",6),BI(),ml(),Is(3,"ds-form-field",7),hg(4,"input",8),BI(),ml(),Yw(5,_e,2,1,"ds-form-field",9)(6,xe,4,1,"ds-form-field",10)(7,De,6,2,"ds-form-field",11),Is(8,"ds-form-field",12),hg(9,"textarea",13),BI(),ml(),Is(10,"ds-fieldset",14)(11,"ds-form-field",15)(12,"select",16),Jw(13,Te,2,2,"option",17,V),ml(),BI(),ml(),Yw(15,Ie,4,0,"ds-form-field",18),Is(16,"ds-form-field",19)(17,"div",20),hg(18,"input",21),BI(),Is(19,"span",22),HC(20,"UTC"),ml()()()(),Is(21,"ds-fieldset",23)(22,"ds-form-field",24),hg(23,"input",25),BI(),ml(),Is(24,"ds-form-field",26)(25,"select",27),Jw(26,Me,2,2,"option",17,V),ml(),BI(),ml(),Yw(28,Pe,2,2,"ds-form-field",28),Yw(29,we,2,2,"ds-form-field",29),ml(),Is(30,"div",30)(31,"label",31),hg(32,"input",32),BI(),HC(33," Enabled "),ml(),Is(34,"p",33),HC(35,"When disabled, the scheduled prompt is saved but will not run on schedule."),ml()(),Is(36,"ds-form-field",34),hg(37,"textarea",35),BI(),ml(),Yw(38,Fe,2,1,"ds-notice"),Is(39,"ds-form-actions")(40,"button",36),HC(41),ml(),Is(42,"button",37),Eg("click",function(){mf(e);let f=dC();return yf(f.cancel())}),HC(43,"Cancel"),ml()()();}if(n&2){let e=dC();pg("formGroup",e.form),QE(),pg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),QE(),pg("formControl",e.nameControl),HI(),QE(2),pg("formControl",e.descriptionControl),HI(),QE(),Qw(e.isEditMode()?5:e.availableAgentConfigs().length===0?6:7),QE(3),pg("error",e.promptContentControl.invalid&&e.promptContentControl.touched?"Opening message is required.":null),QE(),pg("formControl",e.promptContentControl),HI(),QE(3),pg("formControl",e.unitControl),HI(),QE(),eC(e.schedulerUnits),QE(2),Qw(e.showDayFilter()?15:-1),QE(),pg("error",e.timeUtcControl.invalid&&e.timeUtcControl.touched?"Valid time is required (HH:mm).":null),QE(2),pg("formControl",e.timeUtcControl),HI(),QE(4),pg("error",e.startDateControl.invalid&&e.startDateControl.touched?"Start date is required.":null),QE(),pg("formControl",e.startDateControl),HI(),QE(2),pg("formControl",e.endTypeControl),HI(),QE(),eC(e.endTypes),QE(2),Qw(e.showEndDate()?28:-1),QE(),Qw(e.showOccurrenceCount()?29:-1),QE(3),pg("formControl",e.enabledControl),HI(),QE(4),pg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),QE(),pg("formControl",e.externalMetadataJsonControl),HI(),QE(),Qw(e.errorMessage()?38:-1),QE(2),pg("disabled",e.form.invalid||e.isSubmitting()),QE(),Il(" ",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:[bn.required]}),description:new Te$1(null),agentConfigId:new Te$1("",{nonNullable:true,validators:[bn.required]}),promptContent:new Te$1("",{nonNullable:true,validators:[bn.required]}),unit:new Te$1(Fe$1.WEEK,{nonNullable:true,validators:[bn.required]}),days:new Te$1([],{nonNullable:true}),timeUtc:new Te$1("09:00",{nonNullable:true,validators:[bn.required,bn.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new Te$1("",{nonNullable:true,validators:[bn.required]}),endType:new Te$1(ke$1.NEVER,{nonNullable:true,validators:[bn.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=zi(false);isSubmitting=zi(false);isLoading=zi(false);errorMessage=zi(null);SchedulerUnit=Fe$1;SchedulerEndType=ke$1;schedulerUnits=[{value:Fe$1.WEEK,label:"Week(s)"},{value:Fe$1.MONTH,label:"Month(s)"}];endTypes=[{value:ke$1.NEVER,label:"Never"},{value:ke$1.ON_DATE,label:"On date"},{value:ke$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(Dd(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(Dd(this.endTypeControl.value)));showDayFilter=mT(()=>this.unitSignal()===Fe$1.WEEK);showEndDate=mT(()=>this.endTypeSignal()===ke$1.ON_DATE);showOccurrenceCount=mT(()=>this.endTypeSignal()===ke$1.OCCURRENCES);agentConfigs=zi([]);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),Ny({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(ga(()=>_r([])))}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===ke$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===ke$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=Nw({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&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return l.cancel()}),HC(3),ml()(),Yw(4,be,2,0,"p",2)(5,Oe,44,22,"form",3),ml()),e&2&&(QE(),pg("title",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"),QE(2),Il(" \u2190 ",l.isPlatformMode?"Platform scheduled prompts":"Scheduled prompts"," "),QE(),Qw(l.isLoading()?4:5));},dependencies:[Kt,fd,Mo,Do,Ut,Pn,Mn,Qt,fo,go,ta,Nn,Rn,vn,yn,fn,pn,hn,_n,at,un,cn],encapsulation:2})};function Ae(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===ke$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===ke$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-I4zoVvDE.js';import {p as pt,T as Te$1,b as bn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,P as Pn,o as Mn,Q as Qt,c as fo,g as go,t as ta,N as Nn,R as Rn,v as vn,d as yn,e as fn,l as pn,h as hn,_ as _n,i as at,u as un,n as cn}from'./chunk-DNpsnpVA.js';import {g,W,F,K as we$1,ag as U,ah as ke$1,ai as Fe$1,z as zi,aj as De$1,a9 as F$1,ak as Dd,j as mT,ac as Ny,U as U$1,a2 as ga,aa as _r,O as x,M as w,N as Nw,I as Is,R as Eg,H as HC,m as ml,Y as Yw,Q as QE,P as pg,o as Il,b as Qw,s as sC,a as hg,S as BI,J as Jw,p as dC,T as HI,k as eC,L as Lg,q as mf,r as yf,u as ch}from'./main-IUUK3O6C.js';var V=(n,t)=>t.value,ve=(n,t)=>t.id;function be(n,t){n&1&&(Is(0,"p",2),HC(1,"Loading\u2026"),ml());}function _e(n,t){if(n&1&&(Is(0,"ds-form-field",9),hg(1,"input",38),ml()),n&2){let e=dC(2);QE(),pg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function Se(n,t){if(n&1&&(Is(0,"a",39),HC(1,"Add an agent config"),ml(),HC(2," first. ")),n&2){let e=dC(3);pg("href","/agentos/"+e.namespaceId+"/agent-configs/new",ch);}}function xe(n,t){if(n&1&&(Is(0,"ds-form-field",10)(1,"p",2),HC(2," No agent configs available in this scope yet. "),Yw(3,Se,3,1),ml()()),n&2){let e=dC(2);QE(3),Qw(e.isPlatformMode?-1:3);}}function Ee(n,t){if(n&1&&(Is(0,"option",17),HC(1),ml()),n&2){let e=t.$implicit;pg("value",e.id),QE(),Lg(e.name);}}function De(n,t){if(n&1&&(Is(0,"ds-form-field",11)(1,"select",40)(2,"option",41),HC(3,"Select an agent config\u2026"),ml(),Jw(4,Ee,2,2,"option",17,ve),ml(),BI(),ml()),n&2){let e=dC(2);pg("error",e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?"Agent Config is required.":null),QE(),pg("formControl",e.agentConfigIdControl),HI(),QE(3),eC(e.availableAgentConfigs());}}function Te(n,t){if(n&1&&(Is(0,"option",17),HC(1),ml()),n&2){let e=t.$implicit;pg("value",e.value),QE(),Lg(e.label);}}function Ne(n,t){if(n&1){let e=sC();Is(0,"label",31)(1,"input",43),Eg("change",function(){let f=mf(e).$implicit,h=dC(3);return yf(h.toggleDay(f.value))}),ml(),HC(2),ml();}if(n&2){let e=t.$implicit,l=dC(3);QE(),pg("checked",l.isDaySelected(e.value)),QE(),Il(" ",e.label," ");}}function Ie(n,t){if(n&1&&(Is(0,"ds-form-field",18)(1,"div",42),Jw(2,Ne,3,2,"label",31,V),ml()()),n&2){let e=dC(2);QE(2),eC(e.dayOptions);}}function Me(n,t){if(n&1&&(Is(0,"option",17),HC(1),ml()),n&2){let e=t.$implicit;pg("value",e.value),QE(),Lg(e.label);}}function Pe(n,t){if(n&1&&(Is(0,"ds-form-field",28),hg(1,"input",44),BI(),ml()),n&2){let e=dC(2);pg("error",e.form.hasError("endDateRequired")&&e.endDateControl.touched?"End date is required.":null),QE(),pg("formControl",e.endDateControl),HI();}}function we(n,t){if(n&1&&(Is(0,"ds-form-field",29),hg(1,"input",45),BI(),ml()),n&2){let e=dC(2);pg("error",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?"Must be at least 1.":null),QE(),pg("formControl",e.occurrenceCountControl),HI();}}function Fe(n,t){if(n&1&&(Is(0,"ds-notice"),HC(1),ml()),n&2){let e=dC(2);QE(),Lg(e.errorMessage());}}function Oe(n,t){if(n&1){let e=sC();Is(0,"form",4),Eg("ngSubmit",function(){mf(e);let f=dC();return yf(f.submit())}),Is(1,"ds-form-field",5),hg(2,"input",6),BI(),ml(),Is(3,"ds-form-field",7),hg(4,"input",8),BI(),ml(),Yw(5,_e,2,1,"ds-form-field",9)(6,xe,4,1,"ds-form-field",10)(7,De,6,2,"ds-form-field",11),Is(8,"ds-form-field",12),hg(9,"textarea",13),BI(),ml(),Is(10,"ds-fieldset",14)(11,"ds-form-field",15)(12,"select",16),Jw(13,Te,2,2,"option",17,V),ml(),BI(),ml(),Yw(15,Ie,4,0,"ds-form-field",18),Is(16,"ds-form-field",19)(17,"div",20),hg(18,"input",21),BI(),Is(19,"span",22),HC(20,"UTC"),ml()()()(),Is(21,"ds-fieldset",23)(22,"ds-form-field",24),hg(23,"input",25),BI(),ml(),Is(24,"ds-form-field",26)(25,"select",27),Jw(26,Me,2,2,"option",17,V),ml(),BI(),ml(),Yw(28,Pe,2,2,"ds-form-field",28),Yw(29,we,2,2,"ds-form-field",29),ml(),Is(30,"div",30)(31,"label",31),hg(32,"input",32),BI(),HC(33," Enabled "),ml(),Is(34,"p",33),HC(35,"When disabled, the scheduled prompt is saved but will not run on schedule."),ml()(),Is(36,"ds-form-field",34),hg(37,"textarea",35),BI(),ml(),Yw(38,Fe,2,1,"ds-notice"),Is(39,"ds-form-actions")(40,"button",36),HC(41),ml(),Is(42,"button",37),Eg("click",function(){mf(e);let f=dC();return yf(f.cancel())}),HC(43,"Cancel"),ml()()();}if(n&2){let e=dC();pg("formGroup",e.form),QE(),pg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),QE(),pg("formControl",e.nameControl),HI(),QE(2),pg("formControl",e.descriptionControl),HI(),QE(),Qw(e.isEditMode()?5:e.availableAgentConfigs().length===0?6:7),QE(3),pg("error",e.promptContentControl.invalid&&e.promptContentControl.touched?"Opening message is required.":null),QE(),pg("formControl",e.promptContentControl),HI(),QE(3),pg("formControl",e.unitControl),HI(),QE(),eC(e.schedulerUnits),QE(2),Qw(e.showDayFilter()?15:-1),QE(),pg("error",e.timeUtcControl.invalid&&e.timeUtcControl.touched?"Valid time is required (HH:mm).":null),QE(2),pg("formControl",e.timeUtcControl),HI(),QE(4),pg("error",e.startDateControl.invalid&&e.startDateControl.touched?"Start date is required.":null),QE(),pg("formControl",e.startDateControl),HI(),QE(2),pg("formControl",e.endTypeControl),HI(),QE(),eC(e.endTypes),QE(2),Qw(e.showEndDate()?28:-1),QE(),Qw(e.showOccurrenceCount()?29:-1),QE(3),pg("formControl",e.enabledControl),HI(),QE(4),pg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),QE(),pg("formControl",e.externalMetadataJsonControl),HI(),QE(),Qw(e.errorMessage()?38:-1),QE(2),pg("disabled",e.form.invalid||e.isSubmitting()),QE(),Il(" ",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:[bn.required]}),description:new Te$1(null),agentConfigId:new Te$1("",{nonNullable:true,validators:[bn.required]}),promptContent:new Te$1("",{nonNullable:true,validators:[bn.required]}),unit:new Te$1(Fe$1.WEEK,{nonNullable:true,validators:[bn.required]}),days:new Te$1([],{nonNullable:true}),timeUtc:new Te$1("09:00",{nonNullable:true,validators:[bn.required,bn.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new Te$1("",{nonNullable:true,validators:[bn.required]}),endType:new Te$1(ke$1.NEVER,{nonNullable:true,validators:[bn.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=zi(false);isSubmitting=zi(false);isLoading=zi(false);errorMessage=zi(null);SchedulerUnit=Fe$1;SchedulerEndType=ke$1;schedulerUnits=[{value:Fe$1.WEEK,label:"Week(s)"},{value:Fe$1.MONTH,label:"Month(s)"}];endTypes=[{value:ke$1.NEVER,label:"Never"},{value:ke$1.ON_DATE,label:"On date"},{value:ke$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(Dd(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(Dd(this.endTypeControl.value)));showDayFilter=mT(()=>this.unitSignal()===Fe$1.WEEK);showEndDate=mT(()=>this.endTypeSignal()===ke$1.ON_DATE);showOccurrenceCount=mT(()=>this.endTypeSignal()===ke$1.OCCURRENCES);agentConfigs=zi([]);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),Ny({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(ga(()=>_r([])))}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===ke$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===ke$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=Nw({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&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return l.cancel()}),HC(3),ml()(),Yw(4,be,2,0,"p",2)(5,Oe,44,22,"form",3),ml()),e&2&&(QE(),pg("title",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"),QE(2),Il(" \u2190 ",l.isPlatformMode?"Platform scheduled prompts":"Scheduled prompts"," "),QE(),Qw(l.isLoading()?4:5));},dependencies:[Kt,fd,Mo,Do,Ut,Pn,Mn,Qt,fo,go,ta,Nn,Rn,vn,yn,fn,pn,hn,_n,at,un,cn],encapsulation:2})};function Ae(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===ke$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===ke$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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {O as O$1}from'./chunk-ARX7xO57.js';import {O}from'./chunk-BgfuCnTj.js';import {I}from'./chunk-D-F4_F5P.js';import {g,K as we$1,z as zi,j as mT,a9 as F,at as _y,ad as ne,U,N as Nw,I as Is,a as hg,Y as Yw,m as ml,Q as QE,b as Qw,H as HC,s as sC,R as Eg,p as dC,P as pg,S as BI,J as Jw,L as Lg,T as HI,k as eC,o as Il,ae as qw,q as mf,r as yf,aL as DC,O as x,M as w}from'./main-IUUK3O6C.js';import {y,J as k,L as R,X as a,p as pt,T as Te$1,$ as v,a0 as V,K as Kt,a as fd,M as Mo,D as Do,U as Ut,Q as Qt,c as fo,g as go,R as Rn,E as Ea,v as vn,d as yn,e as fn,a1 as gn,h as hn,i as at,u as un,m as mn,a2 as ji,F as Ni,a3 as m,a4 as S}from'./chunk-DNpsnpVA.js';import'./chunk-BSz21_Vu.js';var ye=(o,e)=>e.value,be=(o,e)=>e.title;function xe(o,e){o&1&&(Is(0,"p",4),HC(1,"Loading\u2026"),ml());}function Se(o,e){if(o&1&&(Is(0,"option",34),HC(1),ml()),o&2){let t=e.$implicit;pg("value",t.value),QE(),Lg(t.label);}}function Ee(o,e){if(o&1&&(Is(0,"option",34),HC(1),ml()),o&2){let t=e.$implicit;pg("value",t.value),QE(),Lg(t.label);}}function Te(o,e){if(o&1){let t=sC();Is(0,"form",22),Eg("ngSubmit",function(){mf(t);let s=dC(2);return yf(s.save())}),Is(1,"ds-group",23)(2,"dl",24)(3,"dt"),HC(4,"Email"),ml(),Is(5,"dd"),HC(6),ml(),Is(7,"dt"),HC(8,"External ID"),ml(),Is(9,"dd"),HC(10),ml()()(),Is(11,"ds-group",25)(12,"ds-form-field",26),hg(13,"input",27),BI(),ml(),Is(14,"ds-form-field",28),hg(15,"input",29),BI(),ml(),Is(16,"ds-form-field",30),hg(17,"textarea",31),BI(),ml(),Is(18,"ds-form-field",32)(19,"select",33),Jw(20,Se,2,2,"option",34,ye),ml(),BI(),ml(),Is(22,"ds-form-field",35)(23,"select",36),Jw(24,Ee,2,2,"option",34,ye),ml(),BI(),ml()(),Is(26,"ds-form-actions")(27,"button",37),HC(28),ml(),Is(29,"button",38),Eg("click",function(){mf(t);let s=dC(2);return yf(s.cancelEditing())}),HC(30,"Cancel"),ml()()();}if(o&2){let t=dC(),a=dC();pg("formGroup",a.form),QE(6),Lg(t.email),QE(4),Lg(t.externalId),QE(3),HI(),QE(2),HI(),QE(2),HI(),QE(2),HI(),QE(),eC(a.languageOptions),QE(3),HI(),QE(),eC(a.promptCacheTtlOptions),QE(3),pg("disabled",a.isSaving()),QE(),Il(" ",a.isSaving()?"Saving\u2026":"Save changes"," ");}}function Pe(o,e){o&1&&(Is(0,"p",4),HC(1," No global configuration yet. Create one from the Integrations / AI Providers / Auth Settings pages of your namespaces. "),ml());}function De(o,e){if(o&1){let t=sC();Is(0,"span",47),HC(1,"Delete?"),ml(),Is(2,"button",48),Eg("click",function(){mf(t);let s=dC().$implicit,m=dC(5);return yf(m.confirmDelete(s))}),HC(3,"Confirm"),ml(),Is(4,"button",49),Eg("click",function(){mf(t);let s=dC(6);return yf(s.cancelDelete())}),HC(5,"Cancel"),ml();}}function Ue(o,e){if(o&1){let t=sC();Is(0,"button",49),Eg("click",function(){mf(t);let s=dC().$implicit,m=dC(5);return yf(m.armDelete(s))}),HC(1,"Delete"),ml();}}function Ie(o,e){if(o&1&&(Is(0,"li",43)(1,"span",44),HC(2),ml(),Is(3,"span",45),HC(4),ml(),Yw(5,De,6,0)(6,Ue,2,0,"button",46),ml()),o&2){let t=e.$implicit,a=dC(5);QE(2),Lg(t.name),QE(2),Lg(t.subtitle),QE(),Qw(a.isPendingDelete(t)?5:6);}}function we(o,e){if(o&1&&(Is(0,"span",41),HC(1),ml(),Is(2,"ul",42),Jw(3,Ie,7,3,"li",43,qw().trackEntry,true),ml()),o&2){let t=e.$implicit;QE(),Lg(t.title),QE(2),eC(t.entries);}}function Ve(o,e){if(o&1&&Jw(0,we,5,1,null,null,be),o&2){let t=dC(3);eC(t.recapSections());}}function Ne(o,e){if(o&1){let t=sC();Is(0,"ds-group",23)(1,"dl",24)(2,"dt"),HC(3,"Email"),ml(),Is(4,"dd"),HC(5),ml(),Is(6,"dt"),HC(7,"External ID"),ml(),Is(8,"dd"),HC(9),ml()()(),Is(10,"ds-group",25)(11,"dl",24)(12,"dt"),HC(13,"First name"),ml(),Is(14,"dd"),HC(15),ml(),Is(16,"dt"),HC(17,"Last name"),ml(),Is(18,"dd"),HC(19),ml(),Is(20,"dt"),HC(21,"Bio"),ml(),Is(22,"dd"),HC(23),ml(),Is(24,"dt"),HC(25,"Language"),ml(),Is(26,"dd"),HC(27),ml(),Is(28,"dt"),HC(29,"Prompt cache"),ml(),Is(30,"dd"),HC(31),ml()()(),Is(32,"ds-form-actions")(33,"button",39),Eg("click",function(){mf(t);let s=dC(2);return yf(s.startEditing())}),HC(34,"Edit profile"),ml()(),Is(35,"ds-disclosure",40),Eg("toggled",function(){mf(t);let s=dC(2);return yf(s.toggleOverrides())}),Yw(36,Pe,2,0,"p",4)(37,Ve,2,0),ml();}if(o&2){let t=dC(),a=dC();QE(5),Lg(t.email),QE(4),Lg(t.externalId),QE(6),Lg(t.firstname||"\u2014"),QE(4),Lg(t.lastname||"\u2014"),QE(4),Lg(t.bio||"\u2014"),QE(4),Lg(t.preferredLanguage||"\u2014"),QE(4),Lg(a.promptCacheTtlLabel()),QE(4),pg("heading","My global user configurations ("+a.recap().total+")")("open",a.isOverridesExpanded()),QE(),Qw(a.recap().total===0?36:37);}}function Me(o,e){if(o&1){let t=sC();Is(0,"ds-group",5)(1,"ds-form-field",6)(2,"ds-segmented",7),Eg("valueChange",function(s){mf(t);let m=dC();return yf(m.setThemeVariant(s))}),ml()(),Is(3,"ds-form-field",8)(4,"ds-segmented",9),Eg("valueChange",function(s){mf(t);let m=dC();return yf(m.setTheme(s))}),ml()()(),Is(5,"ds-group",10)(6,"ds-form-field",11)(7,"ds-segmented",12),Eg("valueChange",function(s){mf(t);let m=dC();return yf(m.setEnterKeyBehavior(s))}),ml()()(),Is(8,"ds-group",13)(9,"ds-form-field",14)(10,"ds-segmented",15),Eg("valueChange",function(s){mf(t);let m=dC();return yf(m.setShowTechnical(s))}),ml()()(),Is(11,"ds-group",16)(12,"ds-form-field",17)(13,"input",18,0),Eg("change",function(){mf(t);let s=DC(14),m=dC();return yf(m.setIdeProjectRoot(s.value))}),ml()(),Is(15,"ds-form-field",19)(16,"input",20,1),Eg("change",function(){mf(t);let s=DC(17),m=dC();return yf(m.setIdeUrlTemplate(s.value))}),ml()()(),Yw(18,Te,31,5,"form",21)(19,Ne,38,10);}if(o&2){let t=dC();QE(),pg("hint",t.activeVariantDescription()),QE(),pg("options",t.themeVariantOptions)("value",t.themeVariant()),QE(),pg("hint",t.modeOverridden()?t.activeVariantLabel()+" does not support this mode; your choice is kept for other skins.":null),QE(),pg("options",t.modeOptions())("value",t.shownMode()),QE(3),pg("options",t.enterKeyOptions)("value",t.enterKeyBehavior()),QE(3),pg("options",t.showTechnicalOptions)("value",t.showTechnical()),QE(3),pg("value",t.ideProjectRoot()),QE(3),pg("value",t.ideUrlTemplate()),QE(2),Qw(t.isEditing()?18:19);}}function Fe(o,e){o&1&&(Is(0,"p",4),HC(1,"Unable to load profile."),ml());}var Ce=class o{userState=g(y);destroyRef=g(we$1);integrationState=g(O);providerState=g(O$1);authSettingState=g(I);themePort=g(k);preferencesPort=g(R);isEditing=zi(false);isLoading=zi(false);isSaving=zi(false);isOverridesExpanded=zi(false);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeMode=mT(()=>this.themePort.theme().mode);themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];themeVariant=mT(()=>this.themePort.theme().variant);themeVariantOptions=a.map(({id:e,label:t,description:a})=>({value:e,label:t,description:a}));modeOverridden=mT(()=>!V(this.themeVariant(),this.themeMode()));activeVariantLabel=mT(()=>m(this.themeVariant()).label);activeVariantDescription=mT(()=>m(this.themeVariant()).description);modeOptions=mT(()=>this.themeOptions.map(e=>x(w({},e),{disabled:this.isModeDisabled(e.value)})));shownMode=mT(()=>this.modeOverridden()?S(this.themeVariant(),this.themeMode(),false):this.themeMode());enterKeyBehavior=this.preferencesPort.enterKeyBehavior;enterKeyOptions=[{value:"send",label:"Send"},{value:"newline",label:"New line"}];showTechnical=this.preferencesPort.showTechnical;showTechnicalOptions=[{value:true,label:"Shown"},{value:false,label:"Hidden"}];ideProjectRoot=this.preferencesPort.ideProjectRoot;ideUrlTemplate=this.preferencesPort.ideUrlTemplate;languageOptions=[{value:"",label:"No preference (English fallback)"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"es",label:"Spanish"},{value:"pt",label:"Portuguese"},{value:"it",label:"Italian"},{value:"nl",label:"Dutch"},{value:"pl",label:"Polish"},{value:"ja",label:"Japanese"},{value:"zh",label:"Chinese"}];promptCacheTtlOptions=[{value:"STANDARD",label:"Standard"},{value:"EXTENDED",label:"Extended"}];form=new pt({firstname:new Te$1("",{nonNullable:true}),lastname:new Te$1("",{nonNullable:true}),bio:new Te$1("",{nonNullable:true}),preferredLanguage:new Te$1("",{nonNullable:true}),promptCacheTtl:new Te$1("STANDARD",{nonNullable:true})});promptCacheTtlLabel=mT(()=>{let e=this.currentUser()?.promptCacheTtl??"STANDARD";return this.promptCacheTtlOptions.find(t=>t.value===e)?.label??e});recap=F(_y([this.integrationState.userGlobal$,this.providerState.userGlobal$,this.authSettingState.userGlobal$]).pipe(ne(([e,t,a])=>{let s=e.map(g=>({category:"integration",id:g.id??"",name:g.name,subtitle:g.integrationType})),m=t.map(g=>({category:"aiProvider",id:g.id??"",name:g.name,subtitle:g.apiType})),M=a.map(g=>({category:"authSetting",id:g.id??"",name:g.name,subtitle:g.authType}));return {integrations:s,aiProviders:m,authSettings:M,total:s.length+m.length+M.length}})),{initialValue:{integrations:[],aiProviders:[],authSettings:[],total:0}});recapSections=mT(()=>{let e=this.recap();return [{title:"Integrations",entries:e.integrations},{title:"AI Providers",entries:e.aiProviders},{title:"My global auth settings",entries:e.authSettings}].filter(t=>t.entries.length>0)});ngOnInit(){if(this.currentUser()){this.syncFormFromState();return}this.isLoading.set(true),this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:()=>{this.syncFormFromState(),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}startEditing(){this.syncFormFromState(),this.isEditing.set(true);}cancelEditing(){this.isEditing.set(false);}setTheme(e){this.themePort.setTheme({variant:this.themePort.theme().variant,mode:e});}setThemeVariant(e){v(e)&&this.themePort.setTheme({variant:e,mode:this.themePort.theme().mode});}isModeDisabled(e){return !V(this.themeVariant(),e)}setEnterKeyBehavior(e){this.preferencesPort.setEnterKeyBehavior(e);}setShowTechnical(e){this.preferencesPort.setShowTechnical(e);}setIdeProjectRoot(e){this.preferencesPort.setIdeProjectRoot(e);}setIdeUrlTemplate(e){this.preferencesPort.setIdeUrlTemplate(e);}save(){if(this.isSaving())return;this.isSaving.set(true);let e=this.form.controls.preferredLanguage.value.trim();this.userState.updateMe({firstname:this.form.controls.firstname.value.trim()||void 0,lastname:this.form.controls.lastname.value.trim()||void 0,bio:this.form.controls.bio.value.trim()||void 0,preferredLanguage:e||void 0,promptCacheTtl:this.form.controls.promptCacheTtl.value}).pipe(U(this.destroyRef)).subscribe({next:()=>{this.isSaving.set(false),this.isEditing.set(false);},error:()=>this.isSaving.set(false)});}toggleOverrides(){this.isOverridesExpanded.update(e=>!e),this.pendingDeleteKey.set(null);}pendingDeleteKey=zi(null);isPendingDelete(e){return this.pendingDeleteKey()===this.entryKey(e)}armDelete(e){e.id&&this.pendingDeleteKey.set(this.entryKey(e));}cancelDelete(){this.pendingDeleteKey.set(null);}confirmDelete(e){if(!e.id)return;this.pendingDeleteKey.set(null),(e.category==="integration"?this.integrationState.delete(e.id,"userGlobal"):e.category==="authSetting"?this.authSettingState.delete(e.id,"userGlobal"):this.providerState.delete(e.id,"userGlobal")).pipe(U(this.destroyRef)).subscribe({error:a=>{console.error(`[UserProfile] Delete failed for ${e.category}:${e.id}:`,a);}});}entryKey(e){return `${e.category}:${e.id}`}trackEntry(e,t){return this.entryKey(t)}syncFormFromState(){let e=this.currentUser();e&&this.form.setValue({firstname:e.firstname??"",lastname:e.lastname??"",bio:e.bio??"",preferredLanguage:e.preferredLanguage??"",promptCacheTtl:e.promptCacheTtl??"STANDARD"});}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=Nw({type:o,selectors:[["agentos-user-profile"]],decls:5,vars:1,consts:[["projectRootInput",""],["urlTemplateInput",""],["framed",""],["title","My profile"],[1,"ds-hint"],["heading","Appearance"],["label","Skin",3,"hint"],["label","Skin",3,"valueChange","options","value"],["label","Mode",3,"hint"],["label","Color mode",3,"valueChange","options","value"],["heading","Composer"],["label","Enter key","hint",'In "New line" mode, press Ctrl or Cmd + Enter to send.'],["label","Enter key behavior",3,"valueChange","options","value"],["heading","Case chat"],["label","Technical logs","hint","Show system log lines (agent status, tool selection...) in the case chat."],["label","Technical logs",3,"valueChange","options","value"],["heading","IDE links"],["label","IDE project root (absolute path)","controlId","ide-project-root","hint","Folder of the project on this machine. Relative file references in agent replies open from it."],["dsControl","","id","ide-project-root","type","text","placeholder","/Users/you/Workspace/project",3,"change","value"],["label","IDE URL template","controlId","ide-url-template","hint","Opens a file in IntelliJ IDEA. {file} is the URL-encoded absolute path, {line} and {column} the position."],["dsControl","","id","ide-url-template","type","text",3,"change","value"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["heading","Identity"],["dsDefinitionList",""],["heading","Profile"],["label","First name","controlId","up-firstname"],["dsControl","","id","up-firstname","type","text","placeholder","Your first name","formControlName","firstname","autocomplete","given-name"],["label","Last name","controlId","up-lastname"],["dsControl","","id","up-lastname","type","text","placeholder","Your last name","formControlName","lastname","autocomplete","family-name"],["label","Bio","controlId","up-bio"],["dsControl","","id","up-bio","placeholder","A short description about yourself","formControlName","bio","rows","4"],["label","Language","controlId","up-preferredLanguage"],["dsControl","","id","up-preferredLanguage","formControlName","preferredLanguage"],[3,"value"],["label","Prompt cache","controlId","up-promptCacheTtl","hintId","up-promptCacheTtl-hint","hint","Extended keeps the conversation cached through longer pauses (Claude models via Requesty: 1 hour instead of 5 minutes; each cache write costs more). Other models keep their provider's default."],["dsControl","","id","up-promptCacheTtl","aria-describedby","up-promptCacheTtl-hint","formControlName","promptCacheTtl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsButton","","variant","primary","type","button",3,"click"],[3,"toggled","heading","open"],[1,"ds-micro"],[1,"ds-list"],[1,"ds-row"],[1,"ds-strong","ds-row__grow"],[1,"ds-meta"],["dsButton","","variant","ghost","type","button"],[1,"ds-error"],["dsButton","","variant","danger","type","button",3,"click"],["dsButton","","variant","ghost","type","button",3,"click"]],template:function(t,a){if(t&1&&(Is(0,"ds-page",2),hg(1,"ds-section-header",3),Yw(2,xe,2,0,"p",4)(3,Me,20,13)(4,Fe,2,0,"p",4),ml()),t&2){let s;QE(2),Qw(a.isLoading()?2:(s=a.currentUser())?3:4,s);}},dependencies:[Kt,fd,Mo,Do,Ut,Qt,fo,go,Rn,Ea,vn,yn,fn,gn,hn,at,un,mn,ji,Ni],encapsulation:2})};export{Ce as UserProfileComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {i}from'./chunk-
|
|
1
|
+
import {i}from'./chunk-BSz21_Vu.js';import {y}from'./chunk-DNpsnpVA.js';import {g,aD as X,$ as Sr,at as _y,a1 as ma,a2 as ga,aa as _r,ad as ne,aC as Jy,O as x,M as w$1,a5 as Ed,aE as an,aF as Ot,aG as cn,a6 as A}from'./main-IUUK3O6C.js';var nt=["ApiKeyAuthSetting","BasicAuthAuthSetting","BearerTokenAuthSetting","OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"],it={ApiKeyAuthSetting:"API Key",BasicAuthAuthSetting:"Basic Auth (username / password)",BearerTokenAuthSetting:"Bearer Token",OAuthDiscoverableAuthSetting:"OAuth \u2014 Discovery URL",OAuthMcpDiscoverableAuthSetting:"OAuth \u2014 MCP Discoverable",OAuthCustomAuthSetting:"OAuth \u2014 Custom endpoints",OAuthRegisteredAuthSetting:"OAuth \u2014 Registered app"},R="none",w="me",b=2e3,M=15e4,P=3,L={ApiKeyAuthSetting:"API_KEY",BasicAuthAuthSetting:"BASIC_AUTH",BearerTokenAuthSetting:"BEARER_TOKEN",OAuthDiscoverableAuthSetting:"OAUTH_DISCOVERABLE",OAuthMcpDiscoverableAuthSetting:"OAUTH_MCP_DISCOVERABLE",OAuthCustomAuthSetting:"OAUTH_CUSTOM",OAuthRegisteredAuthSetting:"OAUTH_REGISTERED"},k={API_KEY:"ApiKeyAuthSetting",BASIC_AUTH:"BasicAuthAuthSetting",BEARER_TOKEN:"BearerTokenAuthSetting",OAUTH_DISCOVERABLE:"OAuthDiscoverableAuthSetting",OAUTH_MCP_DISCOVERABLE:"OAuthMcpDiscoverableAuthSetting",OAUTH_CUSTOM:"OAuthCustomAuthSetting",OAUTH_REGISTERED:"OAuthRegisteredAuthSetting"};function B(i){let t=L[i.authType];return t?x(w$1({},i),{authType:t}):i}function m(i){return U(i)}function f(i){return i.map(U)}function U(i){let t=i;if(typeof t.authType=="string"){let e=k[t.authType];if(e)return x(w$1({},t),{authType:e})}return i}function H(i,t){return t===null?true:i!==void 0&&Date.parse(i)>Date.parse(t)}var I=class i$1{controller=g(X);userState=g(y);refresh$=new Sr(void 0);namespaceId$=new Sr(null);vm$=_y([this.namespaceId$,this.refresh$]).pipe(ma(([t])=>{let e=this.loadPlatformSettings().pipe(ga(()=>_r([])));return t?_y([e,this.loadNamespaceSettings(t).pipe(ga(()=>_r([]))),this.loadUserSettings(t).pipe(ga(()=>_r([]))),this.loadUserSettings("global").pipe(ga(()=>_r([])))]).pipe(ne(([n,o,r,h])=>({platform:n,namespace:o,userOnNs:r,userGlobal:h}))):_y([e,this.loadNamespaceSettings("").pipe(ga(()=>_r([]))),this.loadUserSettings("global").pipe(ga(()=>_r([])))]).pipe(ne(([n,o,r])=>({platform:n,namespace:o,userOnNs:[],userGlobal:r})))}),Jy({bufferSize:1,refCount:true}));setNamespace(t){this.namespaceId$.value!==t&&this.namespaceId$.next(t);}refresh(){this.refresh$.next();}loadUserSettings(t){let e=t==="global"?R:t;return this.controller.listAuthSetting(e,w).pipe(ne(n=>f(n)))}userGlobal$=i(this.refresh$,()=>this.loadUserSettings("global"),[]);loadPlatformSettings(){return this.controller.listAuthSetting(R).pipe(ne(t=>f(t)))}loadNamespaceSettings(t){return t?this.controller.listAuthSetting(t).pipe(ne(e=>f(e))):_r([])}getById(t,e){return this.controller.getByIdAuthSetting(t).pipe(ne(n=>m(n)))}create(t,e,n){let r=this.userState.currentUser()?.id;if((e==="userOnNs"||e==="userGlobal")&&!r)throw new Error(`Cannot create ${e} auth setting before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(e==="namespace"&&(n===void 0||n===""))throw new Error("Cannot create namespace-scoped auth setting without a namespaceId");if(e==="userOnNs"&&!n)throw new Error("Cannot create userOnNs auth setting without a namespaceId");let h=B(x(w$1({},t),{namespaceId:e==="namespace"||e==="userOnNs"?n??void 0:void 0,userId:e==="userOnNs"||e==="userGlobal"?r:void 0}));return this.controller.createAuthSetting(h).pipe(ne(A=>m(A)),Ed(()=>this.refresh()))}update(t,e,n){let o=B(x(w$1({},e),{namespaceId:n.namespaceId,userId:n.userId,authType:n.authType}));return this.controller.updateAuthSetting(t,o).pipe(ne(r=>m(r)),Ed(()=>this.refresh()))}delete(t,e){return this.controller.deleteAuthSetting(t).pipe(Ed(()=>this.refresh()))}getConnection(t,e){return this.controller.getConnectionAuthSetting(t,e)}resetCredential(t,e){return this.controller.resetMyCredentialAuthSetting(t,e)}connect(t,e,n,o){return this.getConnection(t,e).pipe(ma(r=>this.controller.connectAuthSetting(t,e).pipe(Ed(h=>n(h.authorizationUrl)),ma(()=>this.awaitNewConnection(t,e,r.connected?r.connectedAt??null:null,o)))))}awaitNewConnection(t,e,n,o){let r=0,h=0;return an(b,b).pipe(ma(()=>this.getConnection(t,e).pipe(ga(()=>_r(null)))),ne(A=>(r++,A?.connected&&H(A.connectedAt,n)?"connected":r*b>=M?"timeout":o()&&++h>=P?"abandoned":null)),Ot(A=>A!==null),cn(1))}static \u0275fac=function(e){return new(e||i$1)};static \u0275prov=A({token:i$1,factory:i$1.\u0275fac,providedIn:"root"})};export{I,it as i,nt as n};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {o as o$1,r,i,l}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-DXhOdsyd.js';import {O}from'./chunk-DNO_UKkx.js';import {g,W,F as F$1,K as we,ag as U,ay as N,z as zi,az as Q,a8 as _,j as mT,a9 as F$2,aA as Me,U as U$1,a2 as ga,aa as _r,ac as Ny,ad as ne,O as x,M as w,N as Nw,au as $t,I as Is,R as Eg,H as HC,m as ml,Y as Yw,Q as QE,P as pg,b as Qw,p as dC,s as sC,a as hg,S as BI,T as HI,i as fg,o as Il,J as Jw,k as eC,L as Lg,q as mf,r as yf,as as jg}from'./main-OLEL3JTU.js';import {H as A,p as pt$1,T as Te,b as bn,I as E,K as Kt,a as fd,M as Mo,D as Do,U as Ut,P as Pn,o as Mn,Q as Qt,c as fo,g as go,t as ta,Z as Zr,N as Nn,R as Rn,v as vn,d as yn,e as fn,l as pn,h as hn,_ as _n,i as at$1,u as un,n as cn,A as Ao}from'./chunk-anaDHfEv.js';import'./chunk-C7Y0YglE.js';var F="*";function Be(n){return (n??[]).some(t=>t.trim()===F)}function $e(n){let t=(n??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==F).map(e=>e.toLowerCase());return new Set(t)}function j(n){return n.includes(F)}function He(n){let t=n.replace(/[\\.[\]{}()^$|]/g,"\\$&").replace(/\*/g,".*");try{return new RegExp(`^${t}$`,"i")}catch(e){return null}}function Y(n,t){return (t??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==F&&j(e)).some(e=>He(e)?.test(n)??false)}var Ge="AGENTOS_CONFIG",Je=new Set(["HTTP_API","MCP_HTTP","MCP_STDIO","BASH","TMUX","GIT"]);function Ue(n){return n.configEnabled&&(n.hasSubAgents||n.integrationTypes.some(t=>Je.has(t)))}var je=(n,t)=>t.value,Ye=(n,t)=>t.config.id,qe=(n,t)=>t.type,We=(n,t)=>t.selector;function ze(n,t){if(n&1&&(Is(0,"a",2),HC(1,"View resolved definition \u2192"),ml()),n&2){let e=dC();pg("routerLink",e.inspectRoute());}}function Xe(n,t){n&1&&(Is(0,"ds-tag",3),HC(1,"Platform level"),ml());}function Qe(n,t){n&1&&(Is(0,"p",4),HC(1,"Loading\u2026"),ml());}function Ze(n,t){if(n&1&&(hg(0,"input",17),BI()),n&2){let e=dC(2);pg("formControl",e.modelNameControl),HI();}}function et(n,t){if(n&1&&(Is(0,"option",41),HC(1),ml()),n&2){let e=t;pg("ngValue",e.value),QE(),Lg(e.label);}}function tt(n,t){if(n&1&&(Is(0,"option",41),HC(1),ml()),n&2){let e=t.$implicit;pg("ngValue",e.value),QE(),Lg(e.label);}}function nt(n,t){if(n&1&&(Is(0,"optgroup",42),Jw(1,tt,2,2,"option",41,je),ml()),n&2){let e=dC(3);QE(),eC(e.modelOptions().aliases);}}function it(n,t){if(n&1&&(Is(0,"option",41),HC(1),ml()),n&2){let e=t.$implicit;pg("ngValue",e.value),QE(),Lg(e.label);}}function ot(n,t){if(n&1&&(Is(0,"optgroup",43),Jw(1,it,2,2,"option",41,je),ml()),n&2){let e=dC(3);QE(),eC(e.modelOptions().apiNames);}}function at(n,t){if(n&1&&(Is(0,"select",18)(1,"option",40),HC(2,"Select a model"),ml(),Yw(3,et,2,2,"option",41),Yw(4,nt,3,0,"optgroup",42),Yw(5,ot,3,0,"optgroup",43),ml(),BI()),n&2){let e,i=dC(2);pg("formControl",i.modelNameControl),HI(),QE(),pg("ngValue",null),QE(2),Qw((e=i.modelOptions().current)?3:-1,e),QE(),Qw(i.modelOptions().aliases.length>0?4:-1),QE(),Qw(i.modelOptions().apiNames.length>0?5:-1);}}function lt(n,t){if(n&1&&(Is(0,"span",44),HC(1),ml()),n&2){let e=dC().$implicit;QE(),Lg(e.config.integrationType);}}function rt(n,t){if(n&1&&(hg(0,"input",45),BI()),n&2){let e=dC().$implicit;pg("formControl",e.toolsControl),fg("aria-label","Tools of "+e.config.name),HI();}}function st(n,t){if(n&1){let e=sC();Is(0,"div",10)(1,"label",11)(2,"input",23),Eg("change",function(){let s=mf(e).$implicit,c=dC(3);return yf(c.toggleIntegration(s))}),ml(),Is(3,"span",24),HC(4),ml(),Yw(5,lt,2,1,"span",44),ml(),Yw(6,rt,1,2,"input",45),ml();}if(n&2){let e=t.$implicit;QE(2),pg("checked",e.enabled()),QE(2),Lg(e.config.name),QE(),Qw(e.config.integrationType?5:-1),QE(),Qw(e.enabled()?6:-1);}}function dt(n,t){if(n&1&&(Is(0,"p",13),HC(1),ml()),n&2){let e=dC().$implicit;QE(),Il(" Restricted to: ",e.restrictedTools.join(", ")," (set outside this form, preserved on save) ");}}function ct(n,t){if(n&1){let e=sC();Is(0,"div",10)(1,"label",24),HC(2),Is(3,"span",44),HC(4,"built-in"),ml()(),Is(5,"select",47),Eg("change",function(s){let c=mf(e).$implicit,C=dC(4);return yf(C.setBuiltInState(c,s.target.value))}),Is(6,"option",48),HC(7),ml(),Is(8,"option",49),HC(9,"Enabled"),ml(),Is(10,"option",50),HC(11,"Disabled"),ml()(),Yw(12,dt,2,1,"p",13),Is(13,"p",13),HC(14),ml()();}if(n&2){let e=t.$implicit,i=dC(4);QE(),fg("for","built-in-"+e.type),QE(),Il(" ",e.displayName," "),QE(3),pg("id","built-in-"+e.type)("value",e.state()),QE(2),Lg(i.builtInDefaultLabel(e)),QE(5),Qw(e.state()==="on"&&e.restrictedTools?12:-1),QE(2),Lg(e.description);}}function mt(n,t){if(n&1&&(Is(0,"span",46),HC(1,"Built-in integrations"),ml(),Jw(2,ct,15,7,"div",10,qe)),n&2){let e=dC(3);QE(2),eC(e.builtInRows());}}function ut(n,t){n&1&&(Is(0,"ds-notice",26),HC(1," This agent can read the AgentOS configuration and also has a network integration or sub-agents: what it reads could be sent outside without any confirmation. Prefer a dedicated configuration agent without them. "),ml());}function gt(n,t){if(n&1&&(Is(0,"ds-fieldset",21),Jw(1,st,7,4,"div",10,Ye),Yw(3,mt,4,0),Yw(4,ut,2,0,"ds-notice",26),ml()),n&2){let e=dC(2);QE(),eC(e.integrationRows()),QE(2),Qw(e.builtInRows().length>0?3:-1),QE(),Qw(e.configAgentExposureWarning()?4:-1);}}function pt(n,t){n&1&&HC(0," A platform config can only list platform skills here: namespace skills are resolved per namespace when the agent runs. ");}function ft(n,t){n&1&&(Is(0,"ds-notice",26),HC(1," Saving with this on replaces the selection below with "),Is(2,"code",25),HC(3,"*"),ml(),HC(4,". "),ml());}function Ct(n,t){n&1&&(Is(0,"ds-notice"),HC(1," The skill catalogue could not be loaded. What this agent already declares is listed below and preserved on save. "),ml());}function _t(n,t){n&1&&(Is(0,"p",4),HC(1,"No skill available in this scope yet."),ml());}function bt(n,t){n&1&&(Is(0,"span",44),HC(1,"platform"),ml());}function ht(n,t){if(n&1&&(Is(0,"span",44),HC(1),ml()),n&2){let e=dC(4);QE(),Il(" ",e.skillCatalogueUnavailable()?"not verified":"no matching skill"," ");}}function yt(n,t){if(n&1&&(Is(0,"p",13),HC(1),ml()),n&2){let e=dC().$implicit;QE(),Lg(e.description);}}function vt(n,t){if(n&1){let e=sC();Is(0,"div",10)(1,"label",11)(2,"input",51),Eg("change",function(){let s=mf(e).$implicit,c=dC(3);return yf(c.toggleSkill(s))}),ml(),Is(3,"span",24),HC(4),ml(),Yw(5,bt,2,0,"span",44),Yw(6,ht,2,1,"span",44),ml(),Yw(7,yt,2,1,"p",13),ml();}if(n&2){let e=t.$implicit,i=dC(3);QE(2),pg("checked",e.selected())("disabled",i.allSkillsSelected()),QE(2),Lg(e.name),QE(),Qw(e.platform?5:-1),QE(),Qw(e.unresolved?6:-1),QE(),Qw(e.description?7:-1);}}function xt(n,t){if(n&1&&Jw(0,vt,8,6,"div",10,We),n&2){let e=dC(2);eC(e.skillRows());}}function St(n,t){if(n&1&&(Is(0,"ds-form-field",30),hg(1,"textarea",52),BI(),Is(2,"p",4),HC(3," Default payload for this loop agent. Overridden at launch time if the first message contains a valid "),Is(4,"code"),HC(5,"AgentLoopPayload"),ml(),HC(6,". Leave empty if you always provide the payload at launch. "),ml()()),n&2){let e=dC(2);pg("error",e.loopConfigControl.invalid&&e.loopConfigControl.touched?"Invalid JSON \u2014 please fix the syntax.":null),QE(),pg("placeholder",e.loopConfigPlaceholder)("formControl",e.loopConfigControl),HI();}}function At(n,t){n&1&&HC(0," A platform config can only list platform agents here: a namespace's agents are resolved per namespace when the agent runs. ");}function wt(n,t){if(n&1&&HC(0),n&2){let e=dC(3);jg(" That deletes ",e.droppedUnresolvedSubAgents()," flagged ",e.droppedUnresolvedSubAgents()===1?"selector":"selectors"," nothing matched, which this form cannot restore. ");}}function Et(n,t){if(n&1&&(Is(0,"ds-notice",26),HC(1," Saving with this on replaces the selection below with "),Is(2,"code",25),HC(3,"*"),ml(),HC(4,". "),Yw(5,wt,1,2),ml()),n&2){let e=dC(2);QE(5),Qw(e.droppedUnresolvedSubAgents()>0?5:-1);}}function Tt(n,t){n&1&&(Is(0,"ds-notice"),HC(1," The list of agents could not be loaded. What this agent already declares is listed below and preserved on save. "),ml());}function kt(n,t){n&1&&(Is(0,"p",4),HC(1,"No other agent is available in this scope yet."),ml());}function It(n,t){n&1&&(Is(0,"span",44),HC(1,"pattern"),ml());}function Rt(n,t){n&1&&(Is(0,"span",44),HC(1,"via pattern"),ml());}function Mt(n,t){if(n&1&&(Is(0,"span",44),HC(1),ml()),n&2){let e=dC(4);QE(),Il(" ",e.subAgentCandidatesUnavailable()?"not verified":"no matching agent"," ");}}function Ft(n,t){if(n&1){let e=sC();Is(0,"button",55),Eg("click",function(){mf(e);let s=dC().$implicit,c=dC(3);return yf(c.removeSubAgent(s))}),HC(1," \xD7 "),ml();}if(n&2){let e=dC().$implicit;fg("aria-label","Remove "+e.selector);}}function Nt(n,t){if(n&1){let e=sC();Is(0,"div",32)(1,"label",53)(2,"input",51),Eg("change",function(){let s=mf(e).$implicit,c=dC(3);return yf(c.toggleSubAgent(s))}),ml(),Is(3,"span",24),HC(4),ml(),Yw(5,It,2,0,"span",44)(6,Rt,2,0,"span",44)(7,Mt,2,1,"span",44),ml(),Yw(8,Ft,2,1,"button",54),ml();}if(n&2){let e=t.$implicit,i=dC(3);QE(2),pg("checked",e.selected())("disabled",i.allSubAgentsSelected()),QE(2),Lg(e.name),QE(),Qw(e.pattern?5:e.grantedByPattern?6:e.unresolved?7:-1),QE(3),Qw(e.unresolved?8:-1);}}function Dt(n,t){if(n&1&&Jw(0,Nt,9,5,"div",32,We),n&2){let e=dC(2);eC(e.subAgentRows());}}function Lt(n,t){if(n&1){let e=sC();Is(0,"div")(1,"button",56),Eg("click",function(){mf(e);let s=dC(2);return yf(s.useDefaultDelegationTimeout())}),HC(2," Use server default "),ml()();}}function Vt(n,t){n&1&&(Is(0,"ds-notice"),HC(1),ml()),n&2&&(QE(),Lg(t));}function Pt(n,t){if(n&1){let e=sC();Is(0,"button",57),Eg("click",function(){mf(e);let s=dC(2);return yf(s.exportYaml())}),HC(1),ml();}if(n&2){let e=dC(2);pg("disabled",e.isExporting()),QE(),Il(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ot(n,t){if(n&1){let e=sC();Is(0,"form",6),Eg("ngSubmit",function(){mf(e);let s=dC();return yf(s.submit())}),Is(1,"ds-fieldset",7)(2,"ds-form-field",8),hg(3,"input",9),BI(),ml(),Is(4,"div",10)(5,"label",11),hg(6,"input",12),BI(),HC(7," Enabled "),ml(),Is(8,"p",13),HC(9,"Disabled agents are excluded from namespace resolution."),ml()(),Is(10,"ds-form-field",14),hg(11,"input",15),BI(),ml(),Is(12,"ds-form-field",16),Yw(13,Ze,1,1,"input",17)(14,at,6,5,"select",18),ml(),Is(15,"ds-form-field",19),hg(16,"textarea",20),BI(),ml()(),Yw(17,gt,5,2,"ds-fieldset",21),Is(18,"ds-fieldset",22)(19,"p",4),HC(20," Instruction bundles this agent can read on demand. Selecting at least one grants it the "),Is(21,"code"),HC(22,"readSkill"),ml(),HC(23," and "),Is(24,"code"),HC(25,"readSkillResource"),ml(),HC(26," tools; selecting none grants neither. "),Yw(27,pt,1,0),ml(),Is(28,"label",11)(29,"input",23),Eg("change",function(){mf(e);let s=dC();return yf(s.toggleAllSkills())}),ml(),Is(30,"span",24),HC(31,"Every skill in the catalogue ("),Is(32,"code",25),HC(33,"*"),ml(),HC(34,")"),ml()(),Is(35,"p",13),HC(36," Resolved at run time, so skills added later are granted too, without editing this agent. "),ml(),Yw(37,ft,5,0,"ds-notice",26),Yw(38,Ct,2,0,"ds-notice"),Yw(39,_t,2,0,"p",4)(40,xt,2,0),ml(),Is(41,"ds-form-field",27)(42,"select",28)(43,"option",29),HC(44,"SIMPLE \u2014 Standard agent (single LLM call)"),ml(),Is(45,"option",29),HC(46,"ADVANCED \u2014 Multi-step reasoning loop"),ml(),Is(47,"option",29),HC(48,"LOOP \u2014 Bulk loop agent (no LLM, experimental)"),ml()(),BI(),ml(),Yw(49,St,7,3,"ds-form-field",30),Is(50,"ds-fieldset",31)(51,"p",4),HC(52," The agents this one may delegate to. Selecting at least one grants it the "),Is(53,"code"),HC(54,"DELEGATE__delegate"),ml(),HC(55," tool; selecting none grants it no way to delegate. Entries are matched against agent names, never ids. "),Yw(56,At,1,0),ml(),Is(57,"label",11)(58,"input",23),Eg("change",function(){mf(e);let s=dC();return yf(s.toggleAllSubAgents())}),ml(),Is(59,"span",24),HC(60,"Every agent it can reach ("),Is(61,"code",25),HC(62,"*"),ml(),HC(63,")"),ml()(),Is(64,"p",13),HC(65," Resolved at run time, so agents added later can be delegated to as well, without editing this agent. "),ml(),Yw(66,Et,6,1,"ds-notice",26),Yw(67,Tt,2,0,"ds-notice"),Yw(68,kt,2,0,"p",4)(69,Dt,2,0),Is(70,"p",4),HC(71," Advanced \u2014 add a glob instead of picking a name, for example "),Is(72,"code"),HC(73,"*Fixer"),ml(),HC(74," to cover BugFixer and StoryFixer. "),ml(),Is(75,"div",32)(76,"input",33),Eg("keydown.enter",function(){mf(e);let s=dC();return yf(s.addSubAgent())}),ml(),BI(),Is(77,"button",34),Eg("click",function(){mf(e);let s=dC();return yf(s.addSubAgent())}),HC(78," + "),ml()(),Is(79,"ds-form-field",35),hg(80,"input",36),BI(),Yw(81,Lt,3,0,"div"),ml()(),Yw(82,Vt,2,1,"ds-notice"),Is(83,"ds-form-actions")(84,"button",37),HC(85),ml(),Yw(86,Pt,2,2,"button",38),Is(87,"button",39),Eg("click",function(){mf(e);let s=dC();return yf(s.cancel())}),HC(88,"Cancel"),ml()()();}if(n&2){let e,i=dC();pg("formGroup",i.form),QE(3),pg("formControl",i.nameControl),HI(),QE(3),pg("formControl",i.enabledControl),HI(),QE(5),pg("formControl",i.descriptionControl),HI(),QE(2),Qw(i.modelAsFreeText()?13:14),QE(3),pg("formControl",i.instructionsControl),HI(),QE(),Qw(i.integrationRows().length>0||i.builtInRows().length>0?17:-1),QE(10),Qw(i.isPlatformMode?27:-1),QE(2),pg("checked",i.allSkillsSelected()),QE(8),Qw(i.namedSkillSelectionDropped()?37:-1),QE(),Qw(i.skillCatalogueUnavailable()?38:-1),QE(),Qw(i.skillRows().length===0?39:40),QE(3),pg("formControl",i.executionModeControl),HI(),QE(),pg("value",i.ExecutionMode.SIMPLE),QE(2),pg("value",i.ExecutionMode.ADVANCED),QE(2),pg("value",i.ExecutionMode.LOOP),QE(2),Qw(i.isLoopMode()?49:-1),QE(7),Qw(i.isPlatformMode?56:-1),QE(2),pg("checked",i.allSubAgentsSelected()),QE(8),Qw(i.namedSubAgentSelectionDropped()?66:-1),QE(),Qw(i.subAgentCandidatesUnavailable()?67:-1),QE(),Qw(i.subAgentRows().length===0?68:69),QE(8),pg("formControl",i.newSubAgentControl),HI(),QE(),pg("disabled",!i.newSubAgentControl.value.trim()),QE(2),pg("hint",i.delegationTimeoutHint())("error",i.delegationTimeoutControl.invalid?"Enter a valid positive whole number of seconds, or leave empty to inherit the server default.":null),QE(),pg("formControl",i.delegationTimeoutControl),fg("aria-invalid",i.delegationTimeoutControl.invalid),HI(),QE(),Qw(i.delegationTimeoutControl.value!==null?81:-1),QE(),Qw((e=i.submitError())?82:-1,e),QE(2),pg("disabled",i.form.invalid||i.isSubmitting()),QE(),Il(" ",i.isEditMode()?"Save changes":"Create"," "),QE(),Qw(i.isEditMode()?86:-1);}}var Ke=class n{route=g(W);router=g(F$1);destroyRef=g(we);agentConfigController=g(U);defaultsController=g(N);defaultDelegationTimeoutSeconds=zi(null);exportService=g(Q);integrationConfigState=g(O);integrationTypeController=g(_);skillState=g(o);aiModelState=g(A);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt$1({name:new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te(null),modelName:new Te(null,{validators:[bn.required,n.notBlankValidator]}),instructions:new Te(null),executionMode:new Te("SIMPLE",{nonNullable:true}),delegationTimeoutSeconds:new Te(null,{validators:[bn.min(1),bn.max(2147483647),bn.pattern(/^\d+$/)]}),enabled:new Te(false,{nonNullable:true}),loopConfig:new Te(null,{validators:[n.jsonValidator]})});static notBlankValidator(t){let e=t.value;return typeof e=="string"&&e.length>0&&e.trim().length===0?{required:true}:null}static jsonValidator(t){let e=t.value?.trim();if(!e)return null;try{return JSON.parse(e),null}catch(i){return {invalidJson:true}}}get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get modelNameControl(){return this.form.controls.modelName}get instructionsControl(){return this.form.controls.instructions}get executionModeControl(){return this.form.controls.executionMode}get delegationTimeoutControl(){return this.form.controls.delegationTimeoutSeconds}useDefaultDelegationTimeout(){this.delegationTimeoutControl.setValue(null),this.delegationTimeoutControl.markAsDirty();}delegationTimeoutHint=mT(()=>{let t=this.defaultDelegationTimeoutSeconds();return `How long each delegation launched by this agent waits without activity from the sub-agent, including its own delegations. When it runs out, the sub-agent and its active descendants are stopped and can be resumed. Leave empty to use the server default${t!==null?`: ${t} s (${t/60} min)`:""}.`});get enabledControl(){return this.form.controls.enabled}get loopConfigControl(){return this.form.controls.loopConfig}executionModeValue=F$2(this.form.controls.executionMode.valueChanges,{initialValue:this.form.controls.executionMode.value});isLoopMode=mT(()=>this.executionModeValue()==="LOOP");subAgentRows=zi([]);allSubAgentsSelected=zi(false);subAgentCandidatesUnavailable=zi(false);namedSubAgentSelectionDropped=mT(()=>this.allSubAgentsSelected()&&this.subAgentRows().some(t=>t.selected()));droppedUnresolvedSubAgents=mT(()=>this.allSubAgentsSelected()?this.subAgentRows().filter(t=>t.unresolved&&t.selected()).length:0);hasAnySubAgent=mT(()=>this.allSubAgentsSelected()||this.subAgentRows().some(t=>t.selected()));newSubAgentControl=new Te("",{nonNullable:true});isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);isExporting=zi(false);submitError=zi(null);ExecutionMode=Me;loopConfigPlaceholder=JSON.stringify({search:{tool:"SearchTalents",params:{talentId:["6ac76692a909eaaae0b078d6"],resolveTargets:["MANAGER"],next:null}},act:{agentName:"ProfileCaretaker",promptTemplate:"This talent has not completed their profile. As their manager, I need you to help me review and improve it."}},null,2);builtInRows=zi([]);inspectRoute(){let t=this.route.snapshot.paramMap.get("agentConfigId")??"";return this.isPlatformMode?["/agentos","admin","agent-configs",t,"inspect"]:["/agentos",this.namespaceId,"agent-configs",t,"inspect"]}configAgentExposureWarning=mT(()=>Ue({configEnabled:this.builtInRows().some(t=>t.type===Ge&&t.state()==="on"),integrationTypes:this.integrationRows().filter(t=>t.enabled()).map(t=>t.config.integrationType),hasSubAgents:this.hasAnySubAgent()}));modelOptions=zi({aliases:[],apiNames:[],current:null});modelCatalogueLoaded=zi(false);modelAsFreeText=mT(()=>{let{aliases:t,apiNames:e}=this.modelOptions();return this.modelCatalogueLoaded()&&t.length+e.length===0});applyModelCatalogue(t,e){this.modelOptions.set(E(t,e)),this.modelCatalogueLoaded.set(true);}integrationRows=zi([]);skillRows=zi([]);allSkillsSelected=zi(false);skillCatalogueUnavailable=zi(false);namedSkillSelectionDropped=mT(()=>this.allSkillsSelected()&&this.skillRows().some(t=>t.selected()));existingConfig=null;ngOnInit(){this.defaultsController.getAgentConfigDefaults().pipe(U$1(this.destroyRef),ga(()=>_r(null))).subscribe(e=>this.defaultDelegationTimeoutSeconds.set(e?.delegationTimeoutSeconds??null));let t=this.route.snapshot.paramMap.get("agentConfigId");t?(this.isEditMode.set(true),this.loadConfigAndIntegrations(t)):this.loadIntegrations(void 0);}loadConfigAndIntegrations(t){this.isLoading.set(true),Ny({config:this.agentConfigController.getByIdAgentConfig(t),namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):_r([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes(),skillCatalogue:this.loadSkillCatalogue(),delegationCandidates:this.loadDelegationCandidates(),models:this.aiModelState.listAvailable(this.namespaceId)}).pipe(U$1(this.destroyRef)).subscribe({next:({config:e,namespaceIntegrations:i,platformIntegrations:s,builtInTypes:c,skillCatalogue:C,delegationCandidates:E,models:T})=>{this.existingConfig=e,this.applyModelCatalogue(T,e.modelName??null),this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.modelNameControl.setValue(e.modelName??null),this.instructionsControl.setValue(e.instructions??null);let f=e.executionMode??(e.advancedExecution?"ADVANCED":"SIMPLE");this.executionModeControl.setValue(f),this.delegationTimeoutControl.setValue(e.delegationTimeoutSeconds??null),this.enabledControl.setValue(e.enabled??true),this.loopConfigControl.setValue(e.loopConfig!=null?JSON.stringify(e.loopConfig,null,2):null);let N=[...s,...i];this.integrationRows.set(this.buildIntegrationRows(N,e.integrations??void 0)),this.builtInRows.set(this.buildBuiltInRows(c,e.integrations??void 0)),this.allSubAgentsSelected.set(Be(e.subAgents)),this.subAgentRows.set(this.buildSubAgentRows(E,e.subAgents,e.name)),this.allSkillsSelected.set(o$1(e.skillSelectors)),this.skillRows.set(this.buildSkillRows(C,e.skillSelectors)),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadIntegrations(t){Ny({namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):_r([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes(),skillCatalogue:this.loadSkillCatalogue(),delegationCandidates:this.loadDelegationCandidates(),models:this.aiModelState.listAvailable(this.namespaceId)}).pipe(U$1(this.destroyRef)).subscribe({next:({namespaceIntegrations:e,platformIntegrations:i,builtInTypes:s,skillCatalogue:c,delegationCandidates:C,models:E})=>{this.applyModelCatalogue(E,null);let T=[...i,...e];this.integrationRows.set(this.buildIntegrationRows(T,t??void 0)),this.builtInRows.set(this.buildBuiltInRows(s,t??void 0)),this.allSubAgentsSelected.set(false),this.subAgentRows.set(this.buildSubAgentRows(C,void 0,null)),this.allSkillsSelected.set(false),this.skillRows.set(this.buildSkillRows(c,void 0));}});}loadSkillCatalogue(){return (this.namespaceId?this.skillState.listEffective(this.namespaceId):this.skillState.listPlatform().pipe(ne(e=>e.map(i=>({id:i.id??"",name:i.name,description:i.description,namespaceId:i.namespaceId??null,readOnly:i.readOnly===true}))))).pipe(ga(e=>(console.error("[agent-config-form] failed to load the skill catalogue",e),this.skillCatalogueUnavailable.set(true),_r([]))))}buildSkillRows(t,e){let s=(e??[]).map(f=>f.trim()).filter(f=>f.length>0).filter(f=>f!==r),c=i(s),C=new Set(t.map(f=>f.name.toLowerCase())),E=t.map(f=>({selector:f.name,name:f.name,description:f.description,platform:f.namespaceId==null,unresolved:false,selected:zi(c.has(f.name.toLowerCase()))})),T=new Set;for(let f of s){let N=l(f).toLowerCase();C.has(N)||T.has(N)||(T.add(N),E.push({selector:f,name:f,description:"",platform:false,unresolved:true,selected:zi(true)}));}return E}toggleSkill(t){t.selected.update(e=>!e);}toggleAllSkills(){this.allSkillsSelected.update(t=>!t);}buildSkillSelectorsPayload(){if(this.allSkillsSelected())return [r];let t=this.skillRows().filter(e=>e.selected()).map(e=>e.selector);return t.length>0?t:void 0}loadDelegationCandidates(){let t=this.agentConfigController.listPlatformAgentsAgentConfig(false).pipe(this.orNoCandidates()),e=this.namespaceId?this.agentConfigController.listByParentAgentConfig(this.namespaceId,false).pipe(this.orNoCandidates()):_r([]);return Ny({platform:t,namespace:e}).pipe(ne(({platform:i,namespace:s})=>[...i,...s]),ne(i=>i.map(s=>s.name).filter(s=>s.length>0)),ne(i=>n.dedupeByKey(i)))}orNoCandidates(){return ga(t=>(console.error("[agent-config-form] failed to load the delegation candidates",t),this.subAgentCandidatesUnavailable.set(true),_r([])))}static dedupeByKey(t){let e=new Set;return t.filter(i=>{let s=i.toLowerCase();return e.has(s)?false:(e.add(s),true)})}buildSubAgentRows(t,e,i){let s=$e(e),c=i?.toLowerCase()??null,C=t.filter(_=>{let O=_.toLowerCase();return O!==c||s.has(O)}),E=new Set(C.map(_=>_.toLowerCase())),T=C.map(_=>({selector:_,name:_,unresolved:false,pattern:false,grantedByPattern:Y(_,e),selected:zi(s.has(_.toLowerCase()))})),f=new Set,N=(e??[]).map(_=>_.trim()).filter(_=>_.length>0&&_!==F);for(let _ of N){let O=_.toLowerCase();E.has(O)||f.has(O)||(f.add(O),T.push({selector:_,name:_,unresolved:true,pattern:j(_),grantedByPattern:false,selected:zi(true)}));}return T}loadBuiltInTypes(){return this.integrationTypeController.listTypesIntegrationType().pipe(ne(t=>t.filter(e=>!e.configSchema)),ga(t=>(console.error("[agent-config-form] failed to load integration types",t),_r([]))))}buildIntegrationRows(t,e){return t.map(i=>{let s=i.name??"",c=e?.[s],C=e!=null&&s in e,E=Array.isArray(c)?c.join(", "):"";return {config:i,enabled:zi(C),toolsControl:new Te(E,{nonNullable:true})}})}buildBuiltInRows(t,e){return t.map(i=>{let s=e!=null&&i.type in e,c=e?.[i.type],C=s?Array.isArray(c)&&c.length===0?"off":"on":"default";return {type:i.type,displayName:i.displayName,description:i.description,enabledByDefault:i.enabledByDefault===true,state:zi(C),restrictedTools:Array.isArray(c)&&c.length>0?c:null}})}toggleIntegration(t){t.enabled.update(e=>!e);}setBuiltInState(t,e){t.state.set(e);}builtInDefaultLabel(t){return t.enabledByDefault?"Platform default (enabled)":"Platform default (disabled)"}addSubAgent(){let t=this.newSubAgentControl.value.trim();if(!t)return;let e=this.subAgentRows().find(i=>i.selector.toLowerCase()===t.toLowerCase());e?e.selected.set(true):t===F?this.allSubAgentsSelected.set(true):this.subAgentRows.update(i=>this.withPatternGrants([...i,{selector:t,name:t,unresolved:true,pattern:j(t),grantedByPattern:false,selected:zi(true)}])),this.newSubAgentControl.reset("");}removeSubAgent(t){let e=t.selector.toLowerCase();this.subAgentRows.update(i=>this.withPatternGrants(i.filter(s=>s.selector.toLowerCase()!==e)));}toggleSubAgent(t){t.selected.update(e=>!e),t.pattern&&this.subAgentRows.update(e=>this.withPatternGrants(e));}withPatternGrants(t){let e=this.allSubAgentsSelected()?[]:t.filter(i=>i.selected()).map(i=>i.selector);return t.map(i=>i.unresolved?i:x(w({},i),{grantedByPattern:Y(i.name,e)}))}toggleAllSubAgents(){this.allSubAgentsSelected.update(t=>!t),this.subAgentRows.update(t=>this.withPatternGrants(t));}buildSubAgentsPayload(){if(this.allSubAgentsSelected())return [F];let t=this.subAgentRows().filter(e=>e.selected()).map(e=>e.selector);return t.length>0?t:void 0}buildIntegrationsPayload(){let t={};for(let i of this.integrationRows().filter(s=>s.enabled())){let s=i.config.name??"",c=i.toolsControl.value.trim();t[s]=c===""?null:c.split(",").map(C=>C.trim()).filter(C=>C.length>0);}for(let i of this.builtInRows()){let s=i.state();s==="on"?t[i.type]=i.restrictedTools??null:s==="off"&&(t[i.type]=[]);}let e=new Set([...this.integrationRows().map(i=>i.config.name??""),...this.builtInRows().map(i=>i.type)]);for(let[i,s]of Object.entries(this.existingConfig?.integrations??{}))e.has(i)||(t[i]=s);return Object.keys(t).length>0?t:void 0}submit(){if(this.form.invalid||this.isSubmitting())return;this.addSubAgent(),this.submitError.set(null),this.isSubmitting.set(true);let t=x(w({},this.existingConfig??{}),{createdOn:this.existingConfig?.createdOn,updatedOn:this.existingConfig?.updatedOn,namespaceId:this.namespaceId,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,modelName:this.modelNameControl.value?.trim()||void 0,instructions:this.instructionsControl.value?.trim()||void 0,integrations:this.buildIntegrationsPayload(),executionMode:this.executionModeControl.value,advancedExecution:this.executionModeControl.value==="ADVANCED",enabled:this.enabledControl.value,subAgents:this.buildSubAgentsPayload(),skillSelectors:this.buildSkillSelectorsPayload(),delegationTimeoutSeconds:this.delegationTimeoutControl.value,loopConfig:this.buildLoopConfigPayload()});(this.isEditMode()?this.agentConfigController.updateAgentConfig(this.existingConfig.id??"",t):this.agentConfigController.createAgentConfig(t)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:i=>{this.isSubmitting.set(false),this.submitError.set(n.serverMessage(i));}});}static serverMessage(t){let i=t?.error?.message;if(typeof i=="string"&&i.trim().length>0)return i;let s=t?.status;return s===0?"The server could not be reached. The agent was not saved.":typeof s=="number"&&s>=500?`The server failed to save the agent (HTTP ${s}). Nothing was changed.`:"The server refused the save and gave no reason. Check the values and try again."}exportYaml(){let t=this.existingConfig?.id;!t||this.isExporting()||(this.isExporting.set(true),this.exportService.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let i=new Blob([e],{type:"application/yaml"}),s=URL.createObjectURL(i),c=document.createElement("a");c.href=s,c.download=`${this.existingConfig?.name??"agent"}.yaml`,c.click(),URL.revokeObjectURL(s),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}buildLoopConfigPayload(){let t=this.loopConfigControl.value?.trim();if(!t)return this.existingConfig?.loopConfig!=null?null:void 0;try{return JSON.parse(t)}catch(e){return}}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Nw({type:n,selectors:[["agentos-agent-config-form"]],decls:8,vars:4,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to agent configs",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],["headerMeta","","variant","outline"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Agent"],["label","Name","controlId","agent-config-name","required",""],["dsControl","","id","agent-config-name","type","text","placeholder","e.g. Support agent","autocomplete","off",3,"formControl"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","Description","controlId","agent-config-description"],["dsControl","","id","agent-config-description","type","text","placeholder","Optional \u2014 short description of this agent","autocomplete","off",3,"formControl"],["label","Model","controlId","agent-config-model-name","required","","hint","Aliases are matched first, then API model names. Resolved when the agent runs."],["dsControl","","id","agent-config-model-name","type","text","placeholder","Model alias or name to use, e.g. BIG","autocomplete","off",3,"formControl"],["dsControl","","id","agent-config-model-name",3,"formControl"],["label","Instructions","controlId","agent-config-instructions"],["dsControl","","id","agent-config-instructions","rows","6","placeholder","Optional \u2014 system instructions for this agent",3,"formControl"],["legend","Integrations","hint","Select which integrations this agent can use. Leave tool names empty to allow all tools from an integration."],["legend","Skills"],["type","checkbox",3,"change","checked"],[1,"ds-strong"],[1,"ds-code"],["tone","warning"],["label","Execution mode","controlId","agent-config-execution-mode","hint",'SIMPLE runs a single LLM pass. ADVANCED uses an intention loop for complex tasks and requires a model that supports advanced execution, otherwise the agent fails to run. LOOP (experimental) starts one case per result of a tool, without an LLM \u2014 run it with "Launch loop" in the agent list menu.'],["dsControl","","id","agent-config-execution-mode",3,"formControl"],[3,"value"],["label","Loop configuration (JSON)","controlId","agent-config-loop-config",3,"error"],["legend","Sub-agents"],[1,"ds-inline"],["dsControl","","type","text","aria-label","New sub-agent pattern","placeholder","e.g. *Fixer","autocomplete","off",3,"keydown.enter","formControl"],["dsButton","","variant","icon","type","button","title","Add pattern","aria-label","Add pattern",3,"click","disabled"],["label","Delegation timeout (seconds)","controlId","delegation-timeout","hintId","delegation-timeout-hint","errorId","delegation-timeout-error",3,"hint","error"],["dsControl","","id","delegation-timeout","type","number","min","1","max","2147483647","step","1","placeholder","Server default","aria-describedby","delegation-timeout-hint delegation-timeout-error",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["disabled","",3,"ngValue"],[3,"ngValue"],["label","Aliases"],["label","API model names"],[1,"ds-meta"],["dsControl","","type","text","placeholder","Tool names, comma-separated (empty = all tools)","autocomplete","off",1,"ds-indent",3,"formControl"],[1,"ds-micro"],["dsControl","",1,"ds-indent","ds-control--auto",3,"change","id","value"],["value","default"],["value","on"],["value","off"],["type","checkbox",3,"change","checked","disabled"],["dsControl","","mono","","id","agent-config-loop-config","rows","10","spellcheck","false","autocomplete","off",3,"placeholder","formControl"],["dsCheck","",1,"ds-grow"],["dsButton","","variant","icon-danger","type","button","title","Remove"],["dsButton","","variant","icon-danger","type","button","title","Remove",3,"click"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,i){e&1&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return i.cancel()}),HC(3," \u2190 Agent configs "),ml(),Yw(4,ze,2,1,"a",2),Yw(5,Xe,2,0,"ds-tag",3),ml(),Yw(6,Qe,2,0,"p",4)(7,Ot,89,33,"form",5),ml()),e&2&&(QE(),pg("title",i.isEditMode()?"Edit agent config":"New agent config"),QE(3),Qw(i.isEditMode()?4:-1),QE(),Qw(i.isPlatformMode?5:-1),QE(),Qw(i.isLoading()?6:7));},dependencies:[Kt,fd,Mo,Do,Ut,Pn,Mn,Qt,fo,go,ta,Zr,Nn,Rn,$t,vn,yn,fn,pn,hn,_n,at$1,un,cn,Ao],encapsulation:2})};export{Ke as AgentConfigFormComponent};
|
|
1
|
+
import {o as o$1,r,i,l}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-DLffGFin.js';import {O}from'./chunk-BgfuCnTj.js';import {g,W,F as F$1,K as we,ag as U,ay as N,z as zi,az as Q,a8 as _,j as mT,a9 as F$2,aA as Me,U as U$1,a2 as ga,aa as _r,ac as Ny,ad as ne,O as x,M as w,N as Nw,au as $t,I as Is,R as Eg,H as HC,m as ml,Y as Yw,Q as QE,P as pg,b as Qw,p as dC,s as sC,a as hg,S as BI,T as HI,i as fg,o as Il,J as Jw,k as eC,L as Lg,q as mf,r as yf,as as jg}from'./main-IUUK3O6C.js';import {H as A,p as pt$1,T as Te,b as bn,I as E,K as Kt,a as fd,M as Mo,D as Do,U as Ut,P as Pn,o as Mn,Q as Qt,c as fo,g as go,t as ta,Z as Zr,N as Nn,R as Rn,v as vn,d as yn,e as fn,l as pn,h as hn,_ as _n,i as at$1,u as un,n as cn,A as Ao}from'./chunk-DNpsnpVA.js';import'./chunk-BSz21_Vu.js';var F="*";function Be(n){return (n??[]).some(t=>t.trim()===F)}function $e(n){let t=(n??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==F).map(e=>e.toLowerCase());return new Set(t)}function j(n){return n.includes(F)}function He(n){let t=n.replace(/[\\.[\]{}()^$|]/g,"\\$&").replace(/\*/g,".*");try{return new RegExp(`^${t}$`,"i")}catch(e){return null}}function Y(n,t){return (t??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==F&&j(e)).some(e=>He(e)?.test(n)??false)}var Ge="AGENTOS_CONFIG",Je=new Set(["HTTP_API","MCP_HTTP","MCP_STDIO","BASH","TMUX","GIT"]);function Ue(n){return n.configEnabled&&(n.hasSubAgents||n.integrationTypes.some(t=>Je.has(t)))}var je=(n,t)=>t.value,Ye=(n,t)=>t.config.id,qe=(n,t)=>t.type,We=(n,t)=>t.selector;function ze(n,t){if(n&1&&(Is(0,"a",2),HC(1,"View resolved definition \u2192"),ml()),n&2){let e=dC();pg("routerLink",e.inspectRoute());}}function Xe(n,t){n&1&&(Is(0,"ds-tag",3),HC(1,"Platform level"),ml());}function Qe(n,t){n&1&&(Is(0,"p",4),HC(1,"Loading\u2026"),ml());}function Ze(n,t){if(n&1&&(hg(0,"input",17),BI()),n&2){let e=dC(2);pg("formControl",e.modelNameControl),HI();}}function et(n,t){if(n&1&&(Is(0,"option",41),HC(1),ml()),n&2){let e=t;pg("ngValue",e.value),QE(),Lg(e.label);}}function tt(n,t){if(n&1&&(Is(0,"option",41),HC(1),ml()),n&2){let e=t.$implicit;pg("ngValue",e.value),QE(),Lg(e.label);}}function nt(n,t){if(n&1&&(Is(0,"optgroup",42),Jw(1,tt,2,2,"option",41,je),ml()),n&2){let e=dC(3);QE(),eC(e.modelOptions().aliases);}}function it(n,t){if(n&1&&(Is(0,"option",41),HC(1),ml()),n&2){let e=t.$implicit;pg("ngValue",e.value),QE(),Lg(e.label);}}function ot(n,t){if(n&1&&(Is(0,"optgroup",43),Jw(1,it,2,2,"option",41,je),ml()),n&2){let e=dC(3);QE(),eC(e.modelOptions().apiNames);}}function at(n,t){if(n&1&&(Is(0,"select",18)(1,"option",40),HC(2,"Select a model"),ml(),Yw(3,et,2,2,"option",41),Yw(4,nt,3,0,"optgroup",42),Yw(5,ot,3,0,"optgroup",43),ml(),BI()),n&2){let e,i=dC(2);pg("formControl",i.modelNameControl),HI(),QE(),pg("ngValue",null),QE(2),Qw((e=i.modelOptions().current)?3:-1,e),QE(),Qw(i.modelOptions().aliases.length>0?4:-1),QE(),Qw(i.modelOptions().apiNames.length>0?5:-1);}}function lt(n,t){if(n&1&&(Is(0,"span",44),HC(1),ml()),n&2){let e=dC().$implicit;QE(),Lg(e.config.integrationType);}}function rt(n,t){if(n&1&&(hg(0,"input",45),BI()),n&2){let e=dC().$implicit;pg("formControl",e.toolsControl),fg("aria-label","Tools of "+e.config.name),HI();}}function st(n,t){if(n&1){let e=sC();Is(0,"div",10)(1,"label",11)(2,"input",23),Eg("change",function(){let s=mf(e).$implicit,c=dC(3);return yf(c.toggleIntegration(s))}),ml(),Is(3,"span",24),HC(4),ml(),Yw(5,lt,2,1,"span",44),ml(),Yw(6,rt,1,2,"input",45),ml();}if(n&2){let e=t.$implicit;QE(2),pg("checked",e.enabled()),QE(2),Lg(e.config.name),QE(),Qw(e.config.integrationType?5:-1),QE(),Qw(e.enabled()?6:-1);}}function dt(n,t){if(n&1&&(Is(0,"p",13),HC(1),ml()),n&2){let e=dC().$implicit;QE(),Il(" Restricted to: ",e.restrictedTools.join(", ")," (set outside this form, preserved on save) ");}}function ct(n,t){if(n&1){let e=sC();Is(0,"div",10)(1,"label",24),HC(2),Is(3,"span",44),HC(4,"built-in"),ml()(),Is(5,"select",47),Eg("change",function(s){let c=mf(e).$implicit,C=dC(4);return yf(C.setBuiltInState(c,s.target.value))}),Is(6,"option",48),HC(7),ml(),Is(8,"option",49),HC(9,"Enabled"),ml(),Is(10,"option",50),HC(11,"Disabled"),ml()(),Yw(12,dt,2,1,"p",13),Is(13,"p",13),HC(14),ml()();}if(n&2){let e=t.$implicit,i=dC(4);QE(),fg("for","built-in-"+e.type),QE(),Il(" ",e.displayName," "),QE(3),pg("id","built-in-"+e.type)("value",e.state()),QE(2),Lg(i.builtInDefaultLabel(e)),QE(5),Qw(e.state()==="on"&&e.restrictedTools?12:-1),QE(2),Lg(e.description);}}function mt(n,t){if(n&1&&(Is(0,"span",46),HC(1,"Built-in integrations"),ml(),Jw(2,ct,15,7,"div",10,qe)),n&2){let e=dC(3);QE(2),eC(e.builtInRows());}}function ut(n,t){n&1&&(Is(0,"ds-notice",26),HC(1," This agent can read the AgentOS configuration and also has a network integration or sub-agents: what it reads could be sent outside without any confirmation. Prefer a dedicated configuration agent without them. "),ml());}function gt(n,t){if(n&1&&(Is(0,"ds-fieldset",21),Jw(1,st,7,4,"div",10,Ye),Yw(3,mt,4,0),Yw(4,ut,2,0,"ds-notice",26),ml()),n&2){let e=dC(2);QE(),eC(e.integrationRows()),QE(2),Qw(e.builtInRows().length>0?3:-1),QE(),Qw(e.configAgentExposureWarning()?4:-1);}}function pt(n,t){n&1&&HC(0," A platform config can only list platform skills here: namespace skills are resolved per namespace when the agent runs. ");}function ft(n,t){n&1&&(Is(0,"ds-notice",26),HC(1," Saving with this on replaces the selection below with "),Is(2,"code",25),HC(3,"*"),ml(),HC(4,". "),ml());}function Ct(n,t){n&1&&(Is(0,"ds-notice"),HC(1," The skill catalogue could not be loaded. What this agent already declares is listed below and preserved on save. "),ml());}function _t(n,t){n&1&&(Is(0,"p",4),HC(1,"No skill available in this scope yet."),ml());}function bt(n,t){n&1&&(Is(0,"span",44),HC(1,"platform"),ml());}function ht(n,t){if(n&1&&(Is(0,"span",44),HC(1),ml()),n&2){let e=dC(4);QE(),Il(" ",e.skillCatalogueUnavailable()?"not verified":"no matching skill"," ");}}function yt(n,t){if(n&1&&(Is(0,"p",13),HC(1),ml()),n&2){let e=dC().$implicit;QE(),Lg(e.description);}}function vt(n,t){if(n&1){let e=sC();Is(0,"div",10)(1,"label",11)(2,"input",51),Eg("change",function(){let s=mf(e).$implicit,c=dC(3);return yf(c.toggleSkill(s))}),ml(),Is(3,"span",24),HC(4),ml(),Yw(5,bt,2,0,"span",44),Yw(6,ht,2,1,"span",44),ml(),Yw(7,yt,2,1,"p",13),ml();}if(n&2){let e=t.$implicit,i=dC(3);QE(2),pg("checked",e.selected())("disabled",i.allSkillsSelected()),QE(2),Lg(e.name),QE(),Qw(e.platform?5:-1),QE(),Qw(e.unresolved?6:-1),QE(),Qw(e.description?7:-1);}}function xt(n,t){if(n&1&&Jw(0,vt,8,6,"div",10,We),n&2){let e=dC(2);eC(e.skillRows());}}function St(n,t){if(n&1&&(Is(0,"ds-form-field",30),hg(1,"textarea",52),BI(),Is(2,"p",4),HC(3," Default payload for this loop agent. Overridden at launch time if the first message contains a valid "),Is(4,"code"),HC(5,"AgentLoopPayload"),ml(),HC(6,". Leave empty if you always provide the payload at launch. "),ml()()),n&2){let e=dC(2);pg("error",e.loopConfigControl.invalid&&e.loopConfigControl.touched?"Invalid JSON \u2014 please fix the syntax.":null),QE(),pg("placeholder",e.loopConfigPlaceholder)("formControl",e.loopConfigControl),HI();}}function At(n,t){n&1&&HC(0," A platform config can only list platform agents here: a namespace's agents are resolved per namespace when the agent runs. ");}function wt(n,t){if(n&1&&HC(0),n&2){let e=dC(3);jg(" That deletes ",e.droppedUnresolvedSubAgents()," flagged ",e.droppedUnresolvedSubAgents()===1?"selector":"selectors"," nothing matched, which this form cannot restore. ");}}function Et(n,t){if(n&1&&(Is(0,"ds-notice",26),HC(1," Saving with this on replaces the selection below with "),Is(2,"code",25),HC(3,"*"),ml(),HC(4,". "),Yw(5,wt,1,2),ml()),n&2){let e=dC(2);QE(5),Qw(e.droppedUnresolvedSubAgents()>0?5:-1);}}function Tt(n,t){n&1&&(Is(0,"ds-notice"),HC(1," The list of agents could not be loaded. What this agent already declares is listed below and preserved on save. "),ml());}function kt(n,t){n&1&&(Is(0,"p",4),HC(1,"No other agent is available in this scope yet."),ml());}function It(n,t){n&1&&(Is(0,"span",44),HC(1,"pattern"),ml());}function Rt(n,t){n&1&&(Is(0,"span",44),HC(1,"via pattern"),ml());}function Mt(n,t){if(n&1&&(Is(0,"span",44),HC(1),ml()),n&2){let e=dC(4);QE(),Il(" ",e.subAgentCandidatesUnavailable()?"not verified":"no matching agent"," ");}}function Ft(n,t){if(n&1){let e=sC();Is(0,"button",55),Eg("click",function(){mf(e);let s=dC().$implicit,c=dC(3);return yf(c.removeSubAgent(s))}),HC(1," \xD7 "),ml();}if(n&2){let e=dC().$implicit;fg("aria-label","Remove "+e.selector);}}function Nt(n,t){if(n&1){let e=sC();Is(0,"div",32)(1,"label",53)(2,"input",51),Eg("change",function(){let s=mf(e).$implicit,c=dC(3);return yf(c.toggleSubAgent(s))}),ml(),Is(3,"span",24),HC(4),ml(),Yw(5,It,2,0,"span",44)(6,Rt,2,0,"span",44)(7,Mt,2,1,"span",44),ml(),Yw(8,Ft,2,1,"button",54),ml();}if(n&2){let e=t.$implicit,i=dC(3);QE(2),pg("checked",e.selected())("disabled",i.allSubAgentsSelected()),QE(2),Lg(e.name),QE(),Qw(e.pattern?5:e.grantedByPattern?6:e.unresolved?7:-1),QE(3),Qw(e.unresolved?8:-1);}}function Dt(n,t){if(n&1&&Jw(0,Nt,9,5,"div",32,We),n&2){let e=dC(2);eC(e.subAgentRows());}}function Lt(n,t){if(n&1){let e=sC();Is(0,"div")(1,"button",56),Eg("click",function(){mf(e);let s=dC(2);return yf(s.useDefaultDelegationTimeout())}),HC(2," Use server default "),ml()();}}function Vt(n,t){n&1&&(Is(0,"ds-notice"),HC(1),ml()),n&2&&(QE(),Lg(t));}function Pt(n,t){if(n&1){let e=sC();Is(0,"button",57),Eg("click",function(){mf(e);let s=dC(2);return yf(s.exportYaml())}),HC(1),ml();}if(n&2){let e=dC(2);pg("disabled",e.isExporting()),QE(),Il(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ot(n,t){if(n&1){let e=sC();Is(0,"form",6),Eg("ngSubmit",function(){mf(e);let s=dC();return yf(s.submit())}),Is(1,"ds-fieldset",7)(2,"ds-form-field",8),hg(3,"input",9),BI(),ml(),Is(4,"div",10)(5,"label",11),hg(6,"input",12),BI(),HC(7," Enabled "),ml(),Is(8,"p",13),HC(9,"Disabled agents are excluded from namespace resolution."),ml()(),Is(10,"ds-form-field",14),hg(11,"input",15),BI(),ml(),Is(12,"ds-form-field",16),Yw(13,Ze,1,1,"input",17)(14,at,6,5,"select",18),ml(),Is(15,"ds-form-field",19),hg(16,"textarea",20),BI(),ml()(),Yw(17,gt,5,2,"ds-fieldset",21),Is(18,"ds-fieldset",22)(19,"p",4),HC(20," Instruction bundles this agent can read on demand. Selecting at least one grants it the "),Is(21,"code"),HC(22,"readSkill"),ml(),HC(23," and "),Is(24,"code"),HC(25,"readSkillResource"),ml(),HC(26," tools; selecting none grants neither. "),Yw(27,pt,1,0),ml(),Is(28,"label",11)(29,"input",23),Eg("change",function(){mf(e);let s=dC();return yf(s.toggleAllSkills())}),ml(),Is(30,"span",24),HC(31,"Every skill in the catalogue ("),Is(32,"code",25),HC(33,"*"),ml(),HC(34,")"),ml()(),Is(35,"p",13),HC(36," Resolved at run time, so skills added later are granted too, without editing this agent. "),ml(),Yw(37,ft,5,0,"ds-notice",26),Yw(38,Ct,2,0,"ds-notice"),Yw(39,_t,2,0,"p",4)(40,xt,2,0),ml(),Is(41,"ds-form-field",27)(42,"select",28)(43,"option",29),HC(44,"SIMPLE \u2014 Standard agent (single LLM call)"),ml(),Is(45,"option",29),HC(46,"ADVANCED \u2014 Multi-step reasoning loop"),ml(),Is(47,"option",29),HC(48,"LOOP \u2014 Bulk loop agent (no LLM, experimental)"),ml()(),BI(),ml(),Yw(49,St,7,3,"ds-form-field",30),Is(50,"ds-fieldset",31)(51,"p",4),HC(52," The agents this one may delegate to. Selecting at least one grants it the "),Is(53,"code"),HC(54,"DELEGATE__delegate"),ml(),HC(55," tool; selecting none grants it no way to delegate. Entries are matched against agent names, never ids. "),Yw(56,At,1,0),ml(),Is(57,"label",11)(58,"input",23),Eg("change",function(){mf(e);let s=dC();return yf(s.toggleAllSubAgents())}),ml(),Is(59,"span",24),HC(60,"Every agent it can reach ("),Is(61,"code",25),HC(62,"*"),ml(),HC(63,")"),ml()(),Is(64,"p",13),HC(65," Resolved at run time, so agents added later can be delegated to as well, without editing this agent. "),ml(),Yw(66,Et,6,1,"ds-notice",26),Yw(67,Tt,2,0,"ds-notice"),Yw(68,kt,2,0,"p",4)(69,Dt,2,0),Is(70,"p",4),HC(71," Advanced \u2014 add a glob instead of picking a name, for example "),Is(72,"code"),HC(73,"*Fixer"),ml(),HC(74," to cover BugFixer and StoryFixer. "),ml(),Is(75,"div",32)(76,"input",33),Eg("keydown.enter",function(){mf(e);let s=dC();return yf(s.addSubAgent())}),ml(),BI(),Is(77,"button",34),Eg("click",function(){mf(e);let s=dC();return yf(s.addSubAgent())}),HC(78," + "),ml()(),Is(79,"ds-form-field",35),hg(80,"input",36),BI(),Yw(81,Lt,3,0,"div"),ml()(),Yw(82,Vt,2,1,"ds-notice"),Is(83,"ds-form-actions")(84,"button",37),HC(85),ml(),Yw(86,Pt,2,2,"button",38),Is(87,"button",39),Eg("click",function(){mf(e);let s=dC();return yf(s.cancel())}),HC(88,"Cancel"),ml()()();}if(n&2){let e,i=dC();pg("formGroup",i.form),QE(3),pg("formControl",i.nameControl),HI(),QE(3),pg("formControl",i.enabledControl),HI(),QE(5),pg("formControl",i.descriptionControl),HI(),QE(2),Qw(i.modelAsFreeText()?13:14),QE(3),pg("formControl",i.instructionsControl),HI(),QE(),Qw(i.integrationRows().length>0||i.builtInRows().length>0?17:-1),QE(10),Qw(i.isPlatformMode?27:-1),QE(2),pg("checked",i.allSkillsSelected()),QE(8),Qw(i.namedSkillSelectionDropped()?37:-1),QE(),Qw(i.skillCatalogueUnavailable()?38:-1),QE(),Qw(i.skillRows().length===0?39:40),QE(3),pg("formControl",i.executionModeControl),HI(),QE(),pg("value",i.ExecutionMode.SIMPLE),QE(2),pg("value",i.ExecutionMode.ADVANCED),QE(2),pg("value",i.ExecutionMode.LOOP),QE(2),Qw(i.isLoopMode()?49:-1),QE(7),Qw(i.isPlatformMode?56:-1),QE(2),pg("checked",i.allSubAgentsSelected()),QE(8),Qw(i.namedSubAgentSelectionDropped()?66:-1),QE(),Qw(i.subAgentCandidatesUnavailable()?67:-1),QE(),Qw(i.subAgentRows().length===0?68:69),QE(8),pg("formControl",i.newSubAgentControl),HI(),QE(),pg("disabled",!i.newSubAgentControl.value.trim()),QE(2),pg("hint",i.delegationTimeoutHint())("error",i.delegationTimeoutControl.invalid?"Enter a valid positive whole number of seconds, or leave empty to inherit the server default.":null),QE(),pg("formControl",i.delegationTimeoutControl),fg("aria-invalid",i.delegationTimeoutControl.invalid),HI(),QE(),Qw(i.delegationTimeoutControl.value!==null?81:-1),QE(),Qw((e=i.submitError())?82:-1,e),QE(2),pg("disabled",i.form.invalid||i.isSubmitting()),QE(),Il(" ",i.isEditMode()?"Save changes":"Create"," "),QE(),Qw(i.isEditMode()?86:-1);}}var Ke=class n{route=g(W);router=g(F$1);destroyRef=g(we);agentConfigController=g(U);defaultsController=g(N);defaultDelegationTimeoutSeconds=zi(null);exportService=g(Q);integrationConfigState=g(O);integrationTypeController=g(_);skillState=g(o);aiModelState=g(A);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt$1({name:new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te(null),modelName:new Te(null,{validators:[bn.required,n.notBlankValidator]}),instructions:new Te(null),executionMode:new Te("SIMPLE",{nonNullable:true}),delegationTimeoutSeconds:new Te(null,{validators:[bn.min(1),bn.max(2147483647),bn.pattern(/^\d+$/)]}),enabled:new Te(false,{nonNullable:true}),loopConfig:new Te(null,{validators:[n.jsonValidator]})});static notBlankValidator(t){let e=t.value;return typeof e=="string"&&e.length>0&&e.trim().length===0?{required:true}:null}static jsonValidator(t){let e=t.value?.trim();if(!e)return null;try{return JSON.parse(e),null}catch(i){return {invalidJson:true}}}get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get modelNameControl(){return this.form.controls.modelName}get instructionsControl(){return this.form.controls.instructions}get executionModeControl(){return this.form.controls.executionMode}get delegationTimeoutControl(){return this.form.controls.delegationTimeoutSeconds}useDefaultDelegationTimeout(){this.delegationTimeoutControl.setValue(null),this.delegationTimeoutControl.markAsDirty();}delegationTimeoutHint=mT(()=>{let t=this.defaultDelegationTimeoutSeconds();return `How long each delegation launched by this agent waits without activity from the sub-agent, including its own delegations. When it runs out, the sub-agent and its active descendants are stopped and can be resumed. Leave empty to use the server default${t!==null?`: ${t} s (${t/60} min)`:""}.`});get enabledControl(){return this.form.controls.enabled}get loopConfigControl(){return this.form.controls.loopConfig}executionModeValue=F$2(this.form.controls.executionMode.valueChanges,{initialValue:this.form.controls.executionMode.value});isLoopMode=mT(()=>this.executionModeValue()==="LOOP");subAgentRows=zi([]);allSubAgentsSelected=zi(false);subAgentCandidatesUnavailable=zi(false);namedSubAgentSelectionDropped=mT(()=>this.allSubAgentsSelected()&&this.subAgentRows().some(t=>t.selected()));droppedUnresolvedSubAgents=mT(()=>this.allSubAgentsSelected()?this.subAgentRows().filter(t=>t.unresolved&&t.selected()).length:0);hasAnySubAgent=mT(()=>this.allSubAgentsSelected()||this.subAgentRows().some(t=>t.selected()));newSubAgentControl=new Te("",{nonNullable:true});isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);isExporting=zi(false);submitError=zi(null);ExecutionMode=Me;loopConfigPlaceholder=JSON.stringify({search:{tool:"SearchTalents",params:{talentId:["6ac76692a909eaaae0b078d6"],resolveTargets:["MANAGER"],next:null}},act:{agentName:"ProfileCaretaker",promptTemplate:"This talent has not completed their profile. As their manager, I need you to help me review and improve it."}},null,2);builtInRows=zi([]);inspectRoute(){let t=this.route.snapshot.paramMap.get("agentConfigId")??"";return this.isPlatformMode?["/agentos","admin","agent-configs",t,"inspect"]:["/agentos",this.namespaceId,"agent-configs",t,"inspect"]}configAgentExposureWarning=mT(()=>Ue({configEnabled:this.builtInRows().some(t=>t.type===Ge&&t.state()==="on"),integrationTypes:this.integrationRows().filter(t=>t.enabled()).map(t=>t.config.integrationType),hasSubAgents:this.hasAnySubAgent()}));modelOptions=zi({aliases:[],apiNames:[],current:null});modelCatalogueLoaded=zi(false);modelAsFreeText=mT(()=>{let{aliases:t,apiNames:e}=this.modelOptions();return this.modelCatalogueLoaded()&&t.length+e.length===0});applyModelCatalogue(t,e){this.modelOptions.set(E(t,e)),this.modelCatalogueLoaded.set(true);}integrationRows=zi([]);skillRows=zi([]);allSkillsSelected=zi(false);skillCatalogueUnavailable=zi(false);namedSkillSelectionDropped=mT(()=>this.allSkillsSelected()&&this.skillRows().some(t=>t.selected()));existingConfig=null;ngOnInit(){this.defaultsController.getAgentConfigDefaults().pipe(U$1(this.destroyRef),ga(()=>_r(null))).subscribe(e=>this.defaultDelegationTimeoutSeconds.set(e?.delegationTimeoutSeconds??null));let t=this.route.snapshot.paramMap.get("agentConfigId");t?(this.isEditMode.set(true),this.loadConfigAndIntegrations(t)):this.loadIntegrations(void 0);}loadConfigAndIntegrations(t){this.isLoading.set(true),Ny({config:this.agentConfigController.getByIdAgentConfig(t),namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):_r([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes(),skillCatalogue:this.loadSkillCatalogue(),delegationCandidates:this.loadDelegationCandidates(),models:this.aiModelState.listAvailable(this.namespaceId)}).pipe(U$1(this.destroyRef)).subscribe({next:({config:e,namespaceIntegrations:i,platformIntegrations:s,builtInTypes:c,skillCatalogue:C,delegationCandidates:E,models:T})=>{this.existingConfig=e,this.applyModelCatalogue(T,e.modelName??null),this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.modelNameControl.setValue(e.modelName??null),this.instructionsControl.setValue(e.instructions??null);let f=e.executionMode??(e.advancedExecution?"ADVANCED":"SIMPLE");this.executionModeControl.setValue(f),this.delegationTimeoutControl.setValue(e.delegationTimeoutSeconds??null),this.enabledControl.setValue(e.enabled??true),this.loopConfigControl.setValue(e.loopConfig!=null?JSON.stringify(e.loopConfig,null,2):null);let N=[...s,...i];this.integrationRows.set(this.buildIntegrationRows(N,e.integrations??void 0)),this.builtInRows.set(this.buildBuiltInRows(c,e.integrations??void 0)),this.allSubAgentsSelected.set(Be(e.subAgents)),this.subAgentRows.set(this.buildSubAgentRows(E,e.subAgents,e.name)),this.allSkillsSelected.set(o$1(e.skillSelectors)),this.skillRows.set(this.buildSkillRows(C,e.skillSelectors)),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadIntegrations(t){Ny({namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):_r([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes(),skillCatalogue:this.loadSkillCatalogue(),delegationCandidates:this.loadDelegationCandidates(),models:this.aiModelState.listAvailable(this.namespaceId)}).pipe(U$1(this.destroyRef)).subscribe({next:({namespaceIntegrations:e,platformIntegrations:i,builtInTypes:s,skillCatalogue:c,delegationCandidates:C,models:E})=>{this.applyModelCatalogue(E,null);let T=[...i,...e];this.integrationRows.set(this.buildIntegrationRows(T,t??void 0)),this.builtInRows.set(this.buildBuiltInRows(s,t??void 0)),this.allSubAgentsSelected.set(false),this.subAgentRows.set(this.buildSubAgentRows(C,void 0,null)),this.allSkillsSelected.set(false),this.skillRows.set(this.buildSkillRows(c,void 0));}});}loadSkillCatalogue(){return (this.namespaceId?this.skillState.listEffective(this.namespaceId):this.skillState.listPlatform().pipe(ne(e=>e.map(i=>({id:i.id??"",name:i.name,description:i.description,namespaceId:i.namespaceId??null,readOnly:i.readOnly===true}))))).pipe(ga(e=>(console.error("[agent-config-form] failed to load the skill catalogue",e),this.skillCatalogueUnavailable.set(true),_r([]))))}buildSkillRows(t,e){let s=(e??[]).map(f=>f.trim()).filter(f=>f.length>0).filter(f=>f!==r),c=i(s),C=new Set(t.map(f=>f.name.toLowerCase())),E=t.map(f=>({selector:f.name,name:f.name,description:f.description,platform:f.namespaceId==null,unresolved:false,selected:zi(c.has(f.name.toLowerCase()))})),T=new Set;for(let f of s){let N=l(f).toLowerCase();C.has(N)||T.has(N)||(T.add(N),E.push({selector:f,name:f,description:"",platform:false,unresolved:true,selected:zi(true)}));}return E}toggleSkill(t){t.selected.update(e=>!e);}toggleAllSkills(){this.allSkillsSelected.update(t=>!t);}buildSkillSelectorsPayload(){if(this.allSkillsSelected())return [r];let t=this.skillRows().filter(e=>e.selected()).map(e=>e.selector);return t.length>0?t:void 0}loadDelegationCandidates(){let t=this.agentConfigController.listPlatformAgentsAgentConfig(false).pipe(this.orNoCandidates()),e=this.namespaceId?this.agentConfigController.listByParentAgentConfig(this.namespaceId,false).pipe(this.orNoCandidates()):_r([]);return Ny({platform:t,namespace:e}).pipe(ne(({platform:i,namespace:s})=>[...i,...s]),ne(i=>i.map(s=>s.name).filter(s=>s.length>0)),ne(i=>n.dedupeByKey(i)))}orNoCandidates(){return ga(t=>(console.error("[agent-config-form] failed to load the delegation candidates",t),this.subAgentCandidatesUnavailable.set(true),_r([])))}static dedupeByKey(t){let e=new Set;return t.filter(i=>{let s=i.toLowerCase();return e.has(s)?false:(e.add(s),true)})}buildSubAgentRows(t,e,i){let s=$e(e),c=i?.toLowerCase()??null,C=t.filter(_=>{let O=_.toLowerCase();return O!==c||s.has(O)}),E=new Set(C.map(_=>_.toLowerCase())),T=C.map(_=>({selector:_,name:_,unresolved:false,pattern:false,grantedByPattern:Y(_,e),selected:zi(s.has(_.toLowerCase()))})),f=new Set,N=(e??[]).map(_=>_.trim()).filter(_=>_.length>0&&_!==F);for(let _ of N){let O=_.toLowerCase();E.has(O)||f.has(O)||(f.add(O),T.push({selector:_,name:_,unresolved:true,pattern:j(_),grantedByPattern:false,selected:zi(true)}));}return T}loadBuiltInTypes(){return this.integrationTypeController.listTypesIntegrationType().pipe(ne(t=>t.filter(e=>!e.configSchema)),ga(t=>(console.error("[agent-config-form] failed to load integration types",t),_r([]))))}buildIntegrationRows(t,e){return t.map(i=>{let s=i.name??"",c=e?.[s],C=e!=null&&s in e,E=Array.isArray(c)?c.join(", "):"";return {config:i,enabled:zi(C),toolsControl:new Te(E,{nonNullable:true})}})}buildBuiltInRows(t,e){return t.map(i=>{let s=e!=null&&i.type in e,c=e?.[i.type],C=s?Array.isArray(c)&&c.length===0?"off":"on":"default";return {type:i.type,displayName:i.displayName,description:i.description,enabledByDefault:i.enabledByDefault===true,state:zi(C),restrictedTools:Array.isArray(c)&&c.length>0?c:null}})}toggleIntegration(t){t.enabled.update(e=>!e);}setBuiltInState(t,e){t.state.set(e);}builtInDefaultLabel(t){return t.enabledByDefault?"Platform default (enabled)":"Platform default (disabled)"}addSubAgent(){let t=this.newSubAgentControl.value.trim();if(!t)return;let e=this.subAgentRows().find(i=>i.selector.toLowerCase()===t.toLowerCase());e?e.selected.set(true):t===F?this.allSubAgentsSelected.set(true):this.subAgentRows.update(i=>this.withPatternGrants([...i,{selector:t,name:t,unresolved:true,pattern:j(t),grantedByPattern:false,selected:zi(true)}])),this.newSubAgentControl.reset("");}removeSubAgent(t){let e=t.selector.toLowerCase();this.subAgentRows.update(i=>this.withPatternGrants(i.filter(s=>s.selector.toLowerCase()!==e)));}toggleSubAgent(t){t.selected.update(e=>!e),t.pattern&&this.subAgentRows.update(e=>this.withPatternGrants(e));}withPatternGrants(t){let e=this.allSubAgentsSelected()?[]:t.filter(i=>i.selected()).map(i=>i.selector);return t.map(i=>i.unresolved?i:x(w({},i),{grantedByPattern:Y(i.name,e)}))}toggleAllSubAgents(){this.allSubAgentsSelected.update(t=>!t),this.subAgentRows.update(t=>this.withPatternGrants(t));}buildSubAgentsPayload(){if(this.allSubAgentsSelected())return [F];let t=this.subAgentRows().filter(e=>e.selected()).map(e=>e.selector);return t.length>0?t:void 0}buildIntegrationsPayload(){let t={};for(let i of this.integrationRows().filter(s=>s.enabled())){let s=i.config.name??"",c=i.toolsControl.value.trim();t[s]=c===""?null:c.split(",").map(C=>C.trim()).filter(C=>C.length>0);}for(let i of this.builtInRows()){let s=i.state();s==="on"?t[i.type]=i.restrictedTools??null:s==="off"&&(t[i.type]=[]);}let e=new Set([...this.integrationRows().map(i=>i.config.name??""),...this.builtInRows().map(i=>i.type)]);for(let[i,s]of Object.entries(this.existingConfig?.integrations??{}))e.has(i)||(t[i]=s);return Object.keys(t).length>0?t:void 0}submit(){if(this.form.invalid||this.isSubmitting())return;this.addSubAgent(),this.submitError.set(null),this.isSubmitting.set(true);let t=x(w({},this.existingConfig??{}),{createdOn:this.existingConfig?.createdOn,updatedOn:this.existingConfig?.updatedOn,namespaceId:this.namespaceId,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,modelName:this.modelNameControl.value?.trim()||void 0,instructions:this.instructionsControl.value?.trim()||void 0,integrations:this.buildIntegrationsPayload(),executionMode:this.executionModeControl.value,advancedExecution:this.executionModeControl.value==="ADVANCED",enabled:this.enabledControl.value,subAgents:this.buildSubAgentsPayload(),skillSelectors:this.buildSkillSelectorsPayload(),delegationTimeoutSeconds:this.delegationTimeoutControl.value,loopConfig:this.buildLoopConfigPayload()});(this.isEditMode()?this.agentConfigController.updateAgentConfig(this.existingConfig.id??"",t):this.agentConfigController.createAgentConfig(t)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:i=>{this.isSubmitting.set(false),this.submitError.set(n.serverMessage(i));}});}static serverMessage(t){let i=t?.error?.message;if(typeof i=="string"&&i.trim().length>0)return i;let s=t?.status;return s===0?"The server could not be reached. The agent was not saved.":typeof s=="number"&&s>=500?`The server failed to save the agent (HTTP ${s}). Nothing was changed.`:"The server refused the save and gave no reason. Check the values and try again."}exportYaml(){let t=this.existingConfig?.id;!t||this.isExporting()||(this.isExporting.set(true),this.exportService.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let i=new Blob([e],{type:"application/yaml"}),s=URL.createObjectURL(i),c=document.createElement("a");c.href=s,c.download=`${this.existingConfig?.name??"agent"}.yaml`,c.click(),URL.revokeObjectURL(s),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}buildLoopConfigPayload(){let t=this.loopConfigControl.value?.trim();if(!t)return this.existingConfig?.loopConfig!=null?null:void 0;try{return JSON.parse(t)}catch(e){return}}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Nw({type:n,selectors:[["agentos-agent-config-form"]],decls:8,vars:4,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to agent configs",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],["headerMeta","","variant","outline"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Agent"],["label","Name","controlId","agent-config-name","required",""],["dsControl","","id","agent-config-name","type","text","placeholder","e.g. Support agent","autocomplete","off",3,"formControl"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","Description","controlId","agent-config-description"],["dsControl","","id","agent-config-description","type","text","placeholder","Optional \u2014 short description of this agent","autocomplete","off",3,"formControl"],["label","Model","controlId","agent-config-model-name","required","","hint","Aliases are matched first, then API model names. Resolved when the agent runs."],["dsControl","","id","agent-config-model-name","type","text","placeholder","Model alias or name to use, e.g. BIG","autocomplete","off",3,"formControl"],["dsControl","","id","agent-config-model-name",3,"formControl"],["label","Instructions","controlId","agent-config-instructions"],["dsControl","","id","agent-config-instructions","rows","6","placeholder","Optional \u2014 system instructions for this agent",3,"formControl"],["legend","Integrations","hint","Select which integrations this agent can use. Leave tool names empty to allow all tools from an integration."],["legend","Skills"],["type","checkbox",3,"change","checked"],[1,"ds-strong"],[1,"ds-code"],["tone","warning"],["label","Execution mode","controlId","agent-config-execution-mode","hint",'SIMPLE runs a single LLM pass. ADVANCED uses an intention loop for complex tasks and requires a model that supports advanced execution, otherwise the agent fails to run. LOOP (experimental) starts one case per result of a tool, without an LLM \u2014 run it with "Launch loop" in the agent list menu.'],["dsControl","","id","agent-config-execution-mode",3,"formControl"],[3,"value"],["label","Loop configuration (JSON)","controlId","agent-config-loop-config",3,"error"],["legend","Sub-agents"],[1,"ds-inline"],["dsControl","","type","text","aria-label","New sub-agent pattern","placeholder","e.g. *Fixer","autocomplete","off",3,"keydown.enter","formControl"],["dsButton","","variant","icon","type","button","title","Add pattern","aria-label","Add pattern",3,"click","disabled"],["label","Delegation timeout (seconds)","controlId","delegation-timeout","hintId","delegation-timeout-hint","errorId","delegation-timeout-error",3,"hint","error"],["dsControl","","id","delegation-timeout","type","number","min","1","max","2147483647","step","1","placeholder","Server default","aria-describedby","delegation-timeout-hint delegation-timeout-error",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["disabled","",3,"ngValue"],[3,"ngValue"],["label","Aliases"],["label","API model names"],[1,"ds-meta"],["dsControl","","type","text","placeholder","Tool names, comma-separated (empty = all tools)","autocomplete","off",1,"ds-indent",3,"formControl"],[1,"ds-micro"],["dsControl","",1,"ds-indent","ds-control--auto",3,"change","id","value"],["value","default"],["value","on"],["value","off"],["type","checkbox",3,"change","checked","disabled"],["dsControl","","mono","","id","agent-config-loop-config","rows","10","spellcheck","false","autocomplete","off",3,"placeholder","formControl"],["dsCheck","",1,"ds-grow"],["dsButton","","variant","icon-danger","type","button","title","Remove"],["dsButton","","variant","icon-danger","type","button","title","Remove",3,"click"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,i){e&1&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return i.cancel()}),HC(3," \u2190 Agent configs "),ml(),Yw(4,ze,2,1,"a",2),Yw(5,Xe,2,0,"ds-tag",3),ml(),Yw(6,Qe,2,0,"p",4)(7,Ot,89,33,"form",5),ml()),e&2&&(QE(),pg("title",i.isEditMode()?"Edit agent config":"New agent config"),QE(3),Qw(i.isEditMode()?4:-1),QE(),Qw(i.isPlatformMode?5:-1),QE(),Qw(i.isLoading()?6:7));},dependencies:[Kt,fd,Mo,Do,Ut,Pn,Mn,Qt,fo,go,ta,Zr,Nn,Rn,$t,vn,yn,fn,pn,hn,_n,at$1,un,cn,Ao],encapsulation:2})};export{Ke as AgentConfigFormComponent};
|