@amd-gaia/agent-ui 0.27.0-rc.9 → 0.27.1-rc.1
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/dist/assets/AdvancedSettings-CJxSdclz.js +1 -0
- package/dist/assets/AutomationsSettings-DZP1wPWZ.js +1 -0
- package/dist/assets/ConnectorsPane-BxG6qzLb.css +1 -0
- package/dist/assets/ConnectorsPane-CtN8iyjY.js +1 -0
- package/dist/assets/DocumentLibrary-CC2YsO-O.js +5 -0
- package/dist/assets/{DocumentLibrary-fEMoY7lH.css → DocumentLibrary-g7OCGegP.css} +1 -1
- package/dist/assets/FileBrowser-BhArokri.js +4 -0
- package/dist/assets/FileBrowser-DxS29ShT.css +1 -0
- package/dist/assets/MemoryDashboard-Bfy9g6TS.css +1 -0
- package/dist/assets/MemoryDashboard-gFulbynO.js +1 -0
- package/dist/assets/MessagingSettings-BrLW4gLV.js +1 -0
- package/dist/assets/{MobileAccessModal-BrZMaERi.css → MobileAccessModal-DSFjH6di.css} +1 -1
- package/dist/assets/MobileAccessModal-QheAv8eE.js +2 -0
- package/dist/assets/ScheduleManager-7tRAmOEB.js +1 -0
- package/dist/assets/ScheduleManager-CEBoBLPV.css +1 -0
- package/dist/assets/folderIndexResult-_fe0ncI2.js +1 -0
- package/dist/assets/index-DCyriNCc.css +1 -0
- package/dist/assets/index-DD59wPO3.js +230 -0
- package/dist/assets/useFocusTrap-DEJ5balb.js +6 -0
- package/dist/index.html +3 -3
- package/dist/sw.js +1 -1
- package/main-safety-net.cjs +26 -2
- package/main.cjs +188 -58
- package/package.json +2 -2
- package/services/backend-crash-dialog.cjs +19 -5
- package/services/backend-health-monitor.cjs +86 -0
- package/services/backend-installer.cjs +1 -0
- package/services/backend-supervisor.cjs +35 -9
- package/services/browser-pane/dev-servers.cjs +44 -1
- package/services/browser-pane/listen-addresses.cjs +140 -0
- package/services/context-menu.cjs +79 -0
- package/services/link-policy.cjs +78 -7
- package/services/port-manager.cjs +2 -3
- package/services/process-tree.cjs +84 -14
- package/dist/assets/AdvancedSettings-tGqb_qu0.js +0 -1
- package/dist/assets/AutomationsSettings-Do-1Bwo_.js +0 -1
- package/dist/assets/ConnectorsPane-BGI8nBUb.css +0 -1
- package/dist/assets/ConnectorsPane-BtzewzJi.js +0 -1
- package/dist/assets/DocumentLibrary-BFB-H6Eq.js +0 -5
- package/dist/assets/FileBrowser-1goNp4CP.css +0 -1
- package/dist/assets/FileBrowser-CvRrSoCy.js +0 -4
- package/dist/assets/MemoryDashboard-Bkm_5AXr.js +0 -1
- package/dist/assets/MemoryDashboard-RpfLag-v.css +0 -1
- package/dist/assets/MessagingSettings-CDDnmM0a.js +0 -1
- package/dist/assets/MobileAccessModal-CrjuTauE.js +0 -2
- package/dist/assets/ScheduleManager-BZzEH2-W.css +0 -1
- package/dist/assets/ScheduleManager-CXdPfxqH.js +0 -1
- package/dist/assets/index-Co-umRxB.js +0 -225
- package/dist/assets/index-bP0Mo7oA.css +0 -1
- package/dist/assets/useFocusTrap-DgofE0fA.js +0 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{K as t,Oi as n,a as r,bi as i,c as a,ki as o,l as s,n as c,r as l,s as u,u as d,v as f,x as p}from"./useFocusTrap-DEJ5balb.js";import{$ as ee,$t as m,An as h,B as te,Cn as ne,En as re,G as ie,Gt as ae,H as oe,I as g,In as se,J as ce,Jt as le,K as ue,Kt as de,L as fe,Mn as pe,Nn as me,Pn as he,Q as ge,R as _,Rn as _e,Sn as ve,T as ye,Tn as be,U as v,V as xe,W as Se,Wt as Ce,X as we,Xt as Te,Y as Ee,Yt as y,Z as De,Zt as b,_n as Oe,_t as ke,an as Ae,at as je,cn as Me,ct as Ne,dt as Pe,et as Fe,ft as Ie,gt as Le,ht as Re,it as ze,lt as Be,mt as Ve,nn as He,nt as Ue,ot as We,pt as Ge,q as Ke,rn as qe,rt as Je,st as Ye,t as Xe,tt as Ze,un as Qe,ut as $e,vt as et,xn as tt,z as nt}from"./index-DD59wPO3.js";var rt={name:`git-merge`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]};rt.node;var it=n(rt),at={name:`shield-off`,size:24,node:[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]};at.node;var ot=n(at),st={name:`shield`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]};st.node;var ct=n(st),x={name:`target`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`6`,key:`1vlfrh`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]};x.node;var lt=n(x),ut={name:`trending-up`,size:24,node:[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]};ut.node;var dt=n(ut),S={name:`user`,size:24,node:[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]};S.node;var ft=n(S),C=e(o(),1),pt=200,w=[{title:`mem.about.group.preferences`,categories:[`preference`]},{title:`mem.about.group.about`,categories:[`fact`,`profile`,`skill`]},{title:`mem.about.group.reminders`,categories:[`reminder`]},{title:`mem.about.group.notes`,categories:[`note`]}],mt={user:`mem.source.user`,tool:`mem.source.tool`,llm_extract:`mem.source.llm_extract`,consolidation:`mem.source.consolidation`,inferred:`mem.source.inferred`,discovery:`mem.source.discovery`,error_auto:`mem.source.error_auto`};function ht(e){return mt[e]??`mem.source.other`}function gt(e,n){let r=new Date(e);if(Number.isNaN(r.getTime()))return null;let i=Math.floor((Date.now()-r.getTime())/864e5);return i<=0?t(`mem.day.today`):i===1?t(`mem.day.yesterday`):i<30?t(`mem.day.daysAgo`,{n:i}):r.toLocaleDateString(l(n),{month:`short`,day:`numeric`,year:`numeric`})}function _t(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e),n=t?new Date(+t[1],t[2]-1,+t[3]):new Date(e);return Number.isNaN(n.getTime())?null:n}function vt(e){let t=e?_t(e):null;if(!t)return``;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function yt(e,t=new Date,n=r){let i=_t(e);if(!i)return null;let a=i.getHours()===0&&i.getMinutes()===0&&i.getSeconds()===0,o=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),s=a?i.getTime()<o:i.getTime()<t.getTime(),c=i.toLocaleString(l(n),{weekday:`short`,month:`short`,day:`numeric`,...i.getFullYear()===t.getFullYear()?{}:{year:`numeric`},...a?{}:{hour:`numeric`,minute:`2-digit`}});return{text:n(s?`mem.due.past`:`mem.due.upcoming`,{when:c}),past:s}}function bt({agent:e,supports:n,memoryEnabled:r,reloadKey:o,onChanged:c,onOpenAdvanced:l,showToast:f}){let p=u(),ee=t(e===`gaiacpp`?`setup.agent.gaiacpp`:`setup.agent.gaiapy`),[m,h]=(0,C.useState)(null),[te,ne]=(0,C.useState)(null),[re,ie]=(0,C.useState)(null),[ae,oe]=(0,C.useState)(``),[g,se]=(0,C.useState)(``),[ce,de]=(0,C.useState)([]),[fe,pe]=(0,C.useState)(new Set),[me,he]=(0,C.useState)(``),[_,_e]=(0,C.useState)(`fact`),[ve,ye]=(0,C.useState)(``),[be,v]=(0,C.useState)(null),[xe,Ce]=(0,C.useState)(0),[we,Ee]=(0,C.useState)(!1),y=(0,C.useRef)(0),De=(0,C.useRef)(pt),b=(0,C.useCallback)(async e=>{let t=++y.current,n=e??De.current;try{let e=[],r=new Set,i=0,a=0;for(;;){let o=Math.min(pt,n-e.length),s=await ge({about_user:!0,include_sensitive:!0,sort_by:`updated_at`,order:`desc`,offset:i,limit:o});if(t!==y.current)return;i+=s.items.length;for(let t of s.items)r.has(t.id)||(r.add(t.id),e.push(t));if(a=typeof s.total==`number`?s.total:e.length,s.items.length<o||e.length>=Math.min(n,a))break}De.current=n,h(e),Ce(a),ne(null)}catch(e){if(t!==y.current)return;i.system.warn(`Failed to load what GAIA knows about the user`,e),ne(e instanceof Error?e.message:String(e))}},[]);(0,C.useEffect)(()=>{b()},[b,o]);let ke=(0,C.useCallback)(async()=>{Ee(!0),De.current=Math.max(De.current,m?.length??0)+pt;try{await b()}finally{Ee(!1)}},[b,m]),je=(0,C.useCallback)(async e=>{let t=ae.trim(),r=n.due_dates&&e.category===`reminder`&&!!g&&g!==vt(e.due_at);if(!t||t===e.content&&!r)ie(null);else{v(e.id);try{await Ke(e.id,{...t===e.content?{}:{content:t},...r?{due_at:g}:{}}),ie(null),f(p(`mem.about.updated`),`success`),await b(),c()}catch(e){i.system.error(`Failed to edit memory`,e),f(p(`mem.about.editFailed`,{error:xt(e)}),`error`)}finally{v(null)}}},[ae,g,b,c,f,n.due_dates,p]),Me=(0,C.useCallback)(async e=>{v(e.id);try{await ue(e.id),y.current++,h(t=>(t??[]).filter(t=>t.id!==e.id)),Ce(e=>Math.max(e-1,0)),de(t=>[e,...t]),c()}catch(e){i.system.error(`Failed to forget memory`,e),f(p(`mem.about.forgetFailed`,{error:xt(e)}),`error`)}finally{v(null)}},[c,f,p]),Ne=(0,C.useCallback)(async e=>{v(e.id);try{await Se({content:e.content,category:e.category,domain:e.domain??void 0,context:e.context??void 0,entity:e.entity??void 0,sensitive:e.sensitive,...n.due_dates&&e.due_at?{due_at:e.due_at}:{}}),de(t=>t.filter(t=>t.id!==e.id)),await b(),c()}catch(e){i.system.error(`Failed to restore memory`,e),f(p(`mem.about.restoreFailed`,{error:xt(e)}),`error`)}finally{v(null)}},[b,c,f,n.due_dates,p]),Pe=(0,C.useCallback)(async()=>{let e=me.trim(),t=_===`reminder`;if(!(!e||t&&!ve)){v(`new`);try{await Se({content:e,category:_,...t?{due_at:ve}:{}}),he(``),ye(``),f(p(`mem.about.saved`),`success`),await b(),c()}catch(e){i.system.error(`Failed to add memory`,e),f(p(`mem.about.addFailed`,{error:xt(e)}),`error`)}finally{v(null)}}},[me,_,ve,b,c,f,p]);if(!r)return d(`div`,{className:`mem-about`,children:[s(`h2`,{className:`mem-about-title`,children:p(`mem.about.title`)}),d(`div`,{className:`mem-about-empty`,children:[s(`p`,{children:p(`mem.about.off`)}),s(`button`,{className:`btn-secondary`,onClick:l,children:p(`mem.about.turnOn`)})]})]});let Fe=w.map(e=>({...e,rows:(m??[]).filter(t=>e.categories.includes(t.category))})).filter(e=>e.rows.length>0);return d(`div`,{className:`mem-about`,children:[s(`h2`,{className:`mem-about-title`,children:p(`mem.about.title`)}),s(`p`,{className:`mem-about-intro`,children:p(`mem.about.intro`)}),(!n.due_dates||!n.sources)&&d(`p`,{className:`mem-about-limits`,role:`note`,children:[!n.due_dates&&s(`span`,{children:p(`mem.about.limit.dueDates`,{name:ee})}),!n.due_dates&&!n.sources&&` `,!n.sources&&s(`span`,{children:p(`mem.about.limit.sources`,{name:ee})})]}),d(`form`,{className:`mem-about-add`,onSubmit:e=>{e.preventDefault(),Pe()},children:[s(`input`,{className:`mem-input`,placeholder:p.bare(`mem.about.addPlaceholder`),"aria-label":p(`mem.about.addLabel`),value:me,onChange:e=>he(e.target.value)}),d(`select`,{className:`mem-select`,"aria-label":p(`mem.about.kind`),value:_,onChange:e=>_e(e.target.value),children:[s(`option`,{value:`fact`,children:p.bare(`mem.about.group.about`)}),s(`option`,{value:`preference`,children:p.bare(`mem.about.kind.preference`)}),n.due_dates&&s(`option`,{value:`reminder`,children:p.bare(`mem.about.kind.reminder`)}),s(`option`,{value:`note`,children:p.bare(`mem.about.kind.note`)})]}),_===`reminder`&&s(`input`,{type:`datetime-local`,className:`mem-input mem-about-when`,"aria-label":p(`mem.about.when`),value:ve,onChange:e=>ye(e.target.value)}),d(`button`,{className:`btn-primary`,type:`submit`,disabled:!me.trim()||_===`reminder`&&!ve||be===`new`,children:[s(qe,{size:14}),` `,p(`mem.about.add`)]})]}),ce.map(e=>d(`div`,{className:`mem-about-forgotten`,role:`status`,children:[s(`span`,{title:e.sensitive?void 0:e.content,children:e.sensitive?p(`mem.about.forgottenSensitive`):p(`mem.about.forgotten`,{content:St(e.content)})}),d(`button`,{className:`mem-about-link`,disabled:be===e.id,onClick:()=>Ne(e),children:[s(le,{size:12}),` `,p(`mem.about.undo`)]})]},e.id)),te?d(`div`,{className:`mem-about-empty`,children:[s(`p`,{children:p(`mem.about.loadFailed`,{error:te})}),s(`button`,{className:`btn-secondary`,onClick:()=>b(),children:p(`mem.about.retry`)})]}):m===null?d(`div`,{className:`mem-loading`,children:[s(`div`,{className:`mem-spinner`}),` `,p(`mem.loading`)]}):Fe.length===0?d(`div`,{className:`mem-about-empty`,children:[s(`p`,{children:p(`mem.about.empty`)}),s(`p`,{className:`mem-about-hint`,children:p(`mem.about.emptyHint`)})]}):Fe.map(e=>d(`section`,{className:`mem-about-group`,"aria-label":p(e.title),children:[s(`h3`,{className:`mem-about-group-title`,children:p(e.title)}),s(`ul`,{className:`mem-about-list`,children:e.rows.map(e=>{let r=e.sensitive&&!fe.has(e.id),i=n.due_dates&&e.due_at?yt(e.due_at,new Date,p):null,o=n.sources&&e.source?ht(e.source):null,c=gt(e.updated_at,p),l=r?t(`mem.about.sensitiveMemory`):e.content;return s(`li`,{className:`mem-about-item`,children:re===e.id?d(`form`,{className:`mem-about-edit`,onSubmit:t=>{t.preventDefault(),je(e)},children:[s(`textarea`,{className:`mem-input`,"aria-label":p(`mem.about.editLabel`),rows:2,autoFocus:!0,value:ae,onChange:e=>oe(e.target.value),onKeyDown:t=>{t.key===`Escape`&&(t.stopPropagation(),ie(null)),t.key===`Enter`&&!t.shiftKey&&!t.nativeEvent.isComposing&&(t.preventDefault(),je(e))}}),n.due_dates&&e.category===`reminder`&&s(`input`,{type:`datetime-local`,className:`mem-input mem-about-when`,"aria-label":p(`mem.about.when`),value:g,onChange:e=>se(e.target.value)}),d(`div`,{className:`mem-about-edit-actions`,children:[s(`button`,{className:`btn-primary`,type:`submit`,disabled:be===e.id,children:p(`mem.about.save`)}),s(`button`,{className:`btn-secondary`,type:`button`,onClick:()=>ie(null),children:p(`mem.about.cancel`)})]})]}):d(a.Fragment,{children:[d(`div`,{className:`mem-about-text`,children:[r?d(`button`,{className:`mem-about-link`,onClick:()=>pe(t=>new Set(t).add(e.id)),children:[s(Oe,{size:12}),` `,p(`mem.about.showSensitive`)]}):s(`bdi`,{children:e.content}),i&&s(`span`,{className:`mem-about-due${i.past?` is-overdue`:``}`,children:i.text}),(o||c!==null)&&s(`span`,{className:`mem-about-meta`,children:o===null?typeof c==`string`?c:p(c.ref,c.params):c===null?p(o):p(`mem.about.meta`,{source:t(o),when:c})})]}),d(`div`,{className:`mem-about-actions`,children:[s(`button`,{className:`mem-about-btn`,"aria-label":p(`mem.about.editAria`,{name:l}),title:p(r?`mem.about.editHidden`:`mem.about.edit`),disabled:r,onClick:()=>{ie(e.id),oe(e.content),se(vt(e.due_at))},children:s(Ae,{size:14})}),d(`button`,{className:`mem-about-btn mem-about-btn-remove`,"aria-label":p(`mem.about.forgetAria`,{name:l}),title:p(`mem.about.forget`),disabled:be===e.id,onClick:()=>Me(e),children:[s(Te,{size:14}),` `,p(`mem.about.forget`)]})]})]})},e.id)})})]},e.title)),!te&&m!==null&&m.length<xe&&d(`div`,{className:`mem-about-more`,children:[s(`span`,{children:p(`mem.about.showing`,{shown:m.length,total:xe})}),s(`button`,{className:`btn-secondary`,disabled:we,onClick:ke,children:p(`mem.about.showMore`)})]})]})}function xt(e){return e instanceof Error?e.message:String(e)}function St(e){let t=e.replace(/\s+/g,` `).trim();return t.length<=80?t:`${t.slice(0,79).trimEnd()}…`}function T(e,t){if(!e)return`—`;try{let n=new Date(e);if(isNaN(n.getTime()))return`—`;let r={month:`short`,day:`numeric`};return n.getFullYear()!==new Date().getFullYear()&&(r.year=`numeric`),n.toLocaleDateString(t,r)}catch{return`—`}}function E(e,t){if(!e)return``;try{let n=new Date(e);return isNaN(n.getTime())?``:n.toLocaleString(t,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}catch{return``}}function D(e,t){if(!e)return`—`;try{let n=new Date(e);if(isNaN(n.getTime()))return`—`;let r=Date.now(),i=n.getTime()-r,a=Math.abs(i),o=Math.floor(a/1e3),s=Math.floor(a/6e4),c=Math.floor(a/36e5),u=Math.floor(a/864e5);return i<0?o<5?t(`time.justNow`):o<60?t(`mem.rel.secondsAgo`,{n:o}):c===0?t(`time.minutesAgo`,{n:s}):u===0?t(`time.hoursAgo`,{n:c}):u===1?t(`time.yesterday`):u<30?t(`time.daysAgo`,{n:u}):E(e,l(t)):o<5?t(`mem.rel.now`):o<60?t(`mem.rel.inSeconds`,{n:o}):c===0?t(`mem.rel.inMinutes`,{n:s}):u===0?t(`mem.rel.inHours`,{n:c}):u===1?t(`mem.rel.tomorrow`):u<30?t(`mem.rel.inDays`,{n:u}):E(e,l(t))}catch{return`—`}}function Ct(e){return e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(1)}s`}function wt(e){try{return new Date(e).getTime()<Date.now()}catch{return!1}}function Tt(e){return e>=.7?`high`:e>=.4?`medium`:`low`}function Et(e){return e>=.9?`high`:e>=.7?`medium`:`low`}function Dt(e,t,n){let r=T(e,n),i=T(t,n);return r===`—`&&i===`—`?``:r===i?r:`${r} \u2013 ${i}`}function Ot(e){if(e.length===0)return 0;let t=new Date().toISOString().slice(0,10),n=e.find(e=>e.date===t);return n?n.knowledge_added:0}var kt=[`fact`,`preference`,`error`,`skill`,`note`,`reminder`],At={fact:`mem.cat.fact`,preference:`mem.cat.preference`,error:`mem.cat.error`,skill:`mem.cat.skill`,note:`mem.cat.note`,reminder:`mem.cat.reminder`},jt={pending_approval:`mem.status.pending_approval`,queued:`mem.status.queued`,in_progress:`mem.status.in_progress`,completed:`mem.status.completed`,failed:`mem.status.failed`,rejected:`mem.status.rejected`,cancelled:`mem.status.cancelled`,blocked:`mem.status.blocked`},Mt={low:`mem.priority.low`,medium:`mem.priority.medium`,high:`mem.priority.high`},Nt={agent_inferred:`mem.goals.source.agent_inferred`,agent_scheduled:`mem.goals.source.agent_scheduled`},Pt={user:`mem.role.user`,assistant:`mem.role.assistant`},Ft={work:`mem.domain.work`,technical:`mem.domain.technical`,personal:`mem.domain.personal`,general:`mem.domain.general`},It={...Ft,global:`mem.context.global`};function O({value:e,keys:t}){let n=u(),r=t[e];return r?s(a.Fragment,{children:n(r)}):s(`bdi`,{children:e})}function k(e){return e instanceof Error?e.message:String(e)}var Lt={work:`blue`,technical:`purple`,personal:`green`,general:`gray`},Rt=`gaiacpp`;function zt(){let e=u(),{setShowMemoryDashboard:n,sessions:r,setCurrentSession:o,openSettings:le}=p(),rt=p(e=>e.settingsSection!==null),at=(0,C.useMemo)(()=>new Map(r.map(e=>[e.id,e.title])),[r]),st=e=>at.get(e)||`${e.slice(0,8)}...`,[x,ut]=(0,C.useState)(null),[S,pt]=(0,C.useState)([]),[w,ht]=(0,C.useState)(null),[gt,_t]=(0,C.useState)([]),[vt,yt]=(0,C.useState)([]),[xt,St]=(0,C.useState)([]),[T,zt]=(0,C.useState)(null),[Bt,Vt]=(0,C.useState)([]),[A,Ht]=(0,C.useState)(null),[Ut,Wt]=(0,C.useState)(null),Gt=(0,C.useRef)(null),Kt=A?.supports.advanced===!0,[qt,Jt]=(0,C.useState)(!0),[Yt,Xt]=(0,C.useState)(!1),[Zt,Qt]=(0,C.useState)(null),[$t,j]=(0,C.useState)(!1),[en,tn]=(0,C.useState)(null),[nn,rn]=(0,C.useState)([]),an=(0,C.useRef)(0),[M,on]=(0,C.useState)([]),[sn,cn]=(0,C.useState)(``),[ln,un]=(0,C.useState)(``),[dn,fn]=(0,C.useState)(``),[N,pn]=(0,C.useState)(`updated_at`),[mn,hn]=(0,C.useState)(`desc`),[P,F]=(0,C.useState)(0),[gn,_n]=(0,C.useState)(!1),[vn,yn]=(0,C.useState)(``),[bn,xn]=(0,C.useState)(null),Sn=(0,C.useRef)(null),[I,Cn]=(0,C.useState)(null),[wn,Tn]=(0,C.useState)(!1),[L,En]=(0,C.useState)(null),[R,z]=(0,C.useState)({content:``,category:`fact`,domain:``,context:`global`,entity:``,sensitive:!1,due_at:``}),[B,Dn]=(0,C.useState)(new Set),[V,On]=(0,C.useState)(!1),[kn,An]=(0,C.useState)(!1),[jn,Mn]=(0,C.useState)(!1),[H,U]=(0,C.useState)(!1),[Nn,Pn]=(0,C.useState)(!1),[W,Fn]=(0,C.useState)(null),[In,Ln]=(0,C.useState)(!1),[Rn,G]=(0,C.useState)(null),[K,zn]=(0,C.useState)(`about`),[Bn,Vn]=(0,C.useState)(0),[Hn,Un]=(0,C.useState)([]),[Wn,Gn]=(0,C.useState)(null),[Kn,qn]=(0,C.useState)(!1),Jn=Xe(e=>e.error),Yn=Xe(e=>e.damaged),[Xn,Zn]=(0,C.useState)(null),[Qn,$n]=(0,C.useState)(null),[er,tr]=(0,C.useState)(!1),[nr,rr]=(0,C.useState)(null),[ir,ar]=(0,C.useState)(null),[or,sr]=(0,C.useState)(!1),[cr,lr]=(0,C.useState)({title:``,description:``,priority:`medium`}),[q,ur]=(0,C.useState)(`idle`),[dr,fr]=(0,C.useState)([]),[pr,mr]=(0,C.useState)([]),[hr,gr]=(0,C.useState)(null),[_r,vr]=(0,C.useState)(new Set),yr=(0,C.useRef)(null),br=(0,C.useRef)(null),[J,xr]=(0,C.useState)(`idle`),[Sr,Cr]=(0,C.useState)([]),[wr,Tr]=(0,C.useState)([]),[Er,Dr]=(0,C.useState)(null),[Or,kr]=(0,C.useState)(!1),Ar=(0,C.useRef)(null),jr=(0,C.useRef)(null),[Mr,Nr]=(0,C.useState)(30),[Pr,Fr]=(0,C.useState)(!1),[Ir,Lr]=(0,C.useState)(!1),[Rr,zr]=(0,C.useState)(!1),[Br,Vr]=(0,C.useState)(!1),[Hr,Ur]=(0,C.useState)(!1),[Wr,Gr]=(0,C.useState)(!1),Kr=(0,C.useRef)(null),qr=(0,C.useRef)(null),Jr=(0,C.useRef)(null),Yr=(0,C.useRef)(new Set),Y=(0,C.useCallback)((e,t=`info`)=>{let n=++an.current;rn(r=>[...r,{id:n,text:e,type:t}]);let r=setTimeout(()=>{Yr.current.delete(r),rn(e=>e.filter(e=>e.id!==n))},4e3);Yr.current.add(r)},[]);(0,C.useEffect)(()=>{let e=Yr.current;return()=>{e.forEach(e=>clearTimeout(e)),Kr.current&&clearTimeout(Kr.current),Sn.current&&clearTimeout(Sn.current)}},[]),(0,C.useEffect)(()=>{if(!$t)return;let e=e=>{qr.current&&!qr.current.contains(e.target)&&j(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[$t]),f(!0,()=>{Rn?G(null):Nn?Pn(!1):In?Ln(!1):I?Cn(null):$t?j(!1):wn||L?(Tn(!1),En(null)):en?tn(null):n(!1)}),c(Jr,!!Rn),(0,C.useEffect)(()=>{if(!Rn)return;let e=Jr.current;if(!e)return;let t=document.activeElement;return e.focus(),()=>{t?.focus()}},[Rn]);let Xr=(0,C.useCallback)(async()=>{try{let e=await Je();if(!e)throw new g;return Gt.current=e,Ht(e),Wt(null),e}catch(e){return i.system.error(`Could not tell which agent’s memory to show`,e),Gt.current=null,Ht(null),Wt({unknown:e instanceof g,text:k(e)}),null}},[]),Zr=(0,C.useCallback)(async()=>{try{let e=await Ue();ut(e)}catch(e){i.system.warn(`Failed to load memory stats`,e)}},[]),Qr=(0,C.useCallback)(async()=>{try{let e=await ee(Mr);pt(e)}catch(e){i.system.warn(`Failed to load memory activity`,e)}},[Mr]),X=(0,C.useCallback)(async()=>{try{let e=await ge({category:M.length>0?M:void 0,context:sn||void 0,entity:ln||void 0,search:dn||void 0,sort_by:N,order:mn,offset:P,limit:15,include_sensitive:!0,include_superseded:gn});ht(e)}catch(e){i.system.warn(`Failed to load knowledge`,e)}},[M,sn,ln,dn,N,mn,P,gn]),$r=(0,C.useCallback)(async()=>{try{let e=await ze();_t(e)}catch(e){i.system.warn(`Failed to load tool summary`,e)}},[]),ei=(0,C.useCallback)(async()=>{try{let e=await Fe(20);yt(e)}catch(e){i.system.warn(`Failed to load conversations`,e)}},[]),ti=(0,C.useCallback)(async()=>{try{let e=await je(7);St(e)}catch(e){i.system.warn(`Failed to load upcoming items`,e)}},[]),ni=(0,C.useCallback)(async()=>{try{let e=await Ee();zt(e)}catch(e){i.system.warn(`Failed to load embedding coverage`,e)}},[]),ri=(0,C.useCallback)(async()=>{try{let e=await we();Vt(e||[])}catch(e){i.system.warn(`Failed to load entities`,e)}},[]),ii=(0,C.useCallback)(async()=>{try{let e=await Ze();An(e.mcp_memory_enabled),On(e.memory_enabled),Mn(e.system_discovery_consent)}catch(e){i.system.warn(`Failed to load memory settings`,e)}},[]),Z=(0,C.useCallback)(async()=>{qn(!0),Xe.getState().check();try{let[e,t]=await Promise.all([We(),De()]);Un(e.goals),Gn(t),Zn(null)}catch(e){i.system.warn(`Failed to load goals`,e),Zn(k(e))}finally{qn(!1)}},[]),ai=(0,C.useCallback)(async(n,r)=>{try{await n()}catch(n){i.system.error(`Goal action failed (${r})`,n),Y(e(`mem.goals.failed`,{what:t(r),error:k(n)}),`error`);return}Z()},[Z,Y,e]),oi=(0,C.useCallback)(async()=>{if(cr.title.trim()){$n(null);try{await v(cr)}catch(n){i.system.error(`Goal create failed`,n),$n(e(`mem.goals.failed`,{what:t(`mem.goals.createFailed`),error:k(n)}));return}lr({title:``,description:``,priority:`medium`}),sr(!1),Z()}},[cr,Z,e]);(0,C.useEffect)(()=>{Jn||$n(null)},[Jn]);let si=(0,C.useCallback)(async()=>{tr(!0);try{let{kept:t}=await Re();Y(e(`mem.goals.newListStarted`,{file:t}),`success`)}catch(n){i.system.error(`Starting a new goal list failed`,n),Y(e(`mem.goals.failed`,{what:t(`mem.goals.startNewListFailed`),error:k(n)}),`error`)}finally{tr(!1)}Z()},[Z,Y,e]);(0,C.useEffect)(()=>{if(!ir)return;let e=setTimeout(()=>ar(null),3e3);return()=>clearTimeout(e)},[ir]);let Q=(0,C.useCallback)(async()=>{Jt(!0),Xt(!1);let e=()=>{ut(null),pt([]),ht(null),_t([]),yt([]),St([]),zt(null),Vt([]),xn(null),Cn(null),j(!1)},t=()=>{Un([]),Gn(null),Zn(null)};try{let n=await Xr();if(!n){e(),t();return}n.supports.advanced||e(),n.supports.goals||t(),await Promise.all([ii(),...n.supports.advanced?[Zr(),Qr(),X(),$r(),ei(),ti(),ni(),ri()]:[],...n.supports.goals?[Z()]:[]]),Vn(e=>e+1)}catch(e){Xt(!0),i.system.error(`Memory dashboard load failed`,e)}finally{Jt(!1)}},[Xr,Zr,Qr,X,$r,ei,ti,ni,ri,ii,Z]);(0,C.useEffect)(()=>{Q()},[Q]);let ci=(0,C.useRef)(!1);(0,C.useEffect)(()=>{let e=ci.current&&!rt;if(ci.current=rt,!e)return;let t=!0;return(async()=>{let e=null;try{e=(await Je())?.agent??null}catch(e){i.system.warn(`Could not re-check which agent’s memory to show`,e)}t&&e!==Gt.current?.agent&&Q()})(),()=>{t=!1}},[rt,Q]),(0,C.useEffect)(()=>{Gt.current?.supports.advanced&&X()},[X]);let li=(0,C.useRef)(!0);(0,C.useEffect)(()=>{li.current?li.current=!1:Gt.current?.supports.advanced&&Qr()},[Qr]);let ui=(0,C.useCallback)(e=>{fn(e),Gr(!0),Kr.current&&clearTimeout(Kr.current),Kr.current=setTimeout(()=>{F(0),Gr(!1)},300)},[]),di=(0,C.useCallback)(()=>{Gt.current?.supports.advanced&&(X(),Zr(),ni(),ti(),ri())},[X,Zr,ni,ti,ri]),$=(0,C.useCallback)(()=>{di(),Vn(e=>e+1)},[di]),fi=(0,C.useCallback)(async()=>{if(R.content.trim())try{let t=await Se({content:R.content,category:R.category,domain:R.domain||void 0,context:R.context,entity:R.entity||void 0,sensitive:R.sensitive,due_at:R.due_at||void 0});Tn(!1),z({content:``,category:`fact`,domain:``,context:`global`,entity:``,sensitive:!1,due_at:``}),$(),i.ui.info(`Created new knowledge entry`),t?.embedded===!1?Y(t.embed_error?e(`mem.toast.server`,{message:t.embed_error}):e(`mem.toast.notEmbedded`),`error`):Y(e(`mem.toast.created`),`success`)}catch(t){i.system.error(`Failed to create knowledge`,t),Y(e(`mem.toast.createFailed`,{error:k(t)}),`error`)}},[R,$,Y,e]),pi=(0,C.useCallback)(async()=>{if(L&&R.content.trim())try{let t=await Ke(L,{content:R.content,category:R.category,domain:R.domain||void 0,context:R.context,entity:R.entity||void 0,sensitive:R.sensitive,due_at:R.due_at||void 0});En(null),z({content:``,category:`fact`,domain:``,context:`global`,entity:``,sensitive:!1,due_at:``}),$(),i.ui.info(`Updated knowledge ${L}`),t?.embedded===!1?Y(t.embed_error?e(`mem.toast.server`,{message:t.embed_error}):e(`mem.toast.notEmbedded`),`error`):Y(e(`mem.toast.updated`),`success`)}catch(t){i.system.error(`Failed to update knowledge`,t),Y(e(`mem.toast.updateFailed`,{error:k(t)}),`error`)}},[L,R,$,Y,e]),mi=(0,C.useCallback)(async t=>{if(W!==t)Fn(t);else{Fn(null);try{await ue(t),$(),i.ui.info(`Deleted knowledge ${t}`),Y(e(`mem.toast.deleted`),`info`)}catch(t){i.system.error(`Failed to delete knowledge`,t),Y(e(`mem.toast.deleteFailed`,{error:k(t)}),`error`)}}},[W,$,Y,e]);(0,C.useEffect)(()=>{if(!W)return;let e=setTimeout(()=>Fn(null),3e3);return()=>clearTimeout(e)},[W]);let hi=(0,C.useCallback)(async t=>{try{await Ke(t.id,{sensitive:!t.sensitive}),!t.sensitive&&L===t.id&&!B.has(t.id)&&(En(null),z(e=>({...e,content:``}))),X(),i.ui.info(`Toggled sensitive for ${t.id}: ${!t.sensitive}`),Y(e(t.sensitive?`mem.toast.unmarkedSensitive`:`mem.toast.markedSensitive`),`info`)}catch(t){i.system.error(`Failed to toggle sensitive`,t),Y(e(`mem.toast.sensitiveFailed`,{error:k(t)}),`error`)}},[X,Y,e,L,B]),gi=(0,C.useCallback)(e=>{(!e.sensitive||B.has(e.id))&&(En(e.id),Tn(!1),z({content:e.content,category:e.category,domain:e.domain||``,context:e.context,entity:e.entity||``,sensitive:e.sensitive,due_at:e.due_at||``}))},[B]),_i=(0,C.useCallback)(e=>{let t=B.has(e.id);Dn(n=>{let r=new Set(n);return t?r.delete(e.id):r.add(e.id),r}),t&&L===e.id&&(En(null),z(e=>({...e,content:``})))},[B,L]),vi=(0,C.useCallback)(t=>{navigator.clipboard.writeText(t).then(()=>Y(e(`mem.toast.idCopied`),`info`),n=>{i.ui.warn(`Couldn't copy knowledge ID ${t}`,n),Y(e(`mem.toast.copyFailed`,{error:k(n)}),`error`)})},[Y,e]),yi=(0,C.useCallback)(e=>{yn(e),Sn.current&&clearTimeout(Sn.current),e.trim()?Sn.current=setTimeout(async()=>{try{let t=await ke(e.trim(),20);xn(t)}catch(e){i.system.warn(`Conversation search failed`,e)}},300):xn(null)},[]),bi=(0,C.useCallback)(async e=>{try{let t=await ce(e);Cn({sessionId:e,turns:t})}catch(e){i.system.error(`Failed to load conversation detail`,e)}},[]),xi=(0,C.useCallback)(e=>{on(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),F(0)},[]),Si=(0,C.useCallback)(e=>{N===e?hn(e=>e===`desc`?`asc`:`desc`):(pn(e),hn(`desc`)),F(0)},[N]),Ci=(0,C.useCallback)(async()=>{Fr(!0),j(!1);try{let t=await oe();await Q(),Y(e(`mem.toast.consolidated`,{sessions:t.consolidated??0,items:t.extracted_items??0}),`success`)}catch(t){i.system.error(`Failed to consolidate sessions`,t),Y(e(`mem.toast.consolidateFailed`,{error:k(t)}),`error`)}finally{Fr(!1)}},[Q,Y,e]),wi=(0,C.useCallback)(async()=>{Lr(!0),j(!1);try{let t=await Be();await ni(),Y(t.total_without?e(`mem.toast.backfilledMissing`,{n:t.backfilled??0,missing:t.total_without}):e(`mem.toast.backfilled`,{n:t.backfilled??0}),`success`)}catch(t){i.system.error(`Failed to rebuild embeddings`,t),Y(e(`mem.toast.rebuildFailed`,{error:k(t)}),`error`)}finally{Lr(!1)}},[ni,Y,e]),Ti=(0,C.useCallback)(async()=>{zr(!0),j(!1);try{let t=await Pe();await Q(),Y(e(`mem.toast.reconciled`,{pairs:t.pairs_checked??0,reinforced:t.reinforced??0,contradicted:t.contradicted??0}),`success`)}catch(t){i.system.error(`Failed to reconcile memory`,t),Y(e(`mem.toast.reconcileFailed`,{error:k(t)}),`error`)}finally{zr(!1)}},[Q,Y,e]),Ei=(0,C.useCallback)(async()=>{Vr(!0),j(!1);try{await $e(),await Q(),Y(e(`mem.toast.ftsRebuilt`),`success`)}catch(t){i.system.error(`Failed to rebuild FTS index`,t),Y(e(`mem.toast.ftsFailed`,{error:k(t)}),`error`)}finally{Vr(!1)}},[Q,Y,e]),Di=(0,C.useCallback)(async()=>{Ur(!0),j(!1);try{let t=await Ie();await Q(),t.skipped?Y(e(`mem.toast.systemDisabled`),`error`):Y(e(`mem.toast.systemRefreshed`,{n:t.stored}),`success`)}catch(t){i.system.error(`Failed to refresh system context`,t),Y(e(`mem.toast.systemFailed`,{error:k(t)}),`error`)}finally{Ur(!1)}},[Q,Y,e]),Oi=Pr||Ir||Rr||Br||Hr,ki=(0,C.useCallback)(()=>{ur(`running`),fr([]),mr([]),vr(new Set),gr(null);let t=Ye();br.current=t,t.onmessage=n=>{try{let r=JSON.parse(n.data);if(r.type===`log`)fr(e=>[...e,{text:r.message,kind:`log`,server:!0}]);else if(r.type===`finding`){let t=r.item,n=t.sensitive?e(`mem.log.foundSensitive`):e.bare(`mem.log.found`,{content:t.content});fr(e=>[...e,{text:n,kind:`finding`}]),mr(e=>[...e,{...t,_checked:!0}])}else r.type===`error`?fr(t=>[...t,{text:e.bare(`mem.log.error`,{message:r.message}),kind:`error`}]):r.type===`done`&&(t.close(),br.current=null,fr(t=>[...t,{text:e(`mem.log.discoveryDone`,{n:r.total??0}),kind:`log`}]),ur(`review`))}catch(t){i.system.warn(`Unreadable discovery event`,t),fr(t=>[...t,{text:e(`mem.log.parseFailed`),kind:`error`}])}},t.onerror=()=>{t.close(),br.current=null,fr(t=>[...t,{text:e(`mem.log.discoveryConnection`),kind:`error`}]),mr(e=>(ur(e.length>0?`review`:`idle`),e))}},[e]),Ai=(0,C.useCallback)(async()=>{let t=pr.filter(e=>e._checked);if(t.length!==0){ur(`saving`);try{let n=t.map(({_checked:e,...t})=>t),r=await te(n);gr(r.stored),ur(`done`),$(),Y(e(`mem.disc.saved`,{n:r.stored}),`success`)}catch(t){i.system.error(`Failed to commit discovery items`,t),Y(e(`mem.disc.saveFailed`,{error:k(t)}),`error`),ur(`review`)}}},[pr,$,Y,e]),ji=(0,C.useCallback)(()=>{xr(`running`),Cr([]),Tr([]),Dr(null);let t=Ne(Or);jr.current=t,t.onmessage=n=>{try{let r=JSON.parse(n.data);if(r.type===`log`)Cr(e=>[...e,{text:r.message,kind:`log`,server:!0}]);else if(r.type===`insight`){let t=r.item;Cr(n=>[...n,{text:e.bare(`mem.log.insight`,{content:t.content}),kind:`finding`}]),Tr(e=>[...e,{...t,_checked:!0}])}else r.type===`error`?Cr(t=>[...t,{text:e.bare(`mem.log.error`,{message:r.message}),kind:`error`}]):r.type===`done`&&(t.close(),jr.current=null,Cr(t=>[...t,{text:e(`mem.log.inferenceDone`,{n:r.total??0}),kind:`log`}]),xr(`review`))}catch(t){i.system.warn(`Unreadable inference event`,t),Cr(t=>[...t,{text:e(`mem.log.parseFailed`),kind:`error`}])}},t.onerror=()=>{t.close(),jr.current=null,Cr(t=>[...t,{text:e(`mem.log.inferenceConnection`),kind:`error`}]),Tr(e=>(xr(e.length>0?`review`:`idle`),e))}},[Or,e]),Mi=(0,C.useCallback)(async()=>{let t=wr.filter(e=>e._checked);if(t.length!==0){xr(`saving`);try{let n=t.map(({_checked:e,...t})=>t),r=await xe(n);Dr(r.stored),xr(`done`),$(),Y(e(`mem.inf.saved`,{n:r.stored}),`success`)}catch(t){i.system.error(`Failed to commit inference insights`,t),Y(e(`mem.inf.saveFailed`,{error:k(t)}),`error`),xr(`review`)}}},[wr,$,Y,e]);(0,C.useEffect)(()=>{yr.current&&(yr.current.scrollTop=yr.current.scrollHeight)},[dr]),(0,C.useEffect)(()=>{Ar.current&&(Ar.current.scrollTop=Ar.current.scrollHeight)},[Sr]),(0,C.useEffect)(()=>()=>{br.current&&=(br.current.close(),null),jr.current&&=(jr.current.close(),null)},[]);let Ni=e=>N===e?s(`span`,{className:`mem-sort-arrow`,children:mn===`desc`?`↓`:`↑`}):null,Pi=Math.max(1,...S.map(e=>e.conversations+e.tool_calls+e.knowledge_added+e.errors)),Fi=x?.knowledge?.by_context?Object.keys(x.knowledge.by_context):[];return d(`div`,{className:`memory-dashboard-page`,children:[d(`div`,{className:`memory-dashboard-header`,children:[d(`div`,{className:`memory-dashboard-header-left`,children:[s(`button`,{className:`btn-icon settings-back-btn`,onClick:()=>n(!1),"aria-label":e(`mem.back`),children:s(_e,{size:18})}),d(`h1`,{children:[e(`mem.title`),` `,s(`span`,{className:`mem-beta`,style:{fontSize:11,fontWeight:500,color:`var(--accent-yellow)`,background:`var(--accent-yellow-dim)`,padding:`2px 8px`,borderRadius:4,marginInlineStart:8,verticalAlign:`middle`,whiteSpace:`nowrap`},children:e(`mem.beta`)})]})]}),d(`div`,{className:`memory-dashboard-header-actions`,children:[K===`advanced`&&Kt&&d(a.Fragment,{children:[T&&T.total_items>0&&d(`div`,{className:`mem-embedding-coverage`,title:e(`mem.coverage.title`,{n:T.with_embedding,total:T.total_items}),children:[s(`div`,{className:`mem-embedding-bar`,children:s(`div`,{className:`mem-embedding-fill`,style:{width:`${Math.round(T.coverage_pct)}%`}})}),s(`span`,{className:`mem-embedding-label`,children:e(`mem.coverage.label`,{pct:`${Math.round(T.coverage_pct)}%`})})]}),d(`div`,{className:`mem-maintenance-wrap`,ref:qr,children:[d(`button`,{className:`btn-icon ${Oi?`mem-spinning`:``}`,onClick:()=>j(e=>!e),title:e(`mem.maint.label`),"aria-label":e(`mem.maint.label`),"aria-expanded":$t,children:[Oi?s(`div`,{className:`mem-spinner-sm`}):s(tt,{size:16}),s(he,{size:10,style:{marginInlineStart:2}})]}),$t&&d(`div`,{className:`mem-maintenance-menu`,role:`menu`,children:[d(`button`,{className:`mem-maintenance-item`,onClick:Ci,disabled:Pr,role:`menuitem`,children:[s(it,{size:14}),e(Pr?`mem.maint.consolidating`:`mem.maint.consolidate`)]}),d(`button`,{className:`mem-maintenance-item`,onClick:wi,disabled:Ir,role:`menuitem`,children:[s(Ce,{size:14}),e(Ir?`mem.maint.rebuilding`:`mem.maint.rebuildEmbeddings`)]}),d(`button`,{className:`mem-maintenance-item`,onClick:Ti,disabled:Rr,role:`menuitem`,children:[s(h,{size:14}),e(Rr?`mem.maint.reconciling`:`mem.maint.reconcile`)]}),s(`div`,{className:`mem-maintenance-divider`}),d(`button`,{className:`mem-maintenance-item`,onClick:Di,disabled:Hr,role:`menuitem`,children:[s(He,{size:14}),e(Hr?`mem.maint.refreshing`:`mem.maint.refreshSystem`)]}),s(`div`,{className:`mem-maintenance-divider`}),d(`button`,{className:`mem-maintenance-item`,onClick:Ei,disabled:Br,role:`menuitem`,children:[s(m,{size:14}),e(Br?`mem.maint.rebuilding`:`mem.maint.rebuildFts`)]})]})]})]}),s(`button`,{className:`btn-icon`,onClick:Q,title:e(`mem.refresh`),"aria-label":e(`mem.refreshAria`),children:s(He,{size:16})})]})]}),d(`div`,{className:`mem-tab-bar`,role:`tablist`,children:[d(`button`,{className:`mem-tab-btn${K===`about`?` mem-tab-active`:``}`,onClick:()=>zn(`about`),role:`tab`,"aria-selected":K===`about`,children:[s(ft,{size:14}),` `,e(`mem.tab.about`)]}),d(`button`,{className:`mem-tab-btn${K===`goals`?` mem-tab-active`:``}`,onClick:()=>{zn(`goals`),A?.supports.goals&&Z()},role:`tab`,"aria-selected":K===`goals`,children:[s(lt,{size:14}),` `,e(`mem.tab.goals`),A?.supports.goals&&Wn&&(Wn.goals.pending_approval??0)>0&&s(`span`,{className:`mem-tab-badge`,children:Wn.goals.pending_approval})]}),d(`button`,{className:`mem-tab-btn${K===`profile`?` mem-tab-active`:``}`,onClick:()=>zn(`profile`),role:`tab`,"aria-selected":K===`profile`,children:[s(b,{size:14}),` `,e(`mem.tab.profile`)]}),d(`button`,{className:`mem-tab-btn${K===`advanced`?` mem-tab-active`:``}`,onClick:()=>zn(`advanced`),role:`tab`,"aria-selected":K===`advanced`,children:[s(se,{size:14}),` `,e(`mem.tab.advanced`)]})]}),A&&(A.agent===Rt||A.other_available)&&d(`p`,{className:`mem-store-banner`,role:`note`,children:[s(`span`,{children:e(A.agent===Rt?`mem.store.native`:`mem.store.python`,{name:Rt})}),` `,s(`button`,{type:`button`,className:`link-btn`,onClick:()=>le(`model`),children:e.compose(e=>e(`mem.store.change`,{tab:e(`settings.section.model`)}))})]}),d(`div`,{className:`memory-dashboard-body`,children:[Ut&&d(`div`,{className:`mem-empty`,role:`alert`,children:[s(`div`,{className:`mem-empty-icon`,children:s(y,{size:32})}),s(`p`,{children:Ut.unknown?e(`mem.store.unknown`):e(`mem.store.loadFailed`,{error:Ut.text})}),d(`button`,{className:`btn-secondary`,onClick:Q,style:{marginTop:12},children:[s(He,{size:14}),` `,e(`mem.retry`)]})]}),!A&&!Ut&&d(`div`,{className:`mem-loading`,children:[s(`div`,{className:`mem-spinner`}),e(`mem.loadingData`)]}),A&&d(a.Fragment,{children:[K===`about`&&s(bt,{agent:A.agent,supports:A.supports,memoryEnabled:V,reloadKey:Bn,onChanged:di,onOpenAdvanced:()=>zn(`advanced`),showToast:Y},A.agent),K===`advanced`&&!Kt&&s(`p`,{className:`mem-store-only`,role:`note`,children:e(`mem.store.pythonOnly.advanced`,{name:Rt})}),K===`advanced`&&s(a.Fragment,{children:qt&&!x?d(`div`,{className:`mem-loading`,children:[s(`div`,{className:`mem-spinner`}),e(`mem.loadingData`)]}):Yt?d(`div`,{className:`mem-empty`,children:[s(`div`,{className:`mem-empty-icon`,children:s(y,{size:32})}),s(`p`,{children:e(`mem.loadFailed`)}),d(`button`,{className:`btn-secondary`,onClick:Q,style:{marginTop:12},children:[s(He,{size:14}),` `,e(`mem.retry`)]})]}):d(a.Fragment,{children:[!V&&Kt&&d(`div`,{className:`mem-empty-state`,style:{margin:`40px 0`},children:[s(`div`,{className:`mem-empty-icon`,style:{opacity:.5},children:s(ct,{size:32})}),s(`p`,{style:{color:`var(--text-secondary)`,fontSize:14},children:e(`mem.offAdvanced`)})]}),V&&Kt&&d(a.Fragment,{children:[x?.embedding_error&&d(`div`,{className:`mem-advanced-error`,role:`alert`,children:[s(y,{size:14}),` `,s(`bdi`,{children:x.embedding_error})]}),d(`div`,{className:`mem-stat-cards`,children:[d(`div`,{className:`mem-stat-card`,children:[s(`div`,{className:`mem-stat-value`,children:x?.knowledge?.total??0}),s(`div`,{className:`mem-stat-label`,children:e(`mem.stat.stored`)}),s(`div`,{className:`mem-stat-sub`,children:(()=>{let n=Ot(S);return n>0?e(`mem.stat.addedToday`,{n}):x?.knowledge?.by_category?e.compose(e=>Object.entries(x.knowledge.by_category).slice(0,3).map(([n,r])=>e(`mem.stat.categoryCount`,{category:At[n]?t(At[n]):n,n:r})).join(e(`mem.listSeparator`))):e(`mem.stat.noEntries`)})()})]}),d(`div`,{className:`mem-stat-card`,children:[s(`div`,{className:`mem-stat-value`,children:x?.knowledge?.total_retrievals??0}),s(`div`,{className:`mem-stat-label`,children:e(`mem.stat.retrieved`)}),s(`div`,{className:`mem-stat-sub`,children:x?.knowledge?.total&&x?.knowledge?.total_retrievals?e(`mem.stat.avgRecall`,{n:(x.knowledge.total_retrievals/x.knowledge.total).toFixed(1)}):e(`mem.stat.noRecalls`)})]}),d(`div`,{className:`mem-stat-card`,children:[s(`div`,{className:`mem-stat-value`,children:x?.conversations?.total_sessions??0}),s(`div`,{className:`mem-stat-label`,children:e(`mem.stat.sessions`)}),s(`div`,{className:`mem-stat-sub`,children:Dt(x?.conversations?.first_session??null,x?.conversations?.last_session??null,l(e))||e(`mem.stat.totalTurns`,{n:x?.conversations?.total_turns??0})})]}),d(`div`,{className:`mem-stat-card`,children:[s(`div`,{className:`mem-stat-value`,children:x?.tools?.total_calls??0}),s(`div`,{className:`mem-stat-label`,children:e(`mem.stat.toolCalls`)}),s(`div`,{className:`mem-stat-sub`,title:e(`mem.stat.toolsNotLogged`),children:e(`mem.stat.toolsExclMemory`,{n:x?.tools?.unique_tools??0})})]}),d(`div`,{className:`mem-stat-card`,children:[s(`div`,{className:`mem-stat-value`,children:x?.tools?.overall_success_rate!=null&&(x.tools.total_calls??0)>0?`${Math.round(x.tools.overall_success_rate*100)}%`:`—`}),s(`div`,{className:`mem-stat-label`,children:e(`mem.stat.successRate`)}),s(`div`,{className:`mem-stat-sub`,children:(x?.tools?.total_calls??0)>0?e(`mem.stat.errors`,{n:x?.tools?.total_errors??0}):e(`mem.stat.noToolCalls`)})]})]}),d(`div`,{className:`mem-section`,children:[d(`div`,{className:`mem-section-title mem-section-title-row`,children:[d(`span`,{className:`mem-section-title-left`,children:[s(dt,{size:14}),` `,e(`mem.activity.title`)]}),s(`div`,{className:`mem-range-tabs`,role:`group`,"aria-label":e(`mem.activity.range`),children:[1,7,30].map(t=>s(`button`,{className:`mem-range-tab${Mr===t?` active`:``}`,onClick:()=>Nr(t),children:e(t===1?`mem.activity.day1`:t===7?`mem.activity.days7`:`mem.activity.days30`)},t))})]}),S.length>0?d(a.Fragment,{children:[s(`div`,{className:`mem-activity-chart`,children:S.map((t,n)=>{let r=t.conversations+t.tool_calls+t.knowledge_added+t.errors,i=n===0||n===S.length-1||n%7==0,o=new Date(t.date+`T00:00:00`).toLocaleDateString(l(e),{month:`short`,day:`numeric`});return d(`div`,{className:`mem-activity-bar-group`,onMouseEnter:()=>Qt(n),onMouseLeave:()=>Qt(null),children:[t.errors>0&&s(`div`,{className:`mem-activity-bar errors`,style:{height:`${t.errors/Pi*100}%`}}),t.knowledge_added>0&&s(`div`,{className:`mem-activity-bar knowledge`,style:{height:`${t.knowledge_added/Pi*100}%`}}),t.tool_calls>0&&s(`div`,{className:`mem-activity-bar tool_calls`,style:{height:`${t.tool_calls/Pi*100}%`}}),t.conversations>0&&s(`div`,{className:`mem-activity-bar conversations`,style:{height:`${t.conversations/Pi*100}%`}}),i&&s(`span`,{className:`mem-activity-date-label`,children:o}),Zt===n&&r>0&&d(`div`,{className:`mem-activity-tooltip`,children:[s(`strong`,{children:o}),s(`br`,{}),t.conversations>0&&d(a.Fragment,{children:[e(`mem.activity.conversations`,{n:t.conversations}),s(`br`,{})]}),t.tool_calls>0&&d(a.Fragment,{children:[e(`mem.activity.toolCalls`,{n:t.tool_calls}),s(`br`,{})]}),t.knowledge_added>0&&d(a.Fragment,{children:[e(`mem.activity.learned`,{n:t.knowledge_added}),s(`br`,{})]}),t.errors>0&&s(a.Fragment,{children:e(`mem.stat.errors`,{n:t.errors})})]})]},t.date)})}),d(`div`,{className:`mem-activity-legend`,children:[d(`span`,{className:`mem-activity-legend-item`,children:[s(`span`,{className:`mem-activity-legend-dot conversations`}),` `,e(`mem.legend.conversations`)]}),d(`span`,{className:`mem-activity-legend-item`,children:[s(`span`,{className:`mem-activity-legend-dot tool_calls`}),` `,e(`mem.stat.toolCalls`)]}),d(`span`,{className:`mem-activity-legend-item`,children:[s(`span`,{className:`mem-activity-legend-dot knowledge`}),` `,e(`mem.legend.knowledge`)]}),d(`span`,{className:`mem-activity-legend-item`,children:[s(`span`,{className:`mem-activity-legend-dot errors`}),` `,e(`mem.legend.errors`)]})]})]}):d(`div`,{className:`mem-empty`,children:[s(`div`,{className:`mem-empty-icon`,children:s(dt,{size:28})}),s(`p`,{children:e(`mem.activity.empty`)})]})]}),d(`div`,{className:`mem-section`,children:[d(`div`,{className:`mem-section-title mem-section-title-row`,children:[d(`span`,{className:`mem-section-title-left`,children:[s(se,{size:14}),` `,e(`mem.knowledge.title`),w&&w.total>0&&s(`span`,{className:`mem-section-count`,children:w.total})]}),!wn&&!L&&d(`button`,{className:`mem-section-add-btn`,onClick:()=>Tn(!0),title:e(`mem.knowledge.addTitle`),children:[s(qe,{size:13}),` `,e(`mem.knowledge.add`)]})]}),d(`div`,{className:`mem-filters`,children:[d(`div`,{className:`mem-category-pills`,role:`group`,"aria-label":e(`mem.knowledge.filterCategory`),children:[kt.map(t=>s(`button`,{className:`mem-category-pill ${t}${M.includes(t)?` active`:``}`,onClick:()=>xi(t),"aria-pressed":M.includes(t),children:e(At[t])},t)),M.length>0&&d(`button`,{className:`mem-category-pill clear`,onClick:()=>{on([]),F(0)},"aria-label":e(`mem.knowledge.clearAria`),children:[`✕ `,e(`mem.knowledge.clear`)]})]}),d(`select`,{className:`mem-filter-select`,value:sn,onChange:e=>{cn(e.target.value),F(0)},"aria-label":e(`mem.knowledge.filterContext`),children:[s(`option`,{value:``,children:e.bare(`mem.knowledge.allContexts`)}),Fi.map(t=>s(`option`,{value:t,children:It[t]?e.bare(It[t]):t},t))]}),d(`select`,{className:`mem-filter-select`,value:ln,onChange:e=>{un(e.target.value),F(0)},"aria-label":e(`mem.knowledge.filterEntity`),children:[s(`option`,{value:``,children:e.bare(`mem.knowledge.allEntities`)}),Bt.map(e=>d(`option`,{value:e.entity,children:[e.entity,` (`,e.count,`)`]},e.entity))]}),d(`div`,{className:`mem-filter-search-wrap`,children:[Wr?s(`div`,{className:`mem-spinner-sm search-icon`,style:{width:12,height:12,borderWidth:1.5}}):s(m,{size:13,className:`search-icon`}),s(`input`,{className:`mem-filter-search`,type:`text`,placeholder:e.bare(`mem.knowledge.searchPlaceholder`),value:dn,onChange:e=>ui(e.target.value),"aria-label":e(`mem.knowledge.search`)})]}),d(`label`,{className:`mem-filter-toggle`,title:e(`mem.knowledge.supersededTitle`),children:[s(`input`,{type:`checkbox`,checked:gn,onChange:e=>_n(e.target.checked)}),s(`span`,{children:e(`mem.knowledge.superseded`)})]})]}),(wn||L)&&d(`div`,{className:`mem-inline-form`,children:[d(`div`,{className:`mem-inline-form-row`,children:[s(`label`,{children:e(`mem.col.content`)}),s(`textarea`,{value:R.content,onChange:e=>z(t=>({...t,content:e.target.value})),placeholder:e(`mem.form.contentPlaceholder`)})]}),d(`div`,{className:`mem-inline-form-row`,children:[s(`label`,{children:e(`mem.col.category`)}),s(`select`,{value:R.category,onChange:e=>z(t=>({...t,category:e.target.value})),children:kt.map(t=>s(`option`,{value:t,children:e.bare(At[t])},t))})]}),d(`div`,{className:`mem-inline-form-row`,children:[s(`label`,{children:e(`mem.col.context`)}),s(`input`,{type:`text`,value:R.context,onChange:e=>z(t=>({...t,context:e.target.value})),placeholder:`global`})]}),d(`div`,{className:`mem-inline-form-row`,children:[s(`label`,{children:e(`mem.detail.domain`)}),s(`input`,{type:`text`,value:R.domain,onChange:e=>z(t=>({...t,domain:e.target.value})),placeholder:e(`mem.form.domainPlaceholder`)})]}),d(`div`,{className:`mem-inline-form-row`,children:[s(`label`,{children:e(`mem.col.entity`)}),s(`input`,{type:`text`,value:R.entity,onChange:e=>z(t=>({...t,entity:e.target.value})),placeholder:e(`mem.form.entityPlaceholder`)})]}),d(`div`,{className:`mem-inline-form-row`,children:[s(`label`,{children:e(`mem.form.dueAt`)}),s(`input`,{type:`text`,value:R.due_at,onChange:e=>z(t=>({...t,due_at:e.target.value})),placeholder:e(`mem.form.dueAtPlaceholder`)})]}),d(`div`,{className:`mem-inline-form-row`,children:[s(`label`,{children:e(`mem.form.sensitive`)}),d(`label`,{style:{display:`flex`,alignItems:`center`,gap:6,cursor:`pointer`,fontSize:12},children:[s(`input`,{type:`checkbox`,checked:R.sensitive,onChange:e=>z(t=>({...t,sensitive:e.target.checked}))}),e(`mem.form.sensitiveHint`)]})]}),d(`div`,{className:`mem-inline-form-actions`,children:[s(`button`,{className:`btn-secondary`,onClick:()=>{Tn(!1),En(null)},children:e(`mem.cancel`)}),s(`button`,{className:`btn-primary`,onClick:L?pi:fi,style:{padding:`8px 20px`,fontSize:13},children:e(L?`mem.form.update`:`mem.form.save`)})]})]}),w&&w.items.length>0?d(a.Fragment,{children:[s(`div`,{style:{overflowX:`auto`},children:d(`table`,{className:`mem-knowledge-table`,children:[s(`thead`,{children:d(`tr`,{children:[d(`th`,{onClick:()=>Si(`category`),className:N===`category`?`sorted`:``,children:[e(`mem.col.category`),Ni(`category`)]}),s(`th`,{children:e(`mem.col.content`)}),d(`th`,{onClick:()=>Si(`context`),className:N===`context`?`sorted`:``,children:[e(`mem.col.context`),Ni(`context`)]}),s(`th`,{children:e(`mem.col.entity`)}),d(`th`,{onClick:()=>Si(`confidence`),className:N===`confidence`?`sorted`:``,children:[e(`mem.col.confidence`),Ni(`confidence`)]}),s(`th`,{children:e(`mem.col.source`)}),d(`th`,{onClick:()=>Si(`updated_at`),className:N===`updated_at`?`sorted`:``,children:[e(`mem.col.updated`),Ni(`updated_at`)]}),d(`th`,{onClick:()=>Si(`created_at`),className:N===`created_at`?`sorted`:``,children:[e(`mem.col.created`),Ni(`created_at`)]}),s(`th`,{children:e(`mem.col.due`)}),s(`th`,{className:`mem-actions-cell`})]})}),s(`tbody`,{children:w.items.map(t=>{let n=en===t.id,r=t.has_embedding,i=t.sensitive&&!B.has(t.id),a=d(`button`,{type:`button`,className:`mem-about-link`,onClick:e=>{e.stopPropagation(),_i(t)},onKeyDown:e=>e.stopPropagation(),children:[s(Oe,{size:12}),` `,e(`mem.about.showSensitive`)]});return d(C.Fragment,{children:[d(`tr`,{className:`${t.superseded_by?`mem-superseded-row`:``} ${n?`mem-expanded-row`:``}`,onClick:()=>tn(n?null:t.id),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),tn(n?null:t.id))},tabIndex:0,role:`row`,"aria-expanded":n,style:{cursor:`pointer`},children:[s(`td`,{children:s(`span`,{className:`mem-cat-badge ${t.category}`,children:t.category===`error`&&t.source===`error_auto`?e(`mem.cat.errorLearned`):s(O,{value:t.category,keys:At})})}),s(`td`,{children:d(`div`,{className:`mem-content-cell`,title:i?void 0:t.content,children:[r!==void 0&&s(`span`,{className:`mem-embed-dot ${r?`embedded`:`missing`}`,title:e(r?`mem.knowledge.embedded`:`mem.knowledge.embedMissing`),children:s(re,{size:6,fill:`currentColor`})}),t.sensitive&&s(`span`,{className:`mem-sensitive-badge`,title:e(`mem.form.sensitive`),children:s(ct,{size:11})}),i?a:s(`span`,{className:t.superseded_by?`mem-superseded-text`:``,onClick:e=>{t.sensitive&&(e.stopPropagation(),_i(t))},children:s(`bdi`,{children:t.content})})]})}),s(`td`,{children:s(`span`,{className:`mem-date-cell`,children:s(O,{value:t.context,keys:It})})}),s(`td`,{children:t.entity?s(`span`,{className:`mem-entity-link`,onClick:e=>{e.stopPropagation(),un(t.entity),F(0)},title:e(`mem.knowledge.filterBy`,{entity:t.entity}),children:s(`bdi`,{children:t.entity})}):s(`span`,{className:`mem-date-cell`,children:`—`})}),s(`td`,{children:d(`div`,{className:`mem-confidence`,children:[s(`div`,{className:`mem-confidence-bar`,children:s(`div`,{className:`mem-confidence-fill ${Tt(t.confidence)}`,style:{width:`${t.confidence*100}%`}})}),t.confidence.toFixed(2)]})}),s(`td`,{children:s(`span`,{className:`mem-date-cell`,children:t.source?s(O,{value:t.source,keys:mt}):`—`})}),s(`td`,{children:s(`span`,{className:`mem-date-cell`,title:E(t.updated_at,l(e)),children:D(t.updated_at,e)})}),s(`td`,{children:s(`span`,{className:`mem-date-cell`,title:E(t.created_at,l(e)),children:D(t.created_at,e)})}),s(`td`,{children:t.due_at?s(`span`,{className:`mem-due-badge ${wt(t.due_at)?`overdue`:`upcoming`}`,title:E(t.due_at,l(e)),children:D(t.due_at,e)}):s(`span`,{className:`mem-due-badge none`,children:`—`})}),s(`td`,{className:`mem-actions-cell`,children:d(`div`,{className:`mem-row-actions`,onClick:e=>e.stopPropagation(),children:[s(`button`,{className:`mem-row-action-btn`,onClick:()=>gi(t),disabled:i,title:e(i?`mem.about.editHidden`:`mem.row.edit`),children:s(Ae,{size:13})}),s(`button`,{className:`mem-row-action-btn`,onClick:()=>hi(t),title:e(t.sensitive?`mem.row.unmarkSensitive`:`mem.row.markSensitive`),children:t.sensitive?s(ot,{size:13}):s(ct,{size:13})}),s(`button`,{className:`mem-row-action-btn`,onClick:()=>vi(t.id),title:e(`mem.row.copyId`),children:s(ne,{size:13})}),s(`button`,{className:`mem-row-action-btn delete${W===t.id?` is-confirm`:``}`,onClick:()=>mi(t.id),title:e(W===t.id?`mem.row.clickAgain`:`mem.row.delete`),"aria-label":e(W===t.id?`mem.row.confirmDeleteAria`:`mem.row.deleteAria`),children:W===t.id?s(`span`,{className:`mem-row-delete-label`,children:e(`mem.row.deleteConfirm`)}):s(Te,{size:13})})]})})]}),n&&s(`tr`,{className:`mem-detail-row`,children:s(`td`,{colSpan:10,children:d(`div`,{className:`mem-detail-panel`,children:[d(`div`,{className:`mem-detail-grid`,children:[d(`div`,{className:`mem-detail-field`,children:[s(`span`,{className:`mem-detail-label`,children:e(`mem.detail.id`)}),s(`span`,{className:`mem-detail-value`,children:t.id})]}),d(`div`,{className:`mem-detail-field`,children:[s(`span`,{className:`mem-detail-label`,children:e(`mem.detail.domain`)}),s(`bdi`,{className:`mem-detail-value`,children:t.domain||`—`})]}),d(`div`,{className:`mem-detail-field`,children:[s(`span`,{className:`mem-detail-label`,children:e(`mem.col.source`)}),s(`bdi`,{className:`mem-detail-value`,children:t.source||`—`})]}),d(`div`,{className:`mem-detail-field`,children:[s(`span`,{className:`mem-detail-label`,children:e(`mem.detail.useCount`)}),s(`span`,{className:`mem-detail-value`,children:t.use_count??0})]}),d(`div`,{className:`mem-detail-field`,children:[s(`span`,{className:`mem-detail-label`,children:e(`mem.col.created`)}),s(`span`,{className:`mem-detail-value`,children:E(t.created_at,l(e))})]}),d(`div`,{className:`mem-detail-field`,children:[s(`span`,{className:`mem-detail-label`,children:e(`mem.col.updated`)}),s(`span`,{className:`mem-detail-value`,children:E(t.updated_at,l(e))})]}),d(`div`,{className:`mem-detail-field`,children:[s(`span`,{className:`mem-detail-label`,children:e(`mem.detail.lastUsed`)}),s(`span`,{className:`mem-detail-value`,children:E(t.last_used,l(e))})]}),d(`div`,{className:`mem-detail-field`,children:[s(`span`,{className:`mem-detail-label`,children:e(`mem.detail.remindedAt`)}),s(`span`,{className:`mem-detail-value`,children:E(t.reminded_at,l(e))})]}),t.superseded_by&&d(`div`,{className:`mem-detail-field`,children:[s(`span`,{className:`mem-detail-label`,children:e(`mem.detail.supersededBy`)}),s(`span`,{className:`mem-detail-value mem-detail-chain`,children:t.superseded_by})]}),t.metadata&&d(`div`,{className:`mem-detail-field mem-detail-full`,children:[s(`span`,{className:`mem-detail-label`,children:e(`mem.detail.metadata`)}),s(`span`,{className:`mem-detail-value`,children:s(`bdi`,{dir:`ltr`,children:typeof t.metadata==`object`?JSON.stringify(t.metadata,null,2):t.metadata})})]})]}),d(`div`,{className:`mem-detail-content-full`,children:[s(`span`,{className:`mem-detail-label`,children:e(`mem.detail.fullContent`)}),s(`div`,{className:`mem-detail-content-text`,children:i?a:s(`bdi`,{children:t.content})})]})]})})})]},t.id)})})]})}),d(`div`,{className:`mem-pagination`,children:[s(`span`,{children:e(`mem.page.range`,{from:P+1,to:Math.min(P+15,w.total),total:w.total})}),d(`div`,{className:`mem-pagination-btns`,children:[s(`button`,{type:`button`,className:`mem-page-btn`,"aria-label":e(`mem.page.previous`),disabled:P===0,onClick:()=>F(Math.max(0,P-15)),children:s(me,{size:14})}),s(`button`,{type:`button`,className:`mem-page-btn`,"aria-label":e(`mem.page.next`),disabled:P+15>=w.total,onClick:()=>F(P+15),children:s(pe,{size:14})})]})]})]}):d(`div`,{className:`mem-empty`,children:[s(`div`,{className:`mem-empty-icon`,children:s(se,{size:28})}),s(`p`,{children:e(dn||M.length>0||sn||ln?`mem.knowledge.noMatch`:`mem.knowledge.empty`)})]})]}),d(`div`,{className:`mem-two-col`,children:[d(`div`,{className:`mem-section`,children:[d(`div`,{className:`mem-section-title`,children:[s(de,{size:14}),` `,e(`mem.tools.title`),s(`span`,{className:`mem-section-note`,title:e(`mem.tools.noteTitle`),children:e(`mem.tools.note`)})]}),gt.length>0?s(`div`,{style:{overflowX:`auto`},children:d(`table`,{className:`mem-tool-table`,children:[s(`thead`,{children:d(`tr`,{children:[s(`th`,{children:e(`mem.tools.tool`)}),s(`th`,{children:e(`mem.tools.calls`)}),s(`th`,{children:e(`mem.tools.success`)}),s(`th`,{children:e(`mem.tools.denied`)}),s(`th`,{children:e(`mem.tools.avgTime`)}),s(`th`,{children:e(`mem.detail.lastUsed`)}),s(`th`,{children:e(`mem.tools.lastError`)})]})}),s(`tbody`,{children:gt.map(t=>d(`tr`,{children:[s(`td`,{children:s(`bdi`,{className:`mem-tool-name`,children:t.tool_name})}),s(`td`,{children:t.total_calls}),s(`td`,{children:d(`div`,{className:`mem-confidence`,children:[s(`div`,{className:`mem-confidence-bar`,style:{width:40},children:s(`div`,{className:`mem-confidence-fill ${Et(t.success_rate)}`,style:{width:`${t.success_rate*100}%`}})}),d(`span`,{className:`mem-success-rate ${Et(t.success_rate)}`,children:[Math.round(t.success_rate*100),`%`]})]})}),s(`td`,{children:t.denied_count??0}),s(`td`,{children:s(`bdi`,{dir:`ltr`,children:Ct(t.avg_duration_ms)})}),s(`td`,{children:s(`span`,{className:`mem-date-cell`,title:E(t.last_used,l(e)),children:D(t.last_used,e)})}),s(`td`,{children:s(`bdi`,{className:`mem-tool-error`,title:t.last_error||``,children:t.last_error||`—`})})]},t.tool_name))})]})}):d(`div`,{className:`mem-empty`,children:[s(`div`,{className:`mem-empty-icon`,children:s(de,{size:28})}),s(`p`,{children:e(`mem.tools.empty`)})]})]}),d(`div`,{className:`mem-section`,children:[d(`div`,{className:`mem-section-title`,children:[s(be,{size:14}),` `,e(`mem.upcoming.title`)]}),xt.length>0?s(`div`,{className:`mem-temporal-list`,children:xt.map(t=>{let n=wt(t.due_at);return d(`div`,{className:`mem-temporal-item ${n?`overdue`:`upcoming`}`,children:[s(`span`,{className:`mem-temporal-icon`,children:s(n?y:be,{size:16})}),d(`div`,{className:`mem-temporal-content`,children:[s(`div`,{className:`mem-temporal-text`,children:s(`bdi`,{children:t.content})}),d(`div`,{className:`mem-temporal-date`,children:[e(n?`mem.upcoming.overdue`:`mem.upcoming.due`,{when:D(t.due_at,e)}),t.context!==`global`&&d(a.Fragment,{children:[` `,`·`,` `,s(O,{value:t.context,keys:It})]})]})]})]},t.id)})}):d(`div`,{className:`mem-empty`,children:[s(`div`,{className:`mem-empty-icon`,children:s(h,{size:28})}),s(`p`,{children:e(`mem.upcoming.empty`)})]})]})]}),d(`div`,{className:`mem-section`,children:[d(`div`,{className:`mem-section-title`,children:[s(Me,{size:14}),` `,e(`mem.conv.title`)]}),d(`div`,{className:`mem-conv-search`,children:[s(m,{size:13,className:`search-icon`}),s(`input`,{type:`text`,placeholder:e.bare(`mem.conv.searchPlaceholder`),value:vn,onChange:e=>yi(e.target.value),"aria-label":e(`mem.conv.search`)}),vn&&s(`button`,{className:`mem-search-clear`,onClick:()=>{yn(``),xn(null)},"aria-label":e(`mem.conv.clearSearch`),children:s(ae,{size:12})})]}),bn===null?vt.length>0?s(`div`,{className:`mem-conv-list`,children:vt.map(t=>d(`div`,{className:`mem-conv-item`,onClick:()=>bi(t.session_id),children:[d(`div`,{className:`mem-conv-info`,children:[d(`div`,{className:`mem-conv-session-id`,children:[s(`bdi`,{children:st(t.session_id)}),t.consolidated&&s(`span`,{className:`mem-consolidated-badge`,title:e(`mem.conv.consolidated`),children:s(it,{size:11})})]}),t.first_message&&s(`div`,{className:`mem-conv-preview`,children:s(`bdi`,{children:t.first_message})})]}),d(`div`,{className:`mem-conv-meta`,children:[s(`span`,{children:e.plural(`mem.conv.turns`,t.turn_count)}),s(`span`,{children:D(t.last_activity,e)})]})]},t.session_id))}):d(`div`,{className:`mem-empty`,children:[s(`div`,{className:`mem-empty-icon`,children:s(Me,{size:28})}),s(`p`,{children:e(`mem.conv.empty`)})]}):bn.length>0?s(`div`,{className:`mem-conv-list`,children:bn.map(t=>d(`div`,{className:`mem-conv-item`,onClick:()=>bi(t.session_id),children:[d(`div`,{className:`mem-conv-info`,children:[d(`div`,{className:`mem-conv-session-id`,children:[s(`span`,{className:`mem-conv-turn-role ${t.role}`,children:s(O,{value:t.role,keys:Pt})}),` `,s(`bdi`,{children:st(t.session_id)})]}),s(`div`,{className:`mem-conv-preview`,children:s(`bdi`,{children:t.content})})]}),s(`div`,{className:`mem-conv-meta`,children:s(`span`,{children:D(t.timestamp,e)})})]},t.id))}):s(`div`,{className:`mem-empty`,children:s(`p`,{children:e(`mem.conv.noMatch`,{query:vn})})})]}),I&&d(`div`,{className:`mem-conv-detail-overlay`,children:[d(`div`,{className:`mem-conv-detail-header`,children:[s(`h2`,{children:s(`bdi`,{children:st(I.sessionId)})}),d(`div`,{className:`mem-conv-detail-actions`,children:[at.has(I.sessionId)&&s(`button`,{className:`btn-secondary`,onClick:()=>o(I.sessionId),children:e(`mem.conv.openChat`)}),s(`button`,{className:`btn-icon`,onClick:()=>Cn(null),"aria-label":e(`mem.conv.close`),children:s(ae,{size:16})})]})]}),d(`div`,{className:`mem-conv-detail-body`,children:[I.turns.map(t=>d(`div`,{className:`mem-conv-turn`,children:[d(`div`,{className:`mem-conv-turn-header`,children:[s(`div`,{className:`mem-conv-turn-role ${t.role}`,children:s(O,{value:t.role,keys:Pt})}),s(`span`,{className:`mem-conv-turn-time`,title:E(t.timestamp,l(e)),children:D(t.timestamp,e)})]}),s(`div`,{className:`mem-conv-turn-content`,children:s(`bdi`,{children:t.content})})]},t.id)),I.turns.length===0&&s(`div`,{className:`mem-empty`,children:e(`mem.conv.noTurns`)})]})]})]}),d(`div`,{className:`mem-section`,children:[d(`div`,{className:`mem-section-title`,children:[s(ct,{size:14}),` `,e(`mem.settings.title`),` `,s(`span`,{className:`mem-beta`,style:{fontSize:10,fontWeight:500,color:`var(--accent-yellow)`,background:`var(--accent-yellow-dim)`,padding:`1px 6px`,borderRadius:4,marginInlineStart:6,verticalAlign:`middle`},children:e(`mem.beta`)})]}),d(`div`,{className:`mem-setting-row`,children:[d(`div`,{className:`mem-setting-info`,children:[s(`span`,{className:`mem-setting-label`,children:e(`mem.settings.memory`)}),s(`span`,{className:`mem-setting-desc`,children:e(`mem.settings.memoryDesc`)})]}),s(`button`,{className:`mem-toggle${V?` mem-toggle-on`:``}`,disabled:H,onClick:async()=>{if(!V)G(`memory`);else{U(!0);try{let e=await et({memory_enabled:!1});On(e.memory_enabled)}catch(t){i.system.warn(`Failed to disable memory`,t),Y(e(`mem.toast.settingFailed`,{error:k(t)}),`error`)}finally{U(!1)}}},"aria-pressed":V,"aria-label":e(V?`mem.settings.memoryOn`:`mem.settings.memoryOff`),children:s(`span`,{className:`mem-toggle-knob`,"aria-hidden":`true`})})]}),Rn&&(()=>{let t={memory:{title:`mem.beta.memory.title`,description:`mem.beta.memory.desc`,bullets:[`mem.beta.memory.local`,`mem.beta.memory.lost`,`mem.beta.memory.disable`],buttonLabel:`mem.beta.memory.confirm`,onConfirm:async()=>{let t=await et({memory_enabled:!0});On(t.memory_enabled),Y(e(`mem.toast.memoryEnabled`),`info`)}},mcp:{title:`mem.beta.mcp.title`,description:`mem.beta.mcp.desc`,bullets:[`mem.beta.mcp.read`,`mem.beta.mcp.restart`,`mem.beta.mcp.debug`],buttonLabel:`mem.beta.mcp.confirm`,onConfirm:async()=>{let t=await et({mcp_memory_enabled:!0});An(t.mcp_memory_enabled),Y(e(`mem.toast.mcpEnabled`),`info`)}},discovery:{title:`mem.beta.discovery.title`,description:`mem.beta.discovery.desc`,bullets:[`mem.beta.discovery.collects`,`mem.beta.discovery.scans`,`mem.beta.discovery.local`],buttonLabel:`mem.beta.discovery.confirm`,onConfirm:async()=>{let t=await et({system_discovery_consent:!0});if(Mn(t.system_discovery_consent),t.system_context_error)Y(e(`mem.toast.discoveryScanFailed`,{error:t.system_context_error}),`error`);else{let n=t.system_context_refresh?.stored??0;Y(e(`mem.toast.discoveryEnabled`,{n}),`info`)}Q()}}}[Rn];return d(a.Fragment,{children:[s(`div`,{"aria-hidden":`true`,style:{position:`fixed`,inset:0,background:`var(--bg-modal-overlay)`,zIndex:9998,backdropFilter:`blur(4px)`},onClick:()=>G(null)}),d(`div`,{ref:Jr,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`mem-beta-confirm-title`,"aria-describedby":`mem-beta-confirm-desc`,tabIndex:-1,style:{position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,zIndex:9999,background:`var(--bg-card)`,border:`1px solid var(--border)`,borderRadius:12,padding:`28px 32px`,maxWidth:420,width:`90vw`,boxShadow:`var(--shadow-lg)`},children:[d(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,marginBottom:16},children:[s(`span`,{className:`mem-beta`,style:{fontSize:11,fontWeight:500,color:`var(--accent-yellow)`,background:`var(--accent-yellow-dim)`,padding:`3px 10px`,borderRadius:4},children:e(`mem.beta`)}),s(`h2`,{id:`mem-beta-confirm-title`,style:{fontSize:16,fontWeight:500,color:`var(--text-primary)`},children:e(t.title)})]}),s(`p`,{id:`mem-beta-confirm-desc`,style:{fontSize:13,lineHeight:1.6,color:`var(--text-secondary)`,margin:`0 0 8px`},children:e(t.description)}),s(`ul`,{style:{fontSize:13,lineHeight:1.7,color:`var(--text-secondary)`,margin:`0 0 24px`,paddingInlineStart:20},children:t.bullets.map(t=>s(`li`,{children:e(t)},t))}),d(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:10},children:[s(`button`,{className:`btn-secondary`,onClick:()=>G(null),style:{padding:`8px 20px`,fontSize:13,borderRadius:6},children:e(`mem.cancel`)}),s(`button`,{disabled:H,onClick:async()=>{U(!0);try{await t.onConfirm()}catch(t){i.system.warn(`Failed to update setting`,t),Y(e(`mem.toast.settingFailed`,{error:k(t)}),`error`)}finally{U(!1),G(null)}},style:{padding:`8px 24px`,fontSize:13,fontWeight:500,borderRadius:6,border:`none`,cursor:`pointer`,background:`var(--accent-fill)`,color:`var(--accent-fill-text)`},children:e(t.buttonLabel)})]})]})]})})(),Kt&&d(a.Fragment,{children:[d(`div`,{className:`mem-setting-row`,children:[d(`div`,{className:`mem-setting-info`,children:[s(`span`,{className:`mem-setting-label`,children:e(`mem.settings.mcp`)}),s(`span`,{className:`mem-setting-desc`,children:e(`mem.settings.mcpDesc`)})]}),s(`button`,{className:`mem-toggle${kn?` mem-toggle-on`:``}`,disabled:H,onClick:async()=>{if(!kn)G(`mcp`);else{U(!0);try{let e=await et({mcp_memory_enabled:!1});An(e.mcp_memory_enabled)}catch(t){i.system.warn(`Failed to update memory settings`,t),Y(e(`mem.toast.settingFailed`,{error:k(t)}),`error`)}finally{U(!1)}}},"aria-label":e(`mem.settings.mcpToggle`),"aria-pressed":kn,children:s(`span`,{className:`mem-toggle-knob`,"aria-hidden":`true`})})]}),d(`div`,{className:`mem-setting-row`,children:[d(`div`,{className:`mem-setting-info`,children:[s(`span`,{className:`mem-setting-label`,children:e(`mem.settings.discovery`)}),s(`span`,{className:`mem-setting-desc`,children:e(`mem.settings.discoveryDesc`)})]}),s(`button`,{className:`mem-toggle${jn?` mem-toggle-on`:``}`,disabled:H,onClick:async()=>{if(!jn)G(`discovery`);else{U(!0);try{let e=await et({system_discovery_consent:!1});Mn(e.system_discovery_consent)}catch(t){i.system.warn(`Failed to update system discovery setting`,t),Y(e(`mem.toast.settingFailed`,{error:k(t)}),`error`)}finally{U(!1)}}},"aria-label":e(`mem.settings.discoveryToggle`),"aria-pressed":jn,children:s(`span`,{className:`mem-toggle-knob`,"aria-hidden":`true`})})]}),d(`div`,{className:`mem-setting-row mem-setting-row-danger`,children:[d(`div`,{className:`mem-setting-info`,children:[s(`span`,{className:`mem-setting-label`,children:e(`mem.settings.reinit`)}),s(`span`,{className:`mem-setting-desc`,children:e(`mem.settings.reinitDesc`)})]}),In?d(`div`,{className:`mem-delete-confirm`,children:[s(`span`,{className:`mem-delete-confirm-label`,children:e(`mem.settings.sure`)}),s(`button`,{className:`mem-btn-danger`,disabled:H,onClick:async()=>{U(!0);try{let t=await Ge();t.system_context.error?Y(e(`mem.toast.server`,{message:t.system_context.error}),`error`):Y(e(`mem.toast.reinitialized`,{cleared:t.cleared.knowledge,stored:t.system_context.stored}),`info`),Q()}catch(t){i.system.warn(`Failed to reinitialize memory`,t),Y(e(`mem.toast.reinitFailed`,{error:k(t)}),`error`)}finally{U(!1),Ln(!1)}},children:e(`mem.settings.reinitConfirm`)}),s(`button`,{className:`btn-secondary`,onClick:()=>Ln(!1),style:{padding:`6px 14px`,fontSize:12},children:e(`mem.cancel`)})]}):s(`button`,{className:`mem-btn-danger`,disabled:H,onClick:()=>Ln(!0),children:e(`mem.settings.reinitButton`)})]}),d(`div`,{className:`mem-setting-row mem-setting-row-danger`,children:[d(`div`,{className:`mem-setting-info`,children:[s(`span`,{className:`mem-setting-label`,children:e(`mem.settings.deleteAll`)}),s(`span`,{className:`mem-setting-desc`,children:e(`mem.settings.deleteAllDesc`)})]}),Nn?d(`div`,{className:`mem-delete-confirm`,children:[s(`span`,{className:`mem-delete-confirm-label`,children:e(`mem.settings.sure`)}),s(`button`,{className:`mem-btn-danger`,disabled:H,onClick:async()=>{U(!0);try{let t=await nt();Y(e(`mem.toast.cleared`,{knowledge:t.knowledge,conversations:t.conversations}),`info`),Q()}catch(t){i.system.warn(`Failed to clear memory`,t),Y(e(`mem.toast.clearFailed`,{error:k(t)}),`error`)}finally{U(!1),Pn(!1)}},children:e(`mem.settings.deleteConfirm`)}),s(`button`,{className:`btn-secondary`,onClick:()=>Pn(!1),style:{padding:`6px 14px`,fontSize:12},children:e(`mem.cancel`)})]}):s(`button`,{className:`mem-btn-danger`,disabled:H,onClick:()=>Pn(!0),children:e(`mem.settings.deleteButton`)})]})]})]}),Kt&&x&&d(`div`,{className:`mem-db-footer`,children:[d(`span`,{children:[e(`mem.footer.database`),`: `,s(`bdi`,{dir:`ltr`,children:ye(x.db_size_bytes)}),x.knowledge?.avg_confidence!=null&&d(a.Fragment,{children:[` · `,e(`mem.footer.avgConfidence`,{n:x.knowledge.avg_confidence.toFixed(2)})]})]}),d(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[x.knowledge?.entity_count!=null&&x.knowledge.entity_count>0&&s(`span`,{children:e(`mem.footer.entities`,{n:x.knowledge.entity_count})}),x.knowledge?.sensitive_count!=null&&x.knowledge.sensitive_count>0&&d(`span`,{children:[s(ct,{size:10}),` `,e(`mem.footer.sensitive`,{n:x.knowledge.sensitive_count})]})]})]})]})}),K===`profile`&&!A.supports.profile&&s(`p`,{className:`mem-store-only`,role:`note`,children:e(`mem.store.pythonOnly.profile`,{name:Rt})}),K===`profile`&&A.supports.profile&&d(`div`,{className:`mem-profile-grid`,children:[s(`p`,{className:`mem-tab-intro`,children:e(`mem.profile.intro`)}),d(`div`,{className:`mem-profile-card`,children:[d(`div`,{className:`mem-profile-card-title`,children:[s(ve,{size:16}),` `,e(`mem.disc.title`)]}),s(`p`,{className:`mem-profile-desc`,children:e(`mem.disc.desc`)}),s(`button`,{className:`btn-primary mem-profile-run-btn`,disabled:q===`running`||q===`saving`,onClick:ki,children:q===`running`?d(a.Fragment,{children:[s(`div`,{className:`mem-spinner-sm`}),` `,e(`mem.running`)]}):e(`mem.disc.run`)}),dr.length>0&&s(`div`,{className:`mem-log`,ref:yr,children:dr.map((e,t)=>s(`div`,{className:`mem-log-line ${e.kind}`,children:e.server?s(`bdi`,{children:e.text}):e.text},t))}),(q===`review`||q===`saving`||q===`done`)&&pr.length>0&&d(`div`,{className:`mem-review-section`,children:[s(`div`,{className:`mem-review-header`,children:e(`mem.review.title`)}),s(`div`,{className:`mem-review-list`,children:pr.map((t,n)=>d(`label`,{className:`mem-review-item`,children:[s(`input`,{type:`checkbox`,checked:t._checked,disabled:q===`saving`||q===`done`,onChange:()=>{mr(e=>e.map((e,t)=>t===n?{...e,_checked:!e._checked}:e))}}),t.sensitive&&!_r.has(n)?s(`span`,{className:`mem-review-content`,children:d(`button`,{type:`button`,className:`mem-about-link`,onClick:e=>{e.preventDefault(),vr(e=>new Set(e).add(n))},children:[s(Oe,{size:12}),` `,e(`mem.about.showSensitive`)]})}):s(`bdi`,{className:`mem-review-content`,children:t.content}),s(`span`,{className:`mem-source-badge`,children:t._source_name?s(`bdi`,{children:t._source_name}):s(O,{value:t.category,keys:At})}),d(`span`,{className:`mem-conf-badge`,children:[Math.round(t.confidence*100),`%`]})]},n))}),d(`div`,{className:`mem-review-actions`,children:[s(`button`,{className:`btn-primary`,disabled:q===`saving`||q===`done`||pr.filter(e=>e._checked).length===0,onClick:Ai,children:q===`saving`?d(a.Fragment,{children:[s(`div`,{className:`mem-spinner-sm`}),` `,e(`mem.saving`)]}):e(`mem.review.saveSelected`,{n:pr.filter(e=>e._checked).length})}),d(`span`,{className:`mem-review-select-links`,children:[s(`button`,{type:`button`,className:`mem-link-btn`,onClick:()=>mr(e=>e.map(e=>({...e,_checked:!0}))),children:e(`mem.review.selectAll`)}),` / `,s(`button`,{type:`button`,className:`mem-link-btn`,onClick:()=>mr(e=>e.map(e=>({...e,_checked:!1}))),children:e(`mem.review.none`)})]})]})]}),q===`done`&&hr!==null&&d(`div`,{className:`mem-profile-success`,children:[s(h,{size:14}),` `,e(`mem.disc.saved`,{n:hr})]}),q===`review`&&pr.length===0&&s(`div`,{className:`mem-profile-empty`,children:e(`mem.disc.empty`)})]}),d(`div`,{className:`mem-profile-card`,children:[d(`div`,{className:`mem-profile-card-title`,children:[s(b,{size:16}),` `,e(`mem.inf.title`)]}),s(`p`,{className:`mem-profile-desc`,children:e(`mem.inf.desc`)}),s(`p`,{className:`mem-profile-note`,children:e(`mem.inf.note`)}),d(`label`,{className:`mem-profile-checkbox`,children:[s(`input`,{type:`checkbox`,checked:Or,onChange:e=>kr(e.target.checked),disabled:J===`running`||J===`saving`}),e(`mem.inf.browser`)]}),s(`button`,{className:`btn-primary mem-profile-run-btn`,disabled:J===`running`||J===`saving`,onClick:ji,children:J===`running`?d(a.Fragment,{children:[s(`div`,{className:`mem-spinner-sm`}),` `,e(`mem.running`)]}):e(`mem.inf.run`)}),Sr.length>0&&s(`div`,{className:`mem-log`,ref:Ar,children:Sr.map((e,t)=>s(`div`,{className:`mem-log-line ${e.kind}`,children:e.server?s(`bdi`,{children:e.text}):e.text},t))}),(J===`review`||J===`saving`||J===`done`)&&wr.length>0&&d(`div`,{className:`mem-review-section`,children:[s(`div`,{className:`mem-review-header`,children:e(`mem.review.title`)}),s(`div`,{className:`mem-review-list`,children:wr.map((e,t)=>d(`label`,{className:`mem-review-item`,children:[s(`input`,{type:`checkbox`,checked:e._checked,disabled:J===`saving`||J===`done`,onChange:()=>{Tr(e=>e.map((e,n)=>n===t?{...e,_checked:!e._checked}:e))}}),s(`bdi`,{className:`mem-review-content`,children:e.content}),s(`span`,{className:`mem-domain-badge ${Lt[e.domain]||`gray`}`,children:s(O,{value:e.domain,keys:Ft})}),d(`span`,{className:`mem-conf-badge`,children:[Math.round(e.confidence*100),`%`]})]},t))}),d(`div`,{className:`mem-review-actions`,children:[s(`button`,{className:`btn-primary`,disabled:J===`saving`||J===`done`||wr.filter(e=>e._checked).length===0,onClick:Mi,children:J===`saving`?d(a.Fragment,{children:[s(`div`,{className:`mem-spinner-sm`}),` `,e(`mem.saving`)]}):e(`mem.review.saveSelected`,{n:wr.filter(e=>e._checked).length})}),d(`span`,{className:`mem-review-select-links`,children:[s(`button`,{type:`button`,className:`mem-link-btn`,onClick:()=>Tr(e=>e.map(e=>({...e,_checked:!0}))),children:e(`mem.review.selectAll`)}),` / `,s(`button`,{type:`button`,className:`mem-link-btn`,onClick:()=>Tr(e=>e.map(e=>({...e,_checked:!1}))),children:e(`mem.review.none`)})]})]})]}),J===`done`&&Er!==null&&d(`div`,{className:`mem-profile-success`,children:[s(h,{size:14}),` `,e(`mem.inf.saved`,{n:Er})]}),J===`review`&&wr.length===0&&s(`div`,{className:`mem-profile-empty`,children:e(`mem.inf.empty`)})]})]}),K===`goals`&&!A.supports.goals&&s(`p`,{className:`mem-store-only`,role:`note`,children:e(`mem.store.pythonOnly.goals`,{name:Rt})}),K===`goals`&&A.supports.goals&&d(`div`,{className:`mem-goals-tab`,children:[s(`p`,{className:`mem-tab-intro`,children:e(`mem.goals.intro`,{name:t(`chat.title.goals`)})}),Jn&&(Yn?d(`div`,{className:`mem-advanced-error`,role:`alert`,children:[s(y,{size:14}),` `,e(`mem.goals.storeDamaged`),` `,s(`button`,{type:`button`,className:`link-btn`,disabled:er,onClick:si,children:e(`mem.goals.startNewList`)})]}):d(`div`,{className:`mem-advanced-error`,role:`alert`,children:[s(y,{size:14}),` `,e(`mem.goals.storeError`),`: `,s(`bdi`,{children:Jn})]})),s(`div`,{className:`mem-goals-stats-row`,children:[`queued`,`in_progress`,`completed`,`failed`].map(t=>d(`div`,{className:`mem-goals-stat-pill mem-goal-status-${t.replace(`_`,`-`)}`,children:[s(`span`,{className:`mem-goals-stat-n`,children:Wn?.goals[t]??0}),s(`span`,{className:`mem-goals-stat-label`,children:e(jt[t])})]},t))}),Hn.filter(e=>e.status===`pending_approval`).length>0&&d(`div`,{className:`mem-goals-approval-banner`,children:[d(`div`,{className:`mem-goals-approval-title`,children:[s(Ce,{size:14}),` `,e(`mem.goals.suggested`,{n:Hn.filter(e=>e.status===`pending_approval`).length})]}),Hn.filter(e=>e.status===`pending_approval`).map(t=>d(`div`,{className:`mem-goals-approval-item`,children:[d(`div`,{className:`mem-goals-approval-text`,children:[s(`strong`,{children:s(`bdi`,{children:t.title})}),s(`bdi`,{children:t.description})]}),d(`div`,{className:`mem-goals-approval-actions`,children:[s(`button`,{className:`btn-danger-sm`,onClick:()=>ai(()=>Ve(t.id),`mem.goals.rejectFailed`),children:e(`mem.goals.reject`)}),s(`button`,{className:`btn-secondary`,onClick:()=>ai(()=>fe(t.id),`mem.goals.acceptFailed`),children:e(`mem.goals.accept`)})]})]},t.id))]}),s(`div`,{className:`mem-goals-toolbar`,children:d(`button`,{className:`btn-primary`,onClick:()=>{$n(null),sr(e=>!e)},children:[s(qe,{size:14}),` `,e(`mem.goals.new`)]})}),or&&d(`div`,{className:`mem-goals-add-form`,children:[s(`input`,{className:`mem-input`,placeholder:e(`mem.goals.titlePlaceholder`),value:cr.title,onChange:e=>lr(t=>({...t,title:e.target.value}))}),s(`textarea`,{className:`mem-input`,placeholder:e(`mem.goals.descPlaceholder`),rows:2,value:cr.description,onChange:e=>lr(t=>({...t,description:e.target.value}))}),d(`div`,{className:`mem-goals-form-row`,children:[d(`select`,{className:`mem-select`,value:cr.priority,onChange:e=>lr(t=>({...t,priority:e.target.value})),children:[s(`option`,{value:`low`,children:e.bare(`mem.goals.priorityLow`)}),s(`option`,{value:`medium`,children:e.bare(`mem.goals.priorityMedium`)}),s(`option`,{value:`high`,children:e.bare(`mem.goals.priorityHigh`)})]}),s(`button`,{className:`btn-primary`,disabled:!cr.title.trim(),onClick:oi,children:e(`mem.goals.create`)}),s(`button`,{className:`btn-secondary`,onClick:()=>{$n(null),sr(!1)},children:e(`mem.cancel`)})]}),Qn&&s(`p`,{className:`mem-form-error`,role:`alert`,children:s(`bdi`,{children:Qn})})]}),Kn?d(`div`,{className:`mem-loading`,children:[s(`div`,{className:`mem-spinner`}),` `,e(`mem.goals.loading`)]}):Xn?d(`p`,{className:`mem-form-error`,role:`alert`,children:[e(`mem.goals.loadFailed`),` `,s(`bdi`,{children:Xn})]}):Hn.filter(e=>e.status!==`pending_approval`&&e.status!==`rejected`).length===0?d(`div`,{className:`mem-empty`,children:[s(`div`,{className:`mem-empty-icon`,children:s(lt,{size:32})}),s(`p`,{children:e(`mem.goals.empty`)})]}):s(`div`,{className:`mem-goals-list`,children:Hn.filter(e=>e.status!==`pending_approval`&&e.status!==`rejected`).map(t=>d(`div`,{className:`mem-goal-card mem-goal-status-${t.status.replace(`_`,`-`)}`,children:[d(`div`,{className:`mem-goal-header`,role:`button`,tabIndex:0,"aria-expanded":nr===t.id,onClick:()=>rr(e=>e===t.id?null:t.id),onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),rr(e=>e===t.id?null:t.id))},children:[d(`div`,{className:`mem-goal-header-left`,children:[s(`span`,{className:`mem-goal-status-dot status-${t.status.replace(`_`,`-`)}`}),s(`bdi`,{className:`mem-goal-title`,children:t.title}),s(`span`,{className:`mem-goal-priority mem-priority-${t.priority}`,children:s(O,{value:t.priority,keys:Mt})}),(t.status===`cancelled`||t.status===`failed`)&&s(`span`,{className:`mem-goal-priority mem-goal-${t.status}-label`,children:e(jt[t.status])}),t.source!==`user`&&d(`span`,{className:`mem-goal-source-badge`,children:[s(Ce,{size:10}),` `,s(O,{value:t.source,keys:Nt})]})]}),d(`div`,{className:`mem-goal-header-right`,children:[d(`span`,{className:`mem-goal-task-count`,children:[s(Qe,{size:12}),d(`bdi`,{dir:`ltr`,children:[t.tasks.filter(e=>e.status===`completed`).length,`/`,t.tasks.length]})]}),t.status===`queued`&&s(`button`,{className:`mem-goal-action-btn mem-goal-cancel-btn`,onClick:e=>{e.stopPropagation(),ai(()=>_(t.id),`mem.goals.cancelFailed`)},children:e(`mem.cancel`)}),t.status===`failed`&&s(`button`,{className:`mem-goal-action-btn mem-goal-retry-btn`,onClick:e=>{e.stopPropagation(),ai(()=>Le(t.id),`mem.goals.retryFailed`)},children:e(`mem.goals.retry`)}),ir===t.id?s(`button`,{className:`mem-goal-action-btn mem-goal-delete-btn mem-goal-delete-confirm`,onClick:e=>{e.stopPropagation(),ar(null),ai(()=>ie(t.id),`mem.goals.deleteFailed`)},children:e(`mem.row.deleteConfirm`)}):s(`button`,{className:`mem-goal-action-btn mem-goal-delete-btn`,"aria-label":e(`mem.goals.deleteAria`,{title:t.title}),onClick:e=>{e.stopPropagation(),ar(t.id)},children:s(Te,{size:12})}),s(he,{size:14,className:nr===t.id?`mem-chevron-open`:``})]})]}),nr===t.id&&d(`div`,{className:`mem-goal-body`,children:[t.description&&s(`p`,{className:`mem-goal-desc`,children:s(`bdi`,{children:t.description})}),t.progress_notes&&s(`p`,{className:`mem-goal-progress`,children:s(`bdi`,{children:t.progress_notes})}),t.tasks.length>0?s(`div`,{className:`mem-task-list`,children:t.tasks.map(e=>d(`div`,{className:`mem-task-row mem-task-status-${e.status}`,children:[s(`span`,{className:`mem-task-dot status-${e.status}`}),s(`bdi`,{className:`mem-task-desc`,children:e.description}),s(`span`,{className:`mem-task-status-label`,children:s(O,{value:e.status,keys:jt})}),e.result&&s(`bdi`,{className:`mem-task-result`,children:e.result})]},e.id))}):t.status===`queued`||t.status===`in_progress`?s(`p`,{className:`mem-goal-no-tasks`,children:e(`mem.goals.noTasks`)}):null]})]},t.id))})]})]})]}),nn.length>0&&s(`div`,{className:`mem-toast-container`,"aria-live":`polite`,children:nn.map(e=>d(`div`,{className:`mem-toast mem-toast-${e.type}`,role:`status`,children:[e.type===`success`&&s(h,{size:14}),e.type===`error`&&s(y,{size:14}),e.type===`info`&&s(se,{size:14}),s(`span`,{children:e.text})]},e.id))})]})}export{zt as MemoryDashboard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{c as t,ki as n,l as r,lt as i,ot as a,pt as o,s,u as c}from"./useFocusTrap-DEJ5balb.js";import{Cn as l,Fn as u,Lt as d,f,ln as p,vn as m}from"./index-DD59wPO3.js";var h=e(n(),1);function ee(){return o(`GET`,`/messaging/discord`)}function g(e){return o(`POST`,`/messaging/discord/connect`,{token:e},i)}function _(e=!1){return o(`POST`,`/messaging/discord/start`,{take_over:e},i)}function te(){return o(`POST`,`/messaging/discord/stop`,void 0,i)}function v(){return o(`POST`,`/messaging/discord/restart`,void 0,i)}function ne(){return o(`POST`,`/messaging/discord/forget-always`,void 0,i)}function y(){return o(`POST`,`/messaging/discord/pair`,void 0,i)}function re(){return o(`POST`,`/messaging/discord/disconnect`,void 0,i)}var ie=3e3,b=new Set([`starting`,`pairing`,`connected`]),x=new Set([`error`,`taken_over`,`token_invalid`,`credentials_unavailable`,`conflict`]),S=new Set([`error`,`credentials_unavailable`]),C={newApp:`New Application`,create:`Create`,bot:`Bot`,reset:`Reset Token`,copy:`Copy`,publicBot:`Public Bot`,message:`Message`,createOwn:`Create My Own`,forFriends:`For me and my friends`};function w(e){return e instanceof a?e.detail||e.message:e instanceof Error?e.message:String(e)}function T(e){return e.length===8?`${e.slice(0,4)}-${e.slice(4)}`:e}function E({href:e,children:t,primary:n}){return c(`a`,{className:`${n?`btn-primary`:`btn-secondary`} messaging-link`,href:e,target:`_blank`,rel:`noopener noreferrer`,children:[t,r(m,{size:13,"aria-hidden":`true`,className:`messaging-link-icon`})]})}function D({n:e,title:t,children:n}){return c(`li`,{className:`messaging-step`,children:[r(`span`,{className:`messaging-step-number`,"aria-hidden":`true`,children:r(`bdi`,{dir:`ltr`,children:e})}),c(`div`,{className:`messaging-step-body`,children:[r(`h4`,{className:`settings-label`,children:t}),n]})]})}function O(){let e=s(),[n,i]=(0,h.useState)(null),[a,o]=(0,h.useState)(null),[m,O]=(0,h.useState)(null),[k,A]=(0,h.useState)(null),[j,M]=(0,h.useState)(``),[N,P]=(0,h.useState)(!1),[F,I]=(0,h.useState)(!1),[L,R]=(0,h.useState)(null),[z,B]=(0,h.useState)(!1),V=(0,h.useRef)(!1),H=(0,h.useCallback)(e=>{V.current&&e.paired&&e.state===`connected`&&I(!0),V.current=e.state===`pairing`,i(e)},[]),U=(0,h.useCallback)(()=>{ee().then(e=>{o(null),H(e)}).catch(e=>o(w(e)))},[H]);(0,h.useEffect)(U,[U]);let W=n!==null&&b.has(n.state);(0,h.useEffect)(()=>{if(W)return d(U,ie)},[W,U]);let G=async(e,t)=>{O(e),A(null),I(!1);try{H(await t())}catch(e){A(w(e))}finally{O(null)}},K=async()=>{O(`connect`),A(null);try{let e=await g(j.trim());M(``),P(e.connect.bot_public),H(e.status)}catch(e){A(w(e))}finally{O(null)}},q=e=>{navigator.clipboard.writeText(e).then(()=>R({code:e,ok:!0}),()=>R({code:e,ok:!1}))},J=e=>m===e&&r(p,{size:13,className:`spin`,"aria-hidden":`true`});if(!n)return c(`div`,{className:`settings-pane`,children:[r(`h2`,{className:`settings-pane-title`,children:e(`settings.section.messaging`)}),a?c(`div`,{className:`settings-card`,children:[r(`p`,{className:`settings-error`,role:`alert`,children:e(`settings.messaging.loadFailed`,{error:a})}),r(`button`,{type:`button`,className:`btn-secondary`,onClick:U,children:e(`settings.messaging.retry`)})]}):c(`p`,{className:`settings-hint`,children:[r(p,{size:13,className:`spin`}),` `,e(`settings.loading`)]})]});let Y=n,X=!Y.connected||Y.state===`token_invalid`||Y.state===`conflict`,ae=Y.connected&&!X&&(Y.state===`pairing`||Y.state===`connected`&&!Y.paired),oe=Y.connected&&Y.paired&&Y.state===`connected`,Z=L&&L.code===Y.pairing_code?L:null,se=c(`ol`,{className:`messaging-steps`,children:[c(D,{n:1,title:e(`settings.messaging.step1.title`),children:[c(`ol`,{className:`messaging-substeps settings-hint`,children:[r(`li`,{children:e(`settings.messaging.step1.a`,{label:C.newApp})}),r(`li`,{children:e(`settings.messaging.step1.b`,{label:C.create})}),r(`li`,{children:e(`settings.messaging.step1.c`,{label:C.bot})}),r(`li`,{children:e(`settings.messaging.step1.d`,{reset:C.reset,copy:C.copy})})]}),r(`p`,{className:`settings-hint`,children:e(`settings.messaging.step1.noIntents`)}),r(`div`,{className:`settings-row`,children:r(E,{href:Y.portal_url,children:e(`settings.messaging.openPortal`)})})]}),c(D,{n:2,title:e(`settings.messaging.step2.title`),children:[c(`form`,{className:`settings-row`,onSubmit:e=>{e.preventDefault(),j.trim()&&!m&&K()},children:[r(`input`,{type:`password`,className:`settings-input`,"aria-label":e(`settings.messaging.tokenLabel`),placeholder:e(`settings.messaging.tokenPlaceholder`),autoComplete:`off`,spellCheck:!1,value:j,onChange:e=>M(e.target.value),disabled:m!==null}),c(`button`,{type:`submit`,className:`btn-primary`,disabled:!j.trim()||m!==null,children:[J(`connect`),e(m===`connect`?`settings.messaging.connecting`:`settings.messaging.connect`)]})]}),m===`connect`&&r(`p`,{className:`settings-hint`,children:e(`settings.messaging.connectingHint`)})]})]}),ce=c(`ol`,{className:`messaging-steps`,start:3,children:[c(D,{n:3,title:e(`settings.messaging.step3.title`),children:[r(`p`,{className:`settings-hint`,children:e(`settings.messaging.step3.why`)}),r(`p`,{className:`settings-hint`,children:e(`settings.messaging.step3.how`,{own:C.createOwn,friends:C.forFriends})}),r(`div`,{className:`settings-row`,children:r(E,{href:Y.invite_url,children:e(`settings.messaging.openInvite`)})}),r(`p`,{className:`settings-note`,children:e(`settings.messaging.step3.safe`)})]}),c(D,{n:4,title:e(`settings.messaging.step4.title`),children:[Y.pairing_code?c(`div`,{className:`messaging-code-row`,children:[r(`bdi`,{dir:`ltr`,className:`messaging-code`,"data-testid":`discord-pairing-code`,children:T(Y.pairing_code)}),c(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>q(Y.pairing_code),children:[Z?.ok?r(u,{size:13,"aria-hidden":`true`}):r(l,{size:13,"aria-hidden":`true`}),Z?.ok?e(`settings.messaging.copied`):e(`settings.messaging.copy`)]})]}):c(`p`,{className:`settings-hint`,children:[r(p,{size:13,className:`spin`}),` `,e(`settings.messaging.waitingCode`)]}),Z&&!Z.ok&&r(`p`,{className:`settings-error`,role:`alert`,children:e(`settings.messaging.copyFailed`)}),Y.bot_profile_url&&r(`div`,{className:`settings-row`,children:r(E,{href:Y.bot_profile_url,children:e(`settings.messaging.openBot`)})}),r(`p`,{className:`settings-hint`,children:e(`settings.messaging.step4.hint`,{label:C.message})}),r(`p`,{className:`settings-note`,children:e(`settings.messaging.step4.onlyYou`)})]})]}),le=(()=>{switch(Y.state){case`stopped`:case`error`:return c(`button`,{type:`button`,className:`btn-primary`,disabled:m!==null,onClick:()=>G(`start`,()=>_()),children:[J(`start`),e(`settings.messaging.start`)]});case`credentials_unavailable`:return c(`button`,{type:`button`,className:`btn-primary`,disabled:m!==null,onClick:()=>G(`start`,()=>_()),children:[J(`start`),e(`settings.messaging.retry`)]});case`taken_over`:return c(`button`,{type:`button`,className:`btn-primary`,disabled:m!==null,onClick:()=>G(`takeOver`,()=>_(!0)),children:[J(`takeOver`),e(`settings.messaging.takeOver`)]});default:return null}})(),Q=Y.state===`starting`||m===`start`||m===`takeOver`,$={stopped:e(Y.autostart?`settings.messaging.state.crashed`:`settings.messaging.state.stopped`),error:e(`settings.messaging.state.error`),taken_over:e(`settings.messaging.state.takenOver`),token_invalid:e(`settings.messaging.state.tokenInvalid`),credentials_unavailable:e(`settings.messaging.state.credentials`),conflict:e(`settings.messaging.state.conflict`)};return c(`div`,{className:`settings-pane`,children:[r(`h2`,{className:`settings-pane-title`,children:e(`settings.section.messaging`)}),c(`section`,{className:`settings-card messaging-card`,"aria-label":e(`settings.messaging.discord`),children:[c(`div`,{className:`settings-row settings-row-between`,children:[r(`h3`,{className:`settings-label messaging-card-title`,children:e(`settings.messaging.discord`)}),Y.connected&&Y.bot_name&&c(`span`,{className:`settings-hint`,children:[e(`settings.messaging.botIs`),` `,r(`bdi`,{children:Y.bot_name})]})]}),!Y.connected&&c(t.Fragment,{children:[r(`p`,{className:`settings-pane-lede`,children:e(`settings.messaging.pitch`)}),r(`p`,{className:`settings-hint`,children:e(`settings.messaging.onlyYou`)})]}),$[Y.state]&&Y.connected&&!Q&&c(`div`,{className:x.has(Y.state)||Y.state===`stopped`&&Y.autostart?`settings-notice`:`messaging-status`,children:[r(`p`,{children:$[Y.state]}),S.has(Y.state)&&Y.detail&&r(`p`,{className:`settings-hint`,children:r(`bdi`,{dir:`auto`,children:Y.detail})}),le]}),!Y.connected&&Y.state===`conflict`&&r(`div`,{className:`settings-notice`,children:r(`p`,{children:e(`settings.messaging.state.conflict`)})}),Y.connected&&Q&&c(`p`,{className:`settings-hint`,role:`status`,children:[r(p,{size:13,className:`spin`}),` `,e(`settings.messaging.starting`)]}),X&&se,ae&&c(t.Fragment,{children:[r(`p`,{className:`settings-hint`,children:e(`settings.messaging.pairingLede`)}),ce,N&&Y.bot_page_url&&c(`div`,{className:`settings-notice`,children:[r(`p`,{children:e(`settings.messaging.publicTip`,{label:C.publicBot})}),r(E,{href:Y.bot_page_url,children:e(`settings.messaging.openBotPage`)})]}),Y.state===`connected`&&!Y.paired&&c(`button`,{type:`button`,className:`btn-primary`,disabled:m!==null,onClick:()=>G(`pair`,y),children:[J(`pair`),e(`settings.messaging.showCode`)]})]}),oe&&c(t.Fragment,{children:[F&&r(`p`,{className:`settings-ok`,role:`status`,children:e(`settings.messaging.paired`)}),c(`p`,{className:`messaging-answering`,children:[r(`span`,{className:`settings-key-status settings-ok`}),c(`span`,{className:`messaging-answering-text`,children:[r(`span`,{children:e(`settings.messaging.answering`,{owner:Y.owner_name,bot:Y.bot_name})}),Y.model&&r(`bdi`,{className:`settings-hint messaging-model`,children:Y.model})]})]}),r(`p`,{className:`settings-hint`,children:e(`settings.messaging.answeringHint`)}),c(`div`,{className:`settings-row`,children:[Y.bot_profile_url&&r(E,{href:Y.bot_profile_url,primary:!0,children:e(`settings.messaging.openInDiscord`)}),c(`button`,{type:`button`,className:`btn-secondary`,disabled:m!==null,onClick:()=>G(`stop`,te),children:[J(`stop`),e(`settings.messaging.stop`)]}),c(`button`,{type:`button`,className:`btn-secondary`,disabled:m!==null,onClick:()=>G(`restart`,v),children:[J(`restart`),e(`settings.messaging.restart`)]}),c(`button`,{type:`button`,className:`btn-secondary`,disabled:m!==null,onClick:()=>G(`pair`,y),children:[J(`pair`),e(`settings.messaging.pairOther`)]})]})]}),Y.connected&&(Y.always_allowed?.length??0)>0&&c(`div`,{className:`messaging-status`,children:[r(`p`,{children:e(`settings.messaging.alwaysAllowed`)}),r(`ul`,{className:`settings-hint messaging-always-list`,children:Y.always_allowed.map(e=>r(`li`,{children:r(`bdi`,{dir:`auto`,children:e})},e))}),r(`div`,{className:`settings-row`,children:c(`button`,{type:`button`,className:`btn-secondary`,disabled:m!==null,onClick:()=>G(`forget`,ne),children:[J(`forget`),e(`settings.messaging.forgetAlways`)]})})]}),k&&r(`p`,{className:`settings-error`,role:`alert`,children:r(`bdi`,{dir:`auto`,children:k})}),Y.connected&&r(`div`,{className:`messaging-footer`,children:c(`button`,{type:`button`,className:`btn-danger`,disabled:m!==null,onClick:()=>B(!0),children:[J(`disconnect`),e(`settings.messaging.disconnect`)]})})]}),z&&r(f,{title:e(`settings.messaging.disconnectTitle`),confirmLabel:e(`settings.messaging.disconnect`),cancelLabel:e(`settings.messaging.cancel`),danger:!0,onConfirm:()=>{B(!1),G(`disconnect`,re)},onCancel:()=>B(!1),children:r(`p`,{children:e(`settings.messaging.disconnectBody`)})})]})}export{O as MessagingSettings};
|
|
@@ -1 +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:500}.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:500}.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)}.
|
|
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:500}.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:500}.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)}.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:500}.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,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{bi as t,c as n,ki as r,l as i,n as a,s as o,tn as s,u as c,v as l}from"./useFocusTrap-DEJ5balb.js";import{Cn as u,Dt as d,Fn as f,Gt as p,On as m,Qt as h,a as g,h as _,tn as v,vn as y}from"./index-DD59wPO3.js";var b=e(r(),1),x=null,S=`https://ngrok.com/download`;function C({isOpen:r,onClose:C,onStop:w,error:T,setupCommands:E,onRetry:D}){let[O,k]=(0,b.useState)(null),[A,j]=d(),M=o(),N=Array.isArray(E),P=!!T||N,[F,I]=(0,b.useState)(null),L=(0,b.useRef)(null);l(r,C);let R=(0,b.useRef)(null);a(R,r),_(R,r);let z=(0,b.useCallback)(async()=>{try{let e=await s();return k(e),e}catch(e){return t.system.error(`Failed to fetch tunnel status`,e),null}},[]);(0,b.useEffect)(()=>{if(!r||P)return;z();let e=setInterval(async()=>{let t=await z();t?.active&&t?.url&&clearInterval(e)},2e3);return()=>clearInterval(e)},[r,P,z]),(0,b.useEffect)(()=>{if(!O?.active||!O.url||!O.token||!L.current)return;let n=`${O.url}/?token=${O.token}`;t.system.info(`Generating QR code for the tunnel at ${O.url}`),(async()=>{if(I(null),!x)try{let t=await g(()=>import(`./browser-DfYHeeW3.js`).then(t=>e(t.default,1)),__vite__mapDeps([0,1]),import.meta.url);x=t.default||t}catch{t.system.error(`QR code library not available - install with: npm install qrcode`),I(`mobile.qrUnavailable`);return}let r=getComputedStyle(document.documentElement),i=r.getPropertyValue(`--text-primary`).trim(),a=r.getPropertyValue(`--bg-primary`).trim();if(!i||!a)t.system.error(`QR code skipped: --text-primary/--bg-primary did not resolve. styles/index.css must be loaded before this modal renders.`),I(`mobile.qrNoTheme`);else try{await x.toCanvas(L.current,n,{width:200,margin:2,color:{dark:i,light:a}})}catch(e){t.system.error(`QR code generation failed`,e),I(`mobile.qrFailed`)}})()},[O?.active,O?.url,O?.token]);let B=(0,b.useCallback)(()=>{O?.url&&O?.token&&j(`${O.url}/?token=${O.token}`)},[O,j]);if(!r)return null;let V=O?.active&&O?.url&&O?.token?`${O.url}/?token=${O.token}`:``;return i(`div`,{ref:R,className:`modal-overlay`,onClick:C,role:`dialog`,"aria-modal":`true`,"aria-label":M(`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:[i(h,{size:18}),M(`sidebar.mobileAccess`)]}),i(`button`,{className:`btn-icon`,onClick:C,"aria-label":M(`mobile.close`),children:i(p,{size:18})})]}),c(`div`,{className:`modal-body mobile-modal-body`,children:[c(`div`,{className:`tunnel-status`,children:[i(`span`,{className:`status-dot ${O?.active?`is-active`:N?`is-setup`:T?`is-error`:`is-starting`}`}),i(`span`,{children:O?.active?M(`mobile.tunnelActive`):M(N?`mobile.ngrokRequired`:T?`mobile.startFailed`:`mobile.starting`)}),!O?.active&&!P&&i(`span`,{className:`tunnel-spinner`})]}),N&&c(`div`,{className:`tunnel-setup`,children:[i(`div`,{className:`tunnel-setup-title`,children:M(`mobile.setupTitle`)}),i(`p`,{children:M(`mobile.setupIntro`)}),c(`a`,{href:S,target:`_blank`,rel:`noopener noreferrer`,className:`tunnel-setup-link`,children:[M(`mobile.downloadPage`),` `,i(y,{size:11})]})]}),T&&!N&&i(`div`,{className:`tunnel-error`,children:T}),!P&&i(`div`,{className:`qr-code-area`,children:O?.active?c(n.Fragment,{children:[i(`canvas`,{ref:L,hidden:!!F}),F&&i(`div`,{className:`qr-placeholder error`,children:M(F)})]}):c(`div`,{className:`qr-placeholder`,children:[i(`div`,{className:`placeholder-spinner`}),i(`span`,{children:M(`mobile.connecting`)})]})}),O?.active&&V&&c(`div`,{className:`tunnel-url-area`,children:[i(`label`,{children:M(`mobile.url`)}),c(`div`,{className:`tunnel-url-row`,children:[i(`input`,{type:`text`,readOnly:!0,dir:`ltr`,value:V}),c(`button`,{className:`copy-url-btn ${A===`idle`?``:A}`,onClick:B,title:M(`mobile.copyUrl`),children:[i(A===`copied`?f:A===`failed`?m:u,{size:13}),M(A===`copied`?`mobile.copied`:A===`failed`?`msg.copyFailed`:`mobile.copy`)]})]})]}),!P&&i(`div`,{className:`mobile-instructions`,children:c(`ol`,{children:[i(`li`,{children:M(F?`mobile.stepOpenUrl`:`mobile.stepScan`)}),i(`li`,{children:M(`mobile.stepChat`)}),i(`li`,{children:M(`mobile.thirdParty`)})]})}),O?.active&&!T&&c(`div`,{className:`mobile-install-hint`,children:[i(`div`,{className:`mobile-install-hint-title`,children:M(`mobileAccess.installTitle`)}),i(`p`,{children:M(`mobileAccess.installSteps`)}),i(`p`,{children:M(`mobileAccess.linkLifetime`)})]}),c(`div`,{className:`mobile-access-actions`,children:[O?.active&&w&&i(`button`,{className:`btn-danger`,onClick:w,title:M(`mobile.stopTitle`),children:M(`mobile.stop`)}),N&&D&&c(`button`,{className:`btn-primary`,onClick:D,children:[i(v,{size:13}),` `,M(`mobile.retry`)]}),i(`button`,{className:`btn-secondary`,onClick:C,children:M(`mobile.close`)})]})]})]})})}export{C as MobileAccessModal};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{bi as t,c as n,ki as r,l as i,n as a,o,ot as ee,q as s,r as c,s as te,u as l,v as u,x as ne}from"./useFocusTrap-DEJ5balb.js";import{C as d,Gt as f,Lt as p,Pn as re,S as ie,Tn as m,Wt as h,Xt as g,_ as ae,an as _,b as v,cn as y,f as oe,h as b,in as x,jn as S,on as se,rn as C,v as w,w as T,x as E,y as ce}from"./index-DD59wPO3.js";var D=e(r(),1),O={active:`schedules.status.active`,paused:`schedules.status.paused`,cancelled:`schedules.status.cancelled`};function k(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`))}var A=[{label:`schedules.preset.morning`,value:`daily at 8am`},{label:`schedules.preset.weekdays`,value:`weekdays at 9am`},{label:`schedules.preset.hourly`,value:`every 1h`}];function j(e){if(e.schedule_config)try{let t=JSON.parse(e.schedule_config).raw_input;if(typeof t==`string`&&t.trim())return t}catch(n){t.ui.warn(`Schedule "${e.name}" has an unreadable schedule_config`,n)}return e.description}function M({schedule:e,onEdit:r}){let a=te(),{selectedSchedule:ee,selectSchedule:u,updateScheduleStatus:f,runScheduleNow:p,deleteSchedule:b,results:C,resultsLoading:w,loadSchedules:T,loadResults:E}=d(),{setCurrentSession:k,setShowSchedules:A}=ne(),j=ee===e.name,M=ae(e.description_parts,a),[N,P]=(0,D.useState)(!1),[F,I]=(0,D.useState)(()=>new Date),L=(0,D.useRef)(null);(0,D.useEffect)(()=>{let t=e.status===`active`&&ie(e.next_run_at);return t&&!L.current?L.current=setInterval(()=>{I(new Date),e.next_run_at&&new Date(e.next_run_at).getTime()<=Date.now()&&T()},1e3):!t&&L.current&&(clearInterval(L.current),L.current=null),()=>{L.current&&=(clearInterval(L.current),null)}},[e.status,e.next_run_at,T]);let R=(0,D.useRef)(e.last_run_at);(0,D.useEffect)(()=>{j&&e.last_run_at!==R.current&&(R.current=e.last_run_at,E(e.name))},[j,e.last_run_at,e.name,E]);let z=e.last_run_at&&Date.now()-new Date(e.last_run_at).getTime()<5e3,B=(0,D.useCallback)(n=>{n.stopPropagation();let r=e.status===`active`?`paused`:`active`;t.ui.info(`Schedule "${e.name}": ${e.status} -> ${r}`),f(e.name,r)},[e.name,e.status,f]),V=(0,D.useCallback)(n=>{n.stopPropagation(),t.ui.info(`Schedule "${e.name}": run now`),p(e.name)},[e.name,p]),H=(0,D.useCallback)(e=>{e.stopPropagation(),P(!0)},[]),U=(0,D.useCallback)(()=>{P(!1),t.ui.info(`Deleting schedule "${e.name}"`),b(e.name)},[e.name,b]),W=(0,D.useCallback)(t=>{t.stopPropagation(),r(e)},[r,e]),G=(0,D.useCallback)(t=>{t.stopPropagation(),u(j?null:e.name)},[j,e.name,u]),K=(0,D.useCallback)(n=>{n.stopPropagation(),e.session_id&&(t.ui.info(`Opening chat session for schedule "${e.name}"`),k(e.session_id),A(!1))},[e.session_id,e.name,k,A]);return l(`div`,{className:`schedule-card ${j?`selected`:``} ${z?`just-ran`:``}`,onClick:t=>{t.currentTarget.contains(t.target)&&u(j?null:e.name)},children:[l(`div`,{className:`schedule-card-header`,children:[i(`span`,{className:`schedule-card-name`,dir:`auto`,title:e.name,children:e.name}),i(`span`,{className:`schedule-card-status ${e.status}`,children:a(O[e.status])})]}),i(`div`,{className:`schedule-card-prompt`,dir:`auto`,title:e.prompt,children:e.prompt}),l(`div`,{className:`schedule-card-meta`,children:[l(`span`,{title:s(M??e.description),children:[i(m,{size:11}),` `,M??i(`bdi`,{children:e.description})]}),i(`span`,{children:a(`schedules.card.runs`,{n:e.run_count})}),e.error_count>0&&i(`span`,{children:a(`schedules.card.errors`,{n:e.error_count})}),i(`span`,{children:a.compose((t,n)=>t(`schedules.card.last`,{when:v(e.last_run_at,t,void 0,c(o(n)))}))}),i(`span`,{children:a.compose((t,n)=>t(`schedules.card.next`,{when:e.status===`paused`?t(`schedules.status.paused`):ce(e.next_run_at,F,t,c(o(n)))}))})]}),e.last_error&&!(j&&!w&&C.some(e=>e.error))&&i(`div`,{className:`schedule-card-error`,children:a(`schedules.card.lastFailed`,{error:e.last_error})}),l(`div`,{className:`schedule-card-actions`,children:[e.session_id&&l(`button`,{className:`btn-sm chat`,onClick:K,title:a(`schedules.card.openChatTitle`),children:[i(y,{size:11}),` `,a(`schedules.card.openChat`)]}),l(`button`,{className:`btn-sm`,onClick:V,disabled:e.running,title:a(`schedules.card.runNowTitle`),children:[i(h,{size:11}),` `,a(e.running?`schedules.card.running`:`schedules.card.runNow`)]}),i(`button`,{className:`btn-sm`,onClick:B,title:a(e.status===`active`?`schedules.card.pause`:`schedules.card.resume`),children:e.status===`active`?l(n.Fragment,{children:[i(se,{size:11}),` `,a(`schedules.card.pause`)]}):l(n.Fragment,{children:[i(x,{size:11}),` `,a(`schedules.card.resume`)]})}),l(`button`,{className:`btn-sm`,onClick:W,disabled:e.running,title:a(`schedules.card.editTitle`),children:[i(_,{size:11}),` `,a(`schedules.card.edit`)]}),l(`button`,{className:`btn-sm danger`,onClick:H,title:a(`schedules.card.delete`),children:[i(g,{size:11}),` `,a(`schedules.card.delete`)]}),l(`button`,{className:`btn-sm schedule-history-toggle`,onClick:G,"aria-expanded":j,children:[i(j?S:re,{size:11}),` `,a(`schedules.card.pastRuns`)]})]}),N&&l(oe,{title:a(`schedules.delete.ask`,{name:e.name}),confirmLabel:a(`schedules.delete.confirm`),cancelLabel:a(`schedules.delete.cancel`),onConfirm:U,onCancel:()=>P(!1),danger:!0,children:[i(`p`,{children:a(`schedules.delete.what`)}),e.session_id&&i(`p`,{children:a(`schedules.delete.chatStays`)}),e.running&&i(`p`,{children:a(`schedules.delete.runStops`)})]}),j&&l(`div`,{className:`schedule-results`,children:[i(`h4`,{children:a(`schedules.history`)}),w?i(`p`,{className:`schedule-results-empty`,children:a(`schedules.historyLoading`)}):C.length===0?i(`p`,{className:`schedule-results-empty`,children:a(`schedules.historyEmpty`)}):i(`div`,{className:`schedule-results-list`,children:C.map(e=>l(`div`,{className:`schedule-result-item`,children:[i(`div`,{className:`schedule-result-time`,children:a.compose((t,n)=>v(e.executed_at,t,void 0,c(o(n))))}),e.error?i(`div`,{className:`schedule-result-content schedule-result-error`,children:i(`bdi`,{children:e.error})}):i(`div`,{className:`schedule-result-content`,children:e.result?i(`bdi`,{children:e.result}):a(`schedules.noOutput`)})]},e.id))})]})]})}function N(){let e=te(),{setShowSchedules:r}=ne(),{schedules:s,loading:re,error:ie,actionError:h,loadSchedules:g,createSchedule:_,editSchedule:v,dismissActionError:y}=d(),oe=(0,D.useCallback)(()=>r(!1),[r]);u(!0,oe);let x=(0,D.useRef)(null);a(x,!0),b(x,!0);let[S]=(0,D.useState)(()=>d.getState().draft),[se,O]=(0,D.useState)(S!==null),[N,P]=(0,D.useState)(S?.when??``),[F,I]=(0,D.useState)(S?.name??``),[L,R]=(0,D.useState)(S?.prompt??``),[z,B]=(0,D.useState)(null),[V,H]=(0,D.useState)(!1),[U,W]=(0,D.useState)(!1),[G,K]=(0,D.useState)(null),[q,le]=(0,D.useState)(null),ue=(0,D.useRef)(null),[J,Y]=(0,D.useState)(!1),X=(0,D.useId)(),de=`${X}-when`,fe=`${X}-when-error`,Z=`${X}-when-hint`,pe=`${X}-name`,me=`${X}-name-error`,he=`${X}-prompt`,Q=!V&&z!==null&&!z.valid,ge=Q&&/[A-Za-z]/.test(N);(0,D.useEffect)(()=>{if(q)return;let e=N.trim()||F.trim()||L.trim();d.getState().setDraft(e?{when:N,name:F,prompt:L}:null)},[q,N,F,L]);let $=(0,D.useRef)(null);(0,D.useEffect)(()=>{if(!N.trim())B(null);else return $.current&&clearTimeout($.current),$.current=window.setTimeout(async()=>{H(!0);try{let e=await T(N);B(e)}catch{B(null)}finally{H(!1)}},400),()=>{$.current&&clearTimeout($.current)}},[N]),(0,D.useEffect)(()=>{t.ui.info(`Schedule Manager opened`),g();let e=p(()=>g(),5e3);return()=>{e(),y()}},[g,y]);let _e=N.trim()&&F.trim()&&L.trim()&&(z===null||z.valid),ve=(0,D.useCallback)(()=>{O(!1),le(null),K(null),Y(!1),B(null),P(``),I(``),R(``)},[]),ye=(0,D.useCallback)(e=>{le(e.name),I(e.name),R(e.prompt),P(j(e)),K(null),O(!0),t.ui.info(`Editing schedule "${e.name}"`)},[]);(0,D.useEffect)(()=>{q&&ue.current?.scrollIntoView?.({block:`nearest`})},[q]);let be=(0,D.useCallback)(async()=>{if(_e){W(!0),K(null),Y(!1);try{q?(await v(q,N.trim(),L.trim()),t.ui.info(`Schedule "${q}" edited`)):(await _(F.trim(),N.trim(),L.trim()),d.getState().setDraft(null),t.ui.info(`Schedule "${F}" created`)),ve()}catch(t){!q&&t instanceof ee&&t.httpStatus===409?Y(!0):K(t instanceof Error?t.message:e(q?`schedules.editFailed`:`schedules.createFailed`))}finally{W(!1)}}},[_e,q,F,N,L,_,v,ve,e]);return i(`div`,{ref:x,className:`modal-overlay`,onClick:()=>r(!1),role:`dialog`,"aria-modal":`true`,"aria-label":e(`schedules.title`),children:l(`div`,{className:`modal-panel schedule-modal`,onClick:e=>e.stopPropagation(),children:[l(`div`,{className:`modal-header`,children:[i(`h3`,{children:e(`schedules.title`)}),i(`button`,{className:`btn-icon`,onClick:()=>r(!1),"aria-label":e(`schedules.close`),children:i(f,{size:18})})]}),l(`div`,{className:`modal-body`,children:[i(`section`,{className:`schedule-section`,children:se?l(`div`,{className:`schedule-create-form`,ref:ue,children:[q&&i(`h4`,{className:`schedule-form-title`,children:e(`schedules.editingTitle`,{name:q})}),l(`div`,{className:`schedule-field`,children:[i(`label`,{className:`schedule-field-label`,htmlFor:de,children:e(`schedules.when`)}),i(`div`,{className:`schedule-presets`,children:A.map(t=>i(`button`,{type:`button`,className:`schedule-preset${N.trim()===t.value?` is-picked`:``}`,onClick:()=>P(t.value),"aria-pressed":N.trim()===t.value,children:e(t.label)},t.value))}),i(`textarea`,{id:de,className:`schedule-nl-input`,placeholder:e.bare(`schedules.whenPlaceholder`),value:N,onChange:e=>P(e.target.value),"aria-invalid":Q,"aria-describedby":Q?`${fe} ${Z}`:Z,autoFocus:!0,rows:2}),i(`div`,{id:Z,className:`schedule-field-hint`,children:e(`schedules.whenHint`)})]}),(z||V)&&i(`div`,{className:`schedule-parsed-preview ${z?.valid?`valid`:`invalid`}`,"aria-live":`polite`,children:V?i(`span`,{className:`schedule-parsed-loading`,children:e(`schedules.parsing`)}):z?l(n.Fragment,{children:[z.valid?i(`div`,{className:`schedule-parsed-description`,children:ae(z.description_parts,e)??i(`bdi`,{children:z.description})}):l(`div`,{id:fe,children:[i(`div`,{className:`schedule-parsed-description`,children:e(`schedules.notUnderstood`)}),ge&&i(`div`,{className:`schedule-parsed-hint`,children:i(`bdi`,{children:z.description})})]}),z.valid&&z.next_run_at&&i(`div`,{className:`schedule-parsed-next`,children:e.compose((e,t)=>e(`schedules.nextRun`,{when:ce(z.next_run_at,void 0,e,c(o(t)))}))}),z.valid&&l(`div`,{className:`schedule-parsed-details`,children:[z.time_of_day&&l(`span`,{className:`schedule-parsed-tag`,children:[i(m,{size:10}),` `,E(z.time_of_day,e)]}),z.start_hour!=null&&z.end_hour!=null&&l(`span`,{className:`schedule-parsed-tag`,children:[i(m,{size:10}),` `,e.compose((e,t)=>e(`schedules.hours`,{start:w(o(t),z.start_hour),end:w(o(t),z.end_hour)}))]}),z.days_of_week&&i(`span`,{className:`schedule-parsed-tag`,children:e.compose(e=>k(z.days_of_week,e))})]})]}):null}),l(`div`,{className:`schedule-field`,children:[i(`label`,{className:`schedule-field-label`,htmlFor:pe,children:e(`schedules.name`)}),i(`div`,{className:`schedule-form-row`,children:i(`input`,{id:pe,type:`text`,placeholder:e(`schedules.namePlaceholder`),value:F,onChange:e=>{I(e.target.value),Y(!1)},readOnly:q!==null,className:!F.trim()&&N.trim()?`schedule-field-missing`:``,"aria-invalid":J,"aria-describedby":J?me:void 0})}),J&&i(`p`,{id:me,className:`schedule-form-error`,role:`alert`,children:e(`schedules.nameTaken`)})]}),l(`div`,{className:`schedule-field`,children:[i(`label`,{className:`schedule-field-label`,htmlFor:he,children:e(`schedules.prompt`)}),i(`textarea`,{id:he,className:`schedule-prompt-input ${!L.trim()&&N.trim()?`schedule-field-missing`:``}`,placeholder:e(`schedules.promptPlaceholder`),value:L,onChange:e=>R(e.target.value)}),i(`div`,{className:`schedule-prompt-hint`,children:e(`schedules.promptHint`)})]}),G&&i(`p`,{className:`schedule-form-error`,children:i(`bdi`,{children:G})}),l(`div`,{className:`schedule-create-actions`,children:[i(`button`,{className:`btn-secondary`,onClick:ve,children:e(`schedules.cancel`)}),i(`button`,{className:`btn-primary`,onClick:be,disabled:!_e||U,children:e(q?U?`schedules.saving`:`schedules.save`:U?`schedules.creating`:`schedules.create`)})]})]}):l(`button`,{className:`btn-primary`,onClick:()=>O(!0),children:[i(C,{size:14}),` `,e(`schedules.new`)]})}),l(`section`,{className:`schedule-section`,children:[i(`h4`,{children:e(`schedules.list`)}),h&&l(`div`,{className:`schedule-action-error`,role:`alert`,children:[i(`span`,{children:i(`bdi`,{children:h})}),i(`button`,{className:`btn-icon`,onClick:y,"aria-label":e(`schedules.dismissError`),children:i(f,{size:14})})]}),re?i(`p`,{className:`schedule-empty`,children:e(`schedules.loading`)}):ie?i(`p`,{className:`schedule-empty`,children:e(`schedules.loadFailed`)}):s.length===0?i(`p`,{className:`schedule-empty`,children:e(`schedules.empty`)}):i(`div`,{className:`schedule-list`,children:s.map(e=>i(M,{schedule:e,onEdit:ye},e.id))})]})]})]})})}export{N 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:500}.schedule-field-hint,.schedule-prompt-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-form-row input[readonly]{background:var(--bg-secondary);color:var(--text-secondary)}.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:500}.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:clip;white-space:nowrap;flex:1;font-size:13px;font-weight:500;animation:both fade-cut-inline;animation-timeline:scroll(self inline);overflow:hidden}.schedule-card-status{font-size:var(--fs-caption);text-transform:capitalize;border-radius:var(--radius-sm);padding:2px 8px;font-weight:500}.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);flex-wrap:wrap;align-items:center;gap:4px 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);-webkit-line-clamp:3;overflow-wrap:anywhere;-webkit-box-orient:vertical;margin-top:4px;font-size:12px;animation:both fade-cut-block;animation-timeline:scroll(self);display:-webkit-box;overflow:hidden}:root:not([dir=rtl]) .schedule-card-prompt:dir(rtl){inline-size:fit-content;max-inline-size:100%}.schedule-card-actions{gap:4px;margin-top:8px;display:flex}.schedule-card-actions .btn-sm{min-height:var(--hit-min);font-size:var(--fs-label);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;display:inline-flex}.schedule-card-actions .btn-sm:hover{background:var(--bg-active)}.schedule-card-actions .btn-sm.danger{color:var(--danger);border-color:color-mix(in srgb, var(--danger) 45%, var(--border))}.schedule-card-actions .btn-sm.danger:hover{background:color-mix(in srgb, var(--danger) 10%, transparent)}.schedule-card-actions{flex-wrap:wrap}.schedule-card-actions .schedule-history-toggle{color:var(--text-secondary);background:0 0;border-color:#0000;margin-inline-start:auto}.schedule-form-title{color:var(--text-primary);margin:0;font-size:14px;font-weight:500}.schedule-presets{flex-wrap:wrap;gap:6px;display:flex}.schedule-preset{border:1px solid var(--border);border-radius:var(--radius-full);background:var(--bg-secondary);color:var(--text-secondary);transition:border-color var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease);padding:3px 10px;font-size:12px}.schedule-preset:hover,.schedule-preset.is-picked{border-color:var(--accent);color:var(--accent)}.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:500}.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);max-height:none}.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:500}.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}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{U as e}from"./useFocusTrap-DEJ5balb.js";var t={unsupported_type:`docs.folder.skippedFiles.unsupported`,credential_file:`docs.folder.skippedFiles.credential`};function n(n,r){let i=r.skipped_files??[];if(i.length===0)return[];let a=i.slice(0,50),o=[];for(let r of Object.keys(t)){let i=a.filter(e=>e.reason===r).map(t=>e(t.file,`ltr`));i.length>0&&o.push(n(t[r],{names:i.join(`, `)}))}return(r.skipped_files_truncated||i.length>50)&&o.push(n(`docs.folder.skippedFiles.truncated`,{n:50})),o}export{n as t};
|