@bigduu/lotus 2026.7.15 → 2026.7.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/assets/{ChildApprovalDialog-MnpDFKzH.js → ChildApprovalDialog-Bn6zDSUn.js} +1 -1
  2. package/dist/assets/CommandPalette-C7M9VREB.js +1 -0
  3. package/dist/assets/{CommandSelector-CNYv9TD_.js → CommandSelector-DCF_eYFM.js} +1 -1
  4. package/dist/assets/{ContextBar-D55kxbWQ.js → ContextBar-1LDCx1UR.js} +1 -1
  5. package/dist/assets/{FilePreview-Xwi8sy95.js → FilePreview-C78F5eM1.js} +1 -1
  6. package/dist/assets/{FileReferenceSelector-DNssZZdw.js → FileReferenceSelector-CMthjAt5.js} +1 -1
  7. package/dist/assets/{HomeDashboard-WjzlXY6L.js → HomeDashboard-D0TwAR_x.js} +1 -1
  8. package/dist/assets/LedgerDrawer-DJn4WNaB.js +1 -0
  9. package/dist/assets/{MetricsService-Cncz4Wn7.js → MetricsService-BJjcr3PB.js} +56 -56
  10. package/dist/assets/{QuestionDialog-DqTR1Bfi.js → QuestionDialog-sR4lfOkz.js} +1 -1
  11. package/dist/assets/{SessionSummaryCard-rWg4kae2.js → SessionSummaryCard-CNuYpo8e.js} +1 -1
  12. package/dist/assets/{SubAgentsPanel-C1Zt2sJq.js → SubAgentsPanel-XLs7Ffbu.js} +2 -2
  13. package/dist/assets/{SystemPromptSelector-oLKY5OxV.js → SystemPromptSelector-Cqg7_foJ.js} +1 -1
  14. package/dist/assets/SystemSettingsPage-DOIZqoTl.js +22 -0
  15. package/dist/assets/{TodoList-DeGB_kfz.js → TodoList-wgV1m9Hg.js} +1 -1
  16. package/dist/assets/{WorkspacePathModal-DN1m7RXU.js → WorkspacePathModal-BG03pOha.js} +1 -1
  17. package/dist/assets/{architectureDiagram-3BPJPVTR-CbevEGn3.js → architectureDiagram-3BPJPVTR-cOrZEDQt.js} +1 -1
  18. package/dist/assets/{blockDiagram-GPEHLZMM-BxMwTU63.js → blockDiagram-GPEHLZMM-BoWpE05L.js} +1 -1
  19. package/dist/assets/{c4Diagram-AAUBKEIU-DXtujyjB.js → c4Diagram-AAUBKEIU-BLhKl4mi.js} +1 -1
  20. package/dist/assets/{chunk-4BX2VUAB-BFMQnMIG.js → chunk-4BX2VUAB-BV8TfHHk.js} +1 -1
  21. package/dist/assets/{chunk-QZHKN3VN-BXkRL_rn.js → chunk-QZHKN3VN-BJ9jfaj9.js} +1 -1
  22. package/dist/assets/{classDiagram-v2-Q7XG4LA2-BdH4VFzX.js → classDiagram-v2-Q7XG4LA2-SJYRgOmq.js} +1 -1
  23. package/dist/assets/{cose-bilkent-S5V4N54A-DCkZzESS.js → cose-bilkent-S5V4N54A-DabsZjVy.js} +1 -1
  24. package/dist/assets/{dagre-BM42HDAG-BkFUV3DD.js → dagre-BM42HDAG-CdRFQkvs.js} +1 -1
  25. package/dist/assets/{diagram-2AECGRRQ-DF5bhWsS.js → diagram-2AECGRRQ-_TJO587u.js} +1 -1
  26. package/dist/assets/{diagram-5GNKFQAL-C4OMRMl4.js → diagram-5GNKFQAL-DwwF5Acg.js} +1 -1
  27. package/dist/assets/{diagram-KO2AKTUF-wODWwMnc.js → diagram-KO2AKTUF-UxX_1WSV.js} +1 -1
  28. package/dist/assets/{diagram-LMA3HP47-CbU-4gVW.js → diagram-LMA3HP47-BsJLPvmF.js} +1 -1
  29. package/dist/assets/{diagram-OG6HWLK6-DcqvYHkr.js → diagram-OG6HWLK6-BJfCFPK-.js} +1 -1
  30. package/dist/assets/{erDiagram-TEJ5UH35-DFO8ihoJ.js → erDiagram-TEJ5UH35-B9Kte4_y.js} +1 -1
  31. package/dist/assets/{flowDiagram-I6XJVG4X-D2WdBFot.js → flowDiagram-I6XJVG4X-CdPPJGVr.js} +1 -1
  32. package/dist/assets/{ganttDiagram-6RSMTGT7-C3jqysPv.js → ganttDiagram-6RSMTGT7-DsXLVmGZ.js} +2 -2
  33. package/dist/assets/{gitGraphDiagram-PVQCEYII-Dbqb9y0l.js → gitGraphDiagram-PVQCEYII-m9gNRotf.js} +1 -1
  34. package/dist/assets/{index.es-DWpZqL6k.js → index.es-ATrdjl5_.js} +1 -1
  35. package/dist/assets/{ishikawaDiagram-YF4QCWOH-D6d8mzB1.js → ishikawaDiagram-YF4QCWOH-D4vyoTY2.js} +1 -1
  36. package/dist/assets/{journeyDiagram-JHISSGLW-BortyUjA.js → journeyDiagram-JHISSGLW-weLPS96n.js} +3 -3
  37. package/dist/assets/{kanban-definition-UN3LZRKU-C2RNw2kj.js → kanban-definition-UN3LZRKU-rzClh9Bn.js} +2 -2
  38. package/dist/assets/{main-Bm_td6Y3.js → main-Bm6Xue83.js} +5 -5
  39. package/dist/assets/{mindmap-definition-RKZ34NQL-KdlUBBen.js → mindmap-definition-RKZ34NQL-DYNvg2Tz.js} +4 -4
  40. package/dist/assets/{pieDiagram-4H26LBE5-Brh_y6dV.js → pieDiagram-4H26LBE5-CQwI5lgg.js} +1 -1
  41. package/dist/assets/{quadrantDiagram-W4KKPZXB-DDcFGc8G.js → quadrantDiagram-W4KKPZXB-CozxrzYe.js} +1 -1
  42. package/dist/assets/{requirementDiagram-4Y6WPE33-C_iapLQW.js → requirementDiagram-4Y6WPE33-D922r4PO.js} +1 -1
  43. package/dist/assets/{sankeyDiagram-5OEKKPKP-C5IGzDJl.js → sankeyDiagram-5OEKKPKP-Dr2P1wY4.js} +1 -1
  44. package/dist/assets/{sequenceDiagram-3UESZ5HK-D-iPBZzc.js → sequenceDiagram-3UESZ5HK-BH0d3NK4.js} +1 -1
  45. package/dist/assets/{stateDiagram-AJRCARHV-BUcBjCHw.js → stateDiagram-AJRCARHV-Cf1L99UG.js} +1 -1
  46. package/dist/assets/{stateDiagram-v2-BHNVJYJU-BLRmGLIw.js → stateDiagram-v2-BHNVJYJU-MhE03ChB.js} +1 -1
  47. package/dist/assets/{timeline-definition-PNZ67QCA-CgjhGxB5.js → timeline-definition-PNZ67QCA-DLL2fzZK.js} +1 -1
  48. package/dist/assets/{vendor-antd-IzIw5qDM.js → vendor-antd-CzrN6PM8.js} +83 -83
  49. package/dist/assets/{vendor-charts-Cddnk1Vn.js → vendor-charts-BRxq0LpH.js} +1 -1
  50. package/dist/assets/{vendor-markdown-Bz_2-zkk.js → vendor-markdown-BDStutVw.js} +1 -1
  51. package/dist/assets/{vendor-mermaid-DIRrTQU1.js → vendor-mermaid-CztJpwsx.js} +4 -4
  52. package/dist/assets/{vendor-pdf-BkH3r1kx.js → vendor-pdf-dQDE-8w8.js} +4 -4
  53. package/dist/assets/{vennDiagram-CIIHVFJN-DIN_Q5ND.js → vennDiagram-CIIHVFJN-BhyFcZ8A.js} +1 -1
  54. package/dist/assets/{wardley-L42UT6IY-9HfVkYgx.js → wardley-L42UT6IY-COxgF6uh.js} +1 -1
  55. package/dist/assets/{wardleyDiagram-YWT4CUSO-U39P90SF.js → wardleyDiagram-YWT4CUSO-DSke7W9T.js} +1 -1
  56. package/dist/assets/{xychartDiagram-2RQKCTM6-CqQnkZEa.js → xychartDiagram-2RQKCTM6-CBS-EC6J.js} +1 -1
  57. package/dist/index.html +4 -4
  58. package/package.json +1 -1
  59. package/dist/assets/CommandPalette-D1atuulX.js +0 -1
  60. package/dist/assets/SystemSettingsPage-DITQ98iL.js +0 -22
@@ -1 +1 @@
1
- import{j as e}from"./vendor-markdown-Bz_2-zkk.js";import{R as A,u as S,a as T}from"./vendor-i18n-Dm-c3D_C.js";import{u as g,s as N,a as w,i as B}from"./MetricsService-Cncz4Wn7.js";/* empty css */import{A as $,T as b,j as k,B as y,p as F,o as I,t as R}from"./vendor-antd-IzIw5qDM.js";import"./vendor-mermaid-DIRrTQU1.js";import"./main-Bm_td6Y3.js";const s={questionCard:"qd-questionCard",questionHeader:"qd-questionHeader",headerLeft:"qd-headerLeft",questionIcon:"qd-questionIcon",questionText:"qd-questionText",questionBody:"qd-questionBody",questionFooter:"qd-questionFooter"},{Text:c}=b,{useToken:z}=R,f=({sessionId:a})=>{const{t:o}=S(),{token:r}=z(),{message:i}=$.useApp(),[n,d]=T.useState(!1),m=g(N(a)),l=g(p=>p.clearPendingChildApproval);if(!m)return null;const{childSessionId:j,requestId:C,toolName:u,permission:h,resource:v}=m,q=async p=>{d(!0);try{(await w.respondToChildApproval(j,C,p)).delivered||i.warning(o("components.approval.childGone")),l(a)}catch(t){console.error("Failed to respond to child approval:",t),B(t)&&t.status===404?(i.warning(o("components.approval.childGone")),l(a)):i.error(o("components.approval.deliverFailed"))}finally{d(!1)}},x=[u?`${o("components.approval.toolName")}: ${u}`:null,h?`${o("components.approval.permission")}: ${h}`:null,v?`${o("components.approval.target")}: ${v}`:null].filter(Boolean).join(" · ");return e.jsxs("div",{className:s.questionCard,style:{background:r.colorBgContainer,borderColor:r.colorBorderSecondary,border:`1px solid ${r.colorBorderSecondary}`},children:[e.jsx("div",{className:s.questionHeader,children:e.jsxs("span",{className:s.headerLeft,children:[e.jsx("span",{className:s.questionIcon,children:"🛡️"}),e.jsx(c,{strong:!0,className:s.questionText,style:{color:r.colorPrimary,whiteSpace:"pre-wrap"},children:o("components.approval.childTitle")})]})}),e.jsxs("div",{className:s.questionBody,children:[e.jsx(c,{style:{color:r.colorText,whiteSpace:"pre-wrap"},children:o("components.approval.childQuestion")}),x&&e.jsx("div",{style:{marginTop:r.marginXXS},children:e.jsx(c,{type:"secondary",style:{fontSize:12,whiteSpace:"pre-wrap"},children:x})}),e.jsx("div",{className:s.questionFooter,children:e.jsxs(k,{size:8,children:[e.jsx(y,{type:"primary",size:"small",icon:e.jsx(F,{}),onClick:()=>void q(!0),loading:n,disabled:n,children:o("components.approval.approve")}),e.jsx(y,{danger:!0,size:"small",icon:e.jsx(I,{}),onClick:()=>void q(!1),loading:n,disabled:n,children:o("components.approval.deny")})]})})]})]})};f.displayName="ChildApprovalDialog";const D=A.memo(f);D.displayName="ChildApprovalDialog";export{D as ChildApprovalDialog,D as default};
1
+ import{j as e}from"./vendor-markdown-BDStutVw.js";import{R as A,u as S,a as T}from"./vendor-i18n-Dm-c3D_C.js";import{u as g,s as N,a as w,i as B}from"./MetricsService-BJjcr3PB.js";/* empty css */import{A as $,T as b,j as k,B as y,p as F,o as I,t as R}from"./vendor-antd-CzrN6PM8.js";import"./vendor-mermaid-CztJpwsx.js";import"./main-Bm6Xue83.js";const s={questionCard:"qd-questionCard",questionHeader:"qd-questionHeader",headerLeft:"qd-headerLeft",questionIcon:"qd-questionIcon",questionText:"qd-questionText",questionBody:"qd-questionBody",questionFooter:"qd-questionFooter"},{Text:c}=b,{useToken:z}=R,f=({sessionId:a})=>{const{t:o}=S(),{token:r}=z(),{message:i}=$.useApp(),[n,d]=T.useState(!1),m=g(N(a)),l=g(p=>p.clearPendingChildApproval);if(!m)return null;const{childSessionId:j,requestId:C,toolName:u,permission:h,resource:v}=m,q=async p=>{d(!0);try{(await w.respondToChildApproval(j,C,p)).delivered||i.warning(o("components.approval.childGone")),l(a)}catch(t){console.error("Failed to respond to child approval:",t),B(t)&&t.status===404?(i.warning(o("components.approval.childGone")),l(a)):i.error(o("components.approval.deliverFailed"))}finally{d(!1)}},x=[u?`${o("components.approval.toolName")}: ${u}`:null,h?`${o("components.approval.permission")}: ${h}`:null,v?`${o("components.approval.target")}: ${v}`:null].filter(Boolean).join(" · ");return e.jsxs("div",{className:s.questionCard,style:{background:r.colorBgContainer,borderColor:r.colorBorderSecondary,border:`1px solid ${r.colorBorderSecondary}`},children:[e.jsx("div",{className:s.questionHeader,children:e.jsxs("span",{className:s.headerLeft,children:[e.jsx("span",{className:s.questionIcon,children:"🛡️"}),e.jsx(c,{strong:!0,className:s.questionText,style:{color:r.colorPrimary,whiteSpace:"pre-wrap"},children:o("components.approval.childTitle")})]})}),e.jsxs("div",{className:s.questionBody,children:[e.jsx(c,{style:{color:r.colorText,whiteSpace:"pre-wrap"},children:o("components.approval.childQuestion")}),x&&e.jsx("div",{style:{marginTop:r.marginXXS},children:e.jsx(c,{type:"secondary",style:{fontSize:12,whiteSpace:"pre-wrap"},children:x})}),e.jsx("div",{className:s.questionFooter,children:e.jsxs(k,{size:8,children:[e.jsx(y,{type:"primary",size:"small",icon:e.jsx(F,{}),onClick:()=>void q(!0),loading:n,disabled:n,children:o("components.approval.approve")}),e.jsx(y,{danger:!0,size:"small",icon:e.jsx(I,{}),onClick:()=>void q(!1),loading:n,disabled:n,children:o("components.approval.deny")})]})})]})]})};f.displayName="ChildApprovalDialog";const D=A.memo(f);D.displayName="ChildApprovalDialog";export{D as ChildApprovalDialog,D as default};
@@ -0,0 +1 @@
1
+ import{j as n}from"./vendor-markdown-BDStutVw.js";import{u as H,a as r}from"./vendor-i18n-Dm-c3D_C.js";import{u as h,h as U,x as z,y as B,z as T,A as Q,B as G,D as W,F as Y,G as J,H as X}from"./MetricsService-BJjcr3PB.js";import{t as Z,A as ee,ag as te,ah as se,ai as ne,aj as oe,ak as ae,al as ie,am as le,an as de,O as re,aa as ce,ao as me,ap as ue,T as pe,N as ge,aq as be,n as fe}from"./vendor-antd-CzrN6PM8.js";import"./vendor-mermaid-CztJpwsx.js";import"./main-Bm6Xue83.js";const ye=(()=>{let e=null,o=[],a=new Map;return i=>{if(i===e)return o;const p=i.map(c=>{const l=a.get(c.id),g={id:c.id,title:c.title,kind:c.kind,pinned:c.pinned,updatedAt:c.updatedAt,workspacePath:c.config.workspacePath};return l&&l.title===g.title&&l.kind===g.kind&&l.pinned===g.pinned&&l.updatedAt===g.updatedAt&&l.workspacePath===g.workspacePath?l:g}),P=p.length===o.length&&p.every((c,l)=>c===o[l]);return e=i,a=new Map(p.map(c=>[c.id,c])),P?o:(o=p,p)}})(),ke=[{id:"settings-provider",tabKey:"provider",titleKey:"commandPalette.actions.openProviderSettings",fallbackTitle:"Open Provider Settings",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"AI",keywords:["api","key","openai","anthropic","gemini","model"]},{id:"settings-model-limits",tabKey:"model-limits",titleKey:"commandPalette.actions.openModelLimits",fallbackTitle:"Open Model Limits",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"AI",keywords:["token","context","window","budget","limit"]},{id:"settings-prompts",tabKey:"prompts",titleKey:"commandPalette.actions.openPrompts",fallbackTitle:"Open System Prompts",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"AI",keywords:["system","prompt","persona","instruction"]},{id:"settings-skills",tabKey:"skills",titleKey:"commandPalette.actions.openSkills",fallbackTitle:"Open Skills",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"Tools",keywords:["skill","capability","plugin"]},{id:"settings-mcp",tabKey:"mcp",titleKey:"commandPalette.actions.openMcpSettings",fallbackTitle:"Open MCP Settings",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"Tools",keywords:["mcp","server","tool","external"]},{id:"settings-workflows",tabKey:"workflows",titleKey:"commandPalette.actions.openWorkflowSettings",fallbackTitle:"Open Workflow Settings",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"Tools",keywords:["workflow","automation","template"]},{id:"settings-hooks",tabKey:"hooks",titleKey:"commandPalette.actions.openHooks",fallbackTitle:"Open Hooks",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"Tools",keywords:["hook","event","trigger","callback"]},{id:"settings-schedules",tabKey:"schedules",titleKey:"commandPalette.actions.openSchedulesSettings",fallbackTitle:"Open Schedules",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"Ops",keywords:["schedule","cron","recurring","timer","automated"]},{id:"settings-sessions",tabKey:"sessions",titleKey:"commandPalette.actions.openSessionsSettings",fallbackTitle:"Open Session Monitor",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"Monitor",keywords:["session","monitor","cleanup","history"]},{id:"settings-metrics",tabKey:"metrics",titleKey:"commandPalette.actions.openMetrics",fallbackTitle:"Open Metrics Dashboard",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"Monitor",keywords:["metrics","dashboard","analytics","usage","stats"]},{id:"settings-masking",tabKey:"masking",titleKey:"commandPalette.actions.openMasking",fallbackTitle:"Open Keyword Masking",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"Security & privacy",badge:"Security",keywords:["mask","redact","privacy","keyword","sensitive"]},{id:"settings-env",tabKey:"env-vars",titleKey:"commandPalette.actions.openEnvVars",fallbackTitle:"Open Environment Variables",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"System",keywords:["env","environment","variable","config"]},{id:"settings-config",tabKey:"config",titleKey:"commandPalette.actions.openConfig",fallbackTitle:"Open Configuration",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"System",keywords:["config","json","bamboo","data","path"]},{id:"settings-app",tabKey:"app",titleKey:"commandPalette.actions.openAppSettings",fallbackTitle:"Open App Settings",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"System",keywords:["app","application","reset","theme","language"]}],Se=(e,o)=>{const a=[e.title,e.id,e.kind||"root"];return e.pinned&&a.push("pinned","pin"),o&&a.push("running","processing"),e.workspacePath&&a.push(e.workspacePath),e.updatedAt&&a.push(e.updatedAt),a.filter(Boolean)},we=(e,o,a)=>{const i=[];if(e.kind==="child"?i.push(o):i.push(a),e.workspacePath&&i.push(e.workspacePath),e.updatedAt)try{i.push(new Date(e.updatedAt).toLocaleString())}catch{i.push(e.updatedAt)}return i.join(" • ")},he=(e,o)=>{const a=o.trim().toLowerCase();return a?e.filter(i=>[i.title,i.subtitle||"",...i.keywords].join(" ").toLowerCase().includes(a)):e},Pe=e=>{if(!(e instanceof HTMLElement))return!1;const o=e.tagName.toLowerCase();return e.isContentEditable?!0:o==="input"||o==="textarea"||o==="select"},v="__LOTUS_COMMAND_PALETTE_FORCE_OPEN__",Ee=()=>{const{t:e}=H(),{token:o}=Z.useToken(),a=typeof document<"u"&&document.body.getAttribute("data-vdi-safe")==="true",{message:i}=ee.useApp(),p=h(t=>ye(t.chats)),P=h(t=>t.addChat),c=h(t=>t.lastSelectedPromptId),l=h(t=>t.systemPrompts),g=h(U(t=>Object.entries(t.executionBySession).filter(([,s])=>X(s.phase)).map(([s])=>s).sort())),[b,f]=r.useState(()=>typeof window>"u"?!1:window[v]?(delete window[v],!0):!1),[j,x]=r.useState(""),[k,S]=r.useState(0),E=r.useRef(null),M=r.useRef(null),O=z(t=>t.open),C=B(t=>t.toggleTheme),I=B(t=>t.themeMode),A=T(t=>t.sidebar.collapsed),L=T(t=>t.setSidebarCollapsed),K=Q(t=>t.mode),N=Q(t=>t.toggleMode),R=r.useCallback(async()=>{var $,q;const t=l.find(w=>w.id===c),s=(t==null?void 0:t.id)||(l.length>0?(($=l.find(w=>w.id==="general_assistant"))==null?void 0:$.id)||l[0].id:""),m=await P({title:e("chat.sidebar.newSession"),createdAt:Date.now(),messages:[],config:{systemPromptId:s,baseSystemPrompt:(t==null?void 0:t.content)||(l.length>0?((q=l.find(w=>w.id==="general_assistant"))==null?void 0:q.content)||l[0].content:""),lastUsedEnhancedPrompt:null}}),{activeLeafId:d,setLeafSessionId:y,setActiveLeafId:V}=T.getState();y(d,m),V(d)},[P,c,l,e]),D=r.useMemo(()=>{const t=ke.filter(s=>!(K==="simple"&&G.has(s.tabKey))).map(s=>({id:s.id,kind:"action",title:e(s.titleKey,s.fallbackTitle),subtitle:e(s.subtitleKey||"commandPalette.groups.settings",s.fallbackSubtitle||"System settings"),keywords:[s.tabKey,s.badge||"","settings","config",...s.keywords||[]],icon:n.jsx(te,{}),badge:s.badge,onSelect:()=>{O("chat",s.tabKey)}}));return[{id:"new-session",kind:"action",title:e("commandPalette.actions.newSession","Create New Session"),subtitle:e("commandPalette.groups.quickActions","Quick actions"),keywords:["new","create","session","chat","conversation"],icon:n.jsx(se,{}),badge:e("commandPalette.badges.quickAction","Action"),onSelect:async()=>{await R()}},{id:"toggle-theme",kind:"action",title:I==="dark"?e("commandPalette.actions.switchToLight","Switch to Light Mode"):e("commandPalette.actions.switchToDark","Switch to Dark Mode"),subtitle:e("commandPalette.groups.quickActions","Quick actions"),keywords:["theme","dark","light","mode","appearance","toggle","color"],icon:n.jsx(ne,{}),badge:I==="dark"?"☀️":"🌙",onSelect:()=>{C()}},{id:"toggle-sidebar",kind:"action",title:A?e("commandPalette.actions.showSidebar","Show Sidebar"):e("commandPalette.actions.hideSidebar","Hide Sidebar"),subtitle:e("commandPalette.groups.quickActions","Quick actions"),keywords:["sidebar","toggle","hide","show","panel","menu"],icon:A?n.jsx(oe,{}):n.jsx(ae,{}),badge:"Layout",onSelect:()=>{L(!A)}},{id:"open-agenda",kind:"action",title:e("commandPalette.actions.openAgenda","Open Agenda"),subtitle:e("commandPalette.groups.quickActions","Quick actions"),keywords:["agenda","ledger","todo","task","reminder","event","habit","due"],icon:n.jsx(ie,{}),badge:e("commandPalette.badges.quickAction","Action"),onSelect:()=>{W.getState().open()}},{id:"split-pane",kind:"action",title:e("commandPalette.actions.splitPane","Split Pane"),subtitle:e("commandPalette.groups.quickActions","Quick actions"),keywords:["split","pane","multi","dual","side","layout"],icon:n.jsx(le,{}),badge:"Layout",onSelect:()=>{const{tree:s,activeLeafId:m,splitLeaf:d}=T.getState();Y(s).length<4&&d(m,"vertical")}},...t,{id:"toggle-experience-mode",kind:"action",title:K==="simple"?e("commandPalette.actions.switchToAdvanced","Switch to Advanced Mode"):e("commandPalette.actions.switchToSimple","Switch to Simple Mode"),subtitle:e("commandPalette.groups.quickActions","Quick actions"),keywords:["mode","simple","advanced","beginner","expert","experience","complexity"],icon:n.jsx(de,{}),badge:K==="simple"?"Simple":"Advanced",onSelect:()=>{N()}}]},[R,O,C,I,A,L,K,N,e]),_=r.useMemo(()=>{if(!b)return[];const t=new Set(g);return p.map(s=>{const m=t.has(s.id);return{id:`session-${s.id}`,kind:"session",title:s.title,subtitle:we(s,e("commandPalette.badges.childSession","Child session"),e("commandPalette.badges.rootSession","Session")),keywords:Se(s,m),icon:n.jsx(re,{}),badge:s.pinned?e("commandPalette.badges.pinned","Pinned"):m?e("commandPalette.badges.running","Running"):s.kind==="child"?e("commandPalette.badges.child","Child"):void 0,onSelect:()=>{J(s.id)}}})},[b,g,p,e]),F=r.useMemo(()=>[...D,..._],[D,_]),u=r.useMemo(()=>he(F,j).slice(0,40),[F,j]);return r.useEffect(()=>{S(t=>u.length===0?0:Math.min(t,u.length-1))},[u.length]),r.useEffect(()=>{if(!b)return;const t=window.setTimeout(()=>{var s,m;(s=E.current)==null||s.focus(),(m=E.current)==null||m.select()},0);return()=>window.clearTimeout(t)},[b]),r.useEffect(()=>{if(typeof window>"u")return;const t=s=>{if((s.metaKey||s.ctrlKey)&&s.key.toLowerCase()==="k"){s.preventDefault(),f(d=>!d);return}if(b){if(s.key==="Escape"){s.preventDefault(),f(!1);return}if(!(Pe(s.target)&&s.key!=="ArrowUp"&&s.key!=="ArrowDown"&&s.key!=="Enter")){if(s.key==="ArrowDown"){s.preventDefault(),S(d=>u.length===0?0:(d+1)%u.length);return}if(s.key==="ArrowUp"){s.preventDefault(),S(d=>u.length===0?0:d===0?u.length-1:d-1);return}if(s.key==="Enter"){const d=u[k];if(!d)return;s.preventDefault(),(async()=>{try{await d.onSelect(),f(!1),x("")}catch(y){console.error("[CommandPalette] action failed",y),i.error(y instanceof Error?y.message:e("commandPalette.errors.actionFailed","Command failed"))}})()}}}};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[u,i,b,k,e]),r.useEffect(()=>{b||(x(""),S(0))},[b]),r.useEffect(()=>{typeof window>"u"||!window[v]||(delete window[v],f(!0))},[]),r.useEffect(()=>{const t=M.current;if(!t)return;const s=t.querySelector(`[data-command-index="${k}"]`);s==null||s.scrollIntoView({block:"nearest"})},[k]),n.jsx(ce,{open:b,onCancel:()=>f(!1),footer:null,centered:!0,width:680,destroyOnClose:!0,className:"lotus-command-palette-modal",title:null,closable:!1,styles:{content:{padding:12,borderRadius:o.borderRadiusLG,overflow:"hidden",background:o.colorBgElevated,backdropFilter:a?"none":"blur(18px)",WebkitBackdropFilter:a?"none":"blur(18px)"},body:{padding:0},mask:{backdropFilter:a?"none":"blur(6px)",WebkitBackdropFilter:a?"none":"blur(6px)"}},children:n.jsxs("div",{className:"lotus-command-palette-shell",children:[n.jsxs("div",{className:"lotus-command-palette-search",children:[n.jsx(me,{style:{color:o.colorTextTertiary,fontSize:16}}),n.jsx(ue,{ref:E,value:j,onChange:t=>x(t.target.value),variant:"borderless",placeholder:e("commandPalette.searchPlaceholder","Search sessions, settings, and actions"),"aria-label":e("commandPalette.searchPlaceholder","Search sessions, settings, and actions"),suffix:n.jsx(pe.Text,{type:"secondary",style:{fontSize:12},children:"⌘K"})})]}),n.jsxs("div",{className:"lotus-command-palette-hint",children:[n.jsx(ge,{}),n.jsx("span",{children:e("commandPalette.navigationHint","Use ↑↓ to navigate, Enter to open, and Esc to close.")})]}),n.jsx("div",{ref:M,className:"lotus-command-palette-list",role:"listbox",children:u.length===0?n.jsxs("div",{className:"lotus-command-palette-empty",children:[n.jsx(be,{}),n.jsx("span",{children:e("commandPalette.empty","No matching commands")})]}):u.map((t,s)=>{const m=s===k;return n.jsxs("button",{type:"button",className:`lotus-command-palette-item ${m?"is-selected":""}`,"data-command-index":s,onMouseEnter:()=>S(s),onClick:()=>{(async()=>{try{await t.onSelect(),f(!1),x("")}catch(d){console.error("[CommandPalette] action failed",d),i.error(d instanceof Error?d.message:e("commandPalette.errors.actionFailed","Command failed"))}})()},children:[n.jsx("span",{className:"lotus-command-palette-item-icon",children:t.icon}),n.jsxs("span",{className:"lotus-command-palette-item-content",children:[n.jsxs("span",{className:"lotus-command-palette-item-title-row",children:[n.jsx("span",{className:"lotus-command-palette-item-title",children:t.title}),t.badge?n.jsx(fe,{bordered:!1,children:t.badge}):null]}),t.subtitle?n.jsx("span",{className:"lotus-command-palette-item-subtitle",children:t.subtitle}):null]})]},t.id)})})]})})};export{Ee as CommandPalette,Ee as default};
@@ -1 +1 @@
1
- import{j as a}from"./vendor-markdown-Bz_2-zkk.js";import{C as $,e as v,p as B}from"./MetricsService-Cncz4Wn7.js";import{a as l,u as E}from"./vendor-i18n-Dm-c3D_C.js";import{y as T,t as M,n as L,Q as D,U as K,H as F,w as z}from"./vendor-antd-IzIw5qDM.js";import"./vendor-mermaid-DIRrTQU1.js";import"./main-Bm_td6Y3.js";const X=({visible:p,searchText:k,onSelect:j,onCancel:g,onAutoComplete:f})=>{const[o,i]=l.useState([]),[c,R]=l.useState([]),[d,u]=l.useState(0),[N,I]=l.useState(!1),S=l.useRef(null),h=l.useRef(null);l.useEffect(()=>{if(!p)return;const s=$.getInstance();(async()=>{I(!0);try{const r=await s.listCommands();v("[CommandSelector]","[CommandSelector] Fetched commands:",r),i(r),u(0)}catch(r){console.error("[CommandSelector] Failed to fetch commands:",r),i([])}finally{I(!1)}})()},[p]),l.useEffect(()=>{const s=o.filter(e=>{var x,y,b,C,w;const r=k.toLowerCase(),n=(e.displayName??"").toLowerCase();return e.name.toLowerCase().includes(r)||n.includes(r)||e.description.toLowerCase().includes(r)||e.type==="mcp"&&[(x=e.metadata)==null?void 0:x.serverId,(y=e.metadata)==null?void 0:y.serverName,(b=e.metadata)==null?void 0:b.originalName].filter(m=>typeof m=="string").some(m=>m.toLowerCase().includes(r))||(((C=e.category)==null?void 0:C.toLowerCase().includes(r))??!1)||(((w=e.tags)==null?void 0:w.some(m=>m.toLowerCase().includes(r)))??!1)});R(s),u(0)},[o,k]),l.useEffect(()=>{if(!h.current||!S.current)return;const s=S.current,e=h.current,r=s.getBoundingClientRect(),n=e.getBoundingClientRect();n.top<r.top?e.scrollIntoView({block:"start",behavior:"smooth"}):n.bottom>r.bottom&&e.scrollIntoView({block:"end",behavior:"smooth"})},[d,c]);const t=l.useCallback(async s=>{try{j({name:s.name,type:s.type,id:s.id})}catch(e){console.error(`[CommandSelector] Failed to select command '${s.name}':`,e)}},[j]);return l.useEffect(()=>{const s=e=>{if(p)switch(e.key){case"ArrowDown":case"n":if(e.key==="n"&&!e.ctrlKey)break;e.preventDefault(),e.stopPropagation(),u(r=>r<c.length-1?r+1:0);break;case"ArrowUp":case"p":if(e.key==="p"&&!e.ctrlKey)break;e.preventDefault(),e.stopPropagation(),u(r=>r>0?r-1:c.length-1);break;case"Enter":e.preventDefault(),e.stopPropagation(),c[d]&&t(c[d]);break;case" ":case"Tab":e.preventDefault(),e.stopPropagation(),c[d]&&f&&f(c[d].name);break;case"Escape":e.preventDefault(),e.stopPropagation(),g();break}};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[p,c,d,g,f,t]),{containerRef:S,selectedItemRef:h,filteredCommands:c,selectedIndex:d,setSelectedIndex:u,isLoading:N,handleCommandSelect:t}},{useToken:P}=M,A={workflow:{color:"blue",icon:a.jsx(z,{}),labelKey:"chat.commandSelector.types.workflow"},skill:{color:"green",icon:a.jsx(F,{}),labelKey:"chat.commandSelector.types.skill"},mcp:{color:"purple",icon:a.jsx(K,{}),labelKey:"chat.commandSelector.types.mcp"},goal:{color:"gold",icon:a.jsx(D,{}),labelKey:"chat.commandSelector.types.goal"}},W=({visible:p,onSelect:k,onCancel:j,searchText:g,onAutoComplete:f})=>{const{token:o}=P(),{t:i}=E(),{containerRef:c,selectedItemRef:R,filteredCommands:d,selectedIndex:u,setSelectedIndex:N,isLoading:I,handleCommandSelect:S}=X({visible:p,searchText:g,onSelect:k,onCancel:j,onAutoComplete:f});if(!p)return null;if(I)return a.jsxs("div",{style:{position:"absolute",bottom:"100%",left:0,right:0,background:o.colorBgContainer,border:`1px solid ${o.colorBorderSecondary}`,borderRadius:o.borderRadiusSM,boxShadow:o.boxShadowSecondary,padding:`${o.paddingSM}px ${o.paddingMD}px`,zIndex:1e3,marginBottom:o.marginXS,textAlign:"center"},children:[a.jsx(T,{size:"small"})," ",i("chat.commandSelector.loading")]});if(d.length===0)return a.jsx("div",{style:{position:"absolute",bottom:"100%",left:0,right:0,background:o.colorBgContainer,border:`1px solid ${o.colorBorderSecondary}`,borderRadius:o.borderRadiusSM,boxShadow:o.boxShadowSecondary,padding:`${o.paddingSM}px ${o.paddingMD}px`,zIndex:1e3,marginBottom:o.marginXS,textAlign:"center",color:o.colorTextSecondary},children:g?i("chat.commandSelector.emptyWithSearch",{search:g}):i("chat.commandSelector.empty")});const h=(t,s)=>{var b,C,w;const e=A[t.type],r=s===u,n=t.type==="mcp"?B(t.name):null,x=t.type==="mcp"?((b=t.metadata)==null?void 0:b.originalName)||(n==null?void 0:n.toolName)||t.displayName||t.name:null,y=t.type==="mcp"&&(((C=t.metadata)==null?void 0:C.serverName)||((w=t.metadata)==null?void 0:w.serverId)||(n==null?void 0:n.serverId))||null;return a.jsxs("div",{ref:r?R:null,className:`command-selector-item ${r?"selected":""}`,onClick:()=>S(t),onMouseEnter:()=>N(s),children:[a.jsxs("div",{className:"command-selector-item-header",children:[a.jsxs("div",{className:"command-selector-item-name",style:{color:o.colorPrimary},children:["/",t.type==="mcp"&&x?x:t.name]}),a.jsxs("div",{style:{display:"flex",gap:o.marginXS},children:[t.type==="mcp"&&y&&a.jsx(L,{color:"processing",children:y}),a.jsxs(L,{color:e.color,children:[e.icon," ",i(e.labelKey)]})]})]}),a.jsx("div",{className:"command-selector-item-description",style:{color:o.colorTextSecondary},children:t.description}),t.type==="mcp"&&y&&a.jsxs("div",{className:"command-selector-item-category",style:{color:o.colorTextTertiary},children:[i("common.server")," ",y]}),t.category&&a.jsxs("div",{className:"command-selector-item-category",style:{color:o.colorTextTertiary},children:[i("common.category")," ",t.category]}),t.tags&&t.tags.length>0&&a.jsx("div",{className:"command-selector-item-tags",children:t.tags.slice(0,3).map(m=>a.jsx(L,{children:m},m))})]},t.id)};return a.jsxs("div",{ref:c,className:"command-selector-container",style:{background:o.colorBgContainer,border:`1px solid ${o.colorBorderSecondary}`,borderRadius:o.borderRadiusSM,boxShadow:o.boxShadowSecondary},children:[a.jsx("div",{style:{padding:`${o.paddingXXS}px ${o.paddingSM}px`,borderBottom:`1px solid ${o.colorBorderSecondary}`,background:o.colorFillQuaternary,fontSize:o.fontSizeSM,color:o.colorTextTertiary},children:i("chat.commandSelector.navigationHint")}),d.map((t,s)=>h(t,s))]})};export{W as default};
1
+ import{j as a}from"./vendor-markdown-BDStutVw.js";import{C as $,e as v,p as B}from"./MetricsService-BJjcr3PB.js";import{a as l,u as E}from"./vendor-i18n-Dm-c3D_C.js";import{y as T,t as M,n as L,Q as D,U as K,H as F,w as z}from"./vendor-antd-CzrN6PM8.js";import"./vendor-mermaid-CztJpwsx.js";import"./main-Bm6Xue83.js";const X=({visible:p,searchText:k,onSelect:j,onCancel:g,onAutoComplete:f})=>{const[o,i]=l.useState([]),[c,R]=l.useState([]),[d,u]=l.useState(0),[N,I]=l.useState(!1),S=l.useRef(null),h=l.useRef(null);l.useEffect(()=>{if(!p)return;const s=$.getInstance();(async()=>{I(!0);try{const r=await s.listCommands();v("[CommandSelector]","[CommandSelector] Fetched commands:",r),i(r),u(0)}catch(r){console.error("[CommandSelector] Failed to fetch commands:",r),i([])}finally{I(!1)}})()},[p]),l.useEffect(()=>{const s=o.filter(e=>{var x,y,b,C,w;const r=k.toLowerCase(),n=(e.displayName??"").toLowerCase();return e.name.toLowerCase().includes(r)||n.includes(r)||e.description.toLowerCase().includes(r)||e.type==="mcp"&&[(x=e.metadata)==null?void 0:x.serverId,(y=e.metadata)==null?void 0:y.serverName,(b=e.metadata)==null?void 0:b.originalName].filter(m=>typeof m=="string").some(m=>m.toLowerCase().includes(r))||(((C=e.category)==null?void 0:C.toLowerCase().includes(r))??!1)||(((w=e.tags)==null?void 0:w.some(m=>m.toLowerCase().includes(r)))??!1)});R(s),u(0)},[o,k]),l.useEffect(()=>{if(!h.current||!S.current)return;const s=S.current,e=h.current,r=s.getBoundingClientRect(),n=e.getBoundingClientRect();n.top<r.top?e.scrollIntoView({block:"start",behavior:"smooth"}):n.bottom>r.bottom&&e.scrollIntoView({block:"end",behavior:"smooth"})},[d,c]);const t=l.useCallback(async s=>{try{j({name:s.name,type:s.type,id:s.id})}catch(e){console.error(`[CommandSelector] Failed to select command '${s.name}':`,e)}},[j]);return l.useEffect(()=>{const s=e=>{if(p)switch(e.key){case"ArrowDown":case"n":if(e.key==="n"&&!e.ctrlKey)break;e.preventDefault(),e.stopPropagation(),u(r=>r<c.length-1?r+1:0);break;case"ArrowUp":case"p":if(e.key==="p"&&!e.ctrlKey)break;e.preventDefault(),e.stopPropagation(),u(r=>r>0?r-1:c.length-1);break;case"Enter":e.preventDefault(),e.stopPropagation(),c[d]&&t(c[d]);break;case" ":case"Tab":e.preventDefault(),e.stopPropagation(),c[d]&&f&&f(c[d].name);break;case"Escape":e.preventDefault(),e.stopPropagation(),g();break}};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[p,c,d,g,f,t]),{containerRef:S,selectedItemRef:h,filteredCommands:c,selectedIndex:d,setSelectedIndex:u,isLoading:N,handleCommandSelect:t}},{useToken:P}=M,A={workflow:{color:"blue",icon:a.jsx(z,{}),labelKey:"chat.commandSelector.types.workflow"},skill:{color:"green",icon:a.jsx(F,{}),labelKey:"chat.commandSelector.types.skill"},mcp:{color:"purple",icon:a.jsx(K,{}),labelKey:"chat.commandSelector.types.mcp"},goal:{color:"gold",icon:a.jsx(D,{}),labelKey:"chat.commandSelector.types.goal"}},W=({visible:p,onSelect:k,onCancel:j,searchText:g,onAutoComplete:f})=>{const{token:o}=P(),{t:i}=E(),{containerRef:c,selectedItemRef:R,filteredCommands:d,selectedIndex:u,setSelectedIndex:N,isLoading:I,handleCommandSelect:S}=X({visible:p,searchText:g,onSelect:k,onCancel:j,onAutoComplete:f});if(!p)return null;if(I)return a.jsxs("div",{style:{position:"absolute",bottom:"100%",left:0,right:0,background:o.colorBgContainer,border:`1px solid ${o.colorBorderSecondary}`,borderRadius:o.borderRadiusSM,boxShadow:o.boxShadowSecondary,padding:`${o.paddingSM}px ${o.paddingMD}px`,zIndex:1e3,marginBottom:o.marginXS,textAlign:"center"},children:[a.jsx(T,{size:"small"})," ",i("chat.commandSelector.loading")]});if(d.length===0)return a.jsx("div",{style:{position:"absolute",bottom:"100%",left:0,right:0,background:o.colorBgContainer,border:`1px solid ${o.colorBorderSecondary}`,borderRadius:o.borderRadiusSM,boxShadow:o.boxShadowSecondary,padding:`${o.paddingSM}px ${o.paddingMD}px`,zIndex:1e3,marginBottom:o.marginXS,textAlign:"center",color:o.colorTextSecondary},children:g?i("chat.commandSelector.emptyWithSearch",{search:g}):i("chat.commandSelector.empty")});const h=(t,s)=>{var b,C,w;const e=A[t.type],r=s===u,n=t.type==="mcp"?B(t.name):null,x=t.type==="mcp"?((b=t.metadata)==null?void 0:b.originalName)||(n==null?void 0:n.toolName)||t.displayName||t.name:null,y=t.type==="mcp"&&(((C=t.metadata)==null?void 0:C.serverName)||((w=t.metadata)==null?void 0:w.serverId)||(n==null?void 0:n.serverId))||null;return a.jsxs("div",{ref:r?R:null,className:`command-selector-item ${r?"selected":""}`,onClick:()=>S(t),onMouseEnter:()=>N(s),children:[a.jsxs("div",{className:"command-selector-item-header",children:[a.jsxs("div",{className:"command-selector-item-name",style:{color:o.colorPrimary},children:["/",t.type==="mcp"&&x?x:t.name]}),a.jsxs("div",{style:{display:"flex",gap:o.marginXS},children:[t.type==="mcp"&&y&&a.jsx(L,{color:"processing",children:y}),a.jsxs(L,{color:e.color,children:[e.icon," ",i(e.labelKey)]})]})]}),a.jsx("div",{className:"command-selector-item-description",style:{color:o.colorTextSecondary},children:t.description}),t.type==="mcp"&&y&&a.jsxs("div",{className:"command-selector-item-category",style:{color:o.colorTextTertiary},children:[i("common.server")," ",y]}),t.category&&a.jsxs("div",{className:"command-selector-item-category",style:{color:o.colorTextTertiary},children:[i("common.category")," ",t.category]}),t.tags&&t.tags.length>0&&a.jsx("div",{className:"command-selector-item-tags",children:t.tags.slice(0,3).map(m=>a.jsx(L,{children:m},m))})]},t.id)};return a.jsxs("div",{ref:c,className:"command-selector-container",style:{background:o.colorBgContainer,border:`1px solid ${o.colorBorderSecondary}`,borderRadius:o.borderRadiusSM,boxShadow:o.boxShadowSecondary},children:[a.jsx("div",{style:{padding:`${o.paddingXXS}px ${o.paddingSM}px`,borderBottom:`1px solid ${o.colorBorderSecondary}`,background:o.colorFillQuaternary,fontSize:o.fontSizeSM,color:o.colorTextTertiary},children:i("chat.commandSelector.navigationHint")}),d.map((t,s)=>h(t,s))]})};export{W as default};
@@ -1 +1 @@
1
- import{j as t}from"./vendor-markdown-Bz_2-zkk.js";import{u as P,a as T}from"./vendor-i18n-Dm-c3D_C.js";import{u as y,b as V,f as k,c as v}from"./MetricsService-Cncz4Wn7.js";import{M as w}from"./main-Bm_td6Y3.js";import{F as I,l as n,n as c,w as R,z as S,D as C,G as $,H as E,t as M}from"./vendor-antd-IzIw5qDM.js";import"./vendor-mermaid-DIRrTQU1.js";const{useToken:F}=M,O=l=>{const o=l.replace(/\/$/,"").split("/").filter(Boolean);return o.length<=2?l:`~/${o.slice(-2).join("/")}`},J=({sessionId:l})=>{const{t:o}=P(),{token:x}=F(),e=y(V(l)),f=y(a=>a.systemPrompts),r=e==null?void 0:e.config.workspacePath,i=e==null?void 0:e.config.systemPromptId,s=e==null?void 0:e.config.tokenUsage,B=(e==null?void 0:e.config.compressionEvents)??[],h=(e==null?void 0:e.placement)??null,m=T.useMemo(()=>{if(!i)return null;const a=f.find(N=>N.id===i);return(a==null?void 0:a.name)||i},[i,f]),p=T.useMemo(()=>e!=null&&e.messages?e.messages.filter(a=>a.role==="user"&&"type"in a&&a.type==="file_reference").length:0,[e==null?void 0:e.messages]);if(!e)return null;const g=(s==null?void 0:s.summaryTokens)??0,b=B.length,d=(s==null?void 0:s.promptCachedToolOutputs)??0,u=(s==null?void 0:s.promptCachedToolTokensSaved)??0,j=g>0||b>0,_=d>0||u>0;return h||r||m||p>0||j||_?t.jsx("div",{className:"lotus-context-bar",style:{borderBottomColor:x.colorBorderSecondary,backgroundColor:x.colorBgContainer},children:t.jsxs(I,{align:"center",gap:6,wrap:"wrap",className:"lotus-context-bar__content",children:[t.jsx(w,{placement:h}),r&&t.jsx(n,{title:o("chat.contextBar.workspaceTooltip",{path:r,defaultValue:"Workspace context: {{path}}"}),children:t.jsxs(c,{className:"lotus-context-bar__tag",icon:t.jsx(R,{}),bordered:!1,children:[t.jsx("span",{className:"lotus-context-bar__tag-label",children:o("chat.contextBar.workspace",{defaultValue:"Workspace"})}),O(r)]})}),p>0&&t.jsx(n,{title:o("chat.contextBar.fileRefsTooltip",{count:p,defaultValue:"{{count}} file reference(s) in this session"}),children:t.jsxs(c,{className:"lotus-context-bar__tag",icon:t.jsx(S,{}),bordered:!1,children:[t.jsx("span",{className:"lotus-context-bar__tag-label",children:o("chat.contextBar.files",{defaultValue:"Files"})}),p]})}),m&&t.jsx(n,{title:o("chat.contextBar.promptTooltip",{name:m,defaultValue:"System prompt: {{name}}"}),children:t.jsxs(c,{className:"lotus-context-bar__tag",icon:t.jsx(C,{}),bordered:!1,children:[t.jsx("span",{className:"lotus-context-bar__tag-label",children:o("chat.contextBar.prompt",{defaultValue:"Prompt"})}),m]})}),j&&t.jsx(n,{title:o("chat.contextBar.summaryTooltip",{tokens:k(g),count:b,defaultValue:"Conversation summary contributes {{tokens}} tokens. {{count}} compression event(s) archived older messages."}),children:t.jsx(c,{className:"lotus-context-bar__tag lotus-context-bar__tag--signal",icon:t.jsx($,{}),bordered:!1,color:"gold",children:o("chat.contextBar.summary",{defaultValue:"Summary"})})}),_&&t.jsx(n,{title:o("chat.contextBar.promptCacheTooltip",{count:d,tokens:k(u),defaultValue:"{{count}} tool output(s) were compacted into prompt-side cache notes, saving {{tokens}} tokens."}),children:t.jsxs(c,{className:"lotus-context-bar__tag lotus-context-bar__tag--signal",icon:t.jsx(E,{}),bordered:!1,color:"green",children:[t.jsx("span",{className:"lotus-context-bar__tag-label",children:o("chat.contextBar.promptCache",{defaultValue:"Prompt cache"})}),u>0?v(u):d]})})]})}):null};export{J as ContextBar,J as default};
1
+ import{j as t}from"./vendor-markdown-BDStutVw.js";import{u as P,a as T}from"./vendor-i18n-Dm-c3D_C.js";import{u as y,b as V,f as k,c as v}from"./MetricsService-BJjcr3PB.js";import{M as w}from"./main-Bm6Xue83.js";import{F as I,l as n,n as c,w as R,z as S,D as C,G as $,H as E,t as M}from"./vendor-antd-CzrN6PM8.js";import"./vendor-mermaid-CztJpwsx.js";const{useToken:F}=M,O=l=>{const o=l.replace(/\/$/,"").split("/").filter(Boolean);return o.length<=2?l:`~/${o.slice(-2).join("/")}`},J=({sessionId:l})=>{const{t:o}=P(),{token:x}=F(),e=y(V(l)),f=y(a=>a.systemPrompts),r=e==null?void 0:e.config.workspacePath,i=e==null?void 0:e.config.systemPromptId,s=e==null?void 0:e.config.tokenUsage,B=(e==null?void 0:e.config.compressionEvents)??[],h=(e==null?void 0:e.placement)??null,m=T.useMemo(()=>{if(!i)return null;const a=f.find(N=>N.id===i);return(a==null?void 0:a.name)||i},[i,f]),p=T.useMemo(()=>e!=null&&e.messages?e.messages.filter(a=>a.role==="user"&&"type"in a&&a.type==="file_reference").length:0,[e==null?void 0:e.messages]);if(!e)return null;const g=(s==null?void 0:s.summaryTokens)??0,b=B.length,d=(s==null?void 0:s.promptCachedToolOutputs)??0,u=(s==null?void 0:s.promptCachedToolTokensSaved)??0,j=g>0||b>0,_=d>0||u>0;return h||r||m||p>0||j||_?t.jsx("div",{className:"lotus-context-bar",style:{borderBottomColor:x.colorBorderSecondary,backgroundColor:x.colorBgContainer},children:t.jsxs(I,{align:"center",gap:6,wrap:"wrap",className:"lotus-context-bar__content",children:[t.jsx(w,{placement:h}),r&&t.jsx(n,{title:o("chat.contextBar.workspaceTooltip",{path:r,defaultValue:"Workspace context: {{path}}"}),children:t.jsxs(c,{className:"lotus-context-bar__tag",icon:t.jsx(R,{}),bordered:!1,children:[t.jsx("span",{className:"lotus-context-bar__tag-label",children:o("chat.contextBar.workspace",{defaultValue:"Workspace"})}),O(r)]})}),p>0&&t.jsx(n,{title:o("chat.contextBar.fileRefsTooltip",{count:p,defaultValue:"{{count}} file reference(s) in this session"}),children:t.jsxs(c,{className:"lotus-context-bar__tag",icon:t.jsx(S,{}),bordered:!1,children:[t.jsx("span",{className:"lotus-context-bar__tag-label",children:o("chat.contextBar.files",{defaultValue:"Files"})}),p]})}),m&&t.jsx(n,{title:o("chat.contextBar.promptTooltip",{name:m,defaultValue:"System prompt: {{name}}"}),children:t.jsxs(c,{className:"lotus-context-bar__tag",icon:t.jsx(C,{}),bordered:!1,children:[t.jsx("span",{className:"lotus-context-bar__tag-label",children:o("chat.contextBar.prompt",{defaultValue:"Prompt"})}),m]})}),j&&t.jsx(n,{title:o("chat.contextBar.summaryTooltip",{tokens:k(g),count:b,defaultValue:"Conversation summary contributes {{tokens}} tokens. {{count}} compression event(s) archived older messages."}),children:t.jsx(c,{className:"lotus-context-bar__tag lotus-context-bar__tag--signal",icon:t.jsx($,{}),bordered:!1,color:"gold",children:o("chat.contextBar.summary",{defaultValue:"Summary"})})}),_&&t.jsx(n,{title:o("chat.contextBar.promptCacheTooltip",{count:d,tokens:k(u),defaultValue:"{{count}} tool output(s) were compacted into prompt-side cache notes, saving {{tokens}} tokens."}),children:t.jsxs(c,{className:"lotus-context-bar__tag lotus-context-bar__tag--signal",icon:t.jsx(E,{}),bordered:!1,color:"green",children:[t.jsx("span",{className:"lotus-context-bar__tag-label",children:o("chat.contextBar.promptCache",{defaultValue:"Prompt cache"})}),u>0?v(u):d]})})]})}):null};export{J as ContextBar,J as default};
@@ -1 +1 @@
1
- import{j as n}from"./vendor-markdown-Bz_2-zkk.js";import{u as d}from"./vendor-i18n-Dm-c3D_C.js";import{j as i,k as c,T as p,l as u,n as x,B as m,o as h,t as y}from"./vendor-antd-IzIw5qDM.js";const{Text:g}=p,{useToken:j}=y,T=({files:o,onRemove:a,onClear:r})=>{const{token:e}=j(),{t:s}=d();return o.length===0?null:n.jsx("div",{style:{marginBottom:e.marginSM,padding:`${e.paddingXXS}px ${e.paddingXS}px`,borderRadius:999,background:e.colorFillSecondary,border:`1px solid ${e.colorBorderSecondary}`},children:n.jsxs(i,{align:"center",size:e.marginXS,style:{width:"100%",justifyContent:"space-between"},children:[n.jsxs(i,{align:"center",wrap:!0,size:e.marginXS,children:[n.jsx(c,{style:{color:e.colorTextSecondary}}),n.jsx(g,{type:"secondary",style:{fontSize:e.fontSizeSM},children:s("chat.filePreview.fileCount",{count:o.length})}),o.map(t=>n.jsx(u,{title:`${t.type||"unknown"} • ${(t.size/1024).toFixed(1)} KB`,children:n.jsx(x,{closable:!0,onClose:l=>{l.preventDefault(),a(t.id)},style:{borderRadius:999,marginInlineEnd:0,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name})},t.id))]}),r?n.jsx(m,{type:"text",size:"small",icon:n.jsx(h,{}),onClick:r,style:{borderRadius:999},children:s("common.clear")}):null]})})};export{T as default};
1
+ import{j as n}from"./vendor-markdown-BDStutVw.js";import{u as d}from"./vendor-i18n-Dm-c3D_C.js";import{j as i,k as c,T as p,l as u,n as x,B as m,o as h,t as y}from"./vendor-antd-CzrN6PM8.js";const{Text:g}=p,{useToken:j}=y,T=({files:o,onRemove:a,onClear:r})=>{const{token:e}=j(),{t:s}=d();return o.length===0?null:n.jsx("div",{style:{marginBottom:e.marginSM,padding:`${e.paddingXXS}px ${e.paddingXS}px`,borderRadius:999,background:e.colorFillSecondary,border:`1px solid ${e.colorBorderSecondary}`},children:n.jsxs(i,{align:"center",size:e.marginXS,style:{width:"100%",justifyContent:"space-between"},children:[n.jsxs(i,{align:"center",wrap:!0,size:e.marginXS,children:[n.jsx(c,{style:{color:e.colorTextSecondary}}),n.jsx(g,{type:"secondary",style:{fontSize:e.fontSizeSM},children:s("chat.filePreview.fileCount",{count:o.length})}),o.map(t=>n.jsx(u,{title:`${t.type||"unknown"} • ${(t.size/1024).toFixed(1)} KB`,children:n.jsx(x,{closable:!0,onClose:l=>{l.preventDefault(),a(t.id)},style:{borderRadius:999,marginInlineEnd:0,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name})},t.id))]}),r?n.jsx(m,{type:"text",size:"small",icon:n.jsx(h,{}),onClick:r,style:{borderRadius:999},children:s("common.clear")}):null]})})};export{T as default};
@@ -1 +1 @@
1
- import{j as e}from"./vendor-markdown-Bz_2-zkk.js";import{u as I,a}from"./vendor-i18n-Dm-c3D_C.js";import{q as z,u as D,E as w,v as R,j as y,w as b,k as X,T as M,B as k,x as L,y as A,t as B}from"./vendor-antd-IzIw5qDM.js";const{Text:x}=M,{useToken:C}=B,K=({visible:c,files:l,searchText:d,loading:h,error:g,onSelect:f,onCancel:m,onChangeWorkspace:j})=>{const{token:s}=C(),{t:i}=I(),[n,u]=a.useState(0),E=a.useRef(null),S=a.useRef(null),o=a.useMemo(()=>{const t=d.trim().toLowerCase();return t?l.filter(r=>r.name.toLowerCase().startsWith(t)):l},[l,d]);return a.useEffect(()=>{u(0)},[d,l]),a.useEffect(()=>{if(!c)return;const t=r=>{c&&(r.key==="ArrowDown"||r.key==="n"&&r.ctrlKey?(r.preventDefault(),u(p=>o.length===0?0:(p+1)%o.length)):r.key==="ArrowUp"||r.key==="p"&&r.ctrlKey?(r.preventDefault(),u(p=>o.length===0?0:(p-1+o.length)%o.length)):r.key==="Enter"||r.key==="Tab"?o[n]&&(r.preventDefault(),f(o[n])):r.key==="Escape"&&(r.preventDefault(),m()))};return window.addEventListener("keydown",t),()=>{window.removeEventListener("keydown",t)}},[c,o,n,f,m]),a.useEffect(()=>{if(!c)return;const t=S.current;t&&t.scrollIntoView({block:"nearest"})},[n,c]),c?e.jsx("div",{style:{position:"absolute",bottom:"100%",left:0,right:0,zIndex:1e3,marginBottom:s.marginXS},children:e.jsx(z,{size:"small",style:{borderRadius:s.borderRadius,border:`1px solid ${s.colorBorderSecondary}`,boxShadow:s.boxShadowSecondary},styles:{body:{padding:s.paddingXS,maxHeight:240,overflowY:"auto"}},title:e.jsxs(y,{align:"center",size:s.marginXS,children:[e.jsx(x,{strong:!0,children:i("chat.fileReference.title")}),h&&e.jsx(A,{size:"small"})]}),extra:e.jsxs(y,{size:s.marginXS,children:[j&&e.jsx(k,{type:"text",size:"small",icon:e.jsx(L,{}),onClick:j,children:i("chat.fileReference.setWorkspace")}),e.jsx(k,{type:"text",size:"small",onClick:m,children:i("common.close")})]}),children:g?e.jsx(D,{type:"error",message:g,showIcon:!0}):o.length===0&&!h?e.jsx(w,{image:w.PRESENTED_IMAGE_SIMPLE,description:i(d?"chat.fileReference.noMatches":"chat.fileReference.emptyDirectory")}):e.jsx("div",{ref:E,children:e.jsx(R,{dataSource:o,renderItem:(t,r)=>e.jsx(R.Item,{onMouseEnter:()=>u(r),onClick:()=>f(t),ref:r===n?S:void 0,style:{cursor:"pointer",backgroundColor:r===n?s.colorPrimaryBg:"transparent",borderRadius:s.borderRadiusSM,padding:`${s.paddingXXS}px ${s.paddingXS}px`},children:e.jsxs(y,{size:s.marginXS,align:"center",children:[t.is_directory?e.jsx(b,{}):e.jsx(X,{}),e.jsxs("div",{children:[e.jsx(x,{children:t.name}),e.jsx("div",{children:e.jsx(x,{type:"secondary",style:{fontSize:s.fontSizeSM},children:t.is_directory?i("common.directory"):i("common.file")})})]})]})},t.path)})})})}):null};export{K as default};
1
+ import{j as e}from"./vendor-markdown-BDStutVw.js";import{u as I,a}from"./vendor-i18n-Dm-c3D_C.js";import{q as z,u as D,E as w,v as R,j as y,w as b,k as X,T as M,B as k,x as L,y as A,t as B}from"./vendor-antd-CzrN6PM8.js";const{Text:x}=M,{useToken:C}=B,K=({visible:c,files:l,searchText:d,loading:h,error:g,onSelect:f,onCancel:m,onChangeWorkspace:j})=>{const{token:s}=C(),{t:i}=I(),[n,u]=a.useState(0),E=a.useRef(null),S=a.useRef(null),o=a.useMemo(()=>{const t=d.trim().toLowerCase();return t?l.filter(r=>r.name.toLowerCase().startsWith(t)):l},[l,d]);return a.useEffect(()=>{u(0)},[d,l]),a.useEffect(()=>{if(!c)return;const t=r=>{c&&(r.key==="ArrowDown"||r.key==="n"&&r.ctrlKey?(r.preventDefault(),u(p=>o.length===0?0:(p+1)%o.length)):r.key==="ArrowUp"||r.key==="p"&&r.ctrlKey?(r.preventDefault(),u(p=>o.length===0?0:(p-1+o.length)%o.length)):r.key==="Enter"||r.key==="Tab"?o[n]&&(r.preventDefault(),f(o[n])):r.key==="Escape"&&(r.preventDefault(),m()))};return window.addEventListener("keydown",t),()=>{window.removeEventListener("keydown",t)}},[c,o,n,f,m]),a.useEffect(()=>{if(!c)return;const t=S.current;t&&t.scrollIntoView({block:"nearest"})},[n,c]),c?e.jsx("div",{style:{position:"absolute",bottom:"100%",left:0,right:0,zIndex:1e3,marginBottom:s.marginXS},children:e.jsx(z,{size:"small",style:{borderRadius:s.borderRadius,border:`1px solid ${s.colorBorderSecondary}`,boxShadow:s.boxShadowSecondary},styles:{body:{padding:s.paddingXS,maxHeight:240,overflowY:"auto"}},title:e.jsxs(y,{align:"center",size:s.marginXS,children:[e.jsx(x,{strong:!0,children:i("chat.fileReference.title")}),h&&e.jsx(A,{size:"small"})]}),extra:e.jsxs(y,{size:s.marginXS,children:[j&&e.jsx(k,{type:"text",size:"small",icon:e.jsx(L,{}),onClick:j,children:i("chat.fileReference.setWorkspace")}),e.jsx(k,{type:"text",size:"small",onClick:m,children:i("common.close")})]}),children:g?e.jsx(D,{type:"error",message:g,showIcon:!0}):o.length===0&&!h?e.jsx(w,{image:w.PRESENTED_IMAGE_SIMPLE,description:i(d?"chat.fileReference.noMatches":"chat.fileReference.emptyDirectory")}):e.jsx("div",{ref:E,children:e.jsx(R,{dataSource:o,renderItem:(t,r)=>e.jsx(R.Item,{onMouseEnter:()=>u(r),onClick:()=>f(t),ref:r===n?S:void 0,style:{cursor:"pointer",backgroundColor:r===n?s.colorPrimaryBg:"transparent",borderRadius:s.borderRadiusSM,padding:`${s.paddingXXS}px ${s.paddingXS}px`},children:e.jsxs(y,{size:s.marginXS,align:"center",children:[t.is_directory?e.jsx(b,{}):e.jsx(X,{}),e.jsxs("div",{children:[e.jsx(x,{children:t.name}),e.jsx("div",{children:e.jsx(x,{type:"secondary",style:{fontSize:s.fontSizeSM},children:t.is_directory?i("common.directory"):i("common.file")})})]})]})},t.path)})})})}):null};export{K as default};
@@ -1 +1 @@
1
- import{j as s}from"./vendor-markdown-Bz_2-zkk.js";import{u as g,a as c,i as m}from"./vendor-i18n-Dm-c3D_C.js";import{u as p,d as y,E as T}from"./MetricsService-Cncz4Wn7.js";import{t as v,I as S,H as w,J as R,N as k,w as A,O as I,n as b,P as M}from"./vendor-antd-IzIw5qDM.js";import"./vendor-mermaid-DIRrTQU1.js";import"./main-Bm_td6Y3.js";const C=5,D=5,P=5,$=o=>{if(!o)return"";try{const n=Date.now()-new Date(o).getTime();if(n<0)return"";const t=Math.floor(n/1e3);if(t<60)return m.t("chat.home.justNow");const l=Math.floor(t/60);if(l<60)return m.t("chat.home.minutesAgo",{count:l});const i=Math.floor(l/60);if(i<24)return m.t("chat.home.hoursAgo",{count:i});const a=Math.floor(i/24);return a<30?m.t("chat.home.daysAgo",{count:a}):new Date(o).toLocaleDateString()}catch{return""}},E=(o,n)=>n?"is-running":o.lastRunStatus==="error"?"is-error":o.pinned?"is-pinned":"is-idle",x=({chat:o,onOpen:n,textSecondary:t})=>{const{t:l}=g(),i=p(y(o.id)),a=o.config.workspacePath?o.config.workspacePath.split("/").pop()||o.config.workspacePath:null;return s.jsxs("button",{type:"button",className:"lotus-home-session-item",onClick:()=>n(o.id),children:[s.jsx("span",{className:`lotus-home-session-status ${E(o,i)}`}),s.jsxs("span",{className:"lotus-home-session-content",children:[s.jsx("span",{className:"lotus-home-session-title",children:o.title}),s.jsxs("span",{className:"lotus-home-session-meta",style:{color:t},children:[s.jsx("span",{children:$(o.updatedAt)}),a?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"lotus-home-session-meta-sep"}),s.jsxs("span",{children:[s.jsx(A,{style:{marginRight:3}}),a]})]}):null,o.messageCount!=null?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"lotus-home-session-meta-sep"}),s.jsxs("span",{children:[s.jsx(I,{style:{marginRight:3}}),o.messageCount]})]}):null]})]}),i?s.jsx(b,{color:"green",bordered:!1,style:{margin:0,fontSize:11},children:l("chat.home.running")}):null,s.jsx(M,{className:"lotus-home-session-arrow"})]})},z=({onOpenSession:o})=>{const{t:n}=g(),{token:t}=v.useToken(),l=p(e=>e.chats),i=c.useCallback(e=>y(e)(p.getState()),[]),a=c.useMemo(()=>l.filter(e=>i(e.id)).slice(0,D),[l,i]),d=c.useMemo(()=>l.filter(e=>e.pinned&&!i(e.id)).slice(0,P),[l,i]),j=c.useMemo(()=>{const e=new Set(a.map(r=>r.id)),N=new Set(d.map(r=>r.id));return l.filter(r=>r.kind!=="child"&&!e.has(r.id)&&!N.has(r.id)).sort((r,h)=>{const f=r.updatedAt?new Date(r.updatedAt).getTime():r.createdAt;return(h.updatedAt?new Date(h.updatedAt).getTime():h.createdAt)-f}).slice(0,C)},[l,a,d]),u=c.useCallback(e=>{o(e)},[o]);return s.jsx("div",{className:"lotus-home-dashboard",children:s.jsxs("div",{className:"lotus-home-dashboard-inner",children:[s.jsxs("div",{className:"lotus-home-header",children:[s.jsx("span",{className:"lotus-home-header-icon",style:{background:`${t.colorPrimary}15`,color:t.colorPrimary},children:s.jsx(S,{})}),s.jsxs("div",{className:"lotus-home-header-text",children:[s.jsx("h2",{style:{color:t.colorText},children:n("home.title","Welcome to Bodhi")}),s.jsx("p",{style:{color:t.colorTextSecondary},children:n("home.subtitle","Here's an overview of your workspace.")})]})]}),s.jsx("div",{className:"lotus-home-launcher-shell","data-tour-id":"task-templates",children:s.jsx(T,{embedded:!0,layoutMode:"staggered"})}),s.jsxs("div",{className:"lotus-home-secondary-sections",children:[a.length>0?s.jsxs("div",{className:"lotus-home-section",children:[s.jsxs("div",{className:"lotus-home-section-title",style:{color:t.colorTextSecondary},children:[s.jsx(w,{className:"lotus-home-section-icon",style:{color:t.colorSuccess}}),s.jsx("span",{children:n("home.sections.running","Running Now")})]}),s.jsx("div",{className:"lotus-home-session-list",children:a.map(e=>s.jsx(x,{chat:e,onOpen:u,textSecondary:t.colorTextTertiary},e.id))})]}):null,d.length>0?s.jsxs("div",{className:"lotus-home-section",children:[s.jsxs("div",{className:"lotus-home-section-title",style:{color:t.colorTextSecondary},children:[s.jsx(R,{className:"lotus-home-section-icon",style:{color:"var(--lotus-gold)"}}),s.jsx("span",{children:n("home.sections.pinned","Pinned")})]}),s.jsx("div",{className:"lotus-home-session-list",children:d.map(e=>s.jsx(x,{chat:e,onOpen:u,textSecondary:t.colorTextTertiary},e.id))})]}):null,j.length>0?s.jsxs("div",{className:"lotus-home-section",children:[s.jsxs("div",{className:"lotus-home-section-title",style:{color:t.colorTextSecondary},children:[s.jsx(k,{className:"lotus-home-section-icon"}),s.jsx("span",{children:n("home.sections.recent","Recent Sessions")})]}),s.jsx("div",{className:"lotus-home-session-list",children:j.map(e=>s.jsx(x,{chat:e,onOpen:u,textSecondary:t.colorTextTertiary},e.id))})]}):null,l.length===0?s.jsx("div",{className:"lotus-home-empty-hint",style:{color:t.colorTextTertiary},children:n("home.empty","No sessions yet. Create one to get started!")}):null]})]})})};export{z as HomeDashboard,z as default};
1
+ import{j as s}from"./vendor-markdown-BDStutVw.js";import{u as g,a as c,i as m}from"./vendor-i18n-Dm-c3D_C.js";import{u as p,d as y,E as T}from"./MetricsService-BJjcr3PB.js";import{t as v,I as S,H as w,J as R,N as k,w as A,O as I,n as b,P as M}from"./vendor-antd-CzrN6PM8.js";import"./vendor-mermaid-CztJpwsx.js";import"./main-Bm6Xue83.js";const C=5,D=5,P=5,$=o=>{if(!o)return"";try{const n=Date.now()-new Date(o).getTime();if(n<0)return"";const t=Math.floor(n/1e3);if(t<60)return m.t("chat.home.justNow");const l=Math.floor(t/60);if(l<60)return m.t("chat.home.minutesAgo",{count:l});const i=Math.floor(l/60);if(i<24)return m.t("chat.home.hoursAgo",{count:i});const a=Math.floor(i/24);return a<30?m.t("chat.home.daysAgo",{count:a}):new Date(o).toLocaleDateString()}catch{return""}},E=(o,n)=>n?"is-running":o.lastRunStatus==="error"?"is-error":o.pinned?"is-pinned":"is-idle",x=({chat:o,onOpen:n,textSecondary:t})=>{const{t:l}=g(),i=p(y(o.id)),a=o.config.workspacePath?o.config.workspacePath.split("/").pop()||o.config.workspacePath:null;return s.jsxs("button",{type:"button",className:"lotus-home-session-item",onClick:()=>n(o.id),children:[s.jsx("span",{className:`lotus-home-session-status ${E(o,i)}`}),s.jsxs("span",{className:"lotus-home-session-content",children:[s.jsx("span",{className:"lotus-home-session-title",children:o.title}),s.jsxs("span",{className:"lotus-home-session-meta",style:{color:t},children:[s.jsx("span",{children:$(o.updatedAt)}),a?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"lotus-home-session-meta-sep"}),s.jsxs("span",{children:[s.jsx(A,{style:{marginRight:3}}),a]})]}):null,o.messageCount!=null?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"lotus-home-session-meta-sep"}),s.jsxs("span",{children:[s.jsx(I,{style:{marginRight:3}}),o.messageCount]})]}):null]})]}),i?s.jsx(b,{color:"green",bordered:!1,style:{margin:0,fontSize:11},children:l("chat.home.running")}):null,s.jsx(M,{className:"lotus-home-session-arrow"})]})},z=({onOpenSession:o})=>{const{t:n}=g(),{token:t}=v.useToken(),l=p(e=>e.chats),i=c.useCallback(e=>y(e)(p.getState()),[]),a=c.useMemo(()=>l.filter(e=>i(e.id)).slice(0,D),[l,i]),d=c.useMemo(()=>l.filter(e=>e.pinned&&!i(e.id)).slice(0,P),[l,i]),j=c.useMemo(()=>{const e=new Set(a.map(r=>r.id)),N=new Set(d.map(r=>r.id));return l.filter(r=>r.kind!=="child"&&!e.has(r.id)&&!N.has(r.id)).sort((r,h)=>{const f=r.updatedAt?new Date(r.updatedAt).getTime():r.createdAt;return(h.updatedAt?new Date(h.updatedAt).getTime():h.createdAt)-f}).slice(0,C)},[l,a,d]),u=c.useCallback(e=>{o(e)},[o]);return s.jsx("div",{className:"lotus-home-dashboard",children:s.jsxs("div",{className:"lotus-home-dashboard-inner",children:[s.jsxs("div",{className:"lotus-home-header",children:[s.jsx("span",{className:"lotus-home-header-icon",style:{background:`${t.colorPrimary}15`,color:t.colorPrimary},children:s.jsx(S,{})}),s.jsxs("div",{className:"lotus-home-header-text",children:[s.jsx("h2",{style:{color:t.colorText},children:n("home.title","Welcome to Bodhi")}),s.jsx("p",{style:{color:t.colorTextSecondary},children:n("home.subtitle","Here's an overview of your workspace.")})]})]}),s.jsx("div",{className:"lotus-home-launcher-shell","data-tour-id":"task-templates",children:s.jsx(T,{embedded:!0,layoutMode:"staggered"})}),s.jsxs("div",{className:"lotus-home-secondary-sections",children:[a.length>0?s.jsxs("div",{className:"lotus-home-section",children:[s.jsxs("div",{className:"lotus-home-section-title",style:{color:t.colorTextSecondary},children:[s.jsx(w,{className:"lotus-home-section-icon",style:{color:t.colorSuccess}}),s.jsx("span",{children:n("home.sections.running","Running Now")})]}),s.jsx("div",{className:"lotus-home-session-list",children:a.map(e=>s.jsx(x,{chat:e,onOpen:u,textSecondary:t.colorTextTertiary},e.id))})]}):null,d.length>0?s.jsxs("div",{className:"lotus-home-section",children:[s.jsxs("div",{className:"lotus-home-section-title",style:{color:t.colorTextSecondary},children:[s.jsx(R,{className:"lotus-home-section-icon",style:{color:"var(--lotus-gold)"}}),s.jsx("span",{children:n("home.sections.pinned","Pinned")})]}),s.jsx("div",{className:"lotus-home-session-list",children:d.map(e=>s.jsx(x,{chat:e,onOpen:u,textSecondary:t.colorTextTertiary},e.id))})]}):null,j.length>0?s.jsxs("div",{className:"lotus-home-section",children:[s.jsxs("div",{className:"lotus-home-section-title",style:{color:t.colorTextSecondary},children:[s.jsx(k,{className:"lotus-home-section-icon"}),s.jsx("span",{children:n("home.sections.recent","Recent Sessions")})]}),s.jsx("div",{className:"lotus-home-session-list",children:j.map(e=>s.jsx(x,{chat:e,onOpen:u,textSecondary:t.colorTextTertiary},e.id))})]}):null,l.length===0?s.jsx("div",{className:"lotus-home-empty-hint",style:{color:t.colorTextTertiary},children:n("home.empty","No sessions yet. Create one to get started!")}):null]})]})})};export{z as HomeDashboard,z as default};
@@ -0,0 +1 @@
1
+ var Ce=Object.defineProperty;var Me=(e,t,n)=>t in e?Ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ie=(e,t,n)=>Me(e,typeof t!="symbol"?t+"":t,n);import{j as r}from"./vendor-markdown-BDStutVw.js";import{u as pe,a as i}from"./vendor-i18n-Dm-c3D_C.js";import{L as fe,M as oe,t as C,N as V,O as Ee,D as M}from"./MetricsService-BJjcr3PB.js";import{a9 as Le,ax as y,ay as _e,F as u,az as Fe,ap as j,l as v,B as w,ah as $e,y as de,E as z,aA as q,aB as ze,T as qe,x as De,aa as ce,n as W,aC as Pe,p as Oe,aD as Ne,af as Be,aE as Ue,W as He,aF as Ke,al as Qe,aG as Ve}from"./vendor-antd-CzrN6PM8.js";import"./vendor-mermaid-CztJpwsx.js";import"./main-Bm6Xue83.js";function We(e,t,n){const[a,l]=fe(n==null?void 0:n.in,e,t);return+oe(a)==+oe(l)}function Ge(e,t,n){const[a,l]=fe(n==null?void 0:n.in,e,t);return a.getFullYear()===l.getFullYear()}function ue(e){return e?`?project_key=${encodeURIComponent(e)}`:""}const m=class m{static getInstance(){return m.instance||(m.instance=new m),m.instance}async getAgenda(t={}){const n=new URLSearchParams;t.projectKey&&n.set("project_key",t.projectKey),t.horizonDays!=null&&n.set("horizon_days",String(t.horizonDays));const a=n.toString();return C.get(`ledger/agenda${a?`?${a}`:""}`)}async listRecords(t={}){const n=new URLSearchParams;t.scope&&n.set("scope",t.scope),t.projectKey&&n.set("project_key",t.projectKey),t.status&&t.status.length>0&&n.set("status",t.status.join(",")),t.kind&&t.kind.length>0&&n.set("kind",t.kind.join(",")),t.includeTerminal!=null&&n.set("include_terminal",String(t.includeTerminal)),t.parentId&&n.set("parent_id",t.parentId),t.limit!=null&&n.set("limit",String(t.limit));const a=n.toString();return C.get(`ledger/records${a?`?${a}`:""}`)}async upsertRecord(t){return C.post("ledger/records",t)}async patchRecord(t,n,a){const l=encodeURIComponent(t);return C.patch(`ledger/records/${l}${ue(a)}`,n)}async deleteRecord(t,n){const a=encodeURIComponent(t);return C.delete(`ledger/records/${a}${ue(n)}`)}};ie(m,"instance",null);let Y=m;const Ye=new Set(["done","cancelled","expired"]);function Je(e){return Ye.has(e)}function Xe(e){var t,n;return e?(((t=e.overdue)==null?void 0:t.length)??0)+(((n=e.today)==null?void 0:n.length)??0):0}function Ze(e){switch(e){case"critical":return"red";case"high":return"orange";case"medium":return"blue";case"low":default:return"default"}}function et(e){switch(e){case"in_progress":return"processing";case"blocked":return"warning";case"done":return"success";case"expired":return"error";case"cancelled":return"default";case"open":default:return"blue"}}function tt(e){switch(e){case"todo":return"geekblue";case"event":return"purple";case"reminder":return"gold";case"habit":return"green";default:return"default"}}function rt(e,t=new Date){if(!e)return"";const n=new Date(e);return Number.isNaN(n.getTime())?e:We(n,t)?V(n,"HH:mm"):Ge(n,t)?V(n,"MMM d, HH:mm"):V(n,"yyyy-MM-dd HH:mm")}function G(e){return String(e??"").trim()||void 0}function ge(e){return Array.from(new Set(String(e??"").split(",").map(t=>t.trim()).filter(Boolean)))}function D(e){return{id:e.id,kind:e.kind,title:e.title,status:e.status,priority:e.priority,project_key:e.project_key,timeAt:e.due_at??e.anchor_at,hasDetails:!1}}function nt(e){var t,n;return{id:e.id,kind:e.kind,title:e.title,status:e.status,priority:e.priority,project_key:e.project_key,timeAt:((t=e.time)==null?void 0:t.due_at)??((n=e.time)==null?void 0:n.starts_at),tags:e.tags,hasDetails:!0}}function st(e){return{title:e.title,kind:e.kind,priority:e.priority,due_at:e.timeAt??"",tags:(e.tags??[]).join(", "),body:e.body??""}}function at(e,t,n){const a={id:e};let l=!1;const c=G(n.title);c&&c!==t.title.trim()&&(a.title=c,l=!0),n.kind&&n.kind!==t.kind&&(a.kind=n.kind,l=!0),n.priority&&n.priority!==t.priority&&(a.priority=n.priority,l=!0);const T=G(n.due_at),O=G(t.due_at);T&&T!==O&&(a.due_at=T,l=!0);const A=ge(n.tags),o=ge(t.tags);A.join("\0")!==o.join("\0")&&(a.tags=A,l=!0);const E=String(n.body??"").trim(),L=String(t.body??"").trim();return E!==L&&(a.body=E,l=!0),l?a:null}function lt(e,t){const n=e.trim();if(!n)return null;const a={kind:"todo",title:n},l=(t??"").trim();return l&&(a.due_at=l),a}const{Text:I}=qe,S=Y.getInstance(),it=["todo","event","reminder","habit"],ot=["open","in_progress","blocked","done","cancelled","expired"],dt=["low","medium","high","critical"];function ct(e){switch(e){case"todo":return r.jsx(Ve,{});case"event":return r.jsx(Qe,{});case"reminder":return r.jsx(Ke,{});case"habit":return r.jsx(He,{});default:return r.jsx(Ue,{})}}const he=({item:e,actions:t})=>{const{t:n}=pe(),a=Je(e.status),l=rt(e.timeAt);return r.jsxs(u,{"data-testid":`ledger-item-${e.id}`,align:"center",justify:"space-between",gap:8,style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--ant-color-border-secondary, rgba(0,0,0,0.06))"},children:[r.jsxs(u,{vertical:!0,gap:4,style:{minWidth:0,flex:1,cursor:"pointer"},onClick:()=>t.onEdit(e),children:[r.jsx(I,{strong:!0,ellipsis:!0,delete:a,style:{fontSize:13},children:e.title}),r.jsxs(u,{gap:4,align:"center",wrap:"wrap",children:[r.jsx(W,{icon:ct(e.kind),color:tt(e.kind),style:{marginInlineEnd:0},children:n(`ledger.kinds.${e.kind}`,e.kind)}),r.jsx(W,{color:Ze(e.priority),style:{marginInlineEnd:0},children:n(`ledger.priorities.${e.priority}`,e.priority)}),r.jsx(W,{color:et(e.status),style:{marginInlineEnd:0},children:n(`ledger.statuses.${e.status}`,e.status)}),l?r.jsx(I,{type:"secondary",style:{fontSize:12},children:l}):null]})]}),r.jsxs(u,{gap:2,align:"center",style:{flexShrink:0},children:[a?r.jsx(v,{title:n("ledger.actions.reopen"),children:r.jsx(w,{size:"small",type:"text",icon:r.jsx(Pe,{}),"aria-label":n("ledger.actions.reopen"),onClick:()=>t.onReopen(e)})}):r.jsxs(r.Fragment,{children:[r.jsx(v,{title:n("ledger.actions.done"),children:r.jsx(w,{size:"small",type:"text",icon:r.jsx(Oe,{}),"aria-label":n("ledger.actions.done"),onClick:()=>t.onDone(e)})}),r.jsx(v,{title:n("ledger.actions.cancel"),children:r.jsx(w,{size:"small",type:"text",danger:!0,icon:r.jsx(Ne,{}),"aria-label":n("ledger.actions.cancel"),onClick:()=>t.onCancel(e)})})]}),r.jsx(v,{title:n("ledger.actions.edit"),children:r.jsx(w,{size:"small",type:"text",icon:r.jsx(Be,{}),"aria-label":n("ledger.actions.edit"),onClick:()=>t.onEdit(e)})})]})]})},P=({titleText:e,items:t,actions:n})=>t.length===0?null:r.jsxs(u,{vertical:!0,gap:6,children:[r.jsxs(I,{type:"secondary",strong:!0,style:{fontSize:12,textTransform:"uppercase"},children:[e," (",t.length,")"]}),t.map(a=>r.jsx(he,{item:a,actions:n},a.id))]}),jt=()=>{var le;const{t:e}=pe(),[t,n]=Le.useMessage(),a=Ee(),l=M(s=>s.isOpen),c=M(s=>s.view),T=M(s=>s.close),O=M(s=>s.setView),A=M(s=>s.setBadgeCount),[o,E]=i.useState(null),[L,J]=i.useState(!1),[N,ye]=i.useState([]),[B,xe]=i.useState(null),[X,Z]=i.useState(!1),[_,je]=i.useState([]),[F,me]=i.useState([]),[U,ke]=i.useState(!1),[H,ee]=i.useState(""),[K,te]=i.useState(""),[be,re]=i.useState(!1),[$,k]=i.useState({open:!1,target:null,saving:!1}),[f,b]=i.useState({open:!1,target:null,reason:"",saving:!1}),[Q]=y.useForm(),g=i.useCallback(async s=>{J(!0);try{const d=await S.getAgenda();E(d),A(Xe(d))}catch(d){console.error("[Ledger] Failed to load agenda:",d),s!=null&&s.silent||t.error(e("ledger.toasts.loadFailed"))}finally{J(!1)}},[t,A,e]),p=i.useCallback(async()=>{Z(!0);try{const s=await S.listRecords({status:_.length>0?_:void 0,kind:F.length>0?F:void 0,includeTerminal:U,limit:50});ye(s.records||[]),xe({returned:s.returned,matched:s.matched})}catch(s){console.error("[Ledger] Failed to load records:",s),t.error(e("ledger.toasts.recordsLoadFailed"))}finally{Z(!1)}},[U,F,t,_,e]);i.useEffect(()=>{g({silent:!0})},[]),i.useEffect(()=>{l&&g()},[l,g]),i.useEffect(()=>{l&&c==="records"&&p()},[l,c,p]);const Se=i.useCallback(async()=>{await g(),c==="records"&&await p()},[g,p,c]),ne=i.useCallback(async(s,d,h)=>{try{await S.patchRecord(s.id,d,s.project_key),t.success(e(h))}catch(x){console.error("[Ledger] Failed to update record:",x),t.error(e("ledger.toasts.updateFailed"));return}await g({silent:!0}),c==="records"&&await p()},[t,g,p,e,c]),R={onDone:s=>void ne(s,{status:"done"},"ledger.toasts.done"),onCancel:s=>b({open:!0,target:s,reason:"",saving:!1}),onReopen:s=>void ne(s,{status:"open"},"ledger.toasts.reopened"),onEdit:s=>{const d=st(s);k({open:!0,target:{id:s.id,project_key:s.project_key,initial:d},saving:!1}),Q.setFieldsValue(d)}},se=i.useCallback(async()=>{const s=lt(H,K);if(!s){t.error(e("ledger.quickAdd.titleRequired"));return}re(!0);try{await S.upsertRecord(s),t.success(e("ledger.quickAdd.added")),ee(""),te(""),await g({silent:!0}),c==="records"&&await p()}catch(d){console.error("[Ledger] Failed to add todo:",d),t.error(e("ledger.quickAdd.addFailed"))}finally{re(!1)}},[t,K,H,g,p,e,c]),ve=i.useCallback(async s=>{const d=$.target;if(!d)return;const h=at(d.id,d.initial,s);if(!h){k({open:!1,target:null,saving:!1});return}k(x=>({...x,saving:!0}));try{await S.upsertRecord(h),t.success(e("ledger.toasts.updated")),k({open:!1,target:null,saving:!1}),await g({silent:!0}),c==="records"&&await p()}catch(x){console.error("[Ledger] Failed to save record:",x),t.error(e("ledger.toasts.updateFailed")),k(Re=>({...Re,saving:!1}))}},[$.target,t,g,p,e,c]),we=i.useCallback(async()=>{const s=f.target;if(!s)return;b(h=>({...h,saving:!0}));const d=f.reason.trim();try{await S.patchRecord(s.id,{status:"cancelled",...d?{reason:d}:{}},s.project_key),t.success(e("ledger.toasts.cancelled")),b({open:!1,target:null,reason:"",saving:!1}),await g({silent:!0}),c==="records"&&await p()}catch(h){console.error("[Ledger] Failed to cancel record:",h),t.error(e("ledger.toasts.updateFailed")),b(x=>({...x,saving:!1}))}},[f.reason,f.target,t,g,p,e,c]),Ie=!o||o.overdue.length===0&&o.today.length===0&&o.upcoming.length===0&&o.undated.length===0,ae=it.map(s=>({value:s,label:e(`ledger.kinds.${s}`,s)})),Te=ot.map(s=>({value:s,label:e(`ledger.statuses.${s}`,s)})),Ae=dt.map(s=>({value:s,label:e(`ledger.priorities.${s}`,s)}));return r.jsxs(r.Fragment,{children:[n,r.jsx(_e,{title:e("ledger.title"),placement:"right",width:a?"100%":440,open:l,onClose:T,extra:r.jsx(v,{title:e("ledger.actions.refresh"),children:r.jsx(w,{size:"small",type:"text",icon:r.jsx(De,{}),"aria-label":e("ledger.actions.refresh"),loading:L||X,onClick:()=>void Se()})}),styles:{body:{padding:16}},children:r.jsxs(u,{vertical:!0,gap:12,children:[r.jsx(Fe,{block:!0,value:c,onChange:s=>O(s),options:[{value:"agenda",label:e("ledger.views.agenda")},{value:"records",label:e("ledger.views.records")}]}),c==="agenda"?r.jsxs(r.Fragment,{children:[r.jsxs(u,{gap:6,children:[r.jsx(j,{size:"small",value:H,onChange:s=>ee(s.target.value),placeholder:e("ledger.quickAdd.placeholder"),"aria-label":e("ledger.quickAdd.placeholder"),onPressEnter:()=>void se(),style:{flex:1}}),r.jsx(j,{size:"small",type:"date",value:K,onChange:s=>te(s.target.value),"aria-label":e("ledger.quickAdd.dueLabel"),style:{width:130}}),r.jsx(v,{title:e("ledger.quickAdd.add"),children:r.jsx(w,{size:"small",type:"primary",icon:r.jsx($e,{}),"aria-label":e("ledger.quickAdd.add"),loading:be,onClick:()=>void se()})})]}),L&&!o?r.jsx(u,{justify:"center",style:{padding:24},children:r.jsx(de,{})}):Ie?r.jsx(z,{image:z.PRESENTED_IMAGE_SIMPLE,description:e("ledger.empty.agenda")}):r.jsxs(u,{vertical:!0,gap:14,children:[r.jsx(P,{titleText:e("ledger.sections.overdue"),items:((o==null?void 0:o.overdue)??[]).map(D),actions:R}),r.jsx(P,{titleText:e("ledger.sections.today"),items:((o==null?void 0:o.today)??[]).map(D),actions:R}),r.jsx(P,{titleText:e("ledger.sections.upcoming"),items:((o==null?void 0:o.upcoming)??[]).map(D),actions:R}),r.jsx(P,{titleText:e("ledger.sections.undated"),items:((o==null?void 0:o.undated)??[]).map(D),actions:R})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs(u,{gap:6,wrap:"wrap",align:"center",children:[r.jsx(q,{mode:"multiple",size:"small",allowClear:!0,value:_,onChange:s=>je(s),options:Te,placeholder:e("ledger.filters.status"),"aria-label":e("ledger.filters.status"),style:{minWidth:140,flex:1},maxTagCount:"responsive"}),r.jsx(q,{mode:"multiple",size:"small",allowClear:!0,value:F,onChange:s=>me(s),options:ae,placeholder:e("ledger.filters.kind"),"aria-label":e("ledger.filters.kind"),style:{minWidth:130,flex:1},maxTagCount:"responsive"}),r.jsxs(u,{gap:4,align:"center",children:[r.jsx(ze,{size:"small",checked:U,onChange:ke,"aria-label":e("ledger.filters.includeTerminal")}),r.jsx(I,{type:"secondary",style:{fontSize:12},children:e("ledger.filters.includeTerminal")})]})]}),X&&N.length===0?r.jsx(u,{justify:"center",style:{padding:24},children:r.jsx(de,{})}):N.length===0?r.jsx(z,{image:z.PRESENTED_IMAGE_SIMPLE,description:e("ledger.empty.records")}):r.jsxs(u,{vertical:!0,gap:6,children:[B?r.jsx(I,{type:"secondary",style:{fontSize:12},children:e("ledger.filters.matched",{returned:B.returned,matched:B.matched})}):null,N.map(s=>r.jsx(he,{item:nt(s),actions:R},s.id))]})]})]})}),r.jsx(ce,{title:e("ledger.editModal.title"),open:$.open,onCancel:()=>k({open:!1,target:null,saving:!1}),okText:e("ledger.editModal.save"),confirmLoading:$.saving,onOk:()=>Q.submit(),forceRender:!0,zIndex:1100,children:r.jsxs(y,{form:Q,layout:"vertical",onFinish:ve,children:[r.jsx(y.Item,{label:e("ledger.editModal.titleLabel"),name:"title",rules:[{required:!0,message:e("ledger.editModal.titleRequired")}],children:r.jsx(j,{})}),r.jsxs(u,{gap:12,children:[r.jsx(y.Item,{label:e("ledger.editModal.kindLabel"),name:"kind",style:{flex:1},children:r.jsx(q,{options:ae})}),r.jsx(y.Item,{label:e("ledger.editModal.priorityLabel"),name:"priority",style:{flex:1},children:r.jsx(q,{options:Ae})})]}),r.jsx(y.Item,{label:e("ledger.editModal.dueAtLabel"),name:"due_at",children:r.jsx(j,{placeholder:e("ledger.editModal.dueAtPlaceholder")})}),r.jsx(y.Item,{label:e("ledger.editModal.tagsLabel"),name:"tags",children:r.jsx(j,{placeholder:e("ledger.editModal.tagsPlaceholder")})}),r.jsx(y.Item,{label:e("ledger.editModal.bodyLabel"),name:"body",children:r.jsx(j.TextArea,{rows:3})})]})}),r.jsx(ce,{title:e("ledger.cancelModal.title"),open:f.open,onCancel:()=>b({open:!1,target:null,reason:"",saving:!1}),okText:e("ledger.cancelModal.confirm"),okButtonProps:{danger:!0},confirmLoading:f.saving,onOk:()=>void we(),zIndex:1100,children:r.jsxs(u,{vertical:!0,gap:8,children:[r.jsx(I,{ellipsis:!0,children:(le=f.target)==null?void 0:le.title}),r.jsx(j.TextArea,{rows:2,value:f.reason,onChange:s=>b(d=>({...d,reason:s.target.value})),placeholder:e("ledger.cancelModal.reasonPlaceholder"),"aria-label":e("ledger.cancelModal.reasonLabel")})]})})]})};export{jt as LedgerDrawer,jt as default};