@whoz-oss/coday-client 0.0.0-workstream-forge.100 → 0.0.0-workstream-forge.101
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-D8omHn7V.js → chunk--t7R2FQ4.js} +1 -1
- package/browser/{chunk-BMck3RrE.js → chunk-1I02Q6MC.js} +1 -1
- package/browser/{chunk-Cz3puK-P.js → chunk-8j0zbcE8.js} +1 -1
- package/browser/{chunk-C_5eQn8U.js → chunk-B0ec6QE2.js} +1 -1
- package/browser/{chunk-B5rnCx1b.js → chunk-B4NACXvL.js} +1 -1
- package/browser/{chunk-oODMxNh6.js → chunk-B6YuGUPU.js} +1 -1
- package/browser/{chunk-DLNa7187.js → chunk-BAJj5ySw.js} +1 -1
- package/browser/{chunk-DN2TqPUr.js → chunk-BCkdBoJT.js} +1 -1
- package/browser/{chunk-CBShRrKK.js → chunk-BD9QyJ_D.js} +1 -1
- package/browser/{chunk-C0ZbwTfx.js → chunk-BDClIjt_.js} +1 -1
- package/browser/{chunk-65tVAuhG.js → chunk-BLaIJYTj.js} +1 -1
- package/browser/{chunk-BtsE1R-P.js → chunk-BNS4nii-.js} +1 -1
- package/browser/{chunk-C0fiVu73.js → chunk-BNygw8cy.js} +1 -1
- package/browser/{chunk-CKI8BAs4.js → chunk-Bb97Kx1k.js} +1 -1
- package/browser/{chunk-DBuc5FLi.js → chunk-BhOBAGu0.js} +1 -1
- package/browser/{chunk-DfZZLMRA.js → chunk-Bk4wk-Q1.js} +1 -1
- package/browser/{chunk-x8X4JXC2.js → chunk-Bo7GcoVn.js} +1 -1
- package/browser/{chunk-DVHrTMkL.js → chunk-BuJ0a-jT.js} +1 -1
- package/browser/{chunk-BBUDU1bN.js → chunk-BvCaRkbC.js} +1 -1
- package/browser/{chunk-BHrmI0lw.js → chunk-BxKTxblc.js} +1 -1
- package/browser/{chunk-BrcfGPj_.js → chunk-BxlhPj4a.js} +1 -1
- package/browser/{chunk-J2uWrEAz.js → chunk-C-qaxhzV.js} +1 -1
- package/browser/{chunk-Jp1EkzoM.js → chunk-C2xbdglQ.js} +1 -1
- package/browser/{chunk-BFaLzff-.js → chunk-C6CIcqIe.js} +1 -1
- package/browser/{chunk-CXA9dtI0.js → chunk-CFyEUO4f.js} +1 -1
- package/browser/{chunk-DLde3g-3.js → chunk-CGFcBWlS.js} +1 -1
- package/browser/{chunk-BBgb869U.js → chunk-CIHz2nkf.js} +1 -1
- package/browser/{chunk-QpH9EEhD.js → chunk-CKhMv1Ug.js} +1 -1
- package/browser/{chunk-CDVwpBWc.js → chunk-CTEyKNKm.js} +1 -1
- package/browser/{chunk-DA_sbewE.js → chunk-CTRtr19h.js} +1 -1
- package/browser/chunk-CVM23KJ3.js +11 -0
- package/browser/{chunk-CdXOdNcd.js → chunk-CXyYyXX9.js} +1 -1
- package/browser/{chunk-C6aIC46X.js → chunk-C_etNNrs.js} +1 -1
- package/browser/{chunk-mQPGTeS6.js → chunk-CeL5OSae.js} +1 -1
- package/browser/{chunk-BKbzb9p8.js → chunk-ChNYRuIU.js} +1 -1
- package/browser/{chunk-BnAqiYqI.js → chunk-CkzIzWyC.js} +1 -1
- package/browser/{chunk-DoEwzfHE.js → chunk-ClEsObVj.js} +1 -1
- package/browser/{chunk-Bg9IOIBp.js → chunk-ClmFjies.js} +1 -1
- package/browser/{chunk-CjG8z5z5.js → chunk-CopZgdKm.js} +1 -1
- package/browser/{chunk-CgJRLZNp.js → chunk-Cpofe53u.js} +1 -1
- package/browser/{chunk-CvZWmgd7.js → chunk-CrU3BQQS.js} +1 -1
- package/browser/{chunk-DMAW_dUA.js → chunk-CvmyFGzy.js} +1 -1
- package/browser/{chunk-TPspvPcl.js → chunk-Cy8V5YYe.js} +1 -1
- package/browser/{chunk-C0L3lRLz.js → chunk-CyLUngtV.js} +1 -1
- package/browser/{chunk-bBy0vM9Y.js → chunk-D-FNlEoa.js} +1 -1
- package/browser/{chunk-DphUtWOw.js → chunk-D1duEHtM.js} +1 -1
- package/browser/{chunk-8li-9jxk.js → chunk-D8veTI-Z.js} +1 -1
- package/browser/{chunk-CSuL5t9_.js → chunk-DEcr5XTR.js} +1 -1
- package/browser/{chunk-2mrqEJI8.js → chunk-DI7OUCqm.js} +1 -1
- package/browser/{chunk-BHOfNKW0.js → chunk-DQuNupfJ.js} +1 -1
- package/browser/{chunk-6B3xFuOu.js → chunk-DUTgv2ie.js} +1 -1
- package/browser/{chunk-By9VfPER.js → chunk-DW5_PM92.js} +1 -1
- package/browser/{chunk-CxodB9Ss.js → chunk-DjIEzaIJ.js} +1 -1
- package/browser/{chunk-CccoF4zk.js → chunk-Dp3xB5xu.js} +1 -1
- package/browser/{chunk-rt0W0Bep.js → chunk-DsBVpg5c.js} +1 -1
- package/browser/{chunk-B7tH9_ts.js → chunk-DsvZ07ov.js} +1 -1
- package/browser/{chunk-DTHwi4pI.js → chunk-Du4XO3B9.js} +1 -1
- package/browser/{chunk-Dls1Urvo.js → chunk-DxHp0kqe.js} +1 -1
- package/browser/{chunk-BSWAm8Lc.js → chunk-DyVTJvil.js} +1 -1
- package/browser/chunk-Gb2w1W4p.js +1 -0
- package/browser/{chunk-OEx8WMIh.js → chunk-PT1nxNHL.js} +1 -1
- package/browser/{chunk-CuEHbWdb.js → chunk-PljuvLnA.js} +1 -1
- package/browser/{chunk-BvkBTPsn.js → chunk-T7g1MoTP.js} +1 -1
- package/browser/{chunk-DL_yUw7E.js → chunk-ZZzKEzSY.js} +1 -1
- package/browser/{chunk-D1K33IKA.js → chunk-aMjpfW4c.js} +1 -1
- package/browser/{chunk-Bm8CD55z.js → chunk-fU4sX2V7.js} +1 -1
- package/browser/{chunk-Ck9jrhg3.js → chunk-j9VL-NZi.js} +1 -1
- package/browser/{chunk-giFp1XTq.js → chunk-mLUorSK3.js} +1 -1
- package/browser/{chunk-DYh1IsU-.js → chunk-pBppBdvD.js} +1 -1
- package/browser/{chunk-CU55cDg_.js → chunk-spR5H-6W.js} +1 -1
- package/browser/{chunk-DyNaE9Xq.js → chunk-yRRB8B0R.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/{main-HLQ22ACS.js → main-DB5EJGYC.js} +1 -1
- package/package.json +1 -1
- package/browser/chunk-BXgG4B5s.js +0 -1
- package/browser/chunk-B_yM2E8f.js +0 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
import {v}from'./chunk-Dls1Urvo.js';import {R}from'./chunk-CDVwpBWc.js';import {N}from'./chunk-x8X4JXC2.js';import {g,ao as W,F,C as Ce,d8 as W$1,a as F$1,Q as br,G as Gi,m as mT,cd as Hf,b as U,e as xw,k as ws,n as GC,o as pl,J as Jw,X as XE,a8 as Yg,v as eC,a9 as lC,q as Rg,s as rC,cH as Kw,a3 as VI,S as Sg,a4 as nC,ac as gC,u as bg,y as oC,a6 as UI,a5 as vl,aa as If,ab as wf}from'./main-HLQ22ACS.js';import'./chunk-B_yM2E8f.js';import {n as nt}from'./chunk-D1K33IKA.js';import'./chunk-bBy0vM9Y.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,a as wt,A as At,m as mn,Z as Zn,l as Xn,C as Cn,E as En}from'./chunk-65tVAuhG.js';import'./chunk-BXgG4B5s.js';import'./chunk-QpH9EEhD.js';function le(i,t){i&1&&(ws(0,"p",3),GC(1,"Loading\u2026"),pl());}function se(i,t){if(i&1&&(ws(0,"label",8),Sg(1,"input",27),VI(),ws(2,"span"),GC(3),pl()()),i&2){let e=t.$implicit,n=gC(2);XE(),bg("value",e.value)("formControl",n.scopeControl)("disabled",e.value==="namespace"&&!n.isAdmin()),UI(),XE(2),Yg(e.label);}}function ce(i,t){if(i&1&&(ws(0,"option",14),GC(1),pl()),i&2){let e=t.$implicit;bg("value",e.type),XE(),Yg(e.displayName);}}function me(i,t){if(i&1&&(ws(0,"option",14),GC(1),pl()),i&2){let e=t.$implicit;bg("value",e),XE(),Yg(e);}}function pe(i,t){if(i&1&&(ws(0,"div",9)(1,"label",28),Sg(2,"input",29),VI(),ws(3,"span",7),GC(4,"Grant automatically"),pl()(),ws(5,"p",30),GC(6),pl()()),i&2){let e=gC(2);XE(2),bg("formControl",e.autoGrantControl),UI(),XE(4),vl(" Give this integration to ",e.autoGrantReach(),", without each agent having to declare it. An agent can still opt out by mapping this configuration to an empty tool list. ");}}function de(i,t){if(i&1){let e=lC();ws(0,"div",22)(1,"ds-json-schema-form",31),Rg("valueChange",function(s){If(e);let m=gC(2);return wf(m.onParamsChange(s))}),pl()();}if(i&2){let e=gC(2);XE(),bg("schema",t)("value",e.initialParams());}}function ge(i,t){if(i&1){let e=lC();ws(0,"button",32),Rg("click",function(){If(e);let s=gC(2);return wf(s.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 ue(i,t){if(i&1){let e=lC();ws(0,"form",5),Rg("ngSubmit",function(){If(e);let s=gC();return wf(s.submit())}),ws(1,"fieldset",6)(2,"legend",7),GC(3,"Scope"),pl(),rC(4,se,4,4,"label",8,Kw().trackByScope,true),pl(),ws(6,"div",9)(7,"label",10),GC(8,"Type "),ws(9,"span",11),GC(10,"*"),pl()(),ws(11,"select",12)(12,"option",13),GC(13,"Select type"),pl(),rC(14,ce,2,2,"option",14,Kw().trackByType,true),pl(),VI(),pl(),ws(16,"div",9)(17,"label",15),GC(18,"Name "),ws(19,"span",11),GC(20,"*"),pl()(),Sg(21,"input",16),VI(),pl(),ws(22,"div",9)(23,"label",17),GC(24,"Description"),pl(),Sg(25,"textarea",18),VI(),pl(),ws(26,"div",9)(27,"label",19),GC(28,"Auth Setting"),pl(),ws(29,"select",20)(30,"option",21),GC(31,"None"),pl(),rC(32,me,2,2,"option",14,nC),pl(),VI(),pl(),Jw(34,pe,7,2,"div",9),Jw(35,de,2,2,"div",22),ws(36,"div",23)(37,"button",24),GC(38),pl(),Jw(39,ge,2,2,"button",25),ws(40,"button",26),Rg("click",function(){If(e);let s=gC();return wf(s.cancel())}),GC(41,"Cancel"),pl()()();}if(i&2){let e,n=gC();bg("formGroup",n.form),XE(),bg("disabled",n.isEditMode()),XE(3),oC(n.scopeOptions),XE(7),bg("formControl",n.typeControl),UI(),XE(3),oC(n.integrationTypes()),XE(7),bg("formControl",n.nameControl),UI(),XE(4),bg("formControl",n.descriptionControl),UI(),XE(4),bg("formControl",n.authSettingNameControl),UI(),XE(),bg("ngValue",null),XE(2),oC(n.availableAuthSettings()),XE(2),eC(n.isAutoGrantable()?34:-1),XE(),eC((e=n.schema())?35:-1,e),XE(2),bg("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),XE(),vl(" ",n.isEditMode()?"Save changes":"Create"," "),XE(),eC(n.isEditMode()?39:-1);}}var fe=new Set(["platform","namespace","userOnNs","userGlobal"]),T=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),re=class i{route=g(W);router=g(F);destroyRef=g(Ce);state=g(N);integrationTypeController=g(W$1);authSettingState=g(R);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?br(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new z({name:new _t("",{nonNullable:true,validators:[_e.required,_e.minLength(1)]}),description:new _t(null),type:new _t("",{nonNullable:true,validators:[_e.required]}),scope:new _t("namespace",{nonNullable:true}),autoGrant:new _t(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=Gi(false);isSubmitting=Gi(false);isLoading=Gi(false);isExporting=Gi(false);scopeOptions=[{value:"platform",label:T.platform},{value:"namespace",label:T.namespace},{value:"userOnNs",label:T.userOnNs},{value:"userGlobal",label:T.userGlobal}];authSettingNameControl=new _t(null);availableAuthSettings=Gi([]);paramsValue=Gi(null);initialParams=Gi(null);integrationTypes=F$1(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=F$1(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});scopeValue=F$1(this.form.controls.scope.valueChanges,{initialValue:this.form.controls.scope.value});schema=mT(()=>{let t=this.selectedType();return t?this.integrationTypes().find(n=>n.type===t)?.configSchema??null:null});isAutoGrantable=mT(()=>{let t=this.selectedType();return t?this.integrationTypes().find(e=>e.type===t)?.autoGrantable??false:false});autoGrantReach=mT(()=>{switch(this.scopeValue()){case "platform":return "every agent of this environment";case "namespace":return "every agent of this namespace";default:return "your own runs"}});existingConfig=null;constructor(){Hf(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,n=t.get("integrationId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable(),this.loadAuthSettingsForScope("platform");return}let s=this.parseScope(e.get("scope"));this.scopeControl.setValue(s),this.loadAuthSettingsForScope(s),this.scopeControl.valueChanges.pipe(U(this.destroyRef)).subscribe(ae=>{this.loadAuthSettingsForScope(ae);});let m=e.get("template");m&&this.hydrateFromTemplate(m);}parseScope(t){return t&&fe.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId&&!t.namespaceId?"platform":t.userId?t.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e;let n=this.deriveScopeFromConfig(e);this.scopeControl.setValue(n),this.applyConfigToForm(e),this.loadAuthSettingsForScope(n),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[IntegrationForm] Could not load config '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.applyConfigToForm(e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[IntegrationForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.typeControl.setValue(t.integrationType),this.initialParams.set(t.parameters),this.paramsValue.set(t.parameters),this.authSettingNameControl.setValue(t.authSettingName??null),this.autoGrantControl.setValue(t.autoGrant??false);}loadAuthSettingsForScope(t){let e;switch(t){case "platform":e=this.authSettingState.loadPlatformSettings();break;case "namespace":e=this.authSettingState.loadNamespaceSettings(this.namespaceId);break;case "userOnNs":e=this.authSettingState.loadUserSettings(this.namespaceId);break;case "userGlobal":e=this.authSettingState.loadUserSettings("global");break}e.pipe(U(this.destroyRef)).subscribe({next:n=>{let s=n.map(m=>m.name).filter(Boolean);this.availableAuthSettings.set([...new Set(s)]);},error:()=>this.availableAuthSettings.set([])});}onParamsChange(t){this.paramsValue.set(t);}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.descriptionControl.value?.trim(),e={name:this.nameControl.value.trim(),description:t||null,integrationType:this.typeControl.value,parameters:this.paramsValue(),authSettingName:this.authSettingNameControl.value||null,autoGrant:this.isAutoGrantable()&&this.autoGrantControl.value},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,e,n,this.existingConfig):this.state.create(e,n,this.namespaceId??null)).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.state.exportAsYaml(t).pipe(U(this.destroyRef)).subscribe({next:e=>{let n=new Blob([e],{type:"application/yaml"}),s=URL.createObjectURL(n),m=document.createElement("a");m.href=s,m.download=`${this.existingConfig?.name??"integration"}.yaml`,m.click(),URL.revokeObjectURL(s),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"]);}trackByType(t,e){return e.type}trackByScope(t,e){return e.value}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=xw({type:i,selectors:[["agentos-integration-form"]],decls:6,vars:2,consts:[[1,"integration-form"],[1,"integration-form__header"],[1,"integration-form__title"],[1,"integration-form__loading"],[1,"integration-form__form",3,"formGroup"],[1,"integration-form__form",3,"ngSubmit","formGroup"],[1,"integration-form__field","integration-form__scope",3,"disabled"],[1,"integration-form__label"],[1,"integration-form__scope-option"],[1,"integration-form__field"],["for","integration-type",1,"integration-form__label"],["aria-hidden","true"],["id","integration-type",1,"integration-form__select",3,"formControl"],["value","","disabled",""],[3,"value"],["for","integration-name",1,"integration-form__label"],["id","integration-name","type","text","placeholder","Integration name","autocomplete","off",1,"integration-form__input",3,"formControl"],["for","integration-description",1,"integration-form__label"],["id","integration-description","placeholder","Optional description","rows","3",1,"integration-form__textarea",3,"formControl"],["for","integration-auth-setting",1,"integration-form__label"],["id","integration-auth-setting",1,"integration-form__select",3,"formControl"],[3,"ngValue"],[1,"integration-form__schema-form"],[1,"integration-form__actions"],["type","submit",1,"integration-form__btn","integration-form__btn--primary",3,"disabled"],["type","button",1,"integration-form__btn","integration-form__btn--export",3,"disabled"],["type","button",1,"integration-form__btn",3,"click"],["type","radio",3,"value","formControl","disabled"],[1,"integration-form__checkbox-row"],["type","checkbox",3,"formControl"],[1,"integration-form__hint"],[3,"valueChange","schema","value"],["type","button",1,"integration-form__btn","integration-form__btn--export",3,"click","disabled"]],template:function(e,n){e&1&&(ws(0,"div",0)(1,"header",1)(2,"h1",2),GC(3),pl()(),Jw(4,le,2,0,"p",3)(5,ue,42,12,"form",4),pl()),e&2&&(XE(3),Yg(n.isEditMode()?"Edit integration":"New integration"),XE(),eC(n.isLoading()?4:5));},dependencies:[ni,Jn,Qn,ei,Ye,wt,At,mn,Zn,Xn,Cn,En,nt],styles:[".integration-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.integration-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.integration-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.integration-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.integration-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.integration-form__scope[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.4rem;border:1px solid var(--color-divider);border-radius:0;padding:.75rem 1rem;background:transparent;margin:0}.integration-form__scope[disabled][_ngcontent-%COMP%]{opacity:.6}.integration-form__scope-option[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;font-size:.875rem;color:var(--color-text);cursor:pointer}.integration-form__scope-option[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{margin:0}.integration-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.integration-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.integration-form__input[_ngcontent-%COMP%], .integration-form__textarea[_ngcontent-%COMP%], .integration-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}.integration-form__input[_ngcontent-%COMP%]:focus, .integration-form__textarea[_ngcontent-%COMP%]:focus, .integration-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.integration-form__input[_ngcontent-%COMP%]::placeholder, .integration-form__textarea[_ngcontent-%COMP%]::placeholder, .integration-form__select[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.integration-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:4.5rem;line-height:1.5}.integration-form__select[_ngcontent-%COMP%]{cursor:pointer}.integration-form__select[_ngcontent-%COMP%] option[disabled][_ngcontent-%COMP%]{color:var(--color-text-secondary)}.integration-form__checkbox-row[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;cursor:pointer}.integration-form__checkbox-row[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{margin:0}.integration-form__hint[_ngcontent-%COMP%]{margin:0;font-size:.8125rem;line-height:1.4;color:var(--color-text-secondary)}.integration-form__schema-form[_ngcontent-%COMP%]{padding:1rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface)}.integration-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.integration-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}.integration-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.integration-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.integration-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.integration-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}.integration-form__btn--export[_ngcontent-%COMP%]{border-color:var(--color-divider);color:var(--color-text-secondary)}.integration-form__btn--export[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--color-accent);color:var(--color-accent)}"]})};export{re as IntegrationFormComponent};
|
|
1
|
+
import {v}from'./chunk-DxHp0kqe.js';import {R}from'./chunk-CTEyKNKm.js';import {N}from'./chunk-Bo7GcoVn.js';import {g,ao as W,F,C as Ce,d8 as W$1,a as F$1,Q as br,G as Gi,m as mT,cd as Hf,b as U,e as xw,k as ws,n as GC,o as pl,J as Jw,X as XE,a8 as Yg,v as eC,a9 as lC,q as Rg,s as rC,cH as Kw,a3 as VI,S as Sg,a4 as nC,ac as gC,u as bg,y as oC,a6 as UI,a5 as vl,aa as If,ab as wf}from'./main-DB5EJGYC.js';import'./chunk-CVM23KJ3.js';import {n as nt}from'./chunk-aMjpfW4c.js';import'./chunk-D-FNlEoa.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,a as wt,A as At,m as mn,Z as Zn,l as Xn,C as Cn,E as En}from'./chunk-BLaIJYTj.js';import'./chunk-Gb2w1W4p.js';import'./chunk-CKhMv1Ug.js';function le(i,t){i&1&&(ws(0,"p",3),GC(1,"Loading\u2026"),pl());}function se(i,t){if(i&1&&(ws(0,"label",8),Sg(1,"input",27),VI(),ws(2,"span"),GC(3),pl()()),i&2){let e=t.$implicit,n=gC(2);XE(),bg("value",e.value)("formControl",n.scopeControl)("disabled",e.value==="namespace"&&!n.isAdmin()),UI(),XE(2),Yg(e.label);}}function ce(i,t){if(i&1&&(ws(0,"option",14),GC(1),pl()),i&2){let e=t.$implicit;bg("value",e.type),XE(),Yg(e.displayName);}}function me(i,t){if(i&1&&(ws(0,"option",14),GC(1),pl()),i&2){let e=t.$implicit;bg("value",e),XE(),Yg(e);}}function pe(i,t){if(i&1&&(ws(0,"div",9)(1,"label",28),Sg(2,"input",29),VI(),ws(3,"span",7),GC(4,"Grant automatically"),pl()(),ws(5,"p",30),GC(6),pl()()),i&2){let e=gC(2);XE(2),bg("formControl",e.autoGrantControl),UI(),XE(4),vl(" Give this integration to ",e.autoGrantReach(),", without each agent having to declare it. An agent can still opt out by mapping this configuration to an empty tool list. ");}}function de(i,t){if(i&1){let e=lC();ws(0,"div",22)(1,"ds-json-schema-form",31),Rg("valueChange",function(s){If(e);let m=gC(2);return wf(m.onParamsChange(s))}),pl()();}if(i&2){let e=gC(2);XE(),bg("schema",t)("value",e.initialParams());}}function ge(i,t){if(i&1){let e=lC();ws(0,"button",32),Rg("click",function(){If(e);let s=gC(2);return wf(s.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 ue(i,t){if(i&1){let e=lC();ws(0,"form",5),Rg("ngSubmit",function(){If(e);let s=gC();return wf(s.submit())}),ws(1,"fieldset",6)(2,"legend",7),GC(3,"Scope"),pl(),rC(4,se,4,4,"label",8,Kw().trackByScope,true),pl(),ws(6,"div",9)(7,"label",10),GC(8,"Type "),ws(9,"span",11),GC(10,"*"),pl()(),ws(11,"select",12)(12,"option",13),GC(13,"Select type"),pl(),rC(14,ce,2,2,"option",14,Kw().trackByType,true),pl(),VI(),pl(),ws(16,"div",9)(17,"label",15),GC(18,"Name "),ws(19,"span",11),GC(20,"*"),pl()(),Sg(21,"input",16),VI(),pl(),ws(22,"div",9)(23,"label",17),GC(24,"Description"),pl(),Sg(25,"textarea",18),VI(),pl(),ws(26,"div",9)(27,"label",19),GC(28,"Auth Setting"),pl(),ws(29,"select",20)(30,"option",21),GC(31,"None"),pl(),rC(32,me,2,2,"option",14,nC),pl(),VI(),pl(),Jw(34,pe,7,2,"div",9),Jw(35,de,2,2,"div",22),ws(36,"div",23)(37,"button",24),GC(38),pl(),Jw(39,ge,2,2,"button",25),ws(40,"button",26),Rg("click",function(){If(e);let s=gC();return wf(s.cancel())}),GC(41,"Cancel"),pl()()();}if(i&2){let e,n=gC();bg("formGroup",n.form),XE(),bg("disabled",n.isEditMode()),XE(3),oC(n.scopeOptions),XE(7),bg("formControl",n.typeControl),UI(),XE(3),oC(n.integrationTypes()),XE(7),bg("formControl",n.nameControl),UI(),XE(4),bg("formControl",n.descriptionControl),UI(),XE(4),bg("formControl",n.authSettingNameControl),UI(),XE(),bg("ngValue",null),XE(2),oC(n.availableAuthSettings()),XE(2),eC(n.isAutoGrantable()?34:-1),XE(),eC((e=n.schema())?35:-1,e),XE(2),bg("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),XE(),vl(" ",n.isEditMode()?"Save changes":"Create"," "),XE(),eC(n.isEditMode()?39:-1);}}var fe=new Set(["platform","namespace","userOnNs","userGlobal"]),T=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),re=class i{route=g(W);router=g(F);destroyRef=g(Ce);state=g(N);integrationTypeController=g(W$1);authSettingState=g(R);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?br(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new z({name:new _t("",{nonNullable:true,validators:[_e.required,_e.minLength(1)]}),description:new _t(null),type:new _t("",{nonNullable:true,validators:[_e.required]}),scope:new _t("namespace",{nonNullable:true}),autoGrant:new _t(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=Gi(false);isSubmitting=Gi(false);isLoading=Gi(false);isExporting=Gi(false);scopeOptions=[{value:"platform",label:T.platform},{value:"namespace",label:T.namespace},{value:"userOnNs",label:T.userOnNs},{value:"userGlobal",label:T.userGlobal}];authSettingNameControl=new _t(null);availableAuthSettings=Gi([]);paramsValue=Gi(null);initialParams=Gi(null);integrationTypes=F$1(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=F$1(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});scopeValue=F$1(this.form.controls.scope.valueChanges,{initialValue:this.form.controls.scope.value});schema=mT(()=>{let t=this.selectedType();return t?this.integrationTypes().find(n=>n.type===t)?.configSchema??null:null});isAutoGrantable=mT(()=>{let t=this.selectedType();return t?this.integrationTypes().find(e=>e.type===t)?.autoGrantable??false:false});autoGrantReach=mT(()=>{switch(this.scopeValue()){case "platform":return "every agent of this environment";case "namespace":return "every agent of this namespace";default:return "your own runs"}});existingConfig=null;constructor(){Hf(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,n=t.get("integrationId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable(),this.loadAuthSettingsForScope("platform");return}let s=this.parseScope(e.get("scope"));this.scopeControl.setValue(s),this.loadAuthSettingsForScope(s),this.scopeControl.valueChanges.pipe(U(this.destroyRef)).subscribe(ae=>{this.loadAuthSettingsForScope(ae);});let m=e.get("template");m&&this.hydrateFromTemplate(m);}parseScope(t){return t&&fe.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId&&!t.namespaceId?"platform":t.userId?t.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e;let n=this.deriveScopeFromConfig(e);this.scopeControl.setValue(n),this.applyConfigToForm(e),this.loadAuthSettingsForScope(n),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[IntegrationForm] Could not load config '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.applyConfigToForm(e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[IntegrationForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.typeControl.setValue(t.integrationType),this.initialParams.set(t.parameters),this.paramsValue.set(t.parameters),this.authSettingNameControl.setValue(t.authSettingName??null),this.autoGrantControl.setValue(t.autoGrant??false);}loadAuthSettingsForScope(t){let e;switch(t){case "platform":e=this.authSettingState.loadPlatformSettings();break;case "namespace":e=this.authSettingState.loadNamespaceSettings(this.namespaceId);break;case "userOnNs":e=this.authSettingState.loadUserSettings(this.namespaceId);break;case "userGlobal":e=this.authSettingState.loadUserSettings("global");break}e.pipe(U(this.destroyRef)).subscribe({next:n=>{let s=n.map(m=>m.name).filter(Boolean);this.availableAuthSettings.set([...new Set(s)]);},error:()=>this.availableAuthSettings.set([])});}onParamsChange(t){this.paramsValue.set(t);}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.descriptionControl.value?.trim(),e={name:this.nameControl.value.trim(),description:t||null,integrationType:this.typeControl.value,parameters:this.paramsValue(),authSettingName:this.authSettingNameControl.value||null,autoGrant:this.isAutoGrantable()&&this.autoGrantControl.value},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,e,n,this.existingConfig):this.state.create(e,n,this.namespaceId??null)).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.state.exportAsYaml(t).pipe(U(this.destroyRef)).subscribe({next:e=>{let n=new Blob([e],{type:"application/yaml"}),s=URL.createObjectURL(n),m=document.createElement("a");m.href=s,m.download=`${this.existingConfig?.name??"integration"}.yaml`,m.click(),URL.revokeObjectURL(s),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"]);}trackByType(t,e){return e.type}trackByScope(t,e){return e.value}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=xw({type:i,selectors:[["agentos-integration-form"]],decls:6,vars:2,consts:[[1,"integration-form"],[1,"integration-form__header"],[1,"integration-form__title"],[1,"integration-form__loading"],[1,"integration-form__form",3,"formGroup"],[1,"integration-form__form",3,"ngSubmit","formGroup"],[1,"integration-form__field","integration-form__scope",3,"disabled"],[1,"integration-form__label"],[1,"integration-form__scope-option"],[1,"integration-form__field"],["for","integration-type",1,"integration-form__label"],["aria-hidden","true"],["id","integration-type",1,"integration-form__select",3,"formControl"],["value","","disabled",""],[3,"value"],["for","integration-name",1,"integration-form__label"],["id","integration-name","type","text","placeholder","Integration name","autocomplete","off",1,"integration-form__input",3,"formControl"],["for","integration-description",1,"integration-form__label"],["id","integration-description","placeholder","Optional description","rows","3",1,"integration-form__textarea",3,"formControl"],["for","integration-auth-setting",1,"integration-form__label"],["id","integration-auth-setting",1,"integration-form__select",3,"formControl"],[3,"ngValue"],[1,"integration-form__schema-form"],[1,"integration-form__actions"],["type","submit",1,"integration-form__btn","integration-form__btn--primary",3,"disabled"],["type","button",1,"integration-form__btn","integration-form__btn--export",3,"disabled"],["type","button",1,"integration-form__btn",3,"click"],["type","radio",3,"value","formControl","disabled"],[1,"integration-form__checkbox-row"],["type","checkbox",3,"formControl"],[1,"integration-form__hint"],[3,"valueChange","schema","value"],["type","button",1,"integration-form__btn","integration-form__btn--export",3,"click","disabled"]],template:function(e,n){e&1&&(ws(0,"div",0)(1,"header",1)(2,"h1",2),GC(3),pl()(),Jw(4,le,2,0,"p",3)(5,ue,42,12,"form",4),pl()),e&2&&(XE(3),Yg(n.isEditMode()?"Edit integration":"New integration"),XE(),eC(n.isLoading()?4:5));},dependencies:[ni,Jn,Qn,ei,Ye,wt,At,mn,Zn,Xn,Cn,En,nt],styles:[".integration-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.integration-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.integration-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.integration-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.integration-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.integration-form__scope[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.4rem;border:1px solid var(--color-divider);border-radius:0;padding:.75rem 1rem;background:transparent;margin:0}.integration-form__scope[disabled][_ngcontent-%COMP%]{opacity:.6}.integration-form__scope-option[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;font-size:.875rem;color:var(--color-text);cursor:pointer}.integration-form__scope-option[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{margin:0}.integration-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.integration-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.integration-form__input[_ngcontent-%COMP%], .integration-form__textarea[_ngcontent-%COMP%], .integration-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}.integration-form__input[_ngcontent-%COMP%]:focus, .integration-form__textarea[_ngcontent-%COMP%]:focus, .integration-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.integration-form__input[_ngcontent-%COMP%]::placeholder, .integration-form__textarea[_ngcontent-%COMP%]::placeholder, .integration-form__select[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.integration-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:4.5rem;line-height:1.5}.integration-form__select[_ngcontent-%COMP%]{cursor:pointer}.integration-form__select[_ngcontent-%COMP%] option[disabled][_ngcontent-%COMP%]{color:var(--color-text-secondary)}.integration-form__checkbox-row[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;cursor:pointer}.integration-form__checkbox-row[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{margin:0}.integration-form__hint[_ngcontent-%COMP%]{margin:0;font-size:.8125rem;line-height:1.4;color:var(--color-text-secondary)}.integration-form__schema-form[_ngcontent-%COMP%]{padding:1rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface)}.integration-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.integration-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}.integration-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.integration-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.integration-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.integration-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}.integration-form__btn--export[_ngcontent-%COMP%]{border-color:var(--color-divider);color:var(--color-text-secondary)}.integration-form__btn--export[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--color-accent);color:var(--color-accent)}"]})};export{re as IntegrationFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {l}from'./chunk-B_yM2E8f.js';import {g,C as Ce,ao as W,F,d5 as G,G as Gi,b as U,e as xw,k as ws,q as Rg,c9 as kf,S as Sg,o as pl,n as GC,ck as Ff,J as Jw,a3 as VI,X as XE,v as eC,u as bg,a6 as UI,d6 as Ae,bU as Td,W as x,ac as gC,a5 as vl,a9 as lC,a8 as Yg,z as Ug,d7 as Pn,aa as If,ab as wf,s as rC,y as oC}from'./main-HLQ22ACS.js';import {o as z,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,E as En,p as An}from'./chunk-65tVAuhG.js';import'./chunk-QpH9EEhD.js';import'./chunk-D1K33IKA.js';import'./chunk-bBy0vM9Y.js';var M=class e{api=g(Ae);isLoading=Gi(false);result=Gi(null);errorMessage=Gi(null);invoke(t,o,a,s){return this.isLoading.set(true),this.result.set(null),this.errorMessage.set(null),this.api.invoke({namespaceId:t,userId:o||void 0,toolName:a,payload:s||void 0}).pipe(Td({next:f=>{this.result.set(f),this.isLoading.set(false);},error:f=>{this.errorMessage.set(ne(f)),this.isLoading.set(false);}}))}reset(){this.result.set(null),this.errorMessage.set(null);}static \u0275fac=function(o){return new(o||e)};static \u0275prov=x({token:e,factory:e.\u0275fac,providedIn:"root"})};function ne(e){if(e instanceof Pn){let t=e.error;return t&&typeof t=="object"&&"message"in t&&typeof t.message=="string"?t.message:typeof t=="string"&&t.trim().length>0?t:e.statusText||`HTTP ${e.status}`}return e instanceof Error?e.message:"Unknown error"}var ie=(e,t)=>t.id;function re(e,t){e&1&&GC(0," Execute any registered tool directly \u2014 bypasses the normal agent-run pipeline. Restricted to super-admins. ");}function ae(e,t){e&1&&GC(0," Execute a registered tool directly in this namespace \u2014 bypasses the normal agent-run pipeline. ");}function le(e,t){e&1&&(ws(0,"p",17),GC(1,"Loading namespaces\u2026"),pl());}function se(e,t){if(e&1&&(ws(0,"option",27),GC(1),pl()),e&2){let o=t.$implicit;bg("value",o.id),XE(),Yg(o.name);}}function de(e,t){if(e&1&&(ws(0,"select",25)(1,"option",26),GC(2,"Select a namespace"),pl(),rC(3,se,2,2,"option",27,ie),pl(),VI()),e&2){let o=gC(2);UI(),XE(3),oC(o.namespaces());}}function ce(e,t){if(e&1&&Jw(0,le,2,0,"p",17)(1,de,5,0,"select",25),e&2){let o=gC();eC(o.namespacesLoading()?0:1);}}function me(e,t){if(e&1&&(ws(0,"p",11),GC(1),pl()),e&2){let o=gC();XE(),vl(" ",o.namespaceName()??o.namespaceId," ");}}function pe(e,t){e&1&&GC(0," Running\u2026 ");}function _e(e,t){e&1&&GC(0," Run tool ");}function ue(e,t){if(e&1){let o=lC();ws(0,"button",28),Rg("click",function(){If(o);let s=gC();return wf(s.reset())}),GC(1,"Clear result"),pl();}}function fe(e,t){e&1&&(ws(0,"section",23)(1,"h2",29),GC(2,"Error"),pl(),ws(3,"pre",30),GC(4),pl()()),e&2&&(XE(4),Yg(t));}function ve(e,t){e&1&&(ws(0,"h3",34),GC(1,"Metadata"),pl(),ws(2,"pre",30),GC(3),pl()),e&2&&(XE(3),Yg(t));}function ge(e,t){if(e&1&&(ws(0,"dt",36),GC(1,"Type"),pl(),ws(2,"dd",37),GC(3),pl()),e&2){let o=gC(2);XE(3),Yg(o.errorType);}}function ke(e,t){if(e&1&&(ws(0,"dt",36),GC(1,"Message"),pl(),ws(2,"dd",38),GC(3),pl()),e&2){let o=gC(2);XE(3),Yg(o.errorMessage);}}function be(e,t){if(e&1&&(ws(0,"h3",34),GC(1,"Tool error details"),pl(),ws(2,"dl",35),Jw(3,ge,4,1),Jw(4,ke,4,1),pl()),e&2){let o=gC();XE(3),eC(o.errorType?3:-1),XE(),eC(o.errorMessage?4:-1);}}function xe(e,t){if(e&1&&(ws(0,"section",31)(1,"header",32)(2,"h2",29),GC(3),pl(),ws(4,"span",33),GC(5),pl()(),ws(6,"h3",34),GC(7,"Output"),pl(),ws(8,"pre",30),GC(9),pl(),Jw(10,ve,4,1),ws(11,"h3",34),GC(12,"Structured output"),pl(),ws(13,"pre",30),GC(14),pl(),Jw(15,be,5,2),pl()),e&2){let o,a=t,s=gC();Ug("tool-invoke__result--failure",!a.success),XE(3),vl("Result \u2014 ",a.toolName),XE(),Ug("tool-invoke__badge--success",a.success)("tool-invoke__badge--failure",!a.success),XE(),vl(" ",a.success?"Success":"Tool error"," "),XE(4),Yg(a.output),XE(),eC((o=s.formatMetadata(a.metadata))?10:-1,o),XE(4),Yg(s.formatStructuredOutput(a.structuredOutput)??"null"),XE(),eC(a.errorType||a.errorMessage?15:-1);}}var te=class e{destroyRef=g(Ce);route=g(W);router=g(F);namespaceController=g(G);userState=g(l);state=g(M);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;namespaces=Gi([]);namespacesLoading=Gi(true);namespaceName=Gi(null);form=new z({namespaceId:new _t("",{nonNullable:true,validators:[_e$1.required]}),userId:new _t("",{nonNullable:true}),toolName:new _t("",{nonNullable:true,validators:[_e$1.required]}),payload:new _t("",{nonNullable:true})});ngOnInit(){let t=this.userState.currentUser()?.id;t?this.form.controls.userId.patchValue(t):this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:o=>{o.id&&this.form.controls.userId.patchValue(o.id);}}),this.isPlatformMode?this.namespaceController.listAllNamespace().pipe(U(this.destroyRef)).subscribe({next:o=>{this.namespaces.set(o.map(a=>({id:a.id,name:a.name}))),this.namespacesLoading.set(false);},error:()=>this.namespacesLoading.set(false)}):(this.form.controls.namespaceId.patchValue(this.namespaceId),this.namespacesLoading.set(false),this.namespaceController.getByIdNamespace(this.namespaceId).pipe(U(this.destroyRef)).subscribe({next:o=>this.namespaceName.set(o.name),error:()=>this.namespaceName.set(this.namespaceId)}));}submit(){if(this.form.invalid||this.state.isLoading())return;let{namespaceId:t,userId:o,toolName:a,payload:s}=this.form.getRawValue();this.state.invoke(t,o.trim()||void 0,a.trim(),s.trim()||void 0).pipe(U(this.destroyRef)).subscribe();}reset(){this.state.reset();}formatMetadata(t){return !t||Object.keys(t).length===0?null:JSON.stringify(t,null,2)}formatStructuredOutput(t){return t===void 0?null:JSON.stringify(t,null,2)}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(o){return new(o||e)};static \u0275cmp=xw({type:e,selectors:[["agentos-tool-invoke"]],decls:46,vars:8,consts:[[1,"tool-invoke"],[1,"tool-invoke__header"],["type","button",1,"tool-invoke__back",3,"click"],["width","16","height","16","viewBox","0 0 24 24","fill","none","aria-hidden","true"],["d","M15 18l-6-6 6-6","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],[1,"tool-invoke__title"],[1,"tool-invoke__subtitle"],[1,"tool-invoke__form",3,"ngSubmit","formGroup"],[1,"tool-invoke__field"],["for","ti-namespace",1,"tool-invoke__label"],[1,"tool-invoke__required"],["id","ti-namespace",1,"tool-invoke__namespace-static"],["for","ti-user",1,"tool-invoke__label"],[1,"tool-invoke__optional"],["id","ti-user","type","text","formControlName","userId","placeholder","UUID of the user \u2014 adds user-scoped overlay layers","autocomplete","off",1,"tool-invoke__input"],["for","ti-tool",1,"tool-invoke__label"],["id","ti-tool","type","text","formControlName","toolName","placeholder","e.g. MY_FILES__listFiles","autocomplete","off","spellcheck","false",1,"tool-invoke__input","tool-invoke__input--mono"],[1,"tool-invoke__hint"],["for","ti-payload",1,"tool-invoke__label"],["id","ti-payload","formControlName","payload","rows","6","placeholder",'JSON arguments for the tool, e.g. {"path": "/some/dir"}\\nLeave empty for tools with no input.',"spellcheck","false",1,"tool-invoke__textarea","tool-invoke__input--mono"],[1,"tool-invoke__actions"],["type","submit",1,"tool-invoke__submit",3,"disabled"],["type","button",1,"tool-invoke__reset"],[1,"tool-invoke__result","tool-invoke__result--error"],[1,"tool-invoke__result",3,"tool-invoke__result--failure"],["id","ti-namespace","formControlName","namespaceId",1,"tool-invoke__select"],["value","","disabled",""],[3,"value"],["type","button",1,"tool-invoke__reset",3,"click"],[1,"tool-invoke__result-title"],[1,"tool-invoke__output"],[1,"tool-invoke__result"],[1,"tool-invoke__result-header"],[1,"tool-invoke__badge"],[1,"tool-invoke__section-label"],[1,"tool-invoke__dl"],[1,"tool-invoke__dt"],[1,"tool-invoke__dd","tool-invoke__dd--mono"],[1,"tool-invoke__dd"]],template:function(o,a){if(o&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return a.back()}),kf(),ws(3,"svg",3),Sg(4,"path",4),pl(),GC(5," Back "),pl(),Ff(),ws(6,"h1",5),GC(7,"Tool invoke"),pl(),ws(8,"p",6),Jw(9,re,1,0)(10,ae,1,0),pl()(),ws(11,"form",7),Rg("ngSubmit",function(){return a.submit()}),ws(12,"div",8)(13,"label",9),GC(14,"Namespace "),ws(15,"span",10),GC(16,"*"),pl()(),Jw(17,ce,2,1)(18,me,2,1,"p",11),pl(),ws(19,"div",8)(20,"label",12),GC(21,"User ID "),ws(22,"span",13),GC(23,"(optional)"),pl()(),Sg(24,"input",14),VI(),pl(),ws(25,"div",8)(26,"label",15),GC(27,"Tool name "),ws(28,"span",10),GC(29,"*"),pl()(),Sg(30,"input",16),VI(),ws(31,"p",17),GC(32," Exact tool name as returned by the agent definition inspect page. When not found, the error response lists all available tools for the selected namespace. "),pl()(),ws(33,"div",8)(34,"label",18),GC(35,"Payload "),ws(36,"span",13),GC(37,"(optional)"),pl()(),Sg(38,"textarea",19),VI(),pl(),ws(39,"div",20)(40,"button",21),Jw(41,pe,1,0)(42,_e,1,0),pl(),Jw(43,ue,2,0,"button",22),pl()(),Jw(44,fe,5,1,"section",23),Jw(45,xe,16,12,"section",24),pl()),o&2){let s,f;XE(9),eC(a.isPlatformMode?9:10),XE(2),bg("formGroup",a.form),XE(6),eC(a.isPlatformMode?17:18),XE(7),UI(),XE(6),UI(),XE(8),UI(),XE(2),bg("disabled",a.form.invalid||a.state.isLoading()),XE(),eC(a.state.isLoading()?41:42),XE(2),eC(a.state.result()||a.state.errorMessage()?43:-1),XE(),eC((s=a.state.errorMessage())?44:-1,s),XE(),eC((f=a.state.result())?45:-1,f);}},dependencies:[ni,Jn,Qn,ei,Ye,At,Zn,Xn,En,An],styles:[".tool-invoke[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:720px;margin:0 auto;padding:2rem 1rem}.tool-invoke__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.tool-invoke__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.3rem;padding:0;border:none;background:transparent;color:var(--color-text-secondary, #6e6e73);font-size:.875rem;font-family:inherit;cursor:pointer;align-self:flex-start}.tool-invoke__back[_ngcontent-%COMP%]:hover{color:var(--color-text, #1d1d1f)}.tool-invoke__namespace-static[_ngcontent-%COMP%]{margin:0;padding:.5rem .75rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .12));background:var(--color-surface-muted, rgba(0, 0, 0, .04));color:var(--color-text, #1d1d1f);font-size:.9375rem}.tool-invoke__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.tool-invoke__subtitle[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6e6e73);line-height:1.5}.tool-invoke__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem;padding:1.5rem;border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:12px}.tool-invoke__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.4rem}.tool-invoke__label[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:500;color:var(--color-text-secondary, #6e6e73)}.tool-invoke__required[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30);margin-left:.1em}.tool-invoke__optional[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary, #6e6e73);font-size:.75rem}.tool-invoke__hint[_ngcontent-%COMP%]{margin:0;font-size:.75rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.tool-invoke__input[_ngcontent-%COMP%], .tool-invoke__select[_ngcontent-%COMP%], .tool-invoke__textarea[_ngcontent-%COMP%]{padding:.5rem .75rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .12));background:var(--color-surface, #fff);color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;transition:border-color .15s ease}.tool-invoke__input[_ngcontent-%COMP%]:focus, .tool-invoke__select[_ngcontent-%COMP%]:focus, .tool-invoke__textarea[_ngcontent-%COMP%]:focus{outline:none;border-color:var(--color-primary, #007aff)}.tool-invoke__input--mono[_ngcontent-%COMP%], .tool-invoke__select--mono[_ngcontent-%COMP%], .tool-invoke__textarea--mono[_ngcontent-%COMP%]{font-family:monospace;font-size:.875rem}.tool-invoke__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:120px}.tool-invoke__select[_ngcontent-%COMP%]{cursor:pointer}.tool-invoke__actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.75rem;flex-wrap:wrap;padding-top:.25rem}.tool-invoke__submit[_ngcontent-%COMP%]{padding:.55rem 1.25rem;border-radius:8px;border:none;background:var(--color-primary, #007aff);color:#fff;font-size:.9375rem;font-weight:500;font-family:inherit;cursor:pointer;transition:opacity .15s ease}.tool-invoke__submit[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.tool-invoke__submit[_ngcontent-%COMP%]:not(:disabled):hover{opacity:.88}.tool-invoke__reset[_ngcontent-%COMP%]{padding:.55rem 1rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .12));background:transparent;color:var(--color-text-secondary, #6e6e73);font-size:.875rem;font-family:inherit;cursor:pointer}.tool-invoke__reset[_ngcontent-%COMP%]:hover{background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.tool-invoke__result[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem;padding:1.25rem;border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:12px}.tool-invoke__result--error[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30);background:var(--color-error-bg, #fff5f5)}.tool-invoke__result--failure[_ngcontent-%COMP%]{border-color:var(--color-warning, #ff9500);background:var(--color-warning-bg, #fffaf0)}.tool-invoke__result-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.75rem;flex-wrap:wrap}.tool-invoke__result-title[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;font-weight:600;color:var(--color-text, #1d1d1f)}.tool-invoke__badge[_ngcontent-%COMP%]{display:inline-block;padding:.2em .6em;border-radius:4px;font-size:.75rem;font-weight:500}.tool-invoke__badge--success[_ngcontent-%COMP%]{background:var(--color-success-bg, #e3f5e1);color:var(--color-success, #34c759)}.tool-invoke__badge--failure[_ngcontent-%COMP%]{background:var(--color-warning-bg, #fff3cd);color:var(--color-warning, #ff9500)}.tool-invoke__section-label[_ngcontent-%COMP%]{margin:.5rem 0 0;font-size:.8125rem;font-weight:500;color:var(--color-text-secondary, #6e6e73);text-transform:uppercase;letter-spacing:.04em}.tool-invoke__output[_ngcontent-%COMP%]{margin:0;padding:.875rem 1rem;border-radius:6px;background:var(--color-surface-muted, rgba(0, 0, 0, .04));font-size:.875rem;font-family:monospace;color:var(--color-text, #1d1d1f);white-space:pre-wrap;word-break:break-word;line-height:1.6;max-height:500px;overflow-y:auto}.tool-invoke__dl[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content 1fr;gap:.4rem 1rem;margin:0}.tool-invoke__dt[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:500;color:var(--color-text-secondary, #6e6e73);align-self:start}.tool-invoke__dd[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text, #1d1d1f);word-break:break-word}.tool-invoke__dd--mono[_ngcontent-%COMP%]{font-family:monospace}"]})};export{te as ToolInvokeComponent};
|
|
1
|
+
import {l}from'./chunk-CVM23KJ3.js';import {g,C as Ce,ao as W,F,d5 as G,G as Gi,b as U,e as xw,k as ws,q as Rg,c9 as kf,S as Sg,o as pl,n as GC,ck as Ff,J as Jw,a3 as VI,X as XE,v as eC,u as bg,a6 as UI,d6 as Ae,bU as Td,W as x,ac as gC,a5 as vl,a9 as lC,a8 as Yg,z as Ug,d7 as Pn,aa as If,ab as wf,s as rC,y as oC}from'./main-DB5EJGYC.js';import {o as z,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,E as En,p as An}from'./chunk-BLaIJYTj.js';import'./chunk-CKhMv1Ug.js';import'./chunk-aMjpfW4c.js';import'./chunk-D-FNlEoa.js';var M=class e{api=g(Ae);isLoading=Gi(false);result=Gi(null);errorMessage=Gi(null);invoke(t,o,a,s){return this.isLoading.set(true),this.result.set(null),this.errorMessage.set(null),this.api.invoke({namespaceId:t,userId:o||void 0,toolName:a,payload:s||void 0}).pipe(Td({next:f=>{this.result.set(f),this.isLoading.set(false);},error:f=>{this.errorMessage.set(ne(f)),this.isLoading.set(false);}}))}reset(){this.result.set(null),this.errorMessage.set(null);}static \u0275fac=function(o){return new(o||e)};static \u0275prov=x({token:e,factory:e.\u0275fac,providedIn:"root"})};function ne(e){if(e instanceof Pn){let t=e.error;return t&&typeof t=="object"&&"message"in t&&typeof t.message=="string"?t.message:typeof t=="string"&&t.trim().length>0?t:e.statusText||`HTTP ${e.status}`}return e instanceof Error?e.message:"Unknown error"}var ie=(e,t)=>t.id;function re(e,t){e&1&&GC(0," Execute any registered tool directly \u2014 bypasses the normal agent-run pipeline. Restricted to super-admins. ");}function ae(e,t){e&1&&GC(0," Execute a registered tool directly in this namespace \u2014 bypasses the normal agent-run pipeline. ");}function le(e,t){e&1&&(ws(0,"p",17),GC(1,"Loading namespaces\u2026"),pl());}function se(e,t){if(e&1&&(ws(0,"option",27),GC(1),pl()),e&2){let o=t.$implicit;bg("value",o.id),XE(),Yg(o.name);}}function de(e,t){if(e&1&&(ws(0,"select",25)(1,"option",26),GC(2,"Select a namespace"),pl(),rC(3,se,2,2,"option",27,ie),pl(),VI()),e&2){let o=gC(2);UI(),XE(3),oC(o.namespaces());}}function ce(e,t){if(e&1&&Jw(0,le,2,0,"p",17)(1,de,5,0,"select",25),e&2){let o=gC();eC(o.namespacesLoading()?0:1);}}function me(e,t){if(e&1&&(ws(0,"p",11),GC(1),pl()),e&2){let o=gC();XE(),vl(" ",o.namespaceName()??o.namespaceId," ");}}function pe(e,t){e&1&&GC(0," Running\u2026 ");}function _e(e,t){e&1&&GC(0," Run tool ");}function ue(e,t){if(e&1){let o=lC();ws(0,"button",28),Rg("click",function(){If(o);let s=gC();return wf(s.reset())}),GC(1,"Clear result"),pl();}}function fe(e,t){e&1&&(ws(0,"section",23)(1,"h2",29),GC(2,"Error"),pl(),ws(3,"pre",30),GC(4),pl()()),e&2&&(XE(4),Yg(t));}function ve(e,t){e&1&&(ws(0,"h3",34),GC(1,"Metadata"),pl(),ws(2,"pre",30),GC(3),pl()),e&2&&(XE(3),Yg(t));}function ge(e,t){if(e&1&&(ws(0,"dt",36),GC(1,"Type"),pl(),ws(2,"dd",37),GC(3),pl()),e&2){let o=gC(2);XE(3),Yg(o.errorType);}}function ke(e,t){if(e&1&&(ws(0,"dt",36),GC(1,"Message"),pl(),ws(2,"dd",38),GC(3),pl()),e&2){let o=gC(2);XE(3),Yg(o.errorMessage);}}function be(e,t){if(e&1&&(ws(0,"h3",34),GC(1,"Tool error details"),pl(),ws(2,"dl",35),Jw(3,ge,4,1),Jw(4,ke,4,1),pl()),e&2){let o=gC();XE(3),eC(o.errorType?3:-1),XE(),eC(o.errorMessage?4:-1);}}function xe(e,t){if(e&1&&(ws(0,"section",31)(1,"header",32)(2,"h2",29),GC(3),pl(),ws(4,"span",33),GC(5),pl()(),ws(6,"h3",34),GC(7,"Output"),pl(),ws(8,"pre",30),GC(9),pl(),Jw(10,ve,4,1),ws(11,"h3",34),GC(12,"Structured output"),pl(),ws(13,"pre",30),GC(14),pl(),Jw(15,be,5,2),pl()),e&2){let o,a=t,s=gC();Ug("tool-invoke__result--failure",!a.success),XE(3),vl("Result \u2014 ",a.toolName),XE(),Ug("tool-invoke__badge--success",a.success)("tool-invoke__badge--failure",!a.success),XE(),vl(" ",a.success?"Success":"Tool error"," "),XE(4),Yg(a.output),XE(),eC((o=s.formatMetadata(a.metadata))?10:-1,o),XE(4),Yg(s.formatStructuredOutput(a.structuredOutput)??"null"),XE(),eC(a.errorType||a.errorMessage?15:-1);}}var te=class e{destroyRef=g(Ce);route=g(W);router=g(F);namespaceController=g(G);userState=g(l);state=g(M);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;namespaces=Gi([]);namespacesLoading=Gi(true);namespaceName=Gi(null);form=new z({namespaceId:new _t("",{nonNullable:true,validators:[_e$1.required]}),userId:new _t("",{nonNullable:true}),toolName:new _t("",{nonNullable:true,validators:[_e$1.required]}),payload:new _t("",{nonNullable:true})});ngOnInit(){let t=this.userState.currentUser()?.id;t?this.form.controls.userId.patchValue(t):this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:o=>{o.id&&this.form.controls.userId.patchValue(o.id);}}),this.isPlatformMode?this.namespaceController.listAllNamespace().pipe(U(this.destroyRef)).subscribe({next:o=>{this.namespaces.set(o.map(a=>({id:a.id,name:a.name}))),this.namespacesLoading.set(false);},error:()=>this.namespacesLoading.set(false)}):(this.form.controls.namespaceId.patchValue(this.namespaceId),this.namespacesLoading.set(false),this.namespaceController.getByIdNamespace(this.namespaceId).pipe(U(this.destroyRef)).subscribe({next:o=>this.namespaceName.set(o.name),error:()=>this.namespaceName.set(this.namespaceId)}));}submit(){if(this.form.invalid||this.state.isLoading())return;let{namespaceId:t,userId:o,toolName:a,payload:s}=this.form.getRawValue();this.state.invoke(t,o.trim()||void 0,a.trim(),s.trim()||void 0).pipe(U(this.destroyRef)).subscribe();}reset(){this.state.reset();}formatMetadata(t){return !t||Object.keys(t).length===0?null:JSON.stringify(t,null,2)}formatStructuredOutput(t){return t===void 0?null:JSON.stringify(t,null,2)}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(o){return new(o||e)};static \u0275cmp=xw({type:e,selectors:[["agentos-tool-invoke"]],decls:46,vars:8,consts:[[1,"tool-invoke"],[1,"tool-invoke__header"],["type","button",1,"tool-invoke__back",3,"click"],["width","16","height","16","viewBox","0 0 24 24","fill","none","aria-hidden","true"],["d","M15 18l-6-6 6-6","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],[1,"tool-invoke__title"],[1,"tool-invoke__subtitle"],[1,"tool-invoke__form",3,"ngSubmit","formGroup"],[1,"tool-invoke__field"],["for","ti-namespace",1,"tool-invoke__label"],[1,"tool-invoke__required"],["id","ti-namespace",1,"tool-invoke__namespace-static"],["for","ti-user",1,"tool-invoke__label"],[1,"tool-invoke__optional"],["id","ti-user","type","text","formControlName","userId","placeholder","UUID of the user \u2014 adds user-scoped overlay layers","autocomplete","off",1,"tool-invoke__input"],["for","ti-tool",1,"tool-invoke__label"],["id","ti-tool","type","text","formControlName","toolName","placeholder","e.g. MY_FILES__listFiles","autocomplete","off","spellcheck","false",1,"tool-invoke__input","tool-invoke__input--mono"],[1,"tool-invoke__hint"],["for","ti-payload",1,"tool-invoke__label"],["id","ti-payload","formControlName","payload","rows","6","placeholder",'JSON arguments for the tool, e.g. {"path": "/some/dir"}\\nLeave empty for tools with no input.',"spellcheck","false",1,"tool-invoke__textarea","tool-invoke__input--mono"],[1,"tool-invoke__actions"],["type","submit",1,"tool-invoke__submit",3,"disabled"],["type","button",1,"tool-invoke__reset"],[1,"tool-invoke__result","tool-invoke__result--error"],[1,"tool-invoke__result",3,"tool-invoke__result--failure"],["id","ti-namespace","formControlName","namespaceId",1,"tool-invoke__select"],["value","","disabled",""],[3,"value"],["type","button",1,"tool-invoke__reset",3,"click"],[1,"tool-invoke__result-title"],[1,"tool-invoke__output"],[1,"tool-invoke__result"],[1,"tool-invoke__result-header"],[1,"tool-invoke__badge"],[1,"tool-invoke__section-label"],[1,"tool-invoke__dl"],[1,"tool-invoke__dt"],[1,"tool-invoke__dd","tool-invoke__dd--mono"],[1,"tool-invoke__dd"]],template:function(o,a){if(o&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return a.back()}),kf(),ws(3,"svg",3),Sg(4,"path",4),pl(),GC(5," Back "),pl(),Ff(),ws(6,"h1",5),GC(7,"Tool invoke"),pl(),ws(8,"p",6),Jw(9,re,1,0)(10,ae,1,0),pl()(),ws(11,"form",7),Rg("ngSubmit",function(){return a.submit()}),ws(12,"div",8)(13,"label",9),GC(14,"Namespace "),ws(15,"span",10),GC(16,"*"),pl()(),Jw(17,ce,2,1)(18,me,2,1,"p",11),pl(),ws(19,"div",8)(20,"label",12),GC(21,"User ID "),ws(22,"span",13),GC(23,"(optional)"),pl()(),Sg(24,"input",14),VI(),pl(),ws(25,"div",8)(26,"label",15),GC(27,"Tool name "),ws(28,"span",10),GC(29,"*"),pl()(),Sg(30,"input",16),VI(),ws(31,"p",17),GC(32," Exact tool name as returned by the agent definition inspect page. When not found, the error response lists all available tools for the selected namespace. "),pl()(),ws(33,"div",8)(34,"label",18),GC(35,"Payload "),ws(36,"span",13),GC(37,"(optional)"),pl()(),Sg(38,"textarea",19),VI(),pl(),ws(39,"div",20)(40,"button",21),Jw(41,pe,1,0)(42,_e,1,0),pl(),Jw(43,ue,2,0,"button",22),pl()(),Jw(44,fe,5,1,"section",23),Jw(45,xe,16,12,"section",24),pl()),o&2){let s,f;XE(9),eC(a.isPlatformMode?9:10),XE(2),bg("formGroup",a.form),XE(6),eC(a.isPlatformMode?17:18),XE(7),UI(),XE(6),UI(),XE(8),UI(),XE(2),bg("disabled",a.form.invalid||a.state.isLoading()),XE(),eC(a.state.isLoading()?41:42),XE(2),eC(a.state.result()||a.state.errorMessage()?43:-1),XE(),eC((s=a.state.errorMessage())?44:-1,s),XE(),eC((f=a.state.result())?45:-1,f);}},dependencies:[ni,Jn,Qn,ei,Ye,At,Zn,Xn,En,An],styles:[".tool-invoke[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:720px;margin:0 auto;padding:2rem 1rem}.tool-invoke__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.tool-invoke__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.3rem;padding:0;border:none;background:transparent;color:var(--color-text-secondary, #6e6e73);font-size:.875rem;font-family:inherit;cursor:pointer;align-self:flex-start}.tool-invoke__back[_ngcontent-%COMP%]:hover{color:var(--color-text, #1d1d1f)}.tool-invoke__namespace-static[_ngcontent-%COMP%]{margin:0;padding:.5rem .75rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .12));background:var(--color-surface-muted, rgba(0, 0, 0, .04));color:var(--color-text, #1d1d1f);font-size:.9375rem}.tool-invoke__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.tool-invoke__subtitle[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6e6e73);line-height:1.5}.tool-invoke__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem;padding:1.5rem;border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:12px}.tool-invoke__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.4rem}.tool-invoke__label[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:500;color:var(--color-text-secondary, #6e6e73)}.tool-invoke__required[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30);margin-left:.1em}.tool-invoke__optional[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary, #6e6e73);font-size:.75rem}.tool-invoke__hint[_ngcontent-%COMP%]{margin:0;font-size:.75rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.tool-invoke__input[_ngcontent-%COMP%], .tool-invoke__select[_ngcontent-%COMP%], .tool-invoke__textarea[_ngcontent-%COMP%]{padding:.5rem .75rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .12));background:var(--color-surface, #fff);color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;transition:border-color .15s ease}.tool-invoke__input[_ngcontent-%COMP%]:focus, .tool-invoke__select[_ngcontent-%COMP%]:focus, .tool-invoke__textarea[_ngcontent-%COMP%]:focus{outline:none;border-color:var(--color-primary, #007aff)}.tool-invoke__input--mono[_ngcontent-%COMP%], .tool-invoke__select--mono[_ngcontent-%COMP%], .tool-invoke__textarea--mono[_ngcontent-%COMP%]{font-family:monospace;font-size:.875rem}.tool-invoke__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:120px}.tool-invoke__select[_ngcontent-%COMP%]{cursor:pointer}.tool-invoke__actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.75rem;flex-wrap:wrap;padding-top:.25rem}.tool-invoke__submit[_ngcontent-%COMP%]{padding:.55rem 1.25rem;border-radius:8px;border:none;background:var(--color-primary, #007aff);color:#fff;font-size:.9375rem;font-weight:500;font-family:inherit;cursor:pointer;transition:opacity .15s ease}.tool-invoke__submit[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.tool-invoke__submit[_ngcontent-%COMP%]:not(:disabled):hover{opacity:.88}.tool-invoke__reset[_ngcontent-%COMP%]{padding:.55rem 1rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .12));background:transparent;color:var(--color-text-secondary, #6e6e73);font-size:.875rem;font-family:inherit;cursor:pointer}.tool-invoke__reset[_ngcontent-%COMP%]:hover{background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.tool-invoke__result[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem;padding:1.25rem;border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:12px}.tool-invoke__result--error[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30);background:var(--color-error-bg, #fff5f5)}.tool-invoke__result--failure[_ngcontent-%COMP%]{border-color:var(--color-warning, #ff9500);background:var(--color-warning-bg, #fffaf0)}.tool-invoke__result-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.75rem;flex-wrap:wrap}.tool-invoke__result-title[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;font-weight:600;color:var(--color-text, #1d1d1f)}.tool-invoke__badge[_ngcontent-%COMP%]{display:inline-block;padding:.2em .6em;border-radius:4px;font-size:.75rem;font-weight:500}.tool-invoke__badge--success[_ngcontent-%COMP%]{background:var(--color-success-bg, #e3f5e1);color:var(--color-success, #34c759)}.tool-invoke__badge--failure[_ngcontent-%COMP%]{background:var(--color-warning-bg, #fff3cd);color:var(--color-warning, #ff9500)}.tool-invoke__section-label[_ngcontent-%COMP%]{margin:.5rem 0 0;font-size:.8125rem;font-weight:500;color:var(--color-text-secondary, #6e6e73);text-transform:uppercase;letter-spacing:.04em}.tool-invoke__output[_ngcontent-%COMP%]{margin:0;padding:.875rem 1rem;border-radius:6px;background:var(--color-surface-muted, rgba(0, 0, 0, .04));font-size:.875rem;font-family:monospace;color:var(--color-text, #1d1d1f);white-space:pre-wrap;word-break:break-word;line-height:1.6;max-height:500px;overflow-y:auto}.tool-invoke__dl[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content 1fr;gap:.4rem 1rem;margin:0}.tool-invoke__dt[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:500;color:var(--color-text-secondary, #6e6e73);align-self:start}.tool-invoke__dd[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text, #1d1d1f);word-break:break-word}.tool-invoke__dd--mono[_ngcontent-%COMP%]{font-family:monospace}"]})};export{te as ToolInvokeComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {i}from'./chunk-
|
|
1
|
+
import {i}from'./chunk-Gb2w1W4p.js';import {l}from'./chunk-CVM23KJ3.js';import {g,d9 as D,dk as me,aJ as Tr,aD as Ly,bS as Ea,a7 as ya,Q as br,r as re,cE as Dd,bU as Td,W as x}from'./main-DB5EJGYC.js';var y="none",O="me",N=class f{nsController=g(D);exportService=g(me);userState=g(l);refresh$=new Tr(void 0);namespaceId$=new Tr(null);vm$=Ly([this.namespaceId$,this.refresh$]).pipe(Ea(([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})))}),Dd({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(Td(()=>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(Td(()=>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(Td(()=>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(Td(()=>this.refresh()))}delete(e,n){return this.nsController.deleteIntegrationConfig(e).pipe(Td(()=>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 {D}from'./chunk-
|
|
1
|
+
import {D}from'./chunk-DUTgv2ie.js';import {a}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-Dp3xB5xu.js';import {s}from'./chunk-CVM23KJ3.js';import {g,ao as W$1,F,C as Ce,aJ as Tr,G as Gi,bS as Ea,M as By,a7 as ya,Q as br,r as re,cE as Dd,b as U,e as xw,aK as xb,J as Jw,k as ws,bf as aT,q as Rg,n as GC,o as pl,af as Eg,t as CC,v as eC,X as XE,u as bg,bg as uT,ah as rT,ac as gC,a8 as Yg,a9 as lC,aa as If,ab as wf,ag as fT}from'./main-DB5EJGYC.js';import {$ as $n}from'./chunk-aMjpfW4c.js';import'./chunk-D-FNlEoa.js';import'./chunk-BLaIJYTj.js';import'./chunk-CKhMv1Ug.js';var J=()=>[];function W(a,e){if(a&1&&(ws(0,"p",1),GC(1),pl()),a&2){let t=gC();XE(),Yg(t.errorMessage());}}function H(a,e){if(a&1){let t=lC();ws(0,"agentos-skill-item",5),Rg("deleteRequested",function(i){If(t);let o=gC(2);return wf(o.deleteSkill(i))}),pl();}if(a&2){let t=e,n=gC().$implicit,i=gC();bg("skill",t)("namespaceId",i.namespaceId)("readOnly",i.isPlatformSkill(n.id))("namedByAgents",i.namedByAgents(t));}}function Q(a,e){if(a&1&&Jw(0,H,1,4,"agentos-skill-item",4),a&2){let t,n=e.$implicit,i=gC();eC((t=i.resolveSkill(n.id))?0:-1,t);}}var X="platform",Y="namespace",V=class a$1{route=g(W$1);router=g(F);destroyRef=g(Ce);skillState=g(o);agentState=g(s);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);isLoading=Gi(true);errorMessage=Gi(null);allSkills$=this.refresh$.pipe(Ea(()=>(this.isLoading.set(true),By({platform:this.skillState.listPlatform().pipe(ya(()=>br([]))),namespace:this.skillState.listByNamespace(this.namespaceId),agents:By({namespace:this.agentState.listByNamespace(this.namespaceId),platform:this.agentState.listPlatform().pipe(ya(()=>br([])))}).pipe(re(({namespace:e,platform:t})=>[...e,...t]),ya(()=>br([])))}))),Dd({bufferSize:1,refCount:true}));skillItems$=this.allSkills$.pipe(re(({platform:e,namespace:t})=>[...e.map(n=>({id:n.id??"",name:n.name,description:n.description,groupKey:X,groupLabel:"Platform (read-only)"})),...t.map(n=>({id:n.id??"",name:n.name,description:n.description,groupKey:Y,groupLabel:"Namespace"}))]));namespaceSkillsById=new Map;platformSkillsById=new Map;namedByAgentsByName=new Map;constructor(){this.allSkills$.pipe(U(this.destroyRef)).subscribe({next:({platform:e,namespace:t,agents:n})=>{this.platformSkillsById=new Map(e.map(i=>[i.id??"",i])),this.namespaceSkillsById=new Map(t.map(i=>[i.id??"",i])),this.namedByAgentsByName=this.countNamedBy([...e,...t],n),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}countNamedBy(e,t){let n=new Map;for(let i of e){let o=t.filter(j=>a(j.skillSelectors,i.name)==="named").length;o>0&&n.set(i.name.toLowerCase(),o);}return n}namedByAgents(e){return this.namedByAgentsByName.get(e.name.toLowerCase())??0}goBack(){this.router.navigate(["/agentos","namespaces"]);}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"skills","new"]);}deleteSkill(e){this.errorMessage.set(null),this.skillState.delete(e.id??"").pipe(U(this.destroyRef)).subscribe({next:()=>this.refresh$.next(),error:t=>this.errorMessage.set(t.status===400?`"${e.name}" is defined by a SKILL.md file and cannot be deleted through the API.`:`Deleting "${e.name}" failed.`)});}resolveSkill(e){return this.platformSkillsById.get(e)??this.namespaceSkillsById.get(e)??null}isPlatformSkill(e){return this.platformSkillsById.has(e)}static \u0275fac=function(t){return new(t||a$1)};static \u0275cmp=xw({type:a$1,selectors:[["agentos-namespace-skills"]],decls:7,vars:8,consts:[["skillItemTpl",""],["role","alert",1,"namespace-skills__error"],["title","Skills","emptyMessage","No skills defined yet. Add one above, or drop a SKILL.md under the namespace config path.","cardMinWidth","400px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","type","button",1,"namespace-skills__back",3,"click"],[3,"skill","namespaceId","readOnly","namedByAgents"],[3,"deleteRequested","skill","namespaceId","readOnly","namedByAgents"]],template:function(t,n){if(t&1&&(Jw(0,W,2,1,"p",1),ws(1,"ds-entity-list",2),aT(2,"async"),Rg("createRequested",function(){return n.openCreateForm()}),ws(3,"button",3),Rg("click",function(){return n.goBack()}),GC(4,"\u2190 Namespaces"),pl()(),Eg(5,Q,1,1,"ng-template",null,0,fT)),t&2){let i=CC(6);eC(n.errorMessage()?0:-1),XE(),bg("items",uT(2,5,n.skillItems$)??rT(7,J))("loading",n.isLoading())("showCreate",true)("itemTemplate",i);}},dependencies:[$n,D,xb],styles:[".namespace-skills__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.namespace-skills__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.namespace-skills__error[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:.875rem;color:var(--color-error, var(--red, #dc2626))}"]})};export{V as NamespaceSkillsComponent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {f}from'./chunk-Cz3puK-P.js';import {G as Ge,z as z$1,Q as Qe,E as Et,y as yt$2}from'./chunk-C_5eQn8U.js';import {U as Ue$1,x as x$2,i as is}from'./chunk-QpH9EEhD.js';import {al as vt$1,an as ue,g,ay as O,a as F,L,az as Xt,U,N,p as pe$1,F as F$1,ap as Cd,ae as kt,aA as an,av as B,e as xw,h as hr$1,aB as fr$1,aC as Tu,k as ws,q as Rg,J as Jw,o as pl,X as XE,u as bg,v as eC,B as Pg,E as EC,I as IC,P as P$1,aD as Ly,W as x,a9 as lC,ai as tm,aa as If,aj as KC,ab as wf,a3 as VI,z as Ug,ak as em,a6 as UI,A as dE,G as Gi$1,aE as W,D as py,Q as br$1,aF as R,r as re,a7 as ya,aG as fe,m as mT,x as x$1,w as w$1,aH as z,b as U$1,aI as bS,s as rC,y as oC,aJ as Tr$1,aK as xb,am as qm,j as Gn$1,n as GC,aL as wo$1,aM as Zn$2,aN as Nn,aO as wt$2,aP as G,aQ as $a,aR as Fs,aS as K,aT as Ut,aU as Ue,aV as U$2,aW as C,aX as D$1,aY as ft$1,aZ as js,a_ as QT,ac as gC,a$ as XC,b0 as Qg,a5 as vl,S as Sg,ah as rT,b1 as On,b2 as kb,b3 as Sb,b4 as oT,b5 as nT,aw as hl,b6 as _g,ax as gl,l as le,b7 as u,b8 as B$1,b9 as T,ba as v,bb as m,bc as R$1,bd as h,be as A,a8 as Yg,bf as aT,bg as uT,T as Tg,bh as Vy,i as pr$1,bi as lT,bj as aE,bk as yh}from'./main-HLQ22ACS.js';import {s}from'./chunk-CvZWmgd7.js';import {d}from'./chunk-B5rnCx1b.js';import {S as Se$1,P as Pn}from'./chunk-D1K33IKA.js';import {u as ui$1,m as mt$1,p as pt$1,Z as Z$1,V as Ve}from'./chunk-bBy0vM9Y.js';import {y as yt$1,w as wt$1,t as ti$1,Y as Ye,Z as Zn$1,c as cn}from'./chunk-65tVAuhG.js';var ot=class i{sanitizer=g(bS);transform(e,t){if(!t||!e)return e;let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`(${n})`,"gi"),r=e.replace(o,"<strong>$1</strong>");return this.sanitizer.bypassSecurityTrustHtml(r)}static \u0275fac=function(t){return new(t||i)};static \u0275pipe=On({name:"highlight",type:i,pure:true})};var be=class i{http=g(py);projectState=g(P$1);threadState=g(U);transcribeAudio(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow();return this.http.post(`/api/projects/${o}/transcribe`,w$1({audio:e,mimeType:t},n?{language:n}:{}))}sendVoiceMessage(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow(),r=this.threadState.getSelectedThreadIdOrThrow();return this.http.post(`/api/projects/${o}/threads/${r}/voice-message`,w$1({audio:e,mimeType:t},n?{language:n}:{}))}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var yi=["messageInput"],wi=["fileInput"],Ti=(i,e)=>e.name;function Si(i,e){i&1&&(ws(0,"div",3),Sg(1,"span",8),GC(2," Recording... Click mic to stop "),pl());}function Mi(i,e){i&1&&(ws(0,"div",3),Sg(1,"span",9),GC(2," Transcribing... "),pl());}function Ei(i,e){if(i&1&&(ws(0,"span",14),GC(1),pl()),i&2){let t=gC().$implicit,n=gC(2);XE(),Yg(" "+(n.getParameterFormat(t)||""));}}function Oi(i,e){if(i&1){let t=lC();ws(0,"div",11),Rg("click",function(){let o=If(t).$index,r=gC(2);return wf(r.selectAutocompleteItemByClick(o))})("keydown.enter",function(){let o=If(t).$index,r=gC(2);return wf(r.selectAutocompleteItemByClick(o))})("keydown.space",function(){let o=If(t).$index,r=gC(2);return wf(r.selectAutocompleteItemByClick(o))})("mouseenter",function(){let o=If(t).$index,r=gC(2);return wf(r.selectedAutocompleteIndex=o)}),ws(1,"div",12),Sg(2,"span",13),aT(3,"highlight"),Jw(4,Ei,2,1,"span",14),pl(),Sg(5,"div",15),aT(6,"highlight"),pl();}if(i&2){let t=e.$implicit,n=e.$index,o=gC(2);Ug("selected",n===o.selectedAutocompleteIndex),Tg("aria-selected",n===o.selectedAutocompleteIndex),XE(2),bg("innerHTML",lT(3,6,o.autocompleteTrigger+t.name,o.getAutocompleteQuery()),aE),XE(2),eC(o.hasParameterFormat(t)?4:-1),XE(),bg("innerHTML",lT(6,9,t.description,o.getAutocompleteQuery()),aE);}}function Pi(i,e){if(i&1&&(ws(0,"div",4),rC(1,Oi,7,12,"div",10,Ti),pl()),i&2){let t=gC();XE(),oC(t.autocompleteItems);}}function ki(i,e){if(i&1){let t=lC();ws(0,"ds-icon-button",18),Rg("action",function(){If(t);let o=gC(2);return wf(o.onStopClick())}),pl();}}function Ii(i,e){if(i&1){let t=lC();ws(0,"ds-icon-button",19),Rg("action",function(){If(t);let o=gC(2);return wf(o.sendMessage())}),pl();}if(i&2){let t=gC(2);Ug("hidden",t.isDisabled||!t.message.trim())("active",!!t.message.trim()&&!t.isDisabled),bg("title",t.getSendButtonTooltip())("disabled",t.isDisabled||!t.message.trim());}}function Di(i,e){if(i&1){let t=lC();ws(0,"ds-icon-button",21),Rg("action",function(){If(t);let o=gC(3);return wf(o.triggerFileUpload())}),pl(),ws(1,"input",22,1),Rg("change",function(o){If(t);let r=gC(3);return wf(r.onFileInputChange(o))}),pl();}if(i&2){let t=gC(3);bg("disabled",t.isDisabled);}}function Ai(i,e){if(i&1){let t=lC();Jw(0,Di,3,1),ws(1,"ds-icon-button",20),Rg("action",function(){If(t);let o=gC(2);return wf(o.toggleRecording())}),pl();}if(i&2){let t=gC(2);eC(!t.showWelcome&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?0:-1),XE(),Ug("hidden",t.message.trim()&&!t.isRecording&&!t.isTranscribing),bg("variant",t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing)?"danger":"default")("disabled",t.isVoiceMessageMode&&t.isTranscribing)("title",t.isRecording?"Click to stop recording":t.isTranscribing?"Uploading...":"Click to start recording");}}function Fi(i,e){if(i&1&&(ws(0,"div",7),Jw(1,ki,1,0,"ds-icon-button",16),Jw(2,Ii,1,6,"ds-icon-button",17),Jw(3,Ai,2,6),pl()),i&2){let t=gC();XE(),eC(t.isThinking?1:-1),XE(),eC((!t.isThinking||t.message.trim())&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?2:-1),XE(),eC(t.isThinking?-1:3);}}var rt=class i{isDisabled=false;showWelcome=false;isThinking=false;isStarting=false;isSessionInitializing=false;isStopping=false;filesPasted=new vt$1;messageSubmitted=new vt$1;voiceMessageReady=new vt$1;voiceRecordingToggled=new vt$1;heightChanged=new vt$1;stopRequested=new vt$1;textareaFocused=new vt$1;messageInput;fileInput;message="";isRecording=false;isTranscribing=false;isFocused=false;recognition=null;mediaRecorder=null;audioChunks=[];voiceInputMode="browser";get isVoiceMessageMode(){return this.voiceInputMode==="voice-message"}sessionHadTranscript=false;pendingLineBreaksTimeout=null;lastProcessedResultIndex=0;useEnterToSend=false;currentInvite="";subscriptions=[];thinkingPhrases=["Processing request...","Thinking...","Working on it..."];currentThinkingPhrase="Processing request...";thinkingPhraseIndex=0;thinkingInterval=null;autocompleteVisible=false;autocompleteTrigger=null;autocompleteItems=[];selectedAutocompleteIndex=0;preferencesService=g(L);codayService=g(Ge);agentApiService=g(f);promptApiService=g(d);projectStateService=g(P$1);audioApiService=g(be);threadStateService=g(U);ngOnInit(){this.initializeVoiceInput(),this.useEnterToSend=this.preferencesService.getEnterToSend(),this.subscriptions.push(this.preferencesService.voiceLanguage$.subscribe(()=>this.updateRecognitionLanguage())),this.subscriptions.push(this.preferencesService.voiceInputMode$.subscribe(e=>{this.voiceInputMode=e;})),this.subscriptions.push(this.preferencesService.enterToSend$.subscribe(e=>{this.useEnterToSend=e;})),this.subscribeToInviteEvents(),this.subscribeToMessageRestore();}ngAfterViewInit(){this.adjustTextareaHeight(),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),200);});}ngOnChanges(e){e.isThinking&&(e.isThinking.currentValue?this.startThinkingAnimation():(this.stopThinkingAnimation(),this.isStopping=false,e.isThinking.previousValue&&(console.log("[CHAT-TEXTAREA] Thinking ended, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100);})))),e.isSessionInitializing&&!e.isSessionInitializing.currentValue&&e.isSessionInitializing.previousValue&&(console.log("[CHAT-TEXTAREA] Session initialization completed, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100);})),e.isStarting&&!e.isStarting.currentValue&&e.isStarting.previousValue&&this.isThinking&&(this.thinkingPhraseIndex===0?(console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index 0 - restarting animation"),this.stopThinkingAnimation(),this.startThinkingAnimation()):console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index",this.thinkingPhraseIndex,"- continuing without restart"));}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),this.subscriptions=[],this.clearPendingLineBreaks(),this.stopThinkingAnimation();}onKeyDown(e){if(this.autocompleteVisible)switch(e.key){case "ArrowDown":e.preventDefault(),this.selectedAutocompleteIndex=Math.min(this.selectedAutocompleteIndex+1,this.autocompleteItems.length-1),this.scrollSelectedItemIntoView();return;case "ArrowUp":e.preventDefault(),this.selectedAutocompleteIndex=Math.max(this.selectedAutocompleteIndex-1,0),this.scrollSelectedItemIntoView();return;case "Tab":case "Enter":if(!this.message.includes(" ")){e.preventDefault(),this.selectAutocompleteItem();return}break;case "Escape":e.preventDefault(),this.hideAutocomplete();return}e.key==="Enter"&&(this.useEnterToSend?!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),this.sendMessage(true)):(navigator.platform.toLowerCase().includes("mac")?e.metaKey:e.ctrlKey)&&!e.shiftKey&&(e.preventDefault(),this.sendMessage(true)));}onInput(){this.adjustTextareaHeight(),this.checkForAutocomplete();}onPaste(e){let t=e.clipboardData?.items;if(!t)return;let n=Array.from(t).filter(r=>r.kind==="file");if(!n.length)return;e.preventDefault();let o=n.reduce((r,d)=>{let v=d.getAsFile();return v?[...r,v]:r},[]);o.length&&this.filesPasted.emit(o);}triggerFileUpload(){console.log("[CHAT-TEXTAREA] Triggering file upload"),this.fileInput?.nativeElement?.click();}onFileInputChange(e){let t=e.target,n=t.files;if(!n||n.length===0){console.log("[CHAT-TEXTAREA] No files selected");return}console.log("[CHAT-TEXTAREA] Files selected:",n.length);let o=Array.from(n);this.filesPasted.emit(o),t.value="";}onDocumentClick(e){if(!this.autocompleteVisible)return;let t=e.target,n=document.querySelector(".autocomplete-popup"),o=this.messageInput?.nativeElement;n&&!n.contains(t)&&o&&!o.contains(t)&&this.hideAutocomplete();}sendMessage(e=false){let t=this.message.trim();!this.isDisabled&&(e||t)&&(this.isRecording&&this.recognition&&(this.clearPendingLineBreaks(),this.recognition.stop()),this.messageSubmitted.emit(t),this.message="",setTimeout(()=>this.adjustTextareaHeight(),0));}onStopClick(){this.isStopping=true,this.stopRequested.emit();}toggleRecording(){this.isRecording?this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.stopWhisperRecording():this.stopRecording():this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.startWhisperRecording():this.startRecording();}startWhisperRecording(){return B(this,null,function*(){if(!this.isRecording)try{let e=yield navigator.mediaDevices.getUserMedia({audio:!0});this.audioChunks=[],this.mediaRecorder=new MediaRecorder(e),this.mediaRecorder.ondataavailable=t=>{t.data.size>0&&this.audioChunks.push(t.data);},this.mediaRecorder.onstop=()=>{e.getTracks().forEach(t=>t.stop()),this.processWhisperAudio();},this.mediaRecorder.onerror=t=>{console.error("[WHISPER] MediaRecorder error:",t),e.getTracks().forEach(n=>n.stop()),this.isRecording=!1,this.voiceRecordingToggled.emit(!1);},this.mediaRecorder.start(),this.isRecording=!0,this.voiceRecordingToggled.emit(!0),console.log("[WHISPER] Started recording");}catch(e){console.error("[WHISPER] Failed to start recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(false);}})}stopWhisperRecording(){if(!(!this.mediaRecorder||!this.isRecording))try{this.mediaRecorder.stop(),this.isRecording=!1,this.voiceRecordingToggled.emit(!1),console.log("[WHISPER] Stopped recording");}catch(e){console.error("[WHISPER] Failed to stop recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(false);}}processWhisperAudio(){if(this.audioChunks.length===0)return;let e=new Blob(this.audioChunks,{type:this.mediaRecorder?.mimeType||"audio/webm"}),t=e.type.split(";")[0]||"audio/webm";this.audioChunks=[],this.isTranscribing=true;let n=new FileReader;n.onloadend=()=>{let o=n.result.split(",")[1];if(!o){console.error("[WHISPER] Failed to read audio as base64"),this.isTranscribing=false;return}let d=this.preferencesService.getVoiceLanguage().split("-")[0];if(this.voiceInputMode==="voice-message"){if(!this.threadStateService.getSelectedThreadId()){console.log("[WHISPER] No thread selected \u2014 emitting voiceMessageReady for thread creation"),this.isTranscribing=false,this.voiceMessageReady.emit({base64:o,mimeType:t,language:d});return}this.audioApiService.sendVoiceMessage(o,t,d).subscribe({next:v=>{this.isTranscribing=false,console.log("[WHISPER] Voice message sent, transcription:",v.transcription?.substring(0,50));},error:v=>{console.error("[WHISPER] Voice message error:",v),this.isTranscribing=false,this.fallbackToTranscription(o,t,d);}});}else this.audioApiService.transcribeAudio(o,t,d).subscribe({next:v=>{this.isTranscribing=false,v.text&&this.appendToTextarea(v.text+" ");},error:v=>{console.error("[WHISPER] Transcription error:",v),this.isTranscribing=false;}});},n.readAsDataURL(e);}fallbackToTranscription(e,t,n){this.audioApiService.transcribeAudio(e,t,n).subscribe({next:o=>{this.isTranscribing=false,o.text&&this.appendToTextarea(o.text+" ");},error:o=>{console.error("[WHISPER] Fallback transcription also failed:",o),this.isTranscribing=false;}});}initializeVoiceInput(){let e=window.SpeechRecognition??window.webkitSpeechRecognition;if(console.log("[SPEECH] speechRecognition",e),!e){console.warn("[SPEECH] Speech Recognition API not available");return}this.recognition=new e,this.recognition.continuous=true,this.recognition.interimResults=true,this.recognition.maxAlternatives=1,this.recognition.lang=this.getSelectedLanguage();try{"grammars"in this.recognition&&(this.recognition.serviceURI=void 0);}catch(t){console.log("[SPEECH] Advanced speech recognition parameters not supported");}this.recognition.onresult=t=>{let n="",o=Math.max(t.resultIndex,this.lastProcessedResultIndex);for(let r=o;r<t.results.length;r++)t.results[r].isFinal&&(n+=t.results[r][0].transcript,this.lastProcessedResultIndex=r+1);if(n){let r=this.improveTranscriptPunctuation(n.trim());this.sessionHadTranscript=true,console.log("[SPEECH] onresult ending, appending to textarea",this.isRecording),this.appendToTextarea(r);}},this.recognition.onend=()=>{console.log("[SPEECH] Recognition ended. Was recording:",this.isRecording),this.isRecording=false,this.lastProcessedResultIndex=0,this.voiceRecordingToggled.emit(this.isRecording);},this.recognition.onerror=t=>{console.error("[SPEECH] Speech recognition error:",t.error),console.log("[SPEECH] Error details:",{error:t.error,message:t.message,timeStamp:t.timeStamp}),this.isRecording=false,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording);},this.recognition.onstart=()=>{console.log("[SPEECH] Recognition started successfully");},this.recognition.onspeechstart=()=>{console.log("[SPEECH] Speech detected");},this.recognition.onspeechend=()=>{console.log("[SPEECH] Speech ended");};}startRecording(){return B(this,null,function*(){if(!(!this.recognition||this.isRecording))try{this.isRecording=!0,this.sessionHadTranscript=!1,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording),this.recognition.start(),console.log("[SPEECH] Started recording");}catch(e){console.error("[SPEECH] Failed to start recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(this.isRecording);}})}stopRecording(){if(!this.recognition||!this.isRecording){console.log("[SPEECH] stopRecording not recording");return}try{console.log("[SPEECH] stopRecording recognition stop"),this.recognition.stop(),this.schedulePendingLineBreaks();}catch(e){console.error("[SPEECH] Failed to stop recording:",e);}}getSelectedLanguage(){return this.preferencesService.getVoiceLanguage()}updateRecognitionLanguage(){if(this.recognition){let e=this.getSelectedLanguage();this.recognition.lang=e,console.log("[SPEECH] Language changed to:",e);}}improveTranscriptPunctuation(e){let t=e;return /[.!?]$/.test(t.trim())||(t=t.trim()+"."),t=t.charAt(0).toUpperCase()+t.slice(1),t=t.replace(/\s+/g," "),t=t+" ",t}appendToTextarea(e){let t=this.message;if(this.message=t?`${t}${e}`:e,this.messageInput?.nativeElement){this.messageInput.nativeElement.focus();let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n);}setTimeout(()=>this.adjustTextareaHeight(),0);}schedulePendingLineBreaks(){this.clearPendingLineBreaks(),this.pendingLineBreaksTimeout=window.setTimeout(()=>{this.sessionHadTranscript&&(console.log("[SPEECH] Adding line breaks after transcript session"),this.appendToTextarea(`
|
|
1
|
+
import {f}from'./chunk-8j0zbcE8.js';import {G as Ge,z as z$1,Q as Qe,E as Et,y as yt$2}from'./chunk-B0ec6QE2.js';import {U as Ue$1,x as x$2,i as is}from'./chunk-CKhMv1Ug.js';import {al as vt$1,an as ue,g,ay as O,a as F,L,az as Xt,U,N,p as pe$1,F as F$1,ap as Cd,ae as kt,aA as an,av as B,e as xw,h as hr$1,aB as fr$1,aC as Tu,k as ws,q as Rg,J as Jw,o as pl,X as XE,u as bg,v as eC,B as Pg,E as EC,I as IC,P as P$1,aD as Ly,W as x,a9 as lC,ai as tm,aa as If,aj as KC,ab as wf,a3 as VI,z as Ug,ak as em,a6 as UI,A as dE,G as Gi$1,aE as W,D as py,Q as br$1,aF as R,r as re,a7 as ya,aG as fe,m as mT,x as x$1,w as w$1,aH as z,b as U$1,aI as bS,s as rC,y as oC,aJ as Tr$1,aK as xb,am as qm,j as Gn$1,n as GC,aL as wo$1,aM as Zn$2,aN as Nn,aO as wt$2,aP as G,aQ as $a,aR as Fs,aS as K,aT as Ut,aU as Ue,aV as U$2,aW as C,aX as D$1,aY as ft$1,aZ as js,a_ as QT,ac as gC,a$ as XC,b0 as Qg,a5 as vl,S as Sg,ah as rT,b1 as On,b2 as kb,b3 as Sb,b4 as oT,b5 as nT,aw as hl,b6 as _g,ax as gl,l as le,b7 as u,b8 as B$1,b9 as T,ba as v,bb as m,bc as R$1,bd as h,be as A,a8 as Yg,bf as aT,bg as uT,T as Tg,bh as Vy,i as pr$1,bi as lT,bj as aE,bk as yh}from'./main-DB5EJGYC.js';import {s}from'./chunk-CrU3BQQS.js';import {d}from'./chunk-B4NACXvL.js';import {S as Se$1,P as Pn}from'./chunk-aMjpfW4c.js';import {u as ui$1,m as mt$1,p as pt$1,Z as Z$1,V as Ve}from'./chunk-D-FNlEoa.js';import {y as yt$1,w as wt$1,t as ti$1,Y as Ye,Z as Zn$1,c as cn}from'./chunk-BLaIJYTj.js';var ot=class i{sanitizer=g(bS);transform(e,t){if(!t||!e)return e;let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`(${n})`,"gi"),r=e.replace(o,"<strong>$1</strong>");return this.sanitizer.bypassSecurityTrustHtml(r)}static \u0275fac=function(t){return new(t||i)};static \u0275pipe=On({name:"highlight",type:i,pure:true})};var be=class i{http=g(py);projectState=g(P$1);threadState=g(U);transcribeAudio(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow();return this.http.post(`/api/projects/${o}/transcribe`,w$1({audio:e,mimeType:t},n?{language:n}:{}))}sendVoiceMessage(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow(),r=this.threadState.getSelectedThreadIdOrThrow();return this.http.post(`/api/projects/${o}/threads/${r}/voice-message`,w$1({audio:e,mimeType:t},n?{language:n}:{}))}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var yi=["messageInput"],wi=["fileInput"],Ti=(i,e)=>e.name;function Si(i,e){i&1&&(ws(0,"div",3),Sg(1,"span",8),GC(2," Recording... Click mic to stop "),pl());}function Mi(i,e){i&1&&(ws(0,"div",3),Sg(1,"span",9),GC(2," Transcribing... "),pl());}function Ei(i,e){if(i&1&&(ws(0,"span",14),GC(1),pl()),i&2){let t=gC().$implicit,n=gC(2);XE(),Yg(" "+(n.getParameterFormat(t)||""));}}function Oi(i,e){if(i&1){let t=lC();ws(0,"div",11),Rg("click",function(){let o=If(t).$index,r=gC(2);return wf(r.selectAutocompleteItemByClick(o))})("keydown.enter",function(){let o=If(t).$index,r=gC(2);return wf(r.selectAutocompleteItemByClick(o))})("keydown.space",function(){let o=If(t).$index,r=gC(2);return wf(r.selectAutocompleteItemByClick(o))})("mouseenter",function(){let o=If(t).$index,r=gC(2);return wf(r.selectedAutocompleteIndex=o)}),ws(1,"div",12),Sg(2,"span",13),aT(3,"highlight"),Jw(4,Ei,2,1,"span",14),pl(),Sg(5,"div",15),aT(6,"highlight"),pl();}if(i&2){let t=e.$implicit,n=e.$index,o=gC(2);Ug("selected",n===o.selectedAutocompleteIndex),Tg("aria-selected",n===o.selectedAutocompleteIndex),XE(2),bg("innerHTML",lT(3,6,o.autocompleteTrigger+t.name,o.getAutocompleteQuery()),aE),XE(2),eC(o.hasParameterFormat(t)?4:-1),XE(),bg("innerHTML",lT(6,9,t.description,o.getAutocompleteQuery()),aE);}}function Pi(i,e){if(i&1&&(ws(0,"div",4),rC(1,Oi,7,12,"div",10,Ti),pl()),i&2){let t=gC();XE(),oC(t.autocompleteItems);}}function ki(i,e){if(i&1){let t=lC();ws(0,"ds-icon-button",18),Rg("action",function(){If(t);let o=gC(2);return wf(o.onStopClick())}),pl();}}function Ii(i,e){if(i&1){let t=lC();ws(0,"ds-icon-button",19),Rg("action",function(){If(t);let o=gC(2);return wf(o.sendMessage())}),pl();}if(i&2){let t=gC(2);Ug("hidden",t.isDisabled||!t.message.trim())("active",!!t.message.trim()&&!t.isDisabled),bg("title",t.getSendButtonTooltip())("disabled",t.isDisabled||!t.message.trim());}}function Di(i,e){if(i&1){let t=lC();ws(0,"ds-icon-button",21),Rg("action",function(){If(t);let o=gC(3);return wf(o.triggerFileUpload())}),pl(),ws(1,"input",22,1),Rg("change",function(o){If(t);let r=gC(3);return wf(r.onFileInputChange(o))}),pl();}if(i&2){let t=gC(3);bg("disabled",t.isDisabled);}}function Ai(i,e){if(i&1){let t=lC();Jw(0,Di,3,1),ws(1,"ds-icon-button",20),Rg("action",function(){If(t);let o=gC(2);return wf(o.toggleRecording())}),pl();}if(i&2){let t=gC(2);eC(!t.showWelcome&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?0:-1),XE(),Ug("hidden",t.message.trim()&&!t.isRecording&&!t.isTranscribing),bg("variant",t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing)?"danger":"default")("disabled",t.isVoiceMessageMode&&t.isTranscribing)("title",t.isRecording?"Click to stop recording":t.isTranscribing?"Uploading...":"Click to start recording");}}function Fi(i,e){if(i&1&&(ws(0,"div",7),Jw(1,ki,1,0,"ds-icon-button",16),Jw(2,Ii,1,6,"ds-icon-button",17),Jw(3,Ai,2,6),pl()),i&2){let t=gC();XE(),eC(t.isThinking?1:-1),XE(),eC((!t.isThinking||t.message.trim())&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?2:-1),XE(),eC(t.isThinking?-1:3);}}var rt=class i{isDisabled=false;showWelcome=false;isThinking=false;isStarting=false;isSessionInitializing=false;isStopping=false;filesPasted=new vt$1;messageSubmitted=new vt$1;voiceMessageReady=new vt$1;voiceRecordingToggled=new vt$1;heightChanged=new vt$1;stopRequested=new vt$1;textareaFocused=new vt$1;messageInput;fileInput;message="";isRecording=false;isTranscribing=false;isFocused=false;recognition=null;mediaRecorder=null;audioChunks=[];voiceInputMode="browser";get isVoiceMessageMode(){return this.voiceInputMode==="voice-message"}sessionHadTranscript=false;pendingLineBreaksTimeout=null;lastProcessedResultIndex=0;useEnterToSend=false;currentInvite="";subscriptions=[];thinkingPhrases=["Processing request...","Thinking...","Working on it..."];currentThinkingPhrase="Processing request...";thinkingPhraseIndex=0;thinkingInterval=null;autocompleteVisible=false;autocompleteTrigger=null;autocompleteItems=[];selectedAutocompleteIndex=0;preferencesService=g(L);codayService=g(Ge);agentApiService=g(f);promptApiService=g(d);projectStateService=g(P$1);audioApiService=g(be);threadStateService=g(U);ngOnInit(){this.initializeVoiceInput(),this.useEnterToSend=this.preferencesService.getEnterToSend(),this.subscriptions.push(this.preferencesService.voiceLanguage$.subscribe(()=>this.updateRecognitionLanguage())),this.subscriptions.push(this.preferencesService.voiceInputMode$.subscribe(e=>{this.voiceInputMode=e;})),this.subscriptions.push(this.preferencesService.enterToSend$.subscribe(e=>{this.useEnterToSend=e;})),this.subscribeToInviteEvents(),this.subscribeToMessageRestore();}ngAfterViewInit(){this.adjustTextareaHeight(),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),200);});}ngOnChanges(e){e.isThinking&&(e.isThinking.currentValue?this.startThinkingAnimation():(this.stopThinkingAnimation(),this.isStopping=false,e.isThinking.previousValue&&(console.log("[CHAT-TEXTAREA] Thinking ended, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100);})))),e.isSessionInitializing&&!e.isSessionInitializing.currentValue&&e.isSessionInitializing.previousValue&&(console.log("[CHAT-TEXTAREA] Session initialization completed, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100);})),e.isStarting&&!e.isStarting.currentValue&&e.isStarting.previousValue&&this.isThinking&&(this.thinkingPhraseIndex===0?(console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index 0 - restarting animation"),this.stopThinkingAnimation(),this.startThinkingAnimation()):console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index",this.thinkingPhraseIndex,"- continuing without restart"));}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),this.subscriptions=[],this.clearPendingLineBreaks(),this.stopThinkingAnimation();}onKeyDown(e){if(this.autocompleteVisible)switch(e.key){case "ArrowDown":e.preventDefault(),this.selectedAutocompleteIndex=Math.min(this.selectedAutocompleteIndex+1,this.autocompleteItems.length-1),this.scrollSelectedItemIntoView();return;case "ArrowUp":e.preventDefault(),this.selectedAutocompleteIndex=Math.max(this.selectedAutocompleteIndex-1,0),this.scrollSelectedItemIntoView();return;case "Tab":case "Enter":if(!this.message.includes(" ")){e.preventDefault(),this.selectAutocompleteItem();return}break;case "Escape":e.preventDefault(),this.hideAutocomplete();return}e.key==="Enter"&&(this.useEnterToSend?!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),this.sendMessage(true)):(navigator.platform.toLowerCase().includes("mac")?e.metaKey:e.ctrlKey)&&!e.shiftKey&&(e.preventDefault(),this.sendMessage(true)));}onInput(){this.adjustTextareaHeight(),this.checkForAutocomplete();}onPaste(e){let t=e.clipboardData?.items;if(!t)return;let n=Array.from(t).filter(r=>r.kind==="file");if(!n.length)return;e.preventDefault();let o=n.reduce((r,d)=>{let v=d.getAsFile();return v?[...r,v]:r},[]);o.length&&this.filesPasted.emit(o);}triggerFileUpload(){console.log("[CHAT-TEXTAREA] Triggering file upload"),this.fileInput?.nativeElement?.click();}onFileInputChange(e){let t=e.target,n=t.files;if(!n||n.length===0){console.log("[CHAT-TEXTAREA] No files selected");return}console.log("[CHAT-TEXTAREA] Files selected:",n.length);let o=Array.from(n);this.filesPasted.emit(o),t.value="";}onDocumentClick(e){if(!this.autocompleteVisible)return;let t=e.target,n=document.querySelector(".autocomplete-popup"),o=this.messageInput?.nativeElement;n&&!n.contains(t)&&o&&!o.contains(t)&&this.hideAutocomplete();}sendMessage(e=false){let t=this.message.trim();!this.isDisabled&&(e||t)&&(this.isRecording&&this.recognition&&(this.clearPendingLineBreaks(),this.recognition.stop()),this.messageSubmitted.emit(t),this.message="",setTimeout(()=>this.adjustTextareaHeight(),0));}onStopClick(){this.isStopping=true,this.stopRequested.emit();}toggleRecording(){this.isRecording?this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.stopWhisperRecording():this.stopRecording():this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.startWhisperRecording():this.startRecording();}startWhisperRecording(){return B(this,null,function*(){if(!this.isRecording)try{let e=yield navigator.mediaDevices.getUserMedia({audio:!0});this.audioChunks=[],this.mediaRecorder=new MediaRecorder(e),this.mediaRecorder.ondataavailable=t=>{t.data.size>0&&this.audioChunks.push(t.data);},this.mediaRecorder.onstop=()=>{e.getTracks().forEach(t=>t.stop()),this.processWhisperAudio();},this.mediaRecorder.onerror=t=>{console.error("[WHISPER] MediaRecorder error:",t),e.getTracks().forEach(n=>n.stop()),this.isRecording=!1,this.voiceRecordingToggled.emit(!1);},this.mediaRecorder.start(),this.isRecording=!0,this.voiceRecordingToggled.emit(!0),console.log("[WHISPER] Started recording");}catch(e){console.error("[WHISPER] Failed to start recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(false);}})}stopWhisperRecording(){if(!(!this.mediaRecorder||!this.isRecording))try{this.mediaRecorder.stop(),this.isRecording=!1,this.voiceRecordingToggled.emit(!1),console.log("[WHISPER] Stopped recording");}catch(e){console.error("[WHISPER] Failed to stop recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(false);}}processWhisperAudio(){if(this.audioChunks.length===0)return;let e=new Blob(this.audioChunks,{type:this.mediaRecorder?.mimeType||"audio/webm"}),t=e.type.split(";")[0]||"audio/webm";this.audioChunks=[],this.isTranscribing=true;let n=new FileReader;n.onloadend=()=>{let o=n.result.split(",")[1];if(!o){console.error("[WHISPER] Failed to read audio as base64"),this.isTranscribing=false;return}let d=this.preferencesService.getVoiceLanguage().split("-")[0];if(this.voiceInputMode==="voice-message"){if(!this.threadStateService.getSelectedThreadId()){console.log("[WHISPER] No thread selected \u2014 emitting voiceMessageReady for thread creation"),this.isTranscribing=false,this.voiceMessageReady.emit({base64:o,mimeType:t,language:d});return}this.audioApiService.sendVoiceMessage(o,t,d).subscribe({next:v=>{this.isTranscribing=false,console.log("[WHISPER] Voice message sent, transcription:",v.transcription?.substring(0,50));},error:v=>{console.error("[WHISPER] Voice message error:",v),this.isTranscribing=false,this.fallbackToTranscription(o,t,d);}});}else this.audioApiService.transcribeAudio(o,t,d).subscribe({next:v=>{this.isTranscribing=false,v.text&&this.appendToTextarea(v.text+" ");},error:v=>{console.error("[WHISPER] Transcription error:",v),this.isTranscribing=false;}});},n.readAsDataURL(e);}fallbackToTranscription(e,t,n){this.audioApiService.transcribeAudio(e,t,n).subscribe({next:o=>{this.isTranscribing=false,o.text&&this.appendToTextarea(o.text+" ");},error:o=>{console.error("[WHISPER] Fallback transcription also failed:",o),this.isTranscribing=false;}});}initializeVoiceInput(){let e=window.SpeechRecognition??window.webkitSpeechRecognition;if(console.log("[SPEECH] speechRecognition",e),!e){console.warn("[SPEECH] Speech Recognition API not available");return}this.recognition=new e,this.recognition.continuous=true,this.recognition.interimResults=true,this.recognition.maxAlternatives=1,this.recognition.lang=this.getSelectedLanguage();try{"grammars"in this.recognition&&(this.recognition.serviceURI=void 0);}catch(t){console.log("[SPEECH] Advanced speech recognition parameters not supported");}this.recognition.onresult=t=>{let n="",o=Math.max(t.resultIndex,this.lastProcessedResultIndex);for(let r=o;r<t.results.length;r++)t.results[r].isFinal&&(n+=t.results[r][0].transcript,this.lastProcessedResultIndex=r+1);if(n){let r=this.improveTranscriptPunctuation(n.trim());this.sessionHadTranscript=true,console.log("[SPEECH] onresult ending, appending to textarea",this.isRecording),this.appendToTextarea(r);}},this.recognition.onend=()=>{console.log("[SPEECH] Recognition ended. Was recording:",this.isRecording),this.isRecording=false,this.lastProcessedResultIndex=0,this.voiceRecordingToggled.emit(this.isRecording);},this.recognition.onerror=t=>{console.error("[SPEECH] Speech recognition error:",t.error),console.log("[SPEECH] Error details:",{error:t.error,message:t.message,timeStamp:t.timeStamp}),this.isRecording=false,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording);},this.recognition.onstart=()=>{console.log("[SPEECH] Recognition started successfully");},this.recognition.onspeechstart=()=>{console.log("[SPEECH] Speech detected");},this.recognition.onspeechend=()=>{console.log("[SPEECH] Speech ended");};}startRecording(){return B(this,null,function*(){if(!(!this.recognition||this.isRecording))try{this.isRecording=!0,this.sessionHadTranscript=!1,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording),this.recognition.start(),console.log("[SPEECH] Started recording");}catch(e){console.error("[SPEECH] Failed to start recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(this.isRecording);}})}stopRecording(){if(!this.recognition||!this.isRecording){console.log("[SPEECH] stopRecording not recording");return}try{console.log("[SPEECH] stopRecording recognition stop"),this.recognition.stop(),this.schedulePendingLineBreaks();}catch(e){console.error("[SPEECH] Failed to stop recording:",e);}}getSelectedLanguage(){return this.preferencesService.getVoiceLanguage()}updateRecognitionLanguage(){if(this.recognition){let e=this.getSelectedLanguage();this.recognition.lang=e,console.log("[SPEECH] Language changed to:",e);}}improveTranscriptPunctuation(e){let t=e;return /[.!?]$/.test(t.trim())||(t=t.trim()+"."),t=t.charAt(0).toUpperCase()+t.slice(1),t=t.replace(/\s+/g," "),t=t+" ",t}appendToTextarea(e){let t=this.message;if(this.message=t?`${t}${e}`:e,this.messageInput?.nativeElement){this.messageInput.nativeElement.focus();let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n);}setTimeout(()=>this.adjustTextareaHeight(),0);}schedulePendingLineBreaks(){this.clearPendingLineBreaks(),this.pendingLineBreaksTimeout=window.setTimeout(()=>{this.sessionHadTranscript&&(console.log("[SPEECH] Adding line breaks after transcript session"),this.appendToTextarea(`
|
|
2
2
|
|
|
3
3
|
`),this.sessionHadTranscript=false),this.pendingLineBreaksTimeout=null;},500);}clearPendingLineBreaks(){this.pendingLineBreaksTimeout&&(clearTimeout(this.pendingLineBreaksTimeout),this.pendingLineBreaksTimeout=null);}adjustTextareaHeight(){let e=this.messageInput?.nativeElement;if(!e)return;let t=e.parentElement?.offsetHeight??e.offsetHeight+32;this.heightChanged.emit(t);}getSendButtonShortcut(){return this.useEnterToSend?"Enter":navigator.platform.toLowerCase().includes("mac")?"\u2318+Enter":"Ctrl+Enter"}getSendButtonTooltip(){return this.useEnterToSend?"Send message (Enter) - Shift+Enter for new line":`Send message (${navigator.platform.toLowerCase().includes("mac")?"Cmd+Enter":"Ctrl+Enter"}) - Enter for new line`}getPlaceholder(){return this.isSessionInitializing?"Initializing session...":this.isThinking?this.isStopping?"Stopping...":this.isStarting?"Processing request...":this.currentThinkingPhrase:this.isVoiceMessageMode&&this.isTranscribing?"Uploading...":this.isVoiceMessageMode&&this.isRecording?"Listening...":this.showWelcome?"How can I help you today?":"Type '@' for agents, '/' for commands, or just your message..."}startThinkingAnimation(){this.thinkingPhraseIndex=0,this.currentThinkingPhrase=this.thinkingPhrases[0]??"Thinking...",this.thinkingInterval=window.setInterval(()=>{this.thinkingPhraseIndex<this.thinkingPhrases.length-1&&(this.thinkingPhraseIndex++,this.currentThinkingPhrase=this.thinkingPhrases[this.thinkingPhraseIndex]??"Thinking...");},2e3);}stopThinkingAnimation(){this.thinkingInterval&&(clearInterval(this.thinkingInterval),this.thinkingInterval=null),this.thinkingPhraseIndex=0,this.currentThinkingPhrase="Thinking...";}subscribeToInviteEvents(){this.subscriptions.push(this.codayService.currentInviteEvent$.subscribe(e=>{e?this.handleInviteEvent(e.invite,e.defaultValue):this.currentInvite="";}));}handleInviteEvent(e,t){this.currentInvite=e,t&&(this.message=t,setTimeout(()=>this.adjustTextareaHeight(),0)),setTimeout(()=>{this.messageInput?.nativeElement&&this.messageInput.nativeElement.focus();},50);}subscribeToMessageRestore(){this.subscriptions.push(this.codayService.messageToRestore$.subscribe(e=>{e.trim()&&(console.log("[CHAT-TEXTAREA] Restoring message content:",e.substring(0,50)+"..."),this.restoreMessageContent(e));}));}restoreMessageContent(e){this.message=e,this.messageInput?.nativeElement&&(this.messageInput.nativeElement.focus(),setTimeout(()=>{let t=this.messageInput.nativeElement,n=this.message.length;t.setSelectionRange(n,n);},0)),setTimeout(()=>this.adjustTextareaHeight(),10);}focusTextarea(){let e=this.messageInput?.nativeElement;console.log("[CHAT-TEXTAREA] focusTextarea called",{hasElement:!!e,isDisabled:this.isDisabled,isThinking:this.isThinking,elementDisabled:e?.disabled,isSessionInitializing:this.isSessionInitializing}),e&&!e.disabled?(e.focus(),console.log("[CHAT-TEXTAREA] Textarea focused successfully")):console.log("[CHAT-TEXTAREA] Focus blocked - element disabled or not available");}checkForAutocomplete(){let e=this.message;if(e.startsWith("@")){let t=e.substring(1);if(t.includes(" ")){this.hideAutocomplete();return}this.showAgentAutocomplete(t);return}if(e.startsWith("/")){let t=e.substring(1);if(t.includes(" ")){this.hideAutocomplete();return}this.showPromptAutocomplete(t);return}this.hideAutocomplete();}showAgentAutocomplete(e){this.autocompleteTrigger="@";try{let t=this.projectStateService.getSelectedProjectIdOrThrow();this.agentApiService.getAgentsAutocomplete(t,e).subscribe({next:n=>{this.autocompleteItems=n,this.autocompleteVisible=n.length>0,this.selectedAutocompleteIndex=0;},error:n=>{console.error("[AUTOCOMPLETE] Error loading agents:",n),this.hideAutocomplete();}});}catch(t){console.warn("[AUTOCOMPLETE] No project selected, cannot load agents"),this.hideAutocomplete();}}showPromptAutocomplete(e){this.autocompleteTrigger="/";try{let t=this.projectStateService.getSelectedProjectIdOrThrow();this.promptApiService.getPromptsAutocomplete(t,e).subscribe({next:n=>{this.autocompleteItems=n,this.autocompleteVisible=n.length>0,this.selectedAutocompleteIndex=0;},error:n=>{console.error("[AUTOCOMPLETE] Error loading prompts:",n),this.hideAutocomplete();}});}catch(t){console.warn("[AUTOCOMPLETE] No project selected, cannot load prompts"),this.hideAutocomplete();}}hideAutocomplete(){this.autocompleteVisible=false,this.autocompleteItems=[],this.selectedAutocompleteIndex=0;}selectAutocompleteItem(){let e=this.autocompleteItems[this.selectedAutocompleteIndex];if(!e)return;let t=null;if(this.autocompleteTrigger==="/"){let n=e,o=n.parameterFormat;if(console.log(n),o===void 0)this.message=`/${e.name}`;else if(o==="")this.message=`/${e.name} `;else {this.message=`/${e.name} ${o}`;let r=this.message.indexOf('=""');r!==-1&&(t=r+2);}}else this.message=`@${e.name} `;this.hideAutocomplete(),setTimeout(()=>{if(this.messageInput?.nativeElement)if(this.messageInput.nativeElement.focus(),t!==null)this.messageInput.nativeElement.setSelectionRange(t,t);else {let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n);}},0);}selectAutocompleteItemByClick(e){this.selectedAutocompleteIndex=e,this.selectAutocompleteItem();}getAutocompleteQuery(){return this.message.substring(1).split(" ")[0]??""}getParameterFormat(e){return e.parameterFormat}hasParameterFormat(e){return this.autocompleteTrigger==="/"&&e.parameterFormat!==void 0}scrollSelectedItemIntoView(){setTimeout(()=>{let e=document.querySelector(".autocomplete-popup");if(!e)return;let t=e.querySelector(".autocomplete-item.selected");t&&t.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"});},0);}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=xw({type:i,selectors:[["app-chat-textarea"]],viewQuery:function(t,n){if(t&1&&Pg(yi,7)(wi,5),t&2){let o;EC(o=IC())&&(n.messageInput=o.first),EC(o=IC())&&(n.fileInput=o.first);}},hostBindings:function(t,n){t&1&&Rg("paste",function(r){return n.onPaste(r)})("click",function(r){return n.onDocumentClick(r)},dE);},inputs:{isDisabled:"isDisabled",showWelcome:"showWelcome",isThinking:"isThinking",isStarting:"isStarting",isSessionInitializing:"isSessionInitializing"},outputs:{filesPasted:"filesPasted",messageSubmitted:"messageSubmitted",voiceMessageReady:"voiceMessageReady",voiceRecordingToggled:"voiceRecordingToggled",heightChanged:"heightChanged",stopRequested:"stopRequested",textareaFocused:"textareaFocused"},features:[Tu],decls:8,vars:15,consts:[["messageInput",""],["fileInput",""],[1,"chat-input-container"],[1,"recording-indicator"],[1,"autocomplete-popup"],[1,"input-row","grouped-input"],[1,"message-input",3,"ngModelChange","keydown","input","focus","blur","ngModel","placeholder","disabled"],[1,"actions"],[1,"recording-dot"],[1,"transcribing-dot"],["role","option","tabindex","0",1,"autocomplete-item",3,"selected"],["role","option","tabindex","0",1,"autocomplete-item",3,"click","keydown.enter","keydown.space","mouseenter"],[1,"item-name"],[3,"innerHTML"],[1,"parameter-format"],[1,"item-description",3,"innerHTML"],["icon","stop","variant","danger","title","Stop generation",1,"action-btn"],["icon","send","variant","primary",1,"send-btn",3,"title","disabled","hidden","active"],["icon","stop","variant","danger","title","Stop generation",1,"action-btn",3,"action"],["icon","send","variant","primary",1,"send-btn",3,"action","title","disabled"],["icon","mic",1,"voice-btn",3,"action","variant","disabled","title"],["icon","attach_file","variant","default","title","Upload files (images or documents)",1,"upload-btn",3,"action","disabled"],["type","file","multiple","","accept","image/*,application/pdf,.pdf,.doc,.docx,.txt,.md,.json,.yaml,.yml,.csv,.xml,.html",2,"display","none",3,"change"]],template:function(t,n){if(t&1){let o=lC();ws(0,"div",2),Jw(1,Si,3,0,"div",3),Jw(2,Mi,3,0,"div",3),Jw(3,Pi,3,0,"div",4),ws(4,"div",5)(5,"textarea",6,0),tm("ngModelChange",function(d){return If(o),KC(n.message,d)||(n.message=d),wf(d)}),Rg("keydown",function(d){return n.onKeyDown(d)})("input",function(){return n.onInput()})("focus",function(){return If(o),n.isFocused=true,wf(n.textareaFocused.emit())})("blur",function(){return n.isFocused=false}),pl(),VI(),Jw(7,Fi,4,3,"div",7),pl()();}t&2&&(XE(),eC(!n.isVoiceMessageMode&&n.isRecording?1:-1),XE(),eC(!n.isVoiceMessageMode&&n.isTranscribing?2:-1),XE(),eC(n.autocompleteVisible?3:-1),XE(),Ug("focused",n.isFocused)("welcome-mode",n.showWelcome)("is-thinking",n.isThinking)("is-listening",n.isVoiceMessageMode&&(n.isRecording||n.isTranscribing)),XE(),em("ngModel",n.message),bg("placeholder",n.getPlaceholder())("disabled",n.isDisabled||n.isVoiceMessageMode&&(n.isRecording||n.isTranscribing)),UI(),XE(2),eC(n.isSessionInitializing?-1:7));},dependencies:[ti$1,Ye,Zn$1,cn,Se$1,ot],styles:['@keyframes _ngcontent-%COMP%_gradientBorderShift{0%{background-position:0 0}50%{background-position:100% 0}to{background-position:0 0}}.chat-input-container[_ngcontent-%COMP%]{flex-shrink:0;width:100%;position:relative}.thinking-progress[_ngcontent-%COMP%]{position:absolute;top:0;left:0;right:0;height:3px;z-index:1}.thinking-progress[_ngcontent-%COMP%] .mdc-linear-progress__bar-inner{border-top-width:3px}.input-row.grouped-input[_ngcontent-%COMP%]{display:flex;align-items:stretch;background:var(--glass-bg);border-radius:16px;padding:0 .15rem 0 1.25rem;position:relative;transition:border-color .2s,box-shadow .2s,background .3s}.input-row[_ngcontent-%COMP%]{position:relative;background:var(--glass-bg, #1e1e1e)!important;background-clip:padding-box}.input-row[_ngcontent-%COMP%]:before{content:"";position:absolute;inset:-2px;border-radius:inherit;background-size:200% 100%;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);-webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask-composite:exclude;padding:1px;pointer-events:none;z-index:-1;animation:_ngcontent-%COMP%_gradientBorderShift 3s ease-in-out infinite}.input-row.is-listening[_ngcontent-%COMP%]:before{inset:0;-webkit-mask:none;mask:none;padding:0;opacity:.15;z-index:0;background:linear-gradient(90deg,var(--color-error, #ef4444) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-error, #ef4444) 100%);background-size:200% 100%;animation:_ngcontent-%COMP%_gradientBorderShift 2s ease-in-out infinite}.input-row.is-listening[_ngcontent-%COMP%] .message-input[_ngcontent-%COMP%], .input-row.is-listening[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{position:relative;z-index:1}.input-row.is-thinking[_ngcontent-%COMP%]:before{inset:0;-webkit-mask:none;mask:none;padding:0;opacity:.15;z-index:0;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% 100%;animation:_ngcontent-%COMP%_gradientBorderShift 3s ease-in-out infinite}.input-row.is-thinking[_ngcontent-%COMP%] .message-input[_ngcontent-%COMP%], .input-row.is-thinking[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{position:relative;z-index:1}.input-row.grouped-input.focused[_ngcontent-%COMP%]:not(.is-thinking):before{background:var(--color-primary);animation:none}.input-row.grouped-input.focused[_ngcontent-%COMP%]:not(.is-thinking){box-shadow:0 0 0 4px #007aff1a}.message-input[_ngcontent-%COMP%]{flex:1;border:none;outline:none;background:transparent!important;box-shadow:none;font-size:1rem;padding:1rem 0;color:var(--color-text);resize:none;field-sizing:content;min-height:36px;max-height:70vh;overflow-y:auto;font-family:-apple-system,BlinkMacSystemFont,SF Pro Display,system-ui,sans-serif;line-height:1.5}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar{width:8px}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:4px}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:var(--color-text-secondary)}.message-input[_ngcontent-%COMP%]:focus{outline:none;border:none;box-shadow:none}.message-input[_ngcontent-%COMP%]:disabled{background-color:var(--color-bg-secondary);color:var(--color-text-secondary);cursor:not-allowed;opacity:.6}.message-input[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary);transition:opacity .3s ease-in-out}.message-input[_ngcontent-%COMP%]:disabled::placeholder{animation:_ngcontent-%COMP%_thinkingPulsate 2s ease-in-out infinite}@keyframes _ngcontent-%COMP%_thinkingPulsate{0%,to{opacity:.6}50%{opacity:1}}.voice-btn[_ngcontent-%COMP%], .send-btn[_ngcontent-%COMP%], .action-btn[_ngcontent-%COMP%], .upload-btn[_ngcontent-%COMP%]{margin:0}.actions[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex-wrap:wrap;justify-content:center}.send-btn[_ngcontent-%COMP%]{transition:opacity .4s,margin-left .4s}.send-btn.active[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{opacity:1}.send-btn[_ngcontent-%COMP%]:not(.active) button[_ngcontent-%COMP%]{opacity:0;margin-left:calc(-.5rem - 36px)}.send-btn[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover:not(:disabled){color:#fff;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-primary, #3b82f6) 20%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 80%,var(--color-primary, #3b82f6) 100%);background-size:300% auto;animation:sendButtonGradientShift 6s ease-in-out infinite;box-shadow:0 4px 14px #007aff30;transform:scale(1.2)}.send-btn[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:active:not(:disabled){transform:scale(1.3);box-shadow:0 4px 24px #007aff30}.recording-indicator[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-top:.2rem;margin-bottom:.2rem;color:var(--color-error, #ff5555);font-size:.9rem;position:absolute;top:-1.5rem}@keyframes _ngcontent-%COMP%_pulse{0%,to{opacity:1}50%{opacity:.5}}.autocomplete-popup[_ngcontent-%COMP%]{position:absolute;bottom:100%;left:0;right:0;margin-bottom:.5rem;background:var(--glass-bg);-webkit-backdrop-filter:var(--glass-backdrop-blur);backdrop-filter:var(--glass-backdrop-blur);border-radius:12px;box-shadow:0 8px 32px #00000026;border:1px solid var(--color-border);max-height:400px;max-width:500px;overflow-y:auto;z-index:100}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar{width:8px}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:4px}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:var(--color-text-secondary)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%]{padding:.75rem 1rem;cursor:pointer;transition:background .2s;border-left:3px solid transparent}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%]:hover, .autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item.selected[_ngcontent-%COMP%]{background:var(--color-bg-hover)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item.selected[_ngcontent-%COMP%]{border-left-color:var(--color-primary)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%]{font-weight:600;color:var(--color-text);margin-bottom:.25rem;font-family:SF Mono,Monaco,Menlo,Cascadia Code,Consolas,monospace;font-size:.95rem}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%] strong{font-weight:700;color:var(--color-primary);background:var(--color-primary-light, rgba(99, 102, 241, .1));padding:0 2px;border-radius:2px}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%] .parameter-format[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-weight:400;opacity:.7}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-description[_ngcontent-%COMP%]{font-size:.85rem;color:var(--color-text-secondary);line-height:1.3}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-description[_ngcontent-%COMP%] strong{font-weight:700;color:var(--color-primary);background:var(--color-primary-light, rgba(99, 102, 241, .1))}@media print{.thinking-progress[_ngcontent-%COMP%], .action-btn[_ngcontent-%COMP%], .voice-btn[_ngcontent-%COMP%], .send-btn[_ngcontent-%COMP%], .upload-btn[_ngcontent-%COMP%], .recording-indicator[_ngcontent-%COMP%], .autocomplete-popup[_ngcontent-%COMP%]{display:none!important}}'],changeDetection:1})};var Ce=class i{unreadCountSubject=new Tr$1(0);unreadCount$=this.unreadCountSubject.asObservable();constructor(){console.log("[UNREAD] Service initialized");}addUnread(){let t=this.unreadCountSubject.value+1;this.unreadCountSubject.next(t),console.log("[UNREAD] Added unread message, total:",t);}markAllAsRead(){this.unreadCountSubject.value>0&&(this.unreadCountSubject.next(0),console.log("[UNREAD] Marked all messages as read"));}getCurrentCount(){return this.unreadCountSubject.value}reset(){this.unreadCountSubject.next(0),console.log("[UNREAD] Counter reset");}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var at=class i{ATTENTION_EMOJI="\u{1F534}";isSystemActive=false;systemActiveTimer=null;SYSTEM_ACTIVE_TIMEOUT=4e3;unreadService=g(Ce);project=g(P$1);constructor(){this.initializeTitleUpdates();}initializeTitleUpdates(){Ly([this.project.selectedProject$,this.unreadService.unreadCount$]).subscribe(([e,t])=>{this.updateTitle(e?.name??"...",t);});}updateTitle(e,t){let n;this.isSystemActive?n=`\u23F3${t>0?` (${t}) `:" "}${e}`:t>0?n=`${this.ATTENTION_EMOJI} (${t}) ${e}`:n=e,document.title=n,console.log("[TAB-TITLE] Updated to:",n);}setSystemActive(){console.log("[TAB-TITLE] System active - showing hourglass"),this.isSystemActive=true,this.systemActiveTimer&&clearTimeout(this.systemActiveTimer),this.systemActiveTimer=setTimeout(()=>{console.log("[TAB-TITLE] System active timeout - hiding hourglass"),this.isSystemActive=false,this.forceUpdateTitle();},this.SYSTEM_ACTIVE_TIMEOUT),this.forceUpdateTitle();}setSystemInactive(){console.log("[TAB-TITLE] System inactive - hiding hourglass"),this.isSystemActive=false,this.systemActiveTimer&&(clearTimeout(this.systemActiveTimer),this.systemActiveTimer=null),this.forceUpdateTitle();}forceUpdateTitle(){let e=this.project.getSelectedProjectId()??"...",t=this.unreadService.getCurrentCount();this.updateTitle(e,t);}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var st=class i{pendingFirstMessage=null;pendingVoiceMessage=null;setPendingFirstMessage(e){console.log("[FIRST-MESSAGE-STATE] Storing pending first message:",e.substring(0,50)+"..."),this.pendingFirstMessage=e;}consumePendingFirstMessage(){let e=this.pendingFirstMessage;return e?(console.log("[FIRST-MESSAGE-STATE] Consuming pending first message:",e.substring(0,50)+"..."),this.pendingFirstMessage=null):console.log("[FIRST-MESSAGE-STATE] No pending first message to consume"),e}setPendingVoiceMessage(e){console.log("[FIRST-MESSAGE-STATE] Storing pending voice message"),this.pendingVoiceMessage=e;}consumePendingVoiceMessage(){let e=this.pendingVoiceMessage;return e&&(console.log("[FIRST-MESSAGE-STATE] Consuming pending voice message"),this.pendingVoiceMessage=null),e}hasPendingFirstMessage(){return this.pendingFirstMessage!==null||this.pendingVoiceMessage!==null}clear(){this.pendingFirstMessage&&(console.log("[FIRST-MESSAGE-STATE] Clearing pending first message"),this.pendingFirstMessage=null),this.pendingVoiceMessage=null;}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var Ri=(i,e)=>e.label;function Hi(i,e){if(i&1){let t=lC();ws(0,"button",2),Rg("click",function(o){let r=If(t).$implicit,d=gC();return wf(d.executeAction(r,o))}),ws(1,"mat-icon"),GC(2),pl()();}if(i&2){let t=e.$implicit;Tg("title",t.tooltip||t.label),XE(),Tg("aria-label",t.label),XE(),Yg(t.icon);}}var ct=class i{actions=[];executeAction(e,t){t.stopPropagation(),e.action();}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=xw({type:i,selectors:[["app-message-context-menu"]],inputs:{actions:"actions"},decls:3,vars:0,consts:[[1,"context-menu-wrapper"],["mat-icon-button",""],["mat-icon-button","",3,"click"]],template:function(t,n){t&1&&(ws(0,"div",0),rC(1,Hi,3,3,"button",1,Ri),pl()),t&2&&(XE(),oC(n.actions));},dependencies:[qm,Gn$1,wt$1],styles:[".context-menu-wrapper[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center}.context-menu-wrapper[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{transform:scale(.75)}"],changeDetection:1})};var Z=class i{renderer;constructor(){this.renderer=new Ue$1,this.configureRenderer();}configureRenderer(){let e=this.renderer.link.bind(this.renderer);this.renderer.link=t=>{let n=this.isExternalLink(t.href),o=e(t);if(n){o=o.replace("<a ",'<a target="_blank" rel="noopener noreferrer" ');let r=t.title?`${t.text} - ${t.title} (opens in new tab)`:`${t.text} (opens in new tab)`;o=o.replace("<a ",`<a aria-label="${this.escapeHtml(r)}" `),o=o.replace("</a>",'<span class="external-link-icon" aria-hidden="true">\u2197</span></a>');}return o};}isExternalLink(e){if(!e||e.startsWith("/")||e.startsWith("#")||e.startsWith("?"))return false;if(e.startsWith("//"))return true;try{return new URL(e,window.location.href).hostname!==window.location.hostname}catch(t){return false}}escapeHtml(e){let t={"&":"&","<":"<",">":">",'"':""","'":"'"};return e.replace(/[&<>"']/g,n=>t[n]||n)}parse(e){return B(this,null,function*(){let t=yield x$2.parse(e,{renderer:this.renderer,breaks:true,gfm:true});return is.sanitize(t,{ADD_TAGS:["span"],ADD_ATTR:["aria-hidden","aria-label","target","rel"],ALLOWED_URI_REGEXP:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))/i})})}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var Vi=i=>({"user-message-wrapper":i});function Li(i,e){if(i&1&&(ws(0,"div",4)(1,"div",8),GC(2),pl()()),i&2){let t=gC(2);XE(2),vl(" ",t.message.speaker," ");}}function zi(i,e){if(i&1&&(ws(0,"time",6),GC(1),pl()),i&2){let t=gC(2);XE(),Yg(t.formattedTimestamp);}}function Ni(i,e){if(i&1&&(ws(0,"div",7),Sg(1,"app-message-context-menu",9),pl()),i&2){let t=gC(2);XE(),bg("actions",t.actions);}}function $i(i,e){if(i&1&&(Jw(0,Li,3,1,"div",4),Sg(1,"div",5),Jw(2,zi,2,1,"time",6),Jw(3,Ni,2,1,"div",7)),i&2){let t=gC();eC(t.shouldShowSpeaker?0:-1),XE(),bg("innerHTML",t.renderedContent,aE),XE(),eC(t.formattedTimestamp?2:-1),XE(),eC(t.isLongMessage&&t.shouldShowActions&&t.message.role==="assistant"?3:-1);}}function ji(i,e){if(i&1&&Sg(0,"span",12),i&2){let t=gC(3);bg("innerHTML",t.renderedContent,aE);}}function Ui(i,e){if(i&1&&(ws(0,"span",13),GC(1),pl()),i&2){let t=gC(3);XE(),Yg(t.collapsedErrorText);}}function Bi(i,e){i&1&&GC(0," Show less \u25B2 ");}function Wi(i,e){i&1&&GC(0," Show more \u25BC ");}function qi(i,e){if(i&1){let t=lC();ws(0,"div",10),Jw(1,ji,1,1,"span",12)(2,Ui,2,1,"span",13),ws(3,"button",14),Rg("click",function(){If(t);let o=gC(2);return wf(o.toggleErrorExpanded())}),Jw(4,Bi,1,0)(5,Wi,1,0),pl()();}if(i&2){let t=gC(2);XE(),eC(t.isErrorExpanded()?1:2),XE(3),eC(t.isErrorExpanded()?4:5);}}function Yi(i,e){i&1&&GC(0," \u25B2 ");}function Gi(i,e){i&1&&GC(0," \u25BC ");}function Qi(i,e){if(i&1&&(ws(0,"a",17),GC(1,"view"),pl()),i&2){let t=gC(3);bg("href",t.eventLink,yh);}}function Xi(i,e){if(i&1&&(ws(0,"pre",18),GC(1),pl()),i&2){let t=gC(3);XE(),Yg(t.message.fullContent);}}function Ki(i,e){if(i&1){let t=lC();ws(0,"div",15),Sg(1,"span",12),ws(2,"button",16),Rg("click",function(){If(t);let o=gC(2);return wf(o.toggleTechnicalExpanded())}),Jw(3,Yi,1,0)(4,Gi,1,0),pl(),Jw(5,Qi,2,1,"a",17),pl(),Jw(6,Xi,2,1,"pre",18);}if(i&2){let t=gC(2);XE(),bg("innerHTML",t.renderedContent,aE),XE(2),eC(t.isTechnicalExpanded()?3:4),XE(2),eC(t.eventLink?5:-1),XE(),eC(t.isTechnicalExpanded()?6:-1);}}function Ji(i,e){if(i&1&&(ws(0,"a",17),GC(1,"view"),pl()),i&2){let t=gC(3);bg("href",t.eventLink,yh);}}function Zi(i,e){if(i&1&&(ws(0,"div",11),Sg(1,"span",12),Jw(2,Ji,2,1,"a",17),pl()),i&2){let t=gC(2);XE(),bg("innerHTML",t.renderedContent,aE),XE(),eC(t.eventLink?2:-1);}}function eo(i,e){if(i&1&&Jw(0,qi,6,2,"div",10)(1,Ki,7,4)(2,Zi,3,2,"div",11),i&2){let t=gC();eC(t.message.type==="error"&&t.isLongError?0:t.message.type==="technical"&&t.message.fullContent?1:2);}}function to(i,e){if(i&1&&(ws(0,"div",2),Sg(1,"app-message-context-menu",9),pl()),i&2){let t=gC();XE(),bg("actions",t.actions);}}function no(i,e){if(i&1&&(ws(0,"div",3),Sg(1,"app-message-context-menu",9),pl()),i&2){let t=gC();XE(),bg("actions",t.actions);}}var ve=class i{destroy$=new ue;message;canDelete=true;isOtherUser=false;containingThreadId;copyRequested=new vt$1;deleteRequested=new vt$1;renderedContent="";shouldHideTechnical=false;shouldHideWarning=false;isErrorExpanded=Gi$1(false);static ERROR_COLLAPSE_LINE_THRESHOLD=5;isTechnicalExpanded=Gi$1(false);sanitizer=g(bS);notificationService=g(s);preferencesService=g(L);projectState=g(P$1);threadState=g(U);markdownService=g(Z);get messageClasses(){return {[this.message.role]:true,[this.message.type]:true,"hidden-technical":this.shouldHideTechnical&&this.message.type==="technical","hidden-warning":this.shouldHideWarning&&this.message.type==="warning","other-user":this.isOtherUser}}ngOnInit(){return B(this,null,function*(){yield this.renderMarkdown(),this.preferencesService.hideTechnicalMessages$.pipe(Cd(this.destroy$)).subscribe(e=>{this.shouldHideTechnical=e;}),this.preferencesService.hideWarningMessages$.pipe(Cd(this.destroy$)).subscribe(e=>{this.shouldHideWarning=e;}),this.shouldHideTechnical=this.preferencesService.getHideTechnicalMessages(),this.shouldHideWarning=this.preferencesService.getHideWarningMessages();})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete();}get shouldShowSpeaker(){return this.message.role==="user"?this.isOtherUser||this.message.speaker.startsWith("@"):this.message.role==="assistant"}get shouldShowActions(){return this.message.role==="user"||this.message.role==="assistant"}get isSimplified(){return this.message.role!=="user"&&this.message.role!=="assistant"}datePipe=g(kb);get formattedTimestamp(){if(this.message.role!=="user"||!this.message.timestamp)return null;let e=new Date().toDateString()===this.message.timestamp.toDateString();return this.datePipe.transform(this.message.timestamp,e?"HH:mm":"dd/MM HH:mm")}get isLongError(){return this.message.type!=="error"?false:this.extractTextContent().split(/\n|\\n/).length>i.ERROR_COLLAPSE_LINE_THRESHOLD}get collapsedErrorText(){return this.extractTextContent().split(/\n|\\n/).slice(0,i.ERROR_COLLAPSE_LINE_THRESHOLD).join(`
|
|
4
4
|
`)+"\u2026"}toggleErrorExpanded(){this.isErrorExpanded.update(e=>!e);}toggleTechnicalExpanded(){this.isTechnicalExpanded.update(e=>!e);}get isLongMessage(){let e=this.extractTextContent();return e.length>1e3||e.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,F,C as Ce,dg as k,aJ as Tr,G as Gi,bS as Ea,r as re,b as U,e as xw,aK as xb,k as ws,bf as aT,q as Rg,o as pl,af as Eg,t as CC,u as bg,bg as uT,ah as rT,cb as ZB,cc as qB,m as mT,n as GC,J as Jw,X as XE,a8 as Yg,v as eC,ac as gC,T as Tg,a5 as vl,a9 as lC,aa as If,ab as wf,ag as fT}from'./main-
|
|
1
|
+
import {g,F,C as Ce,dg as k,aJ as Tr,G as Gi,bS as Ea,r as re,b as U,e as xw,aK as xb,k as ws,bf as aT,q as Rg,o as pl,af as Eg,t as CC,u as bg,bg as uT,ah as rT,cb as ZB,cc as qB,m as mT,n as GC,J as Jw,X as XE,a8 as Yg,v as eC,ac as gC,T as Tg,a5 as vl,a9 as lC,aa as If,ab as wf,ag as fT}from'./main-DB5EJGYC.js';import {$ as $n,S as Se,G as Gn,c as ni}from'./chunk-aMjpfW4c.js';import'./chunk-D-FNlEoa.js';import'./chunk-BLaIJYTj.js';function J(i,t){if(i&1&&(ws(0,"span",4),GC(1),pl()),i&2){let e=gC();Tg("data-variant",e.badge().variant)("aria-label",e.badge().ariaLabel),XE(),vl(" ",e.badge().label," ");}}function Q(i,t){if(i&1&&(ws(0,"span",6),GC(1),pl()),i&2){let e=gC();XE(),Yg(e.config().baseUrl);}}function X(i,t){if(i&1){let e=lC();ws(0,"span",8),GC(1,"Delete?"),pl(),ws(2,"ds-icon-button",9),Rg("action",function(){If(e);let o=gC();return wf(o.onDeleteConfirmed())}),pl(),ws(3,"ds-icon-button",10),Rg("action",function(){If(e);let o=gC();return wf(o.onDeleteCancelled())}),pl();}}function Y(i,t){if(i&1){let e=lC();ws(0,"ds-kebab-menu",13),Rg("itemSelected",function(o){If(e);let g=gC(2);return wf(g.onMenuAction(o))}),pl();}if(i&2){let e=gC(2);bg("items",e.menuItems());}}function Z(i,t){if(i&1){let e=lC();ws(0,"ds-icon-button",11),Rg("action",function(){If(e);let o=gC();return wf(o.onDuplicate())}),pl(),Jw(1,Y,1,1,"ds-kebab-menu",12);}if(i&2){let e=gC();XE(),eC(e.readOnly()?-1:1);}}var ee=Object.freeze({platform:{label:"PLATFORM",ariaLabel:"Configuration de niveau plateforme (lecture seule)",variant:"neutral"},namespace:{label:"NS",ariaLabel:"Configuration partag\xE9e du namespace",variant:"neutral"},userOnNs:{label:"USER \xD7 NS",ariaLabel:"Configuration utilisateur sur ce namespace",variant:"info"},userGlobal:{label:"USER GLOBAL",ariaLabel:"Configuration utilisateur globale",variant:"warning"}}),A=class i{config=ZB.required();scope=ZB.required();readOnly=ZB(false);showBadge=ZB(true);editRequested=qB();deleteRequested=qB();duplicateRequested=qB();pendingDelete=Gi(false);badge=mT(()=>ee[this.scope()]);menuItems=mT(()=>[{key:"edit",label:"Edit provider",icon:"edit"},{key:"delete",label:"Delete provider",icon:"delete",variant:"danger"}]);onMenuAction(t){switch(t){case "edit":this.editRequested.emit(this.config());break;case "delete":this.pendingDelete.set(true);break}}onDuplicate(){this.duplicateRequested.emit(this.config());}onDeleteConfirmed(){this.pendingDelete.set(false),this.deleteRequested.emit(this.config());}onDeleteCancelled(){this.pendingDelete.set(false);}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=xw({type:i,selectors:[["agentos-ai-provider-item"]],inputs:{config:[1,"config"],scope:[1,"scope"],readOnly:[1,"readOnly"],showBadge:[1,"showBadge"]},outputs:{editRequested:"editRequested",deleteRequested:"deleteRequested",duplicateRequested:"duplicateRequested"},decls:12,vars:5,consts:[["role","listitem","dsBlueprint","",1,"ai-provider-item"],[1,"ai-provider-item__body"],[1,"ai-provider-item__heading"],[1,"ai-provider-item__name"],[1,"ai-provider-item__badge"],[1,"ai-provider-item__type"],[1,"ai-provider-item__url"],[1,"ai-provider-item__actions"],[1,"ai-provider-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],["icon","content_copy","title","Duplicate this provider",3,"action"],[3,"items"],[3,"itemSelected","items"]],template:function(e,n){e&1&&(ws(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),GC(4),pl(),Jw(5,J,2,3,"span",4),pl(),ws(6,"span",5),GC(7),pl(),Jw(8,Q,2,1,"span",6),pl(),ws(9,"div",7),Jw(10,X,4,0)(11,Z,2,1),pl()()),e&2&&(XE(4),Yg(n.config().name),XE(),eC(n.showBadge()?5:-1),XE(2),Yg(n.config().apiType),XE(),eC(n.config().baseUrl?8:-1),XE(2),eC(n.pendingDelete()?10:11));},dependencies:[Gn,ni,Se],styles:[".ai-provider-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}.ai-provider-item[_ngcontent-%COMP%]:hover{border-color:var(--color-accent)}.ai-provider-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.ai-provider-item__heading[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;min-width:0}.ai-provider-item__name[_ngcontent-%COMP%]{font-size:15px;font-weight:600;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}.ai-provider-item__badge[_ngcontent-%COMP%]{flex-shrink:0;font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;border-radius:0;padding:.1rem .4rem;line-height:1.2;white-space:nowrap}.ai-provider-item__badge[data-variant=neutral][_ngcontent-%COMP%]{border:1px solid var(--color-divider);color:var(--color-neutral-600);background:transparent}.ai-provider-item__badge[data-variant=info][_ngcontent-%COMP%]{border:1px solid color-mix(in srgb,var(--color-info) 40%,transparent);color:var(--color-info);background:color-mix(in srgb,var(--color-info) 10%,transparent)}.ai-provider-item__badge[data-variant=warning][_ngcontent-%COMP%]{border:1px solid color-mix(in srgb,var(--color-warning) 40%,transparent);color:var(--color-warning);background:color-mix(in srgb,var(--color-warning) 10%,transparent)}.ai-provider-item__type[_ngcontent-%COMP%], .ai-provider-item__url[_ngcontent-%COMP%]{font-size:13px;color:var(--color-text-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ai-provider-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.ai-provider-item[_ngcontent-%COMP%]:hover .ai-provider-item__actions[_ngcontent-%COMP%], .ai-provider-item[_ngcontent-%COMP%]:focus-within .ai-provider-item__actions[_ngcontent-%COMP%]{opacity:1}.ai-provider-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}"]})};var te=()=>[];function ie(i,t){if(i&1){let e=lC();ws(0,"agentos-ai-provider-item",4),Rg("editRequested",function(o){If(e);let g=gC(2);return wf(g.onEdit(o))})("deleteRequested",function(o){If(e);let g=gC(2);return wf(g.onDelete(o))}),pl();}i&2&&bg("config",t)("showBadge",false);}function ne(i,t){if(i&1&&Jw(0,ie,1,2,"agentos-ai-provider-item",3),i&2){let e,n=t.$implicit,o=gC();eC((e=o.resolveProvider(n.id))?0:-1,e);}}var K=class i{router=g(F);destroyRef=g(Ce);aiProviderController=g(k);refresh$=new Tr(void 0);isLoading=Gi(true);providers$=this.refresh$.pipe(Ea(()=>(this.isLoading.set(true),this.aiProviderController.listAiProvider("none"))));providerItems$=this.providers$.pipe(re(t=>t.map(e=>({id:e.id??"",name:e.name,description:e.apiType}))));providersById=new Map;constructor(){this.providers$.pipe(U(this.destroyRef)).subscribe({next:t=>{this.providersById=new Map(t.map(e=>[e.id??"",e])),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}goBack(){this.router.navigate(["/agentos","admin"]);}openCreateForm(){this.router.navigate(["/agentos","admin","ai-providers","new"]);}onEdit(t){t.id&&this.router.navigate(["/agentos","admin","ai-providers",t.id,"edit"]);}onDelete(t){t.id&&this.aiProviderController.deleteAiProvider(t.id).pipe(U(this.destroyRef)).subscribe(()=>this.refresh$.next());}resolveProvider(t){return this.providersById.get(t)??null}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=xw({type:i,selectors:[["agentos-platform-ai-providers"]],decls:5,vars:7,consts:[["aiProviderItemTpl",""],["title","Platform AI Providers","emptyMessage","No platform AI providers defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],["scope","namespace",3,"config","showBadge"],["scope","namespace",3,"editRequested","deleteRequested","config","showBadge"]],template:function(e,n){if(e&1&&(ws(0,"ds-entity-list",1),aT(1,"async"),Rg("createRequested",function(){return n.openCreateForm()}),ws(2,"ds-icon-button",2),Rg("action",function(){return n.goBack()}),pl()(),Eg(3,ne,1,1,"ng-template",null,0,fT)),e&2){let o=CC(4);bg("items",uT(1,4,n.providerItems$)??rT(6,te))("loading",n.isLoading())("showCreate",true)("itemTemplate",o);}},dependencies:[$n,A,Se,xb],styles:[".platform-ai-providers__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-providers__back[_ngcontent-%COMP%]:hover{color:var(--color-primary, #007aff)}"]})};export{K as PlatformAiProvidersComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {z}from'./chunk-
|
|
1
|
+
import {z}from'./chunk-DEcr5XTR.js';import {s}from'./chunk-CrU3BQQS.js';import {g as g$1,F,P,R as Re,C as Ce,a as F$1,m as mT,x,w,ae as kt,b as U,e as xw,j as Gn,$ as $t,k as ws,q as Rg,S as Sg,o as pl,af as Eg,ag as fT,t as CC,X as XE,u as bg,a9 as lC,aa as If,ac as gC,ab as wf,n as GC,ah as rT}from'./main-DB5EJGYC.js';import'./chunk-C2xbdglQ.js';import {$ as $n,o as ot}from'./chunk-aMjpfW4c.js';import'./chunk-D-FNlEoa.js';import {y as yt,w as wt}from'./chunk-BLaIJYTj.js';var ee=()=>[];function te(u,t){if(u&1){let o=lC();ws(0,"div",5)(1,"ds-entity-card",6),Rg("selected",function(r){If(o);let i=gC();return wf(i.onItemSelected(r))}),pl(),ws(2,"button",7),Rg("click",function(r){let i=If(o).$implicit,f=gC();return r.stopPropagation(),wf(f.onDeleteRequested(i.id))}),ws(3,"mat-icon"),GC(4,"close"),pl()()();}if(u&2){let o=t.$implicit;XE(),bg("id",o.id)("name",o.name)("description",o.description)("badges",o.badges??rT(4,ee));}}var g="__",Y=class u{router=g$1(F);projectStateService=g$1(P);dialog=g$1(Re);destroyRef=g$1(Ce);notification=g$1(s);projects=F$1(this.projectStateService.projectList$);forcedProject=F$1(this.projectStateService.forcedProject$,{initialValue:null});isLoading=F$1(this.projectStateService.isLoading$,{initialValue:false});projectItems=mT(()=>{let t=this.projects();if(!t)return [];let o=t.filter(e=>!e.name.includes(g)),n=t.filter(e=>e.name.includes(g)),r=new Set(o.map(e=>e.name)),i=e=>e.split(g)[0]??null,f=new Set(n.map(e=>i(e.name)).filter(e=>e!==null&&r.has(e))),l=[],G=[...f].sort((e,a)=>e.localeCompare(a));for(let e of G){let a=o.find(s=>s.name===e);l.push(x(w({},this.toEntityListItem(a)),{groupKey:e,groupLabel:e}));let Z=n.filter(s=>i(s.name)===e).sort((s,C)=>s.name.localeCompare(C.name));for(let s of Z){let C=s.name.slice(e.length+g.length);l.push(x(w({},this.toEntityListItem(s)),{name:C,description:s.name,groupKey:e,groupLabel:e}));}}let H=[...o].filter(e=>!f.has(e.name)&&!e.volatile).sort((e,a)=>e.name.localeCompare(a.name));for(let e of H)l.push(x(w({},this.toEntityListItem(e)),{groupKey:"__standalone__",groupLabel:"Projects"}));let Q=[...o].filter(e=>!f.has(e.name)&&e.volatile).sort((e,a)=>e.name.localeCompare(a.name));for(let e of Q)l.push(x(w({},this.toEntityListItem(e)),{groupKey:"__volatile__",groupLabel:"Temporary"}));let X=n.filter(e=>{let a=i(e.name);return a!==null&&!r.has(a)}).sort((e,a)=>e.name.localeCompare(a.name));for(let e of X)l.push(x(w({},this.toEntityListItem(e)),{groupKey:"__orphaned__",groupLabel:"Orphaned worktrees"}));return l});showCreateButton=mT(()=>!this.forcedProject());constructor(){}onItemSelected(t){this.projectStateService.selectProject(t),this.router.navigate(["project",t]);}onCreateRequested(){this.router.navigate(["project","new"]);}onDeleteRequested(t){let o=t.includes(g);this.dialog.open(z,{width:"400px",panelClass:"confirm-dialog-panel",data:w({title:"Delete project",message:`This will remove the project "${t}" from Coday and archive its configuration. The project source code on disk is not affected.`,confirmLabel:"Delete",cancelLabel:"Cancel",isDestructive:true},o?{checkboxLabel:"Also remove git worktree from disk"}:{})}).afterClosed().pipe(kt(r=>r?.confirmed===true),U(this.destroyRef)).subscribe(r=>{this.notification.info("Deleting project\u2026"),this.projectStateService.deleteProject(t,r.checkboxChecked).pipe(U(this.destroyRef)).subscribe({next:()=>{this.notification.success(`Project "${t}" deleted`),this.router.url.includes(`/project/${encodeURIComponent(t)}`)&&this.router.navigate(["/"]);},error:i=>{console.error("[PROJECT-LIST] Failed to delete project:",i),this.notification.error(i?.error?.error??"Failed to delete project");}});});}toEntityListItem(t){return {id:t.name,name:t.name,badges:t.volatile?[{label:"temp",variant:"warning"}]:[]}}static \u0275fac=function(o){return new(o||u)};static \u0275cmp=xw({type:u,selectors:[["app-project-selection"]],decls:6,vars:5,consts:[["projectCard",""],[1,"project-page-layout"],["title","Projects","contentMaxWidth","1400px","searchPlaceholder","Filter projects\u2026","emptyMessage","No projects found.",3,"itemSelected","createRequested","items","loading","itemTemplate","showCreate","autoFocusSearch"],["toolbar-start","","routerLink","/","title","Back to tasks",1,"project-list__logo"],["src","CODAY-Logo.png","alt","Coday"],[1,"project-card-wrapper"],[3,"selected","id","name","description","badges"],["mat-icon-button","","title","Delete project",1,"project-card-wrapper__delete",3,"click"]],template:function(o,n){if(o&1&&(ws(0,"div",1)(1,"ds-entity-list",2),Rg("itemSelected",function(i){return n.onItemSelected(i)})("createRequested",function(){return n.onCreateRequested()}),ws(2,"a",3),Sg(3,"img",4),pl()()(),Eg(4,te,5,5,"ng-template",null,0,fT)),o&2){let r=CC(5);XE(),bg("items",n.projectItems())("loading",n.isLoading())("itemTemplate",r)("showCreate",n.showCreateButton())("autoFocusSearch",true);}},dependencies:[$n,ot,yt,wt,Gn,$t],styles:["[_nghost-%COMP%]{display:block;width:100%;min-height:100vh;background:var(--color-bg);overflow-y:auto}.project-page-layout[_ngcontent-%COMP%]{display:flex;flex-direction:column;width:100%}.project-list__logo[_ngcontent-%COMP%]{display:flex;align-items:center;flex-shrink:0;border-radius:4px;opacity:.85;transition:opacity .15s ease;cursor:pointer}.project-list__logo[_ngcontent-%COMP%]:hover{opacity:1}.project-list__logo[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:40px;height:40px;object-fit:contain;border-radius:4px}.project-card-wrapper[_ngcontent-%COMP%]{position:relative}.project-card-wrapper__delete[_ngcontent-%COMP%]{position:absolute;top:4px;right:4px;width:28px;height:28px;line-height:28px;padding:0;opacity:0;transition:opacity .15s ease;color:var(--color-text-secondary, #6e6e73)}.project-card-wrapper__delete[_ngcontent-%COMP%] .mat-icon[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px}.project-card-wrapper__delete[_ngcontent-%COMP%]:hover{color:var(--color-error, #ff3b30)}.project-card-wrapper[_ngcontent-%COMP%]:hover .project-card-wrapper__delete[_ngcontent-%COMP%]{opacity:1}"],changeDetection:1})};export{Y as ProjectListComponent};
|