@whoz-oss/coday-client 0.0.0-workstream-forge.298 → 0.0.0-workstream-forge.299
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/{chunk-Djrqlsja.js → chunk-0xo7y4S1.js} +1 -1
- package/browser/{chunk-BibOnln8.js → chunk-B6gsrnkr.js} +1 -1
- package/browser/{chunk-ClvOUHzO.js → chunk-B8ShoQZU.js} +1 -1
- package/browser/{chunk-QA5UvRgp.js → chunk-BAPa85aK.js} +1 -1
- package/browser/{chunk-BaXKtzjd.js → chunk-BAjpVi_E.js} +1 -1
- package/browser/{chunk-Bvdz5sFR.js → chunk-BEDwkVZi.js} +1 -1
- package/browser/{chunk-hSQhyXAK.js → chunk-BJt9W1KJ.js} +1 -1
- package/browser/{chunk-Dh9AMc9f.js → chunk-BQZxl77C.js} +1 -1
- package/browser/{chunk-GlRgl5dB.js → chunk-BYBwATcv.js} +1 -1
- package/browser/{chunk-DVwHMZjr.js → chunk-BjlPQNOw.js} +1 -1
- package/browser/chunk-BlhyPwlI.js +1 -0
- package/browser/{chunk-B5JsB4XI.js → chunk-Btjxfsn3.js} +1 -1
- package/browser/{chunk-9wvyLHuk.js → chunk-Bu-j1i1F.js} +1 -1
- package/browser/{chunk-BIkPktdf.js → chunk-C6D03eC9.js} +1 -1
- package/browser/{chunk-CdBOn66B.js → chunk-C7KIJivU.js} +1 -1
- package/browser/{chunk-BY4pYYCq.js → chunk-C90nyg8k.js} +3 -3
- package/browser/{chunk-BZmi7l-J.js → chunk-C9QdIeaf.js} +1 -1
- package/browser/{chunk-8XyNS78o.js → chunk-CFmjVNMp.js} +1 -1
- package/browser/{chunk-h1DwHzOw.js → chunk-CNsf98BP.js} +1 -1
- package/browser/{chunk-nfwj1uBg.js → chunk-CYuC3k-F.js} +1 -1
- package/browser/{chunk-BMhgEzMc.js → chunk-CdkH2NKZ.js} +1 -1
- package/browser/{chunk-DjrS7piD.js → chunk-CiWU3c_P.js} +1 -1
- package/browser/chunk-Cuut2fuQ.js +1 -0
- package/browser/{chunk-B42ywiOW.js → chunk-Cv0bmOfa.js} +1 -1
- package/browser/{chunk-EV6Gb91d.js → chunk-D6VG9tfL.js} +1 -1
- package/browser/{chunk-BtTk4lBd.js → chunk-DCWDH_a0.js} +1 -1
- package/browser/{chunk-Dp8Qtax9.js → chunk-DD2v7fvf.js} +1 -1
- package/browser/{chunk-BweVOo8c.js → chunk-DDm3cabl.js} +1 -1
- package/browser/{chunk-Dwi6o0t0.js → chunk-DKBlG8bB.js} +1 -1
- package/browser/{chunk-CZLbKUEE.js → chunk-DOWY5FGX.js} +1 -1
- package/browser/{chunk-9l3CfInB.js → chunk-DPfzD59Q.js} +1 -1
- package/browser/{chunk-CBQlusyZ.js → chunk-DdMkHIw_.js} +1 -1
- package/browser/{chunk-BP7l1804.js → chunk-DdTCwg3n.js} +1 -1
- package/browser/{chunk-BJGcsBm7.js → chunk-DgKHoGIv.js} +1 -1
- package/browser/{chunk-By5ToOHd.js → chunk-Dhs29Flf.js} +1 -1
- package/browser/chunk-DizwKPR4.js +1 -0
- package/browser/{chunk-Cqm5BJv_.js → chunk-DjLF6ZtY.js} +1 -1
- package/browser/{chunk-DvDLDjpo.js → chunk-Dly3kfft.js} +1 -1
- package/browser/{chunk-BHTuNMop.js → chunk-DoX2Jqcx.js} +1 -1
- package/browser/{chunk-CJ4vPhs4.js → chunk-DrowH10V.js} +1 -1
- package/browser/{chunk-DSwZ2lJp.js → chunk-DxbOkoDc.js} +1 -1
- package/browser/{chunk-DlUTCVia.js → chunk-Nldlx5RO.js} +1 -1
- package/browser/{chunk-zOYWk0nL.js → chunk-bT43nx1T.js} +1 -1
- package/browser/{chunk-DUQtHd5Q.js → chunk-d4x3KbTe.js} +1 -1
- package/browser/{chunk-BM0VZISu.js → chunk-fHUER4U6.js} +1 -1
- package/browser/{chunk-DfkhqlKG.js → chunk-kn6mevUy.js} +1 -1
- package/browser/index.html +2 -2
- package/browser/{main-WIKPRSWZ.js → main-EE6GZH3K.js} +1 -1
- package/package.json +1 -1
- package/browser/chunk-BNT94xkt.js +0 -1
- package/browser/chunk-Bu0mFMKp.js +0 -1
- package/browser/chunk-DIe7xrW1.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
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-BY4pYYCq.js';import {g,W,F,H as we,ag as U,z as zi,M as U$1,a2 as ga,aa as _r,P as x,O as w,x as xw,I as Is,S as Eg,U as UC,m as ml,Q as Qw,K as KE,R as pg,q as Il,b as Kw,s as aC,a as hg,T as VI,l as eC,am as Xw,r as fC,X as UI,L as Lg,t as tC,j as fg,u as mf,w as yf}from'./main-WIKPRSWZ.js';var ce=(o,t)=>t.id;function ue(o,t){o&1&&(Is(0,"p",2),UC(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=fC(3);KE(),pg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function ge(o,t){if(o&1&&(Is(0,"option",24),UC(1),ml()),o&2){let e=t.$implicit;pg("ngValue",e.id),KE(),Lg(e.name);}}function Ce(o,t){if(o&1&&(Is(0,"ds-form-field",21)(1,"select",23)(2,"option",24),UC(3,"\u2014 None \u2014"),ml(),eC(4,ge,2,2,"option",24,ce),ml(),VI(),ml()),o&2){let e=fC(3);KE(),pg("formControl",e.agentConfigIdControl),UI(),KE(),pg("ngValue",null),KE(2),tC(e.availableAgentConfigs());}}function ye(o,t){if(o&1&&Qw(0,fe,2,1,"ds-form-field",20)(1,Ce,6,2,"ds-form-field",21),o&2){let e=fC(2);Kw(e.isEditMode()&&e.agentConfigIdControl.value?0:e.isEditMode()?-1:1);}}function ve(o,t){o&1&&(Is(0,"p",2),UC(1,"No parameters defined."),ml());}function he(o,t){if(o&1){let e=aC();Is(0,"div",11)(1,"div",25)(2,"ds-form-field",26),hg(3,"input",27),VI(),ml(),Is(4,"ds-form-field",28),hg(5,"input",29),VI(),ml(),Is(6,"ds-form-field",30),hg(7,"input",31),VI(),ml()(),Is(8,"button",32),Eg("click",function(){let d=mf(e).$index,m=fC(2);return yf(m.removeParameter(d))}),UC(9," \xD7 "),ml()();}if(o&2){let e=t.$implicit,r=t.$index;pg("formGroupName",r),KE(2),pg("controlId","param-name-"+r)("error",e.controls.name.invalid&&e.controls.name.touched?"Parameter name is required.":null),KE(),pg("id","param-name-"+r),UI(),KE(),pg("controlId","param-desc-"+r),KE(),pg("id","param-desc-"+r),UI(),KE(),pg("controlId","param-default-"+r),KE(),pg("id","param-default-"+r),UI();}}function _e(o,t){if(o&1){let e=aC();Is(0,"div",14)(1,"span",33),UC(2),ml(),Is(3,"ds-form-field",34),hg(4,"textarea",35),VI(),ml(),Is(5,"button",36),Eg("click",function(){let d=mf(e).$index,m=fC(2);return yf(m.removeContentEntry(d))}),UC(6," \xD7 "),ml()();}if(o&2){let e=t.$implicit,r=t.$index,d=fC(2);KE(2),Lg(r+1),KE(),pg("error",e.invalid&&e.touched?"Content entry must not be blank.":null),KE(),pg("formControlName",r),fg("aria-label","Content entry "+(r+1)),UI(),KE(),pg("disabled",d.contentArray.length===1);}}function xe(o,t){if(o&1&&(Is(0,"ds-notice"),UC(1),ml()),o&2){let e=fC(2);KE(),Lg(e.errorMessage());}}function be(o,t){if(o&1){let e=aC();Is(0,"button",37),Eg("click",function(){mf(e);let d=fC(2);return yf(d.exportYaml())}),UC(1),ml();}if(o&2){let e=fC(2);pg("disabled",e.isExporting()),KE(),Il(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ee(o,t){if(o&1){let e=aC();Is(0,"form",4),Eg("ngSubmit",function(){mf(e);let d=fC();return yf(d.submit())}),Is(1,"ds-form-field",5),hg(2,"input",6),VI(),ml(),Is(3,"ds-form-field",7),hg(4,"input",8),VI(),ml(),Qw(5,ye,2,1),Is(6,"ds-fieldset",9)(7,"p",2),UC(8," Each parameter must have a name and a default value. Use "),Is(9,"code"),UC(10),ml(),UC(11," in content entries to reference them. "),ml(),Is(12,"div",10),Qw(13,ve,2,0,"p",2),eC(14,he,10,8,"div",11,Xw),Is(16,"div")(17,"button",12),Eg("click",function(){mf(e);let d=fC();return yf(d.addParameter())}),UC(18,"+ Add parameter"),ml()()()(),Is(19,"ds-fieldset",13)(20,"p",2),UC(21," Each content entry is a command. Use "),Is(22,"code"),UC(23,"@AgentName"),ml(),UC(24," to target an agent, "),Is(25,"code"),UC(26,"/promptName param1 param2"),ml(),UC(27," to call another prompt, and "),Is(28,"code"),UC(29),ml(),UC(30," for parameter placeholders. "),ml(),Is(31,"div",10),eC(32,_e,7,5,"div",14,Xw),Is(34,"div")(35,"button",12),Eg("click",function(){mf(e);let d=fC();return yf(d.addContentEntry())}),UC(36,"+ Add content entry"),ml()()()(),Qw(37,xe,2,1,"ds-notice"),Is(38,"ds-form-field",15),hg(39,"textarea",16),VI(),ml(),Is(40,"ds-form-actions")(41,"button",17),UC(42),ml(),Qw(43,be,2,2,"button",18),Is(44,"button",19),Eg("click",function(){mf(e);let d=fC();return yf(d.cancel())}),UC(45,"Cancel"),ml()()();}if(o&2){let e=fC();pg("formGroup",e.form),KE(),pg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),KE(),pg("formControl",e.nameControl),UI(),KE(2),pg("formControl",e.descriptionControl),UI(),KE(),Kw(e.availableAgentConfigs().length>0?5:-1),KE(5),Lg(e.paramPlaceholderSyntax),KE(2),pg("formArrayName","parameters"),KE(),Kw(e.parametersArray.length===0?13:-1),KE(),tC(e.parametersArray.controls),KE(15),Lg(e.paramPlaceholderSyntax),KE(2),pg("formArrayName","content"),KE(),tC(e.contentArray.controls),KE(5),Kw(e.errorMessage()?37:-1),KE(),pg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),KE(),pg("formControl",e.externalMetadataJsonControl),UI(),KE(2),pg("disabled",e.form.invalid||e.isSubmitting()),KE(),Il(" ",e.isEditMode()?"Save changes":"Create"," "),KE(),Kw(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=xw({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()}),UC(3),ml()(),Qw(4,ue,2,0,"p",2)(5,Ee,46,16,"form",3),ml()),e&2&&(KE(),pg("title",r.isEditMode()?"Edit prompt":"New prompt"),KE(2),Il(" \u2190 ",r.isPlatformMode?"Platform prompts":"Prompts"," "),KE(),Kw(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 +0,0 @@
|
|
|
1
|
-
import {o as o$1,r,i,l}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-BibOnln8.js';import {O}from'./chunk-QA5UvRgp.js';import {g,W,F as F$1,H as we,ag as U,ay as N,z as zi,az as Q,a8 as _,k as yT,a9 as F$2,aA as $e$1,M as U$1,a2 as ga,aa as _r,ac as Ny,ad as ne,P as x,O as w,x as xw,au as $t,I as Is,S as Eg,U as UC,m as ml,Q as Qw,K as KE,R as pg,b as Kw,r as fC,s as aC,a as hg,T as VI,X as UI,j as fg,q as Il,l as eC,t as tC,L as Lg,u as mf,w as yf,as as jg}from'./main-WIKPRSWZ.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-BY4pYYCq.js';import'./chunk-BNT94xkt.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),UC(1,"View resolved definition \u2192"),ml()),n&2){let e=fC();pg("routerLink",e.inspectRoute());}}function Xe(n,t){n&1&&(Is(0,"ds-tag",3),UC(1,"Platform level"),ml());}function Qe(n,t){n&1&&(Is(0,"p",4),UC(1,"Loading\u2026"),ml());}function Ze(n,t){if(n&1&&(hg(0,"input",17),VI()),n&2){let e=fC(2);pg("formControl",e.modelNameControl),UI();}}function et(n,t){if(n&1&&(Is(0,"option",41),UC(1),ml()),n&2){let e=t;pg("ngValue",e.value),KE(),Lg(e.label);}}function tt(n,t){if(n&1&&(Is(0,"option",41),UC(1),ml()),n&2){let e=t.$implicit;pg("ngValue",e.value),KE(),Lg(e.label);}}function nt(n,t){if(n&1&&(Is(0,"optgroup",42),eC(1,tt,2,2,"option",41,je),ml()),n&2){let e=fC(3);KE(),tC(e.modelOptions().aliases);}}function it(n,t){if(n&1&&(Is(0,"option",41),UC(1),ml()),n&2){let e=t.$implicit;pg("ngValue",e.value),KE(),Lg(e.label);}}function ot(n,t){if(n&1&&(Is(0,"optgroup",43),eC(1,it,2,2,"option",41,je),ml()),n&2){let e=fC(3);KE(),tC(e.modelOptions().apiNames);}}function at(n,t){if(n&1&&(Is(0,"select",18)(1,"option",40),UC(2,"Select a model"),ml(),Qw(3,et,2,2,"option",41),Qw(4,nt,3,0,"optgroup",42),Qw(5,ot,3,0,"optgroup",43),ml(),VI()),n&2){let e,i=fC(2);pg("formControl",i.modelNameControl),UI(),KE(),pg("ngValue",null),KE(2),Kw((e=i.modelOptions().current)?3:-1,e),KE(),Kw(i.modelOptions().aliases.length>0?4:-1),KE(),Kw(i.modelOptions().apiNames.length>0?5:-1);}}function lt(n,t){if(n&1&&(Is(0,"span",44),UC(1),ml()),n&2){let e=fC().$implicit;KE(),Lg(e.config.integrationType);}}function rt(n,t){if(n&1&&(hg(0,"input",45),VI()),n&2){let e=fC().$implicit;pg("formControl",e.toolsControl),fg("aria-label","Tools of "+e.config.name),UI();}}function st(n,t){if(n&1){let e=aC();Is(0,"div",10)(1,"label",11)(2,"input",23),Eg("change",function(){let s=mf(e).$implicit,c=fC(3);return yf(c.toggleIntegration(s))}),ml(),Is(3,"span",24),UC(4),ml(),Qw(5,lt,2,1,"span",44),ml(),Qw(6,rt,1,2,"input",45),ml();}if(n&2){let e=t.$implicit;KE(2),pg("checked",e.enabled()),KE(2),Lg(e.config.name),KE(),Kw(e.config.integrationType?5:-1),KE(),Kw(e.enabled()?6:-1);}}function dt(n,t){if(n&1&&(Is(0,"p",13),UC(1),ml()),n&2){let e=fC().$implicit;KE(),Il(" Restricted to: ",e.restrictedTools.join(", ")," (set outside this form, preserved on save) ");}}function ct(n,t){if(n&1){let e=aC();Is(0,"div",10)(1,"label",24),UC(2),Is(3,"span",44),UC(4,"built-in"),ml()(),Is(5,"select",47),Eg("change",function(s){let c=mf(e).$implicit,C=fC(4);return yf(C.setBuiltInState(c,s.target.value))}),Is(6,"option",48),UC(7),ml(),Is(8,"option",49),UC(9,"Enabled"),ml(),Is(10,"option",50),UC(11,"Disabled"),ml()(),Qw(12,dt,2,1,"p",13),Is(13,"p",13),UC(14),ml()();}if(n&2){let e=t.$implicit,i=fC(4);KE(),fg("for","built-in-"+e.type),KE(),Il(" ",e.displayName," "),KE(3),pg("id","built-in-"+e.type)("value",e.state()),KE(2),Lg(i.builtInDefaultLabel(e)),KE(5),Kw(e.state()==="on"&&e.restrictedTools?12:-1),KE(2),Lg(e.description);}}function mt(n,t){if(n&1&&(Is(0,"span",46),UC(1,"Built-in integrations"),ml(),eC(2,ct,15,7,"div",10,qe)),n&2){let e=fC(3);KE(2),tC(e.builtInRows());}}function ut(n,t){n&1&&(Is(0,"ds-notice",26),UC(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),eC(1,st,7,4,"div",10,Ye),Qw(3,mt,4,0),Qw(4,ut,2,0,"ds-notice",26),ml()),n&2){let e=fC(2);KE(),tC(e.integrationRows()),KE(2),Kw(e.builtInRows().length>0?3:-1),KE(),Kw(e.configAgentExposureWarning()?4:-1);}}function pt(n,t){n&1&&UC(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),UC(1," Saving with this on replaces the selection below with "),Is(2,"code",25),UC(3,"*"),ml(),UC(4,". "),ml());}function Ct(n,t){n&1&&(Is(0,"ds-notice"),UC(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),UC(1,"No skill available in this scope yet."),ml());}function bt(n,t){n&1&&(Is(0,"span",44),UC(1,"platform"),ml());}function ht(n,t){if(n&1&&(Is(0,"span",44),UC(1),ml()),n&2){let e=fC(4);KE(),Il(" ",e.skillCatalogueUnavailable()?"not verified":"no matching skill"," ");}}function yt(n,t){if(n&1&&(Is(0,"p",13),UC(1),ml()),n&2){let e=fC().$implicit;KE(),Lg(e.description);}}function vt(n,t){if(n&1){let e=aC();Is(0,"div",10)(1,"label",11)(2,"input",51),Eg("change",function(){let s=mf(e).$implicit,c=fC(3);return yf(c.toggleSkill(s))}),ml(),Is(3,"span",24),UC(4),ml(),Qw(5,bt,2,0,"span",44),Qw(6,ht,2,1,"span",44),ml(),Qw(7,yt,2,1,"p",13),ml();}if(n&2){let e=t.$implicit,i=fC(3);KE(2),pg("checked",e.selected())("disabled",i.allSkillsSelected()),KE(2),Lg(e.name),KE(),Kw(e.platform?5:-1),KE(),Kw(e.unresolved?6:-1),KE(),Kw(e.description?7:-1);}}function xt(n,t){if(n&1&&eC(0,vt,8,6,"div",10,We),n&2){let e=fC(2);tC(e.skillRows());}}function St(n,t){if(n&1&&(Is(0,"ds-form-field",30),hg(1,"textarea",52),VI(),Is(2,"p",4),UC(3," Default payload for this loop agent. Overridden at launch time if the first message contains a valid "),Is(4,"code"),UC(5,"AgentLoopPayload"),ml(),UC(6,". Leave empty if you always provide the payload at launch. "),ml()()),n&2){let e=fC(2);pg("error",e.loopConfigControl.invalid&&e.loopConfigControl.touched?"Invalid JSON \u2014 please fix the syntax.":null),KE(),pg("placeholder",e.loopConfigPlaceholder)("formControl",e.loopConfigControl),UI();}}function At(n,t){n&1&&UC(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&&UC(0),n&2){let e=fC(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),UC(1," Saving with this on replaces the selection below with "),Is(2,"code",25),UC(3,"*"),ml(),UC(4,". "),Qw(5,wt,1,2),ml()),n&2){let e=fC(2);KE(5),Kw(e.droppedUnresolvedSubAgents()>0?5:-1);}}function Tt(n,t){n&1&&(Is(0,"ds-notice"),UC(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),UC(1,"No other agent is available in this scope yet."),ml());}function It(n,t){n&1&&(Is(0,"span",44),UC(1,"pattern"),ml());}function Rt(n,t){n&1&&(Is(0,"span",44),UC(1,"via pattern"),ml());}function Mt(n,t){if(n&1&&(Is(0,"span",44),UC(1),ml()),n&2){let e=fC(4);KE(),Il(" ",e.subAgentCandidatesUnavailable()?"not verified":"no matching agent"," ");}}function Ft(n,t){if(n&1){let e=aC();Is(0,"button",55),Eg("click",function(){mf(e);let s=fC().$implicit,c=fC(3);return yf(c.removeSubAgent(s))}),UC(1," \xD7 "),ml();}if(n&2){let e=fC().$implicit;fg("aria-label","Remove "+e.selector);}}function Nt(n,t){if(n&1){let e=aC();Is(0,"div",32)(1,"label",53)(2,"input",51),Eg("change",function(){let s=mf(e).$implicit,c=fC(3);return yf(c.toggleSubAgent(s))}),ml(),Is(3,"span",24),UC(4),ml(),Qw(5,It,2,0,"span",44)(6,Rt,2,0,"span",44)(7,Mt,2,1,"span",44),ml(),Qw(8,Ft,2,1,"button",54),ml();}if(n&2){let e=t.$implicit,i=fC(3);KE(2),pg("checked",e.selected())("disabled",i.allSubAgentsSelected()),KE(2),Lg(e.name),KE(),Kw(e.pattern?5:e.grantedByPattern?6:e.unresolved?7:-1),KE(3),Kw(e.unresolved?8:-1);}}function Dt(n,t){if(n&1&&eC(0,Nt,9,5,"div",32,We),n&2){let e=fC(2);tC(e.subAgentRows());}}function Lt(n,t){if(n&1){let e=aC();Is(0,"div")(1,"button",56),Eg("click",function(){mf(e);let s=fC(2);return yf(s.useDefaultDelegationTimeout())}),UC(2," Use server default "),ml()();}}function Vt(n,t){n&1&&(Is(0,"ds-notice"),UC(1),ml()),n&2&&(KE(),Lg(t));}function Pt(n,t){if(n&1){let e=aC();Is(0,"button",57),Eg("click",function(){mf(e);let s=fC(2);return yf(s.exportYaml())}),UC(1),ml();}if(n&2){let e=fC(2);pg("disabled",e.isExporting()),KE(),Il(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ot(n,t){if(n&1){let e=aC();Is(0,"form",6),Eg("ngSubmit",function(){mf(e);let s=fC();return yf(s.submit())}),Is(1,"ds-fieldset",7)(2,"ds-form-field",8),hg(3,"input",9),VI(),ml(),Is(4,"div",10)(5,"label",11),hg(6,"input",12),VI(),UC(7," Enabled "),ml(),Is(8,"p",13),UC(9,"Disabled agents are excluded from namespace resolution."),ml()(),Is(10,"ds-form-field",14),hg(11,"input",15),VI(),ml(),Is(12,"ds-form-field",16),Qw(13,Ze,1,1,"input",17)(14,at,6,5,"select",18),ml(),Is(15,"ds-form-field",19),hg(16,"textarea",20),VI(),ml()(),Qw(17,gt,5,2,"ds-fieldset",21),Is(18,"ds-fieldset",22)(19,"p",4),UC(20," Instruction bundles this agent can read on demand. Selecting at least one grants it the "),Is(21,"code"),UC(22,"readSkill"),ml(),UC(23," and "),Is(24,"code"),UC(25,"readSkillResource"),ml(),UC(26," tools; selecting none grants neither. "),Qw(27,pt,1,0),ml(),Is(28,"label",11)(29,"input",23),Eg("change",function(){mf(e);let s=fC();return yf(s.toggleAllSkills())}),ml(),Is(30,"span",24),UC(31,"Every skill in the catalogue ("),Is(32,"code",25),UC(33,"*"),ml(),UC(34,")"),ml()(),Is(35,"p",13),UC(36," Resolved at run time, so skills added later are granted too, without editing this agent. "),ml(),Qw(37,ft,5,0,"ds-notice",26),Qw(38,Ct,2,0,"ds-notice"),Qw(39,_t,2,0,"p",4)(40,xt,2,0),ml(),Is(41,"ds-form-field",27)(42,"select",28)(43,"option",29),UC(44,"SIMPLE \u2014 Standard agent (single LLM call)"),ml(),Is(45,"option",29),UC(46,"ADVANCED \u2014 Multi-step reasoning loop"),ml(),Is(47,"option",29),UC(48,"LOOP \u2014 Bulk loop agent (no LLM, experimental)"),ml()(),VI(),ml(),Qw(49,St,7,3,"ds-form-field",30),Is(50,"ds-fieldset",31)(51,"p",4),UC(52," The agents this one may delegate to. Selecting at least one grants it the "),Is(53,"code"),UC(54,"DELEGATE__delegate"),ml(),UC(55," tool; selecting none grants it no way to delegate. Entries are matched against agent names, never ids. "),Qw(56,At,1,0),ml(),Is(57,"label",11)(58,"input",23),Eg("change",function(){mf(e);let s=fC();return yf(s.toggleAllSubAgents())}),ml(),Is(59,"span",24),UC(60,"Every agent it can reach ("),Is(61,"code",25),UC(62,"*"),ml(),UC(63,")"),ml()(),Is(64,"p",13),UC(65," Resolved at run time, so agents added later can be delegated to as well, without editing this agent. "),ml(),Qw(66,Et,6,1,"ds-notice",26),Qw(67,Tt,2,0,"ds-notice"),Qw(68,kt,2,0,"p",4)(69,Dt,2,0),Is(70,"p",4),UC(71," Advanced \u2014 add a glob instead of picking a name, for example "),Is(72,"code"),UC(73,"*Fixer"),ml(),UC(74," to cover BugFixer and StoryFixer. "),ml(),Is(75,"div",32)(76,"input",33),Eg("keydown.enter",function(){mf(e);let s=fC();return yf(s.addSubAgent())}),ml(),VI(),Is(77,"button",34),Eg("click",function(){mf(e);let s=fC();return yf(s.addSubAgent())}),UC(78," + "),ml()(),Is(79,"ds-form-field",35),hg(80,"input",36),VI(),Qw(81,Lt,3,0,"div"),ml()(),Qw(82,Vt,2,1,"ds-notice"),Is(83,"ds-form-actions")(84,"button",37),UC(85),ml(),Qw(86,Pt,2,2,"button",38),Is(87,"button",39),Eg("click",function(){mf(e);let s=fC();return yf(s.cancel())}),UC(88,"Cancel"),ml()()();}if(n&2){let e,i=fC();pg("formGroup",i.form),KE(3),pg("formControl",i.nameControl),UI(),KE(3),pg("formControl",i.enabledControl),UI(),KE(5),pg("formControl",i.descriptionControl),UI(),KE(2),Kw(i.modelAsFreeText()?13:14),KE(3),pg("formControl",i.instructionsControl),UI(),KE(),Kw(i.integrationRows().length>0||i.builtInRows().length>0?17:-1),KE(10),Kw(i.isPlatformMode?27:-1),KE(2),pg("checked",i.allSkillsSelected()),KE(8),Kw(i.namedSkillSelectionDropped()?37:-1),KE(),Kw(i.skillCatalogueUnavailable()?38:-1),KE(),Kw(i.skillRows().length===0?39:40),KE(3),pg("formControl",i.executionModeControl),UI(),KE(),pg("value",i.ExecutionMode.SIMPLE),KE(2),pg("value",i.ExecutionMode.ADVANCED),KE(2),pg("value",i.ExecutionMode.LOOP),KE(2),Kw(i.isLoopMode()?49:-1),KE(7),Kw(i.isPlatformMode?56:-1),KE(2),pg("checked",i.allSubAgentsSelected()),KE(8),Kw(i.namedSubAgentSelectionDropped()?66:-1),KE(),Kw(i.subAgentCandidatesUnavailable()?67:-1),KE(),Kw(i.subAgentRows().length===0?68:69),KE(8),pg("formControl",i.newSubAgentControl),UI(),KE(),pg("disabled",!i.newSubAgentControl.value.trim()),KE(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),KE(),pg("formControl",i.delegationTimeoutControl),fg("aria-invalid",i.delegationTimeoutControl.invalid),UI(),KE(),Kw(i.delegationTimeoutControl.value!==null?81:-1),KE(),Kw((e=i.submitError())?82:-1,e),KE(2),pg("disabled",i.form.invalid||i.isSubmitting()),KE(),Il(" ",i.isEditMode()?"Save changes":"Create"," "),KE(),Kw(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=yT(()=>{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=yT(()=>this.executionModeValue()==="LOOP");subAgentRows=zi([]);allSubAgentsSelected=zi(false);subAgentCandidatesUnavailable=zi(false);namedSubAgentSelectionDropped=yT(()=>this.allSubAgentsSelected()&&this.subAgentRows().some(t=>t.selected()));droppedUnresolvedSubAgents=yT(()=>this.allSubAgentsSelected()?this.subAgentRows().filter(t=>t.unresolved&&t.selected()).length:0);hasAnySubAgent=yT(()=>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=$e$1;loopConfigPlaceholder=JSON.stringify({search:{tool:"SearchTalents",params:{talentId:["6ac76692a909eaaae0b078d6"],resolveTargets:["MANAGER"],next:null}},act:{agentName:"ProfileCaretaker",promptTemplate:"This talent has not completed their profile. As their manager, I need you to help me review and improve it."}},null,2);builtInRows=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=yT(()=>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=yT(()=>{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=yT(()=>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=xw({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()}),UC(3," \u2190 Agent configs "),ml(),Qw(4,ze,2,1,"a",2),Qw(5,Xe,2,0,"ds-tag",3),ml(),Qw(6,Qe,2,0,"p",4)(7,Ot,89,33,"form",5),ml()),e&2&&(KE(),pg("title",i.isEditMode()?"Edit agent config":"New agent config"),KE(3),Kw(i.isEditMode()?4:-1),KE(),Kw(i.isPlatformMode?5:-1),KE(),Kw(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};
|