@whoz-oss/coday-client 3.33.0 → 3.34.0
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-CK18gZ63.js → chunk-1pMMl5aQ.js} +1 -1
- package/browser/chunk-24Rqvp-B.js +1 -0
- package/browser/{chunk-BpSHA6TV.js → chunk-3SjkoJQ2.js} +1 -1
- package/browser/{chunk-BFY0pXEf.js → chunk-6yN7LoqT.js} +1 -1
- package/browser/{chunk-D8sYWCcr.js → chunk-8bJEDZYk.js} +1 -1
- package/browser/chunk-9B6pDYGf.js +1 -0
- package/browser/{chunk-BjFLkaZE.js → chunk-9Y4DMIzP.js} +1 -1
- package/browser/{chunk-DWSvE7KY.js → chunk-B0wi4IQ8.js} +1 -1
- package/browser/{chunk-CkBh9-Fw.js → chunk-B1h8Rr_L.js} +1 -1
- package/browser/{chunk-CtHF-uul.js → chunk-B400uKLU.js} +1 -1
- package/browser/{chunk-D3gurhpR.js → chunk-B4GIoG1U.js} +1 -1
- package/browser/{chunk-CNmZmLwF.js → chunk-BAHGxBjI.js} +1 -1
- package/browser/{chunk-DR5zNU0n.js → chunk-BByguAe9.js} +1 -1
- package/browser/{chunk-AB2V4DzP.js → chunk-BECO5DZL.js} +1 -1
- package/browser/{chunk-C0KRHI6e.js → chunk-BEoycX98.js} +1 -1
- package/browser/{chunk-BXZoje_o.js → chunk-BHtGbjK6.js} +1 -1
- package/browser/{chunk-BopMYlkE.js → chunk-BK-SvUGW.js} +1 -1
- package/browser/chunk-BLltB5Fl.js +1 -0
- package/browser/{chunk-DmNKvrHl.js → chunk-BOwbpQDE.js} +1 -1
- package/browser/{chunk-Mxaxers6.js → chunk-B_wrSH-e.js} +1 -1
- package/browser/{chunk-CJGzYd_S.js → chunk-Begup16p.js} +1 -1
- package/browser/{chunk-C2Inb2UP.js → chunk-BqbE20yc.js} +1 -1
- package/browser/{chunk-DVrM3JI8.js → chunk-BscGFXSw.js} +1 -1
- package/browser/{chunk-CnEa9fH2.js → chunk-Bt_Yi0KO.js} +1 -1
- package/browser/{chunk-D6BBuWSd.js → chunk-BvggdF8d.js} +1 -1
- package/browser/{chunk--r2IPkvN.js → chunk-C5xuZf5R.js} +1 -1
- package/browser/{chunk-4NMdLPHF.js → chunk-C7OQXeW9.js} +1 -1
- package/browser/{chunk-DsFEZkSl.js → chunk-C8eqogQ9.js} +1 -1
- package/browser/{chunk-DZUhjamf.js → chunk-CDyIhHOt.js} +1 -1
- package/browser/{chunk-Bx_FH6m3.js → chunk-CGjjc55P.js} +6 -6
- package/browser/{chunk-F5WjZgr6.js → chunk-CJCjJyKP.js} +1 -1
- package/browser/{chunk-CniyJRG1.js → chunk-CLaD3yHE.js} +1 -1
- package/browser/{chunk-B3KKH9dW.js → chunk-CMjxkuFH.js} +2 -2
- package/browser/{chunk-O4nbXJCv.js → chunk-CS3cO2Tx.js} +1 -1
- package/browser/{chunk-D3fatnCm.js → chunk-CT8vu_Pw.js} +1 -1
- package/browser/chunk-CThe5GoQ.js +1 -0
- package/browser/{chunk-S9BROQKc.js → chunk-CX3BRjB5.js} +1 -1
- package/browser/{chunk-DqzTsn7a.js → chunk-CXqNbVXr.js} +1 -1
- package/browser/{chunk-BPkyqr-f.js → chunk-CZe6uHRZ.js} +1 -1
- package/browser/{chunk-CglVp4ZH.js → chunk-Ceb8iCgi.js} +1 -1
- package/browser/{chunk-4QqbIPaR.js → chunk-Ci0veFyD.js} +1 -1
- package/browser/{chunk-C_J2R_PK.js → chunk-CqTTbhQw.js} +1 -1
- package/browser/{chunk-DAk8SIkq.js → chunk-D-bfzu2J.js} +1 -1
- package/browser/{chunk-BhXLqAug.js → chunk-DE0C-yKk.js} +1 -1
- package/browser/{chunk-CEQ5C5Tx.js → chunk-DFjEHH4o.js} +1 -1
- package/browser/{chunk-BrUYkz33.js → chunk-DGUwcds6.js} +1 -1
- package/browser/{chunk-KIJUJ9nq.js → chunk-DH80wnhH.js} +1 -1
- package/browser/{chunk-P6Fi8ohd.js → chunk-DLpC4uuD.js} +1 -1
- package/browser/chunk-DOeIIw1a.js +1 -0
- package/browser/{chunk-CZmNdEYy.js → chunk-DS1gnXQd.js} +1 -1
- package/browser/{chunk-DFLL0Odh.js → chunk-DUTqrLQ0.js} +2 -2
- package/browser/{chunk-DstI03OT.js → chunk-DVK2B443.js} +1 -1
- package/browser/chunk-DY8YywkA.js +1 -0
- package/browser/chunk-DdPOtjZp.js +10 -0
- package/browser/{chunk-B_gHVcU6.js → chunk-DfHrtnxD.js} +1 -1
- package/browser/{chunk-DZuvl0-q.js → chunk-DmpFu0Pv.js} +1 -1
- package/browser/{chunk-CJIgE5YB.js → chunk-Dn1IeSER.js} +1 -1
- package/browser/{chunk-B-Ejl4sU.js → chunk-DpjNfc-X.js} +1 -1
- package/browser/{chunk-COD2O4SF.js → chunk-DvkkGOWr.js} +1 -1
- package/browser/{chunk-1mA1C1Ia.js → chunk-Dy3jpvsK.js} +1 -1
- package/browser/chunk-DzRcZL5W.js +4 -0
- package/browser/{chunk-Cq3KqN1m.js → chunk-O_d524Nl.js} +1 -1
- package/browser/chunk-U55ggdv9.js +1 -0
- package/browser/{chunk-B4hQ_D8H.js → chunk-ZnMmRxVz.js} +1 -1
- package/browser/{chunk-VE530Qd2.js → chunk-_pYIE7Vn.js} +1 -1
- package/browser/{chunk-CJxkwaxD.js → chunk-b-dxVOcr.js} +1 -1
- package/browser/{chunk-B_-1xOxe.js → chunk-e71Ldo0f.js} +1 -1
- package/browser/{chunk-QcmfFN_C.js → chunk-heXluV0a.js} +1 -1
- package/browser/{chunk-D-l2ORqm.js → chunk-iFWDza_l.js} +1 -1
- package/browser/{chunk-bgvmHk7z.js → chunk-qlZmtZOW.js} +1 -1
- package/browser/{chunk-CGn0orvL.js → chunk-x_UzK7O8.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/{main-2EYBZUJC.js → main-GYSPY3UE.js} +13 -13
- package/package.json +1 -1
- package/browser/chunk-BWcVMw4T.js +0 -1
- package/browser/chunk-Bk2EXxig.js +0 -4
- package/browser/chunk-CG3MF0H4.js +0 -1
- package/browser/chunk-D-QPhn7p.js +0 -1
- package/browser/chunk-D3BAOO_0.js +0 -1
- package/browser/chunk-DnMJl9Ao.js +0 -1
- package/browser/chunk-DzWQQKpk.js +0 -1
- package/browser/chunk-kFOHrPbJ.js +0 -10
- package/browser/chunk-lU3996br.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import {m}from'./chunk-kFOHrPbJ.js';import {g,ao as V,G,C as Ce$1,da as M,a as Gi,b as U,a7 as ya,W as br,x,w,e as xw,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,a5 as vl,a8 as Yg,y as eC,a9 as lC,S as Sg,a3 as VI,t as rC,bo as tC,ac as gC,v as bg,A as Ug,a6 as UI,z as oC,aa as If,ab as wf}from'./main-2EYBZUJC.js';import {o as z,z as ze,k as _t,b as _e$1,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,A as At,Z as Zn,l as Xn,C as Cn,E as En,p as An,q as Ct,V as Vt}from'./chunk-CZmNdEYy.js';import'./chunk-DqzTsn7a.js';import'./chunk-Bx_FH6m3.js';import'./chunk-BPkyqr-f.js';var ne=(i,t)=>t.id;function ie(i,t){i&1&&(ws(0,"p",5),GC(1,"Loading\u2026"),pl());}function ae(i,t){i&1&&(ws(0,"span",12),GC(1,"Name is required."),pl());}function le(i,t){if(i&1&&(ws(0,"p",32),GC(1),pl(),ws(2,"span",26),GC(3,"Agent Config cannot be changed after creation."),pl()),i&2){let e=gC(3);XE(),Yg(e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function me(i,t){if(i&1&&(ws(0,"option",34),GC(1),pl()),i&2){let e=t.$implicit;bg("ngValue",e.id),XE(),Yg(e.name);}}function pe(i,t){if(i&1&&(ws(0,"select",33)(1,"option",34),GC(2,"\u2014 None \u2014"),pl(),rC(3,me,2,2,"option",34,ne),pl(),VI(),ws(5,"span",26),GC(6,"Optional. Links this prompt to an agent as a starter. Immutable after creation."),pl()),i&2){let e=gC(3);bg("formControl",e.agentConfigIdControl),UI(),XE(),bg("ngValue",null),XE(2),oC(e.availableAgentConfigs());}}function de(i,t){if(i&1&&(ws(0,"div",8)(1,"label",31),GC(2,"Agent Config"),pl(),Jw(3,le,4,1)(4,pe,7,2),pl()),i&2){let e=gC(2);XE(3),eC(e.isEditMode()&&e.agentConfigIdControl.value?3:e.isEditMode()?-1:4);}}function ce(i,t){i&1&&(ws(0,"p",19),GC(1,"No parameters defined."),pl());}function se(i,t){i&1&&(ws(0,"span",12),GC(1,"Parameter name is required."),pl());}function _e(i,t){if(i&1){let e=lC();ws(0,"div",20)(1,"div",35)(2,"div",36)(3,"label",37),GC(4,"Name "),ws(5,"span",10),GC(6,"*"),pl()(),Sg(7,"input",38),VI(),Jw(8,se,2,0,"span",12),pl(),ws(9,"div",36)(10,"label",37),GC(11,"Description"),pl(),Sg(12,"input",39),VI(),pl(),ws(13,"div",36)(14,"label",37),GC(15,"Default value"),pl(),Sg(16,"input",40),VI(),pl()(),ws(17,"button",41),Rg("click",function(){let m=If(e).$index,d=gC(2);return wf(d.removeParameter(m))}),GC(18," \xD7 "),pl()();}if(i&2){let e=t.$implicit,l=t.$index;bg("formGroupName",l),XE(3),bg("for","param-name-"+l),XE(4),Ug("prompt-form__input--invalid",e.controls.name.invalid&&e.controls.name.touched),bg("id","param-name-"+l),UI(),XE(),eC(e.controls.name.invalid&&e.controls.name.touched?8:-1),XE(2),bg("for","param-desc-"+l),XE(2),bg("id","param-desc-"+l),UI(),XE(2),bg("for","param-default-"+l),XE(2),bg("id","param-default-"+l),UI();}}function fe(i,t){i&1&&(ws(0,"span",12),GC(1,"Content entry must not be blank."),pl());}function ue(i,t){if(i&1){let e=lC();ws(0,"div",22)(1,"span",42),GC(2),pl(),ws(3,"div",43),Sg(4,"textarea",44),VI(),Jw(5,fe,2,0,"span",12),pl(),ws(6,"button",45),Rg("click",function(){let m=If(e).$index,d=gC(2);return wf(d.removeContentEntry(m))}),GC(7," \xD7 "),pl()();}if(i&2){let e=t.$implicit,l=t.$index,m=gC(2);XE(2),Yg(l+1),XE(2),Ug("prompt-form__textarea--invalid",e.invalid&&e.touched),bg("formControlName",l),UI(),XE(),eC(e.invalid&&e.touched?5:-1),XE(),bg("disabled",m.contentArray.length===1);}}function ge(i,t){if(i&1&&(ws(0,"p",23),GC(1),pl()),i&2){let e=gC(2);XE(),Yg(e.errorMessage());}}function Ce(i,t){i&1&&(ws(0,"span",12),GC(1,"Invalid JSON."),pl());}function xe(i,t){if(i&1){let e=lC();ws(0,"button",46),Rg("click",function(){If(e);let m=gC(2);return wf(m.exportYaml())}),GC(1),pl();}if(i&2){let e=gC(2);bg("disabled",e.isExporting()),XE(),vl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function ve(i,t){if(i&1){let e=lC();ws(0,"form",7),Rg("ngSubmit",function(){If(e);let m=gC();return wf(m.submit())}),ws(1,"div",8)(2,"label",9),GC(3,"Name "),ws(4,"span",10),GC(5,"*"),pl()(),Sg(6,"input",11),VI(),Jw(7,ae,2,0,"span",12),pl(),ws(8,"div",8)(9,"label",13),GC(10,"Description"),pl(),Sg(11,"input",14),VI(),pl(),Jw(12,de,5,1,"div",8),ws(13,"fieldset",15)(14,"legend",16),GC(15," Parameters "),ws(16,"span",17),GC(17,"Named placeholders used in content"),pl()(),ws(18,"p",18),GC(19," Each parameter must have a name and a default value. Use "),ws(20,"code"),GC(21),pl(),GC(22," in content entries to reference them. "),pl(),Jw(23,ce,2,0,"p",19),rC(24,_e,19,10,"div",20,tC),ws(26,"button",21),Rg("click",function(){If(e);let m=gC();return wf(m.addParameter())}),GC(27,"+ Add parameter"),pl()(),ws(28,"fieldset",15)(29,"legend",16),GC(30," Content "),ws(31,"span",10),GC(32,"*"),pl(),ws(33,"span",17),GC(34,"Ordered list of text commands"),pl()(),ws(35,"p",18),GC(36," Each content entry is a command. Use "),ws(37,"code"),GC(38,"@AgentName"),pl(),GC(39," to target an agent, "),ws(40,"code"),GC(41,"/promptName param1 param2"),pl(),GC(42," to call another prompt, and "),ws(43,"code"),GC(44),pl(),GC(45," for parameter placeholders. "),pl(),rC(46,ue,8,6,"div",22,tC),ws(48,"button",21),Rg("click",function(){If(e);let m=gC();return wf(m.addContentEntry())}),GC(49,"+ Add content entry"),pl()(),Jw(50,ge,2,1,"p",23),ws(51,"div",8)(52,"label",24),GC(53,"External Metadata"),pl(),Sg(54,"textarea",25),VI(),Jw(55,Ce,2,0,"span",12),ws(56,"span",26),GC(57,"Optional. Opaque JSON object stored as-is. Leave empty to clear."),pl()(),ws(58,"div",27)(59,"button",28),GC(60),pl(),Jw(61,xe,2,2,"button",29),ws(62,"button",30),Rg("click",function(){If(e);let m=gC();return wf(m.cancel())}),GC(63,"Cancel"),pl()()();}if(i&2){let e=gC();bg("formGroup",e.form),XE(6),Ug("prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),bg("formControl",e.nameControl),UI(),XE(),eC(e.nameControl.invalid&&e.nameControl.touched?7:-1),XE(4),bg("formControl",e.descriptionControl),UI(),XE(),eC(e.availableAgentConfigs().length>0?12:-1),XE(),bg("formArrayName","parameters"),XE(8),Yg(e.paramPlaceholderSyntax),XE(2),eC(e.parametersArray.length===0?23:-1),XE(),oC(e.parametersArray.controls),XE(4),bg("formArrayName","content"),XE(16),Yg(e.paramPlaceholderSyntax),XE(2),oC(e.contentArray.controls),XE(4),eC(e.errorMessage()?50:-1),XE(4),bg("formControl",e.externalMetadataJsonControl),UI(),XE(),eC(e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?55:-1),XE(4),bg("disabled",e.form.invalid||e.isSubmitting()),XE(),vl(" ",e.isEditMode()?"Save changes":"Create"," "),XE(),eC(e.isEditMode()?61:-1);}}var re=class i{route=g(V);router=g(G);destroyRef=g(Ce$1);promptState=g(m);agentConfigController=g(M);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new z({name:new _t("",{nonNullable:true,validators:[_e$1.required,_e$1.minLength(1)]}),description:new _t(null),agentConfigId:new _t(null),externalMetadataJson:new _t("",{nonNullable:true,validators:[be]}),content:new ze([this.createContentControl()],{validators:[_e$1.required]}),parameters:new ze([])});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=Gi(false);isSubmitting=Gi(false);isLoading=Gi(false);isExporting=Gi(false);errorMessage=Gi(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=Gi([]);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(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(this.destroyRef),ya(()=>br([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U(this.destroyRef),ya(()=>br([]))).subscribe(t=>this.agentConfigs.set(t));}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(l=>this.contentArray.push(this.createContentControl(l))),this.parametersArray.clear(),(t.parameters??[]).forEach(l=>this.parametersArray.push(this.createParameterGroup(l))),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 _t(t,{nonNullable:true,validators:[_e$1.required,_e$1.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl());}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t);}createParameterGroup(t){return new z({name:new _t(t?.name??"",{nonNullable:true,validators:[_e$1.required,_e$1.minLength(1)]}),description:new _t(t?.description??null),defaultValue:new _t(t?.defaultValue??"",{nonNullable:true,validators:[_e$1.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(d=>d.value.trim()),parameters:this.parametersArray.controls.map(d=>({name:d.controls.name.value.trim(),description:d.controls.description.value?.trim()||void 0,defaultValue:d.controls.defaultValue.value.trim()}))});t||(e.agentConfigId=this.agentConfigIdControl.value||null);let l=this.externalMetadataJsonControl.value.trim();e.externalMetadata=l?JSON.parse(l):null;let m=t?this.promptState.update(this.existingPrompt.id,e):this.promptState.create(e);this.errorMessage.set(null),m.pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:d=>{this.isSubmitting.set(false),d.status===409?this.errorMessage.set(`A prompt named "${e.name}" already exists in this scope.`):d.status===400?this.errorMessage.set(d.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(this.destroyRef)).subscribe({next:e=>{let l=new Blob([e],{type:"application/yaml"}),m=URL.createObjectURL(l),d=document.createElement("a");d.href=m,d.download=`${this.existingPrompt?.name??"prompt"}.yaml`,d.click(),URL.revokeObjectURL(m),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||i)};static \u0275cmp=xw({type:i,selectors:[["agentos-prompt-form"]],decls:10,vars:3,consts:[[1,"prompt-form"],[1,"prompt-form__header"],["type","button","title","Back to prompts",1,"prompt-form__back",3,"click"],[1,"prompt-form__back-icon"],[1,"prompt-form__title"],[1,"prompt-form__loading"],[1,"prompt-form__form",3,"formGroup"],[1,"prompt-form__form",3,"ngSubmit","formGroup"],[1,"prompt-form__field"],["for","prompt-name",1,"prompt-form__label"],["aria-hidden","true"],["id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",1,"prompt-form__input",3,"formControl"],[1,"prompt-form__field-error"],["for","prompt-description",1,"prompt-form__label"],["id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",1,"prompt-form__input",3,"formControl"],[1,"prompt-form__section",3,"formArrayName"],[1,"prompt-form__label"],[1,"prompt-form__label-hint"],[1,"prompt-form__section-hint"],[1,"prompt-form__empty-hint"],[1,"prompt-form__param-row",3,"formGroupName"],["type","button",1,"prompt-form__add-btn",3,"click"],[1,"prompt-form__content-row"],[1,"prompt-form__error"],["for","prompt-external-metadata",1,"prompt-form__label"],["id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",1,"prompt-form__textarea","prompt-form__textarea--code",3,"formControl"],[1,"prompt-form__field-hint"],[1,"prompt-form__actions"],["type","submit",1,"prompt-form__btn","prompt-form__btn--primary",3,"disabled"],["type","button",1,"prompt-form__btn","prompt-form__btn--export",3,"disabled"],["type","button",1,"prompt-form__btn",3,"click"],["for","prompt-agent-config",1,"prompt-form__label"],[1,"prompt-form__readonly-value"],["id","prompt-agent-config",1,"prompt-form__select",3,"formControl"],[3,"ngValue"],[1,"prompt-form__param-fields"],[1,"prompt-form__field","prompt-form__field--inline"],[1,"prompt-form__label",3,"for"],["type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",1,"prompt-form__input",3,"id"],["type","text","placeholder","Optional","formControlName","description","autocomplete","off",1,"prompt-form__input",3,"id"],["type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",1,"prompt-form__input",3,"id"],["type","button","title","Remove this parameter",1,"prompt-form__remove-btn",3,"click"],[1,"prompt-form__content-index"],[1,"prompt-form__content-field"],["rows","4","placeholder","Enter a command\u2026",1,"prompt-form__textarea",3,"formControlName"],["type","button","title","Remove this entry",1,"prompt-form__remove-btn",3,"click","disabled"],["type","button",1,"prompt-form__btn","prompt-form__btn--export",3,"click","disabled"]],template:function(e,l){e&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return l.cancel()}),ws(3,"span",3),GC(4,"\u2190"),pl(),GC(5),pl(),ws(6,"h1",4),GC(7),pl()(),Jw(8,ie,2,0,"p",5)(9,ve,64,18,"form",6),pl()),e&2&&(XE(5),vl(" ",l.isPlatformMode?"Platform prompts":"Prompts"," "),XE(2),Yg(l.isEditMode()?"Edit prompt":"New prompt"),XE(),eC(l.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,At,Zn,Xn,Cn,En,An,Ct,Vt],styles:[".prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.prompt-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.prompt-form__field--inline[_ngcontent-%COMP%]{flex:1}.prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.prompt-form__label-hint[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary);margin-left:.375rem}.prompt-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;cursor:pointer;appearance:auto;transition:border-color .15s ease}.prompt-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;padding:.5rem .875rem;border-radius:0;background:var(--color-bg-hover);border:1px solid var(--color-divider);color:var(--color-text);font-size:.9375rem}.prompt-form__input[_ngcontent-%COMP%], .prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.prompt-form__input[_ngcontent-%COMP%]:focus, .prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.prompt-form__input[_ngcontent-%COMP%]::placeholder, .prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.prompt-form__textarea--code[_ngcontent-%COMP%]{font-family:monospace;font-size:.85rem;resize:vertical}.prompt-form__section[_ngcontent-%COMP%]{border:1px solid var(--color-divider);border-radius:0;padding:1rem;margin:0;display:flex;flex-direction:column;gap:.75rem}.prompt-form__section-hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.prompt-form__empty-hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}.prompt-form__content-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-start}.prompt-form__content-field[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.25rem}.prompt-form__content-index[_ngcontent-%COMP%]{flex-shrink:0;width:1.5rem;padding-top:.6rem;font-size:.8rem;font-weight:600;color:var(--color-text-secondary);text-align:right;-webkit-user-select:none;user-select:none}.prompt-form__param-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-end;padding:.75rem;border-radius:0;background:var(--color-bg-hover)}.prompt-form__param-fields[_ngcontent-%COMP%]{flex:1;display:flex;gap:.75rem;flex-wrap:wrap}.prompt-form__add-btn[_ngcontent-%COMP%]{align-self:flex-start;padding:.4rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-accent);font-size:.875rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.prompt-form__add-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-accent)}.prompt-form__remove-btn[_ngcontent-%COMP%]{flex-shrink:0;width:1.75rem;height:1.75rem;display:flex;align-items:center;justify-content:center;border-radius:0;border:1px solid transparent;background:transparent;color:var(--color-neutral-500);font-size:1rem;line-height:1;cursor:pointer;transition:background .15s ease,color .15s ease,border-color .15s ease}.prompt-form__remove-btn[_ngcontent-%COMP%]:hover:not(:disabled){background:color-mix(in srgb,var(--red) 10%,transparent);color:var(--red);border-color:var(--red)}.prompt-form__remove-btn[_ngcontent-%COMP%]:disabled{opacity:.3;cursor:not-allowed}.prompt-form__error[_ngcontent-%COMP%]{margin:0;padding:.625rem .875rem;border-radius:0;background:color-mix(in srgb,var(--red) 10%,transparent);border:1px solid var(--red);color:var(--red);font-size:.875rem;line-height:1.4}.prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--red);line-height:1.3}.prompt-form__input--invalid[_ngcontent-%COMP%], .prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--red)}.prompt-form__input--invalid[_ngcontent-%COMP%]:focus, .prompt-form__textarea--invalid[_ngcontent-%COMP%]:focus{border-color:var(--red)}.prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}.prompt-form__btn--export[_ngcontent-%COMP%]{border-color:var(--color-divider);color:var(--color-text-secondary)}.prompt-form__btn--export[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--color-accent);color:var(--color-accent)}"]})};function be(i){let t=i.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}export{re as PromptFormComponent};
|
|
1
|
+
import {m}from'./chunk-DdPOtjZp.js';import {g,ao as V,G,C as Ce$1,da as M,a as Gi,b as U,a7 as ya,W as br,x,w,e as xw,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,a5 as vl,a8 as Yg,y as eC,a9 as lC,S as Sg,a3 as VI,t as rC,bo as tC,ac as gC,v as bg,A as Ug,a6 as UI,z as oC,aa as If,ab as wf}from'./main-GYSPY3UE.js';import {o as z,z as ze,k as _t,b as _e$1,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,A as At,Z as Zn,l as Xn,C as Cn,E as En,p as An,q as Ct,V as Vt}from'./chunk-DS1gnXQd.js';import'./chunk-CXqNbVXr.js';import'./chunk-CGjjc55P.js';import'./chunk-CZe6uHRZ.js';var ne=(i,t)=>t.id;function ie(i,t){i&1&&(ws(0,"p",5),GC(1,"Loading\u2026"),pl());}function ae(i,t){i&1&&(ws(0,"span",12),GC(1,"Name is required."),pl());}function le(i,t){if(i&1&&(ws(0,"p",32),GC(1),pl(),ws(2,"span",26),GC(3,"Agent Config cannot be changed after creation."),pl()),i&2){let e=gC(3);XE(),Yg(e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function me(i,t){if(i&1&&(ws(0,"option",34),GC(1),pl()),i&2){let e=t.$implicit;bg("ngValue",e.id),XE(),Yg(e.name);}}function pe(i,t){if(i&1&&(ws(0,"select",33)(1,"option",34),GC(2,"\u2014 None \u2014"),pl(),rC(3,me,2,2,"option",34,ne),pl(),VI(),ws(5,"span",26),GC(6,"Optional. Links this prompt to an agent as a starter. Immutable after creation."),pl()),i&2){let e=gC(3);bg("formControl",e.agentConfigIdControl),UI(),XE(),bg("ngValue",null),XE(2),oC(e.availableAgentConfigs());}}function de(i,t){if(i&1&&(ws(0,"div",8)(1,"label",31),GC(2,"Agent Config"),pl(),Jw(3,le,4,1)(4,pe,7,2),pl()),i&2){let e=gC(2);XE(3),eC(e.isEditMode()&&e.agentConfigIdControl.value?3:e.isEditMode()?-1:4);}}function ce(i,t){i&1&&(ws(0,"p",19),GC(1,"No parameters defined."),pl());}function se(i,t){i&1&&(ws(0,"span",12),GC(1,"Parameter name is required."),pl());}function _e(i,t){if(i&1){let e=lC();ws(0,"div",20)(1,"div",35)(2,"div",36)(3,"label",37),GC(4,"Name "),ws(5,"span",10),GC(6,"*"),pl()(),Sg(7,"input",38),VI(),Jw(8,se,2,0,"span",12),pl(),ws(9,"div",36)(10,"label",37),GC(11,"Description"),pl(),Sg(12,"input",39),VI(),pl(),ws(13,"div",36)(14,"label",37),GC(15,"Default value"),pl(),Sg(16,"input",40),VI(),pl()(),ws(17,"button",41),Rg("click",function(){let m=If(e).$index,d=gC(2);return wf(d.removeParameter(m))}),GC(18," \xD7 "),pl()();}if(i&2){let e=t.$implicit,l=t.$index;bg("formGroupName",l),XE(3),bg("for","param-name-"+l),XE(4),Ug("prompt-form__input--invalid",e.controls.name.invalid&&e.controls.name.touched),bg("id","param-name-"+l),UI(),XE(),eC(e.controls.name.invalid&&e.controls.name.touched?8:-1),XE(2),bg("for","param-desc-"+l),XE(2),bg("id","param-desc-"+l),UI(),XE(2),bg("for","param-default-"+l),XE(2),bg("id","param-default-"+l),UI();}}function fe(i,t){i&1&&(ws(0,"span",12),GC(1,"Content entry must not be blank."),pl());}function ue(i,t){if(i&1){let e=lC();ws(0,"div",22)(1,"span",42),GC(2),pl(),ws(3,"div",43),Sg(4,"textarea",44),VI(),Jw(5,fe,2,0,"span",12),pl(),ws(6,"button",45),Rg("click",function(){let m=If(e).$index,d=gC(2);return wf(d.removeContentEntry(m))}),GC(7," \xD7 "),pl()();}if(i&2){let e=t.$implicit,l=t.$index,m=gC(2);XE(2),Yg(l+1),XE(2),Ug("prompt-form__textarea--invalid",e.invalid&&e.touched),bg("formControlName",l),UI(),XE(),eC(e.invalid&&e.touched?5:-1),XE(),bg("disabled",m.contentArray.length===1);}}function ge(i,t){if(i&1&&(ws(0,"p",23),GC(1),pl()),i&2){let e=gC(2);XE(),Yg(e.errorMessage());}}function Ce(i,t){i&1&&(ws(0,"span",12),GC(1,"Invalid JSON."),pl());}function xe(i,t){if(i&1){let e=lC();ws(0,"button",46),Rg("click",function(){If(e);let m=gC(2);return wf(m.exportYaml())}),GC(1),pl();}if(i&2){let e=gC(2);bg("disabled",e.isExporting()),XE(),vl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function ve(i,t){if(i&1){let e=lC();ws(0,"form",7),Rg("ngSubmit",function(){If(e);let m=gC();return wf(m.submit())}),ws(1,"div",8)(2,"label",9),GC(3,"Name "),ws(4,"span",10),GC(5,"*"),pl()(),Sg(6,"input",11),VI(),Jw(7,ae,2,0,"span",12),pl(),ws(8,"div",8)(9,"label",13),GC(10,"Description"),pl(),Sg(11,"input",14),VI(),pl(),Jw(12,de,5,1,"div",8),ws(13,"fieldset",15)(14,"legend",16),GC(15," Parameters "),ws(16,"span",17),GC(17,"Named placeholders used in content"),pl()(),ws(18,"p",18),GC(19," Each parameter must have a name and a default value. Use "),ws(20,"code"),GC(21),pl(),GC(22," in content entries to reference them. "),pl(),Jw(23,ce,2,0,"p",19),rC(24,_e,19,10,"div",20,tC),ws(26,"button",21),Rg("click",function(){If(e);let m=gC();return wf(m.addParameter())}),GC(27,"+ Add parameter"),pl()(),ws(28,"fieldset",15)(29,"legend",16),GC(30," Content "),ws(31,"span",10),GC(32,"*"),pl(),ws(33,"span",17),GC(34,"Ordered list of text commands"),pl()(),ws(35,"p",18),GC(36," Each content entry is a command. Use "),ws(37,"code"),GC(38,"@AgentName"),pl(),GC(39," to target an agent, "),ws(40,"code"),GC(41,"/promptName param1 param2"),pl(),GC(42," to call another prompt, and "),ws(43,"code"),GC(44),pl(),GC(45," for parameter placeholders. "),pl(),rC(46,ue,8,6,"div",22,tC),ws(48,"button",21),Rg("click",function(){If(e);let m=gC();return wf(m.addContentEntry())}),GC(49,"+ Add content entry"),pl()(),Jw(50,ge,2,1,"p",23),ws(51,"div",8)(52,"label",24),GC(53,"External Metadata"),pl(),Sg(54,"textarea",25),VI(),Jw(55,Ce,2,0,"span",12),ws(56,"span",26),GC(57,"Optional. Opaque JSON object stored as-is. Leave empty to clear."),pl()(),ws(58,"div",27)(59,"button",28),GC(60),pl(),Jw(61,xe,2,2,"button",29),ws(62,"button",30),Rg("click",function(){If(e);let m=gC();return wf(m.cancel())}),GC(63,"Cancel"),pl()()();}if(i&2){let e=gC();bg("formGroup",e.form),XE(6),Ug("prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),bg("formControl",e.nameControl),UI(),XE(),eC(e.nameControl.invalid&&e.nameControl.touched?7:-1),XE(4),bg("formControl",e.descriptionControl),UI(),XE(),eC(e.availableAgentConfigs().length>0?12:-1),XE(),bg("formArrayName","parameters"),XE(8),Yg(e.paramPlaceholderSyntax),XE(2),eC(e.parametersArray.length===0?23:-1),XE(),oC(e.parametersArray.controls),XE(4),bg("formArrayName","content"),XE(16),Yg(e.paramPlaceholderSyntax),XE(2),oC(e.contentArray.controls),XE(4),eC(e.errorMessage()?50:-1),XE(4),bg("formControl",e.externalMetadataJsonControl),UI(),XE(),eC(e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?55:-1),XE(4),bg("disabled",e.form.invalid||e.isSubmitting()),XE(),vl(" ",e.isEditMode()?"Save changes":"Create"," "),XE(),eC(e.isEditMode()?61:-1);}}var re=class i{route=g(V);router=g(G);destroyRef=g(Ce$1);promptState=g(m);agentConfigController=g(M);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new z({name:new _t("",{nonNullable:true,validators:[_e$1.required,_e$1.minLength(1)]}),description:new _t(null),agentConfigId:new _t(null),externalMetadataJson:new _t("",{nonNullable:true,validators:[be]}),content:new ze([this.createContentControl()],{validators:[_e$1.required]}),parameters:new ze([])});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=Gi(false);isSubmitting=Gi(false);isLoading=Gi(false);isExporting=Gi(false);errorMessage=Gi(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=Gi([]);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(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(this.destroyRef),ya(()=>br([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U(this.destroyRef),ya(()=>br([]))).subscribe(t=>this.agentConfigs.set(t));}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(l=>this.contentArray.push(this.createContentControl(l))),this.parametersArray.clear(),(t.parameters??[]).forEach(l=>this.parametersArray.push(this.createParameterGroup(l))),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 _t(t,{nonNullable:true,validators:[_e$1.required,_e$1.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl());}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t);}createParameterGroup(t){return new z({name:new _t(t?.name??"",{nonNullable:true,validators:[_e$1.required,_e$1.minLength(1)]}),description:new _t(t?.description??null),defaultValue:new _t(t?.defaultValue??"",{nonNullable:true,validators:[_e$1.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(d=>d.value.trim()),parameters:this.parametersArray.controls.map(d=>({name:d.controls.name.value.trim(),description:d.controls.description.value?.trim()||void 0,defaultValue:d.controls.defaultValue.value.trim()}))});t||(e.agentConfigId=this.agentConfigIdControl.value||null);let l=this.externalMetadataJsonControl.value.trim();e.externalMetadata=l?JSON.parse(l):null;let m=t?this.promptState.update(this.existingPrompt.id,e):this.promptState.create(e);this.errorMessage.set(null),m.pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:d=>{this.isSubmitting.set(false),d.status===409?this.errorMessage.set(`A prompt named "${e.name}" already exists in this scope.`):d.status===400?this.errorMessage.set(d.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(this.destroyRef)).subscribe({next:e=>{let l=new Blob([e],{type:"application/yaml"}),m=URL.createObjectURL(l),d=document.createElement("a");d.href=m,d.download=`${this.existingPrompt?.name??"prompt"}.yaml`,d.click(),URL.revokeObjectURL(m),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||i)};static \u0275cmp=xw({type:i,selectors:[["agentos-prompt-form"]],decls:10,vars:3,consts:[[1,"prompt-form"],[1,"prompt-form__header"],["type","button","title","Back to prompts",1,"prompt-form__back",3,"click"],[1,"prompt-form__back-icon"],[1,"prompt-form__title"],[1,"prompt-form__loading"],[1,"prompt-form__form",3,"formGroup"],[1,"prompt-form__form",3,"ngSubmit","formGroup"],[1,"prompt-form__field"],["for","prompt-name",1,"prompt-form__label"],["aria-hidden","true"],["id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",1,"prompt-form__input",3,"formControl"],[1,"prompt-form__field-error"],["for","prompt-description",1,"prompt-form__label"],["id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",1,"prompt-form__input",3,"formControl"],[1,"prompt-form__section",3,"formArrayName"],[1,"prompt-form__label"],[1,"prompt-form__label-hint"],[1,"prompt-form__section-hint"],[1,"prompt-form__empty-hint"],[1,"prompt-form__param-row",3,"formGroupName"],["type","button",1,"prompt-form__add-btn",3,"click"],[1,"prompt-form__content-row"],[1,"prompt-form__error"],["for","prompt-external-metadata",1,"prompt-form__label"],["id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",1,"prompt-form__textarea","prompt-form__textarea--code",3,"formControl"],[1,"prompt-form__field-hint"],[1,"prompt-form__actions"],["type","submit",1,"prompt-form__btn","prompt-form__btn--primary",3,"disabled"],["type","button",1,"prompt-form__btn","prompt-form__btn--export",3,"disabled"],["type","button",1,"prompt-form__btn",3,"click"],["for","prompt-agent-config",1,"prompt-form__label"],[1,"prompt-form__readonly-value"],["id","prompt-agent-config",1,"prompt-form__select",3,"formControl"],[3,"ngValue"],[1,"prompt-form__param-fields"],[1,"prompt-form__field","prompt-form__field--inline"],[1,"prompt-form__label",3,"for"],["type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",1,"prompt-form__input",3,"id"],["type","text","placeholder","Optional","formControlName","description","autocomplete","off",1,"prompt-form__input",3,"id"],["type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",1,"prompt-form__input",3,"id"],["type","button","title","Remove this parameter",1,"prompt-form__remove-btn",3,"click"],[1,"prompt-form__content-index"],[1,"prompt-form__content-field"],["rows","4","placeholder","Enter a command\u2026",1,"prompt-form__textarea",3,"formControlName"],["type","button","title","Remove this entry",1,"prompt-form__remove-btn",3,"click","disabled"],["type","button",1,"prompt-form__btn","prompt-form__btn--export",3,"click","disabled"]],template:function(e,l){e&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return l.cancel()}),ws(3,"span",3),GC(4,"\u2190"),pl(),GC(5),pl(),ws(6,"h1",4),GC(7),pl()(),Jw(8,ie,2,0,"p",5)(9,ve,64,18,"form",6),pl()),e&2&&(XE(5),vl(" ",l.isPlatformMode?"Platform prompts":"Prompts"," "),XE(2),Yg(l.isEditMode()?"Edit prompt":"New prompt"),XE(),eC(l.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,At,Zn,Xn,Cn,En,An,Ct,Vt],styles:[".prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.prompt-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.prompt-form__field--inline[_ngcontent-%COMP%]{flex:1}.prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.prompt-form__label-hint[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary);margin-left:.375rem}.prompt-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;cursor:pointer;appearance:auto;transition:border-color .15s ease}.prompt-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;padding:.5rem .875rem;border-radius:0;background:var(--color-bg-hover);border:1px solid var(--color-divider);color:var(--color-text);font-size:.9375rem}.prompt-form__input[_ngcontent-%COMP%], .prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.prompt-form__input[_ngcontent-%COMP%]:focus, .prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.prompt-form__input[_ngcontent-%COMP%]::placeholder, .prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.prompt-form__textarea--code[_ngcontent-%COMP%]{font-family:monospace;font-size:.85rem;resize:vertical}.prompt-form__section[_ngcontent-%COMP%]{border:1px solid var(--color-divider);border-radius:0;padding:1rem;margin:0;display:flex;flex-direction:column;gap:.75rem}.prompt-form__section-hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.prompt-form__empty-hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}.prompt-form__content-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-start}.prompt-form__content-field[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.25rem}.prompt-form__content-index[_ngcontent-%COMP%]{flex-shrink:0;width:1.5rem;padding-top:.6rem;font-size:.8rem;font-weight:600;color:var(--color-text-secondary);text-align:right;-webkit-user-select:none;user-select:none}.prompt-form__param-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-end;padding:.75rem;border-radius:0;background:var(--color-bg-hover)}.prompt-form__param-fields[_ngcontent-%COMP%]{flex:1;display:flex;gap:.75rem;flex-wrap:wrap}.prompt-form__add-btn[_ngcontent-%COMP%]{align-self:flex-start;padding:.4rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-accent);font-size:.875rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.prompt-form__add-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-accent)}.prompt-form__remove-btn[_ngcontent-%COMP%]{flex-shrink:0;width:1.75rem;height:1.75rem;display:flex;align-items:center;justify-content:center;border-radius:0;border:1px solid transparent;background:transparent;color:var(--color-neutral-500);font-size:1rem;line-height:1;cursor:pointer;transition:background .15s ease,color .15s ease,border-color .15s ease}.prompt-form__remove-btn[_ngcontent-%COMP%]:hover:not(:disabled){background:color-mix(in srgb,var(--red) 10%,transparent);color:var(--red);border-color:var(--red)}.prompt-form__remove-btn[_ngcontent-%COMP%]:disabled{opacity:.3;cursor:not-allowed}.prompt-form__error[_ngcontent-%COMP%]{margin:0;padding:.625rem .875rem;border-radius:0;background:color-mix(in srgb,var(--red) 10%,transparent);border:1px solid var(--red);color:var(--red);font-size:.875rem;line-height:1.4}.prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--red);line-height:1.3}.prompt-form__input--invalid[_ngcontent-%COMP%], .prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--red)}.prompt-form__input--invalid[_ngcontent-%COMP%]:focus, .prompt-form__textarea--invalid[_ngcontent-%COMP%]:focus{border-color:var(--red)}.prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}.prompt-form__btn--export[_ngcontent-%COMP%]{border-color:var(--color-divider);color:var(--color-text-secondary)}.prompt-form__btn--export[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--color-accent);color:var(--color-accent)}"]})};function be(i){let t=i.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}export{re as PromptFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {S as St}from'./chunk-CnEa9fH2.js';import {an as ue,g,L,ao as V,G,N as N$1,ap as wd,e as xw,aq as a,ar as S,as as F,at as c,k as ws,q as Rg,J as Jw,o as pl,v as bg,X as XE,y as eC,D as Pg,E as EC,I as IC,au as tv,ae as kt,av as B,Y as x,aw as hl,n as GC,ax as gl,a8 as Yg,a9 as lC,aa as If,ac as gC,ab as wf,S as Sg}from'./main-2EYBZUJC.js';import {a as at,s as st,r as rt,_ as _i}from'./chunk-CJIgE5YB.js';import'./chunk-DAk8SIkq.js';import {G as Ge}from'./chunk-C_J2R_PK.js';import'./chunk-DqzTsn7a.js';import'./chunk-BhXLqAug.js';import'./chunk-DWSvE7KY.js';import'./chunk-F5WjZgr6.js';import'./chunk-DR5zNU0n.js';import'./chunk-Bx_FH6m3.js';import'./chunk-BPkyqr-f.js';import'./chunk-CZmNdEYy.js';var T=class o{welcomeMessages=["Welcome to Coday","Bienvenue sur Coday","Bienvenido a Coday","Willkommen bei Coday","Benvenuto su Coday","Bem-vindo ao Coday","Welkom bij Coday","\u0414\u043E\u0431\u0440\u043E \u043F\u043E\u0436\u0430\u043B\u043E\u0432\u0430\u0442\u044C \u0432 Coday","Coday \u3078\u3088\u3046\u3053\u305D","\u6B22\u8FCE\u6765\u5230 Coday","Coday \uC5D0 \uC624\uC2E0 \uAC83\uC744 \uD658\uC601\uD569\uB2C8\uB2E4","\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0643 \u0641\u064A Coday"];currentWelcomeIndex=0;currentWelcomeMessage=this.welcomeMessages[0];welcomeRotationInterval;ngOnInit(){this.startWelcomeRotation();}ngOnDestroy(){this.stopWelcomeRotation();}startWelcomeRotation(){this.welcomeRotationInterval=window.setInterval(()=>{this.currentWelcomeIndex=(this.currentWelcomeIndex+1)%this.welcomeMessages.length,this.currentWelcomeMessage=this.welcomeMessages[this.currentWelcomeIndex];},3e3);}stopWelcomeRotation(){this.welcomeRotationInterval&&(clearInterval(this.welcomeRotationInterval),this.welcomeRotationInterval=void 0);}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=xw({type:o,selectors:[["app-welcome-message"]],decls:2,vars:1,consts:[[1,"welcome-title"]],template:function(t,i){t&1&&(hl(0,"h1",0),GC(1),gl()),t&2&&(XE(),Yg(i.currentWelcomeMessage));},styles:[".welcome-title[_ngcontent-%COMP%]{font-size:clamp(1.5rem,4vw,4rem);font-weight:700;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% auto;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:_ngcontent-%COMP%_gradientShift 3s ease-in-out infinite;margin:0;padding:0;line-height:1.2;transition:opacity .5s ease-in-out;display:block;min-height:1.2em;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0% center}50%{background-position:100% center}to{background-position:0% center}}"],changeDetection:1})};var N=class o{destroy$=new ue;isSetup=false;codayService=g(Ge);preferencesService=g(L);setup(){if(this.isSetup){console.warn("[AGENT-NOTIFICATION] Service already set up");return}console.log("[AGENT-NOTIFICATION] Setting up agent notification service"),this.codayService.isThinking$.pipe(wd(this.destroy$),tv(),kt(([e,t])=>e===true&&t===false)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Agent stopped thinking, notifying task finished"),this.notifyTaskFinishedIfEnabled();}),this.preferencesService.browserNotificationEnabled$.pipe(wd(this.destroy$),tv(),kt(([e,t])=>e===false&&t===true)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Browser notifications enabled, checking permission"),this.handleBrowserNotificationEnabled();}),this.isSetup=true;}notifyTaskFinishedIfEnabled(){this.preferencesService.getAgentNotificationEnabled()&&(this.preferencesService.getNotificationSoundEnabled()&&this.playCompletionSound(),this.preferencesService.getBrowserNotificationEnabled()&&this.sendBrowserNotification());}playCompletionSound(){try{let e=new(window.AudioContext||window.webkitAudioContext),t=e.createOscillator(),i=e.createGain();t.connect(i),i.connect(e.destination),t.frequency.setValueAtTime(700,e.currentTime),i.gain.setValueAtTime(.1,e.currentTime),i.gain.exponentialRampToValueAtTime(.01,e.currentTime+.08),t.start(e.currentTime),t.stop(e.currentTime+.08);let n=e.createOscillator(),r=e.createGain();n.connect(r),r.connect(e.destination);let l=e.currentTime+.11;n.frequency.setValueAtTime(950,l),r.gain.setValueAtTime(.1,l),r.gain.exponentialRampToValueAtTime(.01,l+.09),n.start(l),n.stop(l+.09),console.log("[AGENT-NOTIFICATION] Completion sound played");}catch(e){console.error("[AGENT-NOTIFICATION] Failed to play completion sound:",e);}}handleBrowserNotificationEnabled(){return B(this,null,function*(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications"),this.preferencesService.setBrowserNotificationEnabled(false);return}if(Notification.permission==="denied"){console.warn("[AGENT-NOTIFICATION] Permission denied, disabling browser notifications"),this.preferencesService.setBrowserNotificationEnabled(false);return}if(Notification.permission==="granted"){console.log("[AGENT-NOTIFICATION] Permission already granted, showing confirmation"),this.createConfirmationNotification();return}try{(yield Notification.requestPermission())==="granted"?(console.log("[AGENT-NOTIFICATION] Permission granted, showing confirmation"),this.createConfirmationNotification()):(console.log("[AGENT-NOTIFICATION] Permission denied or dismissed"),this.preferencesService.setBrowserNotificationEnabled(!1));}catch(e){console.error("[AGENT-NOTIFICATION] Error requesting permission:",e),this.preferencesService.setBrowserNotificationEnabled(false);}})}sendBrowserNotification(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications");return}if(document.hasFocus()){console.warn("[AGENT-NOTIFICATION] Document is focused, skipping browser notification");return}Notification.permission==="granted"?this.createTaskCompleteNotification():console.warn("[AGENT-NOTIFICATION] Permission not granted, cannot send notification");}createConfirmationNotification(){let e=new Notification("Coday - Notifications Enabled",{body:"You will be notified when the agent completes tasks",icon:"/favicon.ico",tag:"coday-notifications-enabled",requireInteraction:false});setTimeout(()=>e.close(),4e3),e.onclick=()=>{window.focus(),e.close();},console.log("[AGENT-NOTIFICATION] Confirmation notification sent");}createTaskCompleteNotification(){let e=new Notification("Coday - Task Complete",{body:"The agent has finished and is waiting for your input",icon:"/favicon.ico",tag:"coday-task-complete",requireInteraction:false});setTimeout(()=>e.close(),5e3),e.onclick=()=>{window.focus(),e.close();},console.log("[AGENT-NOTIFICATION] Task complete notification sent");}ngOnDestroy(){console.log("[AGENT-NOTIFICATION] Service destroyed"),this.destroy$.next(),this.destroy$.complete();}static \u0275fac=function(t){return new(t||o)};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var Z=["inputSection"];function ee(o,e){if(o&1){let t=lC();ws(0,"app-thread",4),Rg("chatFocused",function(){If(t);let n=gC();return wf(n.onChatFocusedOnMobile())})("drawerStateChange",function(n){If(t);let r=gC();return wf(r.onDrawerStateChange(n))}),pl();}if(o&2){let t=gC();bg("projectName",t.projectName)("threadId",t.threadId);}}function te(o,e){if(o&1){let t=lC();ws(0,"div",5),Sg(1,"app-welcome-message"),pl(),ws(2,"div",6,0)(4,"div",7)(5,"div",8)(6,"app-chat-textarea",9),Rg("messageSubmitted",function(n){If(t);let r=gC();return wf(r.onMessageSubmitted(n))})("voiceMessageReady",function(n){If(t);let r=gC();return wf(r.onVoiceMessageReady(n))})("voiceRecordingToggled",function(n){If(t);let r=gC();return wf(r.onVoiceToggled(n))})("heightChanged",function(n){If(t);let r=gC();return wf(r.onInputHeightChanged(n))})("textareaFocused",function(){If(t);let n=gC();return wf(n.onChatFocusedOnMobile())}),pl()()()();}if(o&2){let t=gC();XE(6),bg("isDisabled",t.isSessionInitializing)("isSessionInitializing",t.isSessionInitializing)("showWelcome",true)("isThinking",false)("isStarting",t.isStartingFirstMessage);}}var K=class o{destroy$=new ue;inputSection;sidenav;projectName="";threadId=null;isSessionInitializing=false;isStartingFirstMessage=false;inputSectionHeight=80;codayService=g(Ge);titleService=g(at);preferencesService=g(L);route=g(V);router=g(G);threadApiService=g(N$1);agentNotificationService=g(N);firstMessageState=g(st);constructor(){console.log("[MAIN-APP] Using new thread-based architecture (no clientId needed)");}ngOnInit(){this.agentNotificationService.setup(),this.setupPrintHandlers(),this.route.params.pipe(wd(this.destroy$)).subscribe(e=>{let t=e.projectName,i=e.threadId||null;console.log("[MAIN-APP] Route params updated:",{project:t,thread:i,previousProject:this.projectName,previousThread:this.threadId}),this.projectName=t,this.threadId=i,this.threadId?console.log("[MAIN-APP] Thread selected - ThreadComponent will display"):(console.log("[MAIN-APP] No thread selected - showing welcome view"),this.initializeWelcomeView());});}initializeWelcomeView(){this.codayService.setTabTitleService(this.titleService);}ngAfterViewInit(){setTimeout(()=>this.updateInputSectionHeight(),100);}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),window.removeEventListener("beforeprint",this.handleBeforePrint),window.removeEventListener("afterprint",this.handleAfterPrint);}onMessageSubmitted(e){console.log("[MAIN-APP] First message submitted from welcome view:",e),this.isSessionInitializing=true,this.isStartingFirstMessage=true,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created:",t.thread.id),this.firstMessageState.setPendingFirstMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id]);},error:t=>{console.error("[MAIN-APP] Failed to create thread:",t),this.isSessionInitializing=false,this.isStartingFirstMessage=false,alert("Failed to create conversation: "+(t.message||"Unknown error"));}});}onVoiceToggled(e){console.log("[VOICE] Recording in welcome view:",e);}onVoiceMessageReady(e){console.log("[MAIN-APP] Voice message ready from welcome view"),this.isSessionInitializing=true,this.isStartingFirstMessage=true,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created for voice message:",t.thread.id),this.firstMessageState.setPendingVoiceMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id]);},error:t=>{console.error("[MAIN-APP] Failed to create thread for voice message:",t),this.isSessionInitializing=false,this.isStartingFirstMessage=false,alert("Failed to create conversation: "+(t.message||"Unknown error"));}});}isDrawerOpen=false;onDrawerStateChange(e){this.isDrawerOpen=e;}onChatFocusedOnMobile(){window.innerWidth<1024&&this.sidenav?.close();}onInputHeightChanged(e){console.log("[MAIN-APP] Input height changed:",e),this.inputSectionHeight=e;}updateInputSectionHeight(){if(this.inputSection?.nativeElement){let e=this.inputSection.nativeElement.offsetHeight;e!==this.inputSectionHeight&&(console.log("[MAIN-APP] Input section height updated:",e),this.inputSectionHeight=e);}}setupPrintHandlers(){window.addEventListener("beforeprint",this.handleBeforePrint),window.addEventListener("afterprint",this.handleAfterPrint);}handleBeforePrint=()=>{console.log("[PRINT] Before print event triggered");let e=this.preferencesService.getPrintTechnicalMessages();console.log("[PRINT] Print technical messages:",e),e?document.body.classList.add("print-include-technical"):document.body.classList.remove("print-include-technical");};handleAfterPrint=()=>{console.log("[PRINT] After print event triggered"),document.body.classList.remove("print-include-technical");};static \u0275fac=function(t){return new(t||o)};static \u0275cmp=xw({type:o,selectors:[["app-main"]],viewQuery:function(t,i){if(t&1&&Pg(Z,5)(St,5),t&2){let n;EC(n=IC())&&(i.inputSection=n.first),EC(n=IC())&&(i.sidenav=n.first);}},decls:4,vars:2,consts:[["inputSection",""],[3,"drawerOpen"],[1,"app",3,"mousedown","touchstart"],[3,"projectName","threadId"],[3,"chatFocused","drawerStateChange","projectName","threadId"],[1,"welcome-section"],[1,"input-section"],[1,"input-center"],[1,"input-glass"],[3,"messageSubmitted","voiceMessageReady","voiceRecordingToggled","heightChanged","textareaFocused","isDisabled","isSessionInitializing","showWelcome","isThinking","isStarting"]],template:function(t,i){t&1&&(ws(0,"app-sidenav",1)(1,"div",2),Rg("mousedown",function(){return i.onChatFocusedOnMobile()})("touchstart",function(){return i.onChatFocusedOnMobile()}),Jw(2,ee,1,2,"app-thread",3)(3,te,7,5),pl()()),t&2&&(bg("drawerOpen",i.isDrawerOpen),XE(2),eC(i.threadId?2:3));},dependencies:[rt,_i,T,St],styles:["[_nghost-%COMP%]{display:flex;height:100vh;width:100%;overflow:hidden;justify-content:center}.app[_ngcontent-%COMP%]{width:100%;max-width:100%;min-width:0;height:100%;display:flex;flex-direction:column;background:var(--color-bg);color:var(--color-text);transition:all .3s ease;position:relative;justify-content:center;overflow:hidden}.chat-wrapper[_ngcontent-%COMP%]{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;background:transparent;width:100%;padding:2.5rem 0 1.5rem;display:flex;justify-content:center}.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem}@media(max-width:768px){.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{padding:0 1rem}}.welcome-section[_ngcontent-%COMP%]{flex-shrink:0;text-align:center;padding:2rem 1rem;animation:_ngcontent-%COMP%_fadeInUp .8s ease-out;display:flex;justify-content:center;align-items:center;width:100%;min-width:0;overflow:hidden}@keyframes _ngcontent-%COMP%_fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.input-section[_ngcontent-%COMP%]{flex-shrink:0;position:relative;border-top:none;background:transparent;box-shadow:none;padding:2.5rem 0 2rem;overflow-y:visible;max-height:none;width:100%;z-index:10;pointer-events:none;display:flex;justify-content:center}.input-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem;display:flex;justify-content:center;align-items:end;position:relative;pointer-events:auto}@media(max-width:768px){.input-center[_ngcontent-%COMP%]{padding:0 1rem}}.input-glass[_ngcontent-%COMP%]{background:none;box-shadow:none;width:100%;min-height:64px;display:flex;align-items:stretch;gap:0;pointer-events:auto;position:relative;overflow:visible}.input-glass[_ngcontent-%COMP%] app-chat-textarea[_ngcontent-%COMP%]{width:100%;min-width:0;flex:1 1 auto;align-self:stretch;display:flex}body.dark[_nghost-%COMP%], body.dark [_nghost-%COMP%], [_ngcontent-%COMP%]:root[data-theme=dark] .input-glass[_ngcontent-%COMP%]{background:#24283073;border-color:#b4c8ff17;box-shadow:0 8px 32px #0000002b,0 1.5px 8px #00000012}.choice-overlay[_ngcontent-%COMP%]{z-index:10;width:100%;display:flex;justify-content:center;align-items:center}.upload-status[_ngcontent-%COMP%]{position:fixed;bottom:100px;left:50%;transform:translate(-50%);z-index:1000;display:flex;align-items:center;padding:12px 20px;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);border-radius:16px;font-size:.9em;color:var(--color-text);box-shadow:var(--glass-shadow);max-width:300px;text-align:center}.upload-status.error[_ngcontent-%COMP%]{background:#ff3b3026;color:var(--color-error);border-color:#ff3b304d}@media(max-width:768px){.welcome-section[_ngcontent-%COMP%]{padding:1.5rem 1rem}.input-section[_ngcontent-%COMP%]{padding:1.5rem .75rem 1rem}.input-center[_ngcontent-%COMP%]{padding:0 .5rem}}@media print{[_nghost-%COMP%]{display:block!important;height:auto!important;overflow:visible!important}.app[_ngcontent-%COMP%]{height:auto!important;overflow:visible!important;display:block!important}.input-section[_ngcontent-%COMP%], .welcome-section[_ngcontent-%COMP%]{display:none!important}}"],data:{animation:[a("slideIn",[S(":enter",[F({transform:"translateY(100%)",opacity:0}),c("300ms ease-out",F({transform:"translateY(0)",opacity:1}))]),S(":leave",[c("200ms ease-in",F({transform:"translateY(100%)",opacity:0}))])])]},changeDetection:1})};export{K as MainAppComponent};
|
|
1
|
+
import {S as St}from'./chunk-Bt_Yi0KO.js';import {an as ue,g,L,ao as V,G,N as N$1,ap as wd,e as xw,aq as a,ar as S,as as F,at as c,k as ws,q as Rg,J as Jw,o as pl,v as bg,X as XE,y as eC,D as Pg,E as EC,I as IC,au as tv,ae as kt,av as B,Y as x,aw as hl,n as GC,ax as gl,a8 as Yg,a9 as lC,aa as If,ac as gC,ab as wf,S as Sg}from'./main-GYSPY3UE.js';import {a as at,s as st,r as rt,_ as _i}from'./chunk-Dn1IeSER.js';import'./chunk-D-bfzu2J.js';import {G as Ge}from'./chunk-CqTTbhQw.js';import'./chunk-CXqNbVXr.js';import'./chunk-DE0C-yKk.js';import'./chunk-B0wi4IQ8.js';import'./chunk-CJCjJyKP.js';import'./chunk-BByguAe9.js';import'./chunk-CGjjc55P.js';import'./chunk-CZe6uHRZ.js';import'./chunk-DS1gnXQd.js';var T=class o{welcomeMessages=["Welcome to Coday","Bienvenue sur Coday","Bienvenido a Coday","Willkommen bei Coday","Benvenuto su Coday","Bem-vindo ao Coday","Welkom bij Coday","\u0414\u043E\u0431\u0440\u043E \u043F\u043E\u0436\u0430\u043B\u043E\u0432\u0430\u0442\u044C \u0432 Coday","Coday \u3078\u3088\u3046\u3053\u305D","\u6B22\u8FCE\u6765\u5230 Coday","Coday \uC5D0 \uC624\uC2E0 \uAC83\uC744 \uD658\uC601\uD569\uB2C8\uB2E4","\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0643 \u0641\u064A Coday"];currentWelcomeIndex=0;currentWelcomeMessage=this.welcomeMessages[0];welcomeRotationInterval;ngOnInit(){this.startWelcomeRotation();}ngOnDestroy(){this.stopWelcomeRotation();}startWelcomeRotation(){this.welcomeRotationInterval=window.setInterval(()=>{this.currentWelcomeIndex=(this.currentWelcomeIndex+1)%this.welcomeMessages.length,this.currentWelcomeMessage=this.welcomeMessages[this.currentWelcomeIndex];},3e3);}stopWelcomeRotation(){this.welcomeRotationInterval&&(clearInterval(this.welcomeRotationInterval),this.welcomeRotationInterval=void 0);}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=xw({type:o,selectors:[["app-welcome-message"]],decls:2,vars:1,consts:[[1,"welcome-title"]],template:function(t,i){t&1&&(hl(0,"h1",0),GC(1),gl()),t&2&&(XE(),Yg(i.currentWelcomeMessage));},styles:[".welcome-title[_ngcontent-%COMP%]{font-size:clamp(1.5rem,4vw,4rem);font-weight:700;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% auto;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:_ngcontent-%COMP%_gradientShift 3s ease-in-out infinite;margin:0;padding:0;line-height:1.2;transition:opacity .5s ease-in-out;display:block;min-height:1.2em;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0% center}50%{background-position:100% center}to{background-position:0% center}}"],changeDetection:1})};var N=class o{destroy$=new ue;isSetup=false;codayService=g(Ge);preferencesService=g(L);setup(){if(this.isSetup){console.warn("[AGENT-NOTIFICATION] Service already set up");return}console.log("[AGENT-NOTIFICATION] Setting up agent notification service"),this.codayService.isThinking$.pipe(wd(this.destroy$),tv(),kt(([e,t])=>e===true&&t===false)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Agent stopped thinking, notifying task finished"),this.notifyTaskFinishedIfEnabled();}),this.preferencesService.browserNotificationEnabled$.pipe(wd(this.destroy$),tv(),kt(([e,t])=>e===false&&t===true)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Browser notifications enabled, checking permission"),this.handleBrowserNotificationEnabled();}),this.isSetup=true;}notifyTaskFinishedIfEnabled(){this.preferencesService.getAgentNotificationEnabled()&&(this.preferencesService.getNotificationSoundEnabled()&&this.playCompletionSound(),this.preferencesService.getBrowserNotificationEnabled()&&this.sendBrowserNotification());}playCompletionSound(){try{let e=new(window.AudioContext||window.webkitAudioContext),t=e.createOscillator(),i=e.createGain();t.connect(i),i.connect(e.destination),t.frequency.setValueAtTime(700,e.currentTime),i.gain.setValueAtTime(.1,e.currentTime),i.gain.exponentialRampToValueAtTime(.01,e.currentTime+.08),t.start(e.currentTime),t.stop(e.currentTime+.08);let n=e.createOscillator(),r=e.createGain();n.connect(r),r.connect(e.destination);let l=e.currentTime+.11;n.frequency.setValueAtTime(950,l),r.gain.setValueAtTime(.1,l),r.gain.exponentialRampToValueAtTime(.01,l+.09),n.start(l),n.stop(l+.09),console.log("[AGENT-NOTIFICATION] Completion sound played");}catch(e){console.error("[AGENT-NOTIFICATION] Failed to play completion sound:",e);}}handleBrowserNotificationEnabled(){return B(this,null,function*(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications"),this.preferencesService.setBrowserNotificationEnabled(false);return}if(Notification.permission==="denied"){console.warn("[AGENT-NOTIFICATION] Permission denied, disabling browser notifications"),this.preferencesService.setBrowserNotificationEnabled(false);return}if(Notification.permission==="granted"){console.log("[AGENT-NOTIFICATION] Permission already granted, showing confirmation"),this.createConfirmationNotification();return}try{(yield Notification.requestPermission())==="granted"?(console.log("[AGENT-NOTIFICATION] Permission granted, showing confirmation"),this.createConfirmationNotification()):(console.log("[AGENT-NOTIFICATION] Permission denied or dismissed"),this.preferencesService.setBrowserNotificationEnabled(!1));}catch(e){console.error("[AGENT-NOTIFICATION] Error requesting permission:",e),this.preferencesService.setBrowserNotificationEnabled(false);}})}sendBrowserNotification(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications");return}if(document.hasFocus()){console.warn("[AGENT-NOTIFICATION] Document is focused, skipping browser notification");return}Notification.permission==="granted"?this.createTaskCompleteNotification():console.warn("[AGENT-NOTIFICATION] Permission not granted, cannot send notification");}createConfirmationNotification(){let e=new Notification("Coday - Notifications Enabled",{body:"You will be notified when the agent completes tasks",icon:"/favicon.ico",tag:"coday-notifications-enabled",requireInteraction:false});setTimeout(()=>e.close(),4e3),e.onclick=()=>{window.focus(),e.close();},console.log("[AGENT-NOTIFICATION] Confirmation notification sent");}createTaskCompleteNotification(){let e=new Notification("Coday - Task Complete",{body:"The agent has finished and is waiting for your input",icon:"/favicon.ico",tag:"coday-task-complete",requireInteraction:false});setTimeout(()=>e.close(),5e3),e.onclick=()=>{window.focus(),e.close();},console.log("[AGENT-NOTIFICATION] Task complete notification sent");}ngOnDestroy(){console.log("[AGENT-NOTIFICATION] Service destroyed"),this.destroy$.next(),this.destroy$.complete();}static \u0275fac=function(t){return new(t||o)};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var Z=["inputSection"];function ee(o,e){if(o&1){let t=lC();ws(0,"app-thread",4),Rg("chatFocused",function(){If(t);let n=gC();return wf(n.onChatFocusedOnMobile())})("drawerStateChange",function(n){If(t);let r=gC();return wf(r.onDrawerStateChange(n))}),pl();}if(o&2){let t=gC();bg("projectName",t.projectName)("threadId",t.threadId);}}function te(o,e){if(o&1){let t=lC();ws(0,"div",5),Sg(1,"app-welcome-message"),pl(),ws(2,"div",6,0)(4,"div",7)(5,"div",8)(6,"app-chat-textarea",9),Rg("messageSubmitted",function(n){If(t);let r=gC();return wf(r.onMessageSubmitted(n))})("voiceMessageReady",function(n){If(t);let r=gC();return wf(r.onVoiceMessageReady(n))})("voiceRecordingToggled",function(n){If(t);let r=gC();return wf(r.onVoiceToggled(n))})("heightChanged",function(n){If(t);let r=gC();return wf(r.onInputHeightChanged(n))})("textareaFocused",function(){If(t);let n=gC();return wf(n.onChatFocusedOnMobile())}),pl()()()();}if(o&2){let t=gC();XE(6),bg("isDisabled",t.isSessionInitializing)("isSessionInitializing",t.isSessionInitializing)("showWelcome",true)("isThinking",false)("isStarting",t.isStartingFirstMessage);}}var K=class o{destroy$=new ue;inputSection;sidenav;projectName="";threadId=null;isSessionInitializing=false;isStartingFirstMessage=false;inputSectionHeight=80;codayService=g(Ge);titleService=g(at);preferencesService=g(L);route=g(V);router=g(G);threadApiService=g(N$1);agentNotificationService=g(N);firstMessageState=g(st);constructor(){console.log("[MAIN-APP] Using new thread-based architecture (no clientId needed)");}ngOnInit(){this.agentNotificationService.setup(),this.setupPrintHandlers(),this.route.params.pipe(wd(this.destroy$)).subscribe(e=>{let t=e.projectName,i=e.threadId||null;console.log("[MAIN-APP] Route params updated:",{project:t,thread:i,previousProject:this.projectName,previousThread:this.threadId}),this.projectName=t,this.threadId=i,this.threadId?console.log("[MAIN-APP] Thread selected - ThreadComponent will display"):(console.log("[MAIN-APP] No thread selected - showing welcome view"),this.initializeWelcomeView());});}initializeWelcomeView(){this.codayService.setTabTitleService(this.titleService);}ngAfterViewInit(){setTimeout(()=>this.updateInputSectionHeight(),100);}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),window.removeEventListener("beforeprint",this.handleBeforePrint),window.removeEventListener("afterprint",this.handleAfterPrint);}onMessageSubmitted(e){console.log("[MAIN-APP] First message submitted from welcome view:",e),this.isSessionInitializing=true,this.isStartingFirstMessage=true,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created:",t.thread.id),this.firstMessageState.setPendingFirstMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id]);},error:t=>{console.error("[MAIN-APP] Failed to create thread:",t),this.isSessionInitializing=false,this.isStartingFirstMessage=false,alert("Failed to create conversation: "+(t.message||"Unknown error"));}});}onVoiceToggled(e){console.log("[VOICE] Recording in welcome view:",e);}onVoiceMessageReady(e){console.log("[MAIN-APP] Voice message ready from welcome view"),this.isSessionInitializing=true,this.isStartingFirstMessage=true,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created for voice message:",t.thread.id),this.firstMessageState.setPendingVoiceMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id]);},error:t=>{console.error("[MAIN-APP] Failed to create thread for voice message:",t),this.isSessionInitializing=false,this.isStartingFirstMessage=false,alert("Failed to create conversation: "+(t.message||"Unknown error"));}});}isDrawerOpen=false;onDrawerStateChange(e){this.isDrawerOpen=e;}onChatFocusedOnMobile(){window.innerWidth<1024&&this.sidenav?.close();}onInputHeightChanged(e){console.log("[MAIN-APP] Input height changed:",e),this.inputSectionHeight=e;}updateInputSectionHeight(){if(this.inputSection?.nativeElement){let e=this.inputSection.nativeElement.offsetHeight;e!==this.inputSectionHeight&&(console.log("[MAIN-APP] Input section height updated:",e),this.inputSectionHeight=e);}}setupPrintHandlers(){window.addEventListener("beforeprint",this.handleBeforePrint),window.addEventListener("afterprint",this.handleAfterPrint);}handleBeforePrint=()=>{console.log("[PRINT] Before print event triggered");let e=this.preferencesService.getPrintTechnicalMessages();console.log("[PRINT] Print technical messages:",e),e?document.body.classList.add("print-include-technical"):document.body.classList.remove("print-include-technical");};handleAfterPrint=()=>{console.log("[PRINT] After print event triggered"),document.body.classList.remove("print-include-technical");};static \u0275fac=function(t){return new(t||o)};static \u0275cmp=xw({type:o,selectors:[["app-main"]],viewQuery:function(t,i){if(t&1&&Pg(Z,5)(St,5),t&2){let n;EC(n=IC())&&(i.inputSection=n.first),EC(n=IC())&&(i.sidenav=n.first);}},decls:4,vars:2,consts:[["inputSection",""],[3,"drawerOpen"],[1,"app",3,"mousedown","touchstart"],[3,"projectName","threadId"],[3,"chatFocused","drawerStateChange","projectName","threadId"],[1,"welcome-section"],[1,"input-section"],[1,"input-center"],[1,"input-glass"],[3,"messageSubmitted","voiceMessageReady","voiceRecordingToggled","heightChanged","textareaFocused","isDisabled","isSessionInitializing","showWelcome","isThinking","isStarting"]],template:function(t,i){t&1&&(ws(0,"app-sidenav",1)(1,"div",2),Rg("mousedown",function(){return i.onChatFocusedOnMobile()})("touchstart",function(){return i.onChatFocusedOnMobile()}),Jw(2,ee,1,2,"app-thread",3)(3,te,7,5),pl()()),t&2&&(bg("drawerOpen",i.isDrawerOpen),XE(2),eC(i.threadId?2:3));},dependencies:[rt,_i,T,St],styles:["[_nghost-%COMP%]{display:flex;height:100vh;width:100%;overflow:hidden;justify-content:center}.app[_ngcontent-%COMP%]{width:100%;max-width:100%;min-width:0;height:100%;display:flex;flex-direction:column;background:var(--color-bg);color:var(--color-text);transition:all .3s ease;position:relative;justify-content:center;overflow:hidden}.chat-wrapper[_ngcontent-%COMP%]{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;background:transparent;width:100%;padding:2.5rem 0 1.5rem;display:flex;justify-content:center}.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem}@media(max-width:768px){.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{padding:0 1rem}}.welcome-section[_ngcontent-%COMP%]{flex-shrink:0;text-align:center;padding:2rem 1rem;animation:_ngcontent-%COMP%_fadeInUp .8s ease-out;display:flex;justify-content:center;align-items:center;width:100%;min-width:0;overflow:hidden}@keyframes _ngcontent-%COMP%_fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.input-section[_ngcontent-%COMP%]{flex-shrink:0;position:relative;border-top:none;background:transparent;box-shadow:none;padding:2.5rem 0 2rem;overflow-y:visible;max-height:none;width:100%;z-index:10;pointer-events:none;display:flex;justify-content:center}.input-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem;display:flex;justify-content:center;align-items:end;position:relative;pointer-events:auto}@media(max-width:768px){.input-center[_ngcontent-%COMP%]{padding:0 1rem}}.input-glass[_ngcontent-%COMP%]{background:none;box-shadow:none;width:100%;min-height:64px;display:flex;align-items:stretch;gap:0;pointer-events:auto;position:relative;overflow:visible}.input-glass[_ngcontent-%COMP%] app-chat-textarea[_ngcontent-%COMP%]{width:100%;min-width:0;flex:1 1 auto;align-self:stretch;display:flex}body.dark[_nghost-%COMP%], body.dark [_nghost-%COMP%], [_ngcontent-%COMP%]:root[data-theme=dark] .input-glass[_ngcontent-%COMP%]{background:#24283073;border-color:#b4c8ff17;box-shadow:0 8px 32px #0000002b,0 1.5px 8px #00000012}.choice-overlay[_ngcontent-%COMP%]{z-index:10;width:100%;display:flex;justify-content:center;align-items:center}.upload-status[_ngcontent-%COMP%]{position:fixed;bottom:100px;left:50%;transform:translate(-50%);z-index:1000;display:flex;align-items:center;padding:12px 20px;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);border-radius:16px;font-size:.9em;color:var(--color-text);box-shadow:var(--glass-shadow);max-width:300px;text-align:center}.upload-status.error[_ngcontent-%COMP%]{background:#ff3b3026;color:var(--color-error);border-color:#ff3b304d}@media(max-width:768px){.welcome-section[_ngcontent-%COMP%]{padding:1.5rem 1rem}.input-section[_ngcontent-%COMP%]{padding:1.5rem .75rem 1rem}.input-center[_ngcontent-%COMP%]{padding:0 .5rem}}@media print{[_nghost-%COMP%]{display:block!important;height:auto!important;overflow:visible!important}.app[_ngcontent-%COMP%]{height:auto!important;overflow:visible!important;display:block!important}.input-section[_ngcontent-%COMP%], .welcome-section[_ngcontent-%COMP%]{display:none!important}}"],data:{animation:[a("slideIn",[S(":enter",[F({transform:"translateY(100%)",opacity:0}),c("300ms ease-out",F({transform:"translateY(0)",opacity:1}))]),S(":leave",[c("200ms ease-in",F({transform:"translateY(100%)",opacity:0}))])])]},changeDetection:1})};export{K as MainAppComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {i}from'./chunk-DOeIIw1a.js';import {l}from'./chunk-DdPOtjZp.js';import {g,d9 as N$1,dj as he,aJ as Tr,aD as Ly,bS as va,a7 as ya,W as br,r as re,cE as Ad,bU as Od,Y as x}from'./main-GYSPY3UE.js';var y="none",O="me",N=class f{nsController=g(N$1);exportService=g(he);userState=g(l);refresh$=new Tr(void 0);namespaceId$=new Tr(null);vm$=Ly([this.namespaceId$,this.refresh$]).pipe(va(([e])=>{let n=this.loadPlatformConfigs().pipe(ya(()=>br([]))),t=this.loadUserConfigs("global").pipe(ya(()=>br([])));return e?Ly([n,this.loadNamespaceConfigs(e).pipe(ya(()=>br([]))),this.loadUserConfigs(e).pipe(ya(()=>br([]))),t]).pipe(re(([i,r,u,s])=>({platform:i,namespace:r,userOnNs:u,userGlobal:s}))):Ly([n,t]).pipe(re(([i,r])=>({platform:i,namespace:[],userOnNs:[],userGlobal:r})))}),Ad({bufferSize:1,refCount:true}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e);}refresh(){this.refresh$.next();}loadPlatformConfigs(){return this.nsController.listIntegrationConfig(y)}loadUserConfigs(e){let n=e==="global"?y:e;return this.nsController.listIntegrationConfig(n,O)}userGlobal$=i(this.refresh$,()=>this.loadUserConfigs("global"),[]);loadNamespaceConfigs(e){return e?this.nsController.listIntegrationConfig(e):br([])}getById(e,n){return this.nsController.getByIdIntegrationConfig(e)}create(e,n,t){let r=this.userState.currentUser()?.id;if((n==="userOnNs"||n==="userGlobal")&&!r)throw new Error(`Cannot create ${n} config before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(n==="platform"){let s={name:e.name,integrationType:e.integrationType,description:e.description,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(s).pipe(Od(()=>this.refresh()))}if(n==="namespace"){if(!t)throw new Error("Cannot create namespace-scoped config without a namespaceId");let s={name:e.name,integrationType:e.integrationType,description:e.description,namespaceId:t,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(s).pipe(Od(()=>this.refresh()))}if(n==="userOnNs"&&!t)throw new Error("Cannot create userOnNs config without a namespaceId");let u={name:e.name,integrationType:e.integrationType,description:e.description,userId:r,namespaceId:n==="userOnNs"?t:void 0,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u).pipe(Od(()=>this.refresh()))}update(e,n,t,i){let r={name:n.name,integrationType:n.integrationType,description:n.description,userId:i.userId,namespaceId:i.namespaceId,parameters:n.parameters,authSettingName:n.authSettingName??void 0,autoGrant:n.autoGrant??false};return this.nsController.updateIntegrationConfig(e,r).pipe(Od(()=>this.refresh()))}delete(e,n){return this.nsController.deleteIntegrationConfig(e).pipe(Od(()=>this.refresh()))}exportAsYaml(e){return this.exportService.exportAsYaml(e)}static \u0275fac=function(n){return new(n||f)};static \u0275prov=x({token:f,factory:f.\u0275fac,providedIn:"root"})};export{N};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,ao as V,G,C as Ce,dm as $,df as U,F,a7 as ya,W as br,a as Gi,m as mT,b as U$1,x,w,e as xw,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,a8 as Yg,y as eC,a9 as lC,S as Sg,a3 as VI,ac as gC,v as bg,a6 as UI,a5 as vl,t as rC,cH as Kw,z as oC,b0 as Qg,aa as If,ab as wf}from'./main-2EYBZUJC.js';import {o as z,k as _t,b as _e,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,f as fn,A as At,Z as Zn,l as Xn,$ as $t,W as Wt,C as Cn,E as En,p as An}from'./chunk-CZmNdEYy.js';function le(l,t){l&1&&(ws(0,"p",5),GC(1,"Loading\u2026"),pl());}function ae(l,t){if(l&1&&Sg(0,"input",11),l&2){let e=gC(2);bg("value",e.selectedProviderLabel());}}function de(l,t){if(l&1&&(ws(0,"option",43),GC(1),pl()),l&2){let e=t.$implicit;bg("value",e.id),XE(),Qg("",e.name," (",e.apiType,")");}}function me(l,t){if(l&1&&(ws(0,"select",12)(1,"option",42),GC(2,"Select provider"),pl(),rC(3,de,2,3,"option",43,Kw().trackByProvider,true),pl(),VI()),l&2){let e=gC(2);bg("formControl",e.aiProviderIdControl),UI(),XE(3),oC(e.providers());}}function ce(l,t){if(l&1){let e=lC();ws(0,"form",7),Rg("ngSubmit",function(){If(e);let u=gC();return wf(u.submit())}),ws(1,"div",8)(2,"label",9),GC(3," Provider "),ws(4,"span",10),GC(5,"*"),pl()(),Jw(6,ae,1,1,"input",11)(7,me,5,1,"select",12),pl(),ws(8,"div",8)(9,"label",13),GC(10," API name "),ws(11,"span",10),GC(12,"*"),pl()(),Sg(13,"input",14),VI(),pl(),ws(14,"div",8)(15,"label",15),GC(16,"Description"),pl(),Sg(17,"input",16),VI(),pl(),ws(18,"div",8)(19,"label",17),GC(20,"Alias"),pl(),Sg(21,"input",18),VI(),pl(),ws(22,"div",8)(23,"label",19),GC(24,"Priority"),pl(),Sg(25,"input",20),VI(),pl(),ws(26,"div",21)(27,"div",8)(28,"label",22),GC(29,"Temperature"),pl(),Sg(30,"input",23),VI(),pl(),ws(31,"div",8)(32,"label",24),GC(33,"Context window"),pl(),Sg(34,"input",25),VI(),pl()(),ws(35,"div",8)(36,"label",26),GC(37,"Max completion tokens"),pl(),Sg(38,"input",27),VI(),pl(),ws(39,"fieldset",28)(40,"legend",29),GC(41," Pricing "),ws(42,"span",30),GC(43,"(per million tokens \u2014 leave blank to skip cost monitoring)"),pl()(),ws(44,"div",21)(45,"div",8)(46,"label",31),GC(47,"Input"),pl(),Sg(48,"input",32),VI(),pl(),ws(49,"div",8)(50,"label",33),GC(51,"Output"),pl(),Sg(52,"input",34),VI(),pl()(),ws(53,"div",21)(54,"div",8)(55,"label",35),GC(56,"Cache write"),pl(),Sg(57,"input",36),VI(),pl(),ws(58,"div",8)(59,"label",37),GC(60,"Cache read"),pl(),Sg(61,"input",38),VI(),pl()()(),ws(62,"div",39)(63,"button",40),GC(64),pl(),ws(65,"button",41),Rg("click",function(){If(e);let u=gC();return wf(u.cancel())}),GC(66,"Cancel"),pl()()();}if(l&2){let e=gC();bg("formGroup",e.form),XE(6),eC(e.isEditMode()?6:7),XE(7),bg("formControl",e.apiModelNameControl),UI(),XE(4),bg("formControl",e.descriptionControl),UI(),XE(4),bg("formControl",e.aliasControl),UI(),XE(4),bg("formControl",e.priorityControl),UI(),XE(5),bg("formControl",e.temperatureControl),UI(),XE(4),bg("formControl",e.contextWindowControl),UI(),XE(4),bg("formControl",e.maxCompletionTokensControl),UI(),XE(),bg("formGroup",e.pricingGroup),XE(9),UI(),XE(4),UI(),XE(5),UI(),XE(4),UI(),XE(2),bg("disabled",e.form.invalid||e.isSubmitting()),XE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var re=class l{route=g(V);router=g(G);destroyRef=g(Ce);aiModelController=g($);aiProviderController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;providers=F(this.aiProviderController.listAiProvider(this.isPlatformMode?"none":this.namespaceId).pipe(ya(()=>br([]))),{initialValue:[]});form=new z({aiProviderId:new _t("",{nonNullable:true,validators:[_e.required]}),apiModelName:new _t("",{nonNullable:true,validators:[_e.required,_e.minLength(1)]}),description:new _t(null),alias:new _t("",{nonNullable:true}),priority:new _t(0,{nonNullable:true}),temperature:new _t(null),contextWindow:new _t(null),maxCompletionTokens:new _t(null),pricing:new z({inputMTokens:new _t(null),outputMTokens:new _t(null),cacheWrite:new _t(null),cacheRead:new _t(null)})});get aiProviderIdControl(){return this.form.controls.aiProviderId}get apiModelNameControl(){return this.form.controls.apiModelName}get descriptionControl(){return this.form.controls.description}get aliasControl(){return this.form.controls.alias}get priorityControl(){return this.form.controls.priority}get temperatureControl(){return this.form.controls.temperature}get contextWindowControl(){return this.form.controls.contextWindow}get maxCompletionTokensControl(){return this.form.controls.maxCompletionTokens}get pricingGroup(){return this.form.controls.pricing}isEditMode=Gi(false);isSubmitting=Gi(false);isLoading=Gi(false);selectedProviderLabel=mT(()=>{let t=this.aiProviderIdControl.value,e=this.providers().find(p=>p.id===t);return e?`${e.name} (${e.apiType})`:t});existingModel=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("modelId");t&&(this.isEditMode.set(true),this.loadModel(t));}loadModel(t){this.isLoading.set(true),this.aiModelController.getByIdAiModel(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.existingModel=e,this.aiProviderIdControl.setValue(e.aiProviderId),this.aiProviderIdControl.disable(),this.apiModelNameControl.setValue(e.apiModelName),this.descriptionControl.setValue(e.description??null),this.aliasControl.setValue(e.alias??""),this.priorityControl.setValue(e.priority??0),this.temperatureControl.setValue(e.temperature??null),this.contextWindowControl.setValue(e.contextWindow??null),this.maxCompletionTokensControl.setValue(e.maxCompletionTokens??null),this.pricingGroup.setValue({inputMTokens:e.pricing?.inputMTokens??null,outputMTokens:e.pricing?.outputMTokens??null,cacheWrite:e.pricing?.cacheWrite??null,cacheRead:e.pricing?.cacheRead??null}),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.form.getRawValue(),e=t.pricing,u=e.inputMTokens!=null||e.outputMTokens!=null||e.cacheWrite!=null||e.cacheRead!=null?{isEmpty:false,inputMTokens:e.inputMTokens??void 0,outputMTokens:e.outputMTokens??void 0,cacheWrite:e.cacheWrite??void 0,cacheRead:e.cacheRead??void 0}:void 0,k=x(w({},this.existingModel??{}),{aiProviderId:t.aiProviderId,namespaceId:this.isPlatformMode?void 0:this.existingModel?.namespaceId??this.namespaceId,apiModelName:t.apiModelName.trim(),description:t.description?.trim()||void 0,alias:t.alias.trim()||void 0,priority:t.priority,temperature:t.temperature??void 0,contextWindow:t.contextWindow??void 0,maxCompletionTokens:t.maxCompletionTokens??void 0,pricing:u});(this.isEditMode()?this.aiModelController.updateAiModel(this.existingModel.id??"",k):this.aiModelController.createAiModel(k)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-models"]):this.router.navigate(["/agentos",this.namespaceId,"ai-models"]);}trackByProvider(t,e){return e.id??""}static \u0275fac=function(e){return new(e||l)};static \u0275cmp=xw({type:l,selectors:[["agentos-ai-model-form"]],decls:10,vars:2,consts:[[1,"ai-model-form"],[1,"ai-model-form__header"],["type","button","title","Back to AI models",1,"ai-model-form__back",3,"click"],[1,"ai-model-form__back-icon"],[1,"ai-model-form__title"],[1,"ai-model-form__loading"],[1,"ai-model-form__form",3,"formGroup"],[1,"ai-model-form__form",3,"ngSubmit","formGroup"],[1,"ai-model-form__field"],["for","model-provider",1,"ai-model-form__label"],["aria-hidden","true"],["id","model-provider","type","text","readonly","","tabindex","-1",1,"ai-model-form__input","ai-model-form__input--readonly",3,"value"],["id","model-provider",1,"ai-model-form__select",3,"formControl"],["for","model-api-name",1,"ai-model-form__label"],["id","model-api-name","type","text","placeholder","e.g. gpt-4o, claude-3-5-sonnet-20241022","autocomplete","off",1,"ai-model-form__input","ai-model-form__input--mono",3,"formControl"],["for","model-description",1,"ai-model-form__label"],["id","model-description","type","text","placeholder","Optional \u2014 short description of this model config","autocomplete","off",1,"ai-model-form__input",3,"formControl"],["for","model-alias",1,"ai-model-form__label"],["id","model-alias","type","text","placeholder","e.g. fast, smart \u2014 short identifier used internally","autocomplete","off",1,"ai-model-form__input",3,"formControl"],["for","model-priority",1,"ai-model-form__label"],["id","model-priority","type","number","placeholder","0 \u2014 higher wins when multiple configs share the same alias","min","0","step","1",1,"ai-model-form__input",3,"formControl"],[1,"ai-model-form__row"],["for","model-temperature",1,"ai-model-form__label"],["id","model-temperature","type","number","placeholder","0 \u2013 2","min","0","max","2","step","0.1",1,"ai-model-form__input",3,"formControl"],["for","model-context-window",1,"ai-model-form__label"],["id","model-context-window","type","number","placeholder","e.g. 128000","min","1","step","1",1,"ai-model-form__input",3,"formControl"],["for","model-max-completion-tokens",1,"ai-model-form__label"],["id","model-max-completion-tokens","type","number","placeholder","e.g. 4096","min","1","step","1",1,"ai-model-form__input",3,"formControl"],[1,"ai-model-form__section",3,"formGroup"],[1,"ai-model-form__section-title"],[1,"ai-model-form__section-hint"],["for","pricing-input",1,"ai-model-form__label"],["id","pricing-input","type","number","placeholder","e.g. 2.50","min","0","step","0.01","formControlName","inputMTokens",1,"ai-model-form__input"],["for","pricing-output",1,"ai-model-form__label"],["id","pricing-output","type","number","placeholder","e.g. 10.00","min","0","step","0.01","formControlName","outputMTokens",1,"ai-model-form__input"],["for","pricing-cache-write",1,"ai-model-form__label"],["id","pricing-cache-write","type","number","placeholder","e.g. 3.75","min","0","step","0.01","formControlName","cacheWrite",1,"ai-model-form__input"],["for","pricing-cache-read",1,"ai-model-form__label"],["id","pricing-cache-read","type","number","placeholder","e.g. 0.30","min","0","step","0.01","formControlName","cacheRead",1,"ai-model-form__input"],[1,"ai-model-form__actions"],["type","submit",1,"ai-model-form__btn","ai-model-form__btn--primary",3,"disabled"],["type","button",1,"ai-model-form__btn",3,"click"],["value","","disabled",""],[3,"value"]],template:function(e,p){e&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return p.cancel()}),ws(3,"span",3),GC(4,"\u2190"),pl(),GC(5," AI models "),pl(),ws(6,"h1",4),GC(7),pl()(),Jw(8,le,2,0,"p",5)(9,ce,67,12,"form",6),pl()),e&2&&(XE(7),Yg(p.isEditMode()?"Edit AI model":"New AI model"),XE(),eC(p.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,fn,At,Zn,Xn,$t,Wt,Cn,En,An],styles:[".ai-model-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:480px;margin:0 auto;padding:2rem 1rem}.ai-model-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.ai-model-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.ai-model-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.ai-model-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.ai-model-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.ai-model-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.ai-model-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.ai-model-form__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.ai-model-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.ai-model-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.ai-model-form__input[_ngcontent-%COMP%], .ai-model-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.ai-model-form__input[_ngcontent-%COMP%]:focus, .ai-model-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.ai-model-form__input[_ngcontent-%COMP%]::placeholder, .ai-model-form__select[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.ai-model-form__input--mono[_ngcontent-%COMP%]{font-family:monospace}.ai-model-form__section[_ngcontent-%COMP%]{border:1px solid var(--color-divider);border-radius:0;padding:1rem;margin:0;display:flex;flex-direction:column;gap:1rem}.ai-model-form__section-title[_ngcontent-%COMP%]{font-size:.875rem;font-weight:600;color:var(--color-text);padding:0 .25rem}.ai-model-form__section-hint[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary);font-size:.8125rem}.ai-model-form__input--readonly[_ngcontent-%COMP%]{color:var(--color-text-secondary);cursor:default;background:var(--color-surface-muted, rgba(0, 0, 0, .03))}.ai-model-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.ai-model-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.ai-model-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.ai-model-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.ai-model-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.ai-model-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"]})};export{re as AiModelFormComponent};
|
|
1
|
+
import {g,ao as V,G,C as Ce,dm as $,df as U,F,a7 as ya,W as br,a as Gi,m as mT,b as U$1,x,w,e as xw,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,a8 as Yg,y as eC,a9 as lC,S as Sg,a3 as VI,ac as gC,v as bg,a6 as UI,a5 as vl,t as rC,cH as Kw,z as oC,b0 as Qg,aa as If,ab as wf}from'./main-GYSPY3UE.js';import {o as z,k as _t,b as _e,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,f as fn,A as At,Z as Zn,l as Xn,$ as $t,W as Wt,C as Cn,E as En,p as An}from'./chunk-DS1gnXQd.js';function le(l,t){l&1&&(ws(0,"p",5),GC(1,"Loading\u2026"),pl());}function ae(l,t){if(l&1&&Sg(0,"input",11),l&2){let e=gC(2);bg("value",e.selectedProviderLabel());}}function de(l,t){if(l&1&&(ws(0,"option",43),GC(1),pl()),l&2){let e=t.$implicit;bg("value",e.id),XE(),Qg("",e.name," (",e.apiType,")");}}function me(l,t){if(l&1&&(ws(0,"select",12)(1,"option",42),GC(2,"Select provider"),pl(),rC(3,de,2,3,"option",43,Kw().trackByProvider,true),pl(),VI()),l&2){let e=gC(2);bg("formControl",e.aiProviderIdControl),UI(),XE(3),oC(e.providers());}}function ce(l,t){if(l&1){let e=lC();ws(0,"form",7),Rg("ngSubmit",function(){If(e);let u=gC();return wf(u.submit())}),ws(1,"div",8)(2,"label",9),GC(3," Provider "),ws(4,"span",10),GC(5,"*"),pl()(),Jw(6,ae,1,1,"input",11)(7,me,5,1,"select",12),pl(),ws(8,"div",8)(9,"label",13),GC(10," API name "),ws(11,"span",10),GC(12,"*"),pl()(),Sg(13,"input",14),VI(),pl(),ws(14,"div",8)(15,"label",15),GC(16,"Description"),pl(),Sg(17,"input",16),VI(),pl(),ws(18,"div",8)(19,"label",17),GC(20,"Alias"),pl(),Sg(21,"input",18),VI(),pl(),ws(22,"div",8)(23,"label",19),GC(24,"Priority"),pl(),Sg(25,"input",20),VI(),pl(),ws(26,"div",21)(27,"div",8)(28,"label",22),GC(29,"Temperature"),pl(),Sg(30,"input",23),VI(),pl(),ws(31,"div",8)(32,"label",24),GC(33,"Context window"),pl(),Sg(34,"input",25),VI(),pl()(),ws(35,"div",8)(36,"label",26),GC(37,"Max completion tokens"),pl(),Sg(38,"input",27),VI(),pl(),ws(39,"fieldset",28)(40,"legend",29),GC(41," Pricing "),ws(42,"span",30),GC(43,"(per million tokens \u2014 leave blank to skip cost monitoring)"),pl()(),ws(44,"div",21)(45,"div",8)(46,"label",31),GC(47,"Input"),pl(),Sg(48,"input",32),VI(),pl(),ws(49,"div",8)(50,"label",33),GC(51,"Output"),pl(),Sg(52,"input",34),VI(),pl()(),ws(53,"div",21)(54,"div",8)(55,"label",35),GC(56,"Cache write"),pl(),Sg(57,"input",36),VI(),pl(),ws(58,"div",8)(59,"label",37),GC(60,"Cache read"),pl(),Sg(61,"input",38),VI(),pl()()(),ws(62,"div",39)(63,"button",40),GC(64),pl(),ws(65,"button",41),Rg("click",function(){If(e);let u=gC();return wf(u.cancel())}),GC(66,"Cancel"),pl()()();}if(l&2){let e=gC();bg("formGroup",e.form),XE(6),eC(e.isEditMode()?6:7),XE(7),bg("formControl",e.apiModelNameControl),UI(),XE(4),bg("formControl",e.descriptionControl),UI(),XE(4),bg("formControl",e.aliasControl),UI(),XE(4),bg("formControl",e.priorityControl),UI(),XE(5),bg("formControl",e.temperatureControl),UI(),XE(4),bg("formControl",e.contextWindowControl),UI(),XE(4),bg("formControl",e.maxCompletionTokensControl),UI(),XE(),bg("formGroup",e.pricingGroup),XE(9),UI(),XE(4),UI(),XE(5),UI(),XE(4),UI(),XE(2),bg("disabled",e.form.invalid||e.isSubmitting()),XE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var re=class l{route=g(V);router=g(G);destroyRef=g(Ce);aiModelController=g($);aiProviderController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;providers=F(this.aiProviderController.listAiProvider(this.isPlatformMode?"none":this.namespaceId).pipe(ya(()=>br([]))),{initialValue:[]});form=new z({aiProviderId:new _t("",{nonNullable:true,validators:[_e.required]}),apiModelName:new _t("",{nonNullable:true,validators:[_e.required,_e.minLength(1)]}),description:new _t(null),alias:new _t("",{nonNullable:true}),priority:new _t(0,{nonNullable:true}),temperature:new _t(null),contextWindow:new _t(null),maxCompletionTokens:new _t(null),pricing:new z({inputMTokens:new _t(null),outputMTokens:new _t(null),cacheWrite:new _t(null),cacheRead:new _t(null)})});get aiProviderIdControl(){return this.form.controls.aiProviderId}get apiModelNameControl(){return this.form.controls.apiModelName}get descriptionControl(){return this.form.controls.description}get aliasControl(){return this.form.controls.alias}get priorityControl(){return this.form.controls.priority}get temperatureControl(){return this.form.controls.temperature}get contextWindowControl(){return this.form.controls.contextWindow}get maxCompletionTokensControl(){return this.form.controls.maxCompletionTokens}get pricingGroup(){return this.form.controls.pricing}isEditMode=Gi(false);isSubmitting=Gi(false);isLoading=Gi(false);selectedProviderLabel=mT(()=>{let t=this.aiProviderIdControl.value,e=this.providers().find(p=>p.id===t);return e?`${e.name} (${e.apiType})`:t});existingModel=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("modelId");t&&(this.isEditMode.set(true),this.loadModel(t));}loadModel(t){this.isLoading.set(true),this.aiModelController.getByIdAiModel(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.existingModel=e,this.aiProviderIdControl.setValue(e.aiProviderId),this.aiProviderIdControl.disable(),this.apiModelNameControl.setValue(e.apiModelName),this.descriptionControl.setValue(e.description??null),this.aliasControl.setValue(e.alias??""),this.priorityControl.setValue(e.priority??0),this.temperatureControl.setValue(e.temperature??null),this.contextWindowControl.setValue(e.contextWindow??null),this.maxCompletionTokensControl.setValue(e.maxCompletionTokens??null),this.pricingGroup.setValue({inputMTokens:e.pricing?.inputMTokens??null,outputMTokens:e.pricing?.outputMTokens??null,cacheWrite:e.pricing?.cacheWrite??null,cacheRead:e.pricing?.cacheRead??null}),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.form.getRawValue(),e=t.pricing,u=e.inputMTokens!=null||e.outputMTokens!=null||e.cacheWrite!=null||e.cacheRead!=null?{isEmpty:false,inputMTokens:e.inputMTokens??void 0,outputMTokens:e.outputMTokens??void 0,cacheWrite:e.cacheWrite??void 0,cacheRead:e.cacheRead??void 0}:void 0,k=x(w({},this.existingModel??{}),{aiProviderId:t.aiProviderId,namespaceId:this.isPlatformMode?void 0:this.existingModel?.namespaceId??this.namespaceId,apiModelName:t.apiModelName.trim(),description:t.description?.trim()||void 0,alias:t.alias.trim()||void 0,priority:t.priority,temperature:t.temperature??void 0,contextWindow:t.contextWindow??void 0,maxCompletionTokens:t.maxCompletionTokens??void 0,pricing:u});(this.isEditMode()?this.aiModelController.updateAiModel(this.existingModel.id??"",k):this.aiModelController.createAiModel(k)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-models"]):this.router.navigate(["/agentos",this.namespaceId,"ai-models"]);}trackByProvider(t,e){return e.id??""}static \u0275fac=function(e){return new(e||l)};static \u0275cmp=xw({type:l,selectors:[["agentos-ai-model-form"]],decls:10,vars:2,consts:[[1,"ai-model-form"],[1,"ai-model-form__header"],["type","button","title","Back to AI models",1,"ai-model-form__back",3,"click"],[1,"ai-model-form__back-icon"],[1,"ai-model-form__title"],[1,"ai-model-form__loading"],[1,"ai-model-form__form",3,"formGroup"],[1,"ai-model-form__form",3,"ngSubmit","formGroup"],[1,"ai-model-form__field"],["for","model-provider",1,"ai-model-form__label"],["aria-hidden","true"],["id","model-provider","type","text","readonly","","tabindex","-1",1,"ai-model-form__input","ai-model-form__input--readonly",3,"value"],["id","model-provider",1,"ai-model-form__select",3,"formControl"],["for","model-api-name",1,"ai-model-form__label"],["id","model-api-name","type","text","placeholder","e.g. gpt-4o, claude-3-5-sonnet-20241022","autocomplete","off",1,"ai-model-form__input","ai-model-form__input--mono",3,"formControl"],["for","model-description",1,"ai-model-form__label"],["id","model-description","type","text","placeholder","Optional \u2014 short description of this model config","autocomplete","off",1,"ai-model-form__input",3,"formControl"],["for","model-alias",1,"ai-model-form__label"],["id","model-alias","type","text","placeholder","e.g. fast, smart \u2014 short identifier used internally","autocomplete","off",1,"ai-model-form__input",3,"formControl"],["for","model-priority",1,"ai-model-form__label"],["id","model-priority","type","number","placeholder","0 \u2014 higher wins when multiple configs share the same alias","min","0","step","1",1,"ai-model-form__input",3,"formControl"],[1,"ai-model-form__row"],["for","model-temperature",1,"ai-model-form__label"],["id","model-temperature","type","number","placeholder","0 \u2013 2","min","0","max","2","step","0.1",1,"ai-model-form__input",3,"formControl"],["for","model-context-window",1,"ai-model-form__label"],["id","model-context-window","type","number","placeholder","e.g. 128000","min","1","step","1",1,"ai-model-form__input",3,"formControl"],["for","model-max-completion-tokens",1,"ai-model-form__label"],["id","model-max-completion-tokens","type","number","placeholder","e.g. 4096","min","1","step","1",1,"ai-model-form__input",3,"formControl"],[1,"ai-model-form__section",3,"formGroup"],[1,"ai-model-form__section-title"],[1,"ai-model-form__section-hint"],["for","pricing-input",1,"ai-model-form__label"],["id","pricing-input","type","number","placeholder","e.g. 2.50","min","0","step","0.01","formControlName","inputMTokens",1,"ai-model-form__input"],["for","pricing-output",1,"ai-model-form__label"],["id","pricing-output","type","number","placeholder","e.g. 10.00","min","0","step","0.01","formControlName","outputMTokens",1,"ai-model-form__input"],["for","pricing-cache-write",1,"ai-model-form__label"],["id","pricing-cache-write","type","number","placeholder","e.g. 3.75","min","0","step","0.01","formControlName","cacheWrite",1,"ai-model-form__input"],["for","pricing-cache-read",1,"ai-model-form__label"],["id","pricing-cache-read","type","number","placeholder","e.g. 0.30","min","0","step","0.01","formControlName","cacheRead",1,"ai-model-form__input"],[1,"ai-model-form__actions"],["type","submit",1,"ai-model-form__btn","ai-model-form__btn--primary",3,"disabled"],["type","button",1,"ai-model-form__btn",3,"click"],["value","","disabled",""],[3,"value"]],template:function(e,p){e&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return p.cancel()}),ws(3,"span",3),GC(4,"\u2190"),pl(),GC(5," AI models "),pl(),ws(6,"h1",4),GC(7),pl()(),Jw(8,le,2,0,"p",5)(9,ce,67,12,"form",6),pl()),e&2&&(XE(7),Yg(p.isEditMode()?"Edit AI model":"New AI model"),XE(),eC(p.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,fn,At,Zn,Xn,$t,Wt,Cn,En,An],styles:[".ai-model-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:480px;margin:0 auto;padding:2rem 1rem}.ai-model-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.ai-model-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.ai-model-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.ai-model-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.ai-model-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.ai-model-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.ai-model-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.ai-model-form__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.ai-model-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.ai-model-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.ai-model-form__input[_ngcontent-%COMP%], .ai-model-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.ai-model-form__input[_ngcontent-%COMP%]:focus, .ai-model-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.ai-model-form__input[_ngcontent-%COMP%]::placeholder, .ai-model-form__select[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.ai-model-form__input--mono[_ngcontent-%COMP%]{font-family:monospace}.ai-model-form__section[_ngcontent-%COMP%]{border:1px solid var(--color-divider);border-radius:0;padding:1rem;margin:0;display:flex;flex-direction:column;gap:1rem}.ai-model-form__section-title[_ngcontent-%COMP%]{font-size:.875rem;font-weight:600;color:var(--color-text);padding:0 .25rem}.ai-model-form__section-hint[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary);font-size:.8125rem}.ai-model-form__input--readonly[_ngcontent-%COMP%]{color:var(--color-text-secondary);cursor:default;background:var(--color-surface-muted, rgba(0, 0, 0, .03))}.ai-model-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.ai-model-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.ai-model-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.ai-model-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.ai-model-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.ai-model-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"]})};export{re as AiModelFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {N}from'./chunk-DnMJl9Ao.js';import {g,ao as V,G,C as Ce$1,da as M,dn as B,a as Gi,dp as J,d8 as F,F as F$1,m as mT,dq as Ae$1,b as U,a7 as ya,W as br,Q as By,r as re,x,w,e as xw,s as si,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,a8 as Yg,y as eC,ac as gC,v as bg,a9 as lC,S as Sg,a3 as VI,a6 as UI,T as Tg,a5 as vl,t as rC,z as oC,bo as tC,aa as If,ab as wf,b0 as Qg}from'./main-2EYBZUJC.js';import'./chunk-kFOHrPbJ.js';import {o as z,k as _t,b as _e,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,f as fn,a as wt,A as At,Z as Zn,l as Xn,$ as $t,W as Wt,C as Cn,E as En}from'./chunk-CZmNdEYy.js';import'./chunk-BWcVMw4T.js';import'./chunk-DqzTsn7a.js';import'./chunk-Bx_FH6m3.js';import'./chunk-BPkyqr-f.js';var Ce=(o,t)=>t.config.id,be=(o,t)=>t.type;function xe(o,t){if(o&1&&(ws(0,"a",5),GC(1,"View resolved definition \u2192"),pl()),o&2){let e=gC();bg("routerLink",e.inspectRoute());}}function he(o,t){o&1&&(ws(0,"span",6),GC(1,"Platform level"),pl());}function ve(o,t){o&1&&(ws(0,"p",7),GC(1,"Loading\u2026"),pl());}function ye(o,t){if(o&1&&(ws(0,"span",49),GC(1),pl()),o&2){let e=gC().$implicit;XE(),Yg(e.config.integrationType);}}function we(o,t){if(o&1&&(Sg(0,"input",50),VI()),o&2){let e=gC().$implicit;bg("formControl",e.toolsControl),UI();}}function Se(o,t){if(o&1){let e=lC();ws(0,"div",45)(1,"label",46)(2,"input",47),Rg("change",function(){let c=If(e).$implicit,g=gC(3);return wf(g.toggleIntegration(c))}),pl(),ws(3,"span",48),GC(4),pl(),Jw(5,ye,2,1,"span",49),pl(),Jw(6,we,1,1,"input",50),pl();}if(o&2){let e=t.$implicit;XE(2),bg("checked",e.enabled()),XE(2),Yg(e.config.name),XE(),eC(e.config.integrationType?5:-1),XE(),eC(e.enabled()?6:-1);}}function Me(o,t){if(o&1&&(ws(0,"p",56),GC(1),pl()),o&2){let e=gC().$implicit;XE(),vl(" Restricted to: ",e.restrictedTools.join(", ")," (set outside this form, preserved on save) ");}}function Ee(o,t){if(o&1){let e=lC();ws(0,"div",45)(1,"label",46)(2,"span",48),GC(3),pl(),ws(4,"span",49),GC(5,"built-in"),pl()(),ws(6,"select",52),Rg("change",function(c){let g=If(e).$implicit,C=gC(4);return wf(C.setBuiltInState(g,c.target.value))}),ws(7,"option",53),GC(8),pl(),ws(9,"option",54),GC(10,"Enabled"),pl(),ws(11,"option",55),GC(12,"Disabled"),pl()(),Jw(13,Me,2,1,"p",56),ws(14,"p",57),GC(15),pl()();}if(o&2){let e=t.$implicit,a=gC(4);XE(),Tg("for","built-in-"+e.type),XE(2),Yg(e.displayName),XE(3),bg("id","built-in-"+e.type)("value",e.state()),XE(2),Yg(a.builtInDefaultLabel(e)),XE(5),eC(e.state()==="on"&&e.restrictedTools?13:-1),XE(2),Yg(e.description);}}function Ae(o,t){if(o&1&&(ws(0,"p",51),GC(1,"Built-in integrations"),pl(),rC(2,Ee,16,7,"div",45,be)),o&2){let e=gC(3);XE(2),oC(e.builtInRows());}}function Ie(o,t){if(o&1&&(ws(0,"fieldset",20)(1,"legend",29),GC(2,"Integrations"),pl(),ws(3,"p",44),GC(4," Select which integrations this agent can use. Leave tool names empty to allow all tools from an integration. "),pl(),rC(5,Se,7,4,"div",45,Ce),Jw(7,Ae,4,0),pl()),o&2){let e=gC(2);XE(5),oC(e.integrationRows()),XE(2),eC(e.builtInRows().length>0?7:-1);}}function Oe(o,t){o&1&&(ws(0,"p",60),GC(1,"Invalid JSON \u2014 please fix the syntax."),pl());}function Pe(o,t){if(o&1&&(ws(0,"div",10)(1,"label",58),GC(2,"Loop configuration (JSON)"),pl(),Sg(3,"textarea",59),VI(),Jw(4,Oe,2,0,"p",60),ws(5,"p",24),GC(6," Default payload for this loop agent. Overridden at launch time if the first message contains a valid "),ws(7,"code",30),GC(8,"AgentLoopPayload"),pl(),GC(9,". Leave empty if you always provide the payload at launch. "),pl()()),o&2){let e=gC(2);XE(3),bg("placeholder",e.loopConfigPlaceholder)("formControl",e.loopConfigControl),UI(),XE(),eC(e.loopConfigControl.invalid&&e.loopConfigControl.touched?4:-1);}}function ke(o,t){if(o&1){let e=lC();ws(0,"li",61),Sg(1,"input",62),VI(),ws(2,"button",63),Rg("click",function(){let c=If(e).$implicit,g=gC(3);return wf(g.removeSubAgent(c))}),GC(3," \u{1F5D1} "),pl()();}if(o&2){let e=t.$implicit;XE(),bg("formControl",e.control),UI();}}function Te(o,t){if(o&1&&(ws(0,"ul",31),rC(1,ke,4,1,"li",61,tC),pl()),o&2){let e=gC(2);XE(),oC(e.subAgentRows());}}function Re(o,t){if(o&1&&GC(0),o&2){let e=gC(2);Qg(" : ",e.defaultDelegationTimeoutSeconds()," s (",e.defaultDelegationTimeoutSeconds()/60," min) ");}}function De(o,t){o&1&&(ws(0,"p",38),GC(1," Enter a valid positive whole number of seconds, or leave empty to inherit the server default. "),pl());}function Ve(o,t){if(o&1){let e=lC();ws(0,"button",64),Rg("click",function(){If(e);let c=gC(2);return wf(c.useDefaultDelegationTimeout())}),GC(1," Use server default "),pl();}}function Ne(o,t){if(o&1){let e=lC();ws(0,"button",65),Rg("click",function(){If(e);let c=gC(2);return wf(c.exportYaml())}),GC(1),pl();}if(o&2){let e=gC(2);bg("disabled",e.isExporting()),XE(),vl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Fe(o,t){if(o&1){let e=lC();ws(0,"form",9),Rg("ngSubmit",function(){If(e);let c=gC();return wf(c.submit())}),ws(1,"div",10)(2,"label",11),GC(3,"Name "),ws(4,"span",12),GC(5,"*"),pl()(),Sg(6,"input",13),VI(),pl(),ws(7,"div",10)(8,"label",14),GC(9,"Description"),pl(),Sg(10,"input",15),VI(),pl(),ws(11,"div",10)(12,"label",16),GC(13,"Model name"),pl(),Sg(14,"input",17),VI(),pl(),ws(15,"div",10)(16,"label",18),GC(17,"Instructions"),pl(),Sg(18,"textarea",19),VI(),pl(),Jw(19,Ie,8,1,"fieldset",20),ws(20,"div",10)(21,"label",21),GC(22,"Execution mode"),pl(),ws(23,"select",22)(24,"option",23),GC(25,"SIMPLE \u2014 Standard agent (single LLM call)"),pl(),ws(26,"option",23),GC(27,"ADVANCED \u2014 Multi-step reasoning loop"),pl(),ws(28,"option",23),GC(29,"LOOP \u2014 Bulk loop agent (no LLM, experimental)"),pl()(),VI(),ws(30,"p",24),GC(31,' SIMPLE runs a single LLM pass. ADVANCED uses an intention loop for complex tasks. LOOP (experimental) starts one case per result of a tool, without an LLM \u2014 run it with "Launch loop" in the agent list menu. '),pl()(),Jw(32,Pe,10,3,"div",10),ws(33,"div",10)(34,"label",25),Sg(35,"input",26),VI(),ws(36,"span",27),GC(37,"Enabled"),pl()(),ws(38,"p",28),GC(39,"Disabled agents are excluded from namespace resolution."),pl()(),ws(40,"div",10)(41,"span",29),GC(42,"Sub-agents"),pl(),ws(43,"p",24),GC(44," Glob patterns for agents this agent may delegate to. "),ws(45,"code",30),GC(46,"*"),pl(),GC(47," matches any sequence of characters (e.g. "),ws(48,"code",30),GC(49,"*Fixer"),pl(),GC(50,", "),ws(51,"code",30),GC(52,"*"),pl(),GC(53," for all). Leave empty to disable delegation. "),pl(),Jw(54,Te,3,0,"ul",31),ws(55,"div",32)(56,"input",33),Rg("keydown.enter",function(){If(e);let c=gC();return wf(c.addSubAgent())}),pl(),VI(),ws(57,"button",34),Rg("click",function(){If(e);let c=gC();return wf(c.addSubAgent())}),GC(58," + "),pl()()(),ws(59,"div",10)(60,"label",35),GC(61,"Delegation timeout (seconds)"),pl(),ws(62,"p",36),GC(63," Maximum time for each delegation launched by this agent, including nested delegations. On timeout, the sub-agent and its active descendants are stopped. Leave empty to use the server default "),Jw(64,Re,1,2),GC(65," . "),pl(),Sg(66,"input",37),VI(),Jw(67,De,2,0,"p",38),Jw(68,Ve,2,0,"button",39),pl(),ws(69,"div",40)(70,"button",41),GC(71),pl(),Jw(72,Ne,2,2,"button",42),ws(73,"button",43),Rg("click",function(){If(e);let c=gC();return wf(c.cancel())}),GC(74,"Cancel"),pl()()();}if(o&2){let e=gC();bg("formGroup",e.form),XE(6),bg("formControl",e.nameControl),UI(),XE(4),bg("formControl",e.descriptionControl),UI(),XE(4),bg("formControl",e.modelNameControl),UI(),XE(4),bg("formControl",e.instructionsControl),UI(),XE(),eC(e.integrationRows().length>0||e.builtInRows().length>0?19:-1),XE(4),bg("formControl",e.executionModeControl),UI(),XE(),bg("value",e.ExecutionMode.SIMPLE),XE(2),bg("value",e.ExecutionMode.ADVANCED),XE(2),bg("value",e.ExecutionMode.LOOP),XE(4),eC(e.isLoopMode()?32:-1),XE(3),bg("formControl",e.enabledControl),UI(),XE(19),eC(e.subAgentRows().length>0?54:-1),XE(2),bg("formControl",e.newSubAgentControl),UI(),XE(),bg("disabled",!e.newSubAgentControl.value.trim()),XE(7),eC(e.defaultDelegationTimeoutSeconds()!==null?64:-1),XE(2),bg("formControl",e.delegationTimeoutControl),Tg("aria-invalid",e.delegationTimeoutControl.invalid),UI(),XE(),eC(e.delegationTimeoutControl.invalid?67:-1),XE(),eC(e.delegationTimeoutControl.value!==null?68:-1),XE(2),bg("disabled",e.form.invalid||e.isSubmitting()),XE(),vl(" ",e.isEditMode()?"Save changes":"Create"," "),XE(),eC(e.isEditMode()?72:-1);}}var pe=class o{route=g(V);router=g(G);destroyRef=g(Ce$1);agentConfigController=g(M);defaultsController=g(B);defaultDelegationTimeoutSeconds=Gi(null);exportService=g(J);integrationConfigState=g(N);integrationTypeController=g(F);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new z({name:new _t("",{nonNullable:true,validators:[_e.required,_e.minLength(1)]}),description:new _t(null),modelName:new _t(null),instructions:new _t(null),executionMode:new _t("SIMPLE",{nonNullable:true}),delegationTimeoutSeconds:new _t(null,{validators:[_e.min(1),_e.max(2147483647),_e.pattern(/^\d+$/)]}),enabled:new _t(false,{nonNullable:true}),loopConfig:new _t(null,{validators:[o.jsonValidator]})});static jsonValidator(t){let e=t.value?.trim();if(!e)return null;try{return JSON.parse(e),null}catch(a){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();}get enabledControl(){return this.form.controls.enabled}get loopConfigControl(){return this.form.controls.loopConfig}executionModeValue=F$1(this.form.controls.executionMode.valueChanges,{initialValue:this.form.controls.executionMode.value});isLoopMode=mT(()=>this.executionModeValue()==="LOOP");subAgentRows=Gi([]);newSubAgentControl=new _t("",{nonNullable:true});isEditMode=Gi(false);isSubmitting=Gi(false);isLoading=Gi(false);isExporting=Gi(false);ExecutionMode=Ae$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=Gi([]);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"]}integrationRows=Gi([]);existingConfig=null;ngOnInit(){this.defaultsController.getAgentConfigDefaults().pipe(U(this.destroyRef),ya(()=>br(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),By({config:this.agentConfigController.getByIdAgentConfig(t),namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):br([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes()}).pipe(U(this.destroyRef)).subscribe({next:({config:e,namespaceIntegrations:a,platformIntegrations:c,builtInTypes:g})=>{this.existingConfig=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.modelNameControl.setValue(e.modelName??null),this.instructionsControl.setValue(e.instructions??null);let C=e.executionMode??(e.advancedExecution?"ADVANCED":"SIMPLE");this.executionModeControl.setValue(C),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 T=[...c,...a];this.integrationRows.set(this.buildIntegrationRows(T,e.integrations??void 0)),this.builtInRows.set(this.buildBuiltInRows(g,e.integrations??void 0)),this.subAgentRows.set((e.subAgents??[]).map(_e=>({control:new _t(_e,{nonNullable:true})}))),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadIntegrations(t){By({namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):br([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes()}).pipe(U(this.destroyRef)).subscribe({next:({namespaceIntegrations:e,platformIntegrations:a,builtInTypes:c})=>{let g=[...a,...e];this.integrationRows.set(this.buildIntegrationRows(g,t??void 0)),this.builtInRows.set(this.buildBuiltInRows(c,t??void 0));}});}loadBuiltInTypes(){return this.integrationTypeController.listTypesIntegrationType().pipe(re(t=>t.filter(e=>!e.configSchema)),ya(t=>(console.error("[agent-config-form] failed to load integration types",t),br([]))))}buildIntegrationRows(t,e){return t.map(a=>{let c=a.name??"",g=e?.[c],C=e!=null&&c in e,T=Array.isArray(g)?g.join(", "):"";return {config:a,enabled:Gi(C),toolsControl:new _t(T,{nonNullable:true})}})}buildBuiltInRows(t,e){return t.map(a=>{let c=e!=null&&a.type in e,g=e?.[a.type],C=c?Array.isArray(g)&&g.length===0?"off":"on":"default";return {type:a.type,displayName:a.displayName,description:a.description,enabledByDefault:a.enabledByDefault===true,state:Gi(C),restrictedTools:Array.isArray(g)&&g.length>0?g: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();t&&(this.subAgentRows.update(e=>[...e,{control:new _t(t,{nonNullable:true})}]),this.newSubAgentControl.reset(""));}removeSubAgent(t){this.subAgentRows.update(e=>e.filter(a=>a!==t));}buildSubAgentsPayload(){let t=this.subAgentRows().map(e=>e.control.value.trim()).filter(e=>e.length>0);return t.length>0?t:void 0}buildIntegrationsPayload(){let t={};for(let a of this.integrationRows().filter(c=>c.enabled())){let c=a.config.name??"",g=a.toolsControl.value.trim();t[c]=g===""?null:g.split(",").map(C=>C.trim()).filter(C=>C.length>0);}for(let a of this.builtInRows()){let c=a.state();c==="on"?t[a.type]=a.restrictedTools??null:c==="off"&&(t[a.type]=[]);}let e=new Set([...this.integrationRows().map(a=>a.config.name??""),...this.builtInRows().map(a=>a.type)]);for(let[a,c]of Object.entries(this.existingConfig?.integrations??{}))e.has(a)||(t[a]=c);return Object.keys(t).length>0?t:void 0}submit(){if(this.form.invalid||this.isSubmitting())return;this.addSubAgent(),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(),delegationTimeoutSeconds:this.delegationTimeoutControl.value,loopConfig:this.buildLoopConfigPayload()});(this.isEditMode()?this.agentConfigController.updateAgentConfig(this.existingConfig.id??"",t):this.agentConfigController.createAgentConfig(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let t=this.existingConfig?.id;!t||this.isExporting()||(this.isExporting.set(true),this.exportService.exportAsYaml(t).pipe(U(this.destroyRef)).subscribe({next:e=>{let a=new Blob([e],{type:"application/yaml"}),c=URL.createObjectURL(a),g=document.createElement("a");g.href=c,g.download=`${this.existingConfig?.name??"agent"}.yaml`,g.click(),URL.revokeObjectURL(c),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||o)};static \u0275cmp=xw({type:o,selectors:[["agentos-agent-config-form"]],decls:12,vars:4,consts:[[1,"agent-config-form"],[1,"agent-config-form__header"],["type","button","title","Back to agent configs",1,"agent-config-form__back",3,"click"],[1,"agent-config-form__back-icon"],[1,"agent-config-form__title"],[1,"agent-config-form__sibling-link",3,"routerLink"],[1,"agent-config-form__platform-badge"],[1,"agent-config-form__loading"],[1,"agent-config-form__form",3,"formGroup"],[1,"agent-config-form__form",3,"ngSubmit","formGroup"],[1,"agent-config-form__field"],["for","agent-config-name",1,"agent-config-form__label"],["aria-hidden","true"],["id","agent-config-name","type","text","placeholder","e.g. Support agent","autocomplete","off",1,"agent-config-form__input",3,"formControl"],["for","agent-config-description",1,"agent-config-form__label"],["id","agent-config-description","type","text","placeholder","Optional \u2014 short description of this agent","autocomplete","off",1,"agent-config-form__input",3,"formControl"],["for","agent-config-model-name",1,"agent-config-form__label"],["id","agent-config-model-name","type","text","placeholder","Optional \u2014 model alias or name to use","autocomplete","off",1,"agent-config-form__input",3,"formControl"],["for","agent-config-instructions",1,"agent-config-form__label"],["id","agent-config-instructions","rows","6","placeholder","Optional \u2014 system instructions for this agent",1,"agent-config-form__textarea",3,"formControl"],[1,"agent-config-form__integrations"],["for","agent-config-execution-mode",1,"agent-config-form__label"],["id","agent-config-execution-mode",1,"agent-config-form__select",3,"formControl"],[3,"value"],[1,"agent-config-form__field-hint"],[1,"agent-config-form__toggle-label"],["type","checkbox",1,"agent-config-form__toggle-checkbox",3,"formControl"],[1,"agent-config-form__toggle-text"],[1,"agent-config-form__toggle-hint"],[1,"agent-config-form__label"],[1,"agent-config-form__code"],[1,"agent-config-form__sub-agent-list"],[1,"agent-config-form__sub-agent-add"],["type","text","placeholder","e.g. *Fixer or *","autocomplete","off",1,"agent-config-form__input","agent-config-form__sub-agent-input",3,"keydown.enter","formControl"],["type","button","title","Add pattern",1,"agent-config-form__sub-agent-btn","agent-config-form__sub-agent-btn--add",3,"click","disabled"],["for","delegation-timeout",1,"agent-config-form__label"],["id","delegation-timeout-hint",1,"agent-config-form__field-hint"],["id","delegation-timeout","type","number","min","1","max","2147483647","step","1","placeholder","Server default","aria-describedby","delegation-timeout-hint delegation-timeout-error",1,"agent-config-form__input",3,"formControl"],["id","delegation-timeout-error","role","alert",1,"agent-config-form__field-hint"],["type","button",1,"agent-config-form__sub-agent-btn"],[1,"agent-config-form__actions"],["type","submit",1,"agent-config-form__btn","agent-config-form__btn--primary",3,"disabled"],["type","button",1,"agent-config-form__btn","agent-config-form__btn--export",3,"disabled"],["type","button",1,"agent-config-form__btn",3,"click"],[1,"agent-config-form__integrations-hint"],[1,"agent-config-form__integration-row"],[1,"agent-config-form__integration-toggle"],["type","checkbox",1,"agent-config-form__integration-checkbox",3,"change","checked"],[1,"agent-config-form__integration-name"],[1,"agent-config-form__integration-type"],["type","text","placeholder","Tool names, comma-separated (empty = all tools)","autocomplete","off",1,"agent-config-form__input","agent-config-form__integration-tools",3,"formControl"],[1,"agent-config-form__integrations-separator"],[1,"agent-config-form__integration-state",3,"change","id","value"],["value","default"],["value","on"],["value","off"],[1,"agent-config-form__integration-restriction"],[1,"agent-config-form__integration-builtin-desc"],["for","agent-config-loop-config",1,"agent-config-form__label"],["id","agent-config-loop-config","rows","10","spellcheck","false","autocomplete","off",1,"agent-config-form__textarea","agent-config-form__textarea--mono",3,"placeholder","formControl"],["role","alert",1,"agent-config-form__field-error"],[1,"agent-config-form__sub-agent-row"],["type","text","autocomplete","off",1,"agent-config-form__input","agent-config-form__sub-agent-input",3,"formControl"],["type","button","title","Remove",1,"agent-config-form__sub-agent-btn","agent-config-form__sub-agent-btn--danger",3,"click"],["type","button",1,"agent-config-form__sub-agent-btn",3,"click"],["type","button",1,"agent-config-form__btn","agent-config-form__btn--export",3,"click","disabled"]],template:function(e,a){e&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return a.cancel()}),ws(3,"span",3),GC(4,"\u2190"),pl(),GC(5," Agent Configs "),pl(),ws(6,"h1",4),GC(7),pl(),Jw(8,xe,2,1,"a",5),Jw(9,he,2,0,"span",6),pl(),Jw(10,ve,2,0,"p",7)(11,Fe,75,23,"form",8),pl()),e&2&&(XE(7),Yg(a.isEditMode()?"Edit agent config":"New agent config"),XE(),eC(a.isEditMode()?8:-1),XE(),eC(a.isPlatformMode?9:-1),XE(),eC(a.isLoading()?10:11));},dependencies:[ni,Jn,Qn,ei,Ye,fn,wt,At,Zn,Xn,$t,Wt,Cn,En,si],styles:[".agent-config-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.agent-config-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.agent-config-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.agent-config-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.agent-config-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.agent-config-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.agent-config-form__sibling-link[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-accent);text-decoration:none}.agent-config-form__sibling-link[_ngcontent-%COMP%]:hover{text-decoration:underline}.agent-config-form__platform-badge[_ngcontent-%COMP%]{display:inline-block;font-size:.75rem;font-weight:500;color:var(--color-text-secondary);background:var(--color-surface);border:1px solid var(--color-divider);border-radius:0;padding:.125rem .5rem;letter-spacing:.02em;align-self:flex-start}.agent-config-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.agent-config-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.agent-config-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.agent-config-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.agent-config-form__input[_ngcontent-%COMP%], .agent-config-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.agent-config-form__input[_ngcontent-%COMP%]:focus, .agent-config-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.agent-config-form__input[_ngcontent-%COMP%]::placeholder, .agent-config-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.agent-config-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:120px;line-height:1.5}.agent-config-form__textarea--mono[_ngcontent-%COMP%]{font-family:monospace;font-size:.8125rem}.agent-config-form__field-error[_ngcontent-%COMP%]{margin:.25rem 0 0;font-size:.8rem;color:var(--color-error, var(--red, #dc2626));line-height:1.4}.agent-config-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;cursor:pointer;transition:border-color .15s ease;appearance:auto}.agent-config-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.agent-config-form__integrations[_ngcontent-%COMP%]{border:1px solid var(--color-divider);border-radius:0;padding:1rem;margin:0;display:flex;flex-direction:column;gap:.75rem}.agent-config-form__integrations-hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__integration-row[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.agent-config-form__integration-toggle[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.agent-config-form__integration-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-accent);cursor:pointer}.agent-config-form__integration-name[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text)}.agent-config-form__integration-type[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);font-family:monospace}.agent-config-form__integration-tools[_ngcontent-%COMP%]{margin-left:1.5rem;font-size:.875rem}.agent-config-form__integrations-separator[_ngcontent-%COMP%]{margin:.25rem 0 0;padding-top:.5rem;border-top:1px solid var(--color-divider);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);font-family:var(--font-heading)}.agent-config-form__integration-state[_ngcontent-%COMP%]{margin-left:1.5rem;padding:.375rem .625rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.875rem;font-family:inherit;outline:none;transition:border-color .15s ease}.agent-config-form__integration-state[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.agent-config-form__integration-restriction[_ngcontent-%COMP%]{margin:0 0 0 1.5rem;font-size:.8rem;font-style:italic;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.agent-config-form__integration-builtin-desc[_ngcontent-%COMP%]{margin:0 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__field-hint[_ngcontent-%COMP%]{margin:.25rem 0 0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__code[_ngcontent-%COMP%]{font-family:monospace;font-size:.85em;background:var(--color-surface-muted, rgba(0, 0, 0, .06));padding:.1em .3em;border-radius:0}.agent-config-form__sub-agent-list[_ngcontent-%COMP%]{list-style:none;margin:.5rem 0 0;padding:0;display:flex;flex-direction:column;gap:.375rem}.agent-config-form__sub-agent-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem}.agent-config-form__sub-agent-input[_ngcontent-%COMP%]{flex:1;min-width:0}.agent-config-form__sub-agent-add[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;margin-top:.5rem}.agent-config-form__sub-agent-btn[_ngcontent-%COMP%]{flex-shrink:0;width:2rem;height:2rem;padding:0;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text-secondary);font-size:.9rem;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .15s ease,border-color .15s ease,color .15s ease}.agent-config-form__sub-agent-btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500);color:var(--color-text)}.agent-config-form__sub-agent-btn[_ngcontent-%COMP%]:disabled{opacity:.35;cursor:not-allowed}.agent-config-form__sub-agent-btn--add[_ngcontent-%COMP%]{width:2rem;height:2rem;font-size:1.25rem;font-weight:300;border-color:var(--color-accent);color:var(--color-accent)}.agent-config-form__sub-agent-btn--add[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent);color:#fff}.agent-config-form__sub-agent-btn--danger[_ngcontent-%COMP%]{border:1px solid transparent;color:var(--color-neutral-500)}.agent-config-form__sub-agent-btn--danger[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--red);color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent)}.agent-config-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.agent-config-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-accent);cursor:pointer}.agent-config-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text)}.agent-config-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.agent-config-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.agent-config-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.agent-config-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.agent-config-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.agent-config-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"]})};export{pe as AgentConfigFormComponent};
|
|
1
|
+
import {N}from'./chunk-BLltB5Fl.js';import {g,ao as V,G,C as Ce$1,da as M,dn as B,a as Gi,dp as J,d8 as F,F as F$1,m as mT,dq as ve$1,b as U,a7 as ya,W as br,Q as By,r as re,x,w,e as xw,s as si,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,a8 as Yg,y as eC,ac as gC,v as bg,a9 as lC,S as Sg,a3 as VI,a6 as UI,T as Tg,a5 as vl,t as rC,z as oC,bo as tC,aa as If,ab as wf,b0 as Qg}from'./main-GYSPY3UE.js';import'./chunk-DdPOtjZp.js';import {o as z,k as _t,b as _e,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,f as fn,a as wt,A as At,Z as Zn,l as Xn,$ as $t,W as Wt,C as Cn,E as En}from'./chunk-DS1gnXQd.js';import'./chunk-DOeIIw1a.js';import'./chunk-CXqNbVXr.js';import'./chunk-CGjjc55P.js';import'./chunk-CZe6uHRZ.js';var Ce=(o,t)=>t.config.id,be=(o,t)=>t.type;function xe(o,t){if(o&1&&(ws(0,"a",5),GC(1,"View resolved definition \u2192"),pl()),o&2){let e=gC();bg("routerLink",e.inspectRoute());}}function he(o,t){o&1&&(ws(0,"span",6),GC(1,"Platform level"),pl());}function ve(o,t){o&1&&(ws(0,"p",7),GC(1,"Loading\u2026"),pl());}function ye(o,t){if(o&1&&(ws(0,"span",49),GC(1),pl()),o&2){let e=gC().$implicit;XE(),Yg(e.config.integrationType);}}function we(o,t){if(o&1&&(Sg(0,"input",50),VI()),o&2){let e=gC().$implicit;bg("formControl",e.toolsControl),UI();}}function Se(o,t){if(o&1){let e=lC();ws(0,"div",45)(1,"label",46)(2,"input",47),Rg("change",function(){let c=If(e).$implicit,g=gC(3);return wf(g.toggleIntegration(c))}),pl(),ws(3,"span",48),GC(4),pl(),Jw(5,ye,2,1,"span",49),pl(),Jw(6,we,1,1,"input",50),pl();}if(o&2){let e=t.$implicit;XE(2),bg("checked",e.enabled()),XE(2),Yg(e.config.name),XE(),eC(e.config.integrationType?5:-1),XE(),eC(e.enabled()?6:-1);}}function Me(o,t){if(o&1&&(ws(0,"p",56),GC(1),pl()),o&2){let e=gC().$implicit;XE(),vl(" Restricted to: ",e.restrictedTools.join(", ")," (set outside this form, preserved on save) ");}}function Ee(o,t){if(o&1){let e=lC();ws(0,"div",45)(1,"label",46)(2,"span",48),GC(3),pl(),ws(4,"span",49),GC(5,"built-in"),pl()(),ws(6,"select",52),Rg("change",function(c){let g=If(e).$implicit,C=gC(4);return wf(C.setBuiltInState(g,c.target.value))}),ws(7,"option",53),GC(8),pl(),ws(9,"option",54),GC(10,"Enabled"),pl(),ws(11,"option",55),GC(12,"Disabled"),pl()(),Jw(13,Me,2,1,"p",56),ws(14,"p",57),GC(15),pl()();}if(o&2){let e=t.$implicit,a=gC(4);XE(),Tg("for","built-in-"+e.type),XE(2),Yg(e.displayName),XE(3),bg("id","built-in-"+e.type)("value",e.state()),XE(2),Yg(a.builtInDefaultLabel(e)),XE(5),eC(e.state()==="on"&&e.restrictedTools?13:-1),XE(2),Yg(e.description);}}function Ae(o,t){if(o&1&&(ws(0,"p",51),GC(1,"Built-in integrations"),pl(),rC(2,Ee,16,7,"div",45,be)),o&2){let e=gC(3);XE(2),oC(e.builtInRows());}}function Ie(o,t){if(o&1&&(ws(0,"fieldset",20)(1,"legend",29),GC(2,"Integrations"),pl(),ws(3,"p",44),GC(4," Select which integrations this agent can use. Leave tool names empty to allow all tools from an integration. "),pl(),rC(5,Se,7,4,"div",45,Ce),Jw(7,Ae,4,0),pl()),o&2){let e=gC(2);XE(5),oC(e.integrationRows()),XE(2),eC(e.builtInRows().length>0?7:-1);}}function Oe(o,t){o&1&&(ws(0,"p",60),GC(1,"Invalid JSON \u2014 please fix the syntax."),pl());}function Pe(o,t){if(o&1&&(ws(0,"div",10)(1,"label",58),GC(2,"Loop configuration (JSON)"),pl(),Sg(3,"textarea",59),VI(),Jw(4,Oe,2,0,"p",60),ws(5,"p",24),GC(6," Default payload for this loop agent. Overridden at launch time if the first message contains a valid "),ws(7,"code",30),GC(8,"AgentLoopPayload"),pl(),GC(9,". Leave empty if you always provide the payload at launch. "),pl()()),o&2){let e=gC(2);XE(3),bg("placeholder",e.loopConfigPlaceholder)("formControl",e.loopConfigControl),UI(),XE(),eC(e.loopConfigControl.invalid&&e.loopConfigControl.touched?4:-1);}}function ke(o,t){if(o&1){let e=lC();ws(0,"li",61),Sg(1,"input",62),VI(),ws(2,"button",63),Rg("click",function(){let c=If(e).$implicit,g=gC(3);return wf(g.removeSubAgent(c))}),GC(3," \u{1F5D1} "),pl()();}if(o&2){let e=t.$implicit;XE(),bg("formControl",e.control),UI();}}function Te(o,t){if(o&1&&(ws(0,"ul",31),rC(1,ke,4,1,"li",61,tC),pl()),o&2){let e=gC(2);XE(),oC(e.subAgentRows());}}function Re(o,t){if(o&1&&GC(0),o&2){let e=gC(2);Qg(" : ",e.defaultDelegationTimeoutSeconds()," s (",e.defaultDelegationTimeoutSeconds()/60," min) ");}}function De(o,t){o&1&&(ws(0,"p",38),GC(1," Enter a valid positive whole number of seconds, or leave empty to inherit the server default. "),pl());}function Ve(o,t){if(o&1){let e=lC();ws(0,"button",64),Rg("click",function(){If(e);let c=gC(2);return wf(c.useDefaultDelegationTimeout())}),GC(1," Use server default "),pl();}}function Ne(o,t){if(o&1){let e=lC();ws(0,"button",65),Rg("click",function(){If(e);let c=gC(2);return wf(c.exportYaml())}),GC(1),pl();}if(o&2){let e=gC(2);bg("disabled",e.isExporting()),XE(),vl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Fe(o,t){if(o&1){let e=lC();ws(0,"form",9),Rg("ngSubmit",function(){If(e);let c=gC();return wf(c.submit())}),ws(1,"div",10)(2,"label",11),GC(3,"Name "),ws(4,"span",12),GC(5,"*"),pl()(),Sg(6,"input",13),VI(),pl(),ws(7,"div",10)(8,"label",14),GC(9,"Description"),pl(),Sg(10,"input",15),VI(),pl(),ws(11,"div",10)(12,"label",16),GC(13,"Model name"),pl(),Sg(14,"input",17),VI(),pl(),ws(15,"div",10)(16,"label",18),GC(17,"Instructions"),pl(),Sg(18,"textarea",19),VI(),pl(),Jw(19,Ie,8,1,"fieldset",20),ws(20,"div",10)(21,"label",21),GC(22,"Execution mode"),pl(),ws(23,"select",22)(24,"option",23),GC(25,"SIMPLE \u2014 Standard agent (single LLM call)"),pl(),ws(26,"option",23),GC(27,"ADVANCED \u2014 Multi-step reasoning loop"),pl(),ws(28,"option",23),GC(29,"LOOP \u2014 Bulk loop agent (no LLM, experimental)"),pl()(),VI(),ws(30,"p",24),GC(31,' SIMPLE runs a single LLM pass. ADVANCED uses an intention loop for complex tasks. LOOP (experimental) starts one case per result of a tool, without an LLM \u2014 run it with "Launch loop" in the agent list menu. '),pl()(),Jw(32,Pe,10,3,"div",10),ws(33,"div",10)(34,"label",25),Sg(35,"input",26),VI(),ws(36,"span",27),GC(37,"Enabled"),pl()(),ws(38,"p",28),GC(39,"Disabled agents are excluded from namespace resolution."),pl()(),ws(40,"div",10)(41,"span",29),GC(42,"Sub-agents"),pl(),ws(43,"p",24),GC(44," Glob patterns for agents this agent may delegate to. "),ws(45,"code",30),GC(46,"*"),pl(),GC(47," matches any sequence of characters (e.g. "),ws(48,"code",30),GC(49,"*Fixer"),pl(),GC(50,", "),ws(51,"code",30),GC(52,"*"),pl(),GC(53," for all). Leave empty to disable delegation. "),pl(),Jw(54,Te,3,0,"ul",31),ws(55,"div",32)(56,"input",33),Rg("keydown.enter",function(){If(e);let c=gC();return wf(c.addSubAgent())}),pl(),VI(),ws(57,"button",34),Rg("click",function(){If(e);let c=gC();return wf(c.addSubAgent())}),GC(58," + "),pl()()(),ws(59,"div",10)(60,"label",35),GC(61,"Delegation timeout (seconds)"),pl(),ws(62,"p",36),GC(63," Maximum time for each delegation launched by this agent, including nested delegations. On timeout, the sub-agent and its active descendants are stopped. Leave empty to use the server default "),Jw(64,Re,1,2),GC(65," . "),pl(),Sg(66,"input",37),VI(),Jw(67,De,2,0,"p",38),Jw(68,Ve,2,0,"button",39),pl(),ws(69,"div",40)(70,"button",41),GC(71),pl(),Jw(72,Ne,2,2,"button",42),ws(73,"button",43),Rg("click",function(){If(e);let c=gC();return wf(c.cancel())}),GC(74,"Cancel"),pl()()();}if(o&2){let e=gC();bg("formGroup",e.form),XE(6),bg("formControl",e.nameControl),UI(),XE(4),bg("formControl",e.descriptionControl),UI(),XE(4),bg("formControl",e.modelNameControl),UI(),XE(4),bg("formControl",e.instructionsControl),UI(),XE(),eC(e.integrationRows().length>0||e.builtInRows().length>0?19:-1),XE(4),bg("formControl",e.executionModeControl),UI(),XE(),bg("value",e.ExecutionMode.SIMPLE),XE(2),bg("value",e.ExecutionMode.ADVANCED),XE(2),bg("value",e.ExecutionMode.LOOP),XE(4),eC(e.isLoopMode()?32:-1),XE(3),bg("formControl",e.enabledControl),UI(),XE(19),eC(e.subAgentRows().length>0?54:-1),XE(2),bg("formControl",e.newSubAgentControl),UI(),XE(),bg("disabled",!e.newSubAgentControl.value.trim()),XE(7),eC(e.defaultDelegationTimeoutSeconds()!==null?64:-1),XE(2),bg("formControl",e.delegationTimeoutControl),Tg("aria-invalid",e.delegationTimeoutControl.invalid),UI(),XE(),eC(e.delegationTimeoutControl.invalid?67:-1),XE(),eC(e.delegationTimeoutControl.value!==null?68:-1),XE(2),bg("disabled",e.form.invalid||e.isSubmitting()),XE(),vl(" ",e.isEditMode()?"Save changes":"Create"," "),XE(),eC(e.isEditMode()?72:-1);}}var pe=class o{route=g(V);router=g(G);destroyRef=g(Ce$1);agentConfigController=g(M);defaultsController=g(B);defaultDelegationTimeoutSeconds=Gi(null);exportService=g(J);integrationConfigState=g(N);integrationTypeController=g(F);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new z({name:new _t("",{nonNullable:true,validators:[_e.required,_e.minLength(1)]}),description:new _t(null),modelName:new _t(null),instructions:new _t(null),executionMode:new _t("SIMPLE",{nonNullable:true}),delegationTimeoutSeconds:new _t(null,{validators:[_e.min(1),_e.max(2147483647),_e.pattern(/^\d+$/)]}),enabled:new _t(false,{nonNullable:true}),loopConfig:new _t(null,{validators:[o.jsonValidator]})});static jsonValidator(t){let e=t.value?.trim();if(!e)return null;try{return JSON.parse(e),null}catch(a){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();}get enabledControl(){return this.form.controls.enabled}get loopConfigControl(){return this.form.controls.loopConfig}executionModeValue=F$1(this.form.controls.executionMode.valueChanges,{initialValue:this.form.controls.executionMode.value});isLoopMode=mT(()=>this.executionModeValue()==="LOOP");subAgentRows=Gi([]);newSubAgentControl=new _t("",{nonNullable:true});isEditMode=Gi(false);isSubmitting=Gi(false);isLoading=Gi(false);isExporting=Gi(false);ExecutionMode=ve$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=Gi([]);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"]}integrationRows=Gi([]);existingConfig=null;ngOnInit(){this.defaultsController.getAgentConfigDefaults().pipe(U(this.destroyRef),ya(()=>br(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),By({config:this.agentConfigController.getByIdAgentConfig(t),namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):br([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes()}).pipe(U(this.destroyRef)).subscribe({next:({config:e,namespaceIntegrations:a,platformIntegrations:c,builtInTypes:g})=>{this.existingConfig=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.modelNameControl.setValue(e.modelName??null),this.instructionsControl.setValue(e.instructions??null);let C=e.executionMode??(e.advancedExecution?"ADVANCED":"SIMPLE");this.executionModeControl.setValue(C),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 T=[...c,...a];this.integrationRows.set(this.buildIntegrationRows(T,e.integrations??void 0)),this.builtInRows.set(this.buildBuiltInRows(g,e.integrations??void 0)),this.subAgentRows.set((e.subAgents??[]).map(_e=>({control:new _t(_e,{nonNullable:true})}))),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadIntegrations(t){By({namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):br([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes()}).pipe(U(this.destroyRef)).subscribe({next:({namespaceIntegrations:e,platformIntegrations:a,builtInTypes:c})=>{let g=[...a,...e];this.integrationRows.set(this.buildIntegrationRows(g,t??void 0)),this.builtInRows.set(this.buildBuiltInRows(c,t??void 0));}});}loadBuiltInTypes(){return this.integrationTypeController.listTypesIntegrationType().pipe(re(t=>t.filter(e=>!e.configSchema)),ya(t=>(console.error("[agent-config-form] failed to load integration types",t),br([]))))}buildIntegrationRows(t,e){return t.map(a=>{let c=a.name??"",g=e?.[c],C=e!=null&&c in e,T=Array.isArray(g)?g.join(", "):"";return {config:a,enabled:Gi(C),toolsControl:new _t(T,{nonNullable:true})}})}buildBuiltInRows(t,e){return t.map(a=>{let c=e!=null&&a.type in e,g=e?.[a.type],C=c?Array.isArray(g)&&g.length===0?"off":"on":"default";return {type:a.type,displayName:a.displayName,description:a.description,enabledByDefault:a.enabledByDefault===true,state:Gi(C),restrictedTools:Array.isArray(g)&&g.length>0?g: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();t&&(this.subAgentRows.update(e=>[...e,{control:new _t(t,{nonNullable:true})}]),this.newSubAgentControl.reset(""));}removeSubAgent(t){this.subAgentRows.update(e=>e.filter(a=>a!==t));}buildSubAgentsPayload(){let t=this.subAgentRows().map(e=>e.control.value.trim()).filter(e=>e.length>0);return t.length>0?t:void 0}buildIntegrationsPayload(){let t={};for(let a of this.integrationRows().filter(c=>c.enabled())){let c=a.config.name??"",g=a.toolsControl.value.trim();t[c]=g===""?null:g.split(",").map(C=>C.trim()).filter(C=>C.length>0);}for(let a of this.builtInRows()){let c=a.state();c==="on"?t[a.type]=a.restrictedTools??null:c==="off"&&(t[a.type]=[]);}let e=new Set([...this.integrationRows().map(a=>a.config.name??""),...this.builtInRows().map(a=>a.type)]);for(let[a,c]of Object.entries(this.existingConfig?.integrations??{}))e.has(a)||(t[a]=c);return Object.keys(t).length>0?t:void 0}submit(){if(this.form.invalid||this.isSubmitting())return;this.addSubAgent(),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(),delegationTimeoutSeconds:this.delegationTimeoutControl.value,loopConfig:this.buildLoopConfigPayload()});(this.isEditMode()?this.agentConfigController.updateAgentConfig(this.existingConfig.id??"",t):this.agentConfigController.createAgentConfig(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let t=this.existingConfig?.id;!t||this.isExporting()||(this.isExporting.set(true),this.exportService.exportAsYaml(t).pipe(U(this.destroyRef)).subscribe({next:e=>{let a=new Blob([e],{type:"application/yaml"}),c=URL.createObjectURL(a),g=document.createElement("a");g.href=c,g.download=`${this.existingConfig?.name??"agent"}.yaml`,g.click(),URL.revokeObjectURL(c),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||o)};static \u0275cmp=xw({type:o,selectors:[["agentos-agent-config-form"]],decls:12,vars:4,consts:[[1,"agent-config-form"],[1,"agent-config-form__header"],["type","button","title","Back to agent configs",1,"agent-config-form__back",3,"click"],[1,"agent-config-form__back-icon"],[1,"agent-config-form__title"],[1,"agent-config-form__sibling-link",3,"routerLink"],[1,"agent-config-form__platform-badge"],[1,"agent-config-form__loading"],[1,"agent-config-form__form",3,"formGroup"],[1,"agent-config-form__form",3,"ngSubmit","formGroup"],[1,"agent-config-form__field"],["for","agent-config-name",1,"agent-config-form__label"],["aria-hidden","true"],["id","agent-config-name","type","text","placeholder","e.g. Support agent","autocomplete","off",1,"agent-config-form__input",3,"formControl"],["for","agent-config-description",1,"agent-config-form__label"],["id","agent-config-description","type","text","placeholder","Optional \u2014 short description of this agent","autocomplete","off",1,"agent-config-form__input",3,"formControl"],["for","agent-config-model-name",1,"agent-config-form__label"],["id","agent-config-model-name","type","text","placeholder","Optional \u2014 model alias or name to use","autocomplete","off",1,"agent-config-form__input",3,"formControl"],["for","agent-config-instructions",1,"agent-config-form__label"],["id","agent-config-instructions","rows","6","placeholder","Optional \u2014 system instructions for this agent",1,"agent-config-form__textarea",3,"formControl"],[1,"agent-config-form__integrations"],["for","agent-config-execution-mode",1,"agent-config-form__label"],["id","agent-config-execution-mode",1,"agent-config-form__select",3,"formControl"],[3,"value"],[1,"agent-config-form__field-hint"],[1,"agent-config-form__toggle-label"],["type","checkbox",1,"agent-config-form__toggle-checkbox",3,"formControl"],[1,"agent-config-form__toggle-text"],[1,"agent-config-form__toggle-hint"],[1,"agent-config-form__label"],[1,"agent-config-form__code"],[1,"agent-config-form__sub-agent-list"],[1,"agent-config-form__sub-agent-add"],["type","text","placeholder","e.g. *Fixer or *","autocomplete","off",1,"agent-config-form__input","agent-config-form__sub-agent-input",3,"keydown.enter","formControl"],["type","button","title","Add pattern",1,"agent-config-form__sub-agent-btn","agent-config-form__sub-agent-btn--add",3,"click","disabled"],["for","delegation-timeout",1,"agent-config-form__label"],["id","delegation-timeout-hint",1,"agent-config-form__field-hint"],["id","delegation-timeout","type","number","min","1","max","2147483647","step","1","placeholder","Server default","aria-describedby","delegation-timeout-hint delegation-timeout-error",1,"agent-config-form__input",3,"formControl"],["id","delegation-timeout-error","role","alert",1,"agent-config-form__field-hint"],["type","button",1,"agent-config-form__sub-agent-btn"],[1,"agent-config-form__actions"],["type","submit",1,"agent-config-form__btn","agent-config-form__btn--primary",3,"disabled"],["type","button",1,"agent-config-form__btn","agent-config-form__btn--export",3,"disabled"],["type","button",1,"agent-config-form__btn",3,"click"],[1,"agent-config-form__integrations-hint"],[1,"agent-config-form__integration-row"],[1,"agent-config-form__integration-toggle"],["type","checkbox",1,"agent-config-form__integration-checkbox",3,"change","checked"],[1,"agent-config-form__integration-name"],[1,"agent-config-form__integration-type"],["type","text","placeholder","Tool names, comma-separated (empty = all tools)","autocomplete","off",1,"agent-config-form__input","agent-config-form__integration-tools",3,"formControl"],[1,"agent-config-form__integrations-separator"],[1,"agent-config-form__integration-state",3,"change","id","value"],["value","default"],["value","on"],["value","off"],[1,"agent-config-form__integration-restriction"],[1,"agent-config-form__integration-builtin-desc"],["for","agent-config-loop-config",1,"agent-config-form__label"],["id","agent-config-loop-config","rows","10","spellcheck","false","autocomplete","off",1,"agent-config-form__textarea","agent-config-form__textarea--mono",3,"placeholder","formControl"],["role","alert",1,"agent-config-form__field-error"],[1,"agent-config-form__sub-agent-row"],["type","text","autocomplete","off",1,"agent-config-form__input","agent-config-form__sub-agent-input",3,"formControl"],["type","button","title","Remove",1,"agent-config-form__sub-agent-btn","agent-config-form__sub-agent-btn--danger",3,"click"],["type","button",1,"agent-config-form__sub-agent-btn",3,"click"],["type","button",1,"agent-config-form__btn","agent-config-form__btn--export",3,"click","disabled"]],template:function(e,a){e&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return a.cancel()}),ws(3,"span",3),GC(4,"\u2190"),pl(),GC(5," Agent Configs "),pl(),ws(6,"h1",4),GC(7),pl(),Jw(8,xe,2,1,"a",5),Jw(9,he,2,0,"span",6),pl(),Jw(10,ve,2,0,"p",7)(11,Fe,75,23,"form",8),pl()),e&2&&(XE(7),Yg(a.isEditMode()?"Edit agent config":"New agent config"),XE(),eC(a.isEditMode()?8:-1),XE(),eC(a.isPlatformMode?9:-1),XE(),eC(a.isLoading()?10:11));},dependencies:[ni,Jn,Qn,ei,Ye,fn,wt,At,Zn,Xn,$t,Wt,Cn,En,si],styles:[".agent-config-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.agent-config-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.agent-config-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.agent-config-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.agent-config-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.agent-config-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.agent-config-form__sibling-link[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-accent);text-decoration:none}.agent-config-form__sibling-link[_ngcontent-%COMP%]:hover{text-decoration:underline}.agent-config-form__platform-badge[_ngcontent-%COMP%]{display:inline-block;font-size:.75rem;font-weight:500;color:var(--color-text-secondary);background:var(--color-surface);border:1px solid var(--color-divider);border-radius:0;padding:.125rem .5rem;letter-spacing:.02em;align-self:flex-start}.agent-config-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.agent-config-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.agent-config-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.agent-config-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.agent-config-form__input[_ngcontent-%COMP%], .agent-config-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.agent-config-form__input[_ngcontent-%COMP%]:focus, .agent-config-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.agent-config-form__input[_ngcontent-%COMP%]::placeholder, .agent-config-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.agent-config-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:120px;line-height:1.5}.agent-config-form__textarea--mono[_ngcontent-%COMP%]{font-family:monospace;font-size:.8125rem}.agent-config-form__field-error[_ngcontent-%COMP%]{margin:.25rem 0 0;font-size:.8rem;color:var(--color-error, var(--red, #dc2626));line-height:1.4}.agent-config-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;cursor:pointer;transition:border-color .15s ease;appearance:auto}.agent-config-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.agent-config-form__integrations[_ngcontent-%COMP%]{border:1px solid var(--color-divider);border-radius:0;padding:1rem;margin:0;display:flex;flex-direction:column;gap:.75rem}.agent-config-form__integrations-hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__integration-row[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.agent-config-form__integration-toggle[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.agent-config-form__integration-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-accent);cursor:pointer}.agent-config-form__integration-name[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text)}.agent-config-form__integration-type[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);font-family:monospace}.agent-config-form__integration-tools[_ngcontent-%COMP%]{margin-left:1.5rem;font-size:.875rem}.agent-config-form__integrations-separator[_ngcontent-%COMP%]{margin:.25rem 0 0;padding-top:.5rem;border-top:1px solid var(--color-divider);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);font-family:var(--font-heading)}.agent-config-form__integration-state[_ngcontent-%COMP%]{margin-left:1.5rem;padding:.375rem .625rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.875rem;font-family:inherit;outline:none;transition:border-color .15s ease}.agent-config-form__integration-state[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.agent-config-form__integration-restriction[_ngcontent-%COMP%]{margin:0 0 0 1.5rem;font-size:.8rem;font-style:italic;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.agent-config-form__integration-builtin-desc[_ngcontent-%COMP%]{margin:0 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__field-hint[_ngcontent-%COMP%]{margin:.25rem 0 0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__code[_ngcontent-%COMP%]{font-family:monospace;font-size:.85em;background:var(--color-surface-muted, rgba(0, 0, 0, .06));padding:.1em .3em;border-radius:0}.agent-config-form__sub-agent-list[_ngcontent-%COMP%]{list-style:none;margin:.5rem 0 0;padding:0;display:flex;flex-direction:column;gap:.375rem}.agent-config-form__sub-agent-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem}.agent-config-form__sub-agent-input[_ngcontent-%COMP%]{flex:1;min-width:0}.agent-config-form__sub-agent-add[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;margin-top:.5rem}.agent-config-form__sub-agent-btn[_ngcontent-%COMP%]{flex-shrink:0;width:2rem;height:2rem;padding:0;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text-secondary);font-size:.9rem;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .15s ease,border-color .15s ease,color .15s ease}.agent-config-form__sub-agent-btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500);color:var(--color-text)}.agent-config-form__sub-agent-btn[_ngcontent-%COMP%]:disabled{opacity:.35;cursor:not-allowed}.agent-config-form__sub-agent-btn--add[_ngcontent-%COMP%]{width:2rem;height:2rem;font-size:1.25rem;font-weight:300;border-color:var(--color-accent);color:var(--color-accent)}.agent-config-form__sub-agent-btn--add[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent);color:#fff}.agent-config-form__sub-agent-btn--danger[_ngcontent-%COMP%]{border:1px solid transparent;color:var(--color-neutral-500)}.agent-config-form__sub-agent-btn--danger[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--red);color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent)}.agent-config-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.agent-config-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-accent);cursor:pointer}.agent-config-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text)}.agent-config-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.agent-config-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.agent-config-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.agent-config-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.agent-config-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.agent-config-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"]})};export{pe as AgentConfigFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,G,cb as ZB,cc as qB,a as Gi,m as mT,e as xw,k as ws,n as GC,o as pl,J as Jw,X as XE,a8 as Yg,y as eC,A as Ug,ac as gC,a9 as lC,q as Rg,v as bg,aa as If,ab as wf}from'./main-
|
|
1
|
+
import {g,G,cb as ZB,cc as qB,a as Gi,m as mT,e as xw,k as ws,n as GC,o as pl,J as Jw,X as XE,a8 as Yg,y as eC,A as Ug,ac as gC,a9 as lC,q as Rg,v as bg,aa as If,ab as wf}from'./main-GYSPY3UE.js';import {K as Kn,Z as Zn,S as Se}from'./chunk-CGjjc55P.js';function k(n,t){if(n&1&&(ws(0,"span",9),GC(1),pl()),n&2){let e=t;Ug("agent-config-item__mode-badge--advanced",e.mode==="ADVANCED")("agent-config-item__mode-badge--loop",e.mode==="LOOP"),XE(),Yg(e.label);}}function N(n,t){if(n&1&&(ws(0,"span",5),GC(1),pl()),n&2){let e=gC();XE(),Yg(e.config().modelName);}}function S(n,t){if(n&1&&(ws(0,"span",6),GC(1),pl()),n&2){let e=gC();XE(),Yg(e.config().description);}}function V(n,t){if(n&1){let e=lC();ws(0,"span",10),GC(1,"Delete?"),pl(),ws(2,"ds-icon-button",11),Rg("action",function(){If(e);let r=gC();return wf(r.onDeleteConfirmed())}),pl(),ws(3,"ds-icon-button",12),Rg("action",function(){If(e);let r=gC();return wf(r.onDeleteCancelled())}),pl();}}function L(n,t){if(n&1){let e=lC();ws(0,"ds-kebab-menu",13),Rg("itemSelected",function(r){If(e);let E=gC();return wf(E.onMenuAction(r))}),pl();}if(n&2){let e=gC();bg("items",e.readOnly()?e.readOnlyMenuItems:e.menuItems);}}var P=class n{router=g(G);config=ZB.required();namespaceId=ZB(void 0);platformMode=ZB(false);readOnly=ZB(false);deleteRequested=qB();pendingDelete=Gi(false);executionModeBadge=mT(()=>{let t=this.config(),e=t.executionMode??(t.advancedExecution?"ADVANCED":"SIMPLE");return e==="ADVANCED"?{mode:e,label:"ADVANCED"}:e==="LOOP"?{mode:e,label:"LOOP"}:null});canLaunch=mT(()=>!this.platformMode()&&this.config().executionMode==="LOOP");get menuItems(){let t=[{key:"edit",label:"Edit agent config",icon:"edit"},{key:"inspect",label:"Inspect definition",icon:"search"}];return this.canLaunch()&&t.push({key:"launch",label:"Launch loop",icon:"play_arrow"}),t.push({key:"delete",label:"Delete agent config",icon:"delete",variant:"danger"}),t}readOnlyMenuItems=[{key:"inspect",label:"Inspect definition",icon:"search"}];onMenuAction(t){switch(t){case "edit":this.platformMode()?this.router.navigate(["/agentos","admin","agent-configs",this.config().id,"edit"]):this.router.navigate(["/agentos",this.namespaceId(),"agent-configs",this.config().id,"edit"]);break;case "inspect":this.platformMode()?this.router.navigate(["/agentos","admin","agent-configs",this.config().id,"inspect"]):this.router.navigate(["/agentos",this.namespaceId(),"agent-configs",this.config().id,"inspect"]);break;case "launch":this.router.navigate(["/agentos",this.namespaceId(),"agent-configs",this.config().id,"launch"]);break;case "delete":this.pendingDelete.set(true);break}}onDeleteConfirmed(){this.pendingDelete.set(false),this.deleteRequested.emit(this.config());}onDeleteCancelled(){this.pendingDelete.set(false);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=xw({type:n,selectors:[["agentos-agent-config-item"]],inputs:{config:[1,"config"],namespaceId:[1,"namespaceId"],platformMode:[1,"platformMode"],readOnly:[1,"readOnly"]},outputs:{deleteRequested:"deleteRequested"},decls:11,vars:5,consts:[["role","listitem","dsBlueprint","",1,"agent-config-item"],[1,"agent-config-item__body"],[1,"agent-config-item__name-row"],[1,"agent-config-item__name"],[1,"agent-config-item__mode-badge",3,"agent-config-item__mode-badge--advanced","agent-config-item__mode-badge--loop"],[1,"agent-config-item__model"],[1,"agent-config-item__description"],[1,"agent-config-item__actions"],[3,"items"],[1,"agent-config-item__mode-badge"],[1,"agent-config-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],[3,"itemSelected","items"]],template:function(e,c){if(e&1&&(ws(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),GC(4),pl(),Jw(5,k,2,5,"span",4),pl(),Jw(6,N,2,1,"span",5),Jw(7,S,2,1,"span",6),pl(),ws(8,"div",7),Jw(9,V,4,0)(10,L,1,1,"ds-kebab-menu",8),pl()()),e&2){let r;XE(4),Yg(c.config().name),XE(),eC((r=c.executionModeBadge())?5:-1,r),XE(),eC(c.config().modelName?6:-1),XE(),eC(c.config().description?7:-1),XE(2),eC(c.pendingDelete()?9:10);}},dependencies:[Kn,Zn,Se],styles:[".agent-config-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:14px 16px;position:relative;border-radius:0;border:1px solid var(--color-divider);background:var(--color-bg);box-shadow:var(--shadow-sm);overflow:visible;transition:border-color .15s ease}.agent-config-item[_ngcontent-%COMP%]:hover{border-color:var(--color-accent)}.agent-config-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.agent-config-item__name-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;min-width:0}.agent-config-item__name[_ngcontent-%COMP%]{font-size:15px;font-weight:600;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.agent-config-item__mode-badge[_ngcontent-%COMP%]{flex-shrink:0;display:inline-block;font-family:var(--font-heading);font-size:9px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;padding:.15em .5em;border-radius:0;line-height:1.6;border:1px solid currentColor}.agent-config-item__mode-badge--advanced[_ngcontent-%COMP%]{color:var(--color-accent, #2563eb);background:var(--color-accent-100, rgba(37, 99, 235, .08));border-color:var(--color-accent-300, rgba(37, 99, 235, .3))}.agent-config-item__mode-badge--loop[_ngcontent-%COMP%]{color:var(--color-warning, #f59e0b);background:color-mix(in srgb,var(--color-warning, #f59e0b) 10%,transparent);border-color:color-mix(in srgb,var(--color-warning, #f59e0b) 35%,transparent)}.agent-config-item__model[_ngcontent-%COMP%], .agent-config-item__description[_ngcontent-%COMP%]{font-size:13px;color:var(--color-text-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.agent-config-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.agent-config-item[_ngcontent-%COMP%]:hover .agent-config-item__actions[_ngcontent-%COMP%], .agent-config-item[_ngcontent-%COMP%]:focus-within .agent-config-item__actions[_ngcontent-%COMP%]{opacity:1}.agent-config-item[_ngcontent-%COMP%]:has(.agent-config-item__confirm-label) .agent-config-item__actions[_ngcontent-%COMP%]{opacity:1}.agent-config-item__confirm-label[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--red-deep);margin-right:.25rem;white-space:nowrap}"]})};export{P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {I}from'./chunk-
|
|
1
|
+
import {I}from'./chunk-Ceb8iCgi.js';import {g,G,C as Ce,dm as $,df as U,aJ as Tr,a as Gi,bS as va,aD as Ly,r as re,b as U$1,e as xw,aK as xb,k as ws,bf as aT,q as Rg,o as pl,af as Eg,u as CC,v as bg,bg as uT,ah as rT,J as Jw,ac as gC,y as eC,a9 as lC,aa as If,ab as wf,ag as fT}from'./main-GYSPY3UE.js';import {$ as $n,S as Se}from'./chunk-CGjjc55P.js';import'./chunk-CZe6uHRZ.js';import'./chunk-DS1gnXQd.js';var V=()=>[];function F(n,t){if(n&1){let o=lC();ws(0,"agentos-ai-model-item",4),Rg("editRequested",function(e){If(o);let s=gC(2);return wf(s.onEdit(e))})("deleteRequested",function(e){If(o);let s=gC(2);return wf(s.deleteModel(e))}),pl();}n&2&&bg("model",t);}function O(n,t){if(n&1&&Jw(0,F,1,1,"agentos-ai-model-item",3),n&2){let o,i=t.$implicit,e=gC();eC((o=e.resolveModel(i.id))?0:-1,o);}}var S=class n{router=g(G);destroyRef=g(Ce);aiModelController=g($);aiProviderController=g(U);refresh$=new Tr(void 0);isLoading=Gi(true);data$=this.refresh$.pipe(va(()=>(this.isLoading.set(true),Ly([this.aiModelController.listPlatformLevelAiModel(),this.aiProviderController.listAiProvider("none")]))));modelItems$=this.data$.pipe(re(([t,o])=>{let i=new Map(o.map(e=>[e.id??"",e.name]));return t.map(e=>({id:e.id??"",name:e.alias??e.apiModelName,description:e.apiModelName,groupKey:e.aiProviderId,groupLabel:i.get(e.aiProviderId)??e.aiProviderId}))}));modelsById=new Map;constructor(){this.data$.pipe(U$1(this.destroyRef)).subscribe({next:([t])=>{this.modelsById=new Map(t.map(o=>[o.id??"",o])),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}goBack(){this.router.navigate(["/agentos","admin"]);}openCreateForm(){this.router.navigate(["/agentos","admin","ai-models","new"]);}deleteModel(t){this.aiModelController.deleteAiModel(t.id??"").pipe(U$1(this.destroyRef)).subscribe(()=>this.refresh$.next());}onEdit(t){t.id&&this.router.navigate(["/agentos","admin","ai-models",t.id,"edit"]);}resolveModel(t){return this.modelsById.get(t)??null}static \u0275fac=function(o){return new(o||n)};static \u0275cmp=xw({type:n,selectors:[["agentos-platform-ai-models"]],decls:5,vars:7,consts:[["aiModelItemTpl",""],["title","Platform AI Models","emptyMessage","No platform AI models defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[3,"model"],[3,"editRequested","deleteRequested","model"]],template:function(o,i){if(o&1&&(ws(0,"ds-entity-list",1),aT(1,"async"),Rg("createRequested",function(){return i.openCreateForm()}),ws(2,"ds-icon-button",2),Rg("action",function(){return i.goBack()}),pl()(),Eg(3,O,1,1,"ng-template",null,0,fT)),o&2){let e=CC(4);bg("items",uT(1,4,i.modelItems$)??rT(6,V))("loading",i.isLoading())("showCreate",true)("itemTemplate",e);}},dependencies:[$n,I,Se,xb],styles:[".platform-ai-models__back[_ngcontent-%COMP%]{background:none;border:none;cursor:pointer;font-family:inherit;font-size:.875rem;color:var(--color-text-secondary, #6e6e73);padding:.25rem .5rem;border-radius:4px;transition:color .15s ease}.platform-ai-models__back[_ngcontent-%COMP%]:hover{color:var(--color-primary, #007aff)}"]})};export{S as PlatformAiModelsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,G,cb as ZB,cc as qB,a as Gi,e as xw,k as ws,n as GC,o as pl,J as Jw,A as Ug,X as XE,a8 as Yg,y as eC,ac as gC,a9 as lC,q as Rg,v as bg,aa as If,ab as wf}from'./main-
|
|
1
|
+
import {g,G,cb as ZB,cc as qB,a as Gi,e as xw,k as ws,n as GC,o as pl,J as Jw,A as Ug,X as XE,a8 as Yg,y as eC,ac as gC,a9 as lC,q as Rg,v as bg,aa as If,ab as wf}from'./main-GYSPY3UE.js';import {Z as Zn,S as Se}from'./chunk-CGjjc55P.js';function k(t,r){if(t&1&&(ws(0,"span",3),GC(1),pl()),t&2){let e=gC();XE(),Yg(e.prompt().description);}}function S(t,r){if(t&1){let e=lC();ws(0,"span",6),GC(1,"Delete?"),pl(),ws(2,"ds-icon-button",7),Rg("action",function(){If(e);let m=gC();return wf(m.onDeleteConfirmed())}),pl(),ws(3,"ds-icon-button",8),Rg("action",function(){If(e);let m=gC();return wf(m.onDeleteCancelled())}),pl();}}function E(t,r){if(t&1){let e=lC();ws(0,"ds-kebab-menu",9),Rg("itemSelected",function(m){If(e);let O=gC();return wf(O.onMenuAction(m))}),pl();}if(t&2){let e=gC();bg("items",e.menuItems);}}var I=class t{router=g(G);prompt=ZB.required();namespaceId=ZB(void 0);platformMode=ZB(false);readOnly=ZB(false);deleteRequested=qB();pendingDelete=Gi(false);menuItems=[{key:"edit",label:"Edit prompt",icon:"edit"},{key:"delete",label:"Delete prompt",icon:"delete",variant:"danger"}];onMenuAction(r){switch(r){case "edit":this.platformMode()?this.router.navigate(["/agentos","admin","prompts",this.prompt().id,"edit"]):this.router.navigate(["/agentos",this.namespaceId(),"prompts",this.prompt().id,"edit"]);break;case "delete":this.pendingDelete.set(true);break}}onDeleteConfirmed(){this.pendingDelete.set(false),this.deleteRequested.emit(this.prompt());}onDeleteCancelled(){this.pendingDelete.set(false);}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=xw({type:t,selectors:[["agentos-prompt-item"]],inputs:{prompt:[1,"prompt"],namespaceId:[1,"namespaceId"],platformMode:[1,"platformMode"],readOnly:[1,"readOnly"]},outputs:{deleteRequested:"deleteRequested"},decls:8,vars:5,consts:[["role","listitem",1,"prompt-item"],[1,"prompt-item__body"],[1,"prompt-item__name"],[1,"prompt-item__description"],[1,"prompt-item__actions"],[3,"items"],[1,"prompt-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],[3,"itemSelected","items"]],template:function(e,o){e&1&&(ws(0,"div",0)(1,"div",1)(2,"span",2),GC(3),pl(),Jw(4,k,2,1,"span",3),pl(),ws(5,"div",4),Jw(6,S,4,0)(7,E,1,1,"ds-kebab-menu",5),pl()()),e&2&&(Ug("prompt-item--pending-delete",o.pendingDelete()),XE(3),Yg(o.prompt().name),XE(),eC(o.prompt().description?4:-1),XE(2),eC(o.pendingDelete()?6:o.readOnly()?-1:7));},dependencies:[Zn,Se],styles:[".prompt-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem 1rem;border-radius:10px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--glass-bg, rgba(255, 255, 255, .72));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));backdrop-filter:var(--glass-backdrop-blur, blur(20px));transition:background .15s ease,border-color .15s ease}.prompt-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-color:var(--color-primary, #007aff)}.prompt-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.prompt-item__name[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text, #1d1d1f);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.prompt-item__description[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary, #6e6e73);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.prompt-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.prompt-item[_ngcontent-%COMP%]:hover .prompt-item__actions[_ngcontent-%COMP%], .prompt-item[_ngcontent-%COMP%]:focus-within .prompt-item__actions[_ngcontent-%COMP%], .prompt-item--pending-delete[_ngcontent-%COMP%] .prompt-item__actions[_ngcontent-%COMP%]{opacity:1}.prompt-item__confirm-label[_ngcontent-%COMP%]{font-size:.8rem;font-weight:500;color:var(--color-error, #ff3b30);margin-right:.25rem;white-space:nowrap}"]})};export{I};
|