@amd-gaia/agent-ui 0.26.0-rc.22 → 0.26.0-rc.25

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 (37) hide show
  1. package/dist/assets/AdvancedSettings-xVFY__Gl.js +1 -0
  2. package/dist/assets/AutomationsSettings-BEqETvOv.js +1 -0
  3. package/dist/assets/ConnectorsPane-CcYriY5I.js +1 -0
  4. package/dist/assets/DocumentLibrary-C0EjRp6E.js +4 -0
  5. package/dist/assets/DocumentLibrary-DudZtBqr.css +1 -0
  6. package/dist/assets/FileBrowser-C-HZS_qe.js +4 -0
  7. package/dist/assets/FileBrowser-CrRQXiPo.css +1 -0
  8. package/dist/assets/MemoryDashboard-CM1_U9Ry.js +1 -0
  9. package/dist/assets/MemoryDashboard-CTLyYEkX.css +1 -0
  10. package/dist/assets/MessagingSettings-DYFQe9xW.js +1 -0
  11. package/dist/assets/MobileAccessModal-BAmwG6Ry.js +2 -0
  12. package/dist/assets/MobileAccessModal-CX4NZmr4.css +1 -0
  13. package/dist/assets/ScheduleManager-CH98AfOQ.js +1 -0
  14. package/dist/assets/ScheduleManager-RvQYP0Qh.css +1 -0
  15. package/dist/assets/index-BFdahRmj.css +1 -0
  16. package/dist/assets/index-j3ydFOsZ.js +98 -0
  17. package/dist/assets/useT-CJRolOem.js +6 -0
  18. package/dist/assets/{zap-D2GYBx3s.js → zap-V1ZEXr3L.js} +1 -1
  19. package/dist/index.html +17 -3
  20. package/dist/sw.js +1 -1
  21. package/package.json +1 -1
  22. package/services/auto-updater.cjs +46 -3
  23. package/dist/assets/AdvancedSettings-Ch4N6FTr.js +0 -1
  24. package/dist/assets/ConnectorsPane-Z-C071zE.js +0 -1
  25. package/dist/assets/DocumentLibrary-DM09xPsW.css +0 -1
  26. package/dist/assets/DocumentLibrary-zz0oAd8e.js +0 -4
  27. package/dist/assets/FileBrowser-Cna3BsT7.css +0 -1
  28. package/dist/assets/FileBrowser-D_0noUQx.js +0 -4
  29. package/dist/assets/MemoryDashboard-BYQDFko-.css +0 -1
  30. package/dist/assets/MemoryDashboard-CLMG5SE8.js +0 -1
  31. package/dist/assets/MobileAccessModal-B7BZvPDZ.js +0 -2
  32. package/dist/assets/MobileAccessModal-BkVDm3YG.css +0 -1
  33. package/dist/assets/ScheduleManager-CjHJ4NbD.css +0 -1
  34. package/dist/assets/ScheduleManager-DR6HXq-n.js +0 -1
  35. package/dist/assets/index-CgsMlp1n.js +0 -96
  36. package/dist/assets/index-DJzfIjDs.css +0 -1
  37. package/dist/assets/useT-CCQb2E5P.js +0 -6
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./browser-DfYHeeW3.js","./rolldown-runtime-XKyaHtl9.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Cr as t,Jr as n,_r as r,a as i,gr as a,lt as o,oi as s,vr as c}from"./useT-CJRolOem.js";import{Ct as l,Et as u,Ht as d,f,gt as p,o as m,ot as h,qt as g,rn as _}from"./index-j3ydFOsZ.js";var v=e(s(),1),y=null,b=`https://ngrok.com/download`;function x({isOpen:s,onClose:x,onStop:S,error:C,setupCommands:w,onRetry:T}){let[E,D]=(0,v.useState)(null),[O,k]=(0,v.useState)(!1),A=i(),j=Array.isArray(w),M=!!C||j,[N,P]=(0,v.useState)(null),F=(0,v.useRef)(null);t(s,x);let I=(0,v.useRef)(null);h(I,s),f(I,s);let L=(0,v.useCallback)(async()=>{try{let e=await o();return D(e),e}catch(e){return n.system.error(`Failed to fetch tunnel status`,e),null}},[]);(0,v.useEffect)(()=>{if(!s||M)return;L();let e=setInterval(async()=>{let t=await L();t?.active&&t?.url&&clearInterval(e)},2e3);return()=>clearInterval(e)},[s,M,L]),(0,v.useEffect)(()=>{if(!E?.active||!E.url||!E.token||!F.current)return;let t=`${E.url}/?token=${E.token}`;n.system.info(`Generating QR code for: ${t}`),(async()=>{if(P(null),!y)try{let t=await m(()=>import(`./browser-DfYHeeW3.js`).then(t=>e(t.default,1)),__vite__mapDeps([0,1]),import.meta.url);y=t.default||t}catch{n.system.error(`QR code library not available - install with: npm install qrcode`),P(`QR code unavailable on this build. Use the link below instead.`);return}let r=getComputedStyle(document.documentElement),i=r.getPropertyValue(`--text-primary`).trim(),a=r.getPropertyValue(`--bg-primary`).trim();if(!i||!a)n.system.error(`QR code skipped: --text-primary/--bg-primary did not resolve. styles/index.css must be loaded before this modal renders.`),P(`QR code unavailable — the theme did not load. Use the link below instead.`);else try{await y.toCanvas(F.current,t,{width:200,margin:2,color:{dark:i,light:a}})}catch(e){n.system.error(`QR code generation failed`,e),P(`QR code could not be drawn. Use the link below instead.`)}})()},[E?.active,E?.url,E?.token]);let R=(0,v.useRef)(null),z=(0,v.useCallback)(()=>{if(!E?.url||!E?.token)return;let e=`${E.url}/?token=${E.token}`;navigator.clipboard.writeText(e).then(()=>{k(!0),R.current&&clearTimeout(R.current),R.current=setTimeout(()=>k(!1),2e3)})},[E]);if((0,v.useEffect)(()=>()=>{R.current&&clearTimeout(R.current)},[]),!s)return null;let B=E?.active&&E?.url&&E?.token?`${E.url}/?token=${E.token}`:``;return r(`div`,{ref:I,className:`modal-overlay`,onClick:x,role:`dialog`,"aria-modal":`true`,"aria-label":A(`sidebar.mobileAccess`),children:c(`div`,{className:`modal-panel mobile-modal`,onClick:e=>e.stopPropagation(),children:[c(`div`,{className:`modal-header`,children:[c(`h3`,{style:{display:`flex`,alignItems:`center`,gap:`8px`},children:[r(l,{size:18}),A(`sidebar.mobileAccess`)]}),r(`button`,{className:`btn-icon`,onClick:x,"aria-label":A(`mobile.close`),children:r(p,{size:18})})]}),c(`div`,{className:`modal-body mobile-modal-body`,children:[c(`div`,{className:`tunnel-status`,children:[r(`span`,{className:`status-dot ${E?.active?`is-active`:j?`is-setup`:C?`is-error`:`is-starting`}`}),r(`span`,{children:E?.active?`Tunnel active`:j?A(`mobile.ngrokRequired`):C?`Couldn't start mobile access`:`Starting tunnel...`}),!E?.active&&!M&&r(`span`,{className:`tunnel-spinner`})]}),j&&c(`div`,{className:`tunnel-setup`,children:[r(`div`,{className:`tunnel-setup-title`,children:A(`mobile.setupTitle`)}),r(`p`,{children:A(`mobile.setupIntro`)}),c(`a`,{href:b,target:`_blank`,rel:`noopener noreferrer`,className:`tunnel-setup-link`,children:[A(`mobile.downloadPage`),` `,r(d,{size:11})]})]}),C&&!j&&r(`div`,{className:`tunnel-error`,children:C}),!M&&r(`div`,{className:`qr-code-area`,children:E?.active?c(a.Fragment,{children:[r(`canvas`,{ref:F,hidden:!!N}),N&&r(`div`,{className:`qr-placeholder error`,children:N})]}):c(`div`,{className:`qr-placeholder`,children:[r(`div`,{className:`placeholder-spinner`}),r(`span`,{children:`Connecting...`})]})}),E?.active&&B&&c(`div`,{className:`tunnel-url-area`,children:[r(`label`,{children:`Mobile URL`}),c(`div`,{className:`tunnel-url-row`,children:[r(`input`,{type:`text`,readOnly:!0,value:B}),c(`button`,{className:`copy-url-btn ${O?`copied`:``}`,onClick:z,title:`Copy URL`,children:[r(O?_:g,{size:13}),O?`Copied`:`Copy`]})]})]}),E?.active&&E?.publicIp&&E?.url&&!E.url.includes(`ngrok-free.app`)&&c(`div`,{className:`tunnel-password-hint`,children:[r(`label`,{children:`Tunnel password`}),r(`div`,{className:`tunnel-password-value`,children:E.publicIp}),r(`span`,{className:`tunnel-password-note`,children:`Enter this when the tunnel page asks for a password`})]}),!M&&r(`div`,{className:`mobile-instructions`,children:c(`ol`,{children:[r(`li`,{children:N?`Open the mobile URL above on your phone`:`Scan the QR code with your phone's camera`}),E?.url&&!E.url.includes(`ngrok-free.app`)&&r(`li`,{children:`Enter the tunnel password shown above when prompted`}),r(`li`,{children:`Chat with GAIA from your mobile device`}),r(`li`,{children:`Your data stays secure via encrypted tunnel`})]})}),E?.active&&!C&&c(`div`,{className:`mobile-install-hint`,children:[r(`div`,{className:`mobile-install-hint-title`,children:A(`mobileAccess.installTitle`)}),r(`p`,{children:A(`mobileAccess.installSteps`)}),r(`p`,{children:A(`mobileAccess.linkLifetime`)})]}),c(`div`,{className:`mobile-access-actions`,children:[E?.active&&S&&r(`button`,{className:`btn-danger`,onClick:S,title:`Close the tunnel and revoke the mobile URL`,children:`Stop tunnel`}),j&&T&&c(`button`,{className:`btn-primary`,onClick:T,children:[r(u,{size:13}),` `,A(`mobile.retry`)]}),r(`button`,{className:`btn-secondary`,onClick:x,children:A(`mobile.close`)})]})]})]})})}export{x as MobileAccessModal};
@@ -0,0 +1 @@
1
+ .mobile-modal{width:420px}.mobile-modal-body{flex-direction:column;gap:16px;display:flex}.tunnel-status{background:var(--bg-secondary);border:1px solid var(--border);border-radius:var(--radius-sm);align-items:center;gap:10px;padding:12px 16px;font-size:13px;font-weight:500;display:flex}.tunnel-status .status-dot{border-radius:50%;flex-shrink:0;width:8px;height:8px}.tunnel-status .status-dot.is-active{background:var(--accent-green)}.tunnel-status .status-dot.is-starting{background:var(--accent-yellow);animation:pulse-dot var(--duration-pulse) var(--ease-in-out) infinite}.tunnel-status .status-dot.is-error{background:var(--danger)}.tunnel-status .status-dot.is-setup{background:var(--text-muted)}.tunnel-status .tunnel-spinner{border:2px solid var(--border);border-top-color:var(--accent);width:16px;height:16px;animation:spin var(--duration-spin) var(--ease-linear) infinite;border-radius:50%;margin-left:auto}@keyframes pulse-dot{0%,to{opacity:1;transform:scale(1)}50%{opacity:.4;transform:scale(.85)}}.tunnel-error{background:color-mix(in srgb, var(--danger) 8%, transparent);border:1px solid color-mix(in srgb, var(--danger) 25%, transparent);border-radius:var(--radius-sm);color:var(--danger);word-break:break-word;white-space:pre-line;padding:12px 16px;font-size:13px;line-height:1.5}.tunnel-error a{color:var(--danger);text-decoration:underline}.tunnel-setup{background:var(--bg-secondary);border:1px solid var(--border);border-radius:var(--radius-sm);color:var(--text-secondary);flex-direction:column;gap:10px;padding:12px 16px;font-size:13px;line-height:1.5;display:flex}.tunnel-setup p{margin:0}.tunnel-setup-title{color:var(--text-primary);font-weight:600}.tunnel-setup-link{color:var(--accent);font-size:var(--fs-label);align-items:center;gap:4px;display:inline-flex}.qr-code-area{flex-direction:column;align-items:center;gap:12px;display:flex}.qr-code-area canvas{border-radius:var(--radius-md);border:2px solid var(--border);box-shadow:var(--shadow-sm)}.qr-placeholder{background:var(--bg-secondary);border:2px dashed var(--border);border-radius:var(--radius-md);width:200px;height:200px;color:var(--text-muted);flex-direction:column;justify-content:center;align-items:center;gap:12px;font-size:14px;display:flex}.qr-placeholder.error{border-color:color-mix(in srgb, var(--danger) 30%, transparent);color:var(--danger)}.qr-placeholder .placeholder-spinner{border:3px solid var(--border);border-top-color:var(--accent);width:28px;height:28px;animation:spin var(--duration-spin) var(--ease-linear) infinite;border-radius:50%}.tunnel-url-area{flex-direction:column;gap:6px;display:flex}.tunnel-url-area label{font-size:var(--fs-label);color:var(--text-muted);font-weight:600}.tunnel-url-row{align-items:center;gap:8px;display:flex}.tunnel-url-row input{background:var(--bg-secondary);border:1px solid var(--border);border-radius:var(--radius-sm);font-family:var(--font-mono);color:var(--text-primary);outline:none;flex:1;padding:8px 12px;font-size:12px}.tunnel-url-row input:focus{border-color:var(--accent)}button.copy-url-btn{background:var(--bg-secondary);border:1px solid var(--border);border-radius:var(--radius-sm);white-space:nowrap;transition:all var(--duration) var(--ease);align-items:center;gap:6px;padding:8px 14px;font-size:12px;font-weight:500;display:flex}button.copy-url-btn:hover{background:var(--bg-hover);border-color:var(--accent);color:var(--accent)}button.copy-url-btn.copied{color:var(--accent-green);border-color:var(--accent-green)}.tunnel-password-hint{background:color-mix(in srgb, var(--accent-yellow) 6%, transparent);border:1px solid color-mix(in srgb, var(--accent-yellow) 20%, transparent);border-radius:var(--radius-sm);text-align:center;padding:14px 16px}.tunnel-password-hint label{font-size:var(--fs-label);color:var(--accent-yellow);margin-bottom:6px;font-weight:700;display:block}.tunnel-password-value{font-size:22px;font-family:var(--font-mono);color:var(--text-primary);letter-spacing:1px;-webkit-user-select:all;user-select:all;cursor:text;margin-bottom:4px;font-weight:700}.tunnel-password-note{color:var(--text-muted);font-size:11px}.mobile-instructions{background:var(--bg-secondary);border:1px solid var(--border);border-radius:var(--radius-sm);color:var(--text-secondary);padding:14px 16px;font-size:13px;line-height:1.6}.mobile-instructions ol{margin:0;padding-left:20px}.mobile-instructions li{margin-bottom:4px}.mobile-instructions li:last-child{margin-bottom:0}.mobile-install-hint{border:1px solid var(--border);border-radius:var(--radius-sm);color:var(--text-secondary);padding:14px 16px;font-size:13px;line-height:1.6}.mobile-install-hint-title{font-size:var(--fs-label);color:var(--text-primary);margin-bottom:4px;font-weight:700}.mobile-install-hint p{margin:0 0 6px}.mobile-install-hint p:last-child{margin-bottom:0}.mobile-access-actions{justify-content:flex-end;gap:8px;padding-top:4px;display:flex}@media (width<=480px){.mobile-modal{width:100%}.qr-code-area canvas{width:160px!important;height:160px!important}.qr-placeholder{width:160px;height:160px}}
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{At as t,Cr as n,Jr as r,Kr as i,Vr as a,_r as o,a as s,gr as c,i as l,o as u,oi as d,r as f,t as p,vr as m,wr as ee}from"./useT-CJRolOem.js";import{Jt as h,Ot as g,f as te,gt as _,jt as v,kt as y,n as b,ot as x,xt as S}from"./index-j3ydFOsZ.js";import{n as C,t as ne}from"./zap-V1ZEXr3L.js";var w=e(d(),1),T=8e3,E={active:`schedules.status.active`,paused:`schedules.status.paused`,cancelled:`schedules.status.cancelled`};function D(e,t,n,r){if(!e)return t(`schedules.time.never`);let i=new Date(e),a=(n||new Date).getTime()-i.getTime(),o=Math.floor(a/1e3);if(o<0){let e=Math.abs(o);if(e<60)return t(`schedules.time.inSeconds`,{n:e});let n=Math.floor(e/60);if(n<60)return t(`schedules.time.inMinutes`,{n});let r=Math.floor(n/60);return r<24?t(`schedules.time.inHours`,{n:r}):t(`schedules.time.inDays`,{n:Math.floor(r/24)})}if(o<60)return t(`time.justNow`);let s=Math.floor(o/60);if(s<60)return t(`time.minutesAgo`,{n:s});let c=Math.floor(s/60);return c<24?t(`time.hoursAgo`,{n:c}):i.toLocaleDateString(r,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function O(e,t,n=f.bare,r){if(!e)return n(`schedules.time.never`);let i=D(e,n,t,r),a=new Date(e);return a.getTime()<=(t||new Date).getTime()?i:n(`schedules.time.clockIn`,{clock:a.toLocaleString(r,{weekday:`short`,hour:`numeric`,minute:`2-digit`}),relative:i})}function k(e){if(!e)return!1;let t=new Date(e).getTime()-Date.now();return t>0&&t<6e4}function A(e,t,n=0){let r=new Date(2e3,0,1,t,n);return new Intl.DateTimeFormat(p(e),{hour:`numeric`,minute:`2-digit`}).format(r)}function j(e,t){let[n,r]=e.split(`:`).map(Number);return A(t,n,r)}function M(e,t,n){let r=`${e}.${new Intl.PluralRules(n.locale).select(t)}`;return a(r)?r:null}var N=e=>e.length===5&&e.every(e=>e<5),P=e=>e.length===2&&e.includes(5)&&e.includes(6);function F(e,t,n){if(N(e))return n(`schedules.desc.days.weekdays`);if(P(e))return n(`schedules.desc.days.weekends`);if(e.length===7)return n(`schedules.desc.days.every`);let r=M(`schedules.desc.dayList`,e.length,t);return r?n(r,{days:e.map(e=>n(`schedules.dayName.${e}`)).join(n(`schedules.desc.dayJoin`))}):null}function I(e,t,n,r){let{kind:i,count:a,unit:o,days:s,time:c,start_hour:l,end_hour:u}=e,d=e=>c?n(`schedules.desc.at`,{when:e,time:j(c,r)}):e;if(i===`every`||i===`window`){let e=a&&o?M(`schedules.span.${o}`,a,t):null,c=s?F(s,t,n):void 0;if(!e||c===null)return null;let d=n(e,{n:a});if(i===`every`)return c?n(`schedules.desc.everyOn`,{span:d,days:c}):n(`schedules.desc.every`,{span:d});if(l==null||u==null)return null;let f=n(`schedules.hours`,{start:A(r,l),end:A(r,u)});return c?n(`schedules.desc.windowOn`,{span:d,hours:f,days:c}):n(`schedules.desc.window`,{span:d,hours:f})}if(i===`daily`)return c?d(n(`schedules.desc.daily`)):null;if(i!==`days`||!s?.length)return null;if(s.length===7)return d(n(`schedules.desc.daily`));if(N(s))return d(n(`schedules.desc.weekdays`));if(P(s))return d(n(`schedules.desc.weekends`));let f=F(s,t,n);return f&&d(n(`schedules.desc.onDays`,{days:f}))}function re(e,t){return!e||I(e,t,t.bare,t)===null?null:t.compose((n,r)=>I(e,t,n,l(r))??``)}function L(e,t){return e.length===5&&!e.includes(5)&&!e.includes(6)?t(`schedules.days.weekdays`):e.length===2&&e.includes(5)&&e.includes(6)?t(`schedules.days.weekends`):e.length===7?t(`schedules.days.every`):e.map(e=>t(`schedules.day.${e}`)).join(t(`schedules.days.join`))}function ie({schedule:e}){let t=s(),{selectedSchedule:n,selectSchedule:a,updateScheduleStatus:u,runScheduleNow:d,deleteSchedule:f,results:g,resultsLoading:te,loadSchedules:_,loadResults:x}=b(),{setCurrentSession:A,setShowSchedules:j}=ee(),M=n===e.name,N=re(e.description_parts,t),[P,F]=(0,w.useState)(!1),I=(0,w.useRef)(null),L=(0,w.useCallback)(()=>{I.current&&=(clearTimeout(I.current),null)},[]);(0,w.useEffect)(()=>L,[L]);let[ie,R]=(0,w.useState)(()=>new Date),z=(0,w.useRef)(null);(0,w.useEffect)(()=>{let t=e.status===`active`&&k(e.next_run_at);return t&&!z.current?z.current=setInterval(()=>{R(new Date),e.next_run_at&&new Date(e.next_run_at).getTime()<=Date.now()&&_()},1e3):!t&&z.current&&(clearInterval(z.current),z.current=null),()=>{z.current&&=(clearInterval(z.current),null)}},[e.status,e.next_run_at,_]);let B=(0,w.useRef)(e.last_run_at);(0,w.useEffect)(()=>{M&&e.last_run_at!==B.current&&(B.current=e.last_run_at,x(e.name))},[M,e.last_run_at,e.name,x]);let V=e.last_run_at&&Date.now()-new Date(e.last_run_at).getTime()<5e3,H=(0,w.useCallback)(t=>{t.stopPropagation();let n=e.status===`active`?`paused`:`active`;r.ui.info(`Schedule "${e.name}": ${e.status} -> ${n}`),u(e.name,n)},[e.name,e.status,u]),U=(0,w.useCallback)(t=>{t.stopPropagation(),r.ui.info(`Schedule "${e.name}": run now`),d(e.name)},[e.name,d]),W=(0,w.useCallback)(t=>{t.stopPropagation(),L(),P?(r.ui.info(`Deleting schedule "${e.name}"`),f(e.name)):(F(!0),I.current=setTimeout(()=>{I.current=null,F(!1)},T))},[e.name,P,f,L]),G=(0,w.useCallback)(t=>{t.stopPropagation(),e.session_id&&(r.ui.info(`Opening chat session for schedule "${e.name}"`),A(e.session_id),j(!1))},[e.session_id,e.name,A,j]);return m(`div`,{className:`schedule-card ${M?`selected`:``} ${V?`just-ran`:``}`,onClick:()=>a(M?null:e.name),children:[m(`div`,{className:`schedule-card-header`,children:[o(`span`,{className:`schedule-card-name`,dir:`auto`,children:e.name}),o(`span`,{className:`schedule-card-status ${e.status}`,children:t(E[e.status])})]}),o(`div`,{className:`schedule-card-prompt`,dir:`auto`,children:e.prompt}),m(`div`,{className:`schedule-card-meta`,children:[m(`span`,{title:i(N??e.description),children:[o(h,{size:11}),` `,N??o(`bdi`,{children:e.description})]}),o(`span`,{children:t(`schedules.card.runs`,{n:e.run_count})}),e.error_count>0&&o(`span`,{children:t(`schedules.card.errors`,{n:e.error_count})}),o(`span`,{children:t.compose((t,n)=>t(`schedules.card.last`,{when:D(e.last_run_at,t,void 0,p(l(n)))}))}),o(`span`,{children:t.compose((t,n)=>t(`schedules.card.next`,{when:e.status===`paused`?t(`schedules.status.paused`):O(e.next_run_at,ie,t,p(l(n)))}))})]}),e.last_error&&o(`div`,{className:`schedule-card-error`,children:t(`schedules.card.lastFailed`,{error:e.last_error})}),m(`div`,{className:`schedule-card-actions`,children:[e.session_id&&m(`button`,{className:`btn-sm chat`,onClick:G,title:t(`schedules.card.openChatTitle`),children:[o(C,{size:11}),` `,t(`schedules.card.openChat`)]}),m(`button`,{className:`btn-sm`,onClick:U,disabled:e.running,title:t(`schedules.card.runNowTitle`),children:[o(ne,{size:11}),` `,t(e.running?`schedules.card.running`:`schedules.card.runNow`)]}),o(`button`,{className:`btn-sm`,onClick:H,title:t(e.status===`active`?`schedules.card.pause`:`schedules.card.resume`),children:e.status===`active`?m(c.Fragment,{children:[o(v,{size:11}),` `,t(`schedules.card.pause`)]}):m(c.Fragment,{children:[o(y,{size:11}),` `,t(`schedules.card.resume`)]})}),m(`button`,{className:`btn-sm danger`,onClick:W,title:t(`schedules.card.delete`),children:[o(S,{size:11}),` `,t(P?`schedules.card.confirmDelete`:`schedules.card.delete`)]})]}),M&&m(`div`,{className:`schedule-results`,children:[o(`h4`,{children:t(`schedules.history`)}),te?o(`p`,{className:`schedule-results-empty`,children:t(`schedules.historyLoading`)}):g.length===0?o(`p`,{className:`schedule-results-empty`,children:t(`schedules.historyEmpty`)}):o(`div`,{className:`schedule-results-list`,children:g.map(e=>m(`div`,{className:`schedule-result-item`,children:[o(`div`,{className:`schedule-result-time`,children:t.compose((t,n)=>D(e.executed_at,t,void 0,p(l(n))))}),e.error?o(`div`,{className:`schedule-result-content schedule-result-error`,children:o(`bdi`,{children:e.error})}):o(`div`,{className:`schedule-result-content`,children:e.result?o(`bdi`,{children:e.result}):t(`schedules.noOutput`)})]},e.id))})]})]})}function R(){let e=s(),{setShowSchedules:i}=ee(),{schedules:a,loading:d,error:f,actionError:v,loadSchedules:y,createSchedule:S,dismissActionError:C}=b(),ne=(0,w.useCallback)(()=>i(!1),[i]);n(!0,ne);let T=(0,w.useRef)(null);x(T,!0),te(T,!0);let[E]=(0,w.useState)(()=>b.getState().draft),[D,O]=(0,w.useState)(E!==null),[k,M]=(0,w.useState)(E?.when??``),[N,P]=(0,w.useState)(E?.name??``),[F,I]=(0,w.useState)(E?.prompt??``),[R,z]=(0,w.useState)(null),[B,V]=(0,w.useState)(!1),[H,U]=(0,w.useState)(!1),[W,G]=(0,w.useState)(null),[K,q]=(0,w.useState)(!1),J=(0,w.useId)(),ae=`${J}-when`,oe=`${J}-when-error`,Y=`${J}-when-hint`,se=`${J}-name`,ce=`${J}-name-error`,le=`${J}-prompt`,X=!B&&R!==null&&!R.valid,ue=X&&/[A-Za-z]/.test(k);(0,w.useEffect)(()=>{let e=k.trim()||N.trim()||F.trim();b.getState().setDraft(e?{when:k,name:N,prompt:F}:null)},[k,N,F]);let Z=(0,w.useRef)(null);(0,w.useEffect)(()=>{if(!k.trim())z(null);else return Z.current&&clearTimeout(Z.current),Z.current=window.setTimeout(async()=>{V(!0);try{let e=await t(k);z(e)}catch{z(null)}finally{V(!1)}},400),()=>{Z.current&&clearTimeout(Z.current)}},[k]);let Q=(0,w.useRef)(null);(0,w.useEffect)(()=>(r.ui.info(`Schedule Manager opened`),y(),Q.current=window.setInterval(()=>y(),5e3),()=>{Q.current&&clearInterval(Q.current),C()}),[y,C]);let $=k.trim()&&N.trim()&&F.trim()&&(R===null||R.valid),de=(0,w.useCallback)(async()=>{if($){U(!0),G(null),q(!1);try{await S(N.trim(),k.trim(),F.trim()),b.getState().setDraft(null),M(``),P(``),I(``),z(null),O(!1),r.ui.info(`Schedule "${N}" created`)}catch(t){t instanceof u&&t.httpStatus===409?q(!0):G(t instanceof Error?t.message:e(`schedules.createFailed`))}finally{U(!1)}}},[$,N,k,F,S,e]);return o(`div`,{ref:T,className:`modal-overlay`,onClick:()=>i(!1),role:`dialog`,"aria-modal":`true`,"aria-label":e(`schedules.title`),children:m(`div`,{className:`modal-panel schedule-modal`,onClick:e=>e.stopPropagation(),children:[m(`div`,{className:`modal-header`,children:[o(`h3`,{children:e(`schedules.title`)}),o(`button`,{className:`btn-icon`,onClick:()=>i(!1),"aria-label":e(`schedules.close`),children:o(_,{size:18})})]}),m(`div`,{className:`modal-body`,children:[o(`section`,{className:`schedule-section`,children:D?m(`div`,{className:`schedule-create-form`,children:[m(`div`,{className:`schedule-field`,children:[o(`label`,{className:`schedule-field-label`,htmlFor:ae,children:e(`schedules.when`)}),o(`textarea`,{id:ae,className:`schedule-nl-input`,placeholder:e.bare(`schedules.whenPlaceholder`),value:k,onChange:e=>M(e.target.value),"aria-invalid":X,"aria-describedby":X?`${oe} ${Y}`:Y,autoFocus:!0,rows:2}),o(`div`,{id:Y,className:`schedule-field-hint`,children:e(`schedules.whenHint`)})]}),(R||B)&&o(`div`,{className:`schedule-parsed-preview ${R?.valid?`valid`:`invalid`}`,"aria-live":`polite`,children:B?o(`span`,{className:`schedule-parsed-loading`,children:e(`schedules.parsing`)}):R?m(c.Fragment,{children:[R.valid?o(`div`,{className:`schedule-parsed-description`,children:re(R.description_parts,e)??o(`bdi`,{children:R.description})}):m(`div`,{id:oe,children:[o(`div`,{className:`schedule-parsed-description`,children:e(`schedules.notUnderstood`)}),ue&&o(`div`,{className:`schedule-parsed-hint`,children:o(`bdi`,{children:R.description})})]}),R.valid&&R.next_run_at&&o(`div`,{className:`schedule-parsed-next`,children:e.compose((e,t)=>e(`schedules.nextRun`,{when:new Date(R.next_run_at).toLocaleString(p(l(t)))}))}),R.valid&&m(`div`,{className:`schedule-parsed-details`,children:[R.time_of_day&&m(`span`,{className:`schedule-parsed-tag`,children:[o(h,{size:10}),` `,j(R.time_of_day,e)]}),R.start_hour!=null&&R.end_hour!=null&&m(`span`,{className:`schedule-parsed-tag`,children:[o(h,{size:10}),` `,e.compose((e,t)=>e(`schedules.hours`,{start:A(l(t),R.start_hour),end:A(l(t),R.end_hour)}))]}),R.days_of_week&&o(`span`,{className:`schedule-parsed-tag`,children:e.compose(e=>L(R.days_of_week,e))})]})]}):null}),m(`div`,{className:`schedule-field`,children:[o(`label`,{className:`schedule-field-label`,htmlFor:se,children:e(`schedules.name`)}),o(`div`,{className:`schedule-form-row`,children:o(`input`,{id:se,type:`text`,placeholder:e(`schedules.namePlaceholder`),value:N,onChange:e=>{P(e.target.value),q(!1)},className:!N.trim()&&k.trim()?`schedule-field-missing`:``,"aria-invalid":K,"aria-describedby":K?ce:void 0})}),K&&o(`p`,{id:ce,className:`schedule-form-error`,role:`alert`,children:e(`schedules.nameTaken`)})]}),m(`div`,{className:`schedule-field`,children:[o(`label`,{className:`schedule-field-label`,htmlFor:le,children:e(`schedules.prompt`)}),o(`textarea`,{id:le,className:`schedule-prompt-input ${!F.trim()&&k.trim()?`schedule-field-missing`:``}`,placeholder:e(`schedules.promptPlaceholder`),value:F,onChange:e=>I(e.target.value)})]}),W&&o(`p`,{className:`schedule-form-error`,children:o(`bdi`,{children:W})}),m(`div`,{className:`schedule-create-actions`,children:[o(`button`,{className:`btn-secondary`,onClick:()=>{O(!1),G(null),q(!1),z(null),M(``),P(``),I(``)},children:e(`schedules.cancel`)}),o(`button`,{className:`btn-primary`,onClick:de,disabled:!$||H,children:e(H?`schedules.creating`:`schedules.create`)})]})]}):m(`button`,{className:`btn-primary`,onClick:()=>O(!0),children:[o(g,{size:14}),` `,e(`schedules.new`)]})}),m(`section`,{className:`schedule-section`,children:[o(`h4`,{children:e(`schedules.list`)}),v&&m(`div`,{className:`schedule-action-error`,role:`alert`,children:[o(`span`,{children:o(`bdi`,{children:v})}),o(`button`,{className:`btn-icon`,onClick:C,"aria-label":e(`schedules.dismissError`),children:o(_,{size:14})})]}),d?o(`p`,{className:`schedule-empty`,children:e(`schedules.loading`)}):f?o(`p`,{className:`schedule-empty`,children:e(`schedules.loadFailed`)}):a.length===0?o(`p`,{className:`schedule-empty`,children:e(`schedules.empty`)}):o(`div`,{className:`schedule-list`,children:a.map(e=>o(ie,{schedule:e},e.id))})]})]})]})})}export{R as ScheduleManager};
@@ -0,0 +1 @@
1
+ .schedule-modal{flex-direction:column;width:640px;max-height:80vh;display:flex}.schedule-modal .modal-body{flex:1;overflow-y:auto}.schedule-create-form{flex-direction:column;gap:10px;margin-bottom:20px;display:flex}.schedule-field{flex-direction:column;gap:4px;display:flex}.schedule-field-label{font-size:var(--fs-label);color:var(--text-secondary);font-weight:600}.schedule-field-hint{color:var(--text-muted);font-size:11px}.schedule-form-row{gap:8px;display:flex}.schedule-form-row input{border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--bg-input);color:var(--text-primary);font-size:13px;font-family:var(--font-sans);flex:1;padding:8px 12px}.schedule-form-row input:focus{border-color:var(--accent);outline:none}.schedule-form-row input::placeholder{color:var(--text-muted)}.schedule-prompt-input{border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--bg-input);width:100%;color:var(--text-primary);font-size:13px;font-family:var(--font-sans);resize:vertical;min-height:60px;padding:8px 12px}.schedule-prompt-input:focus{border-color:var(--accent);outline:none}.schedule-prompt-input::placeholder{color:var(--text-muted)}.schedule-create-actions{justify-content:flex-end;gap:8px;display:flex}.schedule-form-error{color:var(--accent);margin-top:-4px;font-size:12px}.schedule-action-error{border-inline-start:2px solid var(--danger);background:color-mix(in srgb, var(--danger) 8%, transparent);color:var(--text-primary);overflow-wrap:anywhere;justify-content:space-between;align-items:flex-start;gap:8px;margin-bottom:8px;padding:6px 8px;font-size:12px;display:flex}.schedule-section{margin-bottom:20px}.schedule-section:last-child{margin-bottom:0}.schedule-section h4{font-size:var(--fs-label);color:var(--text-muted);margin-bottom:10px;font-weight:700}.schedule-empty{color:var(--text-muted);text-align:center;padding:24px 12px;font-size:13px}.schedule-list{flex-direction:column;gap:6px;display:flex}.schedule-card{border-radius:var(--radius-sm);background:var(--bg-secondary);border:1px solid var(--border-light);cursor:pointer;transition:background var(--duration-fast) var(--ease);flex-direction:column;padding:10px 12px;display:flex}.schedule-card:hover{background:var(--bg-hover)}.schedule-card.selected{border-color:var(--accent);background:var(--bg-hover)}.schedule-card.just-ran{animation:schedule-flash var(--duration-pulse) var(--ease)}@keyframes schedule-flash{0%{border-color:var(--accent-green)}to{border-color:var(--border-light)}}.schedule-card-header{justify-content:space-between;align-items:center;gap:8px;display:flex}.schedule-card-name{text-overflow:ellipsis;white-space:nowrap;flex:1;font-size:13px;font-weight:600;overflow:hidden}.schedule-card-status{font-size:var(--fs-caption);text-transform:capitalize;border-radius:var(--radius-sm);padding:2px 8px;font-weight:600}.schedule-card-status.active{color:var(--accent-green);background:color-mix(in srgb, var(--accent-green) 10%, transparent)}.schedule-card-status.paused{color:var(--accent-yellow);background:color-mix(in srgb, var(--accent-yellow) 10%, transparent)}.schedule-card-status.cancelled{color:var(--text-muted);background:var(--bg-tertiary)}.schedule-card-meta{color:var(--text-secondary);align-items:center;gap:12px;margin-top:6px;font-size:12px;display:flex}.schedule-card-error{border-inline-start:2px solid var(--danger);background:color-mix(in srgb, var(--danger) 8%, transparent);color:var(--text-primary);white-space:pre-wrap;overflow-wrap:anywhere;margin-top:6px;padding:6px 8px;font-size:12px}.schedule-card-prompt{color:var(--text-secondary);text-overflow:ellipsis;white-space:nowrap;margin-top:4px;font-size:12px;overflow:hidden}.schedule-card-actions{gap:4px;margin-top:8px;display:flex}.schedule-card-actions .btn-sm{border-radius:var(--radius-sm);border:1px solid var(--border);background:var(--bg-tertiary);color:var(--text-primary);cursor:pointer;transition:background var(--duration-fast) var(--ease);align-items:center;gap:4px;padding:3px 10px;font-size:11px;display:inline-flex}.schedule-card-actions .btn-sm:hover{background:var(--bg-active)}.schedule-card-actions .btn-sm.chat{color:var(--accent-blue);border-color:var(--accent-blue)}.schedule-card-actions .btn-sm.chat:hover{background:color-mix(in srgb, var(--accent-blue) 10%, transparent)}.schedule-card-actions .btn-sm.danger{color:var(--accent);border-color:var(--accent)}.schedule-card-actions .btn-sm.danger:hover{background:color-mix(in srgb, var(--danger) 10%, transparent)}.schedule-results{border-top:1px solid var(--border);margin-top:16px;padding-top:14px}.schedule-results h4{font-size:var(--fs-label);color:var(--text-muted);margin-bottom:10px;font-weight:700}.schedule-results-list{flex-direction:column;gap:6px;max-height:200px;display:flex;overflow-y:auto}.schedule-result-item{border-radius:var(--radius-sm);background:var(--bg-tertiary);padding:8px 10px;font-size:12px}.schedule-result-time{color:var(--text-muted);font-family:var(--font-sans);font-size:var(--fs-caption);font-variant-numeric:tabular-nums;margin-bottom:4px}.schedule-result-content{color:var(--text-primary);white-space:pre-wrap;word-break:break-word;max-height:60px;overflow-y:auto}.schedule-result-error{color:var(--accent)}.schedule-results-empty{color:var(--text-muted);text-align:center;padding:12px;font-size:12px}.schedule-nl-input{border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--bg-input);width:100%;color:var(--text-primary);font-size:13px;font-family:var(--font-sans);resize:vertical;min-height:50px;padding:10px 12px}.schedule-nl-input:focus{border-color:var(--accent);outline:none}.schedule-nl-input::placeholder{color:var(--text-muted)}.schedule-parsed-preview{border-radius:var(--radius-sm);border:1px solid var(--border-light);background:var(--bg-tertiary);padding:10px 12px;font-size:12px}.schedule-parsed-preview.valid{border-color:var(--accent-green);background:color-mix(in srgb, var(--accent-green) 5%, transparent)}.schedule-parsed-preview.invalid{border-color:var(--accent);background:color-mix(in srgb, var(--danger) 5%, transparent)}.schedule-parsed-loading{color:var(--text-muted);font-style:italic}.schedule-parsed-description{color:var(--text-primary);margin-bottom:4px;font-weight:600}.schedule-parsed-hint{color:var(--text-secondary);margin-bottom:4px}.schedule-parsed-next{color:var(--text-secondary);margin-bottom:6px;font-size:11px}.schedule-parsed-details{flex-wrap:wrap;gap:8px;display:flex}.schedule-parsed-tag{border-radius:var(--radius-sm);background:var(--bg-secondary);border:1px solid var(--border);color:var(--text-secondary);align-items:center;gap:4px;padding:2px 8px;font-size:11px;display:inline-flex}.schedule-field-missing{box-shadow:0 0 0 1px color-mix(in srgb, var(--accent-yellow) 30%, transparent);border-color:var(--accent-yellow)!important}