@whoz-oss/coday-client 3.17.0 → 3.19.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.
Files changed (97) hide show
  1. package/browser/chunk-2H_m7V_L.js +1 -0
  2. package/browser/{chunk-BXkvjekT.js → chunk-3m_nS8Y5.js} +2 -2
  3. package/browser/chunk-4tOVGgPj.js +1 -0
  4. package/browser/{chunk-BPfJALqU.js → chunk-82BMsVX3.js} +1 -1
  5. package/browser/{chunk-CxUcyBb9.js → chunk-B3NyUUXq.js} +1 -1
  6. package/browser/chunk-B55TXBfo.js +1 -0
  7. package/browser/{chunk-CI760KmO.js → chunk-B9NYLAhC.js} +1 -1
  8. package/browser/chunk-BEaYQhbI.js +508 -0
  9. package/browser/chunk-BI4kHPfc.js +1 -0
  10. package/browser/chunk-BID9NaLj.js +1 -0
  11. package/browser/{chunk-Ci9l-k84.js → chunk-BOpm3F5F.js} +1 -1
  12. package/browser/{chunk-CpZK7G-Q.js → chunk-BWLCegs8.js} +2 -2
  13. package/browser/{chunk-DjoW6kqa.js → chunk-BWZcAdUl.js} +5 -5
  14. package/browser/{chunk-DqC8XT4v.js → chunk-BXsNw_60.js} +1 -1
  15. package/browser/chunk-BZ-rNYX5.js +1 -0
  16. package/browser/{chunk-BHvLB-pV.js → chunk-B_5qWQZJ.js} +1 -1
  17. package/browser/{chunk-DMtXGu5h.js → chunk-BcHHkjC4.js} +1 -1
  18. package/browser/{chunk-CI7wYBKk.js → chunk-BhD8uvAV.js} +1 -1
  19. package/browser/{chunk-DpHEu7EG.js → chunk-Bha8h69K.js} +1 -1
  20. package/browser/chunk-BhdMedPO.js +37 -0
  21. package/browser/chunk-BiwhEkuA.js +1 -0
  22. package/browser/{chunk-ClSDInQq.js → chunk-Bkwb10Tz.js} +1 -1
  23. package/browser/chunk-BlO8XEX7.js +1 -0
  24. package/browser/{chunk-b6g-uBR5.js → chunk-BmiWFhjp.js} +1 -1
  25. package/browser/{chunk-BVAD9f9s.js → chunk-BnDz6aYG.js} +1 -1
  26. package/browser/chunk-BqH7Wffn.js +5 -0
  27. package/browser/{chunk-LVItL87L.js → chunk-BrZnGAfk.js} +1 -1
  28. package/browser/{chunk-D202v_ff.js → chunk-Bu2KbiEO.js} +1 -1
  29. package/browser/{chunk-B6BZBDSv.js → chunk-C3kED08r.js} +5 -5
  30. package/browser/{chunk-Bu5Xq3QT.js → chunk-C4bnTLvT.js} +1 -1
  31. package/browser/{chunk-EBW8PloQ.js → chunk-C5I2MlRU.js} +1 -1
  32. package/browser/{chunk-ClEmA_ih.js → chunk-C9j9HPDY.js} +1 -1
  33. package/browser/{chunk-B626-rya.js → chunk-CEeAV-bb.js} +1 -1
  34. package/browser/{chunk-Brx_KbnM.js → chunk-CNQEET68.js} +1 -1
  35. package/browser/chunk-CNfTQeDy.js +1 -0
  36. package/browser/{chunk-DFQuWS_F.js → chunk-CR2xcumM.js} +1 -1
  37. package/browser/{chunk-BkN5jb4J.js → chunk-CUeRU4T-.js} +1 -1
  38. package/browser/chunk-Cno6SC-J.js +2 -0
  39. package/browser/{chunk-bfpuueWC.js → chunk-CorOD5-V.js} +3 -3
  40. package/browser/{chunk-B1OTuTxt.js → chunk-CvEqqOCm.js} +1 -1
  41. package/browser/{chunk-DQtoh8wv.js → chunk-Cwpn9dPE.js} +1 -1
  42. package/browser/{chunk-B7kKWG4P.js → chunk-Cx3RQESQ.js} +1 -1
  43. package/browser/{chunk-DO3lSvop.js → chunk-CxKynLjd.js} +1 -1
  44. package/browser/chunk-D8Bz7q-C.js +675 -0
  45. package/browser/{chunk-DCwEaE_b.js → chunk-DAyHNJOx.js} +1 -1
  46. package/browser/chunk-DBfSV0o-.js +2 -0
  47. package/browser/chunk-DEAo8Gsm.js +190 -0
  48. package/browser/{chunk-DKllQ3Ve.js → chunk-DHF4GvxN.js} +1 -1
  49. package/browser/chunk-DIhIuMRR.js +9 -0
  50. package/browser/chunk-DK7la0Zv.js +1 -0
  51. package/browser/{chunk-Bgd8Jkga.js → chunk-DKUyWR_o.js} +1 -1
  52. package/browser/chunk-DP1Oiy0T.js +1 -0
  53. package/browser/chunk-DSgmn8Nl.js +276 -0
  54. package/browser/{chunk-CUz5MHdA.js → chunk-DVVwrDwV.js} +1 -1
  55. package/browser/chunk-DWlwteaE.js +55 -0
  56. package/browser/{chunk-DxrynR3o.js → chunk-DXAodgYO.js} +1 -1
  57. package/browser/chunk-Ddy7zzYX.js +1 -0
  58. package/browser/{chunk-C5WD0UQE.js → chunk-DrITgtaw.js} +3 -3
  59. package/browser/{chunk-mrKeqPKc.js → chunk-Drt7fOvo.js} +1 -1
  60. package/browser/chunk-Dw8nvU1v.js +2 -0
  61. package/browser/{chunk-C2VdQfMJ.js → chunk-HERnQhug.js} +1 -1
  62. package/browser/{chunk-CKhGzoqa.js → chunk-RlCcRMQy.js} +1 -1
  63. package/browser/chunk-iwYQP1W9.js +1 -0
  64. package/browser/chunk-kXODoW4J.js +1 -0
  65. package/browser/{chunk-CXTwGKdl.js → chunk-nbZfjdVD.js} +1 -1
  66. package/browser/{chunk-DHb3-uKf.js → chunk-t5r49PeM.js} +1 -1
  67. package/browser/{chunk-B3-4EW3s.js → chunk-vG5Um99w.js} +1 -1
  68. package/browser/{chunk-BtEXE3Xz.js → chunk-vse5stCO.js} +1 -1
  69. package/browser/chunk-wricEDWB.js +1 -0
  70. package/browser/index.html +1 -1
  71. package/browser/main-K6RKSHKK.js +1811 -0
  72. package/package.json +1 -1
  73. package/browser/chunk-0njD_aMa.js +0 -2
  74. package/browser/chunk-6WIaUDav.js +0 -1
  75. package/browser/chunk-B7yga-a4.js +0 -1
  76. package/browser/chunk-BAWubWk8.js +0 -1
  77. package/browser/chunk-BDaTUrH4.js +0 -1
  78. package/browser/chunk-BJ5G7Y-a.js +0 -276
  79. package/browser/chunk-BTX631I3.js +0 -5
  80. package/browser/chunk-BYyTBqh4.js +0 -37
  81. package/browser/chunk-B_49KV6W.js +0 -1
  82. package/browser/chunk-BaO2vi_O.js +0 -675
  83. package/browser/chunk-BcT0wYqu.js +0 -2
  84. package/browser/chunk-BdJzYh5V.js +0 -190
  85. package/browser/chunk-BwDJA6_r.js +0 -55
  86. package/browser/chunk-C49BBPGm.js +0 -1
  87. package/browser/chunk-CNAj5Eon.js +0 -1
  88. package/browser/chunk-D-jBfPIO.js +0 -1
  89. package/browser/chunk-DMRb150M.js +0 -2
  90. package/browser/chunk-DjMtxVWg.js +0 -508
  91. package/browser/chunk-DqioJb1X.js +0 -1
  92. package/browser/chunk-DrzvCb86.js +0 -1
  93. package/browser/chunk-DwFGK2iu.js +0 -1
  94. package/browser/chunk-DxvmpOv5.js +0 -1
  95. package/browser/chunk-P8B5rz7L.js +0 -1
  96. package/browser/chunk-R-GmZrHu.js +0 -9
  97. package/browser/main-LBRSRTYI.js +0 -1811
@@ -1 +1 @@
1
- import {S as St}from'./chunk-BTX631I3.js';import {an as ce,g,L,ao as V,G,N as N$1,ap as Hy,h as Fw,aq as a,ar as S,as as F,at as c,m as ws,o as Rg,q as oC,n as hl,v as bg,t as nI,x as iC,C as Pg,D as bC,H as SC,au as ov,ae as Ot,av as dt,Y as x,aw as gl,Q as QC,ax as ml,a8 as Yg,a9 as gC,aa as wf,ac as EC,ab as Cf,S as Sg}from'./main-LBRSRTYI.js';import {a as at,s as st,r as rt,_ as _i}from'./chunk-B6BZBDSv.js';import'./chunk-BHvLB-pV.js';import {G as Ge}from'./chunk-DjoW6kqa.js';import'./chunk-ClSDInQq.js';import'./chunk-DO3lSvop.js';import'./chunk-CKhGzoqa.js';import'./chunk-CpZK7G-Q.js';import'./chunk-bfpuueWC.js';import'./chunk-BaO2vi_O.js';import'./chunk-DjMtxVWg.js';import'./chunk-BYyTBqh4.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=Fw({type:o,selectors:[["app-welcome-message"]],decls:2,vars:1,consts:[[1,"welcome-title"]],template:function(t,i){t&1&&(gl(0,"h1",0),QC(1),ml()),t&2&&(nI(),Yg(i.currentWelcomeMessage));},styles:[".welcome-title[_ngcontent-%COMP%]{font-size:clamp(1.5rem,4vw,4rem);font-weight:700;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% auto;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:_ngcontent-%COMP%_gradientShift 3s ease-in-out infinite;margin:0;padding:0;line-height:1.2;transition:opacity .5s ease-in-out;display:block;min-height:1.2em;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0% center}50%{background-position:100% center}to{background-position:0% center}}"],changeDetection:1})};var N=class o{destroy$=new 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(Hy(this.destroy$),ov(),Ot(([e,t])=>e===true&&t===false)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Agent stopped thinking, notifying task finished"),this.notifyTaskFinishedIfEnabled();}),this.preferencesService.browserNotificationEnabled$.pipe(Hy(this.destroy$),ov(),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=gC();ws(0,"app-thread",4),Rg("chatFocused",function(){wf(t);let n=EC();return Cf(n.onChatFocusedOnMobile())})("drawerStateChange",function(n){wf(t);let r=EC();return Cf(r.onDrawerStateChange(n))}),hl();}if(o&2){let t=EC();bg("projectName",t.projectName)("threadId",t.threadId);}}function te(o,e){if(o&1){let t=gC();ws(0,"div",5),Sg(1,"app-welcome-message"),hl(),ws(2,"div",6,0)(4,"div",7)(5,"div",8)(6,"app-chat-textarea",9),Rg("messageSubmitted",function(n){wf(t);let r=EC();return Cf(r.onMessageSubmitted(n))})("voiceMessageReady",function(n){wf(t);let r=EC();return Cf(r.onVoiceMessageReady(n))})("voiceRecordingToggled",function(n){wf(t);let r=EC();return Cf(r.onVoiceToggled(n))})("heightChanged",function(n){wf(t);let r=EC();return Cf(r.onInputHeightChanged(n))})("textareaFocused",function(){wf(t);let n=EC();return Cf(n.onChatFocusedOnMobile())}),hl()()()();}if(o&2){let t=EC();nI(6),bg("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(Hy(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=Fw({type:o,selectors:[["app-main"]],viewQuery:function(t,i){if(t&1&&Pg(Z,5)(St,5),t&2){let n;bC(n=SC())&&(i.inputSection=n.first),bC(n=SC())&&(i.sidenav=n.first);}},decls:4,vars:2,consts:[["inputSection",""],[3,"drawerOpen"],[1,"app",3,"mousedown","touchstart"],[3,"projectName","threadId"],[3,"chatFocused","drawerStateChange","projectName","threadId"],[1,"welcome-section"],[1,"input-section"],[1,"input-center"],[1,"input-glass"],[3,"messageSubmitted","voiceMessageReady","voiceRecordingToggled","heightChanged","textareaFocused","isDisabled","isSessionInitializing","showWelcome","isThinking","isStarting"]],template:function(t,i){t&1&&(ws(0,"app-sidenav",1)(1,"div",2),Rg("mousedown",function(){return i.onChatFocusedOnMobile()})("touchstart",function(){return i.onChatFocusedOnMobile()}),oC(2,ee,1,2,"app-thread",3)(3,te,7,5),hl()()),t&2&&(bg("drawerOpen",i.isDrawerOpen),nI(2),iC(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-BqH7Wffn.js';import {an as ue,g,L,ao as V,G,E as N$1,ap as zy,j as jw,aq as a,ar as S,as as F,at as c,k as Cs,n as kg,o as aC,m as hl,_ as _g,t as sI,u as cC,x as jg,y as MC,N as NC,au as cv,ae as kt,av as dt,K as x,aw as gl,J as JC,ax as ml,a8 as Kg,a9 as vC,aa as Cf,ac as CC,ab as Tf,M as Mg}from'./main-K6RKSHKK.js';import {a as at,s as st,r as rt,_ as _i}from'./chunk-C3kED08r.js';import'./chunk-B_5qWQZJ.js';import {G as Ge}from'./chunk-BWZcAdUl.js';import'./chunk-Bkwb10Tz.js';import'./chunk-CxKynLjd.js';import'./chunk-RlCcRMQy.js';import'./chunk-BWLCegs8.js';import'./chunk-CorOD5-V.js';import'./chunk-D8Bz7q-C.js';import'./chunk-BEaYQhbI.js';import'./chunk-BhdMedPO.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=jw({type:o,selectors:[["app-welcome-message"]],decls:2,vars:1,consts:[[1,"welcome-title"]],template:function(t,i){t&1&&(gl(0,"h1",0),JC(1),ml()),t&2&&(sI(),Kg(i.currentWelcomeMessage));},styles:[".welcome-title[_ngcontent-%COMP%]{font-size:clamp(1.5rem,4vw,4rem);font-weight:700;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% auto;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:_ngcontent-%COMP%_gradientShift 3s ease-in-out infinite;margin:0;padding:0;line-height:1.2;transition:opacity .5s ease-in-out;display:block;min-height:1.2em;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0% center}50%{background-position:100% center}to{background-position:0% center}}"],changeDetection:1})};var N=class o{destroy$=new ue;isSetup=false;codayService=g(Ge);preferencesService=g(L);setup(){if(this.isSetup){console.warn("[AGENT-NOTIFICATION] Service already set up");return}console.log("[AGENT-NOTIFICATION] Setting up agent notification service"),this.codayService.isThinking$.pipe(zy(this.destroy$),cv(),kt(([e,t])=>e===true&&t===false)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Agent stopped thinking, notifying task finished"),this.notifyTaskFinishedIfEnabled();}),this.preferencesService.browserNotificationEnabled$.pipe(zy(this.destroy$),cv(),kt(([e,t])=>e===false&&t===true)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Browser notifications enabled, checking permission"),this.handleBrowserNotificationEnabled();}),this.isSetup=true;}notifyTaskFinishedIfEnabled(){this.preferencesService.getAgentNotificationEnabled()&&(this.preferencesService.getNotificationSoundEnabled()&&this.playCompletionSound(),this.preferencesService.getBrowserNotificationEnabled()&&this.sendBrowserNotification());}playCompletionSound(){try{let e=new(window.AudioContext||window.webkitAudioContext),t=e.createOscillator(),i=e.createGain();t.connect(i),i.connect(e.destination),t.frequency.setValueAtTime(700,e.currentTime),i.gain.setValueAtTime(.1,e.currentTime),i.gain.exponentialRampToValueAtTime(.01,e.currentTime+.08),t.start(e.currentTime),t.stop(e.currentTime+.08);let n=e.createOscillator(),r=e.createGain();n.connect(r),r.connect(e.destination);let l=e.currentTime+.11;n.frequency.setValueAtTime(950,l),r.gain.setValueAtTime(.1,l),r.gain.exponentialRampToValueAtTime(.01,l+.09),n.start(l),n.stop(l+.09),console.log("[AGENT-NOTIFICATION] Completion sound played");}catch(e){console.error("[AGENT-NOTIFICATION] Failed to play completion sound:",e);}}handleBrowserNotificationEnabled(){return 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=vC();Cs(0,"app-thread",4),kg("chatFocused",function(){Cf(t);let n=CC();return Tf(n.onChatFocusedOnMobile())})("drawerStateChange",function(n){Cf(t);let r=CC();return Tf(r.onDrawerStateChange(n))}),hl();}if(o&2){let t=CC();_g("projectName",t.projectName)("threadId",t.threadId);}}function te(o,e){if(o&1){let t=vC();Cs(0,"div",5),Mg(1,"app-welcome-message"),hl(),Cs(2,"div",6,0)(4,"div",7)(5,"div",8)(6,"app-chat-textarea",9),kg("messageSubmitted",function(n){Cf(t);let r=CC();return Tf(r.onMessageSubmitted(n))})("voiceMessageReady",function(n){Cf(t);let r=CC();return Tf(r.onVoiceMessageReady(n))})("voiceRecordingToggled",function(n){Cf(t);let r=CC();return Tf(r.onVoiceToggled(n))})("heightChanged",function(n){Cf(t);let r=CC();return Tf(r.onInputHeightChanged(n))})("textareaFocused",function(){Cf(t);let n=CC();return Tf(n.onChatFocusedOnMobile())}),hl()()()();}if(o&2){let t=CC();sI(6),_g("isDisabled",t.isSessionInitializing)("isSessionInitializing",t.isSessionInitializing)("showWelcome",true)("isThinking",false)("isStarting",t.isStartingFirstMessage);}}var K=class o{destroy$=new ue;inputSection;sidenav;projectName="";threadId=null;isSessionInitializing=false;isStartingFirstMessage=false;inputSectionHeight=80;codayService=g(Ge);titleService=g(at);preferencesService=g(L);route=g(V);router=g(G);threadApiService=g(N$1);agentNotificationService=g(N);firstMessageState=g(st);constructor(){console.log("[MAIN-APP] Using new thread-based architecture (no clientId needed)");}ngOnInit(){this.agentNotificationService.setup(),this.setupPrintHandlers(),this.route.params.pipe(zy(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=jw({type:o,selectors:[["app-main"]],viewQuery:function(t,i){if(t&1&&jg(Z,5)(St,5),t&2){let n;MC(n=NC())&&(i.inputSection=n.first),MC(n=NC())&&(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&&(Cs(0,"app-sidenav",1)(1,"div",2),kg("mousedown",function(){return i.onChatFocusedOnMobile()})("touchstart",function(){return i.onChatFocusedOnMobile()}),aC(2,ee,1,2,"app-thread",3)(3,te,7,5),hl()()),t&2&&(_g("drawerOpen",i.isDrawerOpen),sI(2),cC(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 {I}from'./chunk-DqC8XT4v.js';import {m}from'./chunk-R-GmZrHu.js';import {g,ao as V$1,G as G$1,w as we,aJ as Tr,a as Gi,bS as Da,W as Vy,a7 as va,X as br,u as ue,c as U$1,h as Fw,aK as Ob,m as ws,bf as dT,o as Rg,Q as QC,n as hl,af as Eg,M as MC,v as bg,bg as pT,ah as aT,q as oC,ac as EC,x as iC,a9 as gC,aa as wf,ab as Cf,ag as mT}from'./main-LBRSRTYI.js';import {W as Wn}from'./chunk-BaO2vi_O.js';import'./chunk-DjMtxVWg.js';import'./chunk-BYyTBqh4.js';import'./chunk-ClSDInQq.js';var U=()=>[];function V(r,t){if(r&1){let o=gC();ws(0,"agentos-prompt-item",4),Rg("deleteRequested",function(n){wf(o);let F=EC(2);return Cf(F.deletePrompt(n))}),hl();}if(r&2){let o=EC().$implicit,e=EC();bg("prompt",t)("namespaceId",e.namespaceId)("readOnly",e.isPlatformPrompt(o.id));}}function j(r,t){if(r&1&&oC(0,V,1,3,"agentos-prompt-item",3),r&2){let o,e=t.$implicit,n=EC();iC((o=n.resolvePrompt(e.id))?0:-1,o);}}var G="platform",K="namespace",A=class r{route=g(V$1);router=g(G$1);destroyRef=g(we);promptState=g(m);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);isLoading=Gi(true);allPrompts$=this.refresh$.pipe(Da(()=>(this.isLoading.set(true),Vy({platform:this.promptState.listPlatform().pipe(va(()=>br([]))),namespace:this.promptState.listByNamespace(this.namespaceId)}))));promptItems$=this.allPrompts$.pipe(ue(({platform:t,namespace:o})=>[...t.map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:G,groupLabel:"Platform (read-only)"})),...o.map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:K,groupLabel:"Namespace"}))]));namespacePromptsById=new Map;platformPromptsById=new Map;constructor(){this.allPrompts$.pipe(U$1(this.destroyRef)).subscribe({next:({platform:t,namespace:o})=>{this.platformPromptsById=new Map(t.map(e=>[e.id??"",e])),this.namespacePromptsById=new Map(o.map(e=>[e.id??"",e])),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}goBack(){this.router.navigate(["/agentos","namespaces"]);}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"prompts","new"]);}deletePrompt(t){this.promptState.delete(t.id??"").pipe(U$1(this.destroyRef)).subscribe(()=>this.refresh$.next());}resolvePrompt(t){return this.platformPromptsById.get(t)??this.namespacePromptsById.get(t)??null}isPlatformPrompt(t){return this.platformPromptsById.has(t)}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=Fw({type:r,selectors:[["agentos-namespace-prompts"]],decls:6,vars:7,consts:[["promptItemTpl",""],["title","Prompts","emptyMessage","No prompts defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","type","button",1,"namespace-prompts__back",3,"click"],[3,"prompt","namespaceId","readOnly"],[3,"deleteRequested","prompt","namespaceId","readOnly"]],template:function(o,e){if(o&1&&(ws(0,"ds-entity-list",1),dT(1,"async"),Rg("createRequested",function(){return e.openCreateForm()}),ws(2,"button",2),Rg("click",function(){return e.goBack()}),QC(3,"\u2190 Namespaces"),hl()(),Eg(4,j,1,1,"ng-template",null,0,mT)),o&2){let n=MC(5);bg("items",pT(1,4,e.promptItems$)??aT(6,U))("loading",e.isLoading())("showCreate",true)("itemTemplate",n);}},dependencies:[Wn,I,Ob],styles:[".namespace-prompts__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.namespace-prompts__back[_ngcontent-%COMP%]:hover{text-decoration:underline}"]})};export{A as NamespacePromptsComponent};
1
+ import {I}from'./chunk-BXsNw_60.js';import {m}from'./chunk-DIhIuMRR.js';import {g,ao as V$1,G as G$1,C as Ce,aJ as Tr,W as Wi,bS as Da,$ as $y,a7 as va,I as br,r as re,b as U$1,j as jw,aK as Lb,k as Cs,bf as gT,n as kg,J as JC,m as hl,af as wg,A as AC,_ as _g,bg as yT,ah as dT,o as aC,ac as CC,u as cC,a9 as vC,aa as Cf,ab as Tf,ag as ET}from'./main-K6RKSHKK.js';import {W as Wn}from'./chunk-D8Bz7q-C.js';import'./chunk-BEaYQhbI.js';import'./chunk-BhdMedPO.js';import'./chunk-Bkwb10Tz.js';var U=()=>[];function V(r,t){if(r&1){let o=vC();Cs(0,"agentos-prompt-item",4),kg("deleteRequested",function(n){Cf(o);let F=CC(2);return Tf(F.deletePrompt(n))}),hl();}if(r&2){let o=CC().$implicit,e=CC();_g("prompt",t)("namespaceId",e.namespaceId)("readOnly",e.isPlatformPrompt(o.id));}}function j(r,t){if(r&1&&aC(0,V,1,3,"agentos-prompt-item",3),r&2){let o,e=t.$implicit,n=CC();cC((o=n.resolvePrompt(e.id))?0:-1,o);}}var G="platform",K="namespace",A=class r{route=g(V$1);router=g(G$1);destroyRef=g(Ce);promptState=g(m);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);isLoading=Wi(true);allPrompts$=this.refresh$.pipe(Da(()=>(this.isLoading.set(true),$y({platform:this.promptState.listPlatform().pipe(va(()=>br([]))),namespace:this.promptState.listByNamespace(this.namespaceId)}))));promptItems$=this.allPrompts$.pipe(re(({platform:t,namespace:o})=>[...t.map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:G,groupLabel:"Platform (read-only)"})),...o.map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:K,groupLabel:"Namespace"}))]));namespacePromptsById=new Map;platformPromptsById=new Map;constructor(){this.allPrompts$.pipe(U$1(this.destroyRef)).subscribe({next:({platform:t,namespace:o})=>{this.platformPromptsById=new Map(t.map(e=>[e.id??"",e])),this.namespacePromptsById=new Map(o.map(e=>[e.id??"",e])),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}goBack(){this.router.navigate(["/agentos","namespaces"]);}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"prompts","new"]);}deletePrompt(t){this.promptState.delete(t.id??"").pipe(U$1(this.destroyRef)).subscribe(()=>this.refresh$.next());}resolvePrompt(t){return this.platformPromptsById.get(t)??this.namespacePromptsById.get(t)??null}isPlatformPrompt(t){return this.platformPromptsById.has(t)}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=jw({type:r,selectors:[["agentos-namespace-prompts"]],decls:6,vars:7,consts:[["promptItemTpl",""],["title","Prompts","emptyMessage","No prompts defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","type","button",1,"namespace-prompts__back",3,"click"],[3,"prompt","namespaceId","readOnly"],[3,"deleteRequested","prompt","namespaceId","readOnly"]],template:function(o,e){if(o&1&&(Cs(0,"ds-entity-list",1),gT(1,"async"),kg("createRequested",function(){return e.openCreateForm()}),Cs(2,"button",2),kg("click",function(){return e.goBack()}),JC(3,"\u2190 Namespaces"),hl()(),wg(4,j,1,1,"ng-template",null,0,ET)),o&2){let n=AC(5);_g("items",yT(1,4,e.promptItems$)??dT(6,U))("loading",e.isLoading())("showCreate",true)("itemTemplate",n);}},dependencies:[Wn,I,Lb],styles:[".namespace-prompts__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.namespace-prompts__back[_ngcontent-%COMP%]:hover{text-decoration:underline}"]})};export{A as NamespacePromptsComponent};
@@ -1 +1 @@
1
- import {g,bl as Mt,Y as x}from'./main-LBRSRTYI.js';var s=class n{snackBar=g(Mt);success(t,o=2e3){this.snackBar.open(t,"",{duration:o,horizontalPosition:"center",verticalPosition:"bottom",panelClass:["snackbar-success"]});}error(t,o=3e3){this.snackBar.open(t,"",{duration:o,horizontalPosition:"center",verticalPosition:"bottom",panelClass:["snackbar-error"]});}info(t,o=2e3){this.snackBar.open(t,"",{duration:o,horizontalPosition:"center",verticalPosition:"bottom",panelClass:["snackbar-info"]});}static \u0275fac=function(o){return new(o||n)};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};export{s};
1
+ import {g,bl as Mt,K as x}from'./main-K6RKSHKK.js';var s=class n{snackBar=g(Mt);success(t,o=2e3){this.snackBar.open(t,"",{duration:o,horizontalPosition:"center",verticalPosition:"bottom",panelClass:["snackbar-success"]});}error(t,o=3e3){this.snackBar.open(t,"",{duration:o,horizontalPosition:"center",verticalPosition:"bottom",panelClass:["snackbar-error"]});}info(t,o=2e3){this.snackBar.open(t,"",{duration:o,horizontalPosition:"center",verticalPosition:"bottom",panelClass:["snackbar-info"]});}static \u0275fac=function(o){return new(o||n)};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};export{s};