@whoz-oss/coday-client 3.14.0 → 3.15.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-CCQglZL5.js → chunk-5LRyprMF.js} +1 -1
- package/browser/{chunk-Cqy-kSp8.js → chunk-5t7zJzqM.js} +1 -1
- package/browser/{chunk-CGJJDRqH.js → chunk-9CSRlx74.js} +1 -1
- package/browser/{chunk-QDqqdtZx.js → chunk-B11WEBEl.js} +1 -1
- package/browser/{chunk-BUpmxKd8.js → chunk-B5_o_qhk.js} +1 -1
- package/browser/{chunk-DzSHyN8O.js → chunk-BC0acSZF.js} +1 -1
- package/browser/{chunk-CNRDeQvk.js → chunk-BIMT-HvS.js} +1 -1
- package/browser/{chunk-DKfZ0J0-.js → chunk-BKlwFrFB.js} +1 -1
- package/browser/{chunk-Duz7aHYs.js → chunk-BLa2Gx7h.js} +1 -1
- package/browser/{chunk-Bz081WAa.js → chunk-BUEM7g7F.js} +1 -1
- package/browser/{chunk-CCFtehVS.js → chunk-BVCQOGLR.js} +1 -1
- package/browser/chunk-BZMAEe_X.js +1 -0
- package/browser/{chunk-DzXp5mWz.js → chunk-B_2kLXvG.js} +1 -1
- package/browser/{chunk-BzcZylVP.js → chunk-BfD1F12k.js} +1 -1
- package/browser/{chunk-Co3aK_ug.js → chunk-BgHTiTG2.js} +1 -1
- package/browser/{chunk-Lt-5ZOWn.js → chunk-Bgy3uCgK.js} +1 -1
- package/browser/{chunk-B6GXI9z-.js → chunk-Bh1p6jDj.js} +1 -1
- package/browser/{chunk-BUJvZgLu.js → chunk-BhM0bmJW.js} +1 -1
- package/browser/{chunk-HHbcGqdi.js → chunk-BhfpLr7-.js} +1 -1
- package/browser/{chunk-RPuzC8Su.js → chunk-BlWlE-Cq.js} +1 -1
- package/browser/{chunk-BOq6QumJ.js → chunk-Bnic_hdt.js} +1 -1
- package/browser/{chunk-BQ7Z34pK.js → chunk-BqKdrvcS.js} +1 -1
- package/browser/{chunk-BR4Pl8xo.js → chunk-C4U0w8cP.js} +1 -1
- package/browser/{chunk-CfO-PCnU.js → chunk-C5wr-vqf.js} +1 -1
- package/browser/{chunk-DQj9SXnH.js → chunk-C6RPhP4t.js} +1 -1
- package/browser/{chunk-Wd2dgg4g.js → chunk-C7MXO6BQ.js} +1 -1
- package/browser/{chunk-LgALnta4.js → chunk-C9tuHQmZ.js} +1 -1
- package/browser/{chunk-DoW9c054.js → chunk-CHrmSvQM.js} +1 -1
- package/browser/chunk-CNIfOUla.js +1 -0
- package/browser/{chunk-UX95uV76.js → chunk-CUmS2-ak.js} +1 -1
- package/browser/{chunk-BWqySSd7.js → chunk-CYMQSJz6.js} +1 -1
- package/browser/{chunk-CSa65gP2.js → chunk-CcLheUaL.js} +1 -1
- package/browser/{chunk-E-XRHTIB.js → chunk-Ce03Ba0V.js} +1 -1
- package/browser/chunk-CebS4RAf.js +1 -0
- package/browser/{chunk-DMo8nEUq.js → chunk-Cf3l2UgA.js} +1 -1
- package/browser/{chunk-Cqva3eF5.js → chunk-CnnGSYzi.js} +1 -1
- package/browser/{chunk-DJtRPrJe.js → chunk-CyUmCedx.js} +1 -1
- package/browser/{chunk-iUyWeEFy.js → chunk-CysW_ro-.js} +1 -1
- package/browser/{chunk-GHUL_MFq.js → chunk-CyxhAtE7.js} +1 -1
- package/browser/{chunk-b9_We0yK.js → chunk-DEsz0fzs.js} +1 -1
- package/browser/chunk-DG2FCeMu.js +2 -0
- package/browser/{chunk-BSY9MBD-.js → chunk-DTIhOEG_.js} +1 -1
- package/browser/{chunk-2R-L-8TB.js → chunk-DTZ7N3wC.js} +1 -1
- package/browser/{chunk-DGbegOkt.js → chunk-DX2ZzvT5.js} +1 -1
- package/browser/chunk-DXDohTwX.js +1 -0
- package/browser/chunk-DYE131qf.js +1 -0
- package/browser/{chunk-CS_CmKL0.js → chunk-DYUMiAN8.js} +1 -1
- package/browser/{chunk-Di5brgj6.js → chunk-D_vvo2qx.js} +1 -1
- package/browser/{chunk-CJIcHr4L.js → chunk-Dd2dq7xg.js} +1 -1
- package/browser/{chunk-CZutweoy.js → chunk-Dg6QAZUw.js} +1 -1
- package/browser/{chunk-CkwB4YzM.js → chunk-Dj9y_5pr.js} +1 -1
- package/browser/{chunk-Hhxvnnlp.js → chunk-DvzNS1Bs.js} +1 -1
- package/browser/{chunk-nRV2u7bW.js → chunk-DxxECdrg.js} +1 -1
- package/browser/{chunk-rjkvu4Y6.js → chunk-DzicJow4.js} +1 -1
- package/browser/{chunk-B64oBHQ_.js → chunk-HSc9fwVS.js} +1 -1
- package/browser/{chunk-DfyXf4Lw.js → chunk-Jv7RGmnK.js} +1 -1
- package/browser/{chunk-MtaKFhdm.js → chunk-K-fhwl_z.js} +1 -1
- package/browser/{chunk-CnFhM0Nt.js → chunk-RxHlNJ_t.js} +1 -1
- package/browser/{chunk-BM9I1k6S.js → chunk-XgEfnfT0.js} +1 -1
- package/browser/{chunk-D2wlWOWp.js → chunk-ZvcyZV3G.js} +1 -1
- package/browser/{chunk-CkXXby9d.js → chunk-fP29MqaN.js} +1 -1
- package/browser/{chunk-BESIk8ll.js → chunk-l0HLnBLv.js} +1 -1
- package/browser/{chunk-N-tYgqQC.js → chunk-mHtuxvLs.js} +1 -1
- package/browser/{chunk-CaAK8DtC.js → chunk-n1eKIk8H.js} +1 -1
- package/browser/{chunk-BxnUTBZC.js → chunk-nWqZHM4o.js} +1 -1
- package/browser/{chunk-DEr2MMdQ.js → chunk-qARg6ese.js} +1 -1
- package/browser/{chunk-Bf1Bttqy.js → chunk-uPxETzZs.js} +5 -5
- package/browser/index.html +1 -1
- package/browser/{main-4SCUMPDY.js → main-6K2UFGD2.js} +15 -15
- package/package.json +1 -1
- package/browser/chunk-B9IQiMog.js +0 -1
- package/browser/chunk-BUALjXbx.js +0 -1
- package/browser/chunk-Bsv9CCXL.js +0 -1
- package/browser/chunk-NLyO0ldw.js +0 -1
- package/browser/chunk-iamu8zs_.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import {S as St}from'./chunk-rjkvu4Y6.js';import {an as ce,g,L,ao as V,G,N as N$1,ap as Vy,h as Rw,aq as a,ar as S,as as F,at as c,I as Is,A as Ag,t as tC,m as pl,T as Tg,J as JE,v as nC,D as Fg,E as wC,K as CC,au as nv,ae as Ot,av as dt,Y as x,aw as hl,q as qC,ax as gl,a8 as Zg,a9 as fC,aa as If,ac as yC,ab as wf,n as bg}from'./main-4SCUMPDY.js';import {a as at,s as st,r as rt,_ as _i}from'./chunk-BOq6QumJ.js';import'./chunk-DKfZ0J0-.js';import {G as Ge}from'./chunk-Wd2dgg4g.js';import'./chunk-BxnUTBZC.js';import'./chunk-BM9I1k6S.js';import'./chunk-BUJvZgLu.js';import'./chunk-CCFtehVS.js';import'./chunk-Bz081WAa.js';import'./chunk-BESIk8ll.js';import'./chunk-BSY9MBD-.js';import'./chunk-LgALnta4.js';var T=class o{welcomeMessages=["Welcome to Coday","Bienvenue sur Coday","Bienvenido a Coday","Willkommen bei Coday","Benvenuto su Coday","Bem-vindo ao Coday","Welkom bij Coday","\u0414\u043E\u0431\u0440\u043E \u043F\u043E\u0436\u0430\u043B\u043E\u0432\u0430\u0442\u044C \u0432 Coday","Coday \u3078\u3088\u3046\u3053\u305D","\u6B22\u8FCE\u6765\u5230 Coday","Coday \uC5D0 \uC624\uC2E0 \uAC83\uC744 \uD658\uC601\uD569\uB2C8\uB2E4","\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0643 \u0641\u064A Coday"];currentWelcomeIndex=0;currentWelcomeMessage=this.welcomeMessages[0];welcomeRotationInterval;ngOnInit(){this.startWelcomeRotation();}ngOnDestroy(){this.stopWelcomeRotation();}startWelcomeRotation(){this.welcomeRotationInterval=window.setInterval(()=>{this.currentWelcomeIndex=(this.currentWelcomeIndex+1)%this.welcomeMessages.length,this.currentWelcomeMessage=this.welcomeMessages[this.currentWelcomeIndex];},3e3);}stopWelcomeRotation(){this.welcomeRotationInterval&&(clearInterval(this.welcomeRotationInterval),this.welcomeRotationInterval=void 0);}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=Rw({type:o,selectors:[["app-welcome-message"]],decls:2,vars:1,consts:[[1,"welcome-title"]],template:function(t,i){t&1&&(hl(0,"h1",0),qC(1),gl()),t&2&&(JE(),Zg(i.currentWelcomeMessage));},styles:[".welcome-title[_ngcontent-%COMP%]{font-size:clamp(1.5rem,4vw,4rem);font-weight:700;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% auto;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:_ngcontent-%COMP%_gradientShift 3s ease-in-out infinite;margin:0;padding:0;line-height:1.2;transition:opacity .5s ease-in-out;display:block;min-height:1.2em;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0% center}50%{background-position:100% center}to{background-position:0% center}}"],changeDetection:1})};var N=class o{destroy$=new ce;isSetup=false;codayService=g(Ge);preferencesService=g(L);setup(){if(this.isSetup){console.warn("[AGENT-NOTIFICATION] Service already set up");return}console.log("[AGENT-NOTIFICATION] Setting up agent notification service"),this.codayService.isThinking$.pipe(Vy(this.destroy$),nv(),Ot(([e,t])=>e===true&&t===false)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Agent stopped thinking, notifying task finished"),this.notifyTaskFinishedIfEnabled();}),this.preferencesService.browserNotificationEnabled$.pipe(Vy(this.destroy$),nv(),Ot(([e,t])=>e===false&&t===true)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Browser notifications enabled, checking permission"),this.handleBrowserNotificationEnabled();}),this.isSetup=true;}notifyTaskFinishedIfEnabled(){this.preferencesService.getAgentNotificationEnabled()&&(this.preferencesService.getNotificationSoundEnabled()&&this.playCompletionSound(),this.preferencesService.getBrowserNotificationEnabled()&&this.sendBrowserNotification());}playCompletionSound(){try{let e=new(window.AudioContext||window.webkitAudioContext),t=e.createOscillator(),i=e.createGain();t.connect(i),i.connect(e.destination),t.frequency.setValueAtTime(700,e.currentTime),i.gain.setValueAtTime(.1,e.currentTime),i.gain.exponentialRampToValueAtTime(.01,e.currentTime+.08),t.start(e.currentTime),t.stop(e.currentTime+.08);let n=e.createOscillator(),r=e.createGain();n.connect(r),r.connect(e.destination);let l=e.currentTime+.11;n.frequency.setValueAtTime(950,l),r.gain.setValueAtTime(.1,l),r.gain.exponentialRampToValueAtTime(.01,l+.09),n.start(l),n.stop(l+.09),console.log("[AGENT-NOTIFICATION] Completion sound played");}catch(e){console.error("[AGENT-NOTIFICATION] Failed to play completion sound:",e);}}handleBrowserNotificationEnabled(){return dt(this,null,function*(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications"),this.preferencesService.setBrowserNotificationEnabled(false);return}if(Notification.permission==="denied"){console.warn("[AGENT-NOTIFICATION] Permission denied, disabling browser notifications"),this.preferencesService.setBrowserNotificationEnabled(false);return}if(Notification.permission==="granted"){console.log("[AGENT-NOTIFICATION] Permission already granted, showing confirmation"),this.createConfirmationNotification();return}try{(yield Notification.requestPermission())==="granted"?(console.log("[AGENT-NOTIFICATION] Permission granted, showing confirmation"),this.createConfirmationNotification()):(console.log("[AGENT-NOTIFICATION] Permission denied or dismissed"),this.preferencesService.setBrowserNotificationEnabled(!1));}catch(e){console.error("[AGENT-NOTIFICATION] Error requesting permission:",e),this.preferencesService.setBrowserNotificationEnabled(false);}})}sendBrowserNotification(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications");return}if(document.hasFocus()){console.warn("[AGENT-NOTIFICATION] Document is focused, skipping browser notification");return}Notification.permission==="granted"?this.createTaskCompleteNotification():console.warn("[AGENT-NOTIFICATION] Permission not granted, cannot send notification");}createConfirmationNotification(){let e=new Notification("Coday - Notifications Enabled",{body:"You will be notified when the agent completes tasks",icon:"/favicon.ico",tag:"coday-notifications-enabled",requireInteraction:false});setTimeout(()=>e.close(),4e3),e.onclick=()=>{window.focus(),e.close();},console.log("[AGENT-NOTIFICATION] Confirmation notification sent");}createTaskCompleteNotification(){let e=new Notification("Coday - Task Complete",{body:"The agent has finished and is waiting for your input",icon:"/favicon.ico",tag:"coday-task-complete",requireInteraction:false});setTimeout(()=>e.close(),5e3),e.onclick=()=>{window.focus(),e.close();},console.log("[AGENT-NOTIFICATION] Task complete notification sent");}ngOnDestroy(){console.log("[AGENT-NOTIFICATION] Service destroyed"),this.destroy$.next(),this.destroy$.complete();}static \u0275fac=function(t){return new(t||o)};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var Z=["inputSection"];function ee(o,e){if(o&1){let t=fC();Is(0,"app-thread",4),Ag("chatFocused",function(){If(t);let n=yC();return wf(n.onChatFocusedOnMobile())})("drawerStateChange",function(n){If(t);let r=yC();return wf(r.onDrawerStateChange(n))}),pl();}if(o&2){let t=yC();Tg("projectName",t.projectName)("threadId",t.threadId);}}function te(o,e){if(o&1){let t=fC();Is(0,"div",5),bg(1,"app-welcome-message"),pl(),Is(2,"div",6,0)(4,"div",7)(5,"div",8)(6,"app-chat-textarea",9),Ag("messageSubmitted",function(n){If(t);let r=yC();return wf(r.onMessageSubmitted(n))})("voiceMessageReady",function(n){If(t);let r=yC();return wf(r.onVoiceMessageReady(n))})("voiceRecordingToggled",function(n){If(t);let r=yC();return wf(r.onVoiceToggled(n))})("heightChanged",function(n){If(t);let r=yC();return wf(r.onInputHeightChanged(n))})("textareaFocused",function(){If(t);let n=yC();return wf(n.onChatFocusedOnMobile())}),pl()()()();}if(o&2){let t=yC();JE(6),Tg("isDisabled",t.isSessionInitializing)("isSessionInitializing",t.isSessionInitializing)("showWelcome",true)("isThinking",false)("isStarting",t.isStartingFirstMessage);}}var K=class o{destroy$=new ce;inputSection;sidenav;projectName="";threadId=null;isSessionInitializing=false;isStartingFirstMessage=false;inputSectionHeight=80;codayService=g(Ge);titleService=g(at);preferencesService=g(L);route=g(V);router=g(G);threadApiService=g(N$1);agentNotificationService=g(N);firstMessageState=g(st);constructor(){console.log("[MAIN-APP] Using new thread-based architecture (no clientId needed)");}ngOnInit(){this.agentNotificationService.setup(),this.setupPrintHandlers(),this.route.params.pipe(Vy(this.destroy$)).subscribe(e=>{let t=e.projectName,i=e.threadId||null;console.log("[MAIN-APP] Route params updated:",{project:t,thread:i,previousProject:this.projectName,previousThread:this.threadId}),this.projectName=t,this.threadId=i,this.threadId?console.log("[MAIN-APP] Thread selected - ThreadComponent will display"):(console.log("[MAIN-APP] No thread selected - showing welcome view"),this.initializeWelcomeView());});}initializeWelcomeView(){this.codayService.setTabTitleService(this.titleService);}ngAfterViewInit(){setTimeout(()=>this.updateInputSectionHeight(),100);}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),window.removeEventListener("beforeprint",this.handleBeforePrint),window.removeEventListener("afterprint",this.handleAfterPrint);}onMessageSubmitted(e){console.log("[MAIN-APP] First message submitted from welcome view:",e),this.isSessionInitializing=true,this.isStartingFirstMessage=true,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created:",t.thread.id),this.firstMessageState.setPendingFirstMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id]);},error:t=>{console.error("[MAIN-APP] Failed to create thread:",t),this.isSessionInitializing=false,this.isStartingFirstMessage=false,alert("Failed to create conversation: "+(t.message||"Unknown error"));}});}onVoiceToggled(e){console.log("[VOICE] Recording in welcome view:",e);}onVoiceMessageReady(e){console.log("[MAIN-APP] Voice message ready from welcome view"),this.isSessionInitializing=true,this.isStartingFirstMessage=true,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created for voice message:",t.thread.id),this.firstMessageState.setPendingVoiceMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id]);},error:t=>{console.error("[MAIN-APP] Failed to create thread for voice message:",t),this.isSessionInitializing=false,this.isStartingFirstMessage=false,alert("Failed to create conversation: "+(t.message||"Unknown error"));}});}isDrawerOpen=false;onDrawerStateChange(e){this.isDrawerOpen=e;}onChatFocusedOnMobile(){window.innerWidth<1024&&this.sidenav?.close();}onInputHeightChanged(e){console.log("[MAIN-APP] Input height changed:",e),this.inputSectionHeight=e;}updateInputSectionHeight(){if(this.inputSection?.nativeElement){let e=this.inputSection.nativeElement.offsetHeight;e!==this.inputSectionHeight&&(console.log("[MAIN-APP] Input section height updated:",e),this.inputSectionHeight=e);}}setupPrintHandlers(){window.addEventListener("beforeprint",this.handleBeforePrint),window.addEventListener("afterprint",this.handleAfterPrint);}handleBeforePrint=()=>{console.log("[PRINT] Before print event triggered");let e=this.preferencesService.getPrintTechnicalMessages();console.log("[PRINT] Print technical messages:",e),e?document.body.classList.add("print-include-technical"):document.body.classList.remove("print-include-technical");};handleAfterPrint=()=>{console.log("[PRINT] After print event triggered"),document.body.classList.remove("print-include-technical");};static \u0275fac=function(t){return new(t||o)};static \u0275cmp=Rw({type:o,selectors:[["app-main"]],viewQuery:function(t,i){if(t&1&&Fg(Z,5)(St,5),t&2){let n;wC(n=CC())&&(i.inputSection=n.first),wC(n=CC())&&(i.sidenav=n.first);}},decls:4,vars:2,consts:[["inputSection",""],[3,"drawerOpen"],[1,"app",3,"mousedown","touchstart"],[3,"projectName","threadId"],[3,"chatFocused","drawerStateChange","projectName","threadId"],[1,"welcome-section"],[1,"input-section"],[1,"input-center"],[1,"input-glass"],[3,"messageSubmitted","voiceMessageReady","voiceRecordingToggled","heightChanged","textareaFocused","isDisabled","isSessionInitializing","showWelcome","isThinking","isStarting"]],template:function(t,i){t&1&&(Is(0,"app-sidenav",1)(1,"div",2),Ag("mousedown",function(){return i.onChatFocusedOnMobile()})("touchstart",function(){return i.onChatFocusedOnMobile()}),tC(2,ee,1,2,"app-thread",3)(3,te,7,5),pl()()),t&2&&(Tg("drawerOpen",i.isDrawerOpen),JE(2),nC(i.threadId?2:3));},dependencies:[rt,_i,T,St],styles:["[_nghost-%COMP%]{display:flex;height:100vh;width:100%;overflow:hidden;justify-content:center}.app[_ngcontent-%COMP%]{width:100%;max-width:100%;min-width:0;height:100%;display:flex;flex-direction:column;background:var(--color-bg);color:var(--color-text);transition:all .3s ease;position:relative;justify-content:center;overflow:hidden}.chat-wrapper[_ngcontent-%COMP%]{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;background:transparent;width:100%;padding:2.5rem 0 1.5rem;display:flex;justify-content:center}.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem}@media(max-width:768px){.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{padding:0 1rem}}.welcome-section[_ngcontent-%COMP%]{flex-shrink:0;text-align:center;padding:2rem 1rem;animation:_ngcontent-%COMP%_fadeInUp .8s ease-out;display:flex;justify-content:center;align-items:center;width:100%;min-width:0;overflow:hidden}@keyframes _ngcontent-%COMP%_fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.input-section[_ngcontent-%COMP%]{flex-shrink:0;position:relative;border-top:none;background:transparent;box-shadow:none;padding:2.5rem 0 2rem;overflow-y:visible;max-height:none;width:100%;z-index:10;pointer-events:none;display:flex;justify-content:center}.input-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem;display:flex;justify-content:center;align-items:end;position:relative;pointer-events:auto}@media(max-width:768px){.input-center[_ngcontent-%COMP%]{padding:0 1rem}}.input-glass[_ngcontent-%COMP%]{background:none;box-shadow:none;width:100%;min-height:64px;display:flex;align-items:stretch;gap:0;pointer-events:auto;position:relative;overflow:visible}.input-glass[_ngcontent-%COMP%] app-chat-textarea[_ngcontent-%COMP%]{width:100%;min-width:0;flex:1 1 auto;align-self:stretch;display:flex}body.dark[_nghost-%COMP%], body.dark [_nghost-%COMP%], [_ngcontent-%COMP%]:root[data-theme=dark] .input-glass[_ngcontent-%COMP%]{background:#24283073;border-color:#b4c8ff17;box-shadow:0 8px 32px #0000002b,0 1.5px 8px #00000012}.choice-overlay[_ngcontent-%COMP%]{z-index:10;width:100%;display:flex;justify-content:center;align-items:center}.upload-status[_ngcontent-%COMP%]{position:fixed;bottom:100px;left:50%;transform:translate(-50%);z-index:1000;display:flex;align-items:center;padding:12px 20px;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);border-radius:16px;font-size:.9em;color:var(--color-text);box-shadow:var(--glass-shadow);max-width:300px;text-align:center}.upload-status.error[_ngcontent-%COMP%]{background:#ff3b3026;color:var(--color-error);border-color:#ff3b304d}@media(max-width:768px){.welcome-section[_ngcontent-%COMP%]{padding:1.5rem 1rem}.input-section[_ngcontent-%COMP%]{padding:1.5rem .75rem 1rem}.input-center[_ngcontent-%COMP%]{padding:0 .5rem}}@media print{[_nghost-%COMP%]{display:block!important;height:auto!important;overflow:visible!important}.app[_ngcontent-%COMP%]{height:auto!important;overflow:visible!important;display:block!important}.input-section[_ngcontent-%COMP%], .welcome-section[_ngcontent-%COMP%]{display:none!important}}"],data:{animation:[a("slideIn",[S(":enter",[F({transform:"translateY(100%)",opacity:0}),c("300ms ease-out",F({transform:"translateY(0)",opacity:1}))]),S(":leave",[c("200ms ease-in",F({transform:"translateY(100%)",opacity:0}))])])]},changeDetection:1})};export{K as MainAppComponent};
|
|
1
|
+
import {S as St}from'./chunk-DzicJow4.js';import {an as ce,g,L,ao as V,G,N as N$1,ap as Vy,h as Rw,aq as a,ar as S,as as F,at as c,I as Is,A as Ag,t as tC,m as pl,T as Tg,J as JE,v as nC,D as Fg,E as wC,K as CC,au as nv,ae as Ot,av as dt,Y as x,aw as hl,q as qC,ax as gl,a8 as Zg,a9 as fC,aa as If,ac as yC,ab as wf,n as bg}from'./main-6K2UFGD2.js';import {a as at,s as st,r as rt,_ as _i}from'./chunk-Bnic_hdt.js';import'./chunk-BKlwFrFB.js';import {G as Ge}from'./chunk-C7MXO6BQ.js';import'./chunk-nWqZHM4o.js';import'./chunk-XgEfnfT0.js';import'./chunk-BhM0bmJW.js';import'./chunk-BVCQOGLR.js';import'./chunk-BUEM7g7F.js';import'./chunk-l0HLnBLv.js';import'./chunk-DTIhOEG_.js';import'./chunk-C9tuHQmZ.js';var T=class o{welcomeMessages=["Welcome to Coday","Bienvenue sur Coday","Bienvenido a Coday","Willkommen bei Coday","Benvenuto su Coday","Bem-vindo ao Coday","Welkom bij Coday","\u0414\u043E\u0431\u0440\u043E \u043F\u043E\u0436\u0430\u043B\u043E\u0432\u0430\u0442\u044C \u0432 Coday","Coday \u3078\u3088\u3046\u3053\u305D","\u6B22\u8FCE\u6765\u5230 Coday","Coday \uC5D0 \uC624\uC2E0 \uAC83\uC744 \uD658\uC601\uD569\uB2C8\uB2E4","\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0643 \u0641\u064A Coday"];currentWelcomeIndex=0;currentWelcomeMessage=this.welcomeMessages[0];welcomeRotationInterval;ngOnInit(){this.startWelcomeRotation();}ngOnDestroy(){this.stopWelcomeRotation();}startWelcomeRotation(){this.welcomeRotationInterval=window.setInterval(()=>{this.currentWelcomeIndex=(this.currentWelcomeIndex+1)%this.welcomeMessages.length,this.currentWelcomeMessage=this.welcomeMessages[this.currentWelcomeIndex];},3e3);}stopWelcomeRotation(){this.welcomeRotationInterval&&(clearInterval(this.welcomeRotationInterval),this.welcomeRotationInterval=void 0);}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=Rw({type:o,selectors:[["app-welcome-message"]],decls:2,vars:1,consts:[[1,"welcome-title"]],template:function(t,i){t&1&&(hl(0,"h1",0),qC(1),gl()),t&2&&(JE(),Zg(i.currentWelcomeMessage));},styles:[".welcome-title[_ngcontent-%COMP%]{font-size:clamp(1.5rem,4vw,4rem);font-weight:700;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% auto;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:_ngcontent-%COMP%_gradientShift 3s ease-in-out infinite;margin:0;padding:0;line-height:1.2;transition:opacity .5s ease-in-out;display:block;min-height:1.2em;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0% center}50%{background-position:100% center}to{background-position:0% center}}"],changeDetection:1})};var N=class o{destroy$=new ce;isSetup=false;codayService=g(Ge);preferencesService=g(L);setup(){if(this.isSetup){console.warn("[AGENT-NOTIFICATION] Service already set up");return}console.log("[AGENT-NOTIFICATION] Setting up agent notification service"),this.codayService.isThinking$.pipe(Vy(this.destroy$),nv(),Ot(([e,t])=>e===true&&t===false)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Agent stopped thinking, notifying task finished"),this.notifyTaskFinishedIfEnabled();}),this.preferencesService.browserNotificationEnabled$.pipe(Vy(this.destroy$),nv(),Ot(([e,t])=>e===false&&t===true)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Browser notifications enabled, checking permission"),this.handleBrowserNotificationEnabled();}),this.isSetup=true;}notifyTaskFinishedIfEnabled(){this.preferencesService.getAgentNotificationEnabled()&&(this.preferencesService.getNotificationSoundEnabled()&&this.playCompletionSound(),this.preferencesService.getBrowserNotificationEnabled()&&this.sendBrowserNotification());}playCompletionSound(){try{let e=new(window.AudioContext||window.webkitAudioContext),t=e.createOscillator(),i=e.createGain();t.connect(i),i.connect(e.destination),t.frequency.setValueAtTime(700,e.currentTime),i.gain.setValueAtTime(.1,e.currentTime),i.gain.exponentialRampToValueAtTime(.01,e.currentTime+.08),t.start(e.currentTime),t.stop(e.currentTime+.08);let n=e.createOscillator(),r=e.createGain();n.connect(r),r.connect(e.destination);let l=e.currentTime+.11;n.frequency.setValueAtTime(950,l),r.gain.setValueAtTime(.1,l),r.gain.exponentialRampToValueAtTime(.01,l+.09),n.start(l),n.stop(l+.09),console.log("[AGENT-NOTIFICATION] Completion sound played");}catch(e){console.error("[AGENT-NOTIFICATION] Failed to play completion sound:",e);}}handleBrowserNotificationEnabled(){return dt(this,null,function*(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications"),this.preferencesService.setBrowserNotificationEnabled(false);return}if(Notification.permission==="denied"){console.warn("[AGENT-NOTIFICATION] Permission denied, disabling browser notifications"),this.preferencesService.setBrowserNotificationEnabled(false);return}if(Notification.permission==="granted"){console.log("[AGENT-NOTIFICATION] Permission already granted, showing confirmation"),this.createConfirmationNotification();return}try{(yield Notification.requestPermission())==="granted"?(console.log("[AGENT-NOTIFICATION] Permission granted, showing confirmation"),this.createConfirmationNotification()):(console.log("[AGENT-NOTIFICATION] Permission denied or dismissed"),this.preferencesService.setBrowserNotificationEnabled(!1));}catch(e){console.error("[AGENT-NOTIFICATION] Error requesting permission:",e),this.preferencesService.setBrowserNotificationEnabled(false);}})}sendBrowserNotification(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications");return}if(document.hasFocus()){console.warn("[AGENT-NOTIFICATION] Document is focused, skipping browser notification");return}Notification.permission==="granted"?this.createTaskCompleteNotification():console.warn("[AGENT-NOTIFICATION] Permission not granted, cannot send notification");}createConfirmationNotification(){let e=new Notification("Coday - Notifications Enabled",{body:"You will be notified when the agent completes tasks",icon:"/favicon.ico",tag:"coday-notifications-enabled",requireInteraction:false});setTimeout(()=>e.close(),4e3),e.onclick=()=>{window.focus(),e.close();},console.log("[AGENT-NOTIFICATION] Confirmation notification sent");}createTaskCompleteNotification(){let e=new Notification("Coday - Task Complete",{body:"The agent has finished and is waiting for your input",icon:"/favicon.ico",tag:"coday-task-complete",requireInteraction:false});setTimeout(()=>e.close(),5e3),e.onclick=()=>{window.focus(),e.close();},console.log("[AGENT-NOTIFICATION] Task complete notification sent");}ngOnDestroy(){console.log("[AGENT-NOTIFICATION] Service destroyed"),this.destroy$.next(),this.destroy$.complete();}static \u0275fac=function(t){return new(t||o)};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var Z=["inputSection"];function ee(o,e){if(o&1){let t=fC();Is(0,"app-thread",4),Ag("chatFocused",function(){If(t);let n=yC();return wf(n.onChatFocusedOnMobile())})("drawerStateChange",function(n){If(t);let r=yC();return wf(r.onDrawerStateChange(n))}),pl();}if(o&2){let t=yC();Tg("projectName",t.projectName)("threadId",t.threadId);}}function te(o,e){if(o&1){let t=fC();Is(0,"div",5),bg(1,"app-welcome-message"),pl(),Is(2,"div",6,0)(4,"div",7)(5,"div",8)(6,"app-chat-textarea",9),Ag("messageSubmitted",function(n){If(t);let r=yC();return wf(r.onMessageSubmitted(n))})("voiceMessageReady",function(n){If(t);let r=yC();return wf(r.onVoiceMessageReady(n))})("voiceRecordingToggled",function(n){If(t);let r=yC();return wf(r.onVoiceToggled(n))})("heightChanged",function(n){If(t);let r=yC();return wf(r.onInputHeightChanged(n))})("textareaFocused",function(){If(t);let n=yC();return wf(n.onChatFocusedOnMobile())}),pl()()()();}if(o&2){let t=yC();JE(6),Tg("isDisabled",t.isSessionInitializing)("isSessionInitializing",t.isSessionInitializing)("showWelcome",true)("isThinking",false)("isStarting",t.isStartingFirstMessage);}}var K=class o{destroy$=new ce;inputSection;sidenav;projectName="";threadId=null;isSessionInitializing=false;isStartingFirstMessage=false;inputSectionHeight=80;codayService=g(Ge);titleService=g(at);preferencesService=g(L);route=g(V);router=g(G);threadApiService=g(N$1);agentNotificationService=g(N);firstMessageState=g(st);constructor(){console.log("[MAIN-APP] Using new thread-based architecture (no clientId needed)");}ngOnInit(){this.agentNotificationService.setup(),this.setupPrintHandlers(),this.route.params.pipe(Vy(this.destroy$)).subscribe(e=>{let t=e.projectName,i=e.threadId||null;console.log("[MAIN-APP] Route params updated:",{project:t,thread:i,previousProject:this.projectName,previousThread:this.threadId}),this.projectName=t,this.threadId=i,this.threadId?console.log("[MAIN-APP] Thread selected - ThreadComponent will display"):(console.log("[MAIN-APP] No thread selected - showing welcome view"),this.initializeWelcomeView());});}initializeWelcomeView(){this.codayService.setTabTitleService(this.titleService);}ngAfterViewInit(){setTimeout(()=>this.updateInputSectionHeight(),100);}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),window.removeEventListener("beforeprint",this.handleBeforePrint),window.removeEventListener("afterprint",this.handleAfterPrint);}onMessageSubmitted(e){console.log("[MAIN-APP] First message submitted from welcome view:",e),this.isSessionInitializing=true,this.isStartingFirstMessage=true,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created:",t.thread.id),this.firstMessageState.setPendingFirstMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id]);},error:t=>{console.error("[MAIN-APP] Failed to create thread:",t),this.isSessionInitializing=false,this.isStartingFirstMessage=false,alert("Failed to create conversation: "+(t.message||"Unknown error"));}});}onVoiceToggled(e){console.log("[VOICE] Recording in welcome view:",e);}onVoiceMessageReady(e){console.log("[MAIN-APP] Voice message ready from welcome view"),this.isSessionInitializing=true,this.isStartingFirstMessage=true,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created for voice message:",t.thread.id),this.firstMessageState.setPendingVoiceMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id]);},error:t=>{console.error("[MAIN-APP] Failed to create thread for voice message:",t),this.isSessionInitializing=false,this.isStartingFirstMessage=false,alert("Failed to create conversation: "+(t.message||"Unknown error"));}});}isDrawerOpen=false;onDrawerStateChange(e){this.isDrawerOpen=e;}onChatFocusedOnMobile(){window.innerWidth<1024&&this.sidenav?.close();}onInputHeightChanged(e){console.log("[MAIN-APP] Input height changed:",e),this.inputSectionHeight=e;}updateInputSectionHeight(){if(this.inputSection?.nativeElement){let e=this.inputSection.nativeElement.offsetHeight;e!==this.inputSectionHeight&&(console.log("[MAIN-APP] Input section height updated:",e),this.inputSectionHeight=e);}}setupPrintHandlers(){window.addEventListener("beforeprint",this.handleBeforePrint),window.addEventListener("afterprint",this.handleAfterPrint);}handleBeforePrint=()=>{console.log("[PRINT] Before print event triggered");let e=this.preferencesService.getPrintTechnicalMessages();console.log("[PRINT] Print technical messages:",e),e?document.body.classList.add("print-include-technical"):document.body.classList.remove("print-include-technical");};handleAfterPrint=()=>{console.log("[PRINT] After print event triggered"),document.body.classList.remove("print-include-technical");};static \u0275fac=function(t){return new(t||o)};static \u0275cmp=Rw({type:o,selectors:[["app-main"]],viewQuery:function(t,i){if(t&1&&Fg(Z,5)(St,5),t&2){let n;wC(n=CC())&&(i.inputSection=n.first),wC(n=CC())&&(i.sidenav=n.first);}},decls:4,vars:2,consts:[["inputSection",""],[3,"drawerOpen"],[1,"app",3,"mousedown","touchstart"],[3,"projectName","threadId"],[3,"chatFocused","drawerStateChange","projectName","threadId"],[1,"welcome-section"],[1,"input-section"],[1,"input-center"],[1,"input-glass"],[3,"messageSubmitted","voiceMessageReady","voiceRecordingToggled","heightChanged","textareaFocused","isDisabled","isSessionInitializing","showWelcome","isThinking","isStarting"]],template:function(t,i){t&1&&(Is(0,"app-sidenav",1)(1,"div",2),Ag("mousedown",function(){return i.onChatFocusedOnMobile()})("touchstart",function(){return i.onChatFocusedOnMobile()}),tC(2,ee,1,2,"app-thread",3)(3,te,7,5),pl()()),t&2&&(Tg("drawerOpen",i.isDrawerOpen),JE(2),nC(i.threadId?2:3));},dependencies:[rt,_i,T,St],styles:["[_nghost-%COMP%]{display:flex;height:100vh;width:100%;overflow:hidden;justify-content:center}.app[_ngcontent-%COMP%]{width:100%;max-width:100%;min-width:0;height:100%;display:flex;flex-direction:column;background:var(--color-bg);color:var(--color-text);transition:all .3s ease;position:relative;justify-content:center;overflow:hidden}.chat-wrapper[_ngcontent-%COMP%]{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;background:transparent;width:100%;padding:2.5rem 0 1.5rem;display:flex;justify-content:center}.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem}@media(max-width:768px){.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{padding:0 1rem}}.welcome-section[_ngcontent-%COMP%]{flex-shrink:0;text-align:center;padding:2rem 1rem;animation:_ngcontent-%COMP%_fadeInUp .8s ease-out;display:flex;justify-content:center;align-items:center;width:100%;min-width:0;overflow:hidden}@keyframes _ngcontent-%COMP%_fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.input-section[_ngcontent-%COMP%]{flex-shrink:0;position:relative;border-top:none;background:transparent;box-shadow:none;padding:2.5rem 0 2rem;overflow-y:visible;max-height:none;width:100%;z-index:10;pointer-events:none;display:flex;justify-content:center}.input-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem;display:flex;justify-content:center;align-items:end;position:relative;pointer-events:auto}@media(max-width:768px){.input-center[_ngcontent-%COMP%]{padding:0 1rem}}.input-glass[_ngcontent-%COMP%]{background:none;box-shadow:none;width:100%;min-height:64px;display:flex;align-items:stretch;gap:0;pointer-events:auto;position:relative;overflow:visible}.input-glass[_ngcontent-%COMP%] app-chat-textarea[_ngcontent-%COMP%]{width:100%;min-width:0;flex:1 1 auto;align-self:stretch;display:flex}body.dark[_nghost-%COMP%], body.dark [_nghost-%COMP%], [_ngcontent-%COMP%]:root[data-theme=dark] .input-glass[_ngcontent-%COMP%]{background:#24283073;border-color:#b4c8ff17;box-shadow:0 8px 32px #0000002b,0 1.5px 8px #00000012}.choice-overlay[_ngcontent-%COMP%]{z-index:10;width:100%;display:flex;justify-content:center;align-items:center}.upload-status[_ngcontent-%COMP%]{position:fixed;bottom:100px;left:50%;transform:translate(-50%);z-index:1000;display:flex;align-items:center;padding:12px 20px;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);border-radius:16px;font-size:.9em;color:var(--color-text);box-shadow:var(--glass-shadow);max-width:300px;text-align:center}.upload-status.error[_ngcontent-%COMP%]{background:#ff3b3026;color:var(--color-error);border-color:#ff3b304d}@media(max-width:768px){.welcome-section[_ngcontent-%COMP%]{padding:1.5rem 1rem}.input-section[_ngcontent-%COMP%]{padding:1.5rem .75rem 1rem}.input-center[_ngcontent-%COMP%]{padding:0 .5rem}}@media print{[_nghost-%COMP%]{display:block!important;height:auto!important;overflow:visible!important}.app[_ngcontent-%COMP%]{height:auto!important;overflow:visible!important;display:block!important}.input-section[_ngcontent-%COMP%], .welcome-section[_ngcontent-%COMP%]{display:none!important}}"],data:{animation:[a("slideIn",[S(":enter",[F({transform:"translateY(100%)",opacity:0}),c("300ms ease-out",F({transform:"translateY(0)",opacity:1}))]),S(":leave",[c("200ms ease-in",F({transform:"translateY(100%)",opacity:0}))])])]},changeDetection:1})};export{K as MainAppComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,dj as
|
|
1
|
+
import {g,dj as ne,Y as x}from'./main-6K2UFGD2.js';var c=class r{api=g(ne);getById(e){return this.api.getByIdScheduledPrompt(e)}listPlatform(){return this.api.searchScheduledPrompt({namespaceId:null,userId:null})}listByNamespace(e){return this.api.searchScheduledPrompt({namespaceId:e,userId:null})}search(e){return this.api.searchScheduledPrompt(e)}listEffective(e){return this.api.resolveEffectiveScheduledPrompt(e)}create(e){return this.api.createScheduledPrompt(e)}update(e,t){return this.api.updateScheduledPrompt(e,t)}enable(e){return this.api.enableScheduledPrompt(e)}disable(e){return this.api.disableScheduledPrompt(e)}delete(e){return this.api.deleteScheduledPrompt(e)}static \u0275fac=function(t){return new(t||r)};static \u0275prov=x({token:r,factory:r.\u0275fac,providedIn:"root"})};export{c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {R}from'./chunk-
|
|
1
|
+
import {R}from'./chunk-C5wr-vqf.js';import {c}from'./chunk-D_vvo2qx.js';import {g,ao as V$1,G,w as we,z as zi,y as yT,S as By,a7 as ya,X as br,c as U,h as Rw,I as Is,A as Ag,m as pl,af as Dg,r as bC,T as Tg,t as tC,ac as yC,v as nC,a9 as fC,aa as If,ab as wf,ag as pT}from'./main-6K2UFGD2.js';import {W as Wn,S as Se}from'./chunk-l0HLnBLv.js';import'./chunk-DTIhOEG_.js';import'./chunk-C9tuHQmZ.js';function V(i,e){if(i&1){let t=fC();Is(0,"agentos-scheduled-prompt-item",4),Ag("enableRequested",function(n){If(t);let s=yC(2);return wf(s.enablePrompt(n))})("disableRequested",function(n){If(t);let s=yC(2);return wf(s.disablePrompt(n))})("deleteRequested",function(n){If(t);let s=yC(2);return wf(s.deletePrompt(n))}),pl();}if(i&2){let t=yC().$implicit,o=yC();Tg("definition",e)("namespaceId",o.namespaceId)("readOnly",o.isPlatformPrompt(t.id));}}function k(i,e){if(i&1&&tC(0,V,1,3,"agentos-scheduled-prompt-item",3),i&2){let t,o=e.$implicit,n=yC();nC((t=n.resolvePrompt(o.id))?0:-1,t);}}var O="platform",B="namespace",M=class i{route=g(V$1);router=g(G);destroyRef=g(we);state=g(c);namespaceId=this.route.snapshot.params.namespaceId;platformPrompts=zi([]);namespacePrompts=zi([]);isLoading=zi(true);promptItems=yT(()=>[...this.platformPrompts().map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:O,groupLabel:"Platform (read-only)",badges:[{label:e.enabled?"Enabled":"Disabled",variant:e.enabled?"success":"warning"}]})),...this.namespacePrompts().map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:B,groupLabel:"Namespace",badges:[{label:e.enabled?"Enabled":"Disabled",variant:e.enabled?"success":"warning"}]}))]);constructor(){By({platform:this.state.listPlatform().pipe(ya(()=>br([]))),namespace:this.state.listByNamespace(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({platform:e,namespace:t})=>{this.platformPrompts.set(e),this.namespacePrompts.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}goBack(){this.router.navigate(["/agentos","namespaces"]);}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts","new"]);}enablePrompt(e){this.state.enable(e.id??"").pipe(U(this.destroyRef)).subscribe(t=>this.patchNamespacePrompt(t));}disablePrompt(e){this.state.disable(e.id??"").pipe(U(this.destroyRef)).subscribe(t=>this.patchNamespacePrompt(t));}deletePrompt(e){let t=e.id??"";this.state.delete(t).pipe(U(this.destroyRef)).subscribe(()=>this.namespacePrompts.update(o=>o.filter(n=>n.id!==t)));}resolvePrompt(e){return this.platformPrompts().find(t=>t.id===e)??this.namespacePrompts().find(t=>t.id===e)??null}isPlatformPrompt(e){return this.platformPrompts().some(t=>t.id===e)}patchNamespacePrompt(e){this.namespacePrompts.update(t=>t.map(o=>o.id===e.id?e:o));}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=Rw({type:i,selectors:[["agentos-scheduled-prompt-list"]],decls:4,vars:4,consts:[["scheduledPromptItemTpl",""],["title","Scheduled Prompts","emptyMessage","No scheduled prompts yet. Create one to get started.","cardMinWidth","420px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[3,"definition","namespaceId","readOnly"],[3,"enableRequested","disableRequested","deleteRequested","definition","namespaceId","readOnly"]],template:function(t,o){if(t&1&&(Is(0,"ds-entity-list",1),Ag("createRequested",function(){return o.openCreateForm()}),Is(1,"ds-icon-button",2),Ag("action",function(){return o.goBack()}),pl()(),Dg(2,k,1,1,"ng-template",null,0,pT)),t&2){let n=bC(3);Tg("items",o.promptItems())("loading",o.isLoading())("showCreate",true)("itemTemplate",n);}},dependencies:[Wn,R,Se],encapsulation:2})};export{M as ScheduledPromptListComponent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {x as xe}from'./chunk-nRV2u7bW.js';import {P as Pt$1,L as Lt}from'./chunk-Duz7aHYs.js';import {v as ve,n as ne}from'./chunk-CkXXby9d.js';import {d}from'./chunk-BUJvZgLu.js';import {W,k as ke,s as se}from'./chunk-CCFtehVS.js';import {T as Tn,S as Sn,n as nt,a as ae,l as le,c as ce}from'./chunk-Bz081WAa.js';import {W as Wn,o as ot,i as it,I as In,D as De,B as Be,y as ya,E as En,F as Fn,g as gt$1,A as An}from'./chunk-BESIk8ll.js';import'./chunk-BSY9MBD-.js';import {g,bm as Sm,R as Re,z as zi,y as yT,h as Rw,i as hr,k as Gn,I as Is,A as Ag,q as qC,m as pl,a3 as UI,t as tC,af as Dg,ag as pT,r as bC,J as JE,T as Tg,a6 as zI,v as nC,Z as z,_ as Ue,am as Gm,$ as zt$1,a0 as jt$1,a1 as Vt,a2 as Nt$1,j as pr,ai as Jg,aj as XC,o as iC,a8 as Zg,ak as Xg,x as sC,a5 as vl,ac as yC,a9 as fC,aa as If,ab as wf,bp as ml,bq as yl,ah as oT,b4 as iT,aL as Eo,aM as qn,br as sn,aO as wt$1,bs as Tl,bt as Qn,aT as Ut$1,al as yt$2,aW as w,bu as Ve,aZ as Ls,a_ as QT,b5 as rT,C as Cg,H as Hg,bv as kg,E as wC,K as CC,az as Kt$1,bw as St,aS as K$1,aX as D$1,bx as on,by as am,bz as Oi,bA as DC,bB as EC,n as bg,D as Fg,bC as Ti,bo as rC}from'./main-4SCUMPDY.js';import {y as yt$1,w as wt,t as ti,Z as Zn,c as cn,Y as Ye,f as fn,g as gt,$ as $t$1,D}from'./chunk-LgALnta4.js';var Pt=["button"],Ot=["*"];function Ft(l,a){if(l&1&&(Is(0,"div",2),bg(1,"mat-pseudo-checkbox",6),pl()),l&2){let e=yC();JE(),Tg("disabled",e.disabled);}}var yt=new w("MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS",{providedIn:"root",factory:()=>({hideSingleSelectionIndicator:false,hideMultipleSelectionIndicator:false,disabledInteractive:false})}),vt=new w("MatButtonToggleGroup"),Dt={provide:D,useExisting:Ti(()=>ie),multi:true},K=class{source;value;constructor(a,e){this.source=a,this.value=e;}},ie=(()=>{class l{_changeDetector=g(Tl);_dir=g(Qn,{optional:true});_multiple=false;_disabled=false;_disabledInteractive=false;_selectionModel;_rawValue;_controlValueAccessorChangeFn=()=>{};_onTouched=()=>{};_buttonToggles;appearance;get name(){return this._name}set name(e){this._name=e,this._markButtonsForCheck();}_name=g(Ut$1).getId("mat-button-toggle-group-");vertical=false;get value(){let e=this._selectionModel?this._selectionModel.selected:[];return this.multiple?e.map(t=>t.value):e[0]?e[0].value:void 0}set value(e){this._setSelectionByValue(e),this.valueChange.emit(this.value);}valueChange=new yt$2;get selected(){let e=this._selectionModel?this._selectionModel.selected:[];return this.multiple?e:e[0]||null}get multiple(){return this._multiple}set multiple(e){this._multiple=e,this._markButtonsForCheck();}get disabled(){return this._disabled}set disabled(e){this._disabled=e,this._markButtonsForCheck();}get disabledInteractive(){return this._disabledInteractive}set disabledInteractive(e){this._disabledInteractive=e,this._markButtonsForCheck();}get dir(){return this._dir&&this._dir.value==="rtl"?"rtl":"ltr"}change=new yt$2;get hideSingleSelectionIndicator(){return this._hideSingleSelectionIndicator}set hideSingleSelectionIndicator(e){this._hideSingleSelectionIndicator=e,this._markButtonsForCheck();}_hideSingleSelectionIndicator;get hideMultipleSelectionIndicator(){return this._hideMultipleSelectionIndicator}set hideMultipleSelectionIndicator(e){this._hideMultipleSelectionIndicator=e,this._markButtonsForCheck();}_hideMultipleSelectionIndicator;constructor(){let e=g(yt,{optional:true});this.appearance=e&&e.appearance?e.appearance:"standard",this._hideSingleSelectionIndicator=e?.hideSingleSelectionIndicator??false,this._hideMultipleSelectionIndicator=e?.hideMultipleSelectionIndicator??false;}ngOnInit(){this._selectionModel=new gt$1(this.multiple,void 0,false);}ngAfterContentInit(){this._selectionModel.select(...this._buttonToggles.filter(e=>e.checked)),this.multiple||this._initializeTabIndex();}writeValue(e){this.value=e,this._changeDetector.markForCheck();}registerOnChange(e){this._controlValueAccessorChangeFn=e;}registerOnTouched(e){this._onTouched=e;}setDisabledState(e){this.disabled=e;}_keydown(e){if(this.multiple||this.disabled||Ve(e))return;let n=e.target.id,o=this._buttonToggles.toArray().findIndex(I=>I.buttonId===n),u=null;switch(e.keyCode){case 32:case 13:u=this._buttonToggles.get(o)||null;break;case 38:u=this._getNextButton(o,-1);break;case 37:u=this._getNextButton(o,this.dir==="ltr"?-1:1);break;case 40:u=this._getNextButton(o,1);break;case 39:u=this._getNextButton(o,this.dir==="ltr"?1:-1);break;default:return}u&&(e.preventDefault(),u._onButtonClick(),u.focus());}_emitChangeEvent(e){let t=new K(e,this.value);this._rawValue=t.value,this._controlValueAccessorChangeFn(t.value),this.change.emit(t);}_syncButtonToggle(e,t,n=false,o=false){!this.multiple&&this.selected&&!e.checked&&(this.selected.checked=false),this._selectionModel?t?this._selectionModel.select(e):this._selectionModel.deselect(e):o=true,o?Promise.resolve().then(()=>this._updateModelValue(e,n)):this._updateModelValue(e,n);}_isSelected(e){return this._selectionModel&&this._selectionModel.isSelected(e)}_isPrechecked(e){return typeof this._rawValue>"u"?false:this.multiple&&Array.isArray(this._rawValue)?this._rawValue.some(t=>e.value!=null&&t===e.value):e.value===this._rawValue}_initializeTabIndex(){if(this._buttonToggles.forEach(e=>{e.tabIndex=-1;}),this.selected)this.selected.tabIndex=0;else for(let e=0;e<this._buttonToggles.length;e++){let t=this._buttonToggles.get(e);if(!t.disabled){t.tabIndex=0;break}}}_getNextButton(e,t){let n=this._buttonToggles;for(let o=1;o<=n.length;o++){let u=(e+t*o+n.length)%n.length,I=n.get(u);if(I&&!I.disabled)return I}return null}_setSelectionByValue(e){if(this._rawValue=e,!this._buttonToggles)return;let t=this._buttonToggles.toArray();if(this.multiple&&e?(this._clearSelection(),e.forEach(n=>this._selectValue(n,t))):(this._clearSelection(),this._selectValue(e,t)),!this.multiple&&t.every(n=>n.tabIndex===-1)){for(let n of t)if(!n.disabled){n.tabIndex=0;break}}}_clearSelection(){this._selectionModel.clear(),this._buttonToggles.forEach(e=>{e.checked=false,this.multiple||(e.tabIndex=-1);});}_selectValue(e,t){for(let n of t)if(n.value===e){n.checked=true,this._selectionModel.select(n),this.multiple||(n.tabIndex=0);break}}_updateModelValue(e,t){t&&this._emitChangeEvent(e),this.valueChange.emit(this.value);}_markButtonsForCheck(){this._buttonToggles?.forEach(e=>e._markForCheck());}static \u0275fac=function(t){return new(t||l)};static \u0275dir=Ls({type:l,selectors:[["mat-button-toggle-group"]],contentQueries:function(t,n,o){if(t&1&&kg(o,X,5),t&2){let u;wC(u=CC())&&(n._buttonToggles=u);}},hostAttrs:[1,"mat-button-toggle-group"],hostVars:6,hostBindings:function(t,n){t&1&&Ag("keydown",function(u){return n._keydown(u)}),t&2&&(Cg("role",n.multiple?"group":"radiogroup")("aria-disabled",n.disabled),Hg("mat-button-toggle-vertical",n.vertical)("mat-button-toggle-group-appearance-standard",n.appearance==="standard"));},inputs:{appearance:"appearance",name:"name",vertical:[2,"vertical","vertical",QT],value:"value",multiple:[2,"multiple","multiple",QT],disabled:[2,"disabled","disabled",QT],disabledInteractive:[2,"disabledInteractive","disabledInteractive",QT],hideSingleSelectionIndicator:[2,"hideSingleSelectionIndicator","hideSingleSelectionIndicator",QT],hideMultipleSelectionIndicator:[2,"hideMultipleSelectionIndicator","hideMultipleSelectionIndicator",QT]},outputs:{valueChange:"valueChange",change:"change"},exportAs:["matButtonToggleGroup"],features:[rT([Dt,{provide:vt,useExisting:l}])]})}return l})(),X=(()=>{class l{_changeDetectorRef=g(Tl);_elementRef=g(Kt$1);_focusMonitor=g(St);_idGenerator=g(Ut$1);_animationDisabled=K$1();_checked=false;ariaLabel;ariaLabelledby=null;_buttonElement;buttonToggleGroup;get buttonId(){return `${this.id}-button`}id;name;value;get tabIndex(){return this._tabIndex()}set tabIndex(e){this._tabIndex.set(e);}_tabIndex;disableRipple=false;get appearance(){return this.buttonToggleGroup?this.buttonToggleGroup.appearance:this._appearance}set appearance(e){this._appearance=e;}_appearance;get checked(){return this.buttonToggleGroup?this.buttonToggleGroup._isSelected(this):this._checked}set checked(e){e!==this._checked&&(this._checked=e,this.buttonToggleGroup&&this.buttonToggleGroup._syncButtonToggle(this,this._checked),this._changeDetectorRef.markForCheck());}get disabled(){return this._disabled||this.buttonToggleGroup&&this.buttonToggleGroup.disabled}set disabled(e){this._disabled=e;}_disabled=false;get disabledInteractive(){return this._disabledInteractive||this.buttonToggleGroup!==null&&this.buttonToggleGroup.disabledInteractive}set disabledInteractive(e){this._disabledInteractive=e;}_disabledInteractive;change=new yt$2;constructor(){g(D$1).load(on);let e=g(vt,{optional:true}),t=g(new am("tabindex"),{optional:true})||"",n=g(yt,{optional:true});this._tabIndex=zi(parseInt(t)||0),this.buttonToggleGroup=e,this._appearance=n&&n.appearance?n.appearance:"standard",this._disabledInteractive=n?.disabledInteractive??false;}ngOnInit(){let e=this.buttonToggleGroup;this.id=this.id||this._idGenerator.getId("mat-button-toggle-"),e&&(e._isPrechecked(this)?this.checked=true:e._isSelected(this)!==this._checked&&e._syncButtonToggle(this,this._checked));}ngAfterViewInit(){this._animationDisabled||this._elementRef.nativeElement.classList.add("mat-button-toggle-animations-enabled"),this._focusMonitor.monitor(this._elementRef,true);}ngOnDestroy(){let e=this.buttonToggleGroup;this._focusMonitor.stopMonitoring(this._elementRef),e&&e._isSelected(this)&&e._syncButtonToggle(this,false,false,true);}focus(e){this._buttonElement.nativeElement.focus(e);}_onButtonClick(){if(this.disabled)return;let e=this.isSingleSelector()?true:!this._checked;if(e!==this._checked&&(this._checked=e,this.buttonToggleGroup&&(this.buttonToggleGroup._syncButtonToggle(this,this._checked,true),this.buttonToggleGroup._onTouched())),this.isSingleSelector()){let t=this.buttonToggleGroup._buttonToggles.find(n=>n.tabIndex===0);t&&(t.tabIndex=-1),this.tabIndex=0;}this.change.emit(new K(this,this.value));}_markForCheck(){this._changeDetectorRef.markForCheck();}_getButtonName(){return this.isSingleSelector()?this.buttonToggleGroup.name:this.name||null}isSingleSelector(){return this.buttonToggleGroup&&!this.buttonToggleGroup.multiple}static \u0275fac=function(t){return new(t||l)};static \u0275cmp=Rw({type:l,selectors:[["mat-button-toggle"]],viewQuery:function(t,n){if(t&1&&Fg(Pt,5),t&2){let o;wC(o=CC())&&(n._buttonElement=o.first);}},hostAttrs:["role","presentation",1,"mat-button-toggle"],hostVars:14,hostBindings:function(t,n){t&1&&Ag("focus",function(){return n.focus()}),t&2&&(Cg("aria-label",null)("aria-labelledby",null)("id",n.id)("name",null),Hg("mat-button-toggle-standalone",!n.buttonToggleGroup)("mat-button-toggle-checked",n.checked)("mat-button-toggle-disabled",n.disabled)("mat-button-toggle-disabled-interactive",n.disabledInteractive)("mat-button-toggle-appearance-standard",n.appearance==="standard"));},inputs:{ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],id:"id",name:"name",value:"value",tabIndex:"tabIndex",disableRipple:[2,"disableRipple","disableRipple",QT],appearance:"appearance",checked:[2,"checked","checked",QT],disabled:[2,"disabled","disabled",QT],disabledInteractive:[2,"disabledInteractive","disabledInteractive",QT]},outputs:{change:"change"},exportAs:["matButtonToggle"],ngContentSelectors:Ot,decls:7,vars:13,consts:[["button",""],["type","button",1,"mat-button-toggle-button","mat-focus-indicator",3,"click","id","disabled"],[1,"mat-button-toggle-checkbox-wrapper"],[1,"mat-button-toggle-label-content"],[1,"mat-button-toggle-focus-overlay"],["matRipple","",1,"mat-button-toggle-ripple",3,"matRippleTrigger","matRippleDisabled"],["state","checked","aria-hidden","true","appearance","minimal",3,"disabled"]],template:function(t,n){if(t&1&&(DC(),Is(0,"button",1,0),Ag("click",function(){return n._onButtonClick()}),tC(2,Ft,2,1,"div",2),Is(3,"span",3),EC(4),pl()(),bg(5,"span",4)(6,"span",5)),t&2){let o=bC(1);Tg("id",n.buttonId)("disabled",n.disabled&&!n.disabledInteractive||null),Cg("role",n.isSingleSelector()?"radio":"button")("tabindex",n.disabled&&!n.disabledInteractive?-1:n.tabIndex)("aria-pressed",n.isSingleSelector()?null:n.checked)("aria-checked",n.isSingleSelector()?n.checked:null)("name",n._getButtonName())("aria-label",n.ariaLabel)("aria-labelledby",n.ariaLabelledby)("aria-disabled",n.disabled&&n.disabledInteractive?"true":null),JE(2),nC(n.buttonToggleGroup&&(!n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideSingleSelectionIndicator||n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideMultipleSelectionIndicator)?2:-1),JE(4),Tg("matRippleTrigger",o)("matRippleDisabled",n.disableRipple||n.disabled);}},dependencies:[Oi,An],styles:[`.mat-button-toggle-standalone,
|
|
1
|
+
import {x as xe}from'./chunk-DxxECdrg.js';import {P as Pt$1,L as Lt}from'./chunk-BLa2Gx7h.js';import {v as ve,n as ne}from'./chunk-fP29MqaN.js';import {d}from'./chunk-BhM0bmJW.js';import {W,k as ke,s as se}from'./chunk-BVCQOGLR.js';import {T as Tn,S as Sn,n as nt,a as ae,l as le,c as ce}from'./chunk-BUEM7g7F.js';import {W as Wn,o as ot,i as it,I as In,D as De,B as Be,y as ya,E as En,F as Fn,g as gt$1,A as An}from'./chunk-l0HLnBLv.js';import'./chunk-DTIhOEG_.js';import {g,bm as Sm,R as Re,z as zi,y as yT,h as Rw,i as hr,k as Gn,I as Is,A as Ag,q as qC,m as pl,a3 as UI,t as tC,af as Dg,ag as pT,r as bC,J as JE,T as Tg,a6 as zI,v as nC,Z as z,_ as Ue,am as Gm,$ as zt$1,a0 as jt$1,a1 as Vt,a2 as Nt$1,j as pr,ai as Jg,aj as XC,o as iC,a8 as Zg,ak as Xg,x as sC,a5 as vl,ac as yC,a9 as fC,aa as If,ab as wf,bp as ml,bq as yl,ah as oT,b4 as iT,aL as Eo,aM as qn,br as sn,aO as wt$1,bs as Tl,bt as Qn,aT as Ut$1,al as yt$2,aW as w,bu as Ve,aZ as Ls,a_ as QT,b5 as rT,C as Cg,H as Hg,bv as kg,E as wC,K as CC,az as Kt$1,bw as St,aS as K$1,aX as D$1,bx as on,by as am,bz as Oi,bA as DC,bB as EC,n as bg,D as Fg,bC as Ti,bo as rC}from'./main-6K2UFGD2.js';import {y as yt$1,w as wt,t as ti,Z as Zn,c as cn,Y as Ye,f as fn,g as gt,$ as $t$1,D}from'./chunk-C9tuHQmZ.js';var Pt=["button"],Ot=["*"];function Ft(l,a){if(l&1&&(Is(0,"div",2),bg(1,"mat-pseudo-checkbox",6),pl()),l&2){let e=yC();JE(),Tg("disabled",e.disabled);}}var yt=new w("MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS",{providedIn:"root",factory:()=>({hideSingleSelectionIndicator:false,hideMultipleSelectionIndicator:false,disabledInteractive:false})}),vt=new w("MatButtonToggleGroup"),Dt={provide:D,useExisting:Ti(()=>ie),multi:true},K=class{source;value;constructor(a,e){this.source=a,this.value=e;}},ie=(()=>{class l{_changeDetector=g(Tl);_dir=g(Qn,{optional:true});_multiple=false;_disabled=false;_disabledInteractive=false;_selectionModel;_rawValue;_controlValueAccessorChangeFn=()=>{};_onTouched=()=>{};_buttonToggles;appearance;get name(){return this._name}set name(e){this._name=e,this._markButtonsForCheck();}_name=g(Ut$1).getId("mat-button-toggle-group-");vertical=false;get value(){let e=this._selectionModel?this._selectionModel.selected:[];return this.multiple?e.map(t=>t.value):e[0]?e[0].value:void 0}set value(e){this._setSelectionByValue(e),this.valueChange.emit(this.value);}valueChange=new yt$2;get selected(){let e=this._selectionModel?this._selectionModel.selected:[];return this.multiple?e:e[0]||null}get multiple(){return this._multiple}set multiple(e){this._multiple=e,this._markButtonsForCheck();}get disabled(){return this._disabled}set disabled(e){this._disabled=e,this._markButtonsForCheck();}get disabledInteractive(){return this._disabledInteractive}set disabledInteractive(e){this._disabledInteractive=e,this._markButtonsForCheck();}get dir(){return this._dir&&this._dir.value==="rtl"?"rtl":"ltr"}change=new yt$2;get hideSingleSelectionIndicator(){return this._hideSingleSelectionIndicator}set hideSingleSelectionIndicator(e){this._hideSingleSelectionIndicator=e,this._markButtonsForCheck();}_hideSingleSelectionIndicator;get hideMultipleSelectionIndicator(){return this._hideMultipleSelectionIndicator}set hideMultipleSelectionIndicator(e){this._hideMultipleSelectionIndicator=e,this._markButtonsForCheck();}_hideMultipleSelectionIndicator;constructor(){let e=g(yt,{optional:true});this.appearance=e&&e.appearance?e.appearance:"standard",this._hideSingleSelectionIndicator=e?.hideSingleSelectionIndicator??false,this._hideMultipleSelectionIndicator=e?.hideMultipleSelectionIndicator??false;}ngOnInit(){this._selectionModel=new gt$1(this.multiple,void 0,false);}ngAfterContentInit(){this._selectionModel.select(...this._buttonToggles.filter(e=>e.checked)),this.multiple||this._initializeTabIndex();}writeValue(e){this.value=e,this._changeDetector.markForCheck();}registerOnChange(e){this._controlValueAccessorChangeFn=e;}registerOnTouched(e){this._onTouched=e;}setDisabledState(e){this.disabled=e;}_keydown(e){if(this.multiple||this.disabled||Ve(e))return;let n=e.target.id,o=this._buttonToggles.toArray().findIndex(I=>I.buttonId===n),u=null;switch(e.keyCode){case 32:case 13:u=this._buttonToggles.get(o)||null;break;case 38:u=this._getNextButton(o,-1);break;case 37:u=this._getNextButton(o,this.dir==="ltr"?-1:1);break;case 40:u=this._getNextButton(o,1);break;case 39:u=this._getNextButton(o,this.dir==="ltr"?1:-1);break;default:return}u&&(e.preventDefault(),u._onButtonClick(),u.focus());}_emitChangeEvent(e){let t=new K(e,this.value);this._rawValue=t.value,this._controlValueAccessorChangeFn(t.value),this.change.emit(t);}_syncButtonToggle(e,t,n=false,o=false){!this.multiple&&this.selected&&!e.checked&&(this.selected.checked=false),this._selectionModel?t?this._selectionModel.select(e):this._selectionModel.deselect(e):o=true,o?Promise.resolve().then(()=>this._updateModelValue(e,n)):this._updateModelValue(e,n);}_isSelected(e){return this._selectionModel&&this._selectionModel.isSelected(e)}_isPrechecked(e){return typeof this._rawValue>"u"?false:this.multiple&&Array.isArray(this._rawValue)?this._rawValue.some(t=>e.value!=null&&t===e.value):e.value===this._rawValue}_initializeTabIndex(){if(this._buttonToggles.forEach(e=>{e.tabIndex=-1;}),this.selected)this.selected.tabIndex=0;else for(let e=0;e<this._buttonToggles.length;e++){let t=this._buttonToggles.get(e);if(!t.disabled){t.tabIndex=0;break}}}_getNextButton(e,t){let n=this._buttonToggles;for(let o=1;o<=n.length;o++){let u=(e+t*o+n.length)%n.length,I=n.get(u);if(I&&!I.disabled)return I}return null}_setSelectionByValue(e){if(this._rawValue=e,!this._buttonToggles)return;let t=this._buttonToggles.toArray();if(this.multiple&&e?(this._clearSelection(),e.forEach(n=>this._selectValue(n,t))):(this._clearSelection(),this._selectValue(e,t)),!this.multiple&&t.every(n=>n.tabIndex===-1)){for(let n of t)if(!n.disabled){n.tabIndex=0;break}}}_clearSelection(){this._selectionModel.clear(),this._buttonToggles.forEach(e=>{e.checked=false,this.multiple||(e.tabIndex=-1);});}_selectValue(e,t){for(let n of t)if(n.value===e){n.checked=true,this._selectionModel.select(n),this.multiple||(n.tabIndex=0);break}}_updateModelValue(e,t){t&&this._emitChangeEvent(e),this.valueChange.emit(this.value);}_markButtonsForCheck(){this._buttonToggles?.forEach(e=>e._markForCheck());}static \u0275fac=function(t){return new(t||l)};static \u0275dir=Ls({type:l,selectors:[["mat-button-toggle-group"]],contentQueries:function(t,n,o){if(t&1&&kg(o,X,5),t&2){let u;wC(u=CC())&&(n._buttonToggles=u);}},hostAttrs:[1,"mat-button-toggle-group"],hostVars:6,hostBindings:function(t,n){t&1&&Ag("keydown",function(u){return n._keydown(u)}),t&2&&(Cg("role",n.multiple?"group":"radiogroup")("aria-disabled",n.disabled),Hg("mat-button-toggle-vertical",n.vertical)("mat-button-toggle-group-appearance-standard",n.appearance==="standard"));},inputs:{appearance:"appearance",name:"name",vertical:[2,"vertical","vertical",QT],value:"value",multiple:[2,"multiple","multiple",QT],disabled:[2,"disabled","disabled",QT],disabledInteractive:[2,"disabledInteractive","disabledInteractive",QT],hideSingleSelectionIndicator:[2,"hideSingleSelectionIndicator","hideSingleSelectionIndicator",QT],hideMultipleSelectionIndicator:[2,"hideMultipleSelectionIndicator","hideMultipleSelectionIndicator",QT]},outputs:{valueChange:"valueChange",change:"change"},exportAs:["matButtonToggleGroup"],features:[rT([Dt,{provide:vt,useExisting:l}])]})}return l})(),X=(()=>{class l{_changeDetectorRef=g(Tl);_elementRef=g(Kt$1);_focusMonitor=g(St);_idGenerator=g(Ut$1);_animationDisabled=K$1();_checked=false;ariaLabel;ariaLabelledby=null;_buttonElement;buttonToggleGroup;get buttonId(){return `${this.id}-button`}id;name;value;get tabIndex(){return this._tabIndex()}set tabIndex(e){this._tabIndex.set(e);}_tabIndex;disableRipple=false;get appearance(){return this.buttonToggleGroup?this.buttonToggleGroup.appearance:this._appearance}set appearance(e){this._appearance=e;}_appearance;get checked(){return this.buttonToggleGroup?this.buttonToggleGroup._isSelected(this):this._checked}set checked(e){e!==this._checked&&(this._checked=e,this.buttonToggleGroup&&this.buttonToggleGroup._syncButtonToggle(this,this._checked),this._changeDetectorRef.markForCheck());}get disabled(){return this._disabled||this.buttonToggleGroup&&this.buttonToggleGroup.disabled}set disabled(e){this._disabled=e;}_disabled=false;get disabledInteractive(){return this._disabledInteractive||this.buttonToggleGroup!==null&&this.buttonToggleGroup.disabledInteractive}set disabledInteractive(e){this._disabledInteractive=e;}_disabledInteractive;change=new yt$2;constructor(){g(D$1).load(on);let e=g(vt,{optional:true}),t=g(new am("tabindex"),{optional:true})||"",n=g(yt,{optional:true});this._tabIndex=zi(parseInt(t)||0),this.buttonToggleGroup=e,this._appearance=n&&n.appearance?n.appearance:"standard",this._disabledInteractive=n?.disabledInteractive??false;}ngOnInit(){let e=this.buttonToggleGroup;this.id=this.id||this._idGenerator.getId("mat-button-toggle-"),e&&(e._isPrechecked(this)?this.checked=true:e._isSelected(this)!==this._checked&&e._syncButtonToggle(this,this._checked));}ngAfterViewInit(){this._animationDisabled||this._elementRef.nativeElement.classList.add("mat-button-toggle-animations-enabled"),this._focusMonitor.monitor(this._elementRef,true);}ngOnDestroy(){let e=this.buttonToggleGroup;this._focusMonitor.stopMonitoring(this._elementRef),e&&e._isSelected(this)&&e._syncButtonToggle(this,false,false,true);}focus(e){this._buttonElement.nativeElement.focus(e);}_onButtonClick(){if(this.disabled)return;let e=this.isSingleSelector()?true:!this._checked;if(e!==this._checked&&(this._checked=e,this.buttonToggleGroup&&(this.buttonToggleGroup._syncButtonToggle(this,this._checked,true),this.buttonToggleGroup._onTouched())),this.isSingleSelector()){let t=this.buttonToggleGroup._buttonToggles.find(n=>n.tabIndex===0);t&&(t.tabIndex=-1),this.tabIndex=0;}this.change.emit(new K(this,this.value));}_markForCheck(){this._changeDetectorRef.markForCheck();}_getButtonName(){return this.isSingleSelector()?this.buttonToggleGroup.name:this.name||null}isSingleSelector(){return this.buttonToggleGroup&&!this.buttonToggleGroup.multiple}static \u0275fac=function(t){return new(t||l)};static \u0275cmp=Rw({type:l,selectors:[["mat-button-toggle"]],viewQuery:function(t,n){if(t&1&&Fg(Pt,5),t&2){let o;wC(o=CC())&&(n._buttonElement=o.first);}},hostAttrs:["role","presentation",1,"mat-button-toggle"],hostVars:14,hostBindings:function(t,n){t&1&&Ag("focus",function(){return n.focus()}),t&2&&(Cg("aria-label",null)("aria-labelledby",null)("id",n.id)("name",null),Hg("mat-button-toggle-standalone",!n.buttonToggleGroup)("mat-button-toggle-checked",n.checked)("mat-button-toggle-disabled",n.disabled)("mat-button-toggle-disabled-interactive",n.disabledInteractive)("mat-button-toggle-appearance-standard",n.appearance==="standard"));},inputs:{ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],id:"id",name:"name",value:"value",tabIndex:"tabIndex",disableRipple:[2,"disableRipple","disableRipple",QT],appearance:"appearance",checked:[2,"checked","checked",QT],disabled:[2,"disabled","disabled",QT],disabledInteractive:[2,"disabledInteractive","disabledInteractive",QT]},outputs:{change:"change"},exportAs:["matButtonToggle"],ngContentSelectors:Ot,decls:7,vars:13,consts:[["button",""],["type","button",1,"mat-button-toggle-button","mat-focus-indicator",3,"click","id","disabled"],[1,"mat-button-toggle-checkbox-wrapper"],[1,"mat-button-toggle-label-content"],[1,"mat-button-toggle-focus-overlay"],["matRipple","",1,"mat-button-toggle-ripple",3,"matRippleTrigger","matRippleDisabled"],["state","checked","aria-hidden","true","appearance","minimal",3,"disabled"]],template:function(t,n){if(t&1&&(DC(),Is(0,"button",1,0),Ag("click",function(){return n._onButtonClick()}),tC(2,Ft,2,1,"div",2),Is(3,"span",3),EC(4),pl()(),bg(5,"span",4)(6,"span",5)),t&2){let o=bC(1);Tg("id",n.buttonId)("disabled",n.disabled&&!n.disabledInteractive||null),Cg("role",n.isSingleSelector()?"radio":"button")("tabindex",n.disabled&&!n.disabledInteractive?-1:n.tabIndex)("aria-pressed",n.isSingleSelector()?null:n.checked)("aria-checked",n.isSingleSelector()?n.checked:null)("name",n._getButtonName())("aria-label",n.ariaLabel)("aria-labelledby",n.ariaLabelledby)("aria-disabled",n.disabled&&n.disabledInteractive?"true":null),JE(2),nC(n.buttonToggleGroup&&(!n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideSingleSelectionIndicator||n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideMultipleSelectionIndicator)?2:-1),JE(4),Tg("matRippleTrigger",o)("matRippleDisabled",n.disableRipple||n.disabled);}},dependencies:[Oi,An],styles:[`.mat-button-toggle-standalone,
|
|
2
2
|
.mat-button-toggle-group {
|
|
3
3
|
position: relative;
|
|
4
4
|
display: inline-flex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,G,P,h as Rw,i as hr,j as pr,I as Is,A as Ag,q as qC,m as pl,t as tC,J as JE,T as Tg,v as nC,a5 as vl,al as yt$1,am as Gm,a9 as fC,ai as Jg,aa as If,aj as XC,ab as wf,a3 as UI,ak as Xg,a6 as zI,D as Fg,E as wC,K as CC,ac as yC,a8 as Zg}from'./main-
|
|
1
|
+
import {g,G,P,h as Rw,i as hr,j as pr,I as Is,A as Ag,q as qC,m as pl,t as tC,J as JE,T as Tg,v as nC,a5 as vl,al as yt$1,am as Gm,a9 as fC,ai as Jg,aa as If,aj as XC,ab as wf,a3 as UI,ak as Xg,a6 as zI,D as Fg,E as wC,K as CC,ac as yC,a8 as Zg}from'./main-6K2UFGD2.js';import {y as yt,w as wt,t as ti,Y as Ye,Z as Zn,c as cn}from'./chunk-C9tuHQmZ.js';var J=["inputElement"];function K(o,r){if(o&1&&(Is(0,"span",3),qC(1),pl()),o&2){let t=yC();JE(),Zg(t.label);}}function U(o,r){if(o&1&&(Is(0,"small",5),qC(1),pl()),o&2){let t=yC();JE(),Zg(t.hint);}}var h=class o{label="";placeholder="";hint="";isDisabled=false;value="";autoFocus=true;valueChange=new yt$1;enterPressed=new yt$1;inputElement;inputValue="";ngAfterViewInit(){this.inputValue=this.value,this.autoFocus&&setTimeout(()=>this.inputElement?.nativeElement.focus(),100);}onValueChange(r){this.valueChange.emit(r);}onEnter(){this.inputValue.trim()&&this.enterPressed.emit(this.inputValue.trim());}focus(){this.inputElement?.nativeElement.focus();}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=Rw({type:o,selectors:[["app-text-input"]],viewQuery:function(t,e){if(t&1&&Fg(J,5),t&2){let p;wC(p=CC())&&(e.inputElement=p.first);}},inputs:{label:"label",placeholder:"placeholder",hint:"hint",isDisabled:"isDisabled",value:"value",autoFocus:"autoFocus"},outputs:{valueChange:"valueChange",enterPressed:"enterPressed"},decls:6,vars:5,consts:[["inputElement",""],[1,"text-input-container"],[1,"text-input-wrapper"],[1,"text-input-label"],["type","text",1,"text-input-field",3,"ngModelChange","keydown.enter","ngModel","placeholder","disabled"],[1,"text-input-hint"]],template:function(t,e){if(t&1){let p=fC();Is(0,"div",1)(1,"label",2),tC(2,K,2,1,"span",3),Is(3,"input",4,0),Jg("ngModelChange",function(m){return If(p),XC(e.inputValue,m)||(e.inputValue=m),wf(m)}),Ag("ngModelChange",function(m){return e.onValueChange(m)})("keydown.enter",function(){return e.onEnter()}),pl(),UI(),pl(),tC(5,U,2,1,"small",5),pl();}t&2&&(JE(2),nC(e.label?2:-1),JE(),Xg("ngModel",e.inputValue),Tg("placeholder",e.placeholder)("disabled",e.isDisabled),zI(),JE(2),nC(e.hint?5:-1));},dependencies:[ti,Ye,Zn,cn,Gm],styles:[".text-input-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem;width:100%}.text-input-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem;width:100%;cursor:text}.text-input-label[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text);margin:0}.text-input-field[_ngcontent-%COMP%]{width:100%;padding:.75rem 1rem;font-size:1rem;color:var(--color-text);background:var(--color-bg);border:1px solid var(--color-border);border-radius:8px;outline:none;transition:all .2s ease}.text-input-field[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary);opacity:.7}.text-input-field[_ngcontent-%COMP%]:focus{border-color:var(--color-primary);box-shadow:0 0 0 3px rgba(var(--color-primary-rgb),.1)}.text-input-field[_ngcontent-%COMP%]:disabled{opacity:.6;cursor:not-allowed;background:var(--color-surface)}.text-input-hint[_ngcontent-%COMP%]{font-size:.85rem;color:var(--color-text-secondary);margin:0;font-style:italic}@media(max-width:768px){.text-input-field[_ngcontent-%COMP%]{padding:.65rem .85rem;font-size:.95rem}.text-input-label[_ngcontent-%COMP%]{font-size:.9rem}.text-input-hint[_ngcontent-%COMP%]{font-size:.8rem}}"],changeDetection:1})};function X(o,r){if(o&1&&(Is(0,"div",8),qC(1),pl()),o&2){let t=yC();JE(),Zg(t.errorMessage);}}var L=class o{router=g(G);projectStateService=g(P);projectName="";projectPath="";isCreating=false;errorMessage=null;isValid(){return this.projectName.trim()!==""&&this.projectPath.trim()!==""}onCreate(){if(!this.isValid()){this.errorMessage="Both name and path are required";return}this.isCreating=true,this.errorMessage=null,this.projectStateService.createProject(this.projectName.trim(),this.projectPath.trim()).subscribe({next:()=>{let r=this.projectName.trim();this.isCreating=false,this.projectStateService.selectProject(r),this.router.navigate(["project",r]);},error:r=>{this.errorMessage=r.error?.error??"Failed to create project",this.isCreating=false;}});}onCancel(){this.router.navigate(["/"]);}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=Rw({type:o,selectors:[["app-project-new"]],decls:19,vars:9,consts:[[1,"project-new-page"],[1,"project-new-card"],["mat-button","",1,"project-new__back",3,"click"],[1,"project-new__title"],[1,"project-new__subtitle"],[1,"project-new__form"],["label","Project name","placeholder","my-project",3,"valueChange","value","isDisabled","autoFocus"],["label","Project path","placeholder","/path/to/project","hint","Absolute path to the project directory",3,"valueChange","enterPressed","value","isDisabled"],[1,"project-new__error"],[1,"project-new__actions"],["mat-button","",3,"click","disabled"],["mat-flat-button","","color","primary",3,"click","disabled"]],template:function(t,e){t&1&&(Is(0,"div",0)(1,"div",1)(2,"button",2),Ag("click",function(){return e.onCancel()}),Is(3,"mat-icon"),qC(4,"arrow_back"),pl(),qC(5," Back to projects "),pl(),Is(6,"h1",3),qC(7,"New project"),pl(),Is(8,"p",4),qC(9,"Point Coday to an existing directory on your machine."),pl(),Is(10,"div",5)(11,"app-text-input",6),Ag("valueChange",function(d){return e.projectName=d}),pl(),Is(12,"app-text-input",7),Ag("valueChange",function(d){return e.projectPath=d})("enterPressed",function(){return e.onCreate()}),pl(),tC(13,X,2,1,"div",8),pl(),Is(14,"div",9)(15,"button",10),Ag("click",function(){return e.onCancel()}),qC(16,"Cancel"),pl(),Is(17,"button",11),Ag("click",function(){return e.onCreate()}),qC(18),pl()()()()),t&2&&(JE(11),Tg("value",e.projectName)("isDisabled",e.isCreating)("autoFocus",true),JE(),Tg("value",e.projectPath)("isDisabled",e.isCreating),JE(),nC(e.errorMessage?13:-1),JE(2),Tg("disabled",e.isCreating),JE(2),Tg("disabled",!e.isValid()||e.isCreating),JE(),vl(" ",e.isCreating?"Creating\u2026":"Create project"," "));},dependencies:[hr,pr,yt,wt,h],styles:[".project-new-page[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:center;min-height:100vh;width:100%;background:var(--color-bg);padding:2rem 1.5rem;box-sizing:border-box}.project-new-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem;width:100%;max-width:560px;padding:2rem;background:var(--color-bg-secondary, rgba(255, 255, 255, .7));border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:16px;box-shadow:var(--glass-shadow, 0 8px 32px rgba(31, 38, 135, .15));margin-top:2rem}.project-new__back[_ngcontent-%COMP%]{align-self:flex-start;margin-left:-.5rem;color:var(--color-text-secondary, #6e6e73)}.project-new__title[_ngcontent-%COMP%]{margin:0;font-size:1.625rem;font-weight:700;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.project-new__subtitle[_ngcontent-%COMP%]{margin:-.75rem 0 0;font-size:.9375rem;color:var(--color-text-secondary, #6e6e73)}.project-new__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.project-new__error[_ngcontent-%COMP%]{padding:.75rem 1rem;background:#dc262614;border:1px solid rgba(220,38,38,.25);border-radius:8px;color:var(--color-error, #ff3b30);font-size:.875rem}.project-new__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;justify-content:flex-end;padding-top:.25rem}"],changeDetection:1})};export{L as ProjectNewComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {f}from'./chunk-DKfZ0J0-.js';import {g,bm as Sm,R as Re,z as zi,y as yT,h as Rw,i as hr,k as Gn,I as Is,A as Ag,q as qC,m as pl,t as tC,af as Dg,ag as pT,r as bC,J as JE,T as Tg,v as nC,M as dy,P,aF as A,Y as x,Z as z,_ as Ue,$ as zt,a0 as jt,a1 as Vt,a2 as Nt,j as pr,bn as Xt,ai as Jg,aj as XC,a3 as UI,o as iC,bo as rC,a8 as Zg,ak as Xg,a6 as zI,x as sC,a5 as vl,ac as yC,a9 as fC,aa as If,ab as wf,bp as ml,bq as yl,ah as oT,b4 as iT,H as Hg,b0 as Yg,a4 as oC,C as Cg,n as bg}from'./main-4SCUMPDY.js';import {P as Pt}from'./chunk-Duz7aHYs.js';import {T as Tn,S as Sn,n as nt$1,a as ae,l as le,c as ce}from'./chunk-Bz081WAa.js';import {W as Wn,o as ot$1,i as it$1,I as In,D as De,B as Be,y as ya,E as En}from'./chunk-BESIk8ll.js';import'./chunk-BSY9MBD-.js';import {y as yt,w as wt,t as ti,Q as Qn,e as ei,Y as Ye$1,f as fn,m as mn,Z as Zn,g as gt,$ as $t,W as Wt,c as cn}from'./chunk-LgALnta4.js';var w=class s{http=g(dy);projectState=g(P);getBaseUrl(){return `/api/projects/${this.projectState.getSelectedProjectIdOrThrow()}/agents`}listEditableAgents(){return this.http.get(`${this.getBaseUrl()}/editable`)}getAgent(t){return this.http.get(`${this.getBaseUrl()}/${encodeURIComponent(t)}`)}createAgent(t,e){return this.http.post(this.getBaseUrl(),{location:e,definition:t})}updateAgent(t,e){return this.http.put(`${this.getBaseUrl()}/${encodeURIComponent(t)}`,{definition:e})}listDocuments(t){return this.http.get(`${this.getBaseUrl()}/documents`,{params:{location:t}})}uploadDocument(t,e){return new A(n=>{let a=new FileReader;a.onload=()=>{let r=a.result.split(",")[1];this.http.post(`${this.getBaseUrl()}/documents`,{filename:e.name,content:r,mimeType:e.type},{params:{location:t}}).subscribe(n);},a.onerror=()=>n.error(a.error),a.readAsDataURL(e);})}deleteAgent(t){return this.http.delete(`${this.getBaseUrl()}/${encodeURIComponent(t)}`)}static \u0275fac=function(e){return new(e||s)};static \u0275prov=x({token:s,factory:s.\u0275fac,providedIn:"root"})};function ze(s,t){s&1&&(Is(0,"p",15),qC(1,"No integrations defined \u2014 agent will have access to all tools."),pl());}function qe(s,t){if(s&1){let e=fC();Is(0,"div",16)(1,"mat-form-field",22)(2,"mat-label"),qC(3,"Integration"),pl(),Is(4,"input",23),Jg("ngModelChange",function(a){let r=If(e).$implicit;return XC(r.integration,a)||(r.integration=a),wf(a)}),pl(),UI(),pl(),Is(5,"mat-form-field",24)(6,"mat-label"),qC(7,"Tools (comma-separated)"),pl(),Is(8,"input",25),Jg("ngModelChange",function(a){let r=If(e).$implicit;return XC(r.tools,a)||(r.tools=a),wf(a)}),pl(),UI(),pl(),Is(9,"button",26),Ag("click",function(){let a=If(e).$index,r=yC();return wf(r.removeIntegrationRow(a))}),Is(10,"mat-icon"),qC(11,"delete"),pl()()();}if(s&2){let e=t.$implicit;JE(4),Xg("ngModel",e.integration),zI(),JE(4),Xg("ngModel",e.tools),zI();}}function He(s,t){if(s&1&&(Is(0,"p",30),qC(1),pl()),s&2){let e=yC(2);JE(),Zg(e.docUploadError);}}function Ge(s,t){s&1&&(Is(0,"p",15),qC(1,"No mandatory documents defined."),pl());}function Ze(s,t){if(s&1&&bg(0,"option",35),s&2){let e=t.$implicit;Tg("value","documents/"+e);}}function Ke(s,t){if(s&1){let e=fC();Is(0,"div",31)(1,"mat-form-field",32)(2,"mat-label"),qC(3,"Document path"),pl(),Is(4,"input",33),Jg("ngModelChange",function(a){let r=If(e).$index,j=yC(2);return XC(j.mandatoryDocs[r],a)||(j.mandatoryDocs[r]=a),wf(a)}),pl(),UI(),Is(5,"datalist",34),iC(6,Ze,1,1,"option",35,oC),pl()(),Is(8,"button",26),Ag("click",function(){let a=If(e).$index,r=yC(2);return wf(r.removeDocRow(a))}),Is(9,"mat-icon"),qC(10,"delete"),pl()()();}if(s&2){let e=t.$index,n=yC(2);JE(4),Xg("ngModel",n.mandatoryDocs[e]),Cg("list","docs-list-"+e),zI(),JE(),Tg("id","docs-list-"+e),JE(),sC(n.availableDocuments);}}function Je(s,t){if(s&1){let e=fC();Is(0,"div",6)(1,"span"),qC(2,"Mandatory Documents"),pl(),Is(3,"button",27),Ag("click",function(){If(e);let a=yC();return wf(a.addDocRow())}),Is(4,"mat-icon"),qC(5,"add"),pl()(),Is(6,"label",28)(7,"mat-icon"),qC(8,"upload_file"),pl(),Is(9,"input",29),Ag("change",function(a){If(e);let r=yC();return wf(r.onDocFileSelected(a))}),pl()()(),tC(10,He,2,1,"p",30),tC(11,Ge,2,0,"p",15),iC(12,Ke,11,3,"div",31,rC);}if(s&2){let e=yC();JE(6),Hg("uploading",e.isUploadingDoc),JE(3),Tg("disabled",e.isUploadingDoc),JE(),nC(e.docUploadError?10:-1),JE(),nC(e.mandatoryDocs.length===0?11:-1),JE(),sC(e.mandatoryDocs);}}function Qe(s,t){s&1&&(Is(0,"p",15),qC(1,"\u{1F4A1} Documents can be added after the agent is created."),pl());}function Xe(s,t){if(s&1){let e=fC();Is(0,"div",6),qC(1,"Save to"),pl(),Is(2,"div",36)(3,"label",37)(4,"input",38),Jg("ngModelChange",function(a){If(e);let r=yC();return XC(r.location,a)||(r.location=a),wf(a)}),pl(),UI(),Is(5,"div",39)(6,"div",40)(7,"span",41),qC(8,"\u{1F464}"),pl(),Is(9,"span",42),qC(10,"Project config"),pl()(),Is(11,"p",43),qC(12),pl()()(),Is(13,"label",37)(14,"input",44),Jg("ngModelChange",function(a){If(e);let r=yC();return XC(r.location,a)||(r.location=a),wf(a)}),pl(),UI(),Is(15,"div",39)(16,"div",40)(17,"span",41),qC(18,"\u{1F4E6}"),pl(),Is(19,"span",42),qC(20,"Colocated"),pl()(),Is(21,"p",43),qC(22,"Next to coday.yaml in ./agents/ (committable)"),pl()()()(),Is(23,"p",15),qC(24,"Storage location is permanent and cannot be changed after creation."),pl();}if(s&2){let e=yC();JE(3),Hg("selected",e.location==="project"),JE(),Xg("ngModel",e.location),zI(),JE(8),Yg("~/.coday/projects/","{","name","}","/agents/ (not committed)"),JE(),Hg("selected",e.location==="colocated"),JE(),Xg("ngModel",e.location),zI();}}function Ye(s,t){if(s&1&&(Is(0,"div",17)(1,"span",6),qC(2,"Storage Location"),pl(),Is(3,"span",45),qC(4),pl(),Is(5,"p",15),qC(6,"Cannot be changed after creation."),pl()()),s&2){let e=yC();JE(3),Hg("badge-project",e.location==="project")("badge-colocated",e.location==="colocated"),JE(),vl(" ",e.location==="project"?"\u{1F464} Project config":"\u{1F4E6} Colocated"," ");}}function $e(s,t){if(s&1&&(Is(0,"div",18)(1,"mat-icon"),qC(2,"error"),pl(),Is(3,"span"),qC(4),pl()()),s&2){let e=yC();JE(4),Zg(e.errorMessage);}}var E=class s{agentCrudApi=g(w);agentApi=g(f);dialogRef=g(z);data=g(Ue);name="";description="";instructions="";aiProvider="";modelName="";temperature=null;maxOutputTokens=null;openaiAssistantId="";integrationRows=[];mandatoryDocs=[];availableDocuments=[];isUploadingDoc=false;docUploadError="";location="project";isSaving=false;errorMessage="";isEditMode=false;ngOnInit(){if(this.isEditMode=this.data.mode==="edit",this.isEditMode&&this.data.agent){let t=this.data.agent.definition;this.name=t.name,this.description=t.description,this.instructions=t.instructions??"",this.aiProvider=t.aiProvider??"",this.modelName=t.modelName??"",this.temperature=t.temperature??null,this.maxOutputTokens=t.maxOutputTokens??null,this.openaiAssistantId=t.openaiAssistantId??"",this.location=this.data.agent.source,t.integrations&&(this.integrationRows=Object.entries(t.integrations).map(([e,n])=>({integration:e,tools:n?.join(", ")??""}))),this.mandatoryDocs=[...t.mandatoryDocs??[]],this.loadAvailableDocuments();}}loadAvailableDocuments(){this.agentCrudApi.listDocuments(this.location).subscribe({next:t=>this.availableDocuments=t,error:()=>this.availableDocuments=[]});}addDocRow(){this.mandatoryDocs.push("");}removeDocRow(t){this.mandatoryDocs.splice(t,1);}onDocFileSelected(t){let e=t.target,n=e.files?.[0];n&&(this.isUploadingDoc=true,this.docUploadError="",this.agentCrudApi.uploadDocument(this.location,n).subscribe({next:a=>{this.isUploadingDoc=false,this.mandatoryDocs.push(a.relativePath),this.loadAvailableDocuments(),e.value="";},error:a=>{this.isUploadingDoc=false,this.docUploadError=a?.error?.error??a?.message??"Upload failed",e.value="";}}));}addIntegrationRow(){this.integrationRows.push({integration:"",tools:""});}removeIntegrationRow(t){this.integrationRows.splice(t,1);}trackByIndex(t){return t}validateForm(){if(!this.name.trim())return this.errorMessage="Name is required",false;if(!/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(this.name.trim()))return this.errorMessage="Name must start with alphanumeric and contain only letters, digits, hyphens or underscores",false;if(!this.description.trim())return this.errorMessage="Description is required",false;for(let t of this.integrationRows)if(!t.integration.trim())return this.errorMessage="Integration name cannot be empty",false;return true}buildDefinition(){let t=this.mandatoryDocs.map(n=>n.trim()).filter(Boolean),e=this.integrationRows.length>0?Object.fromEntries(this.integrationRows.filter(n=>n.integration.trim()).map(n=>[n.integration.trim(),n.tools.split(",").map(a=>a.trim()).filter(Boolean)])):void 0;return {name:this.name.trim(),description:this.description.trim(),instructions:this.instructions.trim()||void 0,aiProvider:this.aiProvider.trim()||void 0,modelName:this.modelName.trim()||void 0,temperature:this.temperature??void 0,maxOutputTokens:this.maxOutputTokens??void 0,openaiAssistantId:this.openaiAssistantId.trim()||void 0,integrations:e,mandatoryDocs:t.length>0?t:void 0}}save(){if(this.errorMessage="",!this.validateForm())return;let t=this.buildDefinition();this.isSaving=true,(this.isEditMode?this.agentCrudApi.updateAgent(this.name.trim(),t):this.agentCrudApi.createAgent(t,this.location)).subscribe({next:()=>{this.isSaving=false,this.agentApi.clearAllCache(),this.dialogRef.close(true);},error:n=>{this.isSaving=false,this.errorMessage=n?.error?.error||n?.message||"Failed to save agent";}});}cancel(){this.dialogRef.close(false);}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=Rw({type:s,selectors:[["app-agent-form"]],decls:69,vars:18,consts:[["mat-dialog-title",""],[1,"form-container"],["appearance","outline",1,"full-width"],["matInput","","placeholder","my-agent","required","",3,"ngModelChange","ngModel","readonly"],["matInput","","placeholder","What does this agent do?","rows","2","required","",3,"ngModelChange","ngModel"],["matInput","","placeholder","System instructions for the agent...","rows","6",3,"ngModelChange","ngModel"],[1,"section-title"],[1,"row-2col"],["appearance","outline"],["matInput","","placeholder","e.g. anthropic, openai",3,"ngModelChange","ngModel"],["matInput","","placeholder","e.g. claude-sonnet-4-5",3,"ngModelChange","ngModel"],["matInput","","type","number","min","0","max","2","step","0.1","placeholder","0.0 \u2013 2.0",3,"ngModelChange","ngModel"],["matInput","","type","number","min","1","placeholder","e.g. 4096",3,"ngModelChange","ngModel"],["matInput","","placeholder","asst_...",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Add integration",3,"click"],[1,"hint"],[1,"integration-row"],[1,"source-display"],[1,"error-message"],["align","end"],["mat-button","",3,"click","disabled"],["mat-raised-button","","color","primary",3,"click","disabled"],["appearance","outline",1,"integration-name"],["matInput","","placeholder","e.g. GITHUB",3,"ngModelChange","ngModel"],["appearance","outline",1,"integration-tools"],["matInput","","placeholder","Leave empty for all tools",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Remove",3,"click"],["mat-icon-button","","type","button","title","Add document path",3,"click"],["title","Upload a document to the pool",1,"upload-btn"],["type","file","hidden","",3,"change","disabled"],[1,"doc-upload-error"],[1,"doc-row"],["appearance","outline",1,"doc-field"],["matInput","","placeholder","documents/guide.md",3,"ngModelChange","ngModel"],[3,"id"],[3,"value"],[1,"source-options"],[1,"source-option"],["type","radio","name","location","value","project",3,"ngModelChange","ngModel"],[1,"source-content"],[1,"source-header"],[1,"source-icon"],[1,"source-label"],[1,"source-description"],["type","radio","name","location","value","colocated",3,"ngModelChange","ngModel"],[1,"source-badge"]],template:function(e,n){e&1&&(Is(0,"h2",0),qC(1),pl(),Is(2,"mat-dialog-content")(3,"div",1)(4,"mat-form-field",2)(5,"mat-label"),qC(6,"Name"),pl(),Is(7,"input",3),Jg("ngModelChange",function(r){return XC(n.name,r)||(n.name=r),r}),pl(),UI(),Is(8,"mat-hint"),qC(9,"Alphanumeric, hyphens and underscores only. Cannot be changed after creation."),pl()(),Is(10,"mat-form-field",2)(11,"mat-label"),qC(12,"Description"),pl(),Is(13,"textarea",4),Jg("ngModelChange",function(r){return XC(n.description,r)||(n.description=r),r}),pl(),UI(),pl(),Is(14,"mat-form-field",2)(15,"mat-label"),qC(16,"Instructions"),pl(),Is(17,"textarea",5),Jg("ngModelChange",function(r){return XC(n.instructions,r)||(n.instructions=r),r}),pl(),UI(),Is(18,"mat-hint"),qC(19,"System prompt / instructions sent to the AI model"),pl()(),Is(20,"div",6),qC(21,"AI Configuration"),pl(),Is(22,"div",7)(23,"mat-form-field",8)(24,"mat-label"),qC(25,"AI Provider"),pl(),Is(26,"input",9),Jg("ngModelChange",function(r){return XC(n.aiProvider,r)||(n.aiProvider=r),r}),pl(),UI(),pl(),Is(27,"mat-form-field",8)(28,"mat-label"),qC(29,"Model Name"),pl(),Is(30,"input",10),Jg("ngModelChange",function(r){return XC(n.modelName,r)||(n.modelName=r),r}),pl(),UI(),pl()(),Is(31,"div",7)(32,"mat-form-field",8)(33,"mat-label"),qC(34,"Temperature"),pl(),Is(35,"input",11),Jg("ngModelChange",function(r){return XC(n.temperature,r)||(n.temperature=r),r}),pl(),UI(),Is(36,"mat-hint"),qC(37,"Leave empty for model default"),pl()(),Is(38,"mat-form-field",8)(39,"mat-label"),qC(40,"Max Output Tokens"),pl(),Is(41,"input",12),Jg("ngModelChange",function(r){return XC(n.maxOutputTokens,r)||(n.maxOutputTokens=r),r}),pl(),UI(),Is(42,"mat-hint"),qC(43,"Leave empty for model default"),pl()()(),Is(44,"mat-form-field",2)(45,"mat-label"),qC(46,"OpenAI Assistant ID"),pl(),Is(47,"input",13),Jg("ngModelChange",function(r){return XC(n.openaiAssistantId,r)||(n.openaiAssistantId=r),r}),pl(),UI(),Is(48,"mat-hint"),qC(49,"If set, forces aiProvider to openai"),pl()(),Is(50,"div",6)(51,"span"),qC(52,"Integrations"),pl(),Is(53,"button",14),Ag("click",function(){return n.addIntegrationRow()}),Is(54,"mat-icon"),qC(55,"add"),pl()()(),tC(56,ze,2,0,"p",15),iC(57,qe,12,2,"div",16,rC),tC(59,Je,14,5)(60,Qe,2,0,"p",15),tC(61,Xe,25,8),tC(62,Ye,7,5,"div",17),tC(63,$e,5,1,"div",18),pl()(),Is(64,"mat-dialog-actions",19)(65,"button",20),Ag("click",function(){return n.cancel()}),qC(66,"Cancel"),pl(),Is(67,"button",21),Ag("click",function(){return n.save()}),qC(68),pl()()),e&2&&(JE(),Zg(n.isEditMode?"Edit Agent":"Create Agent"),JE(6),Xg("ngModel",n.name),Tg("readonly",n.isEditMode),zI(),JE(6),Xg("ngModel",n.description),zI(),JE(4),Xg("ngModel",n.instructions),zI(),JE(9),Xg("ngModel",n.aiProvider),zI(),JE(4),Xg("ngModel",n.modelName),zI(),JE(5),Xg("ngModel",n.temperature),zI(),JE(6),Xg("ngModel",n.maxOutputTokens),zI(),JE(6),Xg("ngModel",n.openaiAssistantId),zI(),JE(9),nC(n.integrationRows.length===0?56:-1),JE(),sC(n.integrationRows),JE(2),nC(n.isEditMode?59:60),JE(2),nC(n.isEditMode?-1:61),JE(),nC(n.isEditMode?62:-1),JE(),nC(n.errorMessage?63:-1),JE(2),Tg("disabled",n.isSaving),JE(2),Tg("disabled",n.isSaving),JE(),vl(" ",n.isSaving?"Saving...":"Save"," "));},dependencies:[ti,Qn,ei,Ye$1,fn,mn,Zn,gt,$t,Wt,cn,zt,jt,Vt,Nt,hr,pr,Gn,Tn,Sn,nt$1,ae,le,ce,yt,wt,Pt,Xt],styles:[".form-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;padding:0;min-width:560px}@media(max-width:768px){.form-container[_ngcontent-%COMP%]{min-width:auto}}.full-width[_ngcontent-%COMP%]{width:100%}.section-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;font-size:1rem;font-weight:600;margin-top:.5rem;margin-bottom:-.25rem}.row-2col[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}@media(max-width:768px){.row-2col[_ngcontent-%COMP%]{grid-template-columns:1fr}}.integration-row[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.integration-row[_ngcontent-%COMP%] .integration-name[_ngcontent-%COMP%]{flex:0 0 180px}.integration-row[_ngcontent-%COMP%] .integration-tools[_ngcontent-%COMP%]{flex:1}.hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}.source-options[_ngcontent-%COMP%]{display:flex;gap:1rem;margin-bottom:.5rem}@media(max-width:768px){.source-options[_ngcontent-%COMP%]{flex-direction:column}}.source-option[_ngcontent-%COMP%]{flex:1;display:flex;align-items:flex-start;gap:.75rem;padding:1rem;background:var(--color-bg);border:2px solid var(--color-border);border-radius:8px;cursor:pointer;transition:all .2s ease}.source-option[_ngcontent-%COMP%]:hover{border-color:var(--color-primary);background:var(--color-bg-hover)}.source-option.selected[_ngcontent-%COMP%]{border-color:var(--color-primary);background:var(--color-bg-hover);box-shadow:0 0 0 1px var(--color-primary)}.source-option[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{margin-top:2px;cursor:pointer}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%]{flex:1}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:.5rem}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-icon[_ngcontent-%COMP%]{font-size:1.25rem}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-label[_ngcontent-%COMP%]{font-weight:600;font-size:.95rem}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-description[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-family:monospace;line-height:1.4}.source-display[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.source-badge[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;padding:.5rem 1rem;border-radius:6px;font-size:.9rem;font-weight:500}.source-badge.badge-project[_ngcontent-%COMP%]{background:#2196f31a;color:#2196f3;border:1px solid rgba(33,150,243,.3)}.source-badge.badge-colocated[_ngcontent-%COMP%]{background:#4caf501a;color:#4caf50;border:1px solid rgba(76,175,80,.3)}.doc-row[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.doc-row[_ngcontent-%COMP%] .doc-field[_ngcontent-%COMP%]{flex:1}.upload-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:50%;cursor:pointer;color:var(--color-text-secondary);transition:background .2s}.upload-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);color:var(--color-primary)}.upload-btn.uploading[_ngcontent-%COMP%]{opacity:.5;cursor:wait}.upload-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.doc-upload-error[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-error)}.error-message[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem;background:#f443361a;border:1px solid var(--color-error);border-radius:4px;color:var(--color-error)}.error-message[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.error-message[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1}"],changeDetection:1})};var et=()=>[],tt=s=>({id:s});function nt(s,t){if(s&1&&(Is(0,"div",5),qC(1),pl()),s&2){let e=yC();JE(),Zg(e.errorMessage());}}function it(s,t){if(s&1){let e=fC();Is(0,"ds-entity-card",7),Ag("selected",function(a){If(e);let r=yC();return wf(r.onEdit(a))}),ml(1,8),Is(2,"button",9),Ag("click",function(a){return a.stopPropagation()}),Is(3,"mat-icon"),qC(4,"more_vert"),pl()(),yl(),pl();}if(s&2){let e=t.$implicit;yC();let n=bC(9);Tg("id",e.id)("name",e.name)("description",e.description)("badges",e.badges??oT(6,et)),JE(2),Tg("matMenuTriggerFor",n)("matMenuTriggerData",iT(7,tt,e.id));}}function ot(s,t){if(s&1){let e=fC();Is(0,"button",10),Ag("click",function(){let a=If(e).id,r=yC();return wf(r.onEdit(a))}),Is(1,"mat-icon"),qC(2,"edit"),pl(),qC(3," Edit "),pl(),Is(4,"button",11),Ag("click",function(){let a=If(e).id,r=yC();return wf(r.onDelete(a))}),Is(5,"mat-icon"),qC(6,"delete"),pl(),qC(7," Delete "),pl();}}var Ve=class s{agentCrudApi=g(w);location=g(Sm);dialog=g(Re);agents=zi([]);isLoading=zi(false);errorMessage=zi(null);agentItems=yT(()=>this.agents().map(t=>({id:t.name,name:t.name,description:t.description,badges:this.buildBadges(t),groupKey:t.source,groupLabel:t.source==="project"?"Project (~/.coday/)":"Colocated (next to coday.yaml)"})));ngOnInit(){this.loadAgents();}loadAgents(){this.isLoading.set(true),this.errorMessage.set(null),this.agentCrudApi.listEditableAgents().subscribe({next:t=>{this.agents.set(t),this.isLoading.set(false);},error:t=>{this.errorMessage.set(t?.error?.error??"Failed to load agents"),this.isLoading.set(false);}});}onBack(){this.location.back();}onCreate(){this.dialog.open(E,{width:"700px",maxHeight:"90vh",data:{mode:"create"}}).afterClosed().subscribe(e=>{e&&this.loadAgents();});}onEdit(t){this.agentCrudApi.getAgent(t).subscribe({next:e=>{this.dialog.open(E,{width:"700px",maxHeight:"90vh",data:{mode:"edit",agent:e}}).afterClosed().subscribe(a=>{a&&this.loadAgents();});},error:e=>this.errorMessage.set(e?.error?.error??"Failed to load agent")});}onDelete(t){confirm(`Are you sure you want to delete agent "${t}"?`)&&this.agentCrudApi.deleteAgent(t).subscribe({next:()=>this.loadAgents(),error:e=>this.errorMessage.set(e?.error?.error??"Failed to delete agent")});}buildBadges(t){return [t.source==="project"?{label:"project",variant:"info"}:{label:"colocated",variant:"success"}]}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=Rw({type:s,selectors:[["app-agent-list"]],decls:11,vars:5,consts:[["agentCard",""],["cardMenu","matMenu"],[1,"agent-list-page"],["title","Agents","cardMinWidth","260px","contentMaxWidth","1400px","searchPlaceholder","Filter agents\u2026","emptyMessage","No file-based agents found.",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","mat-icon-button","","title","Back",3,"click"],[1,"agent-list__error"],["matMenuContent",""],[3,"selected","id","name","description","badges"],["dsCardActions",""],["mat-icon-button","",3,"click","matMenuTriggerFor","matMenuTriggerData"],["mat-menu-item","",3,"click"],["mat-menu-item","",1,"agent-list__delete-item",3,"click"]],template:function(e,n){if(e&1&&(Is(0,"div",2)(1,"ds-entity-list",3),Ag("createRequested",function(){return n.onCreate()}),Is(2,"button",4),Ag("click",function(){return n.onBack()}),Is(3,"mat-icon"),qC(4,"chevron_left"),pl()()(),tC(5,nt,2,1,"div",5),pl(),Dg(6,it,5,9,"ng-template",null,0,pT),Is(8,"mat-menu",null,1),Dg(10,ot,8,0,"ng-template",6),pl()),e&2){let a=bC(7);JE(),Tg("items",n.agentItems())("loading",n.isLoading())("showCreate",true)("itemTemplate",a),JE(4),nC(n.errorMessage()?5:-1);}},dependencies:[Wn,ot$1,it$1,hr,Gn,yt,wt,In,De,Be,ya,En],styles:["[_nghost-%COMP%]{display:block;width:100%;min-height:100vh;background:var(--color-bg);overflow-y:auto}.agent-list__delete-item[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.agent-list__delete-item[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:inherit}.agent-list__error[_ngcontent-%COMP%]{margin:1rem auto;max-width:900px;padding:.75rem 1rem;background:#dc262614;border:1px solid rgba(220,38,38,.25);border-radius:8px;color:var(--color-error, #ff3b30);font-size:.875rem}"],changeDetection:1})};export{Ve as AgentListComponent};
|
|
1
|
+
import {f}from'./chunk-BKlwFrFB.js';import {g,bm as Sm,R as Re,z as zi,y as yT,h as Rw,i as hr,k as Gn,I as Is,A as Ag,q as qC,m as pl,t as tC,af as Dg,ag as pT,r as bC,J as JE,T as Tg,v as nC,M as dy,P,aF as A,Y as x,Z as z,_ as Ue,$ as zt,a0 as jt,a1 as Vt,a2 as Nt,j as pr,bn as Xt,ai as Jg,aj as XC,a3 as UI,o as iC,bo as rC,a8 as Zg,ak as Xg,a6 as zI,x as sC,a5 as vl,ac as yC,a9 as fC,aa as If,ab as wf,bp as ml,bq as yl,ah as oT,b4 as iT,H as Hg,b0 as Yg,a4 as oC,C as Cg,n as bg}from'./main-6K2UFGD2.js';import {P as Pt}from'./chunk-BLa2Gx7h.js';import {T as Tn,S as Sn,n as nt$1,a as ae,l as le,c as ce}from'./chunk-BUEM7g7F.js';import {W as Wn,o as ot$1,i as it$1,I as In,D as De,B as Be,y as ya,E as En}from'./chunk-l0HLnBLv.js';import'./chunk-DTIhOEG_.js';import {y as yt,w as wt,t as ti,Q as Qn,e as ei,Y as Ye$1,f as fn,m as mn,Z as Zn,g as gt,$ as $t,W as Wt,c as cn}from'./chunk-C9tuHQmZ.js';var w=class s{http=g(dy);projectState=g(P);getBaseUrl(){return `/api/projects/${this.projectState.getSelectedProjectIdOrThrow()}/agents`}listEditableAgents(){return this.http.get(`${this.getBaseUrl()}/editable`)}getAgent(t){return this.http.get(`${this.getBaseUrl()}/${encodeURIComponent(t)}`)}createAgent(t,e){return this.http.post(this.getBaseUrl(),{location:e,definition:t})}updateAgent(t,e){return this.http.put(`${this.getBaseUrl()}/${encodeURIComponent(t)}`,{definition:e})}listDocuments(t){return this.http.get(`${this.getBaseUrl()}/documents`,{params:{location:t}})}uploadDocument(t,e){return new A(n=>{let a=new FileReader;a.onload=()=>{let r=a.result.split(",")[1];this.http.post(`${this.getBaseUrl()}/documents`,{filename:e.name,content:r,mimeType:e.type},{params:{location:t}}).subscribe(n);},a.onerror=()=>n.error(a.error),a.readAsDataURL(e);})}deleteAgent(t){return this.http.delete(`${this.getBaseUrl()}/${encodeURIComponent(t)}`)}static \u0275fac=function(e){return new(e||s)};static \u0275prov=x({token:s,factory:s.\u0275fac,providedIn:"root"})};function ze(s,t){s&1&&(Is(0,"p",15),qC(1,"No integrations defined \u2014 agent will have access to all tools."),pl());}function qe(s,t){if(s&1){let e=fC();Is(0,"div",16)(1,"mat-form-field",22)(2,"mat-label"),qC(3,"Integration"),pl(),Is(4,"input",23),Jg("ngModelChange",function(a){let r=If(e).$implicit;return XC(r.integration,a)||(r.integration=a),wf(a)}),pl(),UI(),pl(),Is(5,"mat-form-field",24)(6,"mat-label"),qC(7,"Tools (comma-separated)"),pl(),Is(8,"input",25),Jg("ngModelChange",function(a){let r=If(e).$implicit;return XC(r.tools,a)||(r.tools=a),wf(a)}),pl(),UI(),pl(),Is(9,"button",26),Ag("click",function(){let a=If(e).$index,r=yC();return wf(r.removeIntegrationRow(a))}),Is(10,"mat-icon"),qC(11,"delete"),pl()()();}if(s&2){let e=t.$implicit;JE(4),Xg("ngModel",e.integration),zI(),JE(4),Xg("ngModel",e.tools),zI();}}function He(s,t){if(s&1&&(Is(0,"p",30),qC(1),pl()),s&2){let e=yC(2);JE(),Zg(e.docUploadError);}}function Ge(s,t){s&1&&(Is(0,"p",15),qC(1,"No mandatory documents defined."),pl());}function Ze(s,t){if(s&1&&bg(0,"option",35),s&2){let e=t.$implicit;Tg("value","documents/"+e);}}function Ke(s,t){if(s&1){let e=fC();Is(0,"div",31)(1,"mat-form-field",32)(2,"mat-label"),qC(3,"Document path"),pl(),Is(4,"input",33),Jg("ngModelChange",function(a){let r=If(e).$index,j=yC(2);return XC(j.mandatoryDocs[r],a)||(j.mandatoryDocs[r]=a),wf(a)}),pl(),UI(),Is(5,"datalist",34),iC(6,Ze,1,1,"option",35,oC),pl()(),Is(8,"button",26),Ag("click",function(){let a=If(e).$index,r=yC(2);return wf(r.removeDocRow(a))}),Is(9,"mat-icon"),qC(10,"delete"),pl()()();}if(s&2){let e=t.$index,n=yC(2);JE(4),Xg("ngModel",n.mandatoryDocs[e]),Cg("list","docs-list-"+e),zI(),JE(),Tg("id","docs-list-"+e),JE(),sC(n.availableDocuments);}}function Je(s,t){if(s&1){let e=fC();Is(0,"div",6)(1,"span"),qC(2,"Mandatory Documents"),pl(),Is(3,"button",27),Ag("click",function(){If(e);let a=yC();return wf(a.addDocRow())}),Is(4,"mat-icon"),qC(5,"add"),pl()(),Is(6,"label",28)(7,"mat-icon"),qC(8,"upload_file"),pl(),Is(9,"input",29),Ag("change",function(a){If(e);let r=yC();return wf(r.onDocFileSelected(a))}),pl()()(),tC(10,He,2,1,"p",30),tC(11,Ge,2,0,"p",15),iC(12,Ke,11,3,"div",31,rC);}if(s&2){let e=yC();JE(6),Hg("uploading",e.isUploadingDoc),JE(3),Tg("disabled",e.isUploadingDoc),JE(),nC(e.docUploadError?10:-1),JE(),nC(e.mandatoryDocs.length===0?11:-1),JE(),sC(e.mandatoryDocs);}}function Qe(s,t){s&1&&(Is(0,"p",15),qC(1,"\u{1F4A1} Documents can be added after the agent is created."),pl());}function Xe(s,t){if(s&1){let e=fC();Is(0,"div",6),qC(1,"Save to"),pl(),Is(2,"div",36)(3,"label",37)(4,"input",38),Jg("ngModelChange",function(a){If(e);let r=yC();return XC(r.location,a)||(r.location=a),wf(a)}),pl(),UI(),Is(5,"div",39)(6,"div",40)(7,"span",41),qC(8,"\u{1F464}"),pl(),Is(9,"span",42),qC(10,"Project config"),pl()(),Is(11,"p",43),qC(12),pl()()(),Is(13,"label",37)(14,"input",44),Jg("ngModelChange",function(a){If(e);let r=yC();return XC(r.location,a)||(r.location=a),wf(a)}),pl(),UI(),Is(15,"div",39)(16,"div",40)(17,"span",41),qC(18,"\u{1F4E6}"),pl(),Is(19,"span",42),qC(20,"Colocated"),pl()(),Is(21,"p",43),qC(22,"Next to coday.yaml in ./agents/ (committable)"),pl()()()(),Is(23,"p",15),qC(24,"Storage location is permanent and cannot be changed after creation."),pl();}if(s&2){let e=yC();JE(3),Hg("selected",e.location==="project"),JE(),Xg("ngModel",e.location),zI(),JE(8),Yg("~/.coday/projects/","{","name","}","/agents/ (not committed)"),JE(),Hg("selected",e.location==="colocated"),JE(),Xg("ngModel",e.location),zI();}}function Ye(s,t){if(s&1&&(Is(0,"div",17)(1,"span",6),qC(2,"Storage Location"),pl(),Is(3,"span",45),qC(4),pl(),Is(5,"p",15),qC(6,"Cannot be changed after creation."),pl()()),s&2){let e=yC();JE(3),Hg("badge-project",e.location==="project")("badge-colocated",e.location==="colocated"),JE(),vl(" ",e.location==="project"?"\u{1F464} Project config":"\u{1F4E6} Colocated"," ");}}function $e(s,t){if(s&1&&(Is(0,"div",18)(1,"mat-icon"),qC(2,"error"),pl(),Is(3,"span"),qC(4),pl()()),s&2){let e=yC();JE(4),Zg(e.errorMessage);}}var E=class s{agentCrudApi=g(w);agentApi=g(f);dialogRef=g(z);data=g(Ue);name="";description="";instructions="";aiProvider="";modelName="";temperature=null;maxOutputTokens=null;openaiAssistantId="";integrationRows=[];mandatoryDocs=[];availableDocuments=[];isUploadingDoc=false;docUploadError="";location="project";isSaving=false;errorMessage="";isEditMode=false;ngOnInit(){if(this.isEditMode=this.data.mode==="edit",this.isEditMode&&this.data.agent){let t=this.data.agent.definition;this.name=t.name,this.description=t.description,this.instructions=t.instructions??"",this.aiProvider=t.aiProvider??"",this.modelName=t.modelName??"",this.temperature=t.temperature??null,this.maxOutputTokens=t.maxOutputTokens??null,this.openaiAssistantId=t.openaiAssistantId??"",this.location=this.data.agent.source,t.integrations&&(this.integrationRows=Object.entries(t.integrations).map(([e,n])=>({integration:e,tools:n?.join(", ")??""}))),this.mandatoryDocs=[...t.mandatoryDocs??[]],this.loadAvailableDocuments();}}loadAvailableDocuments(){this.agentCrudApi.listDocuments(this.location).subscribe({next:t=>this.availableDocuments=t,error:()=>this.availableDocuments=[]});}addDocRow(){this.mandatoryDocs.push("");}removeDocRow(t){this.mandatoryDocs.splice(t,1);}onDocFileSelected(t){let e=t.target,n=e.files?.[0];n&&(this.isUploadingDoc=true,this.docUploadError="",this.agentCrudApi.uploadDocument(this.location,n).subscribe({next:a=>{this.isUploadingDoc=false,this.mandatoryDocs.push(a.relativePath),this.loadAvailableDocuments(),e.value="";},error:a=>{this.isUploadingDoc=false,this.docUploadError=a?.error?.error??a?.message??"Upload failed",e.value="";}}));}addIntegrationRow(){this.integrationRows.push({integration:"",tools:""});}removeIntegrationRow(t){this.integrationRows.splice(t,1);}trackByIndex(t){return t}validateForm(){if(!this.name.trim())return this.errorMessage="Name is required",false;if(!/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(this.name.trim()))return this.errorMessage="Name must start with alphanumeric and contain only letters, digits, hyphens or underscores",false;if(!this.description.trim())return this.errorMessage="Description is required",false;for(let t of this.integrationRows)if(!t.integration.trim())return this.errorMessage="Integration name cannot be empty",false;return true}buildDefinition(){let t=this.mandatoryDocs.map(n=>n.trim()).filter(Boolean),e=this.integrationRows.length>0?Object.fromEntries(this.integrationRows.filter(n=>n.integration.trim()).map(n=>[n.integration.trim(),n.tools.split(",").map(a=>a.trim()).filter(Boolean)])):void 0;return {name:this.name.trim(),description:this.description.trim(),instructions:this.instructions.trim()||void 0,aiProvider:this.aiProvider.trim()||void 0,modelName:this.modelName.trim()||void 0,temperature:this.temperature??void 0,maxOutputTokens:this.maxOutputTokens??void 0,openaiAssistantId:this.openaiAssistantId.trim()||void 0,integrations:e,mandatoryDocs:t.length>0?t:void 0}}save(){if(this.errorMessage="",!this.validateForm())return;let t=this.buildDefinition();this.isSaving=true,(this.isEditMode?this.agentCrudApi.updateAgent(this.name.trim(),t):this.agentCrudApi.createAgent(t,this.location)).subscribe({next:()=>{this.isSaving=false,this.agentApi.clearAllCache(),this.dialogRef.close(true);},error:n=>{this.isSaving=false,this.errorMessage=n?.error?.error||n?.message||"Failed to save agent";}});}cancel(){this.dialogRef.close(false);}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=Rw({type:s,selectors:[["app-agent-form"]],decls:69,vars:18,consts:[["mat-dialog-title",""],[1,"form-container"],["appearance","outline",1,"full-width"],["matInput","","placeholder","my-agent","required","",3,"ngModelChange","ngModel","readonly"],["matInput","","placeholder","What does this agent do?","rows","2","required","",3,"ngModelChange","ngModel"],["matInput","","placeholder","System instructions for the agent...","rows","6",3,"ngModelChange","ngModel"],[1,"section-title"],[1,"row-2col"],["appearance","outline"],["matInput","","placeholder","e.g. anthropic, openai",3,"ngModelChange","ngModel"],["matInput","","placeholder","e.g. claude-sonnet-4-5",3,"ngModelChange","ngModel"],["matInput","","type","number","min","0","max","2","step","0.1","placeholder","0.0 \u2013 2.0",3,"ngModelChange","ngModel"],["matInput","","type","number","min","1","placeholder","e.g. 4096",3,"ngModelChange","ngModel"],["matInput","","placeholder","asst_...",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Add integration",3,"click"],[1,"hint"],[1,"integration-row"],[1,"source-display"],[1,"error-message"],["align","end"],["mat-button","",3,"click","disabled"],["mat-raised-button","","color","primary",3,"click","disabled"],["appearance","outline",1,"integration-name"],["matInput","","placeholder","e.g. GITHUB",3,"ngModelChange","ngModel"],["appearance","outline",1,"integration-tools"],["matInput","","placeholder","Leave empty for all tools",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Remove",3,"click"],["mat-icon-button","","type","button","title","Add document path",3,"click"],["title","Upload a document to the pool",1,"upload-btn"],["type","file","hidden","",3,"change","disabled"],[1,"doc-upload-error"],[1,"doc-row"],["appearance","outline",1,"doc-field"],["matInput","","placeholder","documents/guide.md",3,"ngModelChange","ngModel"],[3,"id"],[3,"value"],[1,"source-options"],[1,"source-option"],["type","radio","name","location","value","project",3,"ngModelChange","ngModel"],[1,"source-content"],[1,"source-header"],[1,"source-icon"],[1,"source-label"],[1,"source-description"],["type","radio","name","location","value","colocated",3,"ngModelChange","ngModel"],[1,"source-badge"]],template:function(e,n){e&1&&(Is(0,"h2",0),qC(1),pl(),Is(2,"mat-dialog-content")(3,"div",1)(4,"mat-form-field",2)(5,"mat-label"),qC(6,"Name"),pl(),Is(7,"input",3),Jg("ngModelChange",function(r){return XC(n.name,r)||(n.name=r),r}),pl(),UI(),Is(8,"mat-hint"),qC(9,"Alphanumeric, hyphens and underscores only. Cannot be changed after creation."),pl()(),Is(10,"mat-form-field",2)(11,"mat-label"),qC(12,"Description"),pl(),Is(13,"textarea",4),Jg("ngModelChange",function(r){return XC(n.description,r)||(n.description=r),r}),pl(),UI(),pl(),Is(14,"mat-form-field",2)(15,"mat-label"),qC(16,"Instructions"),pl(),Is(17,"textarea",5),Jg("ngModelChange",function(r){return XC(n.instructions,r)||(n.instructions=r),r}),pl(),UI(),Is(18,"mat-hint"),qC(19,"System prompt / instructions sent to the AI model"),pl()(),Is(20,"div",6),qC(21,"AI Configuration"),pl(),Is(22,"div",7)(23,"mat-form-field",8)(24,"mat-label"),qC(25,"AI Provider"),pl(),Is(26,"input",9),Jg("ngModelChange",function(r){return XC(n.aiProvider,r)||(n.aiProvider=r),r}),pl(),UI(),pl(),Is(27,"mat-form-field",8)(28,"mat-label"),qC(29,"Model Name"),pl(),Is(30,"input",10),Jg("ngModelChange",function(r){return XC(n.modelName,r)||(n.modelName=r),r}),pl(),UI(),pl()(),Is(31,"div",7)(32,"mat-form-field",8)(33,"mat-label"),qC(34,"Temperature"),pl(),Is(35,"input",11),Jg("ngModelChange",function(r){return XC(n.temperature,r)||(n.temperature=r),r}),pl(),UI(),Is(36,"mat-hint"),qC(37,"Leave empty for model default"),pl()(),Is(38,"mat-form-field",8)(39,"mat-label"),qC(40,"Max Output Tokens"),pl(),Is(41,"input",12),Jg("ngModelChange",function(r){return XC(n.maxOutputTokens,r)||(n.maxOutputTokens=r),r}),pl(),UI(),Is(42,"mat-hint"),qC(43,"Leave empty for model default"),pl()()(),Is(44,"mat-form-field",2)(45,"mat-label"),qC(46,"OpenAI Assistant ID"),pl(),Is(47,"input",13),Jg("ngModelChange",function(r){return XC(n.openaiAssistantId,r)||(n.openaiAssistantId=r),r}),pl(),UI(),Is(48,"mat-hint"),qC(49,"If set, forces aiProvider to openai"),pl()(),Is(50,"div",6)(51,"span"),qC(52,"Integrations"),pl(),Is(53,"button",14),Ag("click",function(){return n.addIntegrationRow()}),Is(54,"mat-icon"),qC(55,"add"),pl()()(),tC(56,ze,2,0,"p",15),iC(57,qe,12,2,"div",16,rC),tC(59,Je,14,5)(60,Qe,2,0,"p",15),tC(61,Xe,25,8),tC(62,Ye,7,5,"div",17),tC(63,$e,5,1,"div",18),pl()(),Is(64,"mat-dialog-actions",19)(65,"button",20),Ag("click",function(){return n.cancel()}),qC(66,"Cancel"),pl(),Is(67,"button",21),Ag("click",function(){return n.save()}),qC(68),pl()()),e&2&&(JE(),Zg(n.isEditMode?"Edit Agent":"Create Agent"),JE(6),Xg("ngModel",n.name),Tg("readonly",n.isEditMode),zI(),JE(6),Xg("ngModel",n.description),zI(),JE(4),Xg("ngModel",n.instructions),zI(),JE(9),Xg("ngModel",n.aiProvider),zI(),JE(4),Xg("ngModel",n.modelName),zI(),JE(5),Xg("ngModel",n.temperature),zI(),JE(6),Xg("ngModel",n.maxOutputTokens),zI(),JE(6),Xg("ngModel",n.openaiAssistantId),zI(),JE(9),nC(n.integrationRows.length===0?56:-1),JE(),sC(n.integrationRows),JE(2),nC(n.isEditMode?59:60),JE(2),nC(n.isEditMode?-1:61),JE(),nC(n.isEditMode?62:-1),JE(),nC(n.errorMessage?63:-1),JE(2),Tg("disabled",n.isSaving),JE(2),Tg("disabled",n.isSaving),JE(),vl(" ",n.isSaving?"Saving...":"Save"," "));},dependencies:[ti,Qn,ei,Ye$1,fn,mn,Zn,gt,$t,Wt,cn,zt,jt,Vt,Nt,hr,pr,Gn,Tn,Sn,nt$1,ae,le,ce,yt,wt,Pt,Xt],styles:[".form-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;padding:0;min-width:560px}@media(max-width:768px){.form-container[_ngcontent-%COMP%]{min-width:auto}}.full-width[_ngcontent-%COMP%]{width:100%}.section-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;font-size:1rem;font-weight:600;margin-top:.5rem;margin-bottom:-.25rem}.row-2col[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}@media(max-width:768px){.row-2col[_ngcontent-%COMP%]{grid-template-columns:1fr}}.integration-row[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.integration-row[_ngcontent-%COMP%] .integration-name[_ngcontent-%COMP%]{flex:0 0 180px}.integration-row[_ngcontent-%COMP%] .integration-tools[_ngcontent-%COMP%]{flex:1}.hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}.source-options[_ngcontent-%COMP%]{display:flex;gap:1rem;margin-bottom:.5rem}@media(max-width:768px){.source-options[_ngcontent-%COMP%]{flex-direction:column}}.source-option[_ngcontent-%COMP%]{flex:1;display:flex;align-items:flex-start;gap:.75rem;padding:1rem;background:var(--color-bg);border:2px solid var(--color-border);border-radius:8px;cursor:pointer;transition:all .2s ease}.source-option[_ngcontent-%COMP%]:hover{border-color:var(--color-primary);background:var(--color-bg-hover)}.source-option.selected[_ngcontent-%COMP%]{border-color:var(--color-primary);background:var(--color-bg-hover);box-shadow:0 0 0 1px var(--color-primary)}.source-option[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{margin-top:2px;cursor:pointer}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%]{flex:1}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:.5rem}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-icon[_ngcontent-%COMP%]{font-size:1.25rem}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-label[_ngcontent-%COMP%]{font-weight:600;font-size:.95rem}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-description[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-family:monospace;line-height:1.4}.source-display[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.source-badge[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;padding:.5rem 1rem;border-radius:6px;font-size:.9rem;font-weight:500}.source-badge.badge-project[_ngcontent-%COMP%]{background:#2196f31a;color:#2196f3;border:1px solid rgba(33,150,243,.3)}.source-badge.badge-colocated[_ngcontent-%COMP%]{background:#4caf501a;color:#4caf50;border:1px solid rgba(76,175,80,.3)}.doc-row[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.doc-row[_ngcontent-%COMP%] .doc-field[_ngcontent-%COMP%]{flex:1}.upload-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:50%;cursor:pointer;color:var(--color-text-secondary);transition:background .2s}.upload-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);color:var(--color-primary)}.upload-btn.uploading[_ngcontent-%COMP%]{opacity:.5;cursor:wait}.upload-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.doc-upload-error[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-error)}.error-message[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem;background:#f443361a;border:1px solid var(--color-error);border-radius:4px;color:var(--color-error)}.error-message[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.error-message[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1}"],changeDetection:1})};var et=()=>[],tt=s=>({id:s});function nt(s,t){if(s&1&&(Is(0,"div",5),qC(1),pl()),s&2){let e=yC();JE(),Zg(e.errorMessage());}}function it(s,t){if(s&1){let e=fC();Is(0,"ds-entity-card",7),Ag("selected",function(a){If(e);let r=yC();return wf(r.onEdit(a))}),ml(1,8),Is(2,"button",9),Ag("click",function(a){return a.stopPropagation()}),Is(3,"mat-icon"),qC(4,"more_vert"),pl()(),yl(),pl();}if(s&2){let e=t.$implicit;yC();let n=bC(9);Tg("id",e.id)("name",e.name)("description",e.description)("badges",e.badges??oT(6,et)),JE(2),Tg("matMenuTriggerFor",n)("matMenuTriggerData",iT(7,tt,e.id));}}function ot(s,t){if(s&1){let e=fC();Is(0,"button",10),Ag("click",function(){let a=If(e).id,r=yC();return wf(r.onEdit(a))}),Is(1,"mat-icon"),qC(2,"edit"),pl(),qC(3," Edit "),pl(),Is(4,"button",11),Ag("click",function(){let a=If(e).id,r=yC();return wf(r.onDelete(a))}),Is(5,"mat-icon"),qC(6,"delete"),pl(),qC(7," Delete "),pl();}}var Ve=class s{agentCrudApi=g(w);location=g(Sm);dialog=g(Re);agents=zi([]);isLoading=zi(false);errorMessage=zi(null);agentItems=yT(()=>this.agents().map(t=>({id:t.name,name:t.name,description:t.description,badges:this.buildBadges(t),groupKey:t.source,groupLabel:t.source==="project"?"Project (~/.coday/)":"Colocated (next to coday.yaml)"})));ngOnInit(){this.loadAgents();}loadAgents(){this.isLoading.set(true),this.errorMessage.set(null),this.agentCrudApi.listEditableAgents().subscribe({next:t=>{this.agents.set(t),this.isLoading.set(false);},error:t=>{this.errorMessage.set(t?.error?.error??"Failed to load agents"),this.isLoading.set(false);}});}onBack(){this.location.back();}onCreate(){this.dialog.open(E,{width:"700px",maxHeight:"90vh",data:{mode:"create"}}).afterClosed().subscribe(e=>{e&&this.loadAgents();});}onEdit(t){this.agentCrudApi.getAgent(t).subscribe({next:e=>{this.dialog.open(E,{width:"700px",maxHeight:"90vh",data:{mode:"edit",agent:e}}).afterClosed().subscribe(a=>{a&&this.loadAgents();});},error:e=>this.errorMessage.set(e?.error?.error??"Failed to load agent")});}onDelete(t){confirm(`Are you sure you want to delete agent "${t}"?`)&&this.agentCrudApi.deleteAgent(t).subscribe({next:()=>this.loadAgents(),error:e=>this.errorMessage.set(e?.error?.error??"Failed to delete agent")});}buildBadges(t){return [t.source==="project"?{label:"project",variant:"info"}:{label:"colocated",variant:"success"}]}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=Rw({type:s,selectors:[["app-agent-list"]],decls:11,vars:5,consts:[["agentCard",""],["cardMenu","matMenu"],[1,"agent-list-page"],["title","Agents","cardMinWidth","260px","contentMaxWidth","1400px","searchPlaceholder","Filter agents\u2026","emptyMessage","No file-based agents found.",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","mat-icon-button","","title","Back",3,"click"],[1,"agent-list__error"],["matMenuContent",""],[3,"selected","id","name","description","badges"],["dsCardActions",""],["mat-icon-button","",3,"click","matMenuTriggerFor","matMenuTriggerData"],["mat-menu-item","",3,"click"],["mat-menu-item","",1,"agent-list__delete-item",3,"click"]],template:function(e,n){if(e&1&&(Is(0,"div",2)(1,"ds-entity-list",3),Ag("createRequested",function(){return n.onCreate()}),Is(2,"button",4),Ag("click",function(){return n.onBack()}),Is(3,"mat-icon"),qC(4,"chevron_left"),pl()()(),tC(5,nt,2,1,"div",5),pl(),Dg(6,it,5,9,"ng-template",null,0,pT),Is(8,"mat-menu",null,1),Dg(10,ot,8,0,"ng-template",6),pl()),e&2){let a=bC(7);JE(),Tg("items",n.agentItems())("loading",n.isLoading())("showCreate",true)("itemTemplate",a),JE(4),nC(n.errorMessage()?5:-1);}},dependencies:[Wn,ot$1,it$1,hr,Gn,yt,wt,In,De,Be,ya,En],styles:["[_nghost-%COMP%]{display:block;width:100%;min-height:100vh;background:var(--color-bg);overflow-y:auto}.agent-list__delete-item[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.agent-list__delete-item[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:inherit}.agent-list__error[_ngcontent-%COMP%]{margin:1rem auto;max-width:900px;padding:.75rem 1rem;background:#dc262614;border:1px solid rgba(220,38,38,.25);border-radius:8px;color:var(--color-error, #ff3b30);font-size:.875rem}"],changeDetection:1})};export{Ve as AgentListComponent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {s as se}from'./chunk-
|
|
1
|
+
import {s as se}from'./chunk-BUEM7g7F.js';import {a as Dr,z as zi,F as Fn,H as Hi,h as ht,b as gr,_ as _r}from'./chunk-l0HLnBLv.js';import {g,M as dy,P,Y as x,aL as Eo,aM as qn,bD as ge,bE as vt,aO as wt,bs as Tl,az as Kt,aW as w,aS as K,bF as X,al as yt,aT as Ut,bG as p,bH as Pt,h as Rw,a_ as QT,bA as DC,bI as Eg,b5 as rT,D as Fg,bJ as dr,E as wC,K as CC,bv as kg,bK as fe,bL as pe,bM as mr,aP as G,bt as Qn,bN as F,aR as ks,an as ce,O as Ot,bO as mt,bP as Yy,ae as Ot$1,X as br,u as ue,bQ as Zy,bR as Sd,bS as va,aF as A,bu as Ve$1,bT as pn,bU as Od,bV as Ky,aA as an,bW as Y,bX as Pt$1,bY as po,bZ as X$1,b_ as xt,aZ as Ls,aC as Tu,A as Ag,C as Cg,aw as hl,bB as EC,ax as gl,ac as yC,b$ as PC,H as Hg,c0 as Ng,c1 as E,c2 as NE,c3 as kt$1,bC as Ti}from'./main-6K2UFGD2.js';import {D}from'./chunk-C9tuHQmZ.js';var xe=class a{http=g(dy);projectState=g(P);getBaseUrl(){return `/api/projects/${this.projectState.getSelectedProjectIdOrThrow()}/schedulers`}listSchedulers(){return this.http.get(this.getBaseUrl())}getScheduler(o){return this.http.get(`${this.getBaseUrl()}/${o}`)}createScheduler(o){return this.http.post(this.getBaseUrl(),o)}listSchedulersForProject(o){return this.http.get(`/api/projects/${o}/schedulers`)}enableSchedulerForProject(o,e){return this.http.post(`/api/projects/${o}/schedulers/${e}/enable`,{})}disableSchedulerForProject(o,e){return this.http.post(`/api/projects/${o}/schedulers/${e}/disable`,{})}runSchedulerNowForProject(o,e){return this.http.post(`/api/projects/${o}/schedulers/${e}/run-now`,{})}deleteSchedulerForProject(o,e){return this.http.delete(`/api/projects/${o}/schedulers/${e}`)}updateSchedulerForProject(o,e,t){return this.http.put(`/api/projects/${o}/schedulers/${e}`,t)}createSchedulerForProject(o,e){return this.http.post(`/api/projects/${o}/schedulers`,e)}updateScheduler(o,e){return this.http.put(`${this.getBaseUrl()}/${o}`,e)}deleteScheduler(o){return this.http.delete(`${this.getBaseUrl()}/${o}`)}enableScheduler(o){return this.http.post(`${this.getBaseUrl()}/${o}/enable`,{})}disableScheduler(o){return this.http.post(`${this.getBaseUrl()}/${o}/disable`,{})}runSchedulerNow(o){return this.http.post(`${this.getBaseUrl()}/${o}/run-now`,{})}static \u0275fac=function(e){return new(e||a)};static \u0275prov=x({token:a,factory:a.\u0275fac,providedIn:"root"})};var Ke=["panel"],Ue=["*"];function qe(a,o){if(a&1&&(hl(0,"div",1,0),EC(2),gl()),a&2){let e=o.id,t=yC();PC(t._classList),Hg("mat-mdc-autocomplete-visible",t.showPanel)("mat-mdc-autocomplete-hidden",!t.showPanel)("mat-autocomplete-panel-animations-enabled",!t._animationsDisabled)("mat-primary",t._color==="primary")("mat-accent",t._color==="accent")("mat-warn",t._color==="warn"),Ng("id",t.id),Cg("aria-label",t.ariaLabel||null)("aria-labelledby",t._getPanelAriaLabelledby(e));}}var R=class{source;option;constructor(o,e){this.source=o,this.option=e;}},Ve=new w("mat-autocomplete-default-options",{providedIn:"root",factory:()=>({autoActiveFirstOption:false,autoSelectActiveOption:false,hideSingleSelectionIndicator:false,requireSelection:false,hasBackdrop:false})}),Ct=(()=>{class a{_changeDetectorRef=g(Tl);_elementRef=g(Kt);_defaults=g(Ve);_animationsDisabled=K();_activeOptionChanges=X.EMPTY;_keyManager;showPanel=false;get isOpen(){return this._isOpen&&this.showPanel}_isOpen=false;_latestOpeningTrigger;_setColor(e){this._color=e,this._changeDetectorRef.markForCheck();}_color;template;panel;options;optionGroups;ariaLabel;ariaLabelledby;displayWith=null;autoActiveFirstOption;autoSelectActiveOption;requireSelection;panelWidth;disableRipple=false;optionSelected=new yt;opened=new yt;closed=new yt;optionActivated=new yt;set classList(e){this._classList=e,this._elementRef.nativeElement.className="";}_classList;get hideSingleSelectionIndicator(){return this._hideSingleSelectionIndicator}set hideSingleSelectionIndicator(e){this._hideSingleSelectionIndicator=e,this._syncParentProperties();}_hideSingleSelectionIndicator;_syncParentProperties(){if(this.options)for(let e of this.options)e._changeDetectorRef.markForCheck();}id=g(Ut).getId("mat-autocomplete-");inertGroups;constructor(){let e=g(p);this.inertGroups=e?.SAFARI||false,this.autoActiveFirstOption=!!this._defaults.autoActiveFirstOption,this.autoSelectActiveOption=!!this._defaults.autoSelectActiveOption,this.requireSelection=!!this._defaults.requireSelection,this._hideSingleSelectionIndicator=this._defaults.hideSingleSelectionIndicator??false;}ngAfterContentInit(){this._keyManager=new Pt(this.options).withWrap().skipPredicate(this._skipPredicate),this._activeOptionChanges=this._keyManager.change.subscribe(e=>{this.isOpen&&this.optionActivated.emit({source:this,option:this.options.toArray()[e]||null});}),this._setVisibility();}ngOnDestroy(){this._keyManager?.destroy(),this._activeOptionChanges.unsubscribe();}_setScrollTop(e){this.panel&&(this.panel.nativeElement.scrollTop=e);}_getScrollTop(){return this.panel?this.panel.nativeElement.scrollTop:0}_setVisibility(){this.showPanel=!!this.options?.length,this._changeDetectorRef.markForCheck();}_emitSelectEvent(e){let t=new R(this,e);this.optionSelected.emit(t);}_getPanelAriaLabelledby(e){if(this.ariaLabel)return null;let t=e?e+" ":"";return this.ariaLabelledby?t+this.ariaLabelledby:e}_skipPredicate(){return false}static \u0275fac=function(t){return new(t||a)};static \u0275cmp=Rw({type:a,selectors:[["mat-autocomplete"]],contentQueries:function(t,i,n){if(t&1&&kg(n,Fn,5)(n,Hi,5),t&2){let s;wC(s=CC())&&(i.options=s),wC(s=CC())&&(i.optionGroups=s);}},viewQuery:function(t,i){if(t&1&&Fg(dr,7)(Ke,5),t&2){let n;wC(n=CC())&&(i.template=n.first),wC(n=CC())&&(i.panel=n.first);}},hostAttrs:[1,"mat-mdc-autocomplete"],inputs:{ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],displayWith:"displayWith",autoActiveFirstOption:[2,"autoActiveFirstOption","autoActiveFirstOption",QT],autoSelectActiveOption:[2,"autoSelectActiveOption","autoSelectActiveOption",QT],requireSelection:[2,"requireSelection","requireSelection",QT],panelWidth:"panelWidth",disableRipple:[2,"disableRipple","disableRipple",QT],classList:[0,"class","classList"],hideSingleSelectionIndicator:[2,"hideSingleSelectionIndicator","hideSingleSelectionIndicator",QT]},outputs:{optionSelected:"optionSelected",opened:"opened",closed:"closed",optionActivated:"optionActivated"},exportAs:["matAutocomplete"],features:[rT([{provide:zi,useExisting:a}])],ngContentSelectors:Ue,decls:1,vars:0,consts:[["panel",""],["role","listbox",1,"mat-mdc-autocomplete-panel","mdc-menu-surface","mdc-menu-surface--open",3,"id"]],template:function(t,i){t&1&&(DC(),Eg(0,qe,3,17,"ng-template"));},styles:[`div.mat-mdc-autocomplete-panel {
|
|
2
2
|
width: 100%;
|
|
3
3
|
max-height: 256px;
|
|
4
4
|
visibility: hidden;
|