@whoz-oss/coday-client 0.244.0 → 0.245.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/{chunk-LHKOA7FX.js → chunk-2BMHZNQA.js} +1 -1
- package/browser/{chunk-ADEIEQGJ.js → chunk-2IN2N6PV.js} +1 -1
- package/browser/{chunk-TRFKVZGV.js → chunk-2QDRHKK5.js} +1 -1
- package/browser/{chunk-AK746XRX.js → chunk-45MC2DTD.js} +1 -1
- package/browser/{chunk-WMHS3NSI.js → chunk-4QVEFNE3.js} +1 -1
- package/browser/{chunk-4CNY7Z64.js → chunk-4QXUUAXS.js} +1 -1
- package/browser/{chunk-6BMCL5TR.js → chunk-5PVR7BPQ.js} +1 -1
- package/browser/{chunk-VZOBZ3DD.js → chunk-6QJAB37Y.js} +1 -1
- package/browser/chunk-6UZOFA34.js +1 -0
- package/browser/{chunk-76HYDFUL.js → chunk-7QFIBIYY.js} +1 -1
- package/browser/{chunk-LUB22VNT.js → chunk-AGUXPJDD.js} +1 -1
- package/browser/{chunk-UO7SKQEC.js → chunk-AMWKKZG5.js} +1 -1
- package/browser/{chunk-X73LZ3QV.js → chunk-ARAXWPWU.js} +1 -1
- package/browser/{chunk-5OGZHNUE.js → chunk-BSYMLXS6.js} +1 -1
- package/browser/{chunk-UQTA3ACH.js → chunk-C2LUO2MP.js} +1 -1
- package/browser/{chunk-F4ZRQ6MH.js → chunk-CQANBPMP.js} +1 -1
- package/browser/{chunk-VLDPXI7G.js → chunk-CWVJWHAD.js} +1 -1
- package/browser/{chunk-U7ZJFIOR.js → chunk-D67AF7QL.js} +1 -1
- package/browser/{chunk-CSHG3PLJ.js → chunk-DGCILIN5.js} +1 -1
- package/browser/{chunk-U3AHBQTX.js → chunk-EG5EQQU3.js} +1 -1
- package/browser/{chunk-CU7SABOQ.js → chunk-EHQPUQEI.js} +1 -1
- package/browser/{chunk-QXBTTCPM.js → chunk-FCEVFEIX.js} +1 -1
- package/browser/{chunk-ONZVOEJQ.js → chunk-FCFKY56K.js} +1 -1
- package/browser/{chunk-X5ZRXGFA.js → chunk-FSUOGZGO.js} +1 -1
- package/browser/{chunk-QTXEWRHZ.js → chunk-GLZG7RKF.js} +1 -1
- package/browser/{chunk-YGBFW4ZS.js → chunk-GS2CQHR7.js} +1 -1
- package/browser/{chunk-W7A7CPWM.js → chunk-HD2F6BMJ.js} +1 -1
- package/browser/{chunk-NYUYHMIH.js → chunk-IMS7HQGJ.js} +1 -1
- package/browser/chunk-KCFDTF3A.js +1 -0
- package/browser/{chunk-GLFQ37PU.js → chunk-KYYI3JSI.js} +1 -1
- package/browser/{chunk-KWJJEVAI.js → chunk-LIBCKDBU.js} +1 -1
- package/browser/{chunk-5Y2Q6WKL.js → chunk-LRIDOWQT.js} +1 -1
- package/browser/{chunk-I4RHXOIC.js → chunk-M6HAWZVC.js} +1 -1
- package/browser/chunk-MBQHFE5U.js +1 -0
- package/browser/{chunk-BWBZLC7A.js → chunk-NT57GO6D.js} +1 -1
- package/browser/{chunk-N2NJQ7DJ.js → chunk-NYQXGX3Y.js} +1 -1
- package/browser/{chunk-XAEUGARN.js → chunk-OTZDQE5T.js} +1 -1
- package/browser/{chunk-ZXQEKBPA.js → chunk-PEPRUAAU.js} +1 -1
- package/browser/{chunk-7H4TBVB7.js → chunk-PKLY5FK2.js} +1 -1
- package/browser/{chunk-S5QSZK6N.js → chunk-Q3UQBBUS.js} +1 -1
- package/browser/{chunk-MIAKSSSF.js → chunk-QCLAOYIL.js} +1 -1
- package/browser/chunk-QKICZGWX.js +1 -0
- package/browser/{chunk-7O6TY5IW.js → chunk-QTGBG7IF.js} +1 -1
- package/browser/{chunk-SZM3NJVZ.js → chunk-SC7BP3G3.js} +1 -1
- package/browser/chunk-SFQE4GQ6.js +1 -0
- package/browser/{chunk-5N6DUZII.js → chunk-SI42WXFB.js} +1 -1
- package/browser/{chunk-TNSH3NBF.js → chunk-T4R5WSRE.js} +1 -1
- package/browser/chunk-UJ2IGPRI.js +1 -0
- package/browser/{chunk-R2NWLPS6.js → chunk-VVFVGWIQ.js} +1 -1
- package/browser/{chunk-RQKLSUW5.js → chunk-W34FCJM7.js} +1 -1
- package/browser/{chunk-H6NBS4JE.js → chunk-W7ONGRS7.js} +1 -1
- package/browser/{chunk-NNUJIQ6R.js → chunk-WJZ4NXIG.js} +1 -1
- package/browser/{chunk-GSUU7JSY.js → chunk-WTBQIOPQ.js} +1 -1
- package/browser/{chunk-FA2MVU23.js → chunk-XC5W65K7.js} +1 -1
- package/browser/{chunk-4FGWE3EW.js → chunk-XKHDPUML.js} +1 -1
- package/browser/{chunk-ECISS7V2.js → chunk-XS4CC6GG.js} +1 -1
- package/browser/{chunk-UWYJO2DN.js → chunk-YCZCEQQL.js} +1 -1
- package/browser/chunk-YFQUZF2M.js +1 -0
- package/browser/{chunk-ZQZHBROX.js → chunk-ZEN5PJJE.js} +1 -1
- package/browser/{chunk-KJJPVCIH.js → chunk-ZJLDJUUY.js} +1 -1
- package/browser/{chunk-MFSY4HYK.js → chunk-ZM4HUO26.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/{main-VWHGBAF5.js → main-5JFQENOY.js} +1 -1
- package/package.json +1 -1
- package/browser/chunk-EAVXJ7QN.js +0 -1
- package/browser/chunk-ENRRDIUM.js +0 -1
- package/browser/chunk-P6WNH2KJ.js +0 -1
- package/browser/chunk-XJYEZL5J.js +0 -1
- package/browser/chunk-XZRVHU66.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{V as l,Xc as u,Z as g,ca as m,m as c,t as p}from"./chunk-CHEXA6RY.js";var f=class s{http=m(u);agentsCache=new Map;getAgents(e){let t=this.agentsCache.get(e);return t?c(t):this.http.get(`/api/projects/${e}/agents`).pipe(l(o=>{this.agentsCache.set(e,o)}))}getAgentsAutocomplete(e,t){return this.getAgents(e).pipe(p(o=>{if(!t)return o;let i=t.toLowerCase(),a=r=>{let n=r.name.toLowerCase();return n.startsWith(i)?0:n.includes(i)?1:2};return o.filter(r=>{let n=r.name.toLowerCase(),h=r.description?.toLowerCase()||"";return n.includes(i)||h.includes(i)}).sort((r,n)=>a(r)-a(n))}))}clearCache(e){this.agentsCache.delete(e)}clearAllCache(){this.agentsCache.clear()}static \u0275fac=function(t){return new(t||s)};static \u0275prov=g({token:s,factory:s.\u0275fac,providedIn:"root"})};export{f as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as o,k as i,p as l}from"./chunk-
|
|
1
|
+
import{b as o,k as i,p as l}from"./chunk-C2LUO2MP.js";import{Z as a,ca as t,z as n}from"./chunk-CHEXA6RY.js";var m=class s{controller=t(l);agentConfigController=t(o);namespacePermissions=t(i);listByNamespace(e){return this.controller.findByNamespaceIdUserGroup(e)}loadFormData(e){return n({namespaceAgents:this.agentConfigController.listByParentAgentConfig(e,!1),platformAgents:this.agentConfigController.listPlatformAgentsAgentConfig(!1),groups:this.listByNamespace(e),users:this.namespacePermissions.listNamespaceUsers(e)})}loadExistingGroup(e){return n({group:this.getById(e),members:this.getMembers(e)})}getById(e){return this.controller.getByIdUserGroup(e)}getMembers(e){return this.controller.getMembersUserGroup(e)}create(e){return this.controller.createUserGroup({namespaceId:e.namespaceId,name:e.name,agentIds:e.agentIds,userExternalIdsToAdd:e.memberExternalIdsToAdd,adminExternalIds:e.adminExternalIds})}update(e,r){return this.controller.updateUserGroup(e,{name:r.name,agentIds:r.agentIds,userExternalIdsToAdd:r.memberExternalIdsToAdd,userExternalIdsToRemove:r.memberExternalIdsToRemove,adminExternalIds:r.adminExternalIds})}delete(e){return this.controller.deleteUserGroup(e)}static \u0275fac=function(r){return new(r||s)};static \u0275prov=a({token:s,factory:s.\u0275fac,providedIn:"root"})};export{m as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as G}from"./chunk-AIC4U2MU.js";import{a as B}from"./chunk-TFW43ZTS.js";import{c as K}from"./chunk-
|
|
1
|
+
import{a as G}from"./chunk-AIC4U2MU.js";import{a as B}from"./chunk-TFW43ZTS.js";import{c as K}from"./chunk-4QVEFNE3.js";import{a as V}from"./chunk-ZJLDJUUY.js";import"./chunk-NWFFZ2FW.js";import"./chunk-6QJAB37Y.js";import"./chunk-C2LUO2MP.js";import{a as N,c as $}from"./chunk-6XX7GME4.js";import{s as L,z as P}from"./chunk-VNO76B3S.js";import"./chunk-E6T6QLQT.js";import"./chunk-SPV5SLNS.js";import{a as l}from"./chunk-VMYKE4ZC.js";import"./chunk-AS2L77JV.js";import"./chunk-7OGOI6WM.js";import"./chunk-G5RWG2GK.js";import{Bb as b,Db as u,Fb as o,Ka as A,Lc as M,Pb as x,S as f,Tb as E,Ub as w,Wa as v,ab as C,ca as a,cc as D,fc as O,ga as c,gc as T,ha as m,jc as q,lb as I,m as _,ma as S,mb as R,rb as h,sb as p,t as g,ta as y,tb as d}from"./chunk-CHEXA6RY.js";var W=()=>[];function z(s,e){if(s&1&&(p(0,"p",3),E(1),d()),s&2){let t=o().$implicit;A(),w(t.name)}}function U(s,e){if(s&1){let t=b();p(0,"agentos-auth-setting-item",5),u("editRequested",function(){let n=c(t),r=o(2);return m(r.onEdit(n))})("deleteRequested",function(){let n=c(t),r=o(2);return m(r.onDelete(n))})("duplicateRequested",function(){let n=c(t),r=o(2);return m(r.onDuplicate(n))}),d()}if(s&2){let t=e,i=o(2);h("config",t.config)("scope",t.scope)("readOnly",t.scope==="platform"||t.scope==="namespace"&&!i.isAdmin())}}function X(s,e){if(s&1&&I(0,z,2,1,"p",3)(1,U,1,3,"agentos-auth-setting-item",4),s&2){let t,i=e.$implicit,n=o();R(n.isEmptyPlaceholder(i.id)?0:(t=n.resolve(i.id))?1:-1,t)}}var k=Object.freeze({platform:"Platform (read-only)",namespace:"Auth Settings du namespace",userOnNs:"Mes overrides sur ce namespace",userGlobal:"Mes overrides globaux"}),F="__empty__",j=class s{route=a(N);router=a($);destroyRef=a(S);state=a(K);namespaceRole=a(V);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=y(!1);listItems$=this.state.vm$.pipe(g(e=>this.toListItems(e)));resolved=new Map;ngOnInit(){this.route.paramMap.pipe(l(this.destroyRef)).subscribe(e=>{let t=e.get("namespaceId")??"";t&&t!==this.namespaceId&&(this.namespaceId=t),this.state.setNamespace(t)}),this.route.paramMap.pipe(g(e=>e.get("namespaceId")??""),f(e=>e?this.namespaceRole.isAdminOfNamespace$(e):_(!1)),l(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(l(this.destroyRef)).subscribe(e=>{let t=new Map;e.platform.forEach(i=>{i.id&&t.set(this.itemKey("platform",i.id),{config:i,scope:"platform"})}),e.namespace.forEach(i=>{i.id&&t.set(this.itemKey("namespace",i.id),{config:i,scope:"namespace"})}),e.userOnNs.forEach(i=>{i.id&&t.set(this.itemKey("userOnNs",i.id),{config:i,scope:"userOnNs"})}),e.userGlobal.forEach(i=>{i.id&&t.set(this.itemKey("userGlobal",i.id),{config:i,scope:"userGlobal"})}),this.resolved=t})}isEmptyPlaceholder(e){return e.startsWith(F)}resolve(e){return this.resolved.get(e)??null}itemKey(e,t){return`${e}:${t}`}goBack(){this.router.navigate(["/agentos","namespaces"])}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:G(this.isAdmin())}})}onEdit(e){let t=e.config.id;t&&this.router.navigate(["/agentos",this.namespaceId,"auth-settings",t,"edit"],{queryParams:{scope:e.scope}})}onDelete(e){let t=e.config.id;t&&this.state.delete(t,e.scope).pipe(l(this.destroyRef)).subscribe({error:i=>{console.error(`[AuthSettingsAllScopes] Delete failed for ${e.scope}:${t}:`,i)}})}onDuplicate(e){if(!e.config.id)return;let t=e.scope==="platform"||e.scope==="namespace"&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:t,template:e.config.id,templateScope:e.scope}})}toListItems(e){let t=[];return t.push(...this.sectionItems("platform",e.platform)),t.push(...this.sectionItems("namespace",e.namespace)),t.push(...this.sectionItems("userOnNs",e.userOnNs)),t.push(...this.sectionItems("userGlobal",e.userGlobal)),t}sectionItems(e,t){return t.length===0?[{id:`${F}${e}`,name:"Aucun Auth Setting",groupKey:e,groupLabel:k[e]}]:t.filter(i=>!!i.id).map(i=>({id:this.itemKey(e,i.id),name:i.name,description:i.authType,groupKey:e,groupLabel:k[e]}))}static \u0275fac=function(t){return new(t||s)};static \u0275cmp=v({type:s,selectors:[["agentos-auth-settings-all-scopes"]],decls:5,vars:6,consts:[["authSettingItemTpl",""],["title","Auth Settings","emptyMessage","No auth settings available.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[1,"auth-settings-all-scopes__empty"],[3,"config","scope","readOnly"],[3,"editRequested","deleteRequested","duplicateRequested","config","scope","readOnly"]],template:function(t,i){if(t&1&&(p(0,"ds-entity-list",1),O(1,"async"),u("createRequested",function(){return i.openCreateForm()}),p(2,"ds-icon-button",2),u("action",function(){return i.goBack()}),d()(),C(3,X,2,1,"ng-template",null,0,q)),t&2){let n=x(4);h("items",T(1,3,i.listItems$)??D(5,W))("showCreate",!0)("itemTemplate",n)}},dependencies:[P,B,L,M],encapsulation:2,changeDetection:0})};export{j as AuthSettingsAllScopesComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Ne}from"./chunk-QCLAOYIL.js";import{a as ze}from"./chunk-LRIDOWQT.js";import{a as De,b as Be}from"./chunk-KCFDTF3A.js";import{a as Se,b as Ie}from"./chunk-QKICZGWX.js";import{a as Pe,b as ye}from"./chunk-Y42FQQZC.js";import{a as Me}from"./chunk-45MC2DTD.js";import{a as Te,b as He,c as Ue}from"./chunk-PKLY5FK2.js";import{a as we,b as Fe,c as Ee}from"./chunk-ARAXWPWU.js";import{a as Oe}from"./chunk-SI42WXFB.js";import{a as ke}from"./chunk-W7ONGRS7.js";import{a as Q}from"./chunk-46V5PCBB.js";import{a as ee,b as te,c as ne,d as oe,e as ae,f as re,g as ie,h as me,i as pe,j as de,k as ce,l as le,m as ge,n as he,o as ue,p as fe,q as Ce,r as be,s as ve,t as _e,u as xe}from"./chunk-KYYI3JSI.js";import{a as se}from"./chunk-KHMEGI4Z.js";import{a as X,b as Z,c as $}from"./chunk-RB7N2NWN.js";import"./chunk-LIBCKDBU.js";import"./chunk-WTBQIOPQ.js";import{a as Ae}from"./chunk-IMS7HQGJ.js";import"./chunk-YCZCEQQL.js";import{a as H}from"./chunk-6QJAB37Y.js";import{a as Y,b as q,c as J,d as K}from"./chunk-YFCRBVWD.js";import{l as F}from"./chunk-C2LUO2MP.js";import"./chunk-TSYL5EEO.js";import{c as w}from"./chunk-6XX7GME4.js";import{s as T}from"./chunk-VNO76B3S.js";import"./chunk-E6T6QLQT.js";import"./chunk-SPV5SLNS.js";import{a as E}from"./chunk-VMYKE4ZC.js";import"./chunk-AS2L77JV.js";import"./chunk-7OGOI6WM.js";import"./chunk-G5RWG2GK.js";import{Bb as k,Db as c,Fb as C,Ka as p,Rb as M,Tb as r,Ub as x,Wa as h,ca as g,ga as A,ha as P,lb as s,ma as y,mb as l,mc as O,rb as v,sb as n,ta as b,tb as o,ub as f,vb as S,wb as I,xb as _}from"./chunk-CHEXA6RY.js";var t=()=>!0;var Ge=[{path:"oauth/callback",loadComponent:()=>import("./chunk-AGUXPJDD.js").then(e=>e.OAuthCallbackComponent)},{path:"",loadComponent:()=>import("./chunk-FAHNOZ4S.js").then(e=>e.AgentosShellComponent),children:[{path:"home",canActivate:[t],loadComponent:()=>import("./chunk-6UZOFA34.js").then(e=>e.CaseShellComponent)},{path:"",loadComponent:()=>import("./chunk-YFQUZF2M.js").then(e=>e.LayoutComponent),children:[{path:"namespaces/new",canActivate:[t],loadComponent:()=>import("./chunk-NT57GO6D.js").then(e=>e.NamespaceFormComponent)},{path:"namespaces/:namespaceId/edit",canActivate:[t],loadComponent:()=>import("./chunk-NT57GO6D.js").then(e=>e.NamespaceFormComponent)},{path:"namespaces",canActivate:[t],loadComponent:()=>import("./chunk-SC7BP3G3.js").then(e=>e.NamespaceListComponent)},{path:"admin",canActivate:[t],loadComponent:()=>import("./chunk-WC55KAEC.js").then(e=>e.AdminHomeComponent)},{path:"admin/users/new",canActivate:[t],loadComponent:()=>import("./chunk-WJZ4NXIG.js").then(e=>e.UserFormComponent)},{path:"admin/users/:userId/edit",canActivate:[t],loadComponent:()=>import("./chunk-WJZ4NXIG.js").then(e=>e.UserFormComponent)},{path:"admin/users",canActivate:[t],loadComponent:()=>import("./chunk-GLZG7RKF.js").then(e=>e.AdminUsersGroupsComponent)},{path:"admin/integration-configs/new",canActivate:[t],loadComponent:()=>import("./chunk-BSYMLXS6.js").then(e=>e.IntegrationFormComponent)},{path:"admin/integration-configs/:integrationId/edit",canActivate:[t],loadComponent:()=>import("./chunk-BSYMLXS6.js").then(e=>e.IntegrationFormComponent)},{path:"admin/integration-configs",canActivate:[t],loadComponent:()=>import("./chunk-QTGBG7IF.js").then(e=>e.PlatformIntegrationConfigsComponent)},{path:"admin/scheduled-prompts/new",canActivate:[t],loadComponent:()=>import("./chunk-HD2F6BMJ.js").then(e=>e.ScheduledPromptFormComponent)},{path:"admin/scheduled-prompts/:scheduledPromptId/edit",canActivate:[t],loadComponent:()=>import("./chunk-HD2F6BMJ.js").then(e=>e.ScheduledPromptFormComponent)},{path:"admin/scheduled-prompts",canActivate:[t],loadComponent:()=>import("./chunk-EG5EQQU3.js").then(e=>e.PlatformScheduledPromptsComponent)},{path:"admin/prompts/new",canActivate:[t],loadComponent:()=>import("./chunk-XC5W65K7.js").then(e=>e.PromptFormComponent)},{path:"admin/prompts/:promptId/edit",canActivate:[t],loadComponent:()=>import("./chunk-XC5W65K7.js").then(e=>e.PromptFormComponent)},{path:"admin/prompts",canActivate:[t],loadComponent:()=>import("./chunk-CQANBPMP.js").then(e=>e.PlatformPromptsComponent)},{path:"admin/ai-providers/new",canActivate:[t],loadComponent:()=>import("./chunk-OTZDQE5T.js").then(e=>e.AiProviderFormComponent)},{path:"admin/ai-providers/:aiProviderId/edit",canActivate:[t],loadComponent:()=>import("./chunk-OTZDQE5T.js").then(e=>e.AiProviderFormComponent)},{path:"admin/ai-providers",canActivate:[t],loadComponent:()=>import("./chunk-EHQPUQEI.js").then(e=>e.PlatformAiProvidersComponent)},{path:"admin/auth-settings/new",canActivate:[t],loadComponent:()=>import("./chunk-4QXUUAXS.js").then(e=>e.AuthSettingFormComponent)},{path:"admin/auth-settings/:authSettingId/edit",canActivate:[t],loadComponent:()=>import("./chunk-4QXUUAXS.js").then(e=>e.AuthSettingFormComponent)},{path:"admin/auth-settings",canActivate:[t],loadComponent:()=>import("./chunk-CWVJWHAD.js").then(e=>e.PlatformAuthSettingsComponent)},{path:"admin/ai-models/new",canActivate:[t],loadComponent:()=>import("./chunk-XS4CC6GG.js").then(e=>e.AiModelFormComponent)},{path:"admin/ai-models/:modelId/edit",canActivate:[t],loadComponent:()=>import("./chunk-XS4CC6GG.js").then(e=>e.AiModelFormComponent)},{path:"admin/ai-models",canActivate:[t],loadComponent:()=>import("./chunk-NYQXGX3Y.js").then(e=>e.PlatformAiModelsComponent)},{path:"admin/agent-configs/new",canActivate:[t],loadComponent:()=>import("./chunk-M6HAWZVC.js").then(e=>e.AgentConfigFormComponent)},{path:"admin/agent-configs/:agentConfigId/edit",canActivate:[t],loadComponent:()=>import("./chunk-M6HAWZVC.js").then(e=>e.AgentConfigFormComponent)},{path:"admin/agent-configs/:agentConfigId/inspect",canActivate:[t],loadComponent:()=>import("./chunk-XKHDPUML.js").then(e=>e.AgentConfigInspectComponent)},{path:"admin/agent-configs",canActivate:[t],loadComponent:()=>import("./chunk-W34FCJM7.js").then(e=>e.PlatformAgentConfigsComponent)},{path:"me",canActivate:[t],loadComponent:()=>import("./chunk-FCFKY56K.js").then(e=>e.UserProfileComponent)},{path:"user",canActivate:[t],loadComponent:()=>import("./chunk-FCFKY56K.js").then(e=>e.UserProfileComponent)},{path:":namespaceId/auth-settings/new",canActivate:[t],loadComponent:()=>import("./chunk-4QXUUAXS.js").then(e=>e.AuthSettingFormComponent)},{path:":namespaceId/auth-settings/:authSettingId/edit",canActivate:[t],loadComponent:()=>import("./chunk-4QXUUAXS.js").then(e=>e.AuthSettingFormComponent)},{path:":namespaceId/auth-settings",canActivate:[t],loadComponent:()=>import("./chunk-T4R5WSRE.js").then(e=>e.AuthSettingsAllScopesComponent)},{path:":namespaceId/integrations/new",canActivate:[t],loadComponent:()=>import("./chunk-BSYMLXS6.js").then(e=>e.IntegrationFormComponent)},{path:":namespaceId/integrations/:integrationId/edit",canActivate:[t],loadComponent:()=>import("./chunk-BSYMLXS6.js").then(e=>e.IntegrationFormComponent)},{path:":namespaceId/integrations",canActivate:[t],loadComponent:()=>import("./chunk-ZEN5PJJE.js").then(e=>e.IntegrationsAllScopesComponent)},{path:":namespaceId/ai-providers/new",canActivate:[t],loadComponent:()=>import("./chunk-OTZDQE5T.js").then(e=>e.AiProviderFormComponent)},{path:":namespaceId/ai-providers/:aiProviderId/edit",canActivate:[t],loadComponent:()=>import("./chunk-OTZDQE5T.js").then(e=>e.AiProviderFormComponent)},{path:":namespaceId/ai-providers",canActivate:[t],loadComponent:()=>import("./chunk-PEPRUAAU.js").then(e=>e.AiProvidersAllScopesComponent)},{path:":namespaceId/ai-models/new",canActivate:[t],loadComponent:()=>import("./chunk-XS4CC6GG.js").then(e=>e.AiModelFormComponent)},{path:":namespaceId/ai-models/:modelId/edit",canActivate:[t],loadComponent:()=>import("./chunk-XS4CC6GG.js").then(e=>e.AiModelFormComponent)},{path:":namespaceId/ai-models",canActivate:[t],loadComponent:()=>import("./chunk-2BMHZNQA.js").then(e=>e.NamespaceAiModelsComponent)},{path:":namespaceId/scheduled-prompts/new",canActivate:[t],loadComponent:()=>import("./chunk-HD2F6BMJ.js").then(e=>e.ScheduledPromptFormComponent)},{path:":namespaceId/scheduled-prompts/:scheduledPromptId/edit",canActivate:[t],loadComponent:()=>import("./chunk-HD2F6BMJ.js").then(e=>e.ScheduledPromptFormComponent)},{path:":namespaceId/scheduled-prompts",canActivate:[t],loadComponent:()=>import("./chunk-FSUOGZGO.js").then(e=>e.ScheduledPromptListComponent)},{path:":namespaceId/prompts/new",canActivate:[t],loadComponent:()=>import("./chunk-XC5W65K7.js").then(e=>e.PromptFormComponent)},{path:":namespaceId/prompts/:promptId/edit",canActivate:[t],loadComponent:()=>import("./chunk-XC5W65K7.js").then(e=>e.PromptFormComponent)},{path:":namespaceId/prompts",canActivate:[t],loadComponent:()=>import("./chunk-DGCILIN5.js").then(e=>e.NamespacePromptsComponent)},{path:":namespaceId/agent-configs/new",canActivate:[t],loadComponent:()=>import("./chunk-M6HAWZVC.js").then(e=>e.AgentConfigFormComponent)},{path:":namespaceId/agent-configs/:agentConfigId/edit",canActivate:[t],loadComponent:()=>import("./chunk-M6HAWZVC.js").then(e=>e.AgentConfigFormComponent)},{path:":namespaceId/agent-configs/:agentConfigId/inspect",canActivate:[t],loadComponent:()=>import("./chunk-XKHDPUML.js").then(e=>e.AgentConfigInspectComponent)},{path:":namespaceId/agent-configs",canActivate:[t],loadComponent:()=>import("./chunk-Q3UQBBUS.js").then(e=>e.NamespaceAgentConfigsComponent)},{path:":namespaceId/user-groups/new",canActivate:[t],loadComponent:()=>import("./chunk-D67AF7QL.js").then(e=>e.UserGroupFormComponent)},{path:":namespaceId/user-groups/:userGroupId/edit",canActivate:[t],loadComponent:()=>import("./chunk-D67AF7QL.js").then(e=>e.UserGroupFormComponent)},{path:":namespaceId/user-groups",canActivate:[t],loadComponent:()=>import("./chunk-ZM4HUO26.js").then(e=>e.NamespaceUserGroupsComponent)},{path:":namespaceId/members",canActivate:[t],loadComponent:()=>import("./chunk-MBQHFE5U.js").then(e=>e.NamespaceMembersComponent)},{path:"",redirectTo:"namespaces",pathMatch:"full"}]}]}];function B(e,i){e&1&&_(0,"span",1)}function R(e,i){e&1&&_(0,"span",2)}function j(e,i){e&1&&_(0,"span",3)}var u=class e{pluginService=g(F);online=b(null);ngOnInit(){this.pluginService.getAllPlugins().subscribe({next:()=>this.online.set(!0),error:()=>this.online.set(!1)})}static \u0275fac=function(a){return new(a||e)};static \u0275cmp=h({type:e,selectors:[["agentos-backend-status"]],decls:4,vars:1,consts:[[1,"backend-status"],["title","AgentOS online",1,"dot","dot--online"],["title","AgentOS offline",1,"dot","dot--offline"],["title","Checking\u2026",1,"dot","dot--checking"]],template:function(a,m){if(a&1&&(S(0,"div",0),s(1,B,1,0,"span",1)(2,R,1,0,"span",2)(3,j,1,0,"span",3),I()),a&2){let d;p(),l((d=m.online())===!0?1:d===!1?2:3)}},styles:[".backend-status[_ngcontent-%COMP%]{display:flex;align-items:center}.dot[_ngcontent-%COMP%]{width:8px;height:8px;border-radius:50%;flex-shrink:0}.dot--online[_ngcontent-%COMP%]{background:var(--color-success, #34c759)}.dot--offline[_ngcontent-%COMP%]{background:var(--color-error, #ff3b30)}.dot--checking[_ngcontent-%COMP%]{background:var(--color-text-secondary, #6e6e73);opacity:.5;animation:_ngcontent-%COMP%_pulse 1.2s ease-in-out infinite}@keyframes _ngcontent-%COMP%_pulse{0%,to{opacity:.5}50%{opacity:1}}"]})};function G(e,i){if(e&1){let a=k();n(0,"button",9),c("click",function(){A(a);let d=C();return P(d.navigateToAdmin())}),n(1,"span",10),r(2,"\u2699\uFE0F"),o()()}}function L(e,i){if(e&1&&(n(0,"span",7),r(1),o()),e&2){let a=C();p(),x(a.userInitials)}}function V(e,i){e&1&&(n(0,"span",8),r(1,"\u25EF"),o())}var z=class e{router=g(w);userState=g(H);destroyRef=g(y);currentUser=this.userState.currentUser;navigateHome(){this.router.navigate(["/agentos/home"])}isAdmin=O(()=>this.userState.currentUser()?.isAdmin===!0);navigateToAdmin(){this.router.navigate(["/agentos/admin"])}ngOnInit(){this.currentUser()||this.userState.loadMe().pipe(E(this.destroyRef)).subscribe()}get userInitials(){let i=this.currentUser();if(!i)return"";let a=i.firstname?.[0]??"",m=i.lastname?.[0]??"";return(a+m).toUpperCase()||i.email?.[0]?.toUpperCase()||"?"}get isOnProfilePage(){return this.router.url.startsWith("/agentos/me")}toggleProfile(){this.isOnProfilePage?window.history.length>1?window.history.back():this.router.navigate(["/agentos"]):this.router.navigate(["/agentos/me"])}static \u0275fac=function(a){return new(a||e)};static \u0275cmp=h({type:e,selectors:[["agentos-header"]],decls:11,vars:5,consts:[[1,"header"],["type","button","title","Home",1,"header__brand",3,"click"],["src","CODAY-Logo.png","alt","Coday",1,"header__logo-img"],[1,"header__logo-text"],[1,"header__nav"],["type","button","title","Admin",1,"header__admin-btn"],["type","button",1,"header__user-btn",3,"click","title"],[1,"header__user-initials"],[1,"header__user-icon"],["type","button","title","Admin",1,"header__admin-btn",3,"click"],[1,"header__admin-icon"]],template:function(a,m){a&1&&(n(0,"header",0)(1,"button",1),c("click",function(){return m.navigateHome()}),f(2,"img",2),n(3,"span",3),r(4,"Coday"),o()(),n(5,"nav",4),f(6,"agentos-backend-status"),s(7,G,3,0,"button",5),n(8,"button",6),c("click",function(){return m.toggleProfile()}),s(9,L,2,1,"span",7)(10,V,2,0,"span",8),o()()()),a&2&&(p(7),l(m.isAdmin()?7:-1),p(),M("header__user-btn--active",m.isOnProfilePage),v("title",m.isOnProfilePage?"Back":"My profile"),p(),l(m.userInitials?9:10))},dependencies:[u],styles:[".header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding:0 1.5rem;height:56px;background:var(--glass-bg, rgba(255, 255, 255, .72));border-bottom:1px solid var(--glass-border, rgba(255, 255, 255, .18));backdrop-filter:var(--glass-backdrop-blur, blur(20px));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));position:sticky;top:0;z-index:100}.header__brand[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;background:none;border:none;padding:0;cursor:pointer;border-radius:6px;transition:opacity .15s ease}.header__brand[_ngcontent-%COMP%]:hover{opacity:.7}.header__logo-img[_ngcontent-%COMP%]{width:32px;height:32px;object-fit:contain}.header__logo-text[_ngcontent-%COMP%]{font-size:1rem;font-weight:700;letter-spacing:-.01em;color:var(--color-text, #1d1d1f)}.header__nav[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.header__admin-btn[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:50%;border:1.5px solid var(--color-border, rgba(0, 0, 0, .1));background:var(--color-bg-secondary, rgba(0, 0, 0, .04));cursor:pointer;transition:background .15s ease,border-color .15s ease;padding:0;font-family:inherit;font-size:1rem;line-height:1}.header__admin-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .08));border-color:var(--color-primary, #007aff)}.header__admin-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.header__user-btn[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:50%;border:1.5px solid var(--color-border, rgba(0, 0, 0, .1));background:var(--color-bg-secondary, rgba(0, 0, 0, .04));cursor:pointer;transition:background .15s ease,border-color .15s ease;padding:0;font-family:inherit}.header__user-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .08));border-color:var(--color-primary, #007aff)}.header__user-btn--active[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff)}.header__user-btn--active[_ngcontent-%COMP%] .header__user-initials[_ngcontent-%COMP%], .header__user-btn--active[_ngcontent-%COMP%] .header__user-icon[_ngcontent-%COMP%]{color:#fff}.header__user-initials[_ngcontent-%COMP%]{font-size:.75rem;font-weight:600;color:var(--color-text, #1d1d1f);line-height:1;letter-spacing:.02em}.header__user-icon[_ngcontent-%COMP%]{font-size:1rem;color:var(--color-text-secondary, #6e6e73);line-height:1}"]})};function W(e,i){if(e&1&&(n(0,"p",11),r(1," Last action: "),n(2,"strong"),r(3),o()()),e&2){let a=C();p(3),x(a.lastAction())}}var D=class e{lastAction=b(null);onSend(){this.lastAction.set("send")}onStop(){this.lastAction.set("stop")}onAttach(){this.lastAction.set("attach")}static \u0275fac=function(a){return new(a||e)};static \u0275cmp=h({type:e,selectors:[["agentos-hello"]],decls:35,vars:2,consts:[[1,"hello-agentos"],[1,"card"],[1,"badge"],[1,"principles"],[1,"demo"],[1,"demo-label"],[1,"demo-buttons"],["icon","send","variant","primary","title","Send",3,"action"],["icon","stop","variant","danger","title","Stop",3,"action"],["icon","attach_file","variant","default","title","Attach",3,"action"],["icon","mic","variant","default","title","Record",3,"action","disabled"],[1,"demo-feedback"]],template:function(a,m){a&1&&(n(0,"div",0)(1,"div",1)(2,"div",2),r(3,"AgentOS UI"),o(),n(4,"h1"),r(5,"Hello AgentOS"),o(),n(6,"p"),r(7," This component lives in "),n(8,"code"),r(9,"libs/agentos-ui"),o(),r(10," \u2014 isolated from Coday internals, ready to be published as "),n(11,"code"),r(12,"@whoz-oss/agentos-ui"),o(),r(13,". "),o(),f(14,"agentos-backend-status"),n(15,"ul",3)(16,"li"),r(17,"\u2726 No imports from Coday app"),o(),n(18,"li"),r(19,"\u2726 CSS custom properties as host contract"),o(),n(20,"li"),r(21,"\u2726 Standalone Angular components"),o(),n(22,"li"),r(23,"\u2726 Signals-first reactive state"),o()(),n(24,"div",4)(25,"p",5),r(26,"ds-icon-button from "),n(27,"code"),r(28,"@whoz-oss/design-system"),o()(),n(29,"div",6)(30,"ds-icon-button",7),c("action",function(){return m.onSend()}),o(),n(31,"ds-icon-button",8),c("action",function(){return m.onStop()}),o(),n(32,"ds-icon-button",9),c("action",function(){return m.onAttach()}),o(),n(33,"ds-icon-button",10),c("action",function(){return m.onAttach()}),o()(),s(34,W,4,1,"p",11),o()()()),a&2&&(p(33),v("disabled",!0),p(),l(m.lastAction()?34:-1))},dependencies:[T,u],styles:['@charset "UTF-8";.hello-agentos[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;min-height:100vh;padding:2rem}.card[_ngcontent-%COMP%]{background:var(--glass-bg, rgba(255, 255, 255, .72));border:1px solid var(--glass-border, rgba(255, 255, 255, .18));box-shadow:var(--glass-shadow, 0 8px 32px 0 rgba(31, 38, 135, .15));backdrop-filter:var(--glass-backdrop-blur, blur(20px));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));border-radius:20px;padding:3rem;max-width:480px;width:100%;text-align:center}.badge[_ngcontent-%COMP%]{display:inline-block;background:var(--color-primary, #007aff);color:var(--color-text-inverse, #ffffff);font-size:.75rem;font-weight:600;letter-spacing:.08em;text-transform:uppercase;padding:.25rem .75rem;border-radius:100px;margin-bottom:1.5rem}h1[_ngcontent-%COMP%]{color:var(--color-text, #1d1d1f);font-size:2rem;font-weight:700;margin:0 0 1rem;letter-spacing:-.02em}p[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);line-height:1.6;margin:0 0 1.5rem}p[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:var(--color-code-bg, rgba(142, 142, 147, .12));color:var(--color-code-text, #ff375f);padding:.125rem .375rem;border-radius:6px;font-size:.875em;border:1px solid var(--color-border, rgba(0, 0, 0, .1))}.principles[_ngcontent-%COMP%]{list-style:none;margin:0 0 1.5rem;padding:0;text-align:left;display:flex;flex-direction:column;gap:.5rem}.principles[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;padding:.5rem .75rem;background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-radius:8px;border:1px solid var(--color-border-light, rgba(40, 40, 40, .08))}.demo[_ngcontent-%COMP%]{border-top:1px solid var(--color-border-light, rgba(40, 40, 40, .08));padding-top:1.25rem}.demo[_ngcontent-%COMP%] .demo-label[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.8rem;margin:0 0 .75rem}.demo[_ngcontent-%COMP%] .demo-label[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:var(--color-code-bg, rgba(142, 142, 147, .12));color:var(--color-code-text, #ff375f);padding:.125rem .375rem;border-radius:6px;font-size:.875em;border:1px solid var(--color-border, rgba(0, 0, 0, .1))}.demo[_ngcontent-%COMP%] .demo-buttons[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:center;justify-content:center;padding:.75rem;background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-radius:12px;border:1px solid var(--color-border-light, rgba(40, 40, 40, .08))}.demo[_ngcontent-%COMP%] .demo-feedback[_ngcontent-%COMP%]{margin:.75rem 0 0;font-size:.85rem;color:var(--color-text-secondary, #6e6e73)}.demo[_ngcontent-%COMP%] .demo-feedback[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{color:var(--color-primary, #007aff)}']})};export{Ge as AGENTOS_ROUTES,Pe as ActionCardChipsDirective,ye as ActionCardComponent,Ue as AdminUsersGroupsComponent,Q as AgentosShellComponent,J as AgentosThemeService,Z as AgentosUserPreferencesService,u as BackendStatusComponent,Ce as CaseChatComponent,_e as CaseDrawerComponent,be as CaseHomeComponent,ve as CaseItemComponent,xe as CaseShellComponent,X as ENTER_KEY_BEHAVIORS,le as ExchangeContentViewerComponent,ue as ExchangeDrawerComponent,he as ExchangeFileListComponent,ge as ExchangeItemComponent,fe as ExchangeShellComponent,ee as ExchangeStateService,z as HeaderComponent,D as HelloAgentosComponent,Ae as LayoutComponent,te as MAX_VIEWABLE_SIZE,se as MarkdownPipe,Se as NamespaceItemComponent,Ie as NamespaceListComponent,De as NamespaceMemberStateService,Be as NamespaceMembersComponent,we as NamespaceSelectComponent,ze as NamespaceUserGroupsComponent,q as THEME_MODES,K as THEME_PORT,Y as THEME_VARIANTS,$ as USER_PREFERENCES_PORT,ke as UserAdminStateService,Me as UserFormComponent,Ne as UserGroupFormComponent,Fe as UserGroupItemComponent,Ee as UserGroupListComponent,Oe as UserGroupStateService,Te as UserItemComponent,He as UserListComponent,H as UserStateService,t as agentosReadyGuard,pe as canViewFile,re as detectFormat,ce as exchangeMutationScope,ae as formatDate,oe as formatSize,ne as getFileIcon,ie as isFormatViewable,me as isViewable,de as reindentJson};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as _n}from"./chunk-EAVXJ7QN.js";import{a as Ue,b as Be,c as xn,e as Mn,f as ce}from"./chunk-UEGZX4MW.js";import{a as wn,b as Tn,c as Sn}from"./chunk-TSYL5EEO.js";import{a as Ke}from"./chunk-DZ2M3NQD.js";import{a as je,b as K,c as ln,d as se,i as mn,j as pn,k as gn,m as un,o as hn,p as fn,r as bn,t as Qe,v as Cn,y as vn,z as Xe}from"./chunk-CRXIMHRG.js";import{a as yn}from"./chunk-GIIRKWUO.js";import{c as Kt}from"./chunk-6XX7GME4.js";import{a as An}from"./chunk-SKBEA6VH.js";import{s as In,w as Dn}from"./chunk-VNO76B3S.js";import{b as dn,h as En,i as On,j as Pn,n as kn}from"./chunk-E6T6QLQT.js";import{a as cn,c as $e}from"./chunk-VMYKE4ZC.js";import{a as R,b as z}from"./chunk-AS2L77JV.js";import{E as Ge,c as We,g as qe,m as Ye}from"./chunk-7OGOI6WM.js";import{b as X}from"./chunk-TASSC2XX.js";import{E as rn,K as an,O as re,Q as sn,R as Ne,S as ae,i as Jt,j as Zt,p as en,s as tn,t as nn,z as on}from"./chunk-G5RWG2GK.js";import{$b as He,B as q,Bb as _,D as De,Db as h,Fb as l,G as Rt,Ga as H,Ha as yt,Ja as zt,Jb as ue,Jc as ze,Ka as c,Kb as Z,Lb as ee,Lc as Xt,Mc as Mt,Pa as Nt,Pc as j,Rb as N,T as F,Tb as p,Ub as w,Vb as he,Wa as S,Wb as Ae,Xa as $t,Xc as G,Ya as jt,Z as k,Za as Ut,Zb as Fe,_ as Ht,_b as Re,_c as Q,a as de,ac as Wt,b as Pe,bc as qt,ca as m,cc as Yt,d as O,dc as Gt,fc as Ee,g as ke,ga as f,gc as Qt,h as B,ha as b,hc as St,i as Ie,jb as oe,la as Vt,lb as g,m as xt,mb as u,mc as Ve,n as At,oa as M,pa as Lt,pb as V,qb as L,rb as C,sb as a,t as ie,ta as W,tb as s,u as Ft,ub as x,va as Y,vb as wt,wb as Tt,xb as Bt,ya as ge,yc as Le}from"./chunk-CHEXA6RY.js";var Je=class i{sanitizer=m(Q);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=Ut({name:"highlight",type:i,pure:!0})};var fe=class i{http=m(G);projectState=m(X);threadState=m(K);transcribeAudio(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow();return this.http.post(`/api/projects/${o}/transcribe`,de({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`,de({audio:e,mimeType:t},n?{language:n}:{}))}static \u0275fac=function(t){return new(t||i)};static \u0275prov=k({token:i,factory:i.\u0275fac,providedIn:"root"})};var bi=["messageInput"],Ci=["fileInput"],vi=(i,e)=>e.name;function _i(i,e){i&1&&(a(0,"div",3),x(1,"span",8),p(2," Recording... Click mic to stop "),s())}function xi(i,e){i&1&&(a(0,"div",3),x(1,"span",9),p(2," Transcribing... "),s())}function yi(i,e){if(i&1&&(a(0,"span",14),p(1),s()),i&2){let t=l().$implicit,n=l(2);c(),w(" "+(n.getParameterFormat(t)||""))}}function wi(i,e){if(i&1){let t=_();a(0,"div",11),h("click",function(){let o=f(t).$index,r=l(2);return b(r.selectAutocompleteItemByClick(o))})("keydown.enter",function(){let o=f(t).$index,r=l(2);return b(r.selectAutocompleteItemByClick(o))})("keydown.space",function(){let o=f(t).$index,r=l(2);return b(r.selectAutocompleteItemByClick(o))})("mouseenter",function(){let o=f(t).$index,r=l(2);return b(r.selectedAutocompleteIndex=o)}),a(1,"div",12),x(2,"span",13),Ee(3,"highlight"),g(4,yi,2,1,"span",14),s(),x(5,"div",15),Ee(6,"highlight"),s()}if(i&2){let t=e.$implicit,n=e.$index,o=l(2);N("selected",n===o.selectedAutocompleteIndex),oe("aria-selected",n===o.selectedAutocompleteIndex),c(2),C("innerHTML",St(3,6,o.autocompleteTrigger+t.name,o.getAutocompleteQuery()),H),c(2),u(o.hasParameterFormat(t)?4:-1),c(),C("innerHTML",St(6,9,t.description,o.getAutocompleteQuery()),H)}}function Ti(i,e){if(i&1&&(a(0,"div",4),V(1,wi,7,12,"div",10,vi),s()),i&2){let t=l();c(),L(t.autocompleteItems)}}function Si(i,e){if(i&1){let t=_();a(0,"ds-icon-button",18),h("action",function(){f(t);let o=l(2);return b(o.onStopClick())}),s()}}function Mi(i,e){if(i&1){let t=_();a(0,"ds-icon-button",19),h("action",function(){f(t);let o=l(2);return b(o.sendMessage())}),s()}if(i&2){let t=l(2);N("hidden",t.isDisabled||!t.message.trim())("active",!!t.message.trim()&&!t.isDisabled),C("title",t.getSendButtonTooltip())("disabled",t.isDisabled||!t.message.trim())}}function Ei(i,e){if(i&1){let t=_();a(0,"ds-icon-button",21),h("action",function(){f(t);let o=l(3);return b(o.triggerFileUpload())}),s(),a(1,"input",22,1),h("change",function(o){f(t);let r=l(3);return b(r.onFileInputChange(o))}),s()}if(i&2){let t=l(3);C("disabled",t.isDisabled)}}function Oi(i,e){if(i&1){let t=_();g(0,Ei,3,1),a(1,"ds-icon-button",20),h("action",function(){f(t);let o=l(2);return b(o.toggleRecording())}),s()}if(i&2){let t=l(2);u(!t.showWelcome&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?0:-1),c(),N("hidden",t.message.trim()&&!t.isRecording&&!t.isTranscribing),C("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 Pi(i,e){if(i&1&&(a(0,"div",7),g(1,Si,1,0,"ds-icon-button",16),g(2,Mi,1,6,"ds-icon-button",17),g(3,Oi,2,6),s()),i&2){let t=l();c(),u(t.isThinking?1:-1),c(),u((!t.isThinking||t.message.trim())&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?2:-1),c(),u(t.isThinking?-1:3)}}var Ze=class i{isDisabled=!1;showWelcome=!1;isThinking=!1;isStarting=!1;isSessionInitializing=!1;isStopping=!1;filesPasted=new M;messageSubmitted=new M;voiceMessageReady=new M;voiceRecordingToggled=new M;heightChanged=new M;stopRequested=new M;textareaFocused=new M;messageInput;fileInput;message="";isRecording=!1;isTranscribing=!1;isFocused=!1;recognition=null;mediaRecorder=null;audioChunks=[];voiceInputMode="browser";get isVoiceMessageMode(){return this.voiceInputMode==="voice-message"}sessionHadTranscript=!1;pendingLineBreaksTimeout=null;lastProcessedResultIndex=0;useEnterToSend=!1;currentInvite="";subscriptions=[];thinkingPhrases=["Processing request...","Thinking...","Working on it..."];currentThinkingPhrase="Processing request...";thinkingPhraseIndex=0;thinkingInterval=null;autocompleteVisible=!1;autocompleteTrigger=null;autocompleteItems=[];selectedAutocompleteIndex=0;preferencesService=m(se);codayService=m(ce);agentApiService=m(_n);promptApiService=m(An);projectStateService=m(X);audioApiService=m(fe);threadStateService=m(K);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=!1,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(!0)):(navigator.platform.toLowerCase().includes("mac")?e.metaKey:e.ctrlKey)&&!e.shiftKey&&(e.preventDefault(),this.sendMessage(!0)))}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=!1){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=!0,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 O(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=!1,this.voiceRecordingToggled.emit(!1)}})}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=!1,this.voiceRecordingToggled.emit(!1)}}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=!0;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=!1;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=!1,this.voiceMessageReady.emit({base64:o,mimeType:t,language:d});return}this.audioApiService.sendVoiceMessage(o,t,d).subscribe({next:v=>{this.isTranscribing=!1,console.log("[WHISPER] Voice message sent, transcription:",v.transcription?.substring(0,50))},error:v=>{console.error("[WHISPER] Voice message error:",v),this.isTranscribing=!1,this.fallbackToTranscription(o,t,d)}})}else this.audioApiService.transcribeAudio(o,t,d).subscribe({next:v=>{this.isTranscribing=!1,v.text&&this.appendToTextarea(v.text+" ")},error:v=>{console.error("[WHISPER] Transcription error:",v),this.isTranscribing=!1}})},n.readAsDataURL(e)}fallbackToTranscription(e,t,n){this.audioApiService.transcribeAudio(e,t,n).subscribe({next:o=>{this.isTranscribing=!1,o.text&&this.appendToTextarea(o.text+" ")},error:o=>{console.error("[WHISPER] Fallback transcription also failed:",o),this.isTranscribing=!1}})}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=!0,this.recognition.interimResults=!0,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=!0,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=!1,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=!1,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 O(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=!1,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{a as _n}from"./chunk-SFQE4GQ6.js";import{a as Ue,b as Be,c as xn,e as Mn,f as ce}from"./chunk-UEGZX4MW.js";import{a as wn,b as Tn,c as Sn}from"./chunk-TSYL5EEO.js";import{a as Ke}from"./chunk-DZ2M3NQD.js";import{a as je,b as K,c as ln,d as se,i as mn,j as pn,k as gn,m as un,o as hn,p as fn,r as bn,t as Qe,v as Cn,y as vn,z as Xe}from"./chunk-CRXIMHRG.js";import{a as yn}from"./chunk-GIIRKWUO.js";import{c as Kt}from"./chunk-6XX7GME4.js";import{a as An}from"./chunk-SKBEA6VH.js";import{s as In,w as Dn}from"./chunk-VNO76B3S.js";import{b as dn,h as En,i as On,j as Pn,n as kn}from"./chunk-E6T6QLQT.js";import{a as cn,c as $e}from"./chunk-VMYKE4ZC.js";import{a as R,b as z}from"./chunk-AS2L77JV.js";import{E as Ge,c as We,g as qe,m as Ye}from"./chunk-7OGOI6WM.js";import{b as X}from"./chunk-TASSC2XX.js";import{E as rn,K as an,O as re,Q as sn,R as Ne,S as ae,i as Jt,j as Zt,p as en,s as tn,t as nn,z as on}from"./chunk-G5RWG2GK.js";import{$b as He,B as q,Bb as _,D as De,Db as h,Fb as l,G as Rt,Ga as H,Ha as yt,Ja as zt,Jb as ue,Jc as ze,Ka as c,Kb as Z,Lb as ee,Lc as Xt,Mc as Mt,Pa as Nt,Pc as j,Rb as N,T as F,Tb as p,Ub as w,Vb as he,Wa as S,Wb as Ae,Xa as $t,Xc as G,Ya as jt,Z as k,Za as Ut,Zb as Fe,_ as Ht,_b as Re,_c as Q,a as de,ac as Wt,b as Pe,bc as qt,ca as m,cc as Yt,d as O,dc as Gt,fc as Ee,g as ke,ga as f,gc as Qt,h as B,ha as b,hc as St,i as Ie,jb as oe,la as Vt,lb as g,m as xt,mb as u,mc as Ve,n as At,oa as M,pa as Lt,pb as V,qb as L,rb as C,sb as a,t as ie,ta as W,tb as s,u as Ft,ub as x,va as Y,vb as wt,wb as Tt,xb as Bt,ya as ge,yc as Le}from"./chunk-CHEXA6RY.js";var Je=class i{sanitizer=m(Q);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=Ut({name:"highlight",type:i,pure:!0})};var fe=class i{http=m(G);projectState=m(X);threadState=m(K);transcribeAudio(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow();return this.http.post(`/api/projects/${o}/transcribe`,de({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`,de({audio:e,mimeType:t},n?{language:n}:{}))}static \u0275fac=function(t){return new(t||i)};static \u0275prov=k({token:i,factory:i.\u0275fac,providedIn:"root"})};var bi=["messageInput"],Ci=["fileInput"],vi=(i,e)=>e.name;function _i(i,e){i&1&&(a(0,"div",3),x(1,"span",8),p(2," Recording... Click mic to stop "),s())}function xi(i,e){i&1&&(a(0,"div",3),x(1,"span",9),p(2," Transcribing... "),s())}function yi(i,e){if(i&1&&(a(0,"span",14),p(1),s()),i&2){let t=l().$implicit,n=l(2);c(),w(" "+(n.getParameterFormat(t)||""))}}function wi(i,e){if(i&1){let t=_();a(0,"div",11),h("click",function(){let o=f(t).$index,r=l(2);return b(r.selectAutocompleteItemByClick(o))})("keydown.enter",function(){let o=f(t).$index,r=l(2);return b(r.selectAutocompleteItemByClick(o))})("keydown.space",function(){let o=f(t).$index,r=l(2);return b(r.selectAutocompleteItemByClick(o))})("mouseenter",function(){let o=f(t).$index,r=l(2);return b(r.selectedAutocompleteIndex=o)}),a(1,"div",12),x(2,"span",13),Ee(3,"highlight"),g(4,yi,2,1,"span",14),s(),x(5,"div",15),Ee(6,"highlight"),s()}if(i&2){let t=e.$implicit,n=e.$index,o=l(2);N("selected",n===o.selectedAutocompleteIndex),oe("aria-selected",n===o.selectedAutocompleteIndex),c(2),C("innerHTML",St(3,6,o.autocompleteTrigger+t.name,o.getAutocompleteQuery()),H),c(2),u(o.hasParameterFormat(t)?4:-1),c(),C("innerHTML",St(6,9,t.description,o.getAutocompleteQuery()),H)}}function Ti(i,e){if(i&1&&(a(0,"div",4),V(1,wi,7,12,"div",10,vi),s()),i&2){let t=l();c(),L(t.autocompleteItems)}}function Si(i,e){if(i&1){let t=_();a(0,"ds-icon-button",18),h("action",function(){f(t);let o=l(2);return b(o.onStopClick())}),s()}}function Mi(i,e){if(i&1){let t=_();a(0,"ds-icon-button",19),h("action",function(){f(t);let o=l(2);return b(o.sendMessage())}),s()}if(i&2){let t=l(2);N("hidden",t.isDisabled||!t.message.trim())("active",!!t.message.trim()&&!t.isDisabled),C("title",t.getSendButtonTooltip())("disabled",t.isDisabled||!t.message.trim())}}function Ei(i,e){if(i&1){let t=_();a(0,"ds-icon-button",21),h("action",function(){f(t);let o=l(3);return b(o.triggerFileUpload())}),s(),a(1,"input",22,1),h("change",function(o){f(t);let r=l(3);return b(r.onFileInputChange(o))}),s()}if(i&2){let t=l(3);C("disabled",t.isDisabled)}}function Oi(i,e){if(i&1){let t=_();g(0,Ei,3,1),a(1,"ds-icon-button",20),h("action",function(){f(t);let o=l(2);return b(o.toggleRecording())}),s()}if(i&2){let t=l(2);u(!t.showWelcome&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?0:-1),c(),N("hidden",t.message.trim()&&!t.isRecording&&!t.isTranscribing),C("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 Pi(i,e){if(i&1&&(a(0,"div",7),g(1,Si,1,0,"ds-icon-button",16),g(2,Mi,1,6,"ds-icon-button",17),g(3,Oi,2,6),s()),i&2){let t=l();c(),u(t.isThinking?1:-1),c(),u((!t.isThinking||t.message.trim())&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?2:-1),c(),u(t.isThinking?-1:3)}}var Ze=class i{isDisabled=!1;showWelcome=!1;isThinking=!1;isStarting=!1;isSessionInitializing=!1;isStopping=!1;filesPasted=new M;messageSubmitted=new M;voiceMessageReady=new M;voiceRecordingToggled=new M;heightChanged=new M;stopRequested=new M;textareaFocused=new M;messageInput;fileInput;message="";isRecording=!1;isTranscribing=!1;isFocused=!1;recognition=null;mediaRecorder=null;audioChunks=[];voiceInputMode="browser";get isVoiceMessageMode(){return this.voiceInputMode==="voice-message"}sessionHadTranscript=!1;pendingLineBreaksTimeout=null;lastProcessedResultIndex=0;useEnterToSend=!1;currentInvite="";subscriptions=[];thinkingPhrases=["Processing request...","Thinking...","Working on it..."];currentThinkingPhrase="Processing request...";thinkingPhraseIndex=0;thinkingInterval=null;autocompleteVisible=!1;autocompleteTrigger=null;autocompleteItems=[];selectedAutocompleteIndex=0;preferencesService=m(se);codayService=m(ce);agentApiService=m(_n);promptApiService=m(An);projectStateService=m(X);audioApiService=m(fe);threadStateService=m(K);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=!1,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(!0)):(navigator.platform.toLowerCase().includes("mac")?e.metaKey:e.ctrlKey)&&!e.shiftKey&&(e.preventDefault(),this.sendMessage(!0)))}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=!1){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=!0,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 O(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=!1,this.voiceRecordingToggled.emit(!1)}})}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=!1,this.voiceRecordingToggled.emit(!1)}}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=!0;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=!1;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=!1,this.voiceMessageReady.emit({base64:o,mimeType:t,language:d});return}this.audioApiService.sendVoiceMessage(o,t,d).subscribe({next:v=>{this.isTranscribing=!1,console.log("[WHISPER] Voice message sent, transcription:",v.transcription?.substring(0,50))},error:v=>{console.error("[WHISPER] Voice message error:",v),this.isTranscribing=!1,this.fallbackToTranscription(o,t,d)}})}else this.audioApiService.transcribeAudio(o,t,d).subscribe({next:v=>{this.isTranscribing=!1,v.text&&this.appendToTextarea(v.text+" ")},error:v=>{console.error("[WHISPER] Transcription error:",v),this.isTranscribing=!1}})},n.readAsDataURL(e)}fallbackToTranscription(e,t,n){this.audioApiService.transcribeAudio(e,t,n).subscribe({next:o=>{this.isTranscribing=!1,o.text&&this.appendToTextarea(o.text+" ")},error:o=>{console.error("[WHISPER] Fallback transcription also failed:",o),this.isTranscribing=!1}})}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=!0,this.recognition.interimResults=!0,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=!0,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=!1,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=!1,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 O(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=!1,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=!1),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=!1,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=S({type:i,selectors:[["app-chat-textarea"]],viewQuery:function(t,n){if(t&1&&ue(bi,7)(Ci,5),t&2){let o;Z(o=ee())&&(n.messageInput=o.first),Z(o=ee())&&(n.fileInput=o.first)}},hostBindings:function(t,n){t&1&&h("paste",function(r){return n.onPaste(r)})("click",function(r){return n.onDocumentClick(r)},zt)},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:[Y],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=_();a(0,"div",2),g(1,_i,3,0,"div",3),g(2,xi,3,0,"div",3),g(3,Ti,3,0,"div",4),a(4,"div",5)(5,"textarea",6,0),He("ngModelChange",function(d){return f(o),Re(n.message,d)||(n.message=d),b(d)}),h("keydown",function(d){return n.onKeyDown(d)})("input",function(){return n.onInput()})("focus",function(){return f(o),n.isFocused=!0,b(n.textareaFocused.emit())})("blur",function(){return n.isFocused=!1}),s(),g(7,Pi,4,3,"div",7),s()()}t&2&&(c(),u(!n.isVoiceMessageMode&&n.isRecording?1:-1),c(),u(!n.isVoiceMessageMode&&n.isTranscribing?2:-1),c(),u(n.autocompleteVisible?3:-1),c(),N("focused",n.isFocused)("welcome-mode",n.showWelcome)("is-thinking",n.isThinking)("is-listening",n.isVoiceMessageMode&&(n.isRecording||n.isTranscribing)),c(),Fe("ngModel",n.message),C("placeholder",n.getPlaceholder())("disabled",n.isDisabled||n.isVoiceMessageMode&&(n.isRecording||n.isTranscribing)),c(2),u(n.isSessionInitializing?-1:7))},dependencies:[Ge,We,qe,Ye,In,Je],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}}']})};var be=class i{unreadCountSubject=new Ie(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=k({token:i,factory:i.\u0275fac,providedIn:"root"})};var et=class i{ATTENTION_EMOJI="\u{1F534}";isSystemActive=!1;systemActiveTimer=null;SYSTEM_ACTIVE_TIMEOUT=4e3;unreadService=m(be);project=m(X);constructor(){this.initializeTitleUpdates()}initializeTitleUpdates(){Ft([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=!0,this.systemActiveTimer&&clearTimeout(this.systemActiveTimer),this.systemActiveTimer=setTimeout(()=>{console.log("[TAB-TITLE] System active timeout - hiding hourglass"),this.isSystemActive=!1,this.forceUpdateTitle()},this.SYSTEM_ACTIVE_TIMEOUT),this.forceUpdateTitle()}setSystemInactive(){console.log("[TAB-TITLE] System inactive - hiding hourglass"),this.isSystemActive=!1,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=k({token:i,factory:i.\u0275fac,providedIn:"root"})};var tt=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=k({token:i,factory:i.\u0275fac,providedIn:"root"})};var ki=(i,e)=>e.label;function Ii(i,e){if(i&1){let t=_();a(0,"button",2),h("click",function(o){let r=f(t).$implicit,d=l();return b(d.executeAction(r,o))}),a(1,"mat-icon"),p(2),s()()}if(i&2){let t=e.$implicit;oe("title",t.tooltip||t.label),c(),oe("aria-label",t.label),c(),w(t.icon)}}var nt=class i{actions=[];executeAction(e,t){t.stopPropagation(),e.action()}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=S({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&&(a(0,"div",0),V(1,Ii,3,3,"button",1,ki),s()),t&2&&(c(),L(n.actions))},dependencies:[j,re,R],styles:[".context-menu-wrapper[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center}.context-menu-wrapper[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{transform:scale(.75)}"]})};var J=class i{renderer;constructor(){this.renderer=new wn,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!1;if(e.startsWith("//"))return!0;try{return new URL(e,window.location.href).hostname!==window.location.hostname}catch(t){return!1}}escapeHtml(e){let t={"&":"&","<":"<",">":">",'"':""","'":"'"};return e.replace(/[&<>"']/g,n=>t[n]||n)}parse(e){return O(this,null,function*(){let t=yield Tn.parse(e,{renderer:this.renderer,breaks:!0,gfm:!0});return Sn.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=k({token:i,factory:i.\u0275fac,providedIn:"root"})};var Di=i=>({"user-message-wrapper":i});function Ai(i,e){if(i&1&&(a(0,"div",4)(1,"div",8),p(2),s()()),i&2){let t=l(2);c(2),he(" ",t.message.speaker," ")}}function Fi(i,e){if(i&1&&(a(0,"time",6),p(1),s()),i&2){let t=l(2);c(),w(t.formattedTimestamp)}}function Ri(i,e){if(i&1&&(a(0,"div",7),x(1,"app-message-context-menu",9),s()),i&2){let t=l(2);c(),C("actions",t.actions)}}function Hi(i,e){if(i&1&&(g(0,Ai,3,1,"div",4),x(1,"div",5),g(2,Fi,2,1,"time",6),g(3,Ri,2,1,"div",7)),i&2){let t=l();u(t.shouldShowSpeaker?0:-1),c(),C("innerHTML",t.renderedContent,H),c(),u(t.formattedTimestamp?2:-1),c(),u(t.isLongMessage&&t.shouldShowActions&&t.message.role==="assistant"?3:-1)}}function Vi(i,e){if(i&1&&x(0,"span",12),i&2){let t=l(3);C("innerHTML",t.renderedContent,H)}}function Li(i,e){if(i&1&&(a(0,"span",13),p(1),s()),i&2){let t=l(3);c(),w(t.collapsedErrorText)}}function zi(i,e){i&1&&p(0," Show less \u25B2 ")}function Ni(i,e){i&1&&p(0," Show more \u25BC ")}function $i(i,e){if(i&1){let t=_();a(0,"div",10),g(1,Vi,1,1,"span",12)(2,Li,2,1,"span",13),a(3,"button",14),h("click",function(){f(t);let o=l(2);return b(o.toggleErrorExpanded())}),g(4,zi,1,0)(5,Ni,1,0),s()()}if(i&2){let t=l(2);c(),u(t.isErrorExpanded()?1:2),c(3),u(t.isErrorExpanded()?4:5)}}function ji(i,e){i&1&&p(0," \u25B2 ")}function Ui(i,e){i&1&&p(0," \u25BC ")}function Bi(i,e){if(i&1&&(a(0,"a",17),p(1,"view"),s()),i&2){let t=l(3);C("href",t.eventLink,yt)}}function Wi(i,e){if(i&1&&(a(0,"pre",18),p(1),s()),i&2){let t=l(3);c(),w(t.message.fullContent)}}function qi(i,e){if(i&1){let t=_();a(0,"div",15),x(1,"span",12),a(2,"button",16),h("click",function(){f(t);let o=l(2);return b(o.toggleTechnicalExpanded())}),g(3,ji,1,0)(4,Ui,1,0),s(),g(5,Bi,2,1,"a",17),s(),g(6,Wi,2,1,"pre",18)}if(i&2){let t=l(2);c(),C("innerHTML",t.renderedContent,H),c(2),u(t.isTechnicalExpanded()?3:4),c(2),u(t.eventLink?5:-1),c(),u(t.isTechnicalExpanded()?6:-1)}}function Yi(i,e){if(i&1&&(a(0,"a",17),p(1,"view"),s()),i&2){let t=l(3);C("href",t.eventLink,yt)}}function Gi(i,e){if(i&1&&(a(0,"div",11),x(1,"span",12),g(2,Yi,2,1,"a",17),s()),i&2){let t=l(2);c(),C("innerHTML",t.renderedContent,H),c(),u(t.eventLink?2:-1)}}function Qi(i,e){if(i&1&&g(0,$i,6,2,"div",10)(1,qi,7,4)(2,Gi,3,2,"div",11),i&2){let t=l();u(t.message.type==="error"&&t.isLongError?0:t.message.type==="technical"&&t.message.fullContent?1:2)}}function Xi(i,e){if(i&1&&(a(0,"div",2),x(1,"app-message-context-menu",9),s()),i&2){let t=l();c(),C("actions",t.actions)}}function Ki(i,e){if(i&1&&(a(0,"div",3),x(1,"app-message-context-menu",9),s()),i&2){let t=l();c(),C("actions",t.actions)}}var Ce=class i{destroy$=new B;message;canDelete=!0;isOtherUser=!1;containingThreadId;copyRequested=new M;deleteRequested=new M;renderedContent="";shouldHideTechnical=!1;shouldHideWarning=!1;isErrorExpanded=W(!1);static ERROR_COLLAPSE_LINE_THRESHOLD=5;isTechnicalExpanded=W(!1);sanitizer=m(Q);notificationService=m(yn);preferencesService=m(se);projectState=m(X);threadState=m(K);markdownService=m(J);get messageClasses(){return{[this.message.role]:!0,[this.message.type]:!0,"hidden-technical":this.shouldHideTechnical&&this.message.type==="technical","hidden-warning":this.shouldHideWarning&&this.message.type==="warning","other-user":this.isOtherUser}}ngOnInit(){return O(this,null,function*(){yield this.renderMarkdown(),this.preferencesService.hideTechnicalMessages$.pipe(F(this.destroy$)).subscribe(e=>{this.shouldHideTechnical=e}),this.preferencesService.hideWarningMessages$.pipe(F(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=m(Mt);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"?!1: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{a as D}from"./chunk-KB2ABAWC.js";import{b as B}from"./chunk-
|
|
1
|
+
import{a as D}from"./chunk-KB2ABAWC.js";import{b as B}from"./chunk-C2LUO2MP.js";import{c as x}from"./chunk-6XX7GME4.js";import{s as $,z as k}from"./chunk-VNO76B3S.js";import"./chunk-E6T6QLQT.js";import"./chunk-SPV5SLNS.js";import{a as l}from"./chunk-VMYKE4ZC.js";import"./chunk-AS2L77JV.js";import"./chunk-7OGOI6WM.js";import"./chunk-G5RWG2GK.js";import{Bb as b,Db as s,Fb as m,Lc as T,Pb as P,S as d,Wa as y,ab as h,ca as r,cc as w,fc as I,ga as C,gc as M,ha as _,i as p,jc as R,lb as v,ma as u,mb as A,rb as g,sb as a,t as c,tb as f}from"./chunk-CHEXA6RY.js";var S=()=>[];function F(n,t){if(n&1){let e=b();a(0,"agentos-agent-config-item",4),s("deleteRequested",function(o){C(e);let E=m(2);return _(E.deleteConfig(o))}),f()}n&2&&g("config",t)("platformMode",!0)}function L(n,t){if(n&1&&v(0,F,1,2,"agentos-agent-config-item",3),n&2){let e,i=t.$implicit,o=m();A((e=o.resolveConfig(i.id))?0:-1,e)}}var q=class n{router=r(x);destroyRef=r(u);agentConfigController=r(B);refresh$=new p(void 0);configs$=this.refresh$.pipe(d(()=>this.agentConfigController.listPlatformAgentsAgentConfig(!0)));configItems$=this.configs$.pipe(c(t=>t.map(e=>({id:e.id??"",name:e.name,description:e.description}))));configsById=new Map;constructor(){this.configs$.pipe(l(this.destroyRef)).subscribe(t=>{this.configsById=new Map(t.map(e=>[e.id??"",e]))})}goBack(){this.router.navigate(["/agentos","admin"])}openCreateForm(){this.router.navigate(["/agentos","admin","agent-configs","new"])}deleteConfig(t){this.agentConfigController.deleteAgentConfig(t.id??"").pipe(l(this.destroyRef)).subscribe(()=>this.refresh$.next())}resolveConfig(t){return this.configsById.get(t)??null}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=y({type:n,selectors:[["agentos-platform-agent-configs"]],decls:5,vars:6,consts:[["agentConfigItemTpl",""],["title","Platform Agent Configs","emptyMessage","No platform agent configs defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[3,"config","platformMode"],[3,"deleteRequested","config","platformMode"]],template:function(e,i){if(e&1&&(a(0,"ds-entity-list",1),I(1,"async"),s("createRequested",function(){return i.openCreateForm()}),a(2,"ds-icon-button",2),s("action",function(){return i.goBack()}),f()(),h(3,L,1,1,"ng-template",null,0,R)),e&2){let o=P(4);g("items",M(1,3,i.configItems$)??w(5,S))("showCreate",!0)("itemTemplate",o)}},dependencies:[k,D,$,T],styles:[".platform-agent-configs__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.platform-agent-configs__back[_ngcontent-%COMP%]:hover{text-decoration:underline}"],changeDetection:0})};export{q as PlatformAgentConfigsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as p}from"./chunk-
|
|
1
|
+
import{o as p}from"./chunk-C2LUO2MP.js";import{V as s,Z as d,a as n,ca as u,ta as a}from"./chunk-CHEXA6RY.js";var c=class o{userController=u(p);users=a([]);isLoading=a(!1);loadAll(){return this.isLoading.set(!0),this.userController.listAllUser().pipe(s({next:e=>{this.users.set(e),this.isLoading.set(!1)},error:()=>this.isLoading.set(!1)}))}createUser(e){return this.userController.createUser(e).pipe(s(()=>{this.loadAll().subscribe()}))}updateUser(e,r){let t=this.users().find(i=>i.id===e);if(!t)throw new Error(`Cannot update: user ${e} not found in state`);let U=n(n({},t),r);return this.userController.updateUser(e,U).pipe(s(i=>{this.users.update(b=>b.map(l=>l.id===i.id?i:l))}))}deleteUser(e){return this.userController.deleteUser(e).pipe(s(()=>{this.users.update(r=>r.filter(t=>t.id!==e))}))}static \u0275fac=function(r){return new(r||o)};static \u0275prov=d({token:o,factory:o.\u0275fac,providedIn:"root"})};export{c as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-45MC2DTD.js";import"./chunk-W7ONGRS7.js";import"./chunk-6QJAB37Y.js";import"./chunk-C2LUO2MP.js";import"./chunk-6XX7GME4.js";import"./chunk-VMYKE4ZC.js";import"./chunk-7OGOI6WM.js";import"./chunk-CHEXA6RY.js";export{a as UserFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-C2LUO2MP.js";import{Xc as c,Z as a,ca as s,pa as l,ta as u}from"./chunk-CHEXA6RY.js";var p="agentos_oauth_callback",h=class n{http=s(c);config=s(d);zone=s(l);popupCheckInterval=null;popupClosedAt=null;static POPUP_CLOSE_GRACE_MS=2e3;pendingQuestion=u(null);messageHandler=e=>this.handlePopupMessage(e);storageHandler=e=>this.handleStorageEvent(e);constructor(){window.addEventListener("message",this.messageHandler),window.addEventListener("storage",this.storageHandler),this.drainLocalStorage()}ngOnDestroy(){window.removeEventListener("message",this.messageHandler),window.removeEventListener("storage",this.storageHandler),this.popupCheckInterval&&clearInterval(this.popupCheckInterval)}setPendingQuestion(e){console.log("[OAuthAgentos] Pending OAuth question registered:",e.id),this.pendingQuestion.set(e)}openPopup(e){console.log("[OAuthAgentos] Opening popup from user gesture:",e.id);let t=e.question,o=600,i=900,g=window.screenX+(window.outerWidth-o)/2,v=window.screenY+(window.outerHeight-i)/2,A=`width=${o},height=${i},left=${g},top=${v},popup=yes,resizable=yes,scrollbars=yes`,r=window.open(t,"agentos_oauth_popup",A);r?(r.focus(),this.startPopupMonitoring(r,e),this.pendingQuestion.set(null)):console.warn("[OAuthAgentos] Popup was blocked by the browser")}cancelRequest(){console.log("[OAuthAgentos] OAuth cancelled by user via inline panel"),this.pendingQuestion.set(null),this.stopPopupMonitoring()}answerQuestion(e,t){this.postAnswer(e,t)}startPopupMonitoring(e,t){this.popupCheckInterval&&clearInterval(this.popupCheckInterval),this.popupClosedAt=null,this.popupCheckInterval=setInterval(()=>{if(!e.closed){this.popupClosedAt!==null&&(this.popupClosedAt=null);return}if(this.popupClosedAt===null){this.popupClosedAt=Date.now(),console.log("[OAuthAgentos] Popup closed, waiting for postMessage grace period...");return}if(Date.now()-this.popupClosedAt<n.POPUP_CLOSE_GRACE_MS)return;console.log("[OAuthAgentos] Grace period elapsed \u2014 popup closed without completing auth"),this.stopPopupMonitoring(),this.pendingQuestion()?.id===t.id&&(console.warn("[OAuthAgentos] OAuth cancelled \u2014 popup closed without completing"),this.pendingQuestion.set(null))},500)}stopPopupMonitoring(){this.popupCheckInterval&&(clearInterval(this.popupCheckInterval),this.popupCheckInterval=null),this.popupClosedAt=null}handlePopupMessage(e){if(e.origin!==window.location.origin)return;let t=e.data;!t||typeof t.success!="boolean"||(console.log("[OAuthAgentos] Received postMessage result:",t.success),this.zone.run(()=>this.processResult(t)))}handleStorageEvent(e){e.key!==p||!e.newValue||(console.log("[OAuthAgentos] Received localStorage result fallback"),this.zone.run(()=>this.drainLocalStorage()))}drainLocalStorage(){let e=localStorage.getItem(p);if(e){localStorage.removeItem(p);try{let t=JSON.parse(e);typeof t.success=="boolean"&&this.processResult(t)}catch(t){console.error("[OAuthAgentos] Failed to parse localStorage OAuth result:",t)}}}processResult(e){this.stopPopupMonitoring();let t=this.pendingQuestion();if(this.pendingQuestion.set(null),!t){console.warn("[OAuthAgentos] Received result but no pending question");return}e.success?(console.log("[OAuthAgentos] OAuth succeeded \u2014 posting AnswerEvent"),this.postAnswer(t,"OAuth authorization completed")):(console.warn("[OAuthAgentos] OAuth failed:",e.error),this.postAnswer(t,`OAuth authorization failed: ${e.error??"unknown error"}`))}postAnswer(e,t){this.http.post(`${this.config.basePath}/api/cases/${e.caseId}/messages`,{content:t,answerToEventId:e.id}).subscribe({next:()=>console.log("[OAuthAgentos] AnswerEvent posted successfully"),error:o=>console.error("[OAuthAgentos] Failed to post AnswerEvent:",o)})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=a({token:n,factory:n.\u0275fac,providedIn:"root"})};export{p as a,h as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ee}from"./chunk-KWJJEVAI.js";import{b as L}from"./chunk-UQTA3ACH.js";import{a as R,c as G}from"./chunk-6XX7GME4.js";import{a as P}from"./chunk-VMYKE4ZC.js";import{F as Z,c as J,e as u,g as $,h as B,i as N,l as g,n as q,r as I,s as U,t as j,u as Y,v as H,w as K,x as Q,y as W,z as X}from"./chunk-7OGOI6WM.js";import{Bb as M,D as A,Db as f,Fb as s,Ka as a,Rb as O,Tb as r,Ub as b,Vb as k,Wa as D,a as V,b as T,ca as y,ga as C,ha as x,lb as c,m as w,ma as z,mb as _,nb as F,pb as E,qb as S,rb as p,sb as n,ta as h,tb as o,ub as v}from"./chunk-CHEXA6RY.js";var oe=(i,t)=>t.id;function re(i,t){i&1&&(n(0,"p",5),r(1,"Loading\u2026"),o())}function ne(i,t){i&1&&(n(0,"span",12),r(1,"Name is required."),o())}function ie(i,t){if(i&1&&(n(0,"p",32),r(1),o(),n(2,"span",26),r(3,"Agent Config cannot be changed after creation."),o()),i&2){let e=s(3);a(),b(e.resolveAgentConfigName(e.agentConfigIdControl.value))}}function ae(i,t){if(i&1&&(n(0,"option",34),r(1),o()),i&2){let e=t.$implicit;p("ngValue",e.id),a(),b(e.name)}}function le(i,t){if(i&1&&(n(0,"select",33)(1,"option",34),r(2,"\u2014 None \u2014"),o(),E(3,ae,2,2,"option",34,oe),o(),n(5,"span",26),r(6,"Optional. Links this prompt to an agent as a starter. Immutable after creation."),o()),i&2){let e=s(3);p("formControl",e.agentConfigIdControl),a(),p("ngValue",null),a(2),S(e.availableAgentConfigs())}}function me(i,t){if(i&1&&(n(0,"div",8)(1,"label",31),r(2,"Agent Config"),o(),c(3,ie,4,1)(4,le,7,2),o()),i&2){let e=s(2);a(3),_(e.isEditMode()&&e.agentConfigIdControl.value?3:e.isEditMode()?-1:4)}}function pe(i,t){i&1&&(n(0,"p",19),r(1,"No parameters defined."),o())}function de(i,t){i&1&&(n(0,"span",12),r(1,"Parameter name is required."),o())}function se(i,t){if(i&1){let e=M();n(0,"div",20)(1,"div",35)(2,"div",36)(3,"label",37),r(4,"Name "),n(5,"span",10),r(6,"*"),o()(),v(7,"input",38),c(8,de,2,0,"span",12),o(),n(9,"div",36)(10,"label",37),r(11,"Description"),o(),v(12,"input",39),o(),n(13,"div",36)(14,"label",37),r(15,"Default value"),o(),v(16,"input",40),o()(),n(17,"button",41),f("click",function(){let m=C(e).$index,d=s(2);return x(d.removeParameter(m))}),r(18," \xD7 "),o()()}if(i&2){let e=t.$implicit,l=t.$index;p("formGroupName",l),a(3),p("for","param-name-"+l),a(4),O("prompt-form__input--invalid",e.controls.name.invalid&&e.controls.name.touched),p("id","param-name-"+l),a(),_(e.controls.name.invalid&&e.controls.name.touched?8:-1),a(2),p("for","param-desc-"+l),a(2),p("id","param-desc-"+l),a(2),p("for","param-default-"+l),a(2),p("id","param-default-"+l)}}function ce(i,t){i&1&&(n(0,"span",12),r(1,"Content entry must not be blank."),o())}function _e(i,t){if(i&1){let e=M();n(0,"div",22)(1,"span",42),r(2),o(),n(3,"div",43),v(4,"textarea",44),c(5,ce,2,0,"span",12),o(),n(6,"button",45),f("click",function(){let m=C(e).$index,d=s(2);return x(d.removeContentEntry(m))}),r(7," \xD7 "),o()()}if(i&2){let e=t.$implicit,l=t.$index,m=s(2);a(2),b(l+1),a(2),O("prompt-form__textarea--invalid",e.invalid&&e.touched),p("formControlName",l),a(),_(e.invalid&&e.touched?5:-1),a(),p("disabled",m.contentArray.length===1)}}function fe(i,t){if(i&1&&(n(0,"p",23),r(1),o()),i&2){let e=s(2);a(),b(e.errorMessage())}}function ue(i,t){i&1&&(n(0,"span",12),r(1,"Invalid JSON."),o())}function ge(i,t){if(i&1){let e=M();n(0,"button",46),f("click",function(){C(e);let m=s(2);return x(m.exportYaml())}),r(1),o()}if(i&2){let e=s(2);p("disabled",e.isExporting()),a(),k(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ")}}function Ce(i,t){if(i&1){let e=M();n(0,"form",7),f("ngSubmit",function(){C(e);let m=s();return x(m.submit())}),n(1,"div",8)(2,"label",9),r(3,"Name "),n(4,"span",10),r(5,"*"),o()(),v(6,"input",11),c(7,ne,2,0,"span",12),o(),n(8,"div",8)(9,"label",13),r(10,"Description"),o(),v(11,"input",14),o(),c(12,me,5,1,"div",8),n(13,"fieldset",15)(14,"legend",16),r(15," Parameters "),n(16,"span",17),r(17,"Named placeholders used in content"),o()(),n(18,"p",18),r(19," Each parameter must have a name and a default value. Use "),n(20,"code"),r(21),o(),r(22," in content entries to reference them. "),o(),c(23,pe,2,0,"p",19),E(24,se,19,10,"div",20,F),n(26,"button",21),f("click",function(){C(e);let m=s();return x(m.addParameter())}),r(27,"+ Add parameter"),o()(),n(28,"fieldset",15)(29,"legend",16),r(30," Content "),n(31,"span",10),r(32,"*"),o(),n(33,"span",17),r(34,"Ordered list of text commands"),o()(),n(35,"p",18),r(36," Each content entry is a command. Use "),n(37,"code"),r(38,"@AgentName"),o(),r(39," to target an agent, "),n(40,"code"),r(41,"/promptName param1 param2"),o(),r(42," to call another prompt, and "),n(43,"code"),r(44),o(),r(45," for parameter placeholders. "),o(),E(46,_e,8,6,"div",22,F),n(48,"button",21),f("click",function(){C(e);let m=s();return x(m.addContentEntry())}),r(49,"+ Add content entry"),o()(),c(50,fe,2,1,"p",23),n(51,"div",8)(52,"label",24),r(53,"External Metadata"),o(),v(54,"textarea",25),c(55,ue,2,0,"span",12),n(56,"span",26),r(57,"Optional. Opaque JSON object stored as-is. Leave empty to clear."),o()(),n(58,"div",27)(59,"button",28),r(60),o(),c(61,ge,2,2,"button",29),n(62,"button",30),f("click",function(){C(e);let m=s();return x(m.cancel())}),r(63,"Cancel"),o()()()}if(i&2){let e=s();p("formGroup",e.form),a(6),O("prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),p("formControl",e.nameControl),a(),_(e.nameControl.invalid&&e.nameControl.touched?7:-1),a(4),p("formControl",e.descriptionControl),a(),_(e.availableAgentConfigs().length>0?12:-1),a(),p("formArrayName","parameters"),a(8),b(e.paramPlaceholderSyntax),a(2),_(e.parametersArray.length===0?23:-1),a(),S(e.parametersArray.controls),a(4),p("formArrayName","content"),a(16),b(e.paramPlaceholderSyntax),a(2),S(e.contentArray.controls),a(4),_(e.errorMessage()?50:-1),a(4),p("formControl",e.externalMetadataJsonControl),a(),_(e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?55:-1),a(4),p("disabled",e.form.invalid||e.isSubmitting()),a(),k(" ",e.isEditMode()?"Save changes":"Create"," "),a(),_(e.isEditMode()?61:-1)}}var te=class i{route=y(R);router=y(G);destroyRef=y(z);promptState=y(ee);agentConfigController=y(L);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new N({name:new g("",{nonNullable:!0,validators:[u.required,u.minLength(1)]}),description:new g(null),agentConfigId:new g(null),externalMetadataJson:new g("",{nonNullable:!0,validators:[xe]}),content:new I([this.createContentControl()],{validators:[u.required]}),parameters:new I([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=h(!1);isSubmitting=h(!1);isLoading=h(!1);isExporting=h(!1);errorMessage=h(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=h([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(!0),this.loadPrompt(t)),this.isPlatformMode?this.loadPlatformAgentConfigs():this.namespaceId&&this.loadAgentConfigs(this.namespaceId)}loadPrompt(t){this.isLoading.set(!0),this.promptState.getById(t).pipe(P(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(!1)},error:()=>{this.isLoading.set(!1),this.navigateBack()}})}loadAgentConfigs(t){this.agentConfigController.listByParentAgentConfig(t).pipe(P(this.destroyRef),A(()=>w([]))).subscribe(e=>this.agentConfigs.set(e))}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(P(this.destroyRef),A(()=>w([]))).subscribe(t=>this.agentConfigs.set(t))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(l=>this.contentArray.push(this.createContentControl(l))),this.parametersArray.clear(),(t.parameters??[]).forEach(l=>this.parametersArray.push(this.createParameterGroup(l))),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"")}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}createContentControl(t=""){return new g(t,{nonNullable:!0,validators:[u.required,u.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl())}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t)}createParameterGroup(t){return new N({name:new g(t?.name??"",{nonNullable:!0,validators:[u.required,u.minLength(1)]}),description:new g(t?.description??null),defaultValue:new g(t?.defaultValue??"",{nonNullable:!0,validators:[u.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup())}removeParameter(t){this.parametersArray.removeAt(t)}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(!0);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=T(V({},this.existingPrompt??{}),{namespaceId:this.namespaceId,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(d=>d.value.trim()),parameters:this.parametersArray.controls.map(d=>({name:d.controls.name.value.trim(),description:d.controls.description.value?.trim()||void 0,defaultValue:d.controls.defaultValue.value.trim()}))});t||(e.agentConfigId=this.agentConfigIdControl.value||null);let l=this.externalMetadataJsonControl.value.trim();e.externalMetadata=l?JSON.parse(l):null;let m=t?this.promptState.update(this.existingPrompt.id,e):this.promptState.create(e);this.errorMessage.set(null),m.pipe(P(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:d=>{this.isSubmitting.set(!1),d.status===409?this.errorMessage.set(`A prompt named "${e.name}" already exists in this scope.`):d.status===400?this.errorMessage.set(d.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.")}})}exportYaml(){let t=this.existingPrompt?.id;!t||this.isExporting()||(this.isExporting.set(!0),this.promptState.exportAsYaml(t).pipe(P(this.destroyRef)).subscribe({next:e=>{let l=new Blob([e],{type:"application/yaml"}),m=URL.createObjectURL(l),d=document.createElement("a");d.href=m,d.download=`${this.existingPrompt?.name??"prompt"}.yaml`,d.click(),URL.revokeObjectURL(m),this.isExporting.set(!1)},error:()=>this.isExporting.set(!1)}))}cancel(){this.navigateBack()}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"])}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=D({type:i,selectors:[["agentos-prompt-form"]],decls:10,vars:3,consts:[[1,"prompt-form"],[1,"prompt-form__header"],["type","button","title","Back to prompts",1,"prompt-form__back",3,"click"],[1,"prompt-form__back-icon"],[1,"prompt-form__title"],[1,"prompt-form__loading"],[1,"prompt-form__form",3,"formGroup"],[1,"prompt-form__form",3,"ngSubmit","formGroup"],[1,"prompt-form__field"],["for","prompt-name",1,"prompt-form__label"],["aria-hidden","true"],["id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",1,"prompt-form__input",3,"formControl"],[1,"prompt-form__field-error"],["for","prompt-description",1,"prompt-form__label"],["id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",1,"prompt-form__input",3,"formControl"],[1,"prompt-form__section",3,"formArrayName"],[1,"prompt-form__label"],[1,"prompt-form__label-hint"],[1,"prompt-form__section-hint"],[1,"prompt-form__empty-hint"],[1,"prompt-form__param-row",3,"formGroupName"],["type","button",1,"prompt-form__add-btn",3,"click"],[1,"prompt-form__content-row"],[1,"prompt-form__error"],["for","prompt-external-metadata",1,"prompt-form__label"],["id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",1,"prompt-form__textarea","prompt-form__textarea--code",3,"formControl"],[1,"prompt-form__field-hint"],[1,"prompt-form__actions"],["type","submit",1,"prompt-form__btn","prompt-form__btn--primary",3,"disabled"],["type","button",1,"prompt-form__btn","prompt-form__btn--export",3,"disabled"],["type","button",1,"prompt-form__btn",3,"click"],["for","prompt-agent-config",1,"prompt-form__label"],[1,"prompt-form__readonly-value"],["id","prompt-agent-config",1,"prompt-form__select",3,"formControl"],[3,"ngValue"],[1,"prompt-form__param-fields"],[1,"prompt-form__field","prompt-form__field--inline"],[1,"prompt-form__label",3,"for"],["type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",1,"prompt-form__input",3,"id"],["type","text","placeholder","Optional","formControlName","description","autocomplete","off",1,"prompt-form__input",3,"id"],["type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",1,"prompt-form__input",3,"id"],["type","button","title","Remove this parameter",1,"prompt-form__remove-btn",3,"click"],[1,"prompt-form__content-index"],[1,"prompt-form__content-field"],["rows","4","placeholder","Enter a command\u2026",1,"prompt-form__textarea",3,"formControlName"],["type","button","title","Remove this entry",1,"prompt-form__remove-btn",3,"click","disabled"],["type","button",1,"prompt-form__btn","prompt-form__btn--export",3,"click","disabled"]],template:function(e,l){e&1&&(n(0,"div",0)(1,"header",1)(2,"button",2),f("click",function(){return l.cancel()}),n(3,"span",3),r(4,"\u2190"),o(),r(5),o(),n(6,"h1",4),r(7),o()(),c(8,re,2,0,"p",5)(9,Ce,64,18,"form",6),o()),e&2&&(a(5),k(" ",l.isPlatformMode?"Platform prompts":"Prompts"," "),a(2),b(l.isEditMode()?"Edit prompt":"New prompt"),a(),_(l.isLoading()?8:9))},dependencies:[Z,q,W,X,J,Q,$,B,U,K,H,j,Y],styles:[".prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.prompt-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.prompt-form__field--inline[_ngcontent-%COMP%]{flex:1}.prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.prompt-form__label-hint[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary);margin-left:.375rem}.prompt-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;cursor:pointer;appearance:auto;transition:border-color .15s ease}.prompt-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;padding:.5rem .875rem;border-radius:0;background:var(--color-bg-hover);border:1px solid var(--color-divider);color:var(--color-text);font-size:.9375rem}.prompt-form__input[_ngcontent-%COMP%], .prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.prompt-form__input[_ngcontent-%COMP%]:focus, .prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.prompt-form__input[_ngcontent-%COMP%]::placeholder, .prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.prompt-form__textarea--code[_ngcontent-%COMP%]{font-family:monospace;font-size:.85rem;resize:vertical}.prompt-form__section[_ngcontent-%COMP%]{border:1px solid var(--color-divider);border-radius:0;padding:1rem;margin:0;display:flex;flex-direction:column;gap:.75rem}.prompt-form__section-hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.prompt-form__empty-hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}.prompt-form__content-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-start}.prompt-form__content-field[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.25rem}.prompt-form__content-index[_ngcontent-%COMP%]{flex-shrink:0;width:1.5rem;padding-top:.6rem;font-size:.8rem;font-weight:600;color:var(--color-text-secondary);text-align:right;-webkit-user-select:none;user-select:none}.prompt-form__param-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-end;padding:.75rem;border-radius:0;background:var(--color-bg-hover)}.prompt-form__param-fields[_ngcontent-%COMP%]{flex:1;display:flex;gap:.75rem;flex-wrap:wrap}.prompt-form__add-btn[_ngcontent-%COMP%]{align-self:flex-start;padding:.4rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-accent);font-size:.875rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.prompt-form__add-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-accent)}.prompt-form__remove-btn[_ngcontent-%COMP%]{flex-shrink:0;width:1.75rem;height:1.75rem;display:flex;align-items:center;justify-content:center;border-radius:0;border:1px solid transparent;background:transparent;color:var(--color-neutral-500);font-size:1rem;line-height:1;cursor:pointer;transition:background .15s ease,color .15s ease,border-color .15s ease}.prompt-form__remove-btn[_ngcontent-%COMP%]:hover:not(:disabled){background:color-mix(in srgb,var(--red) 10%,transparent);color:var(--red);border-color:var(--red)}.prompt-form__remove-btn[_ngcontent-%COMP%]:disabled{opacity:.3;cursor:not-allowed}.prompt-form__error[_ngcontent-%COMP%]{margin:0;padding:.625rem .875rem;border-radius:0;background:color-mix(in srgb,var(--red) 10%,transparent);border:1px solid var(--red);color:var(--red);font-size:.875rem;line-height:1.4}.prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--red);line-height:1.3}.prompt-form__input--invalid[_ngcontent-%COMP%], .prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--red)}.prompt-form__input--invalid[_ngcontent-%COMP%]:focus, .prompt-form__textarea--invalid[_ngcontent-%COMP%]:focus{border-color:var(--red)}.prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}.prompt-form__btn--export[_ngcontent-%COMP%]{border-color:var(--color-divider);color:var(--color-text-secondary)}.prompt-form__btn--export[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--color-accent);color:var(--color-accent)}"],changeDetection:0})};function xe(i){let t=i.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return{invalidJson:!0}}}export{te as PromptFormComponent};
|
|
1
|
+
import{a as ee}from"./chunk-LIBCKDBU.js";import{b as L}from"./chunk-C2LUO2MP.js";import{a as R,c as G}from"./chunk-6XX7GME4.js";import{a as P}from"./chunk-VMYKE4ZC.js";import{F as Z,c as J,e as u,g as $,h as B,i as N,l as g,n as q,r as I,s as U,t as j,u as Y,v as H,w as K,x as Q,y as W,z as X}from"./chunk-7OGOI6WM.js";import{Bb as M,D as A,Db as f,Fb as s,Ka as a,Rb as O,Tb as r,Ub as b,Vb as k,Wa as D,a as V,b as T,ca as y,ga as C,ha as x,lb as c,m as w,ma as z,mb as _,nb as F,pb as E,qb as S,rb as p,sb as n,ta as h,tb as o,ub as v}from"./chunk-CHEXA6RY.js";var oe=(i,t)=>t.id;function re(i,t){i&1&&(n(0,"p",5),r(1,"Loading\u2026"),o())}function ne(i,t){i&1&&(n(0,"span",12),r(1,"Name is required."),o())}function ie(i,t){if(i&1&&(n(0,"p",32),r(1),o(),n(2,"span",26),r(3,"Agent Config cannot be changed after creation."),o()),i&2){let e=s(3);a(),b(e.resolveAgentConfigName(e.agentConfigIdControl.value))}}function ae(i,t){if(i&1&&(n(0,"option",34),r(1),o()),i&2){let e=t.$implicit;p("ngValue",e.id),a(),b(e.name)}}function le(i,t){if(i&1&&(n(0,"select",33)(1,"option",34),r(2,"\u2014 None \u2014"),o(),E(3,ae,2,2,"option",34,oe),o(),n(5,"span",26),r(6,"Optional. Links this prompt to an agent as a starter. Immutable after creation."),o()),i&2){let e=s(3);p("formControl",e.agentConfigIdControl),a(),p("ngValue",null),a(2),S(e.availableAgentConfigs())}}function me(i,t){if(i&1&&(n(0,"div",8)(1,"label",31),r(2,"Agent Config"),o(),c(3,ie,4,1)(4,le,7,2),o()),i&2){let e=s(2);a(3),_(e.isEditMode()&&e.agentConfigIdControl.value?3:e.isEditMode()?-1:4)}}function pe(i,t){i&1&&(n(0,"p",19),r(1,"No parameters defined."),o())}function de(i,t){i&1&&(n(0,"span",12),r(1,"Parameter name is required."),o())}function se(i,t){if(i&1){let e=M();n(0,"div",20)(1,"div",35)(2,"div",36)(3,"label",37),r(4,"Name "),n(5,"span",10),r(6,"*"),o()(),v(7,"input",38),c(8,de,2,0,"span",12),o(),n(9,"div",36)(10,"label",37),r(11,"Description"),o(),v(12,"input",39),o(),n(13,"div",36)(14,"label",37),r(15,"Default value"),o(),v(16,"input",40),o()(),n(17,"button",41),f("click",function(){let m=C(e).$index,d=s(2);return x(d.removeParameter(m))}),r(18," \xD7 "),o()()}if(i&2){let e=t.$implicit,l=t.$index;p("formGroupName",l),a(3),p("for","param-name-"+l),a(4),O("prompt-form__input--invalid",e.controls.name.invalid&&e.controls.name.touched),p("id","param-name-"+l),a(),_(e.controls.name.invalid&&e.controls.name.touched?8:-1),a(2),p("for","param-desc-"+l),a(2),p("id","param-desc-"+l),a(2),p("for","param-default-"+l),a(2),p("id","param-default-"+l)}}function ce(i,t){i&1&&(n(0,"span",12),r(1,"Content entry must not be blank."),o())}function _e(i,t){if(i&1){let e=M();n(0,"div",22)(1,"span",42),r(2),o(),n(3,"div",43),v(4,"textarea",44),c(5,ce,2,0,"span",12),o(),n(6,"button",45),f("click",function(){let m=C(e).$index,d=s(2);return x(d.removeContentEntry(m))}),r(7," \xD7 "),o()()}if(i&2){let e=t.$implicit,l=t.$index,m=s(2);a(2),b(l+1),a(2),O("prompt-form__textarea--invalid",e.invalid&&e.touched),p("formControlName",l),a(),_(e.invalid&&e.touched?5:-1),a(),p("disabled",m.contentArray.length===1)}}function fe(i,t){if(i&1&&(n(0,"p",23),r(1),o()),i&2){let e=s(2);a(),b(e.errorMessage())}}function ue(i,t){i&1&&(n(0,"span",12),r(1,"Invalid JSON."),o())}function ge(i,t){if(i&1){let e=M();n(0,"button",46),f("click",function(){C(e);let m=s(2);return x(m.exportYaml())}),r(1),o()}if(i&2){let e=s(2);p("disabled",e.isExporting()),a(),k(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ")}}function Ce(i,t){if(i&1){let e=M();n(0,"form",7),f("ngSubmit",function(){C(e);let m=s();return x(m.submit())}),n(1,"div",8)(2,"label",9),r(3,"Name "),n(4,"span",10),r(5,"*"),o()(),v(6,"input",11),c(7,ne,2,0,"span",12),o(),n(8,"div",8)(9,"label",13),r(10,"Description"),o(),v(11,"input",14),o(),c(12,me,5,1,"div",8),n(13,"fieldset",15)(14,"legend",16),r(15," Parameters "),n(16,"span",17),r(17,"Named placeholders used in content"),o()(),n(18,"p",18),r(19," Each parameter must have a name and a default value. Use "),n(20,"code"),r(21),o(),r(22," in content entries to reference them. "),o(),c(23,pe,2,0,"p",19),E(24,se,19,10,"div",20,F),n(26,"button",21),f("click",function(){C(e);let m=s();return x(m.addParameter())}),r(27,"+ Add parameter"),o()(),n(28,"fieldset",15)(29,"legend",16),r(30," Content "),n(31,"span",10),r(32,"*"),o(),n(33,"span",17),r(34,"Ordered list of text commands"),o()(),n(35,"p",18),r(36," Each content entry is a command. Use "),n(37,"code"),r(38,"@AgentName"),o(),r(39," to target an agent, "),n(40,"code"),r(41,"/promptName param1 param2"),o(),r(42," to call another prompt, and "),n(43,"code"),r(44),o(),r(45," for parameter placeholders. "),o(),E(46,_e,8,6,"div",22,F),n(48,"button",21),f("click",function(){C(e);let m=s();return x(m.addContentEntry())}),r(49,"+ Add content entry"),o()(),c(50,fe,2,1,"p",23),n(51,"div",8)(52,"label",24),r(53,"External Metadata"),o(),v(54,"textarea",25),c(55,ue,2,0,"span",12),n(56,"span",26),r(57,"Optional. Opaque JSON object stored as-is. Leave empty to clear."),o()(),n(58,"div",27)(59,"button",28),r(60),o(),c(61,ge,2,2,"button",29),n(62,"button",30),f("click",function(){C(e);let m=s();return x(m.cancel())}),r(63,"Cancel"),o()()()}if(i&2){let e=s();p("formGroup",e.form),a(6),O("prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),p("formControl",e.nameControl),a(),_(e.nameControl.invalid&&e.nameControl.touched?7:-1),a(4),p("formControl",e.descriptionControl),a(),_(e.availableAgentConfigs().length>0?12:-1),a(),p("formArrayName","parameters"),a(8),b(e.paramPlaceholderSyntax),a(2),_(e.parametersArray.length===0?23:-1),a(),S(e.parametersArray.controls),a(4),p("formArrayName","content"),a(16),b(e.paramPlaceholderSyntax),a(2),S(e.contentArray.controls),a(4),_(e.errorMessage()?50:-1),a(4),p("formControl",e.externalMetadataJsonControl),a(),_(e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?55:-1),a(4),p("disabled",e.form.invalid||e.isSubmitting()),a(),k(" ",e.isEditMode()?"Save changes":"Create"," "),a(),_(e.isEditMode()?61:-1)}}var te=class i{route=y(R);router=y(G);destroyRef=y(z);promptState=y(ee);agentConfigController=y(L);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new N({name:new g("",{nonNullable:!0,validators:[u.required,u.minLength(1)]}),description:new g(null),agentConfigId:new g(null),externalMetadataJson:new g("",{nonNullable:!0,validators:[xe]}),content:new I([this.createContentControl()],{validators:[u.required]}),parameters:new I([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=h(!1);isSubmitting=h(!1);isLoading=h(!1);isExporting=h(!1);errorMessage=h(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=h([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(!0),this.loadPrompt(t)),this.isPlatformMode?this.loadPlatformAgentConfigs():this.namespaceId&&this.loadAgentConfigs(this.namespaceId)}loadPrompt(t){this.isLoading.set(!0),this.promptState.getById(t).pipe(P(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(!1)},error:()=>{this.isLoading.set(!1),this.navigateBack()}})}loadAgentConfigs(t){this.agentConfigController.listByParentAgentConfig(t).pipe(P(this.destroyRef),A(()=>w([]))).subscribe(e=>this.agentConfigs.set(e))}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(P(this.destroyRef),A(()=>w([]))).subscribe(t=>this.agentConfigs.set(t))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(l=>this.contentArray.push(this.createContentControl(l))),this.parametersArray.clear(),(t.parameters??[]).forEach(l=>this.parametersArray.push(this.createParameterGroup(l))),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"")}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}createContentControl(t=""){return new g(t,{nonNullable:!0,validators:[u.required,u.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl())}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t)}createParameterGroup(t){return new N({name:new g(t?.name??"",{nonNullable:!0,validators:[u.required,u.minLength(1)]}),description:new g(t?.description??null),defaultValue:new g(t?.defaultValue??"",{nonNullable:!0,validators:[u.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup())}removeParameter(t){this.parametersArray.removeAt(t)}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(!0);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=T(V({},this.existingPrompt??{}),{namespaceId:this.namespaceId,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(d=>d.value.trim()),parameters:this.parametersArray.controls.map(d=>({name:d.controls.name.value.trim(),description:d.controls.description.value?.trim()||void 0,defaultValue:d.controls.defaultValue.value.trim()}))});t||(e.agentConfigId=this.agentConfigIdControl.value||null);let l=this.externalMetadataJsonControl.value.trim();e.externalMetadata=l?JSON.parse(l):null;let m=t?this.promptState.update(this.existingPrompt.id,e):this.promptState.create(e);this.errorMessage.set(null),m.pipe(P(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:d=>{this.isSubmitting.set(!1),d.status===409?this.errorMessage.set(`A prompt named "${e.name}" already exists in this scope.`):d.status===400?this.errorMessage.set(d.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.")}})}exportYaml(){let t=this.existingPrompt?.id;!t||this.isExporting()||(this.isExporting.set(!0),this.promptState.exportAsYaml(t).pipe(P(this.destroyRef)).subscribe({next:e=>{let l=new Blob([e],{type:"application/yaml"}),m=URL.createObjectURL(l),d=document.createElement("a");d.href=m,d.download=`${this.existingPrompt?.name??"prompt"}.yaml`,d.click(),URL.revokeObjectURL(m),this.isExporting.set(!1)},error:()=>this.isExporting.set(!1)}))}cancel(){this.navigateBack()}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"])}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=D({type:i,selectors:[["agentos-prompt-form"]],decls:10,vars:3,consts:[[1,"prompt-form"],[1,"prompt-form__header"],["type","button","title","Back to prompts",1,"prompt-form__back",3,"click"],[1,"prompt-form__back-icon"],[1,"prompt-form__title"],[1,"prompt-form__loading"],[1,"prompt-form__form",3,"formGroup"],[1,"prompt-form__form",3,"ngSubmit","formGroup"],[1,"prompt-form__field"],["for","prompt-name",1,"prompt-form__label"],["aria-hidden","true"],["id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",1,"prompt-form__input",3,"formControl"],[1,"prompt-form__field-error"],["for","prompt-description",1,"prompt-form__label"],["id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",1,"prompt-form__input",3,"formControl"],[1,"prompt-form__section",3,"formArrayName"],[1,"prompt-form__label"],[1,"prompt-form__label-hint"],[1,"prompt-form__section-hint"],[1,"prompt-form__empty-hint"],[1,"prompt-form__param-row",3,"formGroupName"],["type","button",1,"prompt-form__add-btn",3,"click"],[1,"prompt-form__content-row"],[1,"prompt-form__error"],["for","prompt-external-metadata",1,"prompt-form__label"],["id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",1,"prompt-form__textarea","prompt-form__textarea--code",3,"formControl"],[1,"prompt-form__field-hint"],[1,"prompt-form__actions"],["type","submit",1,"prompt-form__btn","prompt-form__btn--primary",3,"disabled"],["type","button",1,"prompt-form__btn","prompt-form__btn--export",3,"disabled"],["type","button",1,"prompt-form__btn",3,"click"],["for","prompt-agent-config",1,"prompt-form__label"],[1,"prompt-form__readonly-value"],["id","prompt-agent-config",1,"prompt-form__select",3,"formControl"],[3,"ngValue"],[1,"prompt-form__param-fields"],[1,"prompt-form__field","prompt-form__field--inline"],[1,"prompt-form__label",3,"for"],["type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",1,"prompt-form__input",3,"id"],["type","text","placeholder","Optional","formControlName","description","autocomplete","off",1,"prompt-form__input",3,"id"],["type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",1,"prompt-form__input",3,"id"],["type","button","title","Remove this parameter",1,"prompt-form__remove-btn",3,"click"],[1,"prompt-form__content-index"],[1,"prompt-form__content-field"],["rows","4","placeholder","Enter a command\u2026",1,"prompt-form__textarea",3,"formControlName"],["type","button","title","Remove this entry",1,"prompt-form__remove-btn",3,"click","disabled"],["type","button",1,"prompt-form__btn","prompt-form__btn--export",3,"click","disabled"]],template:function(e,l){e&1&&(n(0,"div",0)(1,"header",1)(2,"button",2),f("click",function(){return l.cancel()}),n(3,"span",3),r(4,"\u2190"),o(),r(5),o(),n(6,"h1",4),r(7),o()(),c(8,re,2,0,"p",5)(9,Ce,64,18,"form",6),o()),e&2&&(a(5),k(" ",l.isPlatformMode?"Platform prompts":"Prompts"," "),a(2),b(l.isEditMode()?"Edit prompt":"New prompt"),a(),_(l.isLoading()?8:9))},dependencies:[Z,q,W,X,J,Q,$,B,U,K,H,j,Y],styles:[".prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.prompt-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.prompt-form__field--inline[_ngcontent-%COMP%]{flex:1}.prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.prompt-form__label-hint[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary);margin-left:.375rem}.prompt-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;cursor:pointer;appearance:auto;transition:border-color .15s ease}.prompt-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;padding:.5rem .875rem;border-radius:0;background:var(--color-bg-hover);border:1px solid var(--color-divider);color:var(--color-text);font-size:.9375rem}.prompt-form__input[_ngcontent-%COMP%], .prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.prompt-form__input[_ngcontent-%COMP%]:focus, .prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.prompt-form__input[_ngcontent-%COMP%]::placeholder, .prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.prompt-form__textarea--code[_ngcontent-%COMP%]{font-family:monospace;font-size:.85rem;resize:vertical}.prompt-form__section[_ngcontent-%COMP%]{border:1px solid var(--color-divider);border-radius:0;padding:1rem;margin:0;display:flex;flex-direction:column;gap:.75rem}.prompt-form__section-hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.prompt-form__empty-hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}.prompt-form__content-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-start}.prompt-form__content-field[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.25rem}.prompt-form__content-index[_ngcontent-%COMP%]{flex-shrink:0;width:1.5rem;padding-top:.6rem;font-size:.8rem;font-weight:600;color:var(--color-text-secondary);text-align:right;-webkit-user-select:none;user-select:none}.prompt-form__param-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-end;padding:.75rem;border-radius:0;background:var(--color-bg-hover)}.prompt-form__param-fields[_ngcontent-%COMP%]{flex:1;display:flex;gap:.75rem;flex-wrap:wrap}.prompt-form__add-btn[_ngcontent-%COMP%]{align-self:flex-start;padding:.4rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-accent);font-size:.875rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.prompt-form__add-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-accent)}.prompt-form__remove-btn[_ngcontent-%COMP%]{flex-shrink:0;width:1.75rem;height:1.75rem;display:flex;align-items:center;justify-content:center;border-radius:0;border:1px solid transparent;background:transparent;color:var(--color-neutral-500);font-size:1rem;line-height:1;cursor:pointer;transition:background .15s ease,color .15s ease,border-color .15s ease}.prompt-form__remove-btn[_ngcontent-%COMP%]:hover:not(:disabled){background:color-mix(in srgb,var(--red) 10%,transparent);color:var(--red);border-color:var(--red)}.prompt-form__remove-btn[_ngcontent-%COMP%]:disabled{opacity:.3;cursor:not-allowed}.prompt-form__error[_ngcontent-%COMP%]{margin:0;padding:.625rem .875rem;border-radius:0;background:color-mix(in srgb,var(--red) 10%,transparent);border:1px solid var(--red);color:var(--red);font-size:.875rem;line-height:1.4}.prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--red);line-height:1.3}.prompt-form__input--invalid[_ngcontent-%COMP%], .prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--red)}.prompt-form__input--invalid[_ngcontent-%COMP%]:focus, .prompt-form__textarea--invalid[_ngcontent-%COMP%]:focus{border-color:var(--red)}.prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}.prompt-form__btn--export[_ngcontent-%COMP%]{border-color:var(--color-divider);color:var(--color-text-secondary)}.prompt-form__btn--export[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--color-accent);color:var(--color-accent)}"],changeDetection:0})};function xe(i){let t=i.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return{invalidJson:!0}}}export{te as PromptFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as L}from"./chunk-KHMEGI4Z.js";import{b as z}from"./chunk-UQTA3ACH.js";import"./chunk-TSYL5EEO.js";import{a as T,c as A,d as D}from"./chunk-6XX7GME4.js";import{a as N}from"./chunk-VMYKE4ZC.js";import{Bb as b,Db as f,Fb as l,Ga as M,Ka as r,Rb as u,Tb as a,Ub as p,Vb as h,Wa as I,ca as _,fc as O,ga as C,gc as w,ha as x,jb as v,lb as d,ma as P,mb as s,pb as S,qb as E,rb as y,sb as i,ta as m,tb as t,ub as k}from"./chunk-CHEXA6RY.js";var F=(n,o)=>o.name;function B(n,o){n&1&&(i(0,"p",6),a(1,"Loading\u2026"),t())}function $(n,o){n&1&&(i(0,"p",7),a(1,"Failed to load agent definition."),t())}function j(n,o){if(n&1&&(i(0,"dt",12),a(1,"User context"),t(),i(2,"dd",14),a(3),t()),n&2){let e=l();r(3),p(e.userId)}}function H(n,o){if(n&1&&(i(0,"pre",21),a(1),t()),n&2){let e=l(2);r(),p(e.systemPrompt)}}function J(n,o){if(n&1){let e=b();i(0,"section",9)(1,"button",19),f("click",function(){C(e);let g=l(2);return x(g.toggleSystemPrompt())}),i(2,"h2",10),a(3,"System Prompt"),t(),i(4,"span",20),a(5," \u25BC "),t()(),d(6,H,2,1,"pre",21),t()}if(n&2){let e=l(2);r(),v("aria-expanded",!e.systemPromptCollapsed()),r(3),u("agent-config-inspect__chevron--open",!e.systemPromptCollapsed()),r(2),s(e.systemPromptCollapsed()?-1:6)}}function U(n,o){if(n&1&&(i(0,"pre",21),a(1),t()),n&2){let e=l(2);r(),p(e.instructions)}}function G(n,o){if(n&1){let e=b();i(0,"section",9)(1,"button",19),f("click",function(){C(e);let g=l(2);return x(g.toggleInstructions())}),i(2,"h2",10),a(3,"Instructions"),t(),i(4,"span",20),a(5," \u25BC "),t()(),d(6,U,2,1,"pre",21),t()}if(n&2){let e=l(2);r(),v("aria-expanded",!e.instructionsCollapsed()),r(3),u("agent-config-inspect__chevron--open",!e.instructionsCollapsed()),r(2),s(e.instructionsCollapsed()?-1:6)}}function q(n,o){n&1&&(i(0,"p",17),a(1,"No tools available for this agent."),t())}function K(n,o){if(n&1&&(k(0,"div",26),O(1,"agentosMarkdown")),n&2){let e=l(2).$implicit;y("innerHTML",w(1,1,e.description),M)}}function Q(n,o){if(n&1&&(i(0,"div",25),d(1,K,2,3,"div",26),i(2,"pre",27),a(3),t()()),n&2){let e=l().$implicit,c=l(3);r(),s(e.description?1:-1),r(2),p(c.formatSchema(e.inputSchema))}}function W(n,o){if(n&1){let e=b();i(0,"li",22)(1,"button",23),f("click",function(){let g=C(e).$implicit,V=l(3);return x(V.toggleTool(g))}),i(2,"span",24),a(3),t(),i(4,"span",20),a(5," \u25BC "),t()(),d(6,Q,4,2,"div",25),t()}if(n&2){let e=o.$implicit,c=l(3);r(),v("aria-expanded",c.isToolExpanded(e)),r(2),p(e.name),r(),u("agent-config-inspect__chevron--open",c.isToolExpanded(e)),r(2),s(c.isToolExpanded(e)?6:-1)}}function X(n,o){if(n&1&&(i(0,"ul",18),S(1,W,7,5,"li",22,F),t()),n&2){let e=l();r(),E(e.tools)}}function Y(n,o){if(n&1&&(i(0,"div",8)(1,"section",9)(2,"h2",10),a(3,"General"),t(),i(4,"dl",11)(5,"dt",12),a(6,"Name"),t(),i(7,"dd",13),a(8),t(),i(9,"dt",12),a(10,"Resolved model"),t(),i(11,"dd",14),a(12),t(),i(13,"dt",12),a(14,"Provider"),t(),i(15,"dd",13),a(16),t(),i(17,"dt",12),a(18,"Advanced execution"),t(),i(19,"dd",13)(20,"span",15),a(21),t()(),d(22,j,4,1),t()(),d(23,J,7,4,"section",9),d(24,G,7,4,"section",9),i(25,"section",9)(26,"h2",10),a(27," Tools "),i(28,"span",16),a(29),t()(),d(30,q,2,0,"p",17)(31,X,3,0,"ul",18),t()()),n&2){let e=o;r(8),p(e.name),r(4),p(e.resolvedModelApiName),r(4),p(e.resolvedProviderName),r(4),u("agent-config-inspect__badge--active",e.advancedExecution),r(),h(" ",e.advancedExecution?"Enabled":"Disabled"," "),r(),s(e.userId?22:-1),r(),s(e.systemPrompt?23:-1),r(),s(e.instructions?24:-1),r(5),h("(",e.tools.length,")"),r(),s(e.tools.length===0?30:31)}}var R=class n{route=_(T);router=_(A);destroyRef=_(P);agentConfigController=_(z);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.params.agentConfigId;isPlatformMode=!this.namespaceId;isLoading=m(!0);hasError=m(!1);definition=m(null);expandedTools=m(new Set);systemPromptCollapsed=m(!0);instructionsCollapsed=m(!0);ngOnInit(){this.agentConfigController.getDefinitionAgentConfig(this.agentConfigId).pipe(N(this.destroyRef)).subscribe({next:o=>{this.definition.set(o),this.isLoading.set(!1)},error:()=>{this.hasError.set(!0),this.isLoading.set(!1)}})}toggleTool(o){this.expandedTools.update(e=>{let c=new Set(e);return c.has(o.name)?c.delete(o.name):c.add(o.name),c})}isToolExpanded(o){return this.expandedTools().has(o.name)}toggleSystemPrompt(){this.systemPromptCollapsed.update(o=>!o)}toggleInstructions(){this.instructionsCollapsed.update(o=>!o)}formatSchema(o){try{return JSON.stringify(JSON.parse(o),null,2)}catch(e){return o}}editRoute(){return this.isPlatformMode?["/agentos","admin","agent-configs",this.agentConfigId,"edit"]:["/agentos",this.namespaceId,"agent-configs",this.agentConfigId,"edit"]}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"])}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=I({type:n,selectors:[["agentos-agent-config-inspect"]],decls:13,vars:2,consts:[[1,"agent-config-inspect"],[1,"agent-config-inspect__header"],["type","button","title","Back to agent configs",1,"agent-config-inspect__back",3,"click"],[1,"agent-config-inspect__back-icon"],[1,"agent-config-inspect__title"],[1,"agent-config-inspect__sibling-link",3,"routerLink"],[1,"agent-config-inspect__loading"],[1,"agent-config-inspect__error"],[1,"agent-config-inspect__content"],[1,"agent-config-inspect__section"],[1,"agent-config-inspect__section-title"],[1,"agent-config-inspect__dl"],[1,"agent-config-inspect__dt"],[1,"agent-config-inspect__dd"],[1,"agent-config-inspect__dd","agent-config-inspect__dd--mono"],[1,"agent-config-inspect__badge"],[1,"agent-config-inspect__count"],[1,"agent-config-inspect__empty"],[1,"agent-config-inspect__tools"],["type","button",1,"agent-config-inspect__collapsible",3,"click"],[1,"agent-config-inspect__chevron"],[1,"agent-config-inspect__instructions"],[1,"agent-config-inspect__tool"],["type","button",1,"agent-config-inspect__tool-header",3,"click"],[1,"agent-config-inspect__tool-name"],[1,"agent-config-inspect__tool-body"],[1,"agent-config-inspect__tool-description",3,"innerHTML"],[1,"agent-config-inspect__schema"]],template:function(e,c){if(e&1&&(i(0,"div",0)(1,"header",1)(2,"button",2),f("click",function(){return c.back()}),i(3,"span",3),a(4,"\u2190"),t(),a(5," Agent Configs "),t(),i(6,"h1",4),a(7,"Agent definition"),t(),i(8,"a",5),a(9,"Edit config \u2192"),t()(),d(10,B,2,0,"p",6)(11,$,2,0,"p",7)(12,Y,32,11,"div",8),t()),e&2){let g;r(8),y("routerLink",c.editRoute()),r(2),s(c.isLoading()?10:c.hasError()?11:(g=c.definition())?12:-1,g)}},dependencies:[D,L],styles:[".agent-config-inspect[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:720px;margin:0 auto;padding:2rem 1rem}.agent-config-inspect__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.agent-config-inspect__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.agent-config-inspect__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.agent-config-inspect__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.agent-config-inspect__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.agent-config-inspect__sibling-link[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-primary, #007aff);text-decoration:none}.agent-config-inspect__sibling-link[_ngcontent-%COMP%]:hover{text-decoration:underline}.agent-config-inspect__loading[_ngcontent-%COMP%], .agent-config-inspect__error[_ngcontent-%COMP%], .agent-config-inspect__empty[_ngcontent-%COMP%]{margin:0;font-size:.9rem;color:var(--color-text-secondary, #6e6e73)}.agent-config-inspect__error[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.agent-config-inspect__content[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.agent-config-inspect__section[_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:10px}.agent-config-inspect__section-title[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;font-weight:600;color:var(--color-text, #1d1d1f)}.agent-config-inspect__count[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary, #6e6e73);font-size:.875rem;margin-left:.25rem}.agent-config-inspect__dl[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content 1fr;gap:.5rem 1.25rem;margin:0}.agent-config-inspect__dt[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:500;color:var(--color-text-secondary, #6e6e73);align-self:center}.agent-config-inspect__dd[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);align-self:center;word-break:break-word}.agent-config-inspect__dd--mono[_ngcontent-%COMP%]{font-family:monospace;font-size:.875rem}.agent-config-inspect__badge[_ngcontent-%COMP%]{display:inline-block;padding:.2em .6em;border-radius:4px;font-size:.75rem;font-weight:500;background:var(--color-surface-muted, rgba(0, 0, 0, .06));color:var(--color-text-secondary, #6e6e73)}.agent-config-inspect__badge--active[_ngcontent-%COMP%]{background:var(--color-success-bg, #e3f5e1);color:var(--color-success, #34c759)}.agent-config-inspect__collapsible[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:.5rem;width:100%;background:none;border:none;padding:0;cursor:pointer;font-family:inherit;text-align:left}.agent-config-inspect__chevron[_ngcontent-%COMP%]{font-size:.7rem;color:var(--color-text-secondary, #6e6e73);transition:transform .15s ease;flex-shrink:0}.agent-config-inspect__chevron--open[_ngcontent-%COMP%]{transform:rotate(180deg)}.agent-config-inspect__instructions[_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:inherit;color:var(--color-text, #1d1d1f);white-space:pre-wrap;word-break:break-word;line-height:1.6;max-height:400px;overflow-y:auto}.agent-config-inspect__tools[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.5rem}.agent-config-inspect__tool[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .08));border-radius:6px;overflow:hidden}.agent-config-inspect__tool-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:.75rem;width:100%;padding:.75rem 1rem;background:none;border:none;cursor:pointer;font-family:inherit;text-align:left;transition:background .1s ease}.agent-config-inspect__tool-header[_ngcontent-%COMP%]:hover{background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.agent-config-inspect__tool-name[_ngcontent-%COMP%]{font-size:.875rem;font-weight:600;font-family:monospace;color:var(--color-text, #1d1d1f);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.agent-config-inspect__tool-body[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem;padding:0 1rem .75rem;border-top:1px solid var(--color-border, rgba(0, 0, 0, .08))}.agent-config-inspect__tool-description[_ngcontent-%COMP%]{margin:0;padding-top:.75rem;font-size:.8125rem;line-height:1.5;color:var(--color-text-secondary, #6e6e73)}.agent-config-inspect__tool-description[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0 0 .25rem}.agent-config-inspect__tool-description[_ngcontent-%COMP%] p[_ngcontent-%COMP%]:last-child{margin-bottom:0}.agent-config-inspect__tool-description[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{font-family:monospace;font-size:.8em;background:var(--color-surface-muted, rgba(0, 0, 0, .06));padding:.1em .3em;border-radius:3px}.agent-config-inspect__schema[_ngcontent-%COMP%]{margin:0;padding:.875rem 1rem;background:var(--color-surface-muted, rgba(0, 0, 0, .04));font-size:.8125rem;font-family:monospace;color:var(--color-text, #1d1d1f);white-space:pre;overflow-x:auto;line-height:1.5;max-height:360px;overflow-y:auto}"],changeDetection:0})};export{R as AgentConfigInspectComponent};
|
|
1
|
+
import{a as L}from"./chunk-KHMEGI4Z.js";import{b as z}from"./chunk-C2LUO2MP.js";import"./chunk-TSYL5EEO.js";import{a as T,c as A,d as D}from"./chunk-6XX7GME4.js";import{a as N}from"./chunk-VMYKE4ZC.js";import{Bb as b,Db as f,Fb as l,Ga as M,Ka as r,Rb as u,Tb as a,Ub as p,Vb as h,Wa as I,ca as _,fc as O,ga as C,gc as w,ha as x,jb as v,lb as d,ma as P,mb as s,pb as S,qb as E,rb as y,sb as i,ta as m,tb as t,ub as k}from"./chunk-CHEXA6RY.js";var F=(n,o)=>o.name;function B(n,o){n&1&&(i(0,"p",6),a(1,"Loading\u2026"),t())}function $(n,o){n&1&&(i(0,"p",7),a(1,"Failed to load agent definition."),t())}function j(n,o){if(n&1&&(i(0,"dt",12),a(1,"User context"),t(),i(2,"dd",14),a(3),t()),n&2){let e=l();r(3),p(e.userId)}}function H(n,o){if(n&1&&(i(0,"pre",21),a(1),t()),n&2){let e=l(2);r(),p(e.systemPrompt)}}function J(n,o){if(n&1){let e=b();i(0,"section",9)(1,"button",19),f("click",function(){C(e);let g=l(2);return x(g.toggleSystemPrompt())}),i(2,"h2",10),a(3,"System Prompt"),t(),i(4,"span",20),a(5," \u25BC "),t()(),d(6,H,2,1,"pre",21),t()}if(n&2){let e=l(2);r(),v("aria-expanded",!e.systemPromptCollapsed()),r(3),u("agent-config-inspect__chevron--open",!e.systemPromptCollapsed()),r(2),s(e.systemPromptCollapsed()?-1:6)}}function U(n,o){if(n&1&&(i(0,"pre",21),a(1),t()),n&2){let e=l(2);r(),p(e.instructions)}}function G(n,o){if(n&1){let e=b();i(0,"section",9)(1,"button",19),f("click",function(){C(e);let g=l(2);return x(g.toggleInstructions())}),i(2,"h2",10),a(3,"Instructions"),t(),i(4,"span",20),a(5," \u25BC "),t()(),d(6,U,2,1,"pre",21),t()}if(n&2){let e=l(2);r(),v("aria-expanded",!e.instructionsCollapsed()),r(3),u("agent-config-inspect__chevron--open",!e.instructionsCollapsed()),r(2),s(e.instructionsCollapsed()?-1:6)}}function q(n,o){n&1&&(i(0,"p",17),a(1,"No tools available for this agent."),t())}function K(n,o){if(n&1&&(k(0,"div",26),O(1,"agentosMarkdown")),n&2){let e=l(2).$implicit;y("innerHTML",w(1,1,e.description),M)}}function Q(n,o){if(n&1&&(i(0,"div",25),d(1,K,2,3,"div",26),i(2,"pre",27),a(3),t()()),n&2){let e=l().$implicit,c=l(3);r(),s(e.description?1:-1),r(2),p(c.formatSchema(e.inputSchema))}}function W(n,o){if(n&1){let e=b();i(0,"li",22)(1,"button",23),f("click",function(){let g=C(e).$implicit,V=l(3);return x(V.toggleTool(g))}),i(2,"span",24),a(3),t(),i(4,"span",20),a(5," \u25BC "),t()(),d(6,Q,4,2,"div",25),t()}if(n&2){let e=o.$implicit,c=l(3);r(),v("aria-expanded",c.isToolExpanded(e)),r(2),p(e.name),r(),u("agent-config-inspect__chevron--open",c.isToolExpanded(e)),r(2),s(c.isToolExpanded(e)?6:-1)}}function X(n,o){if(n&1&&(i(0,"ul",18),S(1,W,7,5,"li",22,F),t()),n&2){let e=l();r(),E(e.tools)}}function Y(n,o){if(n&1&&(i(0,"div",8)(1,"section",9)(2,"h2",10),a(3,"General"),t(),i(4,"dl",11)(5,"dt",12),a(6,"Name"),t(),i(7,"dd",13),a(8),t(),i(9,"dt",12),a(10,"Resolved model"),t(),i(11,"dd",14),a(12),t(),i(13,"dt",12),a(14,"Provider"),t(),i(15,"dd",13),a(16),t(),i(17,"dt",12),a(18,"Advanced execution"),t(),i(19,"dd",13)(20,"span",15),a(21),t()(),d(22,j,4,1),t()(),d(23,J,7,4,"section",9),d(24,G,7,4,"section",9),i(25,"section",9)(26,"h2",10),a(27," Tools "),i(28,"span",16),a(29),t()(),d(30,q,2,0,"p",17)(31,X,3,0,"ul",18),t()()),n&2){let e=o;r(8),p(e.name),r(4),p(e.resolvedModelApiName),r(4),p(e.resolvedProviderName),r(4),u("agent-config-inspect__badge--active",e.advancedExecution),r(),h(" ",e.advancedExecution?"Enabled":"Disabled"," "),r(),s(e.userId?22:-1),r(),s(e.systemPrompt?23:-1),r(),s(e.instructions?24:-1),r(5),h("(",e.tools.length,")"),r(),s(e.tools.length===0?30:31)}}var R=class n{route=_(T);router=_(A);destroyRef=_(P);agentConfigController=_(z);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.params.agentConfigId;isPlatformMode=!this.namespaceId;isLoading=m(!0);hasError=m(!1);definition=m(null);expandedTools=m(new Set);systemPromptCollapsed=m(!0);instructionsCollapsed=m(!0);ngOnInit(){this.agentConfigController.getDefinitionAgentConfig(this.agentConfigId).pipe(N(this.destroyRef)).subscribe({next:o=>{this.definition.set(o),this.isLoading.set(!1)},error:()=>{this.hasError.set(!0),this.isLoading.set(!1)}})}toggleTool(o){this.expandedTools.update(e=>{let c=new Set(e);return c.has(o.name)?c.delete(o.name):c.add(o.name),c})}isToolExpanded(o){return this.expandedTools().has(o.name)}toggleSystemPrompt(){this.systemPromptCollapsed.update(o=>!o)}toggleInstructions(){this.instructionsCollapsed.update(o=>!o)}formatSchema(o){try{return JSON.stringify(JSON.parse(o),null,2)}catch(e){return o}}editRoute(){return this.isPlatformMode?["/agentos","admin","agent-configs",this.agentConfigId,"edit"]:["/agentos",this.namespaceId,"agent-configs",this.agentConfigId,"edit"]}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"])}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=I({type:n,selectors:[["agentos-agent-config-inspect"]],decls:13,vars:2,consts:[[1,"agent-config-inspect"],[1,"agent-config-inspect__header"],["type","button","title","Back to agent configs",1,"agent-config-inspect__back",3,"click"],[1,"agent-config-inspect__back-icon"],[1,"agent-config-inspect__title"],[1,"agent-config-inspect__sibling-link",3,"routerLink"],[1,"agent-config-inspect__loading"],[1,"agent-config-inspect__error"],[1,"agent-config-inspect__content"],[1,"agent-config-inspect__section"],[1,"agent-config-inspect__section-title"],[1,"agent-config-inspect__dl"],[1,"agent-config-inspect__dt"],[1,"agent-config-inspect__dd"],[1,"agent-config-inspect__dd","agent-config-inspect__dd--mono"],[1,"agent-config-inspect__badge"],[1,"agent-config-inspect__count"],[1,"agent-config-inspect__empty"],[1,"agent-config-inspect__tools"],["type","button",1,"agent-config-inspect__collapsible",3,"click"],[1,"agent-config-inspect__chevron"],[1,"agent-config-inspect__instructions"],[1,"agent-config-inspect__tool"],["type","button",1,"agent-config-inspect__tool-header",3,"click"],[1,"agent-config-inspect__tool-name"],[1,"agent-config-inspect__tool-body"],[1,"agent-config-inspect__tool-description",3,"innerHTML"],[1,"agent-config-inspect__schema"]],template:function(e,c){if(e&1&&(i(0,"div",0)(1,"header",1)(2,"button",2),f("click",function(){return c.back()}),i(3,"span",3),a(4,"\u2190"),t(),a(5," Agent Configs "),t(),i(6,"h1",4),a(7,"Agent definition"),t(),i(8,"a",5),a(9,"Edit config \u2192"),t()(),d(10,B,2,0,"p",6)(11,$,2,0,"p",7)(12,Y,32,11,"div",8),t()),e&2){let g;r(8),y("routerLink",c.editRoute()),r(2),s(c.isLoading()?10:c.hasError()?11:(g=c.definition())?12:-1,g)}},dependencies:[D,L],styles:[".agent-config-inspect[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:720px;margin:0 auto;padding:2rem 1rem}.agent-config-inspect__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.agent-config-inspect__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.agent-config-inspect__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.agent-config-inspect__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.agent-config-inspect__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.agent-config-inspect__sibling-link[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-primary, #007aff);text-decoration:none}.agent-config-inspect__sibling-link[_ngcontent-%COMP%]:hover{text-decoration:underline}.agent-config-inspect__loading[_ngcontent-%COMP%], .agent-config-inspect__error[_ngcontent-%COMP%], .agent-config-inspect__empty[_ngcontent-%COMP%]{margin:0;font-size:.9rem;color:var(--color-text-secondary, #6e6e73)}.agent-config-inspect__error[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.agent-config-inspect__content[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.agent-config-inspect__section[_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:10px}.agent-config-inspect__section-title[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;font-weight:600;color:var(--color-text, #1d1d1f)}.agent-config-inspect__count[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary, #6e6e73);font-size:.875rem;margin-left:.25rem}.agent-config-inspect__dl[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content 1fr;gap:.5rem 1.25rem;margin:0}.agent-config-inspect__dt[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:500;color:var(--color-text-secondary, #6e6e73);align-self:center}.agent-config-inspect__dd[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);align-self:center;word-break:break-word}.agent-config-inspect__dd--mono[_ngcontent-%COMP%]{font-family:monospace;font-size:.875rem}.agent-config-inspect__badge[_ngcontent-%COMP%]{display:inline-block;padding:.2em .6em;border-radius:4px;font-size:.75rem;font-weight:500;background:var(--color-surface-muted, rgba(0, 0, 0, .06));color:var(--color-text-secondary, #6e6e73)}.agent-config-inspect__badge--active[_ngcontent-%COMP%]{background:var(--color-success-bg, #e3f5e1);color:var(--color-success, #34c759)}.agent-config-inspect__collapsible[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:.5rem;width:100%;background:none;border:none;padding:0;cursor:pointer;font-family:inherit;text-align:left}.agent-config-inspect__chevron[_ngcontent-%COMP%]{font-size:.7rem;color:var(--color-text-secondary, #6e6e73);transition:transform .15s ease;flex-shrink:0}.agent-config-inspect__chevron--open[_ngcontent-%COMP%]{transform:rotate(180deg)}.agent-config-inspect__instructions[_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:inherit;color:var(--color-text, #1d1d1f);white-space:pre-wrap;word-break:break-word;line-height:1.6;max-height:400px;overflow-y:auto}.agent-config-inspect__tools[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.5rem}.agent-config-inspect__tool[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .08));border-radius:6px;overflow:hidden}.agent-config-inspect__tool-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:.75rem;width:100%;padding:.75rem 1rem;background:none;border:none;cursor:pointer;font-family:inherit;text-align:left;transition:background .1s ease}.agent-config-inspect__tool-header[_ngcontent-%COMP%]:hover{background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.agent-config-inspect__tool-name[_ngcontent-%COMP%]{font-size:.875rem;font-weight:600;font-family:monospace;color:var(--color-text, #1d1d1f);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.agent-config-inspect__tool-body[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem;padding:0 1rem .75rem;border-top:1px solid var(--color-border, rgba(0, 0, 0, .08))}.agent-config-inspect__tool-description[_ngcontent-%COMP%]{margin:0;padding-top:.75rem;font-size:.8125rem;line-height:1.5;color:var(--color-text-secondary, #6e6e73)}.agent-config-inspect__tool-description[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0 0 .25rem}.agent-config-inspect__tool-description[_ngcontent-%COMP%] p[_ngcontent-%COMP%]:last-child{margin-bottom:0}.agent-config-inspect__tool-description[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{font-family:monospace;font-size:.8em;background:var(--color-surface-muted, rgba(0, 0, 0, .06));padding:.1em .3em;border-radius:3px}.agent-config-inspect__schema[_ngcontent-%COMP%]{margin:0;padding:.875rem 1rem;background:var(--color-surface-muted, rgba(0, 0, 0, .04));font-size:.8125rem;font-family:monospace;color:var(--color-text, #1d1d1f);white-space:pre;overflow-x:auto;line-height:1.5;max-height:360px;overflow-y:auto}"],changeDetection:0})};export{R as AgentConfigInspectComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as z,d as B}from"./chunk-UQTA3ACH.js";import{a as D,c as L}from"./chunk-6XX7GME4.js";import{a as x,c as R}from"./chunk-VMYKE4ZC.js";import{A as Y,B as Z,F as ee,c as G,e as g,g as $,h as q,i as j,l as s,n as U,o as H,s as J,w as K,x as Q,y as W,z as X}from"./chunk-7OGOI6WM.js";import{Bb as w,D as k,Db as _,Fb as p,Ka as a,Tb as r,Ub as N,Vb as V,Wa as A,Wb as T,a as y,b as M,ca as c,ga as v,ha as b,kb as I,lb as C,m as P,ma as S,mb as h,mc as F,pb as E,qb as O,rb as l,sb as i,ta as f,tb as o,ub as m}from"./chunk-CHEXA6RY.js";function te(n,t){n&1&&(i(0,"p",5),r(1,"Loading\u2026"),o())}function ie(n,t){if(n&1&&m(0,"input",11),n&2){let e=p(2);l("value",e.selectedProviderLabel())}}function re(n,t){if(n&1&&(i(0,"option",30),r(1),o()),n&2){let e=t.$implicit;l("value",e.id),a(),T("",e.name," (",e.apiType,")")}}function ne(n,t){if(n&1&&(i(0,"select",12)(1,"option",29),r(2,"Select provider"),o(),E(3,re,2,3,"option",30,I().trackByProvider,!0),o()),n&2){let e=p(2);l("formControl",e.aiProviderIdControl),a(3),O(e.providers())}}function ae(n,t){if(n&1){let e=w();i(0,"form",7),_("ngSubmit",function(){v(e);let u=p();return b(u.submit())}),i(1,"div",8)(2,"label",9),r(3," Provider "),i(4,"span",10),r(5,"*"),o()(),C(6,ie,1,1,"input",11)(7,ne,5,1,"select",12),o(),i(8,"div",8)(9,"label",13),r(10," API name "),i(11,"span",10),r(12,"*"),o()(),m(13,"input",14),o(),i(14,"div",8)(15,"label",15),r(16,"Description"),o(),m(17,"input",16),o(),i(18,"div",8)(19,"label",17),r(20,"Alias"),o(),m(21,"input",18),o(),i(22,"div",8)(23,"label",19),r(24,"Priority"),o(),m(25,"input",20),o(),i(26,"div",21)(27,"div",8)(28,"label",22),r(29,"Temperature"),o(),m(30,"input",23),o(),i(31,"div",8)(32,"label",24),r(33,"Max tokens"),o(),m(34,"input",25),o()(),i(35,"div",26)(36,"button",27),r(37),o(),i(38,"button",28),_("click",function(){v(e);let u=p();return b(u.cancel())}),r(39,"Cancel"),o()()()}if(n&2){let e=p();l("formGroup",e.form),a(6),h(e.isEditMode()?6:7),a(7),l("formControl",e.apiModelNameControl),a(4),l("formControl",e.descriptionControl),a(4),l("formControl",e.aliasControl),a(4),l("formControl",e.priorityControl),a(5),l("formControl",e.temperatureControl),a(4),l("formControl",e.maxTokensControl),a(2),l("disabled",e.form.invalid||e.isSubmitting()),a(),V(" ",e.isEditMode()?"Save changes":"Create"," ")}}var oe=class n{route=c(D);router=c(L);destroyRef=c(S);aiModelController=c(z);aiProviderController=c(B);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;providers=R(this.aiProviderController.listAiProvider(this.isPlatformMode?"none":this.namespaceId).pipe(k(()=>P([]))),{initialValue:[]});form=new j({aiProviderId:new s("",{nonNullable:!0,validators:[g.required]}),apiModelName:new s("",{nonNullable:!0,validators:[g.required,g.minLength(1)]}),description:new s(null),alias:new s("",{nonNullable:!0}),priority:new s(0,{nonNullable:!0}),temperature:new s(null),maxTokens:new s(null)});get aiProviderIdControl(){return this.form.controls.aiProviderId}get apiModelNameControl(){return this.form.controls.apiModelName}get descriptionControl(){return this.form.controls.description}get aliasControl(){return this.form.controls.alias}get priorityControl(){return this.form.controls.priority}get temperatureControl(){return this.form.controls.temperature}get maxTokensControl(){return this.form.controls.maxTokens}isEditMode=f(!1);isSubmitting=f(!1);isLoading=f(!1);selectedProviderLabel=F(()=>{let t=this.aiProviderIdControl.value,e=this.providers().find(d=>d.id===t);return e?`${e.name} (${e.apiType})`:t});existingModel=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("modelId");t&&(this.isEditMode.set(!0),this.loadModel(t))}loadModel(t){this.isLoading.set(!0),this.aiModelController.getByIdAiModel(t).pipe(x(this.destroyRef)).subscribe({next:e=>{this.existingModel=e,this.aiProviderIdControl.setValue(e.aiProviderId),this.aiProviderIdControl.disable(),this.apiModelNameControl.setValue(e.apiModelName),this.descriptionControl.setValue(e.description??null),this.aliasControl.setValue(e.alias??""),this.priorityControl.setValue(e.priority??0),this.temperatureControl.setValue(e.temperature??null),this.maxTokensControl.setValue(e.maxTokens??null),this.isLoading.set(!1)},error:()=>{this.isLoading.set(!1),this.navigateBack()}})}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(!0);let t=this.form.getRawValue(),e=M(y({},this.existingModel??{}),{aiProviderId:t.aiProviderId,namespaceId:this.isPlatformMode?void 0:this.existingModel?.namespaceId??this.namespaceId,apiModelName:t.apiModelName.trim(),description:t.description?.trim()||void 0,alias:t.alias.trim()||void 0,priority:t.priority,temperature:t.temperature??void 0,maxTokens:t.maxTokens??void 0});(this.isEditMode()?this.aiModelController.updateAiModel(this.existingModel.id??"",e):this.aiModelController.createAiModel(e)).pipe(x(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(!1)})}cancel(){this.navigateBack()}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-models"]):this.router.navigate(["/agentos",this.namespaceId,"ai-models"])}trackByProvider(t,e){return e.id??""}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=A({type:n,selectors:[["agentos-ai-model-form"]],decls:10,vars:2,consts:[[1,"ai-model-form"],[1,"ai-model-form__header"],["type","button","title","Back to AI models",1,"ai-model-form__back",3,"click"],[1,"ai-model-form__back-icon"],[1,"ai-model-form__title"],[1,"ai-model-form__loading"],[1,"ai-model-form__form",3,"formGroup"],[1,"ai-model-form__form",3,"ngSubmit","formGroup"],[1,"ai-model-form__field"],["for","model-provider",1,"ai-model-form__label"],["aria-hidden","true"],["id","model-provider","type","text","readonly","","tabindex","-1",1,"ai-model-form__input","ai-model-form__input--readonly",3,"value"],["id","model-provider",1,"ai-model-form__select",3,"formControl"],["for","model-api-name",1,"ai-model-form__label"],["id","model-api-name","type","text","placeholder","e.g. gpt-4o, claude-3-5-sonnet-20241022","autocomplete","off",1,"ai-model-form__input","ai-model-form__input--mono",3,"formControl"],["for","model-description",1,"ai-model-form__label"],["id","model-description","type","text","placeholder","Optional \u2014 short description of this model config","autocomplete","off",1,"ai-model-form__input",3,"formControl"],["for","model-alias",1,"ai-model-form__label"],["id","model-alias","type","text","placeholder","e.g. fast, smart \u2014 short identifier used internally","autocomplete","off",1,"ai-model-form__input",3,"formControl"],["for","model-priority",1,"ai-model-form__label"],["id","model-priority","type","number","placeholder","0 \u2014 higher wins when multiple configs share the same alias","min","0","step","1",1,"ai-model-form__input",3,"formControl"],[1,"ai-model-form__row"],["for","model-temperature",1,"ai-model-form__label"],["id","model-temperature","type","number","placeholder","0 \u2013 2","min","0","max","2","step","0.1",1,"ai-model-form__input",3,"formControl"],["for","model-max-tokens",1,"ai-model-form__label"],["id","model-max-tokens","type","number","placeholder","e.g. 4096","min","1","step","1",1,"ai-model-form__input",3,"formControl"],[1,"ai-model-form__actions"],["type","submit",1,"ai-model-form__btn","ai-model-form__btn--primary",3,"disabled"],["type","button",1,"ai-model-form__btn",3,"click"],["value","","disabled",""],[3,"value"]],template:function(e,d){e&1&&(i(0,"div",0)(1,"header",1)(2,"button",2),_("click",function(){return d.cancel()}),i(3,"span",3),r(4,"\u2190"),o(),r(5," AI models "),o(),i(6,"h1",4),r(7),o()(),C(8,te,2,0,"p",5)(9,ae,40,10,"form",6),o()),e&2&&(a(7),N(d.isEditMode()?"Edit AI model":"New AI model"),a(),h(d.isLoading()?8:9))},dependencies:[ee,U,W,X,G,H,Q,$,q,Z,Y,J,K],styles:[".ai-model-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:480px;margin:0 auto;padding:2rem 1rem}.ai-model-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.ai-model-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.ai-model-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.ai-model-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.ai-model-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.ai-model-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.ai-model-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.ai-model-form__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.ai-model-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.ai-model-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.ai-model-form__input[_ngcontent-%COMP%], .ai-model-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.ai-model-form__input[_ngcontent-%COMP%]:focus, .ai-model-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.ai-model-form__input[_ngcontent-%COMP%]::placeholder, .ai-model-form__select[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.ai-model-form__input--mono[_ngcontent-%COMP%]{font-family:monospace}.ai-model-form__input--readonly[_ngcontent-%COMP%]{color:var(--color-text-secondary);cursor:default;background:var(--color-surface-muted, rgba(0, 0, 0, .03))}.ai-model-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.ai-model-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.ai-model-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.ai-model-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.ai-model-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.ai-model-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"],changeDetection:0})};export{oe as AiModelFormComponent};
|
|
1
|
+
import{c as z,d as B}from"./chunk-C2LUO2MP.js";import{a as D,c as L}from"./chunk-6XX7GME4.js";import{a as x,c as R}from"./chunk-VMYKE4ZC.js";import{A as Y,B as Z,F as ee,c as G,e as g,g as $,h as q,i as j,l as s,n as U,o as H,s as J,w as K,x as Q,y as W,z as X}from"./chunk-7OGOI6WM.js";import{Bb as w,D as k,Db as _,Fb as p,Ka as a,Tb as r,Ub as N,Vb as V,Wa as A,Wb as T,a as y,b as M,ca as c,ga as v,ha as b,kb as I,lb as C,m as P,ma as S,mb as h,mc as F,pb as E,qb as O,rb as l,sb as i,ta as f,tb as o,ub as m}from"./chunk-CHEXA6RY.js";function te(n,t){n&1&&(i(0,"p",5),r(1,"Loading\u2026"),o())}function ie(n,t){if(n&1&&m(0,"input",11),n&2){let e=p(2);l("value",e.selectedProviderLabel())}}function re(n,t){if(n&1&&(i(0,"option",30),r(1),o()),n&2){let e=t.$implicit;l("value",e.id),a(),T("",e.name," (",e.apiType,")")}}function ne(n,t){if(n&1&&(i(0,"select",12)(1,"option",29),r(2,"Select provider"),o(),E(3,re,2,3,"option",30,I().trackByProvider,!0),o()),n&2){let e=p(2);l("formControl",e.aiProviderIdControl),a(3),O(e.providers())}}function ae(n,t){if(n&1){let e=w();i(0,"form",7),_("ngSubmit",function(){v(e);let u=p();return b(u.submit())}),i(1,"div",8)(2,"label",9),r(3," Provider "),i(4,"span",10),r(5,"*"),o()(),C(6,ie,1,1,"input",11)(7,ne,5,1,"select",12),o(),i(8,"div",8)(9,"label",13),r(10," API name "),i(11,"span",10),r(12,"*"),o()(),m(13,"input",14),o(),i(14,"div",8)(15,"label",15),r(16,"Description"),o(),m(17,"input",16),o(),i(18,"div",8)(19,"label",17),r(20,"Alias"),o(),m(21,"input",18),o(),i(22,"div",8)(23,"label",19),r(24,"Priority"),o(),m(25,"input",20),o(),i(26,"div",21)(27,"div",8)(28,"label",22),r(29,"Temperature"),o(),m(30,"input",23),o(),i(31,"div",8)(32,"label",24),r(33,"Max tokens"),o(),m(34,"input",25),o()(),i(35,"div",26)(36,"button",27),r(37),o(),i(38,"button",28),_("click",function(){v(e);let u=p();return b(u.cancel())}),r(39,"Cancel"),o()()()}if(n&2){let e=p();l("formGroup",e.form),a(6),h(e.isEditMode()?6:7),a(7),l("formControl",e.apiModelNameControl),a(4),l("formControl",e.descriptionControl),a(4),l("formControl",e.aliasControl),a(4),l("formControl",e.priorityControl),a(5),l("formControl",e.temperatureControl),a(4),l("formControl",e.maxTokensControl),a(2),l("disabled",e.form.invalid||e.isSubmitting()),a(),V(" ",e.isEditMode()?"Save changes":"Create"," ")}}var oe=class n{route=c(D);router=c(L);destroyRef=c(S);aiModelController=c(z);aiProviderController=c(B);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;providers=R(this.aiProviderController.listAiProvider(this.isPlatformMode?"none":this.namespaceId).pipe(k(()=>P([]))),{initialValue:[]});form=new j({aiProviderId:new s("",{nonNullable:!0,validators:[g.required]}),apiModelName:new s("",{nonNullable:!0,validators:[g.required,g.minLength(1)]}),description:new s(null),alias:new s("",{nonNullable:!0}),priority:new s(0,{nonNullable:!0}),temperature:new s(null),maxTokens:new s(null)});get aiProviderIdControl(){return this.form.controls.aiProviderId}get apiModelNameControl(){return this.form.controls.apiModelName}get descriptionControl(){return this.form.controls.description}get aliasControl(){return this.form.controls.alias}get priorityControl(){return this.form.controls.priority}get temperatureControl(){return this.form.controls.temperature}get maxTokensControl(){return this.form.controls.maxTokens}isEditMode=f(!1);isSubmitting=f(!1);isLoading=f(!1);selectedProviderLabel=F(()=>{let t=this.aiProviderIdControl.value,e=this.providers().find(d=>d.id===t);return e?`${e.name} (${e.apiType})`:t});existingModel=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("modelId");t&&(this.isEditMode.set(!0),this.loadModel(t))}loadModel(t){this.isLoading.set(!0),this.aiModelController.getByIdAiModel(t).pipe(x(this.destroyRef)).subscribe({next:e=>{this.existingModel=e,this.aiProviderIdControl.setValue(e.aiProviderId),this.aiProviderIdControl.disable(),this.apiModelNameControl.setValue(e.apiModelName),this.descriptionControl.setValue(e.description??null),this.aliasControl.setValue(e.alias??""),this.priorityControl.setValue(e.priority??0),this.temperatureControl.setValue(e.temperature??null),this.maxTokensControl.setValue(e.maxTokens??null),this.isLoading.set(!1)},error:()=>{this.isLoading.set(!1),this.navigateBack()}})}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(!0);let t=this.form.getRawValue(),e=M(y({},this.existingModel??{}),{aiProviderId:t.aiProviderId,namespaceId:this.isPlatformMode?void 0:this.existingModel?.namespaceId??this.namespaceId,apiModelName:t.apiModelName.trim(),description:t.description?.trim()||void 0,alias:t.alias.trim()||void 0,priority:t.priority,temperature:t.temperature??void 0,maxTokens:t.maxTokens??void 0});(this.isEditMode()?this.aiModelController.updateAiModel(this.existingModel.id??"",e):this.aiModelController.createAiModel(e)).pipe(x(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(!1)})}cancel(){this.navigateBack()}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-models"]):this.router.navigate(["/agentos",this.namespaceId,"ai-models"])}trackByProvider(t,e){return e.id??""}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=A({type:n,selectors:[["agentos-ai-model-form"]],decls:10,vars:2,consts:[[1,"ai-model-form"],[1,"ai-model-form__header"],["type","button","title","Back to AI models",1,"ai-model-form__back",3,"click"],[1,"ai-model-form__back-icon"],[1,"ai-model-form__title"],[1,"ai-model-form__loading"],[1,"ai-model-form__form",3,"formGroup"],[1,"ai-model-form__form",3,"ngSubmit","formGroup"],[1,"ai-model-form__field"],["for","model-provider",1,"ai-model-form__label"],["aria-hidden","true"],["id","model-provider","type","text","readonly","","tabindex","-1",1,"ai-model-form__input","ai-model-form__input--readonly",3,"value"],["id","model-provider",1,"ai-model-form__select",3,"formControl"],["for","model-api-name",1,"ai-model-form__label"],["id","model-api-name","type","text","placeholder","e.g. gpt-4o, claude-3-5-sonnet-20241022","autocomplete","off",1,"ai-model-form__input","ai-model-form__input--mono",3,"formControl"],["for","model-description",1,"ai-model-form__label"],["id","model-description","type","text","placeholder","Optional \u2014 short description of this model config","autocomplete","off",1,"ai-model-form__input",3,"formControl"],["for","model-alias",1,"ai-model-form__label"],["id","model-alias","type","text","placeholder","e.g. fast, smart \u2014 short identifier used internally","autocomplete","off",1,"ai-model-form__input",3,"formControl"],["for","model-priority",1,"ai-model-form__label"],["id","model-priority","type","number","placeholder","0 \u2014 higher wins when multiple configs share the same alias","min","0","step","1",1,"ai-model-form__input",3,"formControl"],[1,"ai-model-form__row"],["for","model-temperature",1,"ai-model-form__label"],["id","model-temperature","type","number","placeholder","0 \u2013 2","min","0","max","2","step","0.1",1,"ai-model-form__input",3,"formControl"],["for","model-max-tokens",1,"ai-model-form__label"],["id","model-max-tokens","type","number","placeholder","e.g. 4096","min","1","step","1",1,"ai-model-form__input",3,"formControl"],[1,"ai-model-form__actions"],["type","submit",1,"ai-model-form__btn","ai-model-form__btn--primary",3,"disabled"],["type","button",1,"ai-model-form__btn",3,"click"],["value","","disabled",""],[3,"value"]],template:function(e,d){e&1&&(i(0,"div",0)(1,"header",1)(2,"button",2),_("click",function(){return d.cancel()}),i(3,"span",3),r(4,"\u2190"),o(),r(5," AI models "),o(),i(6,"h1",4),r(7),o()(),C(8,te,2,0,"p",5)(9,ae,40,10,"form",6),o()),e&2&&(a(7),N(d.isEditMode()?"Edit AI model":"New AI model"),a(),h(d.isLoading()?8:9))},dependencies:[ee,U,W,X,G,H,Q,$,q,Z,Y,J,K],styles:[".ai-model-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:480px;margin:0 auto;padding:2rem 1rem}.ai-model-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.ai-model-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.ai-model-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.ai-model-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.ai-model-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.ai-model-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.ai-model-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.ai-model-form__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.ai-model-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.ai-model-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.ai-model-form__input[_ngcontent-%COMP%], .ai-model-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.ai-model-form__input[_ngcontent-%COMP%]:focus, .ai-model-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.ai-model-form__input[_ngcontent-%COMP%]::placeholder, .ai-model-form__select[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.ai-model-form__input--mono[_ngcontent-%COMP%]{font-family:monospace}.ai-model-form__input--readonly[_ngcontent-%COMP%]{color:var(--color-text-secondary);cursor:default;background:var(--color-surface-muted, rgba(0, 0, 0, .03))}.ai-model-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.ai-model-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.ai-model-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.ai-model-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.ai-model-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.ai-model-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"],changeDetection:0})};export{oe as AiModelFormComponent};
|