@graphmemory/server 1.2.0 → 1.3.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.
Files changed (111) hide show
  1. package/LICENSE +84 -12
  2. package/README.md +7 -1
  3. package/dist/api/index.js +151 -54
  4. package/dist/api/rest/code.js +2 -1
  5. package/dist/api/rest/docs.js +2 -1
  6. package/dist/api/rest/embed.js +8 -1
  7. package/dist/api/rest/index.js +39 -18
  8. package/dist/api/rest/knowledge.js +4 -2
  9. package/dist/api/rest/skills.js +2 -1
  10. package/dist/api/rest/tasks.js +2 -1
  11. package/dist/api/rest/tools.js +8 -1
  12. package/dist/api/rest/validation.js +41 -40
  13. package/dist/api/rest/websocket.js +24 -7
  14. package/dist/api/tools/code/search-code.js +12 -9
  15. package/dist/api/tools/code/search-files.js +1 -1
  16. package/dist/api/tools/docs/cross-references.js +3 -2
  17. package/dist/api/tools/docs/explain-symbol.js +2 -1
  18. package/dist/api/tools/docs/find-examples.js +2 -1
  19. package/dist/api/tools/docs/search-files.js +1 -1
  20. package/dist/api/tools/docs/search-snippets.js +1 -1
  21. package/dist/api/tools/docs/search.js +5 -4
  22. package/dist/api/tools/file-index/search-all-files.js +1 -1
  23. package/dist/api/tools/knowledge/add-attachment.js +15 -3
  24. package/dist/api/tools/knowledge/remove-attachment.js +5 -1
  25. package/dist/api/tools/knowledge/search-notes.js +5 -4
  26. package/dist/api/tools/skills/add-attachment.js +15 -3
  27. package/dist/api/tools/skills/recall-skills.js +1 -1
  28. package/dist/api/tools/skills/remove-attachment.js +5 -1
  29. package/dist/api/tools/skills/search-skills.js +6 -5
  30. package/dist/api/tools/tasks/add-attachment.js +15 -3
  31. package/dist/api/tools/tasks/remove-attachment.js +5 -1
  32. package/dist/api/tools/tasks/search-tasks.js +5 -4
  33. package/dist/cli/index.js +63 -52
  34. package/dist/cli/indexer.js +62 -29
  35. package/dist/graphs/attachment-types.js +5 -0
  36. package/dist/graphs/code.js +99 -10
  37. package/dist/graphs/docs.js +20 -5
  38. package/dist/graphs/file-index.js +22 -6
  39. package/dist/graphs/file-lang.js +1 -1
  40. package/dist/graphs/knowledge.js +31 -7
  41. package/dist/graphs/skill.js +35 -9
  42. package/dist/graphs/task.js +35 -9
  43. package/dist/lib/defaults.js +78 -0
  44. package/dist/lib/embedder.js +11 -12
  45. package/dist/lib/embedding-codec.js +63 -0
  46. package/dist/lib/graph-persistence.js +68 -0
  47. package/dist/lib/jwt.js +4 -4
  48. package/dist/lib/mirror-watcher.js +4 -3
  49. package/dist/lib/multi-config.js +6 -1
  50. package/dist/lib/parsers/code.js +158 -31
  51. package/dist/lib/parsers/codeblock.js +11 -6
  52. package/dist/lib/parsers/docs.js +60 -31
  53. package/dist/lib/parsers/languages/registry.js +2 -2
  54. package/dist/lib/parsers/languages/typescript.js +214 -46
  55. package/dist/lib/project-manager.js +21 -11
  56. package/dist/lib/search/bm25.js +23 -5
  57. package/dist/lib/search/code.js +13 -3
  58. package/dist/lib/search/docs.js +2 -1
  59. package/dist/lib/search/file-index.js +2 -1
  60. package/dist/lib/search/files.js +3 -2
  61. package/dist/lib/search/knowledge.js +2 -1
  62. package/dist/lib/search/skills.js +2 -1
  63. package/dist/lib/search/tasks.js +2 -1
  64. package/dist/ui/assets/NoteForm-aZX9f6-3.js +1 -0
  65. package/dist/ui/assets/SkillForm-KYa3o92l.js +1 -0
  66. package/dist/ui/assets/TaskForm-Bl5nkybO.js +1 -0
  67. package/dist/ui/assets/_articleId_-DjbCByxM.js +1 -0
  68. package/dist/ui/assets/_docId_-hdCDjclV.js +1 -0
  69. package/dist/ui/assets/_filePath_-CpG836v4.js +1 -0
  70. package/dist/ui/assets/_noteId_-C1enaQd1.js +1 -0
  71. package/dist/ui/assets/_skillId_-hPoCet7J.js +1 -0
  72. package/dist/ui/assets/_taskId_-DSB3dLVz.js +1 -0
  73. package/dist/ui/assets/_toolName_-3SmCfxZy.js +2 -0
  74. package/dist/ui/assets/api-BMnBjMMf.js +1 -0
  75. package/dist/ui/assets/api-BlFF6gX-.js +1 -0
  76. package/dist/ui/assets/api-CrGJOcaN.js +1 -0
  77. package/dist/ui/assets/api-DuX-0a_X.js +1 -0
  78. package/dist/ui/assets/attachments-CEQ-2nMo.js +1 -0
  79. package/dist/ui/assets/client-Bq88u7gN.js +1 -0
  80. package/dist/ui/assets/docs-CrXsRcOG.js +1 -0
  81. package/dist/ui/assets/edit-BYiy1FZy.js +1 -0
  82. package/dist/ui/assets/edit-TUIIpUMF.js +1 -0
  83. package/dist/ui/assets/edit-hc-ZWz3y.js +1 -0
  84. package/dist/ui/assets/esm-BWiKNcBW.js +1 -0
  85. package/dist/ui/assets/files-0bPg6NH9.js +1 -0
  86. package/dist/ui/assets/graph-DXGud_wF.js +1 -0
  87. package/dist/ui/assets/help-CEMQqZUR.js +891 -0
  88. package/dist/ui/assets/help-DJ52_fxN.js +1 -0
  89. package/dist/ui/assets/index-BCZDAYZi.js +2 -0
  90. package/dist/ui/assets/index-D6zSNtzo.css +1 -0
  91. package/dist/ui/assets/knowledge-DeygeGGH.js +1 -0
  92. package/dist/ui/assets/new-CpD7hOBA.js +1 -0
  93. package/dist/ui/assets/new-DHTg3Dqq.js +1 -0
  94. package/dist/ui/assets/new-s8c0M75X.js +1 -0
  95. package/dist/ui/assets/prompts-BgOmdxgM.js +295 -0
  96. package/dist/ui/assets/rolldown-runtime-Dw2cE7zH.js +1 -0
  97. package/dist/ui/assets/search-EpJhdP2a.js +1 -0
  98. package/dist/ui/assets/skill-y9pizyqE.js +1 -0
  99. package/dist/ui/assets/skills-Cga9iUZN.js +1 -0
  100. package/dist/ui/assets/tasks-CobouTKV.js +1 -0
  101. package/dist/ui/assets/tools-JxKH5BDF.js +1 -0
  102. package/dist/ui/assets/vendor-graph-BWpSgpMe.js +321 -0
  103. package/dist/ui/assets/vendor-markdown-CT8ZVEPu.js +50 -0
  104. package/dist/ui/assets/vendor-md-editor-DmWafJvr.js +44 -0
  105. package/dist/ui/assets/{index-kKd4mVrh.css → vendor-md-editor-HrwGbQou.css} +1 -1
  106. package/dist/ui/assets/vendor-mui-BPj7d3Sw.js +139 -0
  107. package/dist/ui/assets/vendor-mui-icons-B196sG3f.js +1 -0
  108. package/dist/ui/assets/vendor-react-CHUjhoxh.js +11 -0
  109. package/dist/ui/index.html +11 -3
  110. package/package.json +6 -3
  111. package/dist/ui/assets/index-0hRezICt.js +0 -1702
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{D as t,O as n}from"./vendor-markdown-CT8ZVEPu.js";import{c as r,l as i}from"./vendor-react-CHUjhoxh.js";import{$ as a,A as o,G as s,K as c,W as l,Y as u,r as d,ut as f}from"./vendor-mui-BPj7d3Sw.js";import"./vendor-md-editor-DmWafJvr.js";import{B as p,N as m,P as h,st as g,tt as _}from"./vendor-mui-icons-B196sG3f.js";import{A as v,F as y,j as b}from"./index-BCZDAYZi.js";import{r as x}from"./help-CEMQqZUR.js";var S=e(n(),1),C=t(),w={overview:{label:`Overview`,color:`primary`,icon:(0,C.jsx)(m,{})},concept:{label:`Concept`,color:`warning`,icon:(0,C.jsx)(h,{})},guide:{label:`Guide`,color:`success`,icon:(0,C.jsx)(p,{})}};function T({article:e,onClick:t}){let{palette:n}=f(),r=w[e.category];return(0,C.jsx)(c,{variant:`outlined`,sx:{height:`100%`},children:(0,C.jsx)(s,{onClick:t,sx:{height:`100%`,display:`flex`,flexDirection:`column`,alignItems:`stretch`},children:(0,C.jsxs)(l,{sx:{flex:1,display:`flex`,flexDirection:`column`,gap:1},children:[(0,C.jsxs)(u,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,C.jsx)(y,{label:r.label,color:r.color}),e.relatedTools.length>0&&(0,C.jsxs)(a,{variant:`caption`,sx:{color:n.custom.textMuted,ml:`auto`},children:[e.relatedTools.length,` tool`,e.relatedTools.length===1?``:`s`]})]}),(0,C.jsx)(a,{variant:`subtitle1`,fontWeight:700,children:e.title}),(0,C.jsx)(a,{variant:`body2`,sx:{color:n.custom.textMuted,flex:1},children:e.summary})]})})})}function E(){let{projectId:e}=i(),t=r(),{palette:n}=f(),[s,c]=(0,S.useState)(``),l=(0,S.useMemo)(()=>{if(!s)return x;let e=s.toLowerCase();return x.filter(t=>t.title.toLowerCase().includes(e)||t.summary.toLowerCase().includes(e)||t.relatedTools.some(t=>t.includes(e)))},[s]),p=(0,S.useMemo)(()=>{let e={overview:[],concept:[],guide:[]};for(let t of l)(e[t.category]??=[]).push(t);return e},[l]);return(0,C.jsxs)(u,{children:[(0,C.jsx)(b,{breadcrumbs:[{label:`Help`}]}),(0,C.jsxs)(v,{children:[(0,C.jsx)(d,{size:`small`,placeholder:`Search articles...`,value:s,onChange:e=>c(e.target.value),slotProps:{input:{startAdornment:(0,C.jsx)(o,{position:`start`,children:(0,C.jsx)(g,{fontSize:`small`})})}},sx:{minWidth:280}}),(0,C.jsxs)(a,{variant:`body2`,sx:{color:n.custom.textMuted,ml:`auto`},children:[l.length,` article`,l.length===1?``:`s`]})]}),l.length===0?(0,C.jsxs)(u,{sx:{display:`flex`,flexDirection:`column`,alignItems:`center`,py:6},children:[(0,C.jsx)(_,{sx:{fontSize:48,color:n.custom.textMuted,mb:2}}),(0,C.jsx)(a,{variant:`h6`,children:`No articles found`}),(0,C.jsx)(a,{variant:`body2`,sx:{color:n.custom.textMuted},children:`Try a different search term`})]}):Object.entries(p).map(([r,i])=>{if(i.length===0)return null;let o=w[r];return(0,C.jsxs)(u,{sx:{mb:3},children:[(0,C.jsxs)(u,{sx:{display:`flex`,alignItems:`center`,gap:1,mb:1.5},children:[(0,C.jsx)(u,{sx:{color:n.custom.textMuted,display:`flex`},children:o.icon}),(0,C.jsx)(a,{variant:`subtitle2`,sx:{textTransform:`uppercase`,letterSpacing:.5},children:r===`overview`?`Getting Started`:r===`concept`?`Concepts`:`Guides`})]}),(0,C.jsx)(u,{sx:{display:`grid`,gridTemplateColumns:{xs:`1fr`,sm:`1fr 1fr`,md:`1fr 1fr 1fr`},gap:2},children:i.map(n=>(0,C.jsx)(T,{article:n,onClick:()=>t(`/${e}/help/${n.id}`)},n.id))})]},r)})]})}export{E as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/esm-BWiKNcBW.js","assets/vendor-md-editor-DmWafJvr.js","assets/rolldown-runtime-Dw2cE7zH.js","assets/vendor-markdown-CT8ZVEPu.js","assets/vendor-md-editor-HrwGbQou.css","assets/knowledge-DeygeGGH.js","assets/vendor-react-CHUjhoxh.js","assets/vendor-mui-BPj7d3Sw.js","assets/vendor-mui-icons-B196sG3f.js","assets/NoteForm-aZX9f6-3.js","assets/_noteId_-C1enaQd1.js","assets/skill-y9pizyqE.js","assets/client-Bq88u7gN.js","assets/attachments-CEQ-2nMo.js","assets/api-CrGJOcaN.js","assets/api-BlFF6gX-.js","assets/api-BMnBjMMf.js","assets/new-DHTg3Dqq.js","assets/edit-BYiy1FZy.js","assets/tasks-CobouTKV.js","assets/_taskId_-DSB3dLVz.js","assets/new-CpD7hOBA.js","assets/TaskForm-Bl5nkybO.js","assets/edit-TUIIpUMF.js","assets/skills-Cga9iUZN.js","assets/SkillForm-KYa3o92l.js","assets/_skillId_-hPoCet7J.js","assets/new-s8c0M75X.js","assets/edit-hc-ZWz3y.js","assets/docs-CrXsRcOG.js","assets/_docId_-hdCDjclV.js","assets/files-0bPg6NH9.js","assets/_filePath_-CpG836v4.js","assets/search-EpJhdP2a.js","assets/graph-DXGud_wF.js","assets/vendor-graph-BWpSgpMe.js","assets/tools-JxKH5BDF.js","assets/api-DuX-0a_X.js","assets/_toolName_-3SmCfxZy.js","assets/help-CEMQqZUR.js","assets/prompts-BgOmdxgM.js","assets/help-DJ52_fxN.js","assets/_articleId_-DjbCByxM.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{D as t,O as n,g as r,h as i}from"./vendor-markdown-CT8ZVEPu.js";import{a,c as o,d as s,f as c,i as l,l as u,n as d,o as f,r as p,s as m,t as h}from"./vendor-react-CHUjhoxh.js";import{$ as g,B as _,C as ee,D as v,E as y,F as te,H as b,I as x,J as ne,K as S,L as C,O as w,Q as re,R as ie,S as T,V as ae,W as E,X as D,Y as O,Z as oe,dt as k,et as A,f as se,h as ce,i as le,lt as ue,nt as j,o as de,q as M,r as N,tt as P,ut as F,v as fe,y as pe,z as me}from"./vendor-mui-BPj7d3Sw.js";import"./vendor-md-editor-DmWafJvr.js";import{i as I,n as L,r as R,t as he}from"./client-Bq88u7gN.js";import{$ as ge,G as _e,J as z,K as B,Q as ve,U as ye,W as be,X as V,Y as xe,Z as H,at as Se,ct as U,dt as W,et as Ce,ft as we,it as G,lt as K,mt as Te,nt as Ee,ot as De,pt as Oe,q as ke,rt as Ae,st as je,tt as Me,ut as Ne}from"./vendor-mui-icons-B196sG3f.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Pe=c(),q=e(n(),1),Fe={fontFamily:`"Inter", "Roboto", "Helvetica", "Arial", sans-serif`},Ie=k({palette:{mode:`dark`,primary:{main:`#569cd6`},secondary:{main:`#c586c0`},success:{main:`#6a9955`},error:{main:`#f14c4c`},warning:{main:`#cca700`},info:{main:`#3794ff`},background:{default:`#1e1e1e`,paper:`#252526`},text:{primary:`#cccccc`,secondary:`#9d9d9d`},divider:`#3c3c3c`,action:{hover:`rgba(90,93,94,0.31)`,selected:`rgba(90,93,94,0.40)`,focus:`rgba(90,93,94,0.48)`},custom:{surface:`#252526`,surfaceMuted:`#2d2d2d`,border:`#3c3c3c`,textMuted:`#858585`,textOnPrimary:`#ffffff`,neutral:`#858585`}},typography:Fe,components:{MuiCssBaseline:{styleOverrides:{body:{backgroundColor:`#1e1e1e`},"*::-webkit-scrollbar":{width:10,height:10},"*::-webkit-scrollbar-track":{background:`#1e1e1e`},"*::-webkit-scrollbar-thumb":{background:`#424242`,borderRadius:0},"*::-webkit-scrollbar-thumb:hover":{background:`#4f4f4f`}}},MuiDrawer:{styleOverrides:{paper:{backgroundColor:`#181818`,borderRight:`1px solid #2b2b2b`}}},MuiAppBar:{styleOverrides:{root:{backgroundColor:`#181818`,boxShadow:`none`,borderBottom:`1px solid #2b2b2b`}}},MuiCard:{styleOverrides:{root:{backgroundColor:`#252526`,border:`1px solid #3c3c3c`}}},MuiPaper:{styleOverrides:{root:{backgroundImage:`none`}}},MuiTableHead:{styleOverrides:{root:{"& .MuiTableCell-head":{backgroundColor:`#2d2d2d`,color:`#cccccc`}}}},MuiTableCell:{styleOverrides:{root:{borderBottom:`1px solid #3c3c3c`}}},MuiChip:{styleOverrides:{root:{backgroundColor:`#2d2d2d`,border:`1px solid #3c3c3c`}}},MuiButton:{styleOverrides:{contained:{boxShadow:`none`,"&:hover":{boxShadow:`none`}},containedPrimary:{backgroundColor:`#0e639c`,"&:hover":{backgroundColor:`#1177bb`}}}},MuiTextField:{styleOverrides:{root:{"& .MuiOutlinedInput-root":{backgroundColor:`#3c3c3c`,"& fieldset":{borderColor:`#3c3c3c`},"&:hover fieldset":{borderColor:`#569cd6`},"&.Mui-focused fieldset":{borderColor:`#569cd6`}}}}},MuiSelect:{styleOverrides:{root:{backgroundColor:`#3c3c3c`,"& .MuiOutlinedInput-notchedOutline":{borderColor:`#3c3c3c`},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:`#569cd6`}}}},MuiListItemButton:{styleOverrides:{root:{"&.Mui-selected":{backgroundColor:`rgba(90,93,94,0.40)`}}}},MuiTab:{styleOverrides:{root:{textTransform:`none`,color:`#969696`,"&.Mui-selected":{color:`#ffffff`}}}},MuiTooltip:{styleOverrides:{tooltip:{backgroundColor:`#383838`,border:`1px solid #454545`,color:`#cccccc`}}},MuiMenu:{styleOverrides:{paper:{backgroundColor:`#2d2d2d`,border:`1px solid #454545`}}},MuiDialog:{styleOverrides:{paper:{backgroundColor:`#252526`,border:`1px solid #454545`}}}}}),Le=k({palette:{mode:`light`,primary:{main:`#1976d2`},secondary:{main:`#9c27b0`},success:{main:`#2e7d32`},error:{main:`#d32f2f`},warning:{main:`#ed6c02`},background:{default:`#f0f2f5`,paper:`#ffffff`},custom:{surface:`#ffffff`,surfaceMuted:`#f5f5f5`,border:`#e0e0e0`,textMuted:`#757575`,textOnPrimary:`#ffffff`,neutral:`#9e9e9e`}},typography:Fe,components:{MuiInputLabel:{styleOverrides:{root:{fontSize:`0.8125rem`,textTransform:`uppercase`,letterSpacing:`0.04em`,fontWeight:500,"&.MuiInputLabel-shrink":{transform:`translate(14px, -9px) scale(0.85)`}}}},MuiDrawer:{styleOverrides:{paper:{backgroundColor:`#ffffff`,borderRight:`1px solid #e0e0e0`}}},MuiAppBar:{styleOverrides:{root:{backgroundColor:`#ffffff`,boxShadow:`none`,borderBottom:`1px solid #e0e0e0`}}},MuiCard:{styleOverrides:{root:{backgroundColor:`#ffffff`,border:`1px solid #e0e0e0`}}},MuiTableHead:{styleOverrides:{root:{"& .MuiTableCell-head":{backgroundColor:`#f5f5f5`}}}},MuiChip:{styleOverrides:{root:{backgroundColor:`#f5f5f5`,border:`1px solid #e0e0e0`}}}}}),J=t(),Re=(0,q.createContext)({mode:`dark`,toggle:()=>{}});function ze({children:e}){let[t,n]=(0,q.useState)(()=>localStorage.getItem(`theme-mode`)===`light`?`light`:`dark`),r=(0,q.useCallback)(()=>{n(e=>{let t=e===`dark`?`light`:`dark`;return localStorage.setItem(`theme-mode`,t),t})},[]);return(0,J.jsx)(Re,{value:(0,q.useMemo)(()=>({mode:t,toggle:r}),[t,r]),children:(0,J.jsxs)(ue,{theme:t===`dark`?Ie:Le,children:[(0,J.jsx)(b,{}),e]})})}function Be(){return(0,q.useContext)(Re)}function Ve(){return R(`/projects`).then(I)}function He(){return R(`/workspaces`).then(I)}function Ue(e){return R(`/projects/${e}/stats`)}function We(e){return R(`/projects/${e}/team`).then(I)}async function Ge(){return(await fetch(`/api/auth/status`,{credentials:`include`})).json()}function Ke({onSuccess:e}){let[t,n]=(0,q.useState)(``),[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(``),[s,c]=(0,q.useState)(!1);return(0,J.jsx)(O,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,minHeight:`100vh`},children:(0,J.jsx)(S,{sx:{maxWidth:400,width:`100%`,mx:2},children:(0,J.jsxs)(E,{children:[(0,J.jsx)(g,{variant:`h5`,gutterBottom:!0,align:`center`,children:`Graph Memory`}),(0,J.jsx)(g,{variant:`body2`,color:`text.secondary`,gutterBottom:!0,align:`center`,children:`Sign in to continue`}),(0,J.jsxs)(`form`,{onSubmit:async n=>{if(n.preventDefault(),!(!t.trim()||!r)){c(!0),o(``);try{let n=await fetch(`/api/auth/login`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({email:t.trim(),password:r})});n.ok?e():o((await n.json().catch(()=>({error:`Login failed`}))).error||`Login failed`)}catch{o(`Connection failed`)}finally{c(!1)}}},children:[(0,J.jsx)(N,{fullWidth:!0,label:`Email`,type:`email`,value:t,onChange:e=>n(e.target.value),margin:`normal`,autoFocus:!0}),(0,J.jsx)(N,{fullWidth:!0,label:`Password`,type:`password`,value:r,onChange:e=>i(e.target.value),margin:`normal`}),a&&(0,J.jsx)(A,{severity:`error`,sx:{mt:1},children:a}),(0,J.jsx)(M,{fullWidth:!0,variant:`contained`,type:`submit`,disabled:s||!t.trim()||!r,sx:{mt:2},children:s?`Signing in...`:`Sign In`})]})]})})})}function qe({children:e}){let[t,n]=(0,q.useState)(`loading`),r=(0,q.useCallback)(async()=>{try{let e=await Ge();!e.required||e.authenticated?n(`ok`):n(`login`)}catch{n(`ok`)}},[]);return(0,q.useEffect)(()=>{r()},[r]),(0,q.useEffect)(()=>{he(()=>n(`login`))},[]),t===`loading`?(0,J.jsx)(O,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,minHeight:`100vh`},children:(0,J.jsx)(j,{})}):t===`login`?(0,J.jsx)(Ke,{onSuccess:()=>n(`ok`)}):(0,J.jsx)(J.Fragment,{children:e})}function Je(){let[e,t]=(0,q.useState)([]),[n,r]=(0,q.useState)([]),[i,a]=(0,q.useState)(!0),[o,s]=(0,q.useState)(null);return(0,q.useEffect)(()=>{Promise.all([Ve(),He()]).then(([e,n])=>{t(e),r(n)}).catch(e=>s(e.message)).finally(()=>a(!1))},[]),{projects:e,workspaces:n,loading:i,error:o}}function Ye(){let e=new Set,t=null,n=null,r=!1,i;function a(){if(r||!n)return;let o=`${window.location.protocol===`https:`?`wss`:`ws`}://${window.location.host}/api/ws`;t=new WebSocket(o),t.onopen=()=>{console.log(`[ws] connected to`,o)},t.onmessage=t=>{try{let r=JSON.parse(t.data);if(r.projectId===n)for(let t of e)t(r)}catch{}},t.onerror=()=>{},t.onclose=e=>{console.log(`[ws] closed, code:`,e.code,`reason:`,e.reason),!r&&n&&(i=setTimeout(a,3e3))}}return{subscribe(t){return e.add(t),()=>{e.delete(t)}},connect(e){n===e&&t&&t.readyState<=WebSocket.OPEN||(r=!1,clearTimeout(i),t&&t.readyState<=WebSocket.OPEN&&t.close(),n=e,a())},disconnect(){r=!0,n=null,clearTimeout(i),t&&t.readyState<=WebSocket.OPEN&&t.close()}}}var Y=Ye(),Xe=(0,q.createContext)(Y);function Ze({projectId:e,children:t}){return(0,q.useEffect)(()=>(e&&Y.connect(e),()=>{Y.disconnect()}),[e]),(0,q.createElement)(Xe.Provider,{value:Y},t)}function Qe(e,t){let n=(0,q.useContext)(Xe),r=(0,q.useRef)(t);r.current=t,(0,q.useEffect)(()=>{if(e)return n.subscribe(e=>{r.current(e)})},[e,n])}var $e=(0,q.createContext)({graphs:{},loading:!0});function et({graphs:e,loading:t,children:n}){return(0,J.jsx)($e,{value:{graphs:e,loading:t},children:n})}function tt(e){let{graphs:t,loading:n}=(0,q.useContext)($e),r=t[e];return{enabled:r?.enabled??!0,readonly:r?.readonly??!1,access:r?.access??`rw`,loading:n}}function nt(e){let{access:t,readonly:n}=tt(e);return t===`rw`&&!n}function rt({value:e}){let{palette:t}=F(),[n,r]=(0,q.useState)(!1),i=(0,q.useCallback)(()=>{navigator.clipboard.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)})},[e]);return(0,J.jsxs)(O,{sx:{position:`relative`},children:[(0,J.jsx)(O,{sx:{bgcolor:t.mode===`dark`?`#1a1a1a`:`#f5f5f5`,border:`1px solid ${t.custom.border}`,borderRadius:1,p:1.5,pr:5,fontFamily:`monospace`,fontSize:`0.8125rem`,lineHeight:1.6,whiteSpace:`pre`,overflow:`auto`},children:e}),(0,J.jsx)(P,{size:`small`,onClick:i,sx:{position:`absolute`,top:8,right:8,color:n?`success.main`:t.custom.textMuted},children:n?(0,J.jsx)(V,{fontSize:`small`}):(0,J.jsx)(H,{fontSize:`small`})})]})}function it(e,t){let n={type:`http`,url:e};return t&&(n.headers={Authorization:`Bearer ${t}`}),JSON.stringify({mcpServers:{"graph-memory":n}},null,2)}var at=[`.mcp.json`,`Claude CLI`,`Cursor`,`Windsurf`],ot=[(0,J.jsx)(z,{sx:{fontSize:16}}),(0,J.jsx)(xe,{sx:{fontSize:16}}),(0,J.jsx)(z,{sx:{fontSize:16}}),(0,J.jsx)(z,{sx:{fontSize:16}})],st={0:{text:`Add to your project’s .mcp.json file (or create one in the project root). Works with Claude Desktop and other MCP-compatible clients.`},1:{text:`Run this command in your terminal to register the MCP server with Claude Code CLI.`},2:{text:`Add to your Cursor MCP configuration file.`,path:`~/.cursor/mcp.json`},3:{text:`Add to your Windsurf MCP configuration file.`,path:`~/.codeium/windsurf/mcp_config.json`}};function ct({open:e,onClose:t,projectId:n}){let{palette:r}=F(),[i,a]=(0,q.useState)(0),[o,s]=(0,q.useState)(``),[c,l]=(0,q.useState)(!1);(0,q.useEffect)(()=>{e&&fetch(`/api/auth/status`,{credentials:`include`}).then(e=>e.json()).then(e=>{l(e.required===!0),e.apiKey&&s(e.apiKey)}).catch(()=>l(!1))},[e]);let u=`${(0,q.useMemo)(()=>{let{protocol:e,hostname:t,port:n}=window.location;return`${e}//${t}${n?`:${n}`:``}`},[])}/mcp/${n}`,d=it(u,o),f=o?`claude mcp add --transport http --scope project \\\n --header "Authorization: Bearer ${o}" \\\n graph-memory ${u}`:`claude mcp add --transport http --scope project graph-memory ${u}`,p=st[i];return(0,J.jsxs)(ae,{open:e,onClose:t,maxWidth:`sm`,fullWidth:!0,PaperProps:{sx:{bgcolor:r.mode===`dark`?`#252526`:void 0,border:r.mode===`dark`?`1px solid #454545`:void 0}},children:[(0,J.jsxs)(C,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,pb:1},children:[(0,J.jsx)(g,{variant:`h6`,fontWeight:700,children:`Connect MCP`}),(0,J.jsx)(P,{size:`small`,onClick:t,sx:{color:r.custom.textMuted},children:(0,J.jsx)(ve,{fontSize:`small`})})]}),(0,J.jsxs)(me,{sx:{pt:0},children:[(0,J.jsxs)(g,{variant:`body2`,sx:{color:r.custom.textMuted,mb:2},children:[`Connect your AI assistant to `,(0,J.jsx)(`strong`,{children:n}),` via MCP (Model Context Protocol).`]}),c&&(0,J.jsx)(N,{label:`API Key`,placeholder:`Enter your API key`,size:`small`,fullWidth:!0,value:o,onChange:e=>s(e.target.value),sx:{mb:2},helperText:`Authentication is enabled. Paste your API key to include it in the config.`}),(0,J.jsx)(le,{value:i,onChange:(e,t)=>a(t),variant:`scrollable`,scrollButtons:`auto`,sx:{mb:2,minHeight:36,"& .MuiTab-root":{minHeight:36,py:.5}},children:at.map((e,t)=>(0,J.jsx)(se,{icon:ot[t],iconPosition:`start`,label:e},e))}),(0,J.jsxs)(O,{sx:{display:`flex`,flexDirection:`column`,gap:1.5},children:[(0,J.jsx)(g,{variant:`body2`,sx:{color:r.custom.textMuted},children:p.text}),p.path&&(0,J.jsxs)(g,{variant:`body2`,sx:{color:r.custom.textMuted},children:[`Config path: `,(0,J.jsx)(`code`,{children:p.path})]}),(0,J.jsx)(rt,{value:i===1?f:d})]}),(0,J.jsxs)(O,{sx:{mt:3,pt:2,borderTop:`1px solid ${r.custom.border}`},children:[(0,J.jsx)(g,{variant:`caption`,sx:{color:r.custom.textMuted,mb:.5,display:`block`},children:`Endpoint`}),(0,J.jsx)(rt,{value:u})]})]})]})}var X=240,lt=64,ut={knowledge:`knowledge`,tasks:`tasks`,skills:`skills`,docs:`docs`,files:`files`},dt=[{label:`Dashboard`,icon:(0,J.jsx)(Se,{}),path:`dashboard`},{label:`Knowledge`,icon:(0,J.jsx)(W,{}),path:`knowledge`},{label:`Tasks`,icon:(0,J.jsx)(Ne,{}),path:`tasks`},{label:`Skills`,icon:(0,J.jsx)(G,{}),path:`skills`},{label:`Docs`,icon:(0,J.jsx)(U,{}),path:`docs`},{label:`Files`,icon:(0,J.jsx)(K,{}),path:`files`},{label:`Search`,icon:(0,J.jsx)(je,{}),path:`search`},{label:`Graph`,icon:(0,J.jsx)(De,{}),path:`graph`},{label:`Prompts`,icon:(0,J.jsx)(Ae,{}),path:`prompts`},{label:`Tools`,icon:(0,J.jsx)(Ee,{}),path:`tools`},{label:`Help`,icon:(0,J.jsx)(Me,{}),path:`help`}],ft={dashboard:`Dashboard`,knowledge:`Knowledge`,tasks:`Tasks`,skills:`Skills`,docs:`Docs`,files:`Files`,search:`Search`,graph:`Graph`,prompts:`Prompts`,tools:`Tools`,help:`Help`};function pt(e){return ft[e.split(`/`).filter(Boolean)[1]||`dashboard`]||`Dashboard`}function mt(e){let t=e.split(`/`).filter(Boolean),n=[t[0]||``];for(let e=1;e<t.length;e++){let r=t[e];r!==`view`&&n.push(ft[r]||r)}return n.length===1&&n.push(`Dashboard`),n.join(` :: `)}function ht(e,t){let n=[],r=new Set;for(let i of t){let t=e.filter(e=>e.workspaceId===i.id);if(t.length!==0){n.push((0,J.jsx)(oe,{sx:{lineHeight:`32px`,fontSize:`0.7rem`,fontWeight:700,textTransform:`uppercase`,letterSpacing:`0.05em`},children:i.id},`ws-${i.id}`));for(let e of t)n.push((0,J.jsx)(pe,{value:e.id,children:e.id},e.id)),r.add(e.id)}}let i=e.filter(e=>!r.has(e.id));i.length>0&&t.length>0&&n.push((0,J.jsx)(oe,{sx:{lineHeight:`32px`,fontSize:`0.7rem`,fontWeight:700,textTransform:`uppercase`,letterSpacing:`0.05em`},children:`Standalone`},`ws-standalone`));for(let e of i)n.push((0,J.jsx)(pe,{value:e.id,children:e.id},e.id));return n}function gt(){let[e,t]=(0,q.useState)(!1),[n,r]=(0,q.useState)(!1),{projects:i,workspaces:a,loading:s}=Je(),c=o(),d=m(),{projectId:f}=u(),{mode:p,toggle:h}=Be(),{palette:_}=F(),b=i.find(e=>e.id===f),ne=pt(d.pathname),S=mt(d.pathname);(0,q.useEffect)(()=>{document.title=S},[S]);let C=e=>{c(`/${e}/${d.pathname.split(`/`).slice(2).join(`/`)||`dashboard`}`)},w=(0,J.jsxs)(O,{sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[(0,J.jsxs)(de,{children:[(0,J.jsx)(De,{sx:{mr:1,color:`primary.main`}}),(0,J.jsx)(g,{variant:`subtitle1`,fontWeight:700,noWrap:!0,children:`Graph Memory`})]}),(0,J.jsx)(x,{}),(0,J.jsx)(O,{sx:{px:2,py:1.5},children:(0,J.jsx)(fe,{fullWidth:!0,size:`small`,value:!s&&i.some(e=>e.id===f)?f:``,onChange:e=>C(e.target.value),disabled:s,displayEmpty:!0,renderValue:e=>(0,J.jsx)(g,{variant:`body2`,fontWeight:600,noWrap:!0,children:e||`Select project`}),children:ht(i,a)})}),(0,J.jsx)(x,{}),(0,J.jsx)(v,{sx:{flex:1,px:1},children:dt.filter(({path:e})=>{let t=ut[e];return!t||!b?.graphs?!0:b.graphs[t]?.enabled!==!1}).map(({label:e,icon:t,path:n})=>{let r=(d.pathname.split(`/`).filter(Boolean)[1]||``)===n;return(0,J.jsxs)(y,{selected:r,onClick:()=>c(`/${f}/${n}`),disabled:!f,sx:{borderRadius:1,mb:.5,...r&&{bgcolor:`primary.main`,color:_.custom.textOnPrimary,"&:hover":{bgcolor:`primary.dark`},"&.Mui-selected":{bgcolor:`primary.main`,color:_.custom.textOnPrimary,"&:hover":{bgcolor:`primary.dark`}}}},children:[(0,J.jsx)(ee,{sx:{minWidth:40,color:r?_.custom.textOnPrimary:`inherit`},children:t}),(0,J.jsx)(T,{primary:e})]},n)})})]});return(0,J.jsxs)(O,{sx:{display:`flex`,height:`100vh`},children:[(0,J.jsx)(re,{position:`fixed`,sx:{width:{md:`calc(100% - ${X}px)`},ml:{md:`${X}px`},color:`text.primary`},children:(0,J.jsxs)(de,{children:[(0,J.jsx)(P,{edge:`start`,color:`inherit`,onClick:()=>t(!e),sx:{display:{md:`none`},mr:1},children:(0,J.jsx)(Te,{})}),(0,J.jsxs)(O,{sx:{display:`flex`,alignItems:`center`,gap:1,flexGrow:1},children:[(0,J.jsx)(g,{variant:`h6`,noWrap:!0,children:ne}),b?.workspaceId&&(0,J.jsx)(D,{label:b.workspaceId,size:`small`,variant:`outlined`,color:`primary`,sx:{fontWeight:600}})]}),(0,J.jsx)(M,{variant:`outlined`,size:`small`,color:`primary`,startIcon:(0,J.jsx)(ge,{}),onClick:()=>r(!0),disabled:!f,sx:{textTransform:`none`},children:`Connect`}),(0,J.jsx)(P,{color:`inherit`,onClick:h,title:`Switch to ${p===`dark`?`light`:`dark`} mode`,children:p===`dark`?(0,J.jsx)(we,{}):(0,J.jsx)(Oe,{})}),(0,J.jsx)(P,{color:`inherit`,title:`Sign out`,onClick:async()=>{await fetch(`/api/auth/logout`,{method:`POST`,credentials:`include`}),window.location.reload()},children:(0,J.jsx)(Ce,{})})]})}),(0,J.jsxs)(O,{component:`nav`,sx:{width:{md:X},flexShrink:{md:0}},children:[(0,J.jsx)(te,{variant:`temporary`,open:e,onClose:()=>t(!1),sx:{display:{xs:`block`,md:`none`},"& .MuiDrawer-paper":{width:X}},children:w}),(0,J.jsx)(te,{variant:`permanent`,sx:{display:{xs:`none`,md:`block`},"& .MuiDrawer-paper":{width:X}},open:!0,children:w})]}),(0,J.jsx)(O,{component:`main`,sx:{flexGrow:1,width:{md:`calc(100% - ${X}px)`},height:`100vh`,overflow:`auto`,p:3,pt:`${lt+24}px`},children:(0,J.jsx)(et,{graphs:b?.graphs??{},loading:s,children:(0,J.jsx)(Ze,{projectId:f??null,children:(0,J.jsx)(l,{})})})}),f&&(0,J.jsx)(ct,{open:n,onClose:()=>r(!1),projectId:f})]})}function _t(){let[e,t]=(0,q.useState)(null),[n,r]=(0,q.useState)(null);return(0,q.useEffect)(()=>{Ve().then(e=>{e.length>0?t(e[0].id):r(`No projects configured. Add a project to graph-memory.yaml and restart the server.`)}).catch(e=>r(e instanceof Error?e.message:String(e)))},[]),n?(0,J.jsx)(O,{sx:{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100vh`},children:(0,J.jsx)(g,{color:`error`,children:n})}):e?(0,J.jsx)(p,{to:`/${e}/dashboard`,replace:!0}):(0,J.jsx)(O,{sx:{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100vh`},children:(0,J.jsx)(j,{})})}function vt(e,t){return R(`/projects/${e}/knowledge/notes${L({tag:t?.tag,limit:t?.limit})}`).then(I)}function yt(e,t){return R(`/projects/${e}/knowledge/notes/${t}`)}function bt(e,t){return R(`/projects/${e}/knowledge/notes`,{method:`POST`,body:JSON.stringify(t)})}function xt(e,t,n){return R(`/projects/${e}/knowledge/notes/${t}`,{method:`PUT`,body:JSON.stringify(n)})}function St(e,t){return R(`/projects/${e}/knowledge/notes/${t}`,{method:`DELETE`})}function Ct(e,t,n){return R(`/projects/${e}/knowledge/search${L({q:t,topK:n?.topK,minScore:n?.minScore})}`).then(I)}function wt(e,t){return R(`/projects/${e}/knowledge/notes/${t}/relations`).then(I)}function Tt(e,t){return R(`/projects/${e}/knowledge/relations`,{method:`POST`,body:JSON.stringify(t)})}function Et(e,t){return R(`/projects/${e}/knowledge/relations`,{method:`DELETE`,body:JSON.stringify(t)})}function Dt(e,t,n){return R(`/projects/${e}/knowledge/linked${L({targetGraph:t,targetNodeId:n})}`).then(I)}function Ot(e,t){return R(`/projects/${e}/knowledge/notes/${t}/attachments`).then(I)}async function kt(e,t,n){let r=new FormData;r.append(`file`,n);let i=await fetch(`/api/projects/${e}/knowledge/notes/${t}/attachments`,{method:`POST`,credentials:`include`,body:r});if(!i.ok){let e=await i.json().catch(()=>({error:i.statusText}));throw Error(e.error||i.statusText)}return i.json()}function At(e,t,n){return R(`/projects/${e}/knowledge/notes/${t}/attachments/${encodeURIComponent(n)}`,{method:`DELETE`})}function jt(e,t,n){return`/api/projects/${e}/knowledge/notes/${t}/attachments/${encodeURIComponent(n)}`}function Z({title:e,action:t,children:n,sx:r}){let{palette:i}=F();return(0,J.jsxs)(O,{sx:{borderRadius:1,overflow:`hidden`,border:`1px solid ${i.custom.border}`,display:`flex`,flexDirection:`column`,...r},children:[(0,J.jsxs)(O,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,px:2,py:1.5,bgcolor:i.custom.surfaceMuted,flexShrink:0},children:[(0,J.jsx)(g,{variant:`subtitle2`,sx:{textTransform:`uppercase`,letterSpacing:.5},children:e}),t]}),(0,J.jsx)(O,{sx:{p:2,bgcolor:i.custom.surface,flex:1},children:n})]})}function Q({label:e,color:t,icon:n,size:r=`small`}){let{palette:i}=F(),a={success:i.success.main,error:i.error.main,warning:i.warning.main,neutral:i.custom.neutral,primary:i.primary.main}[t]??i.custom.neutral;return(0,J.jsx)(D,{label:e,icon:n,size:r,sx:{bgcolor:`${a}26`,color:a,border:`none`,borderRadius:`999px`,fontWeight:600,"& .MuiChip-icon":{color:a}}})}function Mt({tags:e,onAdd:t,onRemove:n,editable:r=!1}){let{palette:i}=F(),[a,o]=(0,q.useState)(``);return(0,J.jsxs)(O,{sx:{display:`flex`,flexWrap:`wrap`,gap:.5,alignItems:`center`},children:[e.map(e=>(0,J.jsx)(D,{label:e,size:`small`,onDelete:r?()=>n?.(e):void 0,sx:{bgcolor:i.custom.surfaceMuted,border:`1px solid ${i.custom.border}`,color:i.custom.textMuted}},e)),r&&(0,J.jsx)(N,{size:`small`,placeholder:`Add tag…`,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&a.trim()&&(e.preventDefault(),t?.(a.trim()),o(``))},sx:{width:100,"& .MuiInputBase-input":{py:.5,fontSize:`0.8125rem`}}})]})}function Nt({value:e,size:t=`small`}){let{palette:n}=F(),[r,i]=(0,q.useState)(!1);return(0,J.jsx)(P,{size:t,onClick:(0,q.useCallback)(()=>{navigator.clipboard.writeText(e).then(()=>{i(!0),setTimeout(()=>i(!1),1500)})},[e]),sx:{color:n.custom.textMuted},children:r?(0,J.jsx)(V,{fontSize:`small`}):(0,J.jsx)(H,{fontSize:`small`})})}var Pt=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],Ft=720*60*60*1e3;function It(e,t){let n=String(e.getDate()).padStart(2,`0`),r=Pt[e.getMonth()],i=e.getFullYear();return t?`${n} ${r} ${i}, ${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}`:`${n} ${r} ${i}`}function Lt(e){let t=Date.now()-e.getTime();if(t<0||t>Ft)return null;let n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function Rt({value:e,showTime:t=!1,showRelative:n=!0}){let{palette:r}=F(),i=e instanceof Date?e:new Date(e);if(isNaN(i.getTime()))return null;let a=It(i,t),o=n?Lt(i):null;return(0,J.jsxs)(g,{component:`span`,variant:`body2`,children:[a,o&&(0,J.jsxs)(g,{component:`span`,variant:`body2`,sx:{color:r.custom.textMuted,ml:.5},children:[`· `,o]})]})}function zt({breadcrumbs:e,actions:t}){let n=e.length<=1;return n&&!t?null:(0,J.jsxs)(O,{sx:{display:`flex`,alignItems:`center`,justifyContent:n?`flex-end`:`space-between`,mb:n?1.5:3},children:[!n&&(0,J.jsx)(ne,{separator:(0,J.jsx)(ye,{fontSize:`small`}),children:e.map((t,n)=>t.to&&n<e.length-1?(0,J.jsx)(d,{to:t.to,style:{textDecoration:`none`,color:`inherit`},children:(0,J.jsx)(g,{variant:`body1`,color:`text.secondary`,children:t.label})},n):(0,J.jsx)(g,{variant:`body1`,fontWeight:600,children:t.label},n))}),t&&(0,J.jsx)(O,{sx:{display:`flex`,gap:1},children:t})]})}function Bt({children:e,actions:t}){let{palette:n}=F();return(0,J.jsxs)(O,{sx:{display:`flex`,alignItems:`center`,gap:1.5,px:2,py:1,bgcolor:n.custom.surfaceMuted,borderRadius:1,mb:2},children:[(0,J.jsx)(O,{sx:{display:`flex`,gap:1.5,flex:1,alignItems:`center`},children:e}),t&&(0,J.jsx)(O,{sx:{display:`flex`,gap:1},children:t})]})}function Vt({label:e,children:t,divider:n=!0}){let{palette:r}=F();return(0,J.jsxs)(O,{sx:{display:`flex`,alignItems:`flex-start`,py:1.25,borderBottom:n?`1px solid ${r.custom.border}`:`none`},children:[(0,J.jsx)(g,{variant:`body2`,sx:{width:200,flexShrink:0,color:r.custom.textMuted,pt:.25},children:e}),(0,J.jsx)(O,{sx:{flex:1,minWidth:0},children:t})]})}function Ht({children:e}){return(0,J.jsx)(O,{sx:{display:`grid`,gridTemplateColumns:{xs:`1fr`,md:`1fr 1fr`},gap:2},children:e})}function Ut({children:e,fullWidth:t=!1}){return(0,J.jsx)(O,{sx:t?{gridColumn:`1 / -1`}:void 0,children:e})}function Wt({children:e,required:t,sx:n}){return(0,J.jsxs)(g,{variant:`caption`,sx:{display:`block`,mb:.75,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.05em`,color:`text.secondary`,...n},children:[e,t&&` *`]})}function Gt({title:e,description:t,action:n,icon:r}){let{palette:i}=F();return(0,J.jsxs)(O,{sx:{display:`flex`,flexDirection:`column`,alignItems:`center`,py:6,px:2},children:[r&&(0,J.jsx)(O,{sx:{mb:2,color:i.custom.textMuted,"& .MuiSvgIcon-root":{fontSize:48}},children:r}),(0,J.jsx)(g,{variant:`h6`,gutterBottom:!0,children:e}),t&&(0,J.jsx)(g,{variant:`body2`,sx:{color:i.custom.textMuted,mb:2,textAlign:`center`},children:t}),n]})}function Kt({open:e,title:t,message:n,confirmLabel:r=`Confirm`,confirmColor:i=`primary`,onConfirm:a,onCancel:o,loading:s=!1}){return(0,J.jsxs)(ae,{open:e,onClose:o,maxWidth:`xs`,fullWidth:!0,children:[(0,J.jsx)(C,{children:t}),(0,J.jsx)(me,{children:(0,J.jsx)(ie,{children:n})}),(0,J.jsxs)(_,{children:[(0,J.jsx)(M,{onClick:o,disabled:s,children:`Cancel`}),(0,J.jsx)(M,{onClick:a,color:i,variant:`contained`,disabled:s,children:r})]})]})}function qt({children:e}){let{palette:t}=F();return(0,J.jsx)(r,{remarkPlugins:[i],components:{h1:({children:e})=>(0,J.jsx)(g,{variant:`h5`,fontWeight:700,gutterBottom:!0,sx:{mt:3,mb:1.5},children:e}),h2:({children:e})=>(0,J.jsx)(g,{variant:`h6`,fontWeight:700,gutterBottom:!0,sx:{mt:3,mb:1},children:e}),h3:({children:e})=>(0,J.jsx)(g,{variant:`subtitle1`,fontWeight:700,gutterBottom:!0,sx:{mt:2,mb:.5},children:e}),p:({children:e})=>(0,J.jsx)(g,{variant:`body2`,sx:{mb:1.5,lineHeight:1.7},children:e}),a:({href:e,children:t})=>(0,J.jsx)(w,{href:e,underline:`hover`,color:`primary`,children:t}),ul:({children:e})=>(0,J.jsx)(O,{component:`ul`,sx:{pl:3,mb:1.5,"& li":{mb:.5}},children:e}),ol:({children:e})=>(0,J.jsx)(O,{component:`ol`,sx:{pl:3,mb:1.5,"& li":{mb:.5}},children:e}),li:({children:e})=>(0,J.jsx)(g,{component:`li`,variant:`body2`,sx:{lineHeight:1.7},children:e}),code:({className:e,children:n})=>e?.startsWith(`language-`)?(0,J.jsx)(O,{component:`pre`,sx:{p:2,mb:1.5,bgcolor:t.custom.surfaceMuted,borderRadius:1,border:`1px solid ${t.custom.border}`,overflow:`auto`,fontFamily:`monospace`,fontSize:`0.8125rem`,lineHeight:1.6,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:(0,J.jsx)(`code`,{children:n})}):(0,J.jsx)(O,{component:`code`,sx:{px:.6,py:.15,bgcolor:t.custom.surfaceMuted,borderRadius:.5,fontFamily:`monospace`,fontSize:`0.8125rem`},children:n}),pre:({children:e})=>(0,J.jsx)(J.Fragment,{children:e}),blockquote:({children:e})=>(0,J.jsx)(O,{sx:{pl:2,ml:0,borderLeft:`3px solid ${t.primary.main}`,color:t.custom.textMuted,mb:1.5},children:e}),table:({children:e})=>(0,J.jsx)(O,{component:`table`,sx:{width:`100%`,mb:1.5,borderCollapse:`collapse`,"& th, & td":{border:`1px solid ${t.custom.border}`,px:1.5,py:.75,fontSize:`0.8125rem`,textAlign:`left`},"& th":{bgcolor:t.custom.surfaceMuted,fontWeight:600}},children:e}),hr:()=>(0,J.jsx)(O,{component:`hr`,sx:{border:`none`,borderTop:`1px solid ${t.custom.border}`,my:2}})},children:e})}var Jt=(0,q.lazy)(()=>s(()=>import(`./esm-BWiKNcBW.js`),__vite__mapDeps([0,1,2,3,4])));function Yt({value:e,onChange:t,height:n=300}){let{palette:r}=F(),i=r.mode;return(0,J.jsx)(`div`,{"data-color-mode":i,children:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(O,{sx:{display:`flex`,justifyContent:`center`,alignItems:`center`,height:n},children:(0,J.jsx)(j,{size:24})}),children:(0,J.jsx)(Jt,{value:e,onChange:e=>t(e??``),height:n,preview:`edit`,visibleDragbar:!1})})})}function Xt({note:e,score:t,onClick:n,onEdit:r}){let{palette:i}=F();return(0,J.jsx)(S,{variant:`outlined`,sx:{cursor:n?`pointer`:`default`,"&:hover":n?{borderColor:`primary.main`}:{}},onClick:n,children:(0,J.jsx)(E,{sx:{py:1.5,px:2,"&:last-child":{pb:1.5}},children:(0,J.jsxs)(O,{sx:{display:`flex`,alignItems:`flex-start`,gap:1},children:[(0,J.jsxs)(O,{sx:{flex:1,minWidth:0},children:[(0,J.jsxs)(O,{sx:{display:`flex`,alignItems:`center`,gap:1,mb:.25},children:[(0,J.jsx)(g,{variant:`subtitle1`,fontWeight:600,noWrap:!0,sx:{flex:1},children:e.title}),t!==void 0&&(0,J.jsx)(Q,{label:`${(t*100).toFixed(0)}%`,color:`primary`,size:`small`})]}),e.content&&(0,J.jsx)(g,{variant:`body2`,sx:{color:i.custom.textMuted,display:`-webkit-box`,WebkitLineClamp:2,WebkitBoxOrient:`vertical`,overflow:`hidden`},children:e.content.replace(/^#+\s*/gm,``).replace(/[*_`]/g,``).trim()}),e.tags?.length>0&&(0,J.jsx)(O,{sx:{mt:.5},children:(0,J.jsx)(Mt,{tags:e.tags})})]}),r&&(0,J.jsx)(ce,{title:`Edit`,children:(0,J.jsx)(P,{size:`small`,onClick:e=>{e.stopPropagation(),r()},children:(0,J.jsx)(be,{fontSize:`small`})})})]})})})}function Zt(e,t){return R(`/projects/${e}/tasks${L({status:t?.status,priority:t?.priority,tag:t?.tag,assignee:t?.assignee,limit:t?.limit})}`).then(I)}function Qt(e,t){return R(`/projects/${e}/tasks/${t}`)}function $t(e,t){return R(`/projects/${e}/tasks`,{method:`POST`,body:JSON.stringify(t)})}function en(e,t,n){return R(`/projects/${e}/tasks/${t}`,{method:`PUT`,body:JSON.stringify(n)})}function tn(e,t,n){return R(`/projects/${e}/tasks/${t}/move`,{method:`POST`,body:JSON.stringify({status:n})})}function nn(e,t){return R(`/projects/${e}/tasks/${t}`,{method:`DELETE`})}function rn(e,t,n){return R(`/projects/${e}/tasks/search${L({q:t,topK:n?.topK,minScore:n?.minScore})}`).then(I)}function an(e,t){return R(`/projects/${e}/tasks/${t}/relations`).then(I)}function on(e,t){return R(`/projects/${e}/tasks/links`,{method:`POST`,body:JSON.stringify(t)})}function sn(e,t){return R(`/projects/${e}/tasks/links`,{method:`DELETE`,body:JSON.stringify(t)})}function cn(e,t,n){return R(`/projects/${e}/tasks/linked${L({targetGraph:t,targetNodeId:n})}`).then(I)}function ln(e,t){return R(`/projects/${e}/tasks/${t}/attachments`).then(I)}async function un(e,t,n){let r=new FormData;r.append(`file`,n);let i=await fetch(`/api/projects/${e}/tasks/${t}/attachments`,{method:`POST`,credentials:`include`,body:r});if(!i.ok){let e=await i.json().catch(()=>({error:i.statusText}));throw Error(e.error||i.statusText)}return i.json()}function dn(e,t,n){return R(`/projects/${e}/tasks/${t}/attachments/${encodeURIComponent(n)}`,{method:`DELETE`})}function fn(e,t,n){return`/api/projects/${e}/tasks/${t}/attachments/${encodeURIComponent(n)}`}var pn=[{status:`backlog`,label:`Backlog`,color:`#616161`},{status:`todo`,label:`To Do`,color:`#1976d2`},{status:`in_progress`,label:`In Progress`,color:`#f57c00`},{status:`review`,label:`Review`,color:`#7b1fa2`},{status:`done`,label:`Done`,color:`#388e3c`},{status:`cancelled`,label:`Cancelled`,color:`#d32f2f`}],mn={backlog:`neutral`,todo:`primary`,in_progress:`warning`,review:`primary`,done:`success`,cancelled:`error`},hn={critical:`error`,high:`warning`,medium:`primary`,low:`neutral`};function gn(e){return pn.find(t=>t.status===e)?.label??e}function _n(e){return e.charAt(0).toUpperCase()+e.slice(1)}function vn(){let{projectId:e}=u(),t=o(),{palette:n}=F(),[r,i]=(0,q.useState)(null),[a,s]=(0,q.useState)([]),[c,l]=(0,q.useState)([]),[d,f]=(0,q.useState)(!0),[p,m]=(0,q.useState)(null),h=(0,q.useCallback)(async()=>{if(e)try{let[t,n,r]=await Promise.all([Ue(e),vt(e,{limit:5}).catch(()=>[]),Zt(e,{limit:10}).catch(()=>[])]);i(t),s(n),l(r),m(null)}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(!1)}},[e]);if((0,q.useEffect)(()=>{h()},[h]),Qe(e??null,(0,q.useCallback)(()=>{h()},[h])),d)return(0,J.jsx)(O,{sx:{display:`flex`,justifyContent:`center`,py:4},children:(0,J.jsx)(j,{})});if(p)return(0,J.jsx)(A,{severity:`error`,children:p});let _=[{label:`Notes`,value:r?.knowledge?.nodes??0,icon:(0,J.jsx)(W,{}),path:`knowledge`,color:n.warning.main},{label:`Tasks`,value:r?.tasks?.nodes??0,icon:(0,J.jsx)(Ne,{}),path:`tasks`,color:n.primary.main},{label:`Skills`,value:r?.skills?.nodes??0,icon:(0,J.jsx)(G,{}),path:`skills`,color:`#9c27b0`},{label:`Docs`,value:r?.docs?.nodes??0,icon:(0,J.jsx)(U,{}),path:`docs`,color:n.secondary.main},{label:`Code Symbols`,value:r?.code?.nodes??0,icon:(0,J.jsx)(ke,{}),path:`search`,color:n.error.main},{label:`Files`,value:r?.fileIndex?.nodes??0,icon:(0,J.jsx)(K,{}),path:`files`,color:n.success.main}];return(0,J.jsxs)(O,{children:[(0,J.jsx)(zt,{breadcrumbs:[{label:`Dashboard`}]}),(0,J.jsx)(O,{sx:{display:`grid`,gridTemplateColumns:{xs:`1fr 1fr`,md:`repeat(6, 1fr)`},gap:2,mb:3},children:_.map(r=>(0,J.jsx)(S,{variant:`outlined`,sx:{cursor:`pointer`,"&:hover":{borderColor:`primary.main`}},onClick:()=>t(`/${e}/${r.path}`),children:(0,J.jsxs)(E,{sx:{py:2,px:2,"&:last-child":{pb:2}},children:[(0,J.jsxs)(O,{sx:{display:`flex`,alignItems:`center`,gap:1,mb:1},children:[(0,J.jsx)(O,{sx:{color:r.color},children:r.icon}),(0,J.jsx)(g,{variant:`caption`,sx:{color:n.custom.textMuted,textTransform:`uppercase`,letterSpacing:.5},children:r.label})]}),(0,J.jsx)(g,{variant:`h4`,fontWeight:700,children:r.value})]})},r.label))}),(0,J.jsxs)(O,{sx:{display:`grid`,gridTemplateColumns:{xs:`1fr`,md:`1fr 1fr`},gap:3},children:[(0,J.jsxs)(Z,{title:`Recent Notes`,action:(0,J.jsx)(M,{size:`small`,endIcon:(0,J.jsx)(_e,{}),onClick:()=>t(`/${e}/knowledge`),children:`View all`}),children:[a.length===0?(0,J.jsx)(g,{variant:`body2`,sx:{color:n.custom.textMuted},children:`No notes yet`}):(0,J.jsx)(v,{dense:!0,disablePadding:!0,children:a.map(r=>(0,J.jsxs)(y,{onClick:()=>t(`/${e}/knowledge/${r.id}`),sx:{borderRadius:1,py:.5},children:[(0,J.jsx)(ee,{sx:{minWidth:32},children:(0,J.jsx)(W,{fontSize:`small`,sx:{color:n.warning.main}})}),(0,J.jsx)(T,{primary:(0,J.jsx)(g,{variant:`body2`,fontWeight:500,children:r.title}),secondary:r.content?r.content.slice(0,60)+(r.content.length>60?`...`:``):void 0})]},r.id))}),(0,J.jsx)(O,{sx:{mt:1.5},children:(0,J.jsx)(M,{size:`small`,startIcon:(0,J.jsx)(B,{}),onClick:()=>t(`/${e}/knowledge/new`),children:`New Note`})})]}),(0,J.jsxs)(Z,{title:`Recent Tasks`,action:(0,J.jsx)(M,{size:`small`,endIcon:(0,J.jsx)(_e,{}),onClick:()=>t(`/${e}/tasks`),children:`View all`}),children:[c.length===0?(0,J.jsx)(g,{variant:`body2`,sx:{color:n.custom.textMuted},children:`No tasks yet`}):(0,J.jsx)(v,{dense:!0,disablePadding:!0,children:c.map(n=>(0,J.jsxs)(y,{onClick:()=>t(`/${e}/tasks/${n.id}`),sx:{borderRadius:1,py:.75,px:1.5},children:[(0,J.jsx)(T,{primary:(0,J.jsx)(g,{variant:`body2`,fontWeight:500,noWrap:!0,children:n.title}),sx:{mr:2}}),(0,J.jsx)(Q,{label:gn(n.status),color:mn[n.status],size:`small`})]},n.id))}),(0,J.jsx)(O,{sx:{mt:1.5},children:(0,J.jsx)(M,{size:`small`,startIcon:(0,J.jsx)(B,{}),onClick:()=>t(`/${e}/tasks/new`),children:`New Task`})})]})]})]})}var yn=(0,q.lazy)(()=>s(()=>import(`./knowledge-DeygeGGH.js`),__vite__mapDeps([5,2,6,7,1,3,4,8,9]))),bn=(0,q.lazy)(()=>s(()=>import(`./_noteId_-C1enaQd1.js`),__vite__mapDeps([10,2,6,7,1,3,4,8,11,12,13,14,15,16]))),xn=(0,q.lazy)(()=>s(()=>import(`./new-DHTg3Dqq.js`),__vite__mapDeps([17,6,2,7,1,3,4,9]))),Sn=(0,q.lazy)(()=>s(()=>import(`./edit-BYiy1FZy.js`),__vite__mapDeps([18,2,6,7,1,3,4,9]))),Cn=(0,q.lazy)(()=>s(()=>import(`./tasks-CobouTKV.js`),__vite__mapDeps([19,2,6,7,1,3,4,8]))),wn=(0,q.lazy)(()=>s(()=>import(`./_taskId_-DSB3dLVz.js`),__vite__mapDeps([20,2,6,7,1,3,4,8,11,12,13,14,15,16]))),Tn=(0,q.lazy)(()=>s(()=>import(`./new-CpD7hOBA.js`),__vite__mapDeps([21,6,2,7,1,3,4,22]))),En=(0,q.lazy)(()=>s(()=>import(`./edit-TUIIpUMF.js`),__vite__mapDeps([23,2,6,7,1,3,4,22]))),Dn=(0,q.lazy)(()=>s(()=>import(`./skills-Cga9iUZN.js`),__vite__mapDeps([24,2,6,7,1,3,4,8,11,12,25]))),On=(0,q.lazy)(()=>s(()=>import(`./_skillId_-hPoCet7J.js`),__vite__mapDeps([26,2,6,7,1,3,4,8,11,12,13,14,15,16]))),kn=(0,q.lazy)(()=>s(()=>import(`./new-s8c0M75X.js`),__vite__mapDeps([27,6,2,7,1,3,4,11,8,12,25]))),An=(0,q.lazy)(()=>s(()=>import(`./edit-hc-ZWz3y.js`),__vite__mapDeps([28,2,6,7,1,3,4,11,8,12,25]))),jn=(0,q.lazy)(()=>s(()=>import(`./docs-CrXsRcOG.js`),__vite__mapDeps([29,2,6,7,1,3,4,8,15,12]))),Mn=(0,q.lazy)(()=>s(()=>import(`./_docId_-hdCDjclV.js`),__vite__mapDeps([30,2,6,7,1,3,4,15,12]))),Nn=(0,q.lazy)(()=>s(()=>import(`./files-0bPg6NH9.js`),__vite__mapDeps([31,2,6,7,1,3,4,8,16,12]))),Pn=(0,q.lazy)(()=>s(()=>import(`./_filePath_-CpG836v4.js`),__vite__mapDeps([32,2,6,7,1,3,4,16,12]))),Fn=(0,q.lazy)(()=>s(()=>import(`./search-EpJhdP2a.js`),__vite__mapDeps([33,2,6,7,1,3,4,8,14,12,15,16,11]))),In=(0,q.lazy)(()=>s(()=>import(`./graph-DXGud_wF.js`),__vite__mapDeps([34,2,6,7,1,3,4,8,35,12]))),Ln=(0,q.lazy)(()=>s(()=>import(`./tools-JxKH5BDF.js`),__vite__mapDeps([36,2,6,7,1,3,4,8,37,12]))),Rn=(0,q.lazy)(()=>s(()=>import(`./_toolName_-3SmCfxZy.js`),__vite__mapDeps([38,2,6,7,1,3,4,8,39,37,12]))),$=(0,q.lazy)(()=>s(()=>import(`./prompts-BgOmdxgM.js`),__vite__mapDeps([40,2,6,7,1,3,4,8,11,12]))),zn=(0,q.lazy)(()=>s(()=>import(`./help-DJ52_fxN.js`),__vite__mapDeps([41,2,6,7,1,3,4,8,39]))),Bn=(0,q.lazy)(()=>s(()=>import(`./_articleId_-DjbCByxM.js`),__vite__mapDeps([42,6,2,7,1,3,4,8,39])));function Vn(){return(0,J.jsx)(O,{sx:{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`50vh`},children:(0,J.jsx)(j,{size:32})})}function Hn(){return(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(Vn,{}),children:(0,J.jsxs)(f,{children:[(0,J.jsxs)(a,{path:`/:projectId`,element:(0,J.jsx)(gt,{}),children:[(0,J.jsx)(a,{index:!0,element:(0,J.jsx)(p,{to:`dashboard`,replace:!0})}),(0,J.jsx)(a,{path:`dashboard`,element:(0,J.jsx)(vn,{})}),(0,J.jsx)(a,{path:`knowledge`,element:(0,J.jsx)(yn,{})}),(0,J.jsx)(a,{path:`knowledge/new`,element:(0,J.jsx)(xn,{})}),(0,J.jsx)(a,{path:`knowledge/:noteId/edit`,element:(0,J.jsx)(Sn,{})}),(0,J.jsx)(a,{path:`knowledge/:noteId`,element:(0,J.jsx)(bn,{})}),(0,J.jsx)(a,{path:`tasks`,element:(0,J.jsx)(Cn,{})}),(0,J.jsx)(a,{path:`tasks/new`,element:(0,J.jsx)(Tn,{})}),(0,J.jsx)(a,{path:`tasks/:taskId/edit`,element:(0,J.jsx)(En,{})}),(0,J.jsx)(a,{path:`tasks/:taskId`,element:(0,J.jsx)(wn,{})}),(0,J.jsx)(a,{path:`skills`,element:(0,J.jsx)(Dn,{})}),(0,J.jsx)(a,{path:`skills/new`,element:(0,J.jsx)(kn,{})}),(0,J.jsx)(a,{path:`skills/:skillId/edit`,element:(0,J.jsx)(An,{})}),(0,J.jsx)(a,{path:`skills/:skillId`,element:(0,J.jsx)(On,{})}),(0,J.jsx)(a,{path:`docs`,element:(0,J.jsx)(jn,{})}),(0,J.jsx)(a,{path:`docs/:docId`,element:(0,J.jsx)(Mn,{})}),(0,J.jsx)(a,{path:`files`,element:(0,J.jsx)(Nn,{})}),(0,J.jsx)(a,{path:`files/view/*`,element:(0,J.jsx)(Pn,{})}),(0,J.jsx)(a,{path:`search`,element:(0,J.jsx)(Fn,{})}),(0,J.jsx)(a,{path:`graph`,element:(0,J.jsx)(In,{})}),(0,J.jsx)(a,{path:`prompts/simple`,element:(0,J.jsx)($,{})}),(0,J.jsx)(a,{path:`prompts/advanced`,element:(0,J.jsx)($,{})}),(0,J.jsx)(a,{path:`prompts`,element:(0,J.jsx)($,{})}),(0,J.jsx)(a,{path:`tools`,element:(0,J.jsx)(Ln,{})}),(0,J.jsx)(a,{path:`tools/:toolName`,element:(0,J.jsx)(Rn,{})}),(0,J.jsx)(a,{path:`help`,element:(0,J.jsx)(zn,{})}),(0,J.jsx)(a,{path:`help/:articleId`,element:(0,J.jsx)(Bn,{})})]}),(0,J.jsx)(a,{path:`*`,element:(0,J.jsx)(_t,{})})]})})}(0,Pe.createRoot)(document.getElementById(`root`)).render((0,J.jsx)(q.StrictMode,{children:(0,J.jsx)(h,{basename:`/ui`,children:(0,J.jsx)(ze,{children:(0,J.jsx)(qe,{children:(0,J.jsx)(Hn,{})})})})}));export{Ue as $,Bt as A,At as B,qt as C,Ut as D,Wt as E,Q as F,vt as G,Dt as H,Z as I,Ct as J,wt as K,bt as L,Rt as M,Nt as N,Ht as O,Mt as P,Qe as Q,Tt as R,Yt as S,Gt as T,yt as U,Et as V,Ot as W,kt as X,xt as Y,nt as Z,rn as _,gn as a,un as b,nn as c,cn as d,We as et,Qt as f,tn as g,Zt as h,_n as i,zt as j,Vt as k,dn as l,an as m,hn as n,$t as o,ln as p,jt as q,mn as r,on as s,pn as t,sn as u,fn as v,Kt as w,Xt as x,en as y,St as z};
@@ -0,0 +1 @@
1
+ :root{font-synthesis:none;text-rendering:optimizelegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;font-weight:400;line-height:1.5}html,body,#root{width:100%;height:100%;margin:0;padding:0}
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{D as t,O as n}from"./vendor-markdown-CT8ZVEPu.js";import{c as r,l as i,u as a}from"./vendor-react-CHUjhoxh.js";import{A as o,Y as s,et as c,m as l,nt as u,q as d,r as f,tt as p}from"./vendor-mui-BPj7d3Sw.js";import"./vendor-md-editor-DmWafJvr.js";import{K as m,Q as h,k as g,st as _}from"./vendor-mui-icons-B196sG3f.js";import{A as v,G as y,J as b,L as x,Q as S,T as C,Y as w,Z as T,j as E,x as D,z as O}from"./index-BCZDAYZi.js";import"./NoteForm-aZX9f6-3.js";var k=e(n(),1);function A(e){let[t,n]=(0,k.useState)([]),[r,i]=(0,k.useState)(!1),[a,o]=(0,k.useState)(null),s=(0,k.useCallback)(async()=>{if(e){i(!0),o(null);try{n(await y(e))}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}},[e]);return(0,k.useEffect)(()=>{s()},[s]),{notes:t,loading:r,error:a,refresh:s,create:(0,k.useCallback)(async t=>{if(!e)return;let r=await x(e,t);return n(e=>[...e,r]),r},[e]),update:(0,k.useCallback)(async(t,r)=>{if(!e)return;let i=await w(e,t,r);return n(e=>e.map(e=>e.id===t?i:e)),i},[e]),remove:(0,k.useCallback)(async t=>{e&&(await O(e,t),n(e=>e.filter(e=>e.id!==t)))},[e])}}var j=t();function M(){let{projectId:e}=i(),t=r(),[n,y]=a(),x=T(`knowledge`),{notes:w,loading:O,error:M,refresh:N}=A(e??null),[P,F]=(0,k.useState)(n.get(`q`)||``),[I,L]=(0,k.useState)(null),[R,z]=(0,k.useState)(!1);S(e??null,(0,k.useCallback)(e=>{e.type.startsWith(`note:`)&&N()},[N]));let B=(0,k.useCallback)(async t=>{if(!e||!t.trim()){L(null);return}z(!0);try{L(await b(e,t.trim()))}catch{}finally{z(!1)}},[e]);(0,k.useEffect)(()=>{let e=n.get(`q`);e?.trim()&&B(e)},[]);let V=()=>{let e=new URLSearchParams(n);P.trim()?e.set(`q`,P.trim()):e.delete(`q`),y(e,{replace:!0}),B(P)},H=()=>{F(``),L(null);let e=new URLSearchParams(n);e.delete(`q`),y(e,{replace:!0})},U=I??w;return(0,j.jsxs)(s,{children:[(0,j.jsx)(E,{breadcrumbs:[{label:`Knowledge`}],actions:x?(0,j.jsx)(d,{variant:`contained`,startIcon:(0,j.jsx)(m,{}),onClick:()=>t(`new`),children:`New Note`}):void 0}),(0,j.jsx)(v,{children:(0,j.jsx)(f,{fullWidth:!0,size:`small`,placeholder:`Semantic search notes...`,value:P,onChange:e=>F(e.target.value),onKeyDown:e=>e.key===`Enter`&&V(),slotProps:{input:{startAdornment:(0,j.jsx)(o,{position:`start`,children:(0,j.jsx)(_,{})}),endAdornment:P&&(0,j.jsx)(o,{position:`end`,children:(0,j.jsx)(p,{size:`small`,onClick:H,children:(0,j.jsx)(h,{})})})}}})}),I&&(0,j.jsxs)(s,{sx:{mb:1,color:`text.secondary`,fontSize:`0.75rem`},children:[I.length,` result`,I.length===1?``:`s`,` found`]}),M&&(0,j.jsx)(c,{severity:`error`,sx:{mb:2},children:M}),O||R?(0,j.jsx)(s,{sx:{display:`flex`,justifyContent:`center`,py:4},children:(0,j.jsx)(u,{})}):U.length===0?(0,j.jsx)(C,{icon:(0,j.jsx)(g,{}),title:I?`No matching notes found`:`No notes yet`,description:I?`Try a different search query`:`Create your first note to get started`,action:!I&&x?(0,j.jsx)(d,{variant:`contained`,startIcon:(0,j.jsx)(m,{}),onClick:()=>t(`new`),children:`New Note`}):void 0}):(0,j.jsx)(l,{spacing:2,children:U.map(e=>(0,j.jsx)(D,{note:e,score:`score`in e?e.score:void 0,onClick:()=>t(e.id),onEdit:x?()=>t(`${e.id}/edit`):void 0},e.id))})]})}export{M as default};
@@ -0,0 +1 @@
1
+ import{D as e}from"./vendor-markdown-CT8ZVEPu.js";import{c as t,l as n}from"./vendor-react-CHUjhoxh.js";import{Y as r,et as i,q as a}from"./vendor-mui-BPj7d3Sw.js";import"./vendor-md-editor-DmWafJvr.js";import{Z as o,j as s,o as c}from"./index-BCZDAYZi.js";import{t as l}from"./TaskForm-Bl5nkybO.js";var u=e();function d(){let{projectId:e}=n(),d=t(),f=o(`tasks`);return(0,u.jsxs)(r,{children:[(0,u.jsx)(s,{breadcrumbs:[{label:`Tasks`,to:`/${e}/tasks`},{label:`Create`}],actions:(0,u.jsx)(a,{variant:`contained`,form:`task-form`,type:`submit`,disabled:!f,children:`Create`})}),!f&&(0,u.jsx)(i,{severity:`warning`,sx:{mb:2},children:`Read-only access — you cannot create tasks.`}),(0,u.jsx)(l,{onSubmit:async t=>{e&&d(`/${e}/tasks/${(await c(e,t)).id}`)},onCancel:()=>d(`/${e}/tasks`),submitLabel:`Create`})]})}export{d as default};
@@ -0,0 +1 @@
1
+ import{D as e}from"./vendor-markdown-CT8ZVEPu.js";import{c as t,l as n}from"./vendor-react-CHUjhoxh.js";import{Y as r,et as i,q as a}from"./vendor-mui-BPj7d3Sw.js";import"./vendor-md-editor-DmWafJvr.js";import{L as o,Z as s,j as c}from"./index-BCZDAYZi.js";import{t as l}from"./NoteForm-aZX9f6-3.js";var u=e();function d(){let{projectId:e}=n(),d=t(),f=s(`knowledge`);return(0,u.jsxs)(r,{children:[(0,u.jsx)(c,{breadcrumbs:[{label:`Knowledge`,to:`/${e}/knowledge`},{label:`Create`}],actions:(0,u.jsx)(a,{variant:`contained`,form:`note-form`,type:`submit`,disabled:!f,children:`Create`})}),!f&&(0,u.jsx)(i,{severity:`warning`,sx:{mb:2},children:`Read-only access — you cannot create notes.`}),(0,u.jsx)(l,{onSubmit:async t=>{e&&d(`/${e}/knowledge/${(await o(e,t)).id}`)},onCancel:()=>d(`/${e}/knowledge`),submitLabel:`Create`})]})}export{d as default};
@@ -0,0 +1 @@
1
+ import{D as e}from"./vendor-markdown-CT8ZVEPu.js";import{c as t,l as n}from"./vendor-react-CHUjhoxh.js";import{Y as r,et as i,q as a}from"./vendor-mui-BPj7d3Sw.js";import"./vendor-md-editor-DmWafJvr.js";import{Z as o,j as s}from"./index-BCZDAYZi.js";import{a as c}from"./skill-y9pizyqE.js";import{t as l}from"./SkillForm-KYa3o92l.js";var u=e();function d(){let{projectId:e}=n(),d=t(),f=o(`skills`);return(0,u.jsxs)(r,{children:[(0,u.jsx)(s,{breadcrumbs:[{label:`Skills`,to:`/${e}/skills`},{label:`Create`}],actions:(0,u.jsx)(a,{variant:`contained`,form:`skill-form`,type:`submit`,disabled:!f,children:`Create`})}),!f&&(0,u.jsx)(i,{severity:`warning`,sx:{mb:2},children:`Read-only access — you cannot create skills.`}),(0,u.jsx)(l,{onSubmit:async t=>{e&&d(`/${e}/skills/${(await c(e,t)).id}`)},onCancel:()=>d(`/${e}/skills`),submitLabel:`Create`})]})}export{d as default};