ocean-brain 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +4 -2
- package/server/client/dist/assets/Calendar-CBYfyLwm.js +25 -0
- package/server/client/dist/assets/{Search-BxozUWkC.js → Search-D0yR4DTH.js} +1 -1
- package/server/client/dist/assets/{Tag-BhCf_mil.js → Tag-B8UYGbt9.js} +1 -1
- package/server/client/dist/assets/{TagNotes-BIzhXqwp.js → TagNotes-CDVHz74G.js} +1 -1
- package/server/client/dist/assets/{Views-C26uWznP.js → Views-Cjdbbut-.js} +1 -1
- package/server/client/dist/assets/{app-DbQdHfMb.js → app-Clwvoiwx.js} +2 -2
- package/server/client/dist/assets/app-DGFNtdpS.css +1 -0
- package/server/client/dist/assets/{index-8bsOoxxg.js → index-PjoL3frH.js} +1 -1
- package/server/client/dist/assets/{manage-image-detail-CPpeRZD4.js → manage-image-detail-CLPXVSZf.js} +1 -1
- package/server/client/dist/assets/{placeholder-CHRQt_T8.js → placeholder-D4Lkz_or.js} +1 -1
- package/server/client/dist/assets/{search-DCLnUWYd.js → search-BlbdHNDA.js} +1 -1
- package/server/client/dist/index.html +2 -2
- package/server/dist/app.js +5 -5
- package/server/dist/features/search/sqlite-vector-index.js +71 -138
- package/server/dist/main.js +1 -35
- package/server/dist/routes/api.js +6 -1
- package/server/dist/routes/client.js +15 -4
- package/server/dist/server.js +40 -0
- package/server/client/dist/assets/Calendar-BLiViCGr.js +0 -25
- package/server/client/dist/assets/app-CEkicO08.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,j as a}from"./floating-ui.react-dom-BWTnA00G.js";import{a as N,h as E}from"./useNoteMutate-VJYw0Vt_.js";import{C as A,a1 as M,P as y,T as t,F as c,a2 as o}from"./time-DZKkPFUi.js";import{f as w}from"./mcp-admin-adapter-z9OaMVrl.js";import{a as b,e as H,c as S,S as T,g as C,h as R}from"./url-BvjSC8PU.js";import{d as F,f as k}from"./app-DbQdHfMb.js";import{I as V}from"./Image.es-vY-nTyOe.js";import{n as _,c as I}from"./Trash.es-prxIxo9c.js";import"./preload-helper-BXl3LOEh.js";import"./sortable.esm-DgSW3bAA.js";const L=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M236.37,139.4a12,12,0,0,0-12-3A84.07,84.07,0,0,1,119.6,31.59a12,12,0,0,0-15-15A108.86,108.86,0,0,0,49.69,55.07,108,108,0,0,0,136,228a107.09,107.09,0,0,0,64.93-21.69,108.86,108.86,0,0,0,38.44-54.94A12,12,0,0,0,236.37,139.4Zm-49.88,47.74A84,84,0,0,1,68.86,69.51,84.93,84.93,0,0,1,92.27,48.29Q92,52.13,92,56A108.12,108.12,0,0,0,200,164q3.87,0,7.71-.27A84.79,84.79,0,0,1,186.49,187.14Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M227.89,147.89A96,96,0,1,1,108.11,28.11,96.09,96.09,0,0,0,227.89,147.89Z",opacity:"0.2"}),e.createElement("path",{d:"M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M235.54,150.21a104.84,104.84,0,0,1-37,52.91A104,104,0,0,1,32,120,103.09,103.09,0,0,1,52.88,57.48a104.84,104.84,0,0,1,52.91-37,8,8,0,0,1,10,10,88.08,88.08,0,0,0,109.8,109.8,8,8,0,0,1,10,10Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M232.13,143.64a6,6,0,0,0-6-1.49A90.07,90.07,0,0,1,113.86,29.85a6,6,0,0,0-7.49-7.48A102.88,102.88,0,0,0,54.48,58.68,102,102,0,0,0,197.32,201.52a102.88,102.88,0,0,0,36.31-51.89A6,6,0,0,0,232.13,143.64Zm-42,48.29a90,90,0,0,1-126-126A90.9,90.9,0,0,1,99.65,37.66,102.06,102.06,0,0,0,218.34,156.35,90.9,90.9,0,0,1,190.1,191.93Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M230.72,145.06a4,4,0,0,0-4-1A92.08,92.08,0,0,1,111.94,29.27a4,4,0,0,0-5-5A100.78,100.78,0,0,0,56.08,59.88a100,100,0,0,0,140,140,100.78,100.78,0,0,0,35.59-50.87A4,4,0,0,0,230.72,145.06ZM191.3,193.53A92,92,0,0,1,62.47,64.7a93,93,0,0,1,39.88-30.35,100.09,100.09,0,0,0,119.3,119.3A93,93,0,0,1,191.3,193.53Z"}))]]),P=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M203.57,51A107.9,107.9,0,0,0,20,128c0,44.72,27.6,82.25,72,97.94A36,36,0,0,0,140,192a12,12,0,0,1,12-12h46.21a35.79,35.79,0,0,0,35.1-28A108.6,108.6,0,0,0,236,127.09,107.23,107.23,0,0,0,203.57,51Zm6.34,95.67a11.91,11.91,0,0,1-11.7,9.3H152a36,36,0,0,0-36,36,12,12,0,0,1-16,11.3c-16.65-5.88-30.65-15.76-40.48-28.56A76,76,0,0,1,44,128a84,84,0,0,1,83.13-84H128a84.35,84.35,0,0,1,84,83.29A84.72,84.72,0,0,1,209.91,146.71ZM144,76a16,16,0,1,1-16-16A16,16,0,0,1,144,76Zm-44,24A16,16,0,1,1,84,84,16,16,0,0,1,100,100Zm0,56a16,16,0,1,1-16-16A16,16,0,0,1,100,156Zm88-56a16,16,0,1,1-16-16A16,16,0,0,1,188,100Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M224,127.17a96.48,96.48,0,0,1-2.39,22.18A24,24,0,0,1,198.21,168H152a24,24,0,0,0-24,24,24,24,0,0,1-32,22.61C58.73,201.44,32,169.81,32,128a96,96,0,0,1,95-96C179.84,31.47,223.55,74.35,224,127.17Z",opacity:"0.2"}),e.createElement("path",{d:"M200.77,53.89A103.27,103.27,0,0,0,128,24h-1.07A104,104,0,0,0,24,128c0,43,26.58,79.06,69.36,94.17A32,32,0,0,0,136,192a16,16,0,0,1,16-16h46.21a31.81,31.81,0,0,0,31.2-24.88,104.43,104.43,0,0,0,2.59-24A103.28,103.28,0,0,0,200.77,53.89Zm13,93.71A15.89,15.89,0,0,1,198.21,160H152a32,32,0,0,0-32,32,16,16,0,0,1-21.31,15.07C62.49,194.3,40,164,40,128a88,88,0,0,1,87.09-88h.9a88.35,88.35,0,0,1,88,87.25A88.86,88.86,0,0,1,213.81,147.6ZM140,76a12,12,0,1,1-12-12A12,12,0,0,1,140,76ZM96,100A12,12,0,1,1,84,88,12,12,0,0,1,96,100Zm0,56a12,12,0,1,1-12-12A12,12,0,0,1,96,156Zm88-56a12,12,0,1,1-12-12A12,12,0,0,1,184,100Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M200.77,53.89A103.27,103.27,0,0,0,128,24h-1.07A104,104,0,0,0,24,128c0,43,26.58,79.06,69.36,94.17A32,32,0,0,0,136,192a16,16,0,0,1,16-16h46.21a31.81,31.81,0,0,0,31.2-24.88,104.43,104.43,0,0,0,2.59-24A103.28,103.28,0,0,0,200.77,53.89ZM84,168a12,12,0,1,1,12-12A12,12,0,0,1,84,168Zm0-56a12,12,0,1,1,12-12A12,12,0,0,1,84,112Zm44-24a12,12,0,1,1,12-12A12,12,0,0,1,128,88Zm44,24a12,12,0,1,1,12-12A12,12,0,0,1,172,112Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M199.37,55.31A101.32,101.32,0,0,0,128,26h-1A102,102,0,0,0,26,128c0,42.09,26.07,77.44,68,92.26A30.21,30.21,0,0,0,104.11,222,30.06,30.06,0,0,0,134,192a18,18,0,0,1,18-18h46.21a29.82,29.82,0,0,0,29.25-23.31A102.71,102.71,0,0,0,230,127.11,101.25,101.25,0,0,0,199.37,55.31ZM215.76,148a17.89,17.89,0,0,1-17.55,14H152a30,30,0,0,0-30,30,18,18,0,0,1-24,17C61,195.86,38,164.85,38,128a90,90,0,0,1,89.07-90H128a90.34,90.34,0,0,1,90,89.22A90.46,90.46,0,0,1,215.76,148ZM138,76a10,10,0,1,1-10-10A10,10,0,0,1,138,76ZM94,100A10,10,0,1,1,84,90,10,10,0,0,1,94,100Zm0,56a10,10,0,1,1-10-10A10,10,0,0,1,94,156Zm88-56a10,10,0,1,1-10-10A10,10,0,0,1,182,100Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M200.77,53.89A103.27,103.27,0,0,0,128,24h-1.07A104,104,0,0,0,24,128c0,43,26.58,79.06,69.36,94.17A32,32,0,0,0,136,192a16,16,0,0,1,16-16h46.21a31.81,31.81,0,0,0,31.2-24.88,104.43,104.43,0,0,0,2.59-24A103.28,103.28,0,0,0,200.77,53.89Zm13,93.71A15.89,15.89,0,0,1,198.21,160H152a32,32,0,0,0-32,32,16,16,0,0,1-21.31,15.07C62.49,194.3,40,164,40,128a88,88,0,0,1,87.09-88h.9a88.35,88.35,0,0,1,88,87.25A88.86,88.86,0,0,1,213.81,147.6ZM140,76a12,12,0,1,1-12-12A12,12,0,0,1,140,76ZM96,100A12,12,0,1,1,84,88,12,12,0,0,1,96,100Zm0,56a12,12,0,1,1-12-12A12,12,0,0,1,96,156Zm88-56a12,12,0,1,1-12-12A12,12,0,0,1,184,100Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M198,56.74A99.31,99.31,0,0,0,128,28h-1A100,100,0,0,0,28,128c0,41.22,25.55,75.85,66.69,90.38a28.34,28.34,0,0,0,9.42,1.63A28,28,0,0,0,132,192a20,20,0,0,1,20-20h46.21a27.84,27.84,0,0,0,27.3-21.76,100.37,100.37,0,0,0,2.49-23.1A99.26,99.26,0,0,0,198,56.74Zm19.74,91.72A19.89,19.89,0,0,1,198.21,164H152a28,28,0,0,0-28,28,20,20,0,0,1-26.64,18.83C59.51,197.46,36,165.72,36,128a92,92,0,0,1,91.05-92H128a92,92,0,0,1,89.72,112.46ZM136,76a8,8,0,1,1-8-8A8,8,0,0,1,136,76ZM92,100a8,8,0,1,1-8-8A8,8,0,0,1,92,100Zm0,56a8,8,0,1,1-8-8A8,8,0,0,1,92,156Zm88-56a8,8,0,1,1-8-8A8,8,0,0,1,180,100Z"}))]]),O=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M116,36V20a12,12,0,0,1,24,0V36a12,12,0,0,1-24,0Zm80,92a68,68,0,1,1-68-68A68.07,68.07,0,0,1,196,128Zm-24,0a44,44,0,1,0-44,44A44.05,44.05,0,0,0,172,128ZM51.51,68.49a12,12,0,1,0,17-17l-12-12a12,12,0,0,0-17,17Zm0,119-12,12a12,12,0,0,0,17,17l12-12a12,12,0,1,0-17-17ZM196,72a12,12,0,0,0,8.49-3.51l12-12a12,12,0,0,0-17-17l-12,12A12,12,0,0,0,196,72Zm8.49,115.51a12,12,0,0,0-17,17l12,12a12,12,0,0,0,17-17ZM48,128a12,12,0,0,0-12-12H20a12,12,0,0,0,0,24H36A12,12,0,0,0,48,128Zm80,80a12,12,0,0,0-12,12v16a12,12,0,0,0,24,0V220A12,12,0,0,0,128,208Zm108-92H220a12,12,0,0,0,0,24h16a12,12,0,0,0,0-24Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M184,128a56,56,0,1,1-56-56A56,56,0,0,1,184,128Z",opacity:"0.2"}),e.createElement("path",{d:"M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm8,24a64,64,0,1,0,64,64A64.07,64.07,0,0,0,128,64ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M122,40V16a6,6,0,0,1,12,0V40a6,6,0,0,1-12,0Zm68,88a62,62,0,1,1-62-62A62.07,62.07,0,0,1,190,128Zm-12,0a50,50,0,1,0-50,50A50.06,50.06,0,0,0,178,128ZM59.76,68.24a6,6,0,1,0,8.48-8.48l-16-16a6,6,0,0,0-8.48,8.48Zm0,119.52-16,16a6,6,0,1,0,8.48,8.48l16-16a6,6,0,1,0-8.48-8.48ZM192,70a6,6,0,0,0,4.24-1.76l16-16a6,6,0,0,0-8.48-8.48l-16,16A6,6,0,0,0,192,70Zm4.24,117.76a6,6,0,0,0-8.48,8.48l16,16a6,6,0,0,0,8.48-8.48ZM46,128a6,6,0,0,0-6-6H16a6,6,0,0,0,0,12H40A6,6,0,0,0,46,128Zm82,82a6,6,0,0,0-6,6v24a6,6,0,0,0,12,0V216A6,6,0,0,0,128,210Zm112-88H216a6,6,0,0,0,0,12h24a6,6,0,0,0,0-12Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M124,40V16a4,4,0,0,1,8,0V40a4,4,0,0,1-8,0Zm64,88a60,60,0,1,1-60-60A60.07,60.07,0,0,1,188,128Zm-8,0a52,52,0,1,0-52,52A52.06,52.06,0,0,0,180,128ZM61.17,66.83a4,4,0,0,0,5.66-5.66l-16-16a4,4,0,0,0-5.66,5.66Zm0,122.34-16,16a4,4,0,0,0,5.66,5.66l16-16a4,4,0,0,0-5.66-5.66ZM192,68a4,4,0,0,0,2.83-1.17l16-16a4,4,0,1,0-5.66-5.66l-16,16A4,4,0,0,0,192,68Zm2.83,121.17a4,4,0,0,0-5.66,5.66l16,16a4,4,0,0,0,5.66-5.66ZM40,124H16a4,4,0,0,0,0,8H40a4,4,0,0,0,0-8Zm88,88a4,4,0,0,0-4,4v24a4,4,0,0,0,8,0V216A4,4,0,0,0,128,212Zm112-88H216a4,4,0,0,0,0,8h24a4,4,0,0,0,0-8Z"}))]]),x=e.forwardRef((s,r)=>e.createElement(A,{ref:r,...s,weights:L}));x.displayName="MoonIcon";const U=x,g=e.forwardRef((s,r)=>e.createElement(A,{ref:r,...s,weights:P}));g.displayName="PaletteIcon";const $=g,p=e.forwardRef((s,r)=>e.createElement(A,{ref:r,...s,weights:O}));p.displayName="SunIcon";const G=p,q="https://github.com/baealex/ocean-brain/releases",Q=s=>/^\d+\.\d+\.\d+/.test(s)?`v${s}`:s,B=["mcp-admin","status"],s0=()=>{const{theme:s,toggleTheme:r}=M(j=>j),{data:Z,isLoading:u}=N({queryKey:B,queryFn:w}),d=Z?.server,n="focus-ring-soft surface-base group flex items-start justify-between gap-3.5 px-4 py-3.5 text-left text-fg-default outline-none transition-colors hover:bg-hover-subtle",l="inline-flex h-12 w-12 shrink-0 items-center justify-center rounded-[15px] border border-border-subtle bg-muted text-fg-secondary transition-colors group-hover:border-border-secondary/70 group-hover:text-fg-default",m="h-6 w-6",h="text-fg-tertiary",i="min-w-0 flex flex-col gap-0.5 pt-0.5",f=d?Q(d.version):u?"checking…":"unknown",v=d?.releaseUrl??q;return a.jsx(y,{title:"Settings",description:"Manage display, workspace tools, and advanced connections",children:a.jsxs("div",{className:"flex flex-col gap-6",children:[a.jsxs("section",{className:"flex flex-col gap-3",children:[a.jsx(t,{as:"p",variant:"label",weight:"medium",className:h,children:"Appearance"}),a.jsxs("button",{type:"button",className:n,onClick:r,children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[a.jsx("span",{className:l,children:a.jsx($,{className:m})}),a.jsxs("div",{className:i,children:[a.jsx(t,{as:"div",variant:"body",weight:"medium",children:"Theme"}),a.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Switch between light and dark mode."})]})]}),a.jsxs("div",{className:"mt-0.5 flex shrink-0 items-center gap-2 text-fg-tertiary",children:[a.jsx(t,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:s==="dark"?"Dark":"Light"}),s==="dark"?a.jsx(U,{className:"h-4 w-4",weight:"fill"}):a.jsx(G,{className:"h-4 w-4",weight:"fill"})]})]})]}),a.jsxs("section",{className:"flex flex-col gap-3",children:[a.jsx(t,{as:"p",variant:"label",weight:"medium",className:h,children:"Workspace"}),a.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[a.jsxs(c,{to:b,search:{page:1},className:n,children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[a.jsx("span",{className:l,children:a.jsx(E,{className:m})}),a.jsxs("div",{className:i,children:[a.jsx(t,{as:"div",variant:"body",weight:"medium",children:"Properties"}),a.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Manage fields used across notes."})]})]}),a.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-hover:translate-x-0.5 group-hover:text-fg-secondary"})]}),a.jsxs(c,{to:H,search:{page:1},className:n,children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[a.jsx("span",{className:l,children:a.jsx(F,{className:m})}),a.jsxs("div",{className:i,children:[a.jsx(t,{as:"div",variant:"body",weight:"medium",children:"Placeholders"}),a.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Manage reusable template variables."})]})]}),a.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-hover:translate-x-0.5 group-hover:text-fg-secondary"})]}),a.jsxs(c,{to:S,search:{page:1},className:n,children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[a.jsx("span",{className:l,children:a.jsx(V,{className:m})}),a.jsxs("div",{className:i,children:[a.jsx(t,{as:"div",variant:"body",weight:"medium",children:"Images"}),a.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Review uploaded note images."})]})]}),a.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-hover:translate-x-0.5 group-hover:text-fg-secondary"})]}),a.jsxs(c,{to:T,search:{page:1},className:n,children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[a.jsx("span",{className:l,children:a.jsx(_,{className:m})}),a.jsxs("div",{className:i,children:[a.jsx(t,{as:"div",variant:"body",weight:"medium",children:"Trash"}),a.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Restore or permanently delete notes."})]})]}),a.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-hover:translate-x-0.5 group-hover:text-fg-secondary"})]})]})]}),a.jsxs("section",{className:"flex flex-col gap-3",children:[a.jsx(t,{as:"p",variant:"label",weight:"medium",className:h,children:"Advanced"}),a.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[a.jsxs(c,{to:C,className:n,children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[a.jsx("span",{className:l,children:a.jsx(k,{className:m})}),a.jsxs("div",{className:i,children:[a.jsx(t,{as:"div",variant:"body",weight:"medium",children:"Search"}),a.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Add meaning-based recall with an embedding API."})]})]}),a.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-hover:translate-x-0.5 group-hover:text-fg-secondary"})]}),a.jsxs(c,{to:R,className:n,children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[a.jsx("span",{className:l,children:a.jsx(I,{className:m})}),a.jsxs("div",{className:i,children:[a.jsx(t,{as:"div",variant:"body",weight:"medium",children:"MCP"}),a.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Connect Codex, Claude, or another MCP client."})]})]}),a.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-hover:translate-x-0.5 group-hover:text-fg-secondary"})]})]})]}),a.jsxs(t,{as:"p",variant:"meta",tone:"tertiary",className:"border-t border-border-subtle pt-4",children:["Ocean Brain ",f," ·"," ",a.jsx("a",{href:v,target:"_blank",rel:"noreferrer",className:"font-medium text-fg-secondary underline-offset-4 hover:underline",children:"Releases"})]})]})})};export{s0 as default};
|
|
1
|
+
import{r as e,j as a}from"./floating-ui.react-dom-BWTnA00G.js";import{a as N,h as E}from"./useNoteMutate-VJYw0Vt_.js";import{C as A,a1 as M,P as y,T as t,F as c,a2 as o}from"./time-DZKkPFUi.js";import{f as w}from"./mcp-admin-adapter-z9OaMVrl.js";import{a as b,e as H,c as S,S as T,g as C,h as R}from"./url-BvjSC8PU.js";import{d as F,f as k}from"./app-Clwvoiwx.js";import{I as V}from"./Image.es-vY-nTyOe.js";import{n as _,c as I}from"./Trash.es-prxIxo9c.js";import"./preload-helper-BXl3LOEh.js";import"./sortable.esm-DgSW3bAA.js";const L=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M236.37,139.4a12,12,0,0,0-12-3A84.07,84.07,0,0,1,119.6,31.59a12,12,0,0,0-15-15A108.86,108.86,0,0,0,49.69,55.07,108,108,0,0,0,136,228a107.09,107.09,0,0,0,64.93-21.69,108.86,108.86,0,0,0,38.44-54.94A12,12,0,0,0,236.37,139.4Zm-49.88,47.74A84,84,0,0,1,68.86,69.51,84.93,84.93,0,0,1,92.27,48.29Q92,52.13,92,56A108.12,108.12,0,0,0,200,164q3.87,0,7.71-.27A84.79,84.79,0,0,1,186.49,187.14Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M227.89,147.89A96,96,0,1,1,108.11,28.11,96.09,96.09,0,0,0,227.89,147.89Z",opacity:"0.2"}),e.createElement("path",{d:"M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M235.54,150.21a104.84,104.84,0,0,1-37,52.91A104,104,0,0,1,32,120,103.09,103.09,0,0,1,52.88,57.48a104.84,104.84,0,0,1,52.91-37,8,8,0,0,1,10,10,88.08,88.08,0,0,0,109.8,109.8,8,8,0,0,1,10,10Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M232.13,143.64a6,6,0,0,0-6-1.49A90.07,90.07,0,0,1,113.86,29.85a6,6,0,0,0-7.49-7.48A102.88,102.88,0,0,0,54.48,58.68,102,102,0,0,0,197.32,201.52a102.88,102.88,0,0,0,36.31-51.89A6,6,0,0,0,232.13,143.64Zm-42,48.29a90,90,0,0,1-126-126A90.9,90.9,0,0,1,99.65,37.66,102.06,102.06,0,0,0,218.34,156.35,90.9,90.9,0,0,1,190.1,191.93Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M230.72,145.06a4,4,0,0,0-4-1A92.08,92.08,0,0,1,111.94,29.27a4,4,0,0,0-5-5A100.78,100.78,0,0,0,56.08,59.88a100,100,0,0,0,140,140,100.78,100.78,0,0,0,35.59-50.87A4,4,0,0,0,230.72,145.06ZM191.3,193.53A92,92,0,0,1,62.47,64.7a93,93,0,0,1,39.88-30.35,100.09,100.09,0,0,0,119.3,119.3A93,93,0,0,1,191.3,193.53Z"}))]]),P=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M203.57,51A107.9,107.9,0,0,0,20,128c0,44.72,27.6,82.25,72,97.94A36,36,0,0,0,140,192a12,12,0,0,1,12-12h46.21a35.79,35.79,0,0,0,35.1-28A108.6,108.6,0,0,0,236,127.09,107.23,107.23,0,0,0,203.57,51Zm6.34,95.67a11.91,11.91,0,0,1-11.7,9.3H152a36,36,0,0,0-36,36,12,12,0,0,1-16,11.3c-16.65-5.88-30.65-15.76-40.48-28.56A76,76,0,0,1,44,128a84,84,0,0,1,83.13-84H128a84.35,84.35,0,0,1,84,83.29A84.72,84.72,0,0,1,209.91,146.71ZM144,76a16,16,0,1,1-16-16A16,16,0,0,1,144,76Zm-44,24A16,16,0,1,1,84,84,16,16,0,0,1,100,100Zm0,56a16,16,0,1,1-16-16A16,16,0,0,1,100,156Zm88-56a16,16,0,1,1-16-16A16,16,0,0,1,188,100Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M224,127.17a96.48,96.48,0,0,1-2.39,22.18A24,24,0,0,1,198.21,168H152a24,24,0,0,0-24,24,24,24,0,0,1-32,22.61C58.73,201.44,32,169.81,32,128a96,96,0,0,1,95-96C179.84,31.47,223.55,74.35,224,127.17Z",opacity:"0.2"}),e.createElement("path",{d:"M200.77,53.89A103.27,103.27,0,0,0,128,24h-1.07A104,104,0,0,0,24,128c0,43,26.58,79.06,69.36,94.17A32,32,0,0,0,136,192a16,16,0,0,1,16-16h46.21a31.81,31.81,0,0,0,31.2-24.88,104.43,104.43,0,0,0,2.59-24A103.28,103.28,0,0,0,200.77,53.89Zm13,93.71A15.89,15.89,0,0,1,198.21,160H152a32,32,0,0,0-32,32,16,16,0,0,1-21.31,15.07C62.49,194.3,40,164,40,128a88,88,0,0,1,87.09-88h.9a88.35,88.35,0,0,1,88,87.25A88.86,88.86,0,0,1,213.81,147.6ZM140,76a12,12,0,1,1-12-12A12,12,0,0,1,140,76ZM96,100A12,12,0,1,1,84,88,12,12,0,0,1,96,100Zm0,56a12,12,0,1,1-12-12A12,12,0,0,1,96,156Zm88-56a12,12,0,1,1-12-12A12,12,0,0,1,184,100Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M200.77,53.89A103.27,103.27,0,0,0,128,24h-1.07A104,104,0,0,0,24,128c0,43,26.58,79.06,69.36,94.17A32,32,0,0,0,136,192a16,16,0,0,1,16-16h46.21a31.81,31.81,0,0,0,31.2-24.88,104.43,104.43,0,0,0,2.59-24A103.28,103.28,0,0,0,200.77,53.89ZM84,168a12,12,0,1,1,12-12A12,12,0,0,1,84,168Zm0-56a12,12,0,1,1,12-12A12,12,0,0,1,84,112Zm44-24a12,12,0,1,1,12-12A12,12,0,0,1,128,88Zm44,24a12,12,0,1,1,12-12A12,12,0,0,1,172,112Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M199.37,55.31A101.32,101.32,0,0,0,128,26h-1A102,102,0,0,0,26,128c0,42.09,26.07,77.44,68,92.26A30.21,30.21,0,0,0,104.11,222,30.06,30.06,0,0,0,134,192a18,18,0,0,1,18-18h46.21a29.82,29.82,0,0,0,29.25-23.31A102.71,102.71,0,0,0,230,127.11,101.25,101.25,0,0,0,199.37,55.31ZM215.76,148a17.89,17.89,0,0,1-17.55,14H152a30,30,0,0,0-30,30,18,18,0,0,1-24,17C61,195.86,38,164.85,38,128a90,90,0,0,1,89.07-90H128a90.34,90.34,0,0,1,90,89.22A90.46,90.46,0,0,1,215.76,148ZM138,76a10,10,0,1,1-10-10A10,10,0,0,1,138,76ZM94,100A10,10,0,1,1,84,90,10,10,0,0,1,94,100Zm0,56a10,10,0,1,1-10-10A10,10,0,0,1,94,156Zm88-56a10,10,0,1,1-10-10A10,10,0,0,1,182,100Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M200.77,53.89A103.27,103.27,0,0,0,128,24h-1.07A104,104,0,0,0,24,128c0,43,26.58,79.06,69.36,94.17A32,32,0,0,0,136,192a16,16,0,0,1,16-16h46.21a31.81,31.81,0,0,0,31.2-24.88,104.43,104.43,0,0,0,2.59-24A103.28,103.28,0,0,0,200.77,53.89Zm13,93.71A15.89,15.89,0,0,1,198.21,160H152a32,32,0,0,0-32,32,16,16,0,0,1-21.31,15.07C62.49,194.3,40,164,40,128a88,88,0,0,1,87.09-88h.9a88.35,88.35,0,0,1,88,87.25A88.86,88.86,0,0,1,213.81,147.6ZM140,76a12,12,0,1,1-12-12A12,12,0,0,1,140,76ZM96,100A12,12,0,1,1,84,88,12,12,0,0,1,96,100Zm0,56a12,12,0,1,1-12-12A12,12,0,0,1,96,156Zm88-56a12,12,0,1,1-12-12A12,12,0,0,1,184,100Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M198,56.74A99.31,99.31,0,0,0,128,28h-1A100,100,0,0,0,28,128c0,41.22,25.55,75.85,66.69,90.38a28.34,28.34,0,0,0,9.42,1.63A28,28,0,0,0,132,192a20,20,0,0,1,20-20h46.21a27.84,27.84,0,0,0,27.3-21.76,100.37,100.37,0,0,0,2.49-23.1A99.26,99.26,0,0,0,198,56.74Zm19.74,91.72A19.89,19.89,0,0,1,198.21,164H152a28,28,0,0,0-28,28,20,20,0,0,1-26.64,18.83C59.51,197.46,36,165.72,36,128a92,92,0,0,1,91.05-92H128a92,92,0,0,1,89.72,112.46ZM136,76a8,8,0,1,1-8-8A8,8,0,0,1,136,76ZM92,100a8,8,0,1,1-8-8A8,8,0,0,1,92,100Zm0,56a8,8,0,1,1-8-8A8,8,0,0,1,92,156Zm88-56a8,8,0,1,1-8-8A8,8,0,0,1,180,100Z"}))]]),O=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M116,36V20a12,12,0,0,1,24,0V36a12,12,0,0,1-24,0Zm80,92a68,68,0,1,1-68-68A68.07,68.07,0,0,1,196,128Zm-24,0a44,44,0,1,0-44,44A44.05,44.05,0,0,0,172,128ZM51.51,68.49a12,12,0,1,0,17-17l-12-12a12,12,0,0,0-17,17Zm0,119-12,12a12,12,0,0,0,17,17l12-12a12,12,0,1,0-17-17ZM196,72a12,12,0,0,0,8.49-3.51l12-12a12,12,0,0,0-17-17l-12,12A12,12,0,0,0,196,72Zm8.49,115.51a12,12,0,0,0-17,17l12,12a12,12,0,0,0,17-17ZM48,128a12,12,0,0,0-12-12H20a12,12,0,0,0,0,24H36A12,12,0,0,0,48,128Zm80,80a12,12,0,0,0-12,12v16a12,12,0,0,0,24,0V220A12,12,0,0,0,128,208Zm108-92H220a12,12,0,0,0,0,24h16a12,12,0,0,0,0-24Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M184,128a56,56,0,1,1-56-56A56,56,0,0,1,184,128Z",opacity:"0.2"}),e.createElement("path",{d:"M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm8,24a64,64,0,1,0,64,64A64.07,64.07,0,0,0,128,64ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M122,40V16a6,6,0,0,1,12,0V40a6,6,0,0,1-12,0Zm68,88a62,62,0,1,1-62-62A62.07,62.07,0,0,1,190,128Zm-12,0a50,50,0,1,0-50,50A50.06,50.06,0,0,0,178,128ZM59.76,68.24a6,6,0,1,0,8.48-8.48l-16-16a6,6,0,0,0-8.48,8.48Zm0,119.52-16,16a6,6,0,1,0,8.48,8.48l16-16a6,6,0,1,0-8.48-8.48ZM192,70a6,6,0,0,0,4.24-1.76l16-16a6,6,0,0,0-8.48-8.48l-16,16A6,6,0,0,0,192,70Zm4.24,117.76a6,6,0,0,0-8.48,8.48l16,16a6,6,0,0,0,8.48-8.48ZM46,128a6,6,0,0,0-6-6H16a6,6,0,0,0,0,12H40A6,6,0,0,0,46,128Zm82,82a6,6,0,0,0-6,6v24a6,6,0,0,0,12,0V216A6,6,0,0,0,128,210Zm112-88H216a6,6,0,0,0,0,12h24a6,6,0,0,0,0-12Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M124,40V16a4,4,0,0,1,8,0V40a4,4,0,0,1-8,0Zm64,88a60,60,0,1,1-60-60A60.07,60.07,0,0,1,188,128Zm-8,0a52,52,0,1,0-52,52A52.06,52.06,0,0,0,180,128ZM61.17,66.83a4,4,0,0,0,5.66-5.66l-16-16a4,4,0,0,0-5.66,5.66Zm0,122.34-16,16a4,4,0,0,0,5.66,5.66l16-16a4,4,0,0,0-5.66-5.66ZM192,68a4,4,0,0,0,2.83-1.17l16-16a4,4,0,1,0-5.66-5.66l-16,16A4,4,0,0,0,192,68Zm2.83,121.17a4,4,0,0,0-5.66,5.66l16,16a4,4,0,0,0,5.66-5.66ZM40,124H16a4,4,0,0,0,0,8H40a4,4,0,0,0,0-8Zm88,88a4,4,0,0,0-4,4v24a4,4,0,0,0,8,0V216A4,4,0,0,0,128,212Zm112-88H216a4,4,0,0,0,0,8h24a4,4,0,0,0,0-8Z"}))]]),x=e.forwardRef((s,r)=>e.createElement(A,{ref:r,...s,weights:L}));x.displayName="MoonIcon";const U=x,g=e.forwardRef((s,r)=>e.createElement(A,{ref:r,...s,weights:P}));g.displayName="PaletteIcon";const $=g,p=e.forwardRef((s,r)=>e.createElement(A,{ref:r,...s,weights:O}));p.displayName="SunIcon";const G=p,q="https://github.com/baealex/ocean-brain/releases",Q=s=>/^\d+\.\d+\.\d+/.test(s)?`v${s}`:s,B=["mcp-admin","status"],s0=()=>{const{theme:s,toggleTheme:r}=M(j=>j),{data:Z,isLoading:u}=N({queryKey:B,queryFn:w}),d=Z?.server,n="focus-ring-soft surface-base group flex items-start justify-between gap-3.5 px-4 py-3.5 text-left text-fg-default outline-none transition-colors hover:bg-hover-subtle",l="inline-flex h-12 w-12 shrink-0 items-center justify-center rounded-[15px] border border-border-subtle bg-muted text-fg-secondary transition-colors group-hover:border-border-secondary/70 group-hover:text-fg-default",m="h-6 w-6",h="text-fg-tertiary",i="min-w-0 flex flex-col gap-0.5 pt-0.5",f=d?Q(d.version):u?"checking…":"unknown",v=d?.releaseUrl??q;return a.jsx(y,{title:"Settings",description:"Manage display, workspace tools, and advanced connections",children:a.jsxs("div",{className:"flex flex-col gap-6",children:[a.jsxs("section",{className:"flex flex-col gap-3",children:[a.jsx(t,{as:"p",variant:"label",weight:"medium",className:h,children:"Appearance"}),a.jsxs("button",{type:"button",className:n,onClick:r,children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[a.jsx("span",{className:l,children:a.jsx($,{className:m})}),a.jsxs("div",{className:i,children:[a.jsx(t,{as:"div",variant:"body",weight:"medium",children:"Theme"}),a.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Switch between light and dark mode."})]})]}),a.jsxs("div",{className:"mt-0.5 flex shrink-0 items-center gap-2 text-fg-tertiary",children:[a.jsx(t,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:s==="dark"?"Dark":"Light"}),s==="dark"?a.jsx(U,{className:"h-4 w-4",weight:"fill"}):a.jsx(G,{className:"h-4 w-4",weight:"fill"})]})]})]}),a.jsxs("section",{className:"flex flex-col gap-3",children:[a.jsx(t,{as:"p",variant:"label",weight:"medium",className:h,children:"Workspace"}),a.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[a.jsxs(c,{to:b,search:{page:1},className:n,children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[a.jsx("span",{className:l,children:a.jsx(E,{className:m})}),a.jsxs("div",{className:i,children:[a.jsx(t,{as:"div",variant:"body",weight:"medium",children:"Properties"}),a.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Manage fields used across notes."})]})]}),a.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-hover:translate-x-0.5 group-hover:text-fg-secondary"})]}),a.jsxs(c,{to:H,search:{page:1},className:n,children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[a.jsx("span",{className:l,children:a.jsx(F,{className:m})}),a.jsxs("div",{className:i,children:[a.jsx(t,{as:"div",variant:"body",weight:"medium",children:"Placeholders"}),a.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Manage reusable template variables."})]})]}),a.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-hover:translate-x-0.5 group-hover:text-fg-secondary"})]}),a.jsxs(c,{to:S,search:{page:1},className:n,children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[a.jsx("span",{className:l,children:a.jsx(V,{className:m})}),a.jsxs("div",{className:i,children:[a.jsx(t,{as:"div",variant:"body",weight:"medium",children:"Images"}),a.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Review uploaded note images."})]})]}),a.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-hover:translate-x-0.5 group-hover:text-fg-secondary"})]}),a.jsxs(c,{to:T,search:{page:1},className:n,children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[a.jsx("span",{className:l,children:a.jsx(_,{className:m})}),a.jsxs("div",{className:i,children:[a.jsx(t,{as:"div",variant:"body",weight:"medium",children:"Trash"}),a.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Restore or permanently delete notes."})]})]}),a.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-hover:translate-x-0.5 group-hover:text-fg-secondary"})]})]})]}),a.jsxs("section",{className:"flex flex-col gap-3",children:[a.jsx(t,{as:"p",variant:"label",weight:"medium",className:h,children:"Advanced"}),a.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[a.jsxs(c,{to:C,className:n,children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[a.jsx("span",{className:l,children:a.jsx(k,{className:m})}),a.jsxs("div",{className:i,children:[a.jsx(t,{as:"div",variant:"body",weight:"medium",children:"Search"}),a.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Add meaning-based recall with an embedding API."})]})]}),a.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-hover:translate-x-0.5 group-hover:text-fg-secondary"})]}),a.jsxs(c,{to:R,className:n,children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[a.jsx("span",{className:l,children:a.jsx(I,{className:m})}),a.jsxs("div",{className:i,children:[a.jsx(t,{as:"div",variant:"body",weight:"medium",children:"MCP"}),a.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Connect Codex, Claude, or another MCP client."})]})]}),a.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-hover:translate-x-0.5 group-hover:text-fg-secondary"})]})]})]}),a.jsxs(t,{as:"p",variant:"meta",tone:"tertiary",className:"border-t border-border-subtle pt-4",children:["Ocean Brain ",f," ·"," ",a.jsx("a",{href:v,target:"_blank",rel:"noreferrer",className:"font-medium text-fg-secondary underline-offset-4 hover:underline",children:"Releases"})]})]})})};export{s0 as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{C as k,T as r,N as F,F as p,O as D,R as _,Q as R,h as Z,u as q,i as y,q as h,U as B,V as O,B as b,l as c,e as z}from"./time-DZKkPFUi.js";import{u as G,b as v}from"./useNoteMutate-VJYw0Vt_.js";import{a as L,d as U}from"./image.api-Bbwmcw0T.js";import{c as K}from"./app-DbQdHfMb.js";import{I as Q,g as H}from"./image-delete-confirmation-D7xrODQV.js";import{S as x}from"./SurfaceCard-BAlcul6z.js";import{N as P,T as $,c as C,b as V}from"./url-BvjSC8PU.js";import"./NotePropertiesPanel-uO-JKy19.js";import{c as J,n as W}from"./Trash.es-prxIxo9c.js";import{I as X}from"./Image.es-vY-nTyOe.js";import"./preload-helper-BXl3LOEh.js";import"./sortable.esm-DgSW3bAA.js";import"./AuxiliaryPanelHeader-Bp3iRjm6.js";import"./Plus.es-CaRgmXc_.js";const Y=new Map([["bold",t.createElement(t.Fragment,null,t.createElement("path",{d:"M178,36c-20.09,0-37.92,7.93-50,21.56C115.92,43.93,98.09,36,78,36a66.08,66.08,0,0,0-66,66c0,72.34,105.81,130.14,110.31,132.57a12,12,0,0,0,11.38,0C138.19,232.14,244,174.34,244,102A66.08,66.08,0,0,0,178,36Zm-5.49,142.36A328.69,328.69,0,0,1,128,210.16a328.69,328.69,0,0,1-44.51-31.8C61.82,159.77,36,131.42,36,102A42,42,0,0,1,78,60c17.8,0,32.7,9.4,38.89,24.54a12,12,0,0,0,22.22,0C145.3,69.4,160.2,60,178,60a42,42,0,0,1,42,42C220,131.42,194.18,159.77,172.51,178.36Z"}))],["duotone",t.createElement(t.Fragment,null,t.createElement("path",{d:"M232,102c0,66-104,122-104,122S24,168,24,102A54,54,0,0,1,78,48c22.59,0,41.94,12.31,50,32,8.06-19.69,27.41-32,50-32A54,54,0,0,1,232,102Z",opacity:"0.2"}),t.createElement("path",{d:"M178,40c-20.65,0-38.73,8.88-50,23.89C116.73,48.88,98.65,40,78,40a62.07,62.07,0,0,0-62,62c0,70,103.79,126.66,108.21,129a8,8,0,0,0,7.58,0C136.21,228.66,240,172,240,102A62.07,62.07,0,0,0,178,40ZM128,214.8C109.74,204.16,32,155.69,32,102A46.06,46.06,0,0,1,78,56c19.45,0,35.78,10.36,42.6,27a8,8,0,0,0,14.8,0c6.82-16.67,23.15-27,42.6-27a46.06,46.06,0,0,1,46,46C224,155.61,146.24,204.15,128,214.8Z"}))],["fill",t.createElement(t.Fragment,null,t.createElement("path",{d:"M240,102c0,70-103.79,126.66-108.21,129a8,8,0,0,1-7.58,0C119.79,228.66,16,172,16,102A62.07,62.07,0,0,1,78,40c20.65,0,38.73,8.88,50,23.89C139.27,48.88,157.35,40,178,40A62.07,62.07,0,0,1,240,102Z"}))],["light",t.createElement(t.Fragment,null,t.createElement("path",{d:"M178,42c-21,0-39.26,9.47-50,25.34C117.26,51.47,99,42,78,42a60.07,60.07,0,0,0-60,60c0,29.2,18.2,59.59,54.1,90.31a334.68,334.68,0,0,0,53.06,37,6,6,0,0,0,5.68,0,334.68,334.68,0,0,0,53.06-37C219.8,161.59,238,131.2,238,102A60.07,60.07,0,0,0,178,42ZM128,217.11C111.59,207.64,30,157.72,30,102A48.05,48.05,0,0,1,78,54c20.28,0,37.31,10.83,44.45,28.27a6,6,0,0,0,11.1,0C140.69,64.83,157.72,54,178,54a48.05,48.05,0,0,1,48,48C226,157.72,144.41,207.64,128,217.11Z"}))],["regular",t.createElement(t.Fragment,null,t.createElement("path",{d:"M178,40c-20.65,0-38.73,8.88-50,23.89C116.73,48.88,98.65,40,78,40a62.07,62.07,0,0,0-62,62c0,70,103.79,126.66,108.21,129a8,8,0,0,0,7.58,0C136.21,228.66,240,172,240,102A62.07,62.07,0,0,0,178,40ZM128,214.8C109.74,204.16,32,155.69,32,102A46.06,46.06,0,0,1,78,56c19.45,0,35.78,10.36,42.6,27a8,8,0,0,0,14.8,0c6.82-16.67,23.15-27,42.6-27a46.06,46.06,0,0,1,46,46C224,155.61,146.24,204.15,128,214.8Z"}))],["thin",t.createElement(t.Fragment,null,t.createElement("path",{d:"M178,44c-21.44,0-39.92,10.19-50,27.07C117.92,54.19,99.44,44,78,44a58.07,58.07,0,0,0-58,58c0,28.59,18,58.47,53.4,88.79a333.81,333.81,0,0,0,52.7,36.73,4,4,0,0,0,3.8,0,333.81,333.81,0,0,0,52.7-36.73C218,160.47,236,130.59,236,102A58.07,58.07,0,0,0,178,44ZM128,219.42c-14-8-100-59.35-100-117.42A50.06,50.06,0,0,1,78,52c21.11,0,38.85,11.31,46.3,29.51a4,4,0,0,0,7.4,0C139.15,63.31,156.89,52,178,52a50.06,50.06,0,0,1,50,50C228,160,142,211.46,128,219.42Z"}))]]),E=t.forwardRef((a,n)=>t.createElement(k,{ref:n,...a,weights:Y}));E.displayName="HeartIcon";const ee=E;function ae({name:a}){return e.jsx(r,{as:"div",variant:"label",weight:"medium",tone:"secondary",className:"inline-flex items-center rounded-full border border-border-subtle bg-hover-subtle px-2.5 py-1",children:a})}function se({id:a,title:n,tags:i,createdAt:u,updatedAt:d}){const o=new Date(Number(u)),m=F(Number(d));return e.jsx("div",{className:"border-b-2 border-dashed border-border-subtle last:border-b-0",children:e.jsxs("div",{className:"py-4 flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(r,{variant:"label",weight:"medium",tone:"tertiary",children:m}),e.jsxs(r,{variant:"label",tone:"placeholder",children:["(",o.toDateString(),")"]})]}),e.jsx(r,{as:"div",variant:"body",weight:"bold",tracking:"tight",children:e.jsx(p,{className:"transition-colors hover:text-accent-primary",to:P,params:{id:a},children:n||"Untitled"})}),i&&i.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.map(l=>e.jsx(p,{to:$,params:{id:l.id},search:{page:1},children:e.jsx(ae,{name:l.name})},l.id))})]})})}const f=Z(V),te="mb-4 inline-flex items-center gap-1 text-fg-secondary transition-colors hover:text-fg-default",A="flex h-[248px] items-center justify-center bg-muted/25 p-3 sm:h-[352px]",re="h-full w-full rounded-[12px] object-contain",I="mb-3 flex flex-wrap items-start justify-between gap-3 border-b border-border-subtle pb-3",T="space-y-1",M="grid gap-6 min-[1200px]:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]",ne=a=>a===0?"Unused":a===1?"1 reference":`${a} references`,w=(a,n)=>typeof a=="object"&&a!==null&&"errors"in a&&Array.isArray(a.errors)&&typeof a.errors[0]?.message=="string"?a.errors[0].message:a instanceof Error&&a.message?a.message:n,ie=()=>e.jsxs("div",{className:M,children:[e.jsx("div",{className:"min-w-0",children:e.jsxs(x,{flush:!0,children:[e.jsx("div",{className:A,children:e.jsx(c,{width:"100%",height:"100%",className:"rounded-[12px]"})}),e.jsxs("div",{className:"flex flex-col gap-4 border-t border-border-subtle p-4",children:[e.jsx(c,{width:96,height:14,className:"rounded-full"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(c,{height:32,className:"flex-1 rounded-[12px]"}),e.jsx(c,{height:32,className:"flex-1 rounded-[12px]"})]})]})]})}),e.jsx("div",{className:"min-w-0",children:e.jsxs(x,{children:[e.jsxs("div",{className:I,children:[e.jsxs("div",{className:T,children:[e.jsx(c,{width:140,height:18}),e.jsx(c,{width:220,height:14,className:"rounded-full"})]}),e.jsx(c,{width:84,height:14,className:"rounded-full"})]}),e.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:3},(a,n)=>e.jsx(c,{height:72,className:"rounded-[16px]"},n))})]})})]}),le=({id:a})=>{const n=G(),i=z(),u=f.useNavigate(),d=q(),{data:o}=y({queryKey:h.images.detail(a),queryFn:async()=>{const s=await L(a);if(s.type==="error")throw s;return s.image}}),{data:m}=y({queryKey:h.images.notes(a),queryFn:async()=>{const s=await B(o.url);if(s.type==="error")throw s;return s.imageNotes}}),l=m.length,j=ne(l),g=v({mutationFn:async()=>{const s=await U(a);if(s.type==="error")throw s;if(!s.deleteImage)throw new Error("Failed to delete image");return s.deleteImage},onSuccess:async()=>{await d.invalidateQueries({queryKey:h.images.listAll(),exact:!1}),i("Image deleted"),u({to:C,search:{page:1}})},onError:s=>{i(w(s,"Failed to delete image"))}}),N=v({mutationFn:async()=>{const s=await K("heroBanner",o.url);if(s.type==="error")throw s},onSuccess:async()=>{await d.invalidateQueries({queryKey:h.ui.heroBanner(),exact:!0}),i("Hero banner updated")},onError:s=>{i(w(s,"Failed to update hero banner"))}}),S=async()=>{g.isPending||await n(H(l))&&g.mutate()};return e.jsxs("div",{className:M,children:[e.jsx("div",{className:"min-w-0",children:e.jsxs(x,{flush:!0,children:[e.jsx("a",{href:o.url,target:"_blank",rel:"noreferrer","aria-label":"Open original image",className:"focus-ring-soft block overflow-hidden rounded-t-[18px] outline-none",children:e.jsx("div",{className:A,children:e.jsx(Q,{className:`${re} transition-transform duration-200 hover:scale-[1.02]`,src:o.url,alt:`Image ${o.id}`})})}),e.jsxs("div",{className:"flex flex-col gap-4 border-t border-border-subtle p-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(J,{size:14,className:"text-fg-tertiary"}),e.jsx(r,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:j})]}),e.jsx(r,{as:"p",variant:"meta",tone:"tertiary",children:l>0?"Deleting this image will break it in the referenced notes":"No notes currently reference this image"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(O,{content:"Delete this image",side:"bottom",children:e.jsxs(b,{variant:"soft-danger",size:"sm",className:"flex-1",isLoading:g.isPending,onClick:S,children:[e.jsx(W,{size:16}),"Delete"]})}),e.jsxs(b,{variant:"primary",size:"sm",className:"flex-1",isLoading:N.isPending,onClick:()=>N.mutate(),children:[e.jsx(ee,{size:16}),"Set hero banner"]})]})]})]})}),e.jsx("div",{className:"min-w-0",children:e.jsxs(x,{children:[e.jsxs("div",{className:I,children:[e.jsxs("div",{className:T,children:[e.jsx(r,{as:"h2",variant:"subheading",weight:"medium",tracking:"tight",children:"Referenced Notes"}),e.jsx(r,{as:"p",variant:"meta",tone:"secondary",children:"Notes currently using this image"})]}),e.jsx(r,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:j})]}),l>0?e.jsx("ul",{className:"flex flex-col",children:m.map(s=>e.jsx("li",{children:e.jsx(se,{...s})},s.id))}):e.jsxs("div",{className:"flex items-start gap-3 py-1",children:[e.jsx("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-[10px] bg-muted/25 text-fg-disabled",children:e.jsx(X,{size:18})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(r,{as:"p",variant:"body",weight:"medium",tone:"secondary",children:"No notes reference this image"}),e.jsx(r,{as:"p",variant:"meta",tone:"secondary",children:"This image can be deleted or reused in another note"})]})]})]})})]})},we=()=>{const{id:a}=f.useParams(),{page:n}=f.useSearch();return e.jsxs("div",{className:"w-full",children:[e.jsx(D,{children:e.jsx("title",{children:"Image Detail | Ocean Brain"})}),e.jsxs(p,{to:C,search:{page:n},className:te,children:[e.jsx(_,{size:16}),e.jsx(r,{as:"span",variant:"meta",weight:"medium",className:"text-current",children:"Back to Images"})]}),e.jsx(r,{as:"h1",variant:"heading",weight:"bold",tracking:"tighter",className:"sr-only",children:"Image Detail"}),e.jsx(R,{fallback:e.jsx(ie,{}),errorTitle:"Failed to load image detail",errorDescription:"Retry loading the image preview and its referenced notes",resetKeys:[a],children:e.jsx(le,{id:a})})]})};export{we as default};
|
|
1
|
+
import{r as t,j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{C as k,T as r,N as F,F as p,O as D,R as _,Q as R,h as Z,u as q,i as y,q as h,U as B,V as O,B as b,l as c,e as z}from"./time-DZKkPFUi.js";import{u as G,b as v}from"./useNoteMutate-VJYw0Vt_.js";import{a as L,d as U}from"./image.api-Bbwmcw0T.js";import{c as K}from"./app-Clwvoiwx.js";import{I as Q,g as H}from"./image-delete-confirmation-D7xrODQV.js";import{S as x}from"./SurfaceCard-BAlcul6z.js";import{N as P,T as $,c as C,b as V}from"./url-BvjSC8PU.js";import"./NotePropertiesPanel-uO-JKy19.js";import{c as J,n as W}from"./Trash.es-prxIxo9c.js";import{I as X}from"./Image.es-vY-nTyOe.js";import"./preload-helper-BXl3LOEh.js";import"./sortable.esm-DgSW3bAA.js";import"./AuxiliaryPanelHeader-Bp3iRjm6.js";import"./Plus.es-CaRgmXc_.js";const Y=new Map([["bold",t.createElement(t.Fragment,null,t.createElement("path",{d:"M178,36c-20.09,0-37.92,7.93-50,21.56C115.92,43.93,98.09,36,78,36a66.08,66.08,0,0,0-66,66c0,72.34,105.81,130.14,110.31,132.57a12,12,0,0,0,11.38,0C138.19,232.14,244,174.34,244,102A66.08,66.08,0,0,0,178,36Zm-5.49,142.36A328.69,328.69,0,0,1,128,210.16a328.69,328.69,0,0,1-44.51-31.8C61.82,159.77,36,131.42,36,102A42,42,0,0,1,78,60c17.8,0,32.7,9.4,38.89,24.54a12,12,0,0,0,22.22,0C145.3,69.4,160.2,60,178,60a42,42,0,0,1,42,42C220,131.42,194.18,159.77,172.51,178.36Z"}))],["duotone",t.createElement(t.Fragment,null,t.createElement("path",{d:"M232,102c0,66-104,122-104,122S24,168,24,102A54,54,0,0,1,78,48c22.59,0,41.94,12.31,50,32,8.06-19.69,27.41-32,50-32A54,54,0,0,1,232,102Z",opacity:"0.2"}),t.createElement("path",{d:"M178,40c-20.65,0-38.73,8.88-50,23.89C116.73,48.88,98.65,40,78,40a62.07,62.07,0,0,0-62,62c0,70,103.79,126.66,108.21,129a8,8,0,0,0,7.58,0C136.21,228.66,240,172,240,102A62.07,62.07,0,0,0,178,40ZM128,214.8C109.74,204.16,32,155.69,32,102A46.06,46.06,0,0,1,78,56c19.45,0,35.78,10.36,42.6,27a8,8,0,0,0,14.8,0c6.82-16.67,23.15-27,42.6-27a46.06,46.06,0,0,1,46,46C224,155.61,146.24,204.15,128,214.8Z"}))],["fill",t.createElement(t.Fragment,null,t.createElement("path",{d:"M240,102c0,70-103.79,126.66-108.21,129a8,8,0,0,1-7.58,0C119.79,228.66,16,172,16,102A62.07,62.07,0,0,1,78,40c20.65,0,38.73,8.88,50,23.89C139.27,48.88,157.35,40,178,40A62.07,62.07,0,0,1,240,102Z"}))],["light",t.createElement(t.Fragment,null,t.createElement("path",{d:"M178,42c-21,0-39.26,9.47-50,25.34C117.26,51.47,99,42,78,42a60.07,60.07,0,0,0-60,60c0,29.2,18.2,59.59,54.1,90.31a334.68,334.68,0,0,0,53.06,37,6,6,0,0,0,5.68,0,334.68,334.68,0,0,0,53.06-37C219.8,161.59,238,131.2,238,102A60.07,60.07,0,0,0,178,42ZM128,217.11C111.59,207.64,30,157.72,30,102A48.05,48.05,0,0,1,78,54c20.28,0,37.31,10.83,44.45,28.27a6,6,0,0,0,11.1,0C140.69,64.83,157.72,54,178,54a48.05,48.05,0,0,1,48,48C226,157.72,144.41,207.64,128,217.11Z"}))],["regular",t.createElement(t.Fragment,null,t.createElement("path",{d:"M178,40c-20.65,0-38.73,8.88-50,23.89C116.73,48.88,98.65,40,78,40a62.07,62.07,0,0,0-62,62c0,70,103.79,126.66,108.21,129a8,8,0,0,0,7.58,0C136.21,228.66,240,172,240,102A62.07,62.07,0,0,0,178,40ZM128,214.8C109.74,204.16,32,155.69,32,102A46.06,46.06,0,0,1,78,56c19.45,0,35.78,10.36,42.6,27a8,8,0,0,0,14.8,0c6.82-16.67,23.15-27,42.6-27a46.06,46.06,0,0,1,46,46C224,155.61,146.24,204.15,128,214.8Z"}))],["thin",t.createElement(t.Fragment,null,t.createElement("path",{d:"M178,44c-21.44,0-39.92,10.19-50,27.07C117.92,54.19,99.44,44,78,44a58.07,58.07,0,0,0-58,58c0,28.59,18,58.47,53.4,88.79a333.81,333.81,0,0,0,52.7,36.73,4,4,0,0,0,3.8,0,333.81,333.81,0,0,0,52.7-36.73C218,160.47,236,130.59,236,102A58.07,58.07,0,0,0,178,44ZM128,219.42c-14-8-100-59.35-100-117.42A50.06,50.06,0,0,1,78,52c21.11,0,38.85,11.31,46.3,29.51a4,4,0,0,0,7.4,0C139.15,63.31,156.89,52,178,52a50.06,50.06,0,0,1,50,50C228,160,142,211.46,128,219.42Z"}))]]),E=t.forwardRef((a,n)=>t.createElement(k,{ref:n,...a,weights:Y}));E.displayName="HeartIcon";const ee=E;function ae({name:a}){return e.jsx(r,{as:"div",variant:"label",weight:"medium",tone:"secondary",className:"inline-flex items-center rounded-full border border-border-subtle bg-hover-subtle px-2.5 py-1",children:a})}function se({id:a,title:n,tags:i,createdAt:u,updatedAt:d}){const o=new Date(Number(u)),m=F(Number(d));return e.jsx("div",{className:"border-b-2 border-dashed border-border-subtle last:border-b-0",children:e.jsxs("div",{className:"py-4 flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(r,{variant:"label",weight:"medium",tone:"tertiary",children:m}),e.jsxs(r,{variant:"label",tone:"placeholder",children:["(",o.toDateString(),")"]})]}),e.jsx(r,{as:"div",variant:"body",weight:"bold",tracking:"tight",children:e.jsx(p,{className:"transition-colors hover:text-accent-primary",to:P,params:{id:a},children:n||"Untitled"})}),i&&i.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.map(l=>e.jsx(p,{to:$,params:{id:l.id},search:{page:1},children:e.jsx(ae,{name:l.name})},l.id))})]})})}const f=Z(V),te="mb-4 inline-flex items-center gap-1 text-fg-secondary transition-colors hover:text-fg-default",A="flex h-[248px] items-center justify-center bg-muted/25 p-3 sm:h-[352px]",re="h-full w-full rounded-[12px] object-contain",I="mb-3 flex flex-wrap items-start justify-between gap-3 border-b border-border-subtle pb-3",T="space-y-1",M="grid gap-6 min-[1200px]:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]",ne=a=>a===0?"Unused":a===1?"1 reference":`${a} references`,w=(a,n)=>typeof a=="object"&&a!==null&&"errors"in a&&Array.isArray(a.errors)&&typeof a.errors[0]?.message=="string"?a.errors[0].message:a instanceof Error&&a.message?a.message:n,ie=()=>e.jsxs("div",{className:M,children:[e.jsx("div",{className:"min-w-0",children:e.jsxs(x,{flush:!0,children:[e.jsx("div",{className:A,children:e.jsx(c,{width:"100%",height:"100%",className:"rounded-[12px]"})}),e.jsxs("div",{className:"flex flex-col gap-4 border-t border-border-subtle p-4",children:[e.jsx(c,{width:96,height:14,className:"rounded-full"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(c,{height:32,className:"flex-1 rounded-[12px]"}),e.jsx(c,{height:32,className:"flex-1 rounded-[12px]"})]})]})]})}),e.jsx("div",{className:"min-w-0",children:e.jsxs(x,{children:[e.jsxs("div",{className:I,children:[e.jsxs("div",{className:T,children:[e.jsx(c,{width:140,height:18}),e.jsx(c,{width:220,height:14,className:"rounded-full"})]}),e.jsx(c,{width:84,height:14,className:"rounded-full"})]}),e.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:3},(a,n)=>e.jsx(c,{height:72,className:"rounded-[16px]"},n))})]})})]}),le=({id:a})=>{const n=G(),i=z(),u=f.useNavigate(),d=q(),{data:o}=y({queryKey:h.images.detail(a),queryFn:async()=>{const s=await L(a);if(s.type==="error")throw s;return s.image}}),{data:m}=y({queryKey:h.images.notes(a),queryFn:async()=>{const s=await B(o.url);if(s.type==="error")throw s;return s.imageNotes}}),l=m.length,j=ne(l),g=v({mutationFn:async()=>{const s=await U(a);if(s.type==="error")throw s;if(!s.deleteImage)throw new Error("Failed to delete image");return s.deleteImage},onSuccess:async()=>{await d.invalidateQueries({queryKey:h.images.listAll(),exact:!1}),i("Image deleted"),u({to:C,search:{page:1}})},onError:s=>{i(w(s,"Failed to delete image"))}}),N=v({mutationFn:async()=>{const s=await K("heroBanner",o.url);if(s.type==="error")throw s},onSuccess:async()=>{await d.invalidateQueries({queryKey:h.ui.heroBanner(),exact:!0}),i("Hero banner updated")},onError:s=>{i(w(s,"Failed to update hero banner"))}}),S=async()=>{g.isPending||await n(H(l))&&g.mutate()};return e.jsxs("div",{className:M,children:[e.jsx("div",{className:"min-w-0",children:e.jsxs(x,{flush:!0,children:[e.jsx("a",{href:o.url,target:"_blank",rel:"noreferrer","aria-label":"Open original image",className:"focus-ring-soft block overflow-hidden rounded-t-[18px] outline-none",children:e.jsx("div",{className:A,children:e.jsx(Q,{className:`${re} transition-transform duration-200 hover:scale-[1.02]`,src:o.url,alt:`Image ${o.id}`})})}),e.jsxs("div",{className:"flex flex-col gap-4 border-t border-border-subtle p-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(J,{size:14,className:"text-fg-tertiary"}),e.jsx(r,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:j})]}),e.jsx(r,{as:"p",variant:"meta",tone:"tertiary",children:l>0?"Deleting this image will break it in the referenced notes":"No notes currently reference this image"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(O,{content:"Delete this image",side:"bottom",children:e.jsxs(b,{variant:"soft-danger",size:"sm",className:"flex-1",isLoading:g.isPending,onClick:S,children:[e.jsx(W,{size:16}),"Delete"]})}),e.jsxs(b,{variant:"primary",size:"sm",className:"flex-1",isLoading:N.isPending,onClick:()=>N.mutate(),children:[e.jsx(ee,{size:16}),"Set hero banner"]})]})]})]})}),e.jsx("div",{className:"min-w-0",children:e.jsxs(x,{children:[e.jsxs("div",{className:I,children:[e.jsxs("div",{className:T,children:[e.jsx(r,{as:"h2",variant:"subheading",weight:"medium",tracking:"tight",children:"Referenced Notes"}),e.jsx(r,{as:"p",variant:"meta",tone:"secondary",children:"Notes currently using this image"})]}),e.jsx(r,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:j})]}),l>0?e.jsx("ul",{className:"flex flex-col",children:m.map(s=>e.jsx("li",{children:e.jsx(se,{...s})},s.id))}):e.jsxs("div",{className:"flex items-start gap-3 py-1",children:[e.jsx("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-[10px] bg-muted/25 text-fg-disabled",children:e.jsx(X,{size:18})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(r,{as:"p",variant:"body",weight:"medium",tone:"secondary",children:"No notes reference this image"}),e.jsx(r,{as:"p",variant:"meta",tone:"secondary",children:"This image can be deleted or reused in another note"})]})]})]})})]})},we=()=>{const{id:a}=f.useParams(),{page:n}=f.useSearch();return e.jsxs("div",{className:"w-full",children:[e.jsx(D,{children:e.jsx("title",{children:"Image Detail | Ocean Brain"})}),e.jsxs(p,{to:C,search:{page:n},className:te,children:[e.jsx(_,{size:16}),e.jsx(r,{as:"span",variant:"meta",weight:"medium",className:"text-current",children:"Back to Images"})]}),e.jsx(r,{as:"h1",variant:"heading",weight:"bold",tracking:"tighter",className:"sr-only",children:"Image Detail"}),e.jsx(R,{fallback:e.jsx(ie,{}),errorTitle:"Failed to load image detail",errorDescription:"Retry loading the image preview and its referenced notes",resetKeys:[a],children:e.jsx(le,{id:a})})]})};export{we as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as a,j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{g as J,a as V,b as M,P as v,e as j,M as W}from"./useNoteMutate-VJYw0Vt_.js";import{C as ee,g as P,u as ae,q as N,P as te,T as s,s as se,B as C,G as le,M as m,L as b,I as w,k as ne,l as $,h as re,e as ce}from"./time-DZKkPFUi.js";import{F as ie}from"./app-
|
|
1
|
+
import{r as a,j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{g as J,a as V,b as M,P as v,e as j,M as W}from"./useNoteMutate-VJYw0Vt_.js";import{C as ee,g as P,u as ae,q as N,P as te,T as s,s as se,B as C,G as le,M as m,L as b,I as w,k as ne,l as $,h as re,e as ce}from"./time-DZKkPFUi.js";import{F as ie}from"./app-Clwvoiwx.js";import{S as D}from"./SurfaceCard-BAlcul6z.js";import{e as oe}from"./url-BvjSC8PU.js";import{n as de}from"./Plus.es-CaRgmXc_.js";import"./preload-helper-BXl3LOEh.js";import"./sortable.esm-DgSW3bAA.js";const me=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M208,160H48l80-80Z",opacity:"0.2"}),a.createElement("path",{d:"M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z"}))]]),k=a.forwardRef((l,c)=>a.createElement(ee,{ref:c,...l,weights:me}));k.displayName="CaretUpIcon";const he=k,O=["id","name","template","replacement","createdAt","updatedAt"],pe=new Set(O),ue=`query FetchPlaceholders(
|
|
2
2
|
$searchFilter: SearchFilterInput,
|
|
3
3
|
$pagination: PaginationInput
|
|
4
4
|
) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{a as ve,b as E}from"./useNoteMutate-VJYw0Vt_.js";import{C as je,u as Ne,P as we,T as n,L as A,I as R,B as N,y as Ce,z as ke,s as ee,d as Ae,S as Se,H as Ie,q as Ee,e as Me,f as Pe}from"./time-DZKkPFUi.js";import{f as Le,s as Fe,a as qe,t as Ke,b as Be}from"./search-admin-adapter-BLMYNm9w.js";import{f as Ue}from"./app-DbQdHfMb.js";import{s as T}from"./CheckCircle.es-BTloiuti.js";import"./url-BvjSC8PU.js";import"./preload-helper-BXl3LOEh.js";import"./sortable.esm-DgSW3bAA.js";const Re=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M244,56v48a12,12,0,0,1-12,12H184a12,12,0,1,1,0-24H201.1l-19-17.38c-.13-.12-.26-.24-.38-.37A76,76,0,1,0,127,204h1a75.53,75.53,0,0,0,52.15-20.72,12,12,0,0,1,16.49,17.45A99.45,99.45,0,0,1,128,228h-1.37A100,100,0,1,1,198.51,57.06L220,76.72V56a12,12,0,0,1,24,0Z"}))],["duotone",r.createElement(r.Fragment,null,r.createElement("path",{d:"M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z",opacity:"0.2"}),r.createElement("path",{d:"M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z"}))],["fill",r.createElement(r.Fragment,null,r.createElement("path",{d:"M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1-5.66-13.66l17-17-10.55-9.65-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,1,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60l10.93,10L226.34,50.3A8,8,0,0,1,240,56Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M238,56v48a6,6,0,0,1-6,6H184a6,6,0,0,1,0-12h32.55l-30.38-27.8c-.06-.06-.12-.13-.19-.19a82,82,0,1,0-1.7,117.65,6,6,0,0,1,8.24,8.73A93.46,93.46,0,0,1,128,222h-1.28A94,94,0,1,1,194.37,61.4L226,90.35V56a6,6,0,1,1,12,0Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M236,56v48a4,4,0,0,1-4,4H184a4,4,0,0,1,0-8h37.7L187.53,68.69l-.13-.12a84,84,0,1,0-1.75,120.51,4,4,0,0,1,5.5,5.82A91.43,91.43,0,0,1,128,220h-1.26A92,92,0,1,1,193,62.84l35,32.05V56a4,4,0,1,1,8,0Z"}))]]),ae=r.forwardRef((t,i)=>r.createElement(je,{ref:i,...t,weights:Re}));ae.displayName="ArrowClockwiseIcon";const Te=ae,He={enabled:!1,baseUrl:"",model:"",queryInstruction:""},De={disabled:"Meaning search off","needs-connection":"Connection test needed","needs-index":"Index needed",indexing:"Building index",ready:"Meaning search ready",error:"Index error"},$e=(t,i)=>t.enabled===i.enabled&&t.baseUrl===i.baseUrl&&t.model===i.model&&t.queryInstruction===i.queryInstruction,w=t=>{const i=t.trim();let o=i.length;for(;o>0&&i.charCodeAt(o-1)===47;)o-=1;return o===i.length?i:i.slice(0,o)},Ve=t=>/(^|[-_/])(embed|embedding|bge|e5|gte)([-_/.]|$)/i.test(t),ze=t=>{try{const i=new URL(t),o=i.hostname.toLowerCase(),d=o==="localhost"||o==="::1"||o==="[::1]"||o.startsWith("127.");return i.protocol==="http:"&&!d}catch{return!1}},Qe=({hasConnectionFields:t,enabled:i,savedConnectionValidated:o,dirty:d,phase:g,available:m})=>t?i?d?"Save this setting. You can test the model before or after saving.":g==="needs-connection"?"Test the selected model to make meaning search available.":m?"Meaning search is active.":"Build the local index to activate meaning search.":o?"Your saved connection is ready to turn on again.":"You can save this provider now and test it when you are ready.":"Connect an API and choose a model first.",C=(t,i)=>Pe.isAxiosError(t)?t.response?.data?.message??t.message??i:t instanceof Error?t.message:i,Ze=t=>{if(!t)return"Not built yet";const i=new Date(t);return Number.isNaN(i.getTime())?t:i.toLocaleString()},na=()=>{const t=Me(),i=Ne(),o=Ee.search.adminStatus(),[d,g]=r.useState(He),[m,se]=r.useState(!1),[y,H]=r.useState([]),[ne,D]=r.useState(""),[te,$]=r.useState(""),[M,P]=r.useState(""),[f,L]=r.useState(!1),[re,V]=r.useState(0),F=a=>{const l=M.trim();return l?{...a,apiKey:l}:f?{...a,apiKey:null}:a},{data:s,error:z,isLoading:ie}=ve({queryKey:o,queryFn:Le,refetchInterval:a=>a.state.data?.phase==="indexing"||(a.state.data?.pendingNoteCount??0)>0?1e3:!1});r.useEffect(()=>{s&&!m&&(g(s.config),se(!0))},[m,s]);const Q=E({mutationFn:Fe,onSuccess:a=>{i.setQueryData(o,a),g(a.config),P(""),L(!1),t("Search settings saved.")},onError:a=>{t(C(a,"Failed to save search settings."))}}),p=E({mutationFn:qe,onSuccess:({models:a},l)=>{const h=w(l.baseUrl);H(a),D(h),g(j=>{if(w(j.baseUrl)!==h||a.some(U=>U.id===j.model))return j;const J=a.filter(U=>U.likelyEmbedding),X=J.length===1?J[0]:a.length===1?a[0]:null;return X?{...j,model:X.id}:j})}}),u=E({mutationFn:({input:a})=>Ke(a),onSuccess:async({dimensions:a,model:l},{connectionKey:h})=>{$(h),t(`Connected to ${l} (${a} dimensions).`),await i.invalidateQueries({queryKey:o})},onError:a=>{t(C(a,"Could not connect to the embedding API."))}}),Z=E({mutationFn:Be,onSuccess:({started:a,status:l})=>{i.setQueryData(o,l),t(a?"Search index build started.":l.needsReindex?"Search index is already updating.":"Search index is already up to date.")},onError:a=>{t(C(a,"Could not start the search index build."))}}),b=w(d.baseUrl),O=`${b}::${d.model.trim()}::${re}`,Y=!!(M.trim()||f),S=!!(s&&(!$e(d,s.config)||Y)),c=s?.phase==="indexing",x=p.isPending||u.isPending,k=!!(b&&d.model.trim()),_=!!y.length&&ne===b,de=k&&te===O,le=!!(!!(k&&s&&w(s.config.baseUrl)===b&&s.config.model.trim()===d.model.trim())&&s?.connectionValidated&&!Y),q=k,oe=!!(m&&S&&!c&&!x&&(!d.enabled||q)),ce=!!(s?.config.enabled&&s.needsReindex&&!S&&!c),me=ze(b),v=s?.progress,he=s?De[s.phase]:ie?"Loading":"Unavailable",ue=d.queryInstruction.trim()?"Customized":"Optional",xe=Qe({hasConnectionFields:k,enabled:d.enabled,savedConnectionValidated:le,dirty:S,phase:s?.phase,available:s?.available}),W=r.useMemo(()=>{const a=[...y],l=d.model.trim();return l&&!a.some(h=>h.id===l)&&a.unshift({id:l,likelyEmbedding:Ve(l)}),a},[y,d.model]),I=(a,l)=>{g(h=>({...h,[a]:l}))},K=()=>{$(""),u.reset()},B=()=>{H([]),D(""),K(),p.reset()},ge=a=>{const l=b!==w(a);g(h=>({...h,baseUrl:a,model:l?"":h.model})),l&&B()},pe=a=>{P(a),L(!1),V(l=>l+1),B()},be=()=>{P(""),L(a=>!a),V(a=>a+1),B()},ye=()=>{const a=w(d.baseUrl);g(l=>({...l,baseUrl:a})),K(),p.mutate(F({baseUrl:a}))},G=a=>{I("model",a),K()},fe=a=>{(!a||q)&&I("enabled",a)};return e.jsx(we,{title:"Search",variant:"default",description:"Keyword search is always available. Add an embedding API only when you want meaning-based recall.",headerRight:e.jsx(n,{as:"span",variant:"meta",weight:"medium",tone:s?.phase==="error"?"error":"secondary",className:"rounded-full border border-border-subtle bg-muted px-3 py-1.5",children:he}),children:e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("section",{className:"surface-base flex flex-col gap-4 p-4","aria-labelledby":"embedding-api-heading",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-muted text-sm font-semibold text-fg-secondary",children:"1"}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx(n,{id:"embedding-api-heading",as:"h2",variant:"label",weight:"medium",children:"Connect an embedding API"}),e.jsx(n,{as:"p",variant:"meta",tone:"secondary",className:"leading-relaxed",children:"Enter an OpenAI-compatible API URL and an API key when the provider requires one."})]})]}),e.jsxs("div",{className:"ml-0 space-y-2 sm:ml-10",children:[e.jsx(A,{htmlFor:"semantic-search-base-url",className:"font-medium text-fg-tertiary",children:"API base URL"}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(R,{id:"semantic-search-base-url",inputMode:"url",placeholder:"http://127.0.0.1:1234/v1",value:d.baseUrl,disabled:!m||c||x,onChange:a=>ge(a.target.value),className:"w-full min-w-0 sm:flex-1"}),e.jsxs(N,{type:"button",variant:"subtle",onClick:ye,isLoading:p.isPending,disabled:!b||c||u.isPending,className:"w-full sm:w-auto",children:[e.jsx(Ue,{className:"h-4 w-4"}),"Find models"]})]}),me&&e.jsx("div",{className:"rounded-[12px] border border-border-secondary/70 bg-muted px-3 py-2.5",children:e.jsx(n,{as:"p",variant:"meta",tone:"secondary",className:"leading-relaxed",children:"This provider uses unencrypted HTTP. API credentials and note text can be read on the network."})}),e.jsxs("div",{className:"space-y-2 pt-1",children:[e.jsxs(A,{htmlFor:"semantic-search-api-key",className:"font-medium text-fg-tertiary",children:["API key ",e.jsx("span",{className:"font-normal text-fg-tertiary",children:"(optional)"})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(R,{id:"semantic-search-api-key",type:"password",autoComplete:"new-password",placeholder:f?"No API key":s?.apiKeyConfigured?"Saved API key":"Enter API key",value:M,disabled:!m||c||x||f,onChange:a=>pe(a.target.value),className:"w-full min-w-0 sm:flex-1"}),s?.apiKeyConfigured&&e.jsx(N,{type:"button",variant:"subtle",onClick:be,disabled:c||x,className:"w-full sm:w-auto",children:f?"Keep saved key":"Remove saved key"})]}),f&&e.jsx(n,{as:"p",variant:"meta",tone:"tertiary",children:"The saved key will be removed when you save."})]}),_&&e.jsxs("div",{className:"flex items-start gap-2 rounded-[12px] border border-border-subtle bg-accent-soft-success px-3 py-2.5",role:"status",children:[e.jsx(T,{className:"mt-0.5 h-4 w-4 shrink-0 text-accent-success"}),e.jsxs(n,{as:"p",variant:"meta",className:"leading-relaxed text-accent-success",children:["API connected. Found ",y.length," ",y.length===1?"model":"models","."]})]}),p.isError&&e.jsx("div",{className:"rounded-[12px] border border-border-error bg-accent-soft-danger/40 px-3 py-2.5",children:e.jsx(n,{as:"p",variant:"meta",tone:"error",className:"leading-relaxed",children:C(p.error,"Could not list models from this API.")})})]})]}),e.jsxs("section",{className:"surface-base flex flex-col gap-4 p-4","aria-labelledby":"embedding-model-heading",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-muted text-sm font-semibold text-fg-secondary",children:"2"}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx(n,{id:"embedding-model-heading",as:"h2",variant:"label",weight:"medium",children:"Choose and test a model"}),e.jsx(n,{as:"p",variant:"meta",tone:"secondary",className:"leading-relaxed",children:"Choose an embedding model and verify the connection."})]})]}),e.jsxs("div",{className:"ml-0 space-y-3 sm:ml-10",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{htmlFor:"semantic-search-model",className:"font-medium text-fg-tertiary",children:"Embedding model"}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(Ce,{id:"semantic-search-model",ariaLabel:"Embedding model",value:d.model,placeholder:p.isPending?"Loading models…":"Find models first",disabled:!W.length||!m||c||x,onValueChange:G,className:"w-full min-w-0 sm:flex-1",children:W.map(a=>e.jsxs(ke,{value:a.id,children:[a.id,a.likelyEmbedding?" · Embedding":""]},a.id))}),e.jsxs(N,{type:"button",variant:"subtle",onClick:()=>u.mutate({input:F(d),connectionKey:O}),isLoading:u.isPending,disabled:!k||c||p.isPending,className:"w-full sm:w-auto",children:[e.jsx(T,{className:"h-4 w-4"}),"Test selected model"]})]}),_&&y.every(a=>!a.likelyEmbedding)&&e.jsx(n,{as:"p",variant:"meta",tone:"tertiary",className:"leading-relaxed",children:"None of these model names clearly identifies an embedding model. Choose one only if your provider documents it as an embedding model, then run the test."})]}),de&&u.data&&e.jsxs("div",{className:"flex items-start gap-2 rounded-[12px] border border-border-subtle bg-accent-soft-success px-3 py-2.5",role:"status",children:[e.jsx(T,{className:"mt-0.5 h-4 w-4 shrink-0 text-accent-success"}),e.jsxs(n,{as:"p",variant:"meta",className:"leading-relaxed text-accent-success",children:["This model works · ",u.data.dimensions," dimensions"]})]}),u.isError&&e.jsx("div",{className:"rounded-[12px] border border-border-error bg-accent-soft-danger/40 px-3 py-2.5",children:e.jsx(n,{as:"p",variant:"meta",tone:"error",className:"leading-relaxed",children:C(u.error,"Could not connect to the embedding API.")})}),e.jsxs("details",{className:"group rounded-[12px] border border-border-subtle bg-muted",children:[e.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-3 px-3 py-2.5 marker:hidden",children:[e.jsx(n,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:"Can't find the model? Enter its ID manually"}),e.jsx(ee,{className:"h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-open:rotate-180","aria-hidden":"true"})]}),e.jsxs("div",{className:"space-y-2 border-t border-border-subtle px-3 py-3",children:[e.jsx(A,{htmlFor:"semantic-search-manual-model",className:"font-medium text-fg-tertiary",children:"Model ID"}),e.jsx(R,{id:"semantic-search-manual-model",placeholder:"text-embedding-qwen3-embedding-0.6b",value:d.model,disabled:!m||c||x,onChange:a=>G(a.target.value)}),e.jsx(n,{as:"p",variant:"meta",tone:"tertiary",children:"Use this fallback when a compatible API does not support model listing."})]})]}),e.jsxs("details",{className:"group rounded-[12px] border border-border-subtle bg-muted",children:[e.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-3 px-3 py-2.5 marker:hidden",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(n,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:"Advanced query instruction"}),e.jsxs(n,{as:"span",variant:"meta",tone:"tertiary",children:[" · ",ue]})]}),e.jsx(ee,{className:"h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-open:rotate-180","aria-hidden":"true"})]}),e.jsxs("div",{className:"space-y-3 border-t border-border-subtle px-3 py-3",children:[e.jsx(n,{as:"p",variant:"meta",tone:"secondary",className:"leading-relaxed",children:"Leave this blank unless your embedding model documentation explicitly recommends a query instruction. Ocean Brain does not assume a language or retrieval prompt."}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{htmlFor:"semantic-search-instruction",className:"font-medium text-fg-tertiary",children:"Query instruction"}),e.jsx(Ae,{id:"semantic-search-instruction",rows:3,placeholder:"Leave blank unless your model recommends an instruction.",value:d.queryInstruction,disabled:!m||c||x,onChange:a=>I("queryInstruction",a.target.value)})]}),d.queryInstruction&&e.jsx("div",{className:"flex flex-wrap gap-2",children:e.jsx(N,{type:"button",size:"sm",variant:"ghost",disabled:c||x,onClick:()=>I("queryInstruction",""),children:"Clear"})}),e.jsx(n,{as:"p",variant:"meta",tone:"tertiary",className:"leading-relaxed",children:"This is added only to the search query, never to note chunks. Changing it does not require rebuilding the index."})]})]})]})]}),e.jsxs("section",{className:"surface-base flex flex-col gap-4 p-4","aria-labelledby":"meaning-search-heading",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-muted text-sm font-semibold text-fg-secondary",children:"3"}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsx(n,{id:"meaning-search-heading",as:"h2",variant:"label",weight:"medium",children:"Turn on meaning search"}),e.jsx(n,{as:"p",variant:"meta",tone:"secondary",className:"max-w-[44rem] leading-relaxed",children:"This adds Meaning and All modes to the full search page. Keyword search remains the default fallback and keeps working even when this feature is off."})]})]}),e.jsx("div",{className:"ml-0 rounded-[14px] border border-border-subtle bg-muted px-3.5 py-3 sm:ml-10",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx(n,{as:"p",variant:"meta",weight:"medium",children:"Meaning search"}),e.jsx(n,{as:"p",variant:"meta",tone:"tertiary",children:xe})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(n,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:d.enabled?"Enabled":"Disabled"}),e.jsx(Se,{"aria-label":"Meaning search",checked:d.enabled,disabled:!m||c||x||!d.enabled&&!q,onCheckedChange:fe})]})]})}),e.jsx("div",{className:"flex flex-wrap justify-end gap-2 border-t border-border-subtle pt-4",children:e.jsx(N,{type:"button",variant:"primary",onClick:()=>Q.mutate(F(d)),isLoading:Q.isPending,disabled:!oe,children:"Save settings"})})]}),e.jsxs("section",{className:"surface-base flex flex-col gap-4 p-4","aria-labelledby":"search-index-heading",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1 basis-[28rem] space-y-1",children:[e.jsx(n,{id:"search-index-heading",as:"h2",variant:"label",weight:"medium",children:"Local search index"}),e.jsx(n,{as:"p",variant:"meta",tone:"secondary",children:s?.available?`${s.noteCount} notes · ${s.chunkCount} chunks · ${s.dimensions??0} dimensions`:"Keyword search works without this index."}),e.jsxs(n,{as:"p",variant:"meta",tone:"tertiary",children:["Last synced: ",Ze(s?.lastSyncedAt??s?.indexedAt??null)]}),(s?.pendingNoteCount??0)>0&&e.jsxs(n,{as:"p",variant:"meta",tone:"tertiary",role:"status",children:[s?.pendingNoteCount," ",s?.pendingNoteCount===1?"note is":"notes are"," waiting to sync. Recent edits are grouped before embedding."]})]}),e.jsxs(N,{type:"button",variant:"primary",onClick:()=>Z.mutate(),isLoading:Z.isPending,disabled:!ce,children:[e.jsx(Te,{className:"h-4 w-4"}),s?.available&&!s.needsReindex?"Index is up to date":"Build search index"]})]}),S&&e.jsx(n,{as:"p",variant:"meta",tone:"tertiary",children:"Save these settings before building the index."}),c&&e.jsxs("div",{className:"space-y-2","aria-live":"polite",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(n,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:"Building embeddings"}),e.jsx(n,{as:"span",variant:"meta",tone:"tertiary",children:v&&v.totalChunks>0?`${v.processedChunks} / ${v.totalChunks} chunks`:"Preparing notes…"})]}),e.jsx(Ie,{value:v?.processedChunks??0,max:Math.max(v?.totalChunks??0,1)})]}),s?.needsReindex&&!c&&s.phase!=="error"&&e.jsx(n,{as:"p",variant:"meta",tone:"tertiary",children:"Build the index once to activate meaning search for this model."}),s?.error&&e.jsx("div",{className:"rounded-[14px] border border-border-error bg-accent-soft-danger/40 px-3.5 py-3",children:e.jsx(n,{as:"p",variant:"meta",tone:"error",className:"leading-relaxed",children:s.error})}),s?.syncError&&e.jsx("div",{className:"rounded-[14px] border border-border-error bg-accent-soft-danger/40 px-3.5 py-3",children:e.jsxs(n,{as:"p",variant:"meta",tone:"error",className:"leading-relaxed",children:["Automatic note sync will retry: ",s.syncError]})}),e.jsx(n,{as:"p",variant:"meta",tone:"tertiary",className:"leading-relaxed",children:"Note and query text is sent to the embedding API you configure."}),z&&e.jsx(n,{as:"p",variant:"meta",tone:"error",children:C(z,"Could not load search settings.")})]})]})})};export{na as default};
|
|
1
|
+
import{r,j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{a as ve,b as E}from"./useNoteMutate-VJYw0Vt_.js";import{C as je,u as Ne,P as we,T as n,L as A,I as R,B as N,y as Ce,z as ke,s as ee,d as Ae,S as Se,H as Ie,q as Ee,e as Me,f as Pe}from"./time-DZKkPFUi.js";import{f as Le,s as Fe,a as qe,t as Ke,b as Be}from"./search-admin-adapter-BLMYNm9w.js";import{f as Ue}from"./app-Clwvoiwx.js";import{s as T}from"./CheckCircle.es-BTloiuti.js";import"./url-BvjSC8PU.js";import"./preload-helper-BXl3LOEh.js";import"./sortable.esm-DgSW3bAA.js";const Re=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M244,56v48a12,12,0,0,1-12,12H184a12,12,0,1,1,0-24H201.1l-19-17.38c-.13-.12-.26-.24-.38-.37A76,76,0,1,0,127,204h1a75.53,75.53,0,0,0,52.15-20.72,12,12,0,0,1,16.49,17.45A99.45,99.45,0,0,1,128,228h-1.37A100,100,0,1,1,198.51,57.06L220,76.72V56a12,12,0,0,1,24,0Z"}))],["duotone",r.createElement(r.Fragment,null,r.createElement("path",{d:"M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z",opacity:"0.2"}),r.createElement("path",{d:"M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z"}))],["fill",r.createElement(r.Fragment,null,r.createElement("path",{d:"M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1-5.66-13.66l17-17-10.55-9.65-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,1,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60l10.93,10L226.34,50.3A8,8,0,0,1,240,56Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M238,56v48a6,6,0,0,1-6,6H184a6,6,0,0,1,0-12h32.55l-30.38-27.8c-.06-.06-.12-.13-.19-.19a82,82,0,1,0-1.7,117.65,6,6,0,0,1,8.24,8.73A93.46,93.46,0,0,1,128,222h-1.28A94,94,0,1,1,194.37,61.4L226,90.35V56a6,6,0,1,1,12,0Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M236,56v48a4,4,0,0,1-4,4H184a4,4,0,0,1,0-8h37.7L187.53,68.69l-.13-.12a84,84,0,1,0-1.75,120.51,4,4,0,0,1,5.5,5.82A91.43,91.43,0,0,1,128,220h-1.26A92,92,0,1,1,193,62.84l35,32.05V56a4,4,0,1,1,8,0Z"}))]]),ae=r.forwardRef((t,i)=>r.createElement(je,{ref:i,...t,weights:Re}));ae.displayName="ArrowClockwiseIcon";const Te=ae,He={enabled:!1,baseUrl:"",model:"",queryInstruction:""},De={disabled:"Meaning search off","needs-connection":"Connection test needed","needs-index":"Index needed",indexing:"Building index",ready:"Meaning search ready",error:"Index error"},$e=(t,i)=>t.enabled===i.enabled&&t.baseUrl===i.baseUrl&&t.model===i.model&&t.queryInstruction===i.queryInstruction,w=t=>{const i=t.trim();let o=i.length;for(;o>0&&i.charCodeAt(o-1)===47;)o-=1;return o===i.length?i:i.slice(0,o)},Ve=t=>/(^|[-_/])(embed|embedding|bge|e5|gte)([-_/.]|$)/i.test(t),ze=t=>{try{const i=new URL(t),o=i.hostname.toLowerCase(),d=o==="localhost"||o==="::1"||o==="[::1]"||o.startsWith("127.");return i.protocol==="http:"&&!d}catch{return!1}},Qe=({hasConnectionFields:t,enabled:i,savedConnectionValidated:o,dirty:d,phase:g,available:m})=>t?i?d?"Save this setting. You can test the model before or after saving.":g==="needs-connection"?"Test the selected model to make meaning search available.":m?"Meaning search is active.":"Build the local index to activate meaning search.":o?"Your saved connection is ready to turn on again.":"You can save this provider now and test it when you are ready.":"Connect an API and choose a model first.",C=(t,i)=>Pe.isAxiosError(t)?t.response?.data?.message??t.message??i:t instanceof Error?t.message:i,Ze=t=>{if(!t)return"Not built yet";const i=new Date(t);return Number.isNaN(i.getTime())?t:i.toLocaleString()},na=()=>{const t=Me(),i=Ne(),o=Ee.search.adminStatus(),[d,g]=r.useState(He),[m,se]=r.useState(!1),[y,H]=r.useState([]),[ne,D]=r.useState(""),[te,$]=r.useState(""),[M,P]=r.useState(""),[f,L]=r.useState(!1),[re,V]=r.useState(0),F=a=>{const l=M.trim();return l?{...a,apiKey:l}:f?{...a,apiKey:null}:a},{data:s,error:z,isLoading:ie}=ve({queryKey:o,queryFn:Le,refetchInterval:a=>a.state.data?.phase==="indexing"||(a.state.data?.pendingNoteCount??0)>0?1e3:!1});r.useEffect(()=>{s&&!m&&(g(s.config),se(!0))},[m,s]);const Q=E({mutationFn:Fe,onSuccess:a=>{i.setQueryData(o,a),g(a.config),P(""),L(!1),t("Search settings saved.")},onError:a=>{t(C(a,"Failed to save search settings."))}}),p=E({mutationFn:qe,onSuccess:({models:a},l)=>{const h=w(l.baseUrl);H(a),D(h),g(j=>{if(w(j.baseUrl)!==h||a.some(U=>U.id===j.model))return j;const J=a.filter(U=>U.likelyEmbedding),X=J.length===1?J[0]:a.length===1?a[0]:null;return X?{...j,model:X.id}:j})}}),u=E({mutationFn:({input:a})=>Ke(a),onSuccess:async({dimensions:a,model:l},{connectionKey:h})=>{$(h),t(`Connected to ${l} (${a} dimensions).`),await i.invalidateQueries({queryKey:o})},onError:a=>{t(C(a,"Could not connect to the embedding API."))}}),Z=E({mutationFn:Be,onSuccess:({started:a,status:l})=>{i.setQueryData(o,l),t(a?"Search index build started.":l.needsReindex?"Search index is already updating.":"Search index is already up to date.")},onError:a=>{t(C(a,"Could not start the search index build."))}}),b=w(d.baseUrl),O=`${b}::${d.model.trim()}::${re}`,Y=!!(M.trim()||f),S=!!(s&&(!$e(d,s.config)||Y)),c=s?.phase==="indexing",x=p.isPending||u.isPending,k=!!(b&&d.model.trim()),_=!!y.length&&ne===b,de=k&&te===O,le=!!(!!(k&&s&&w(s.config.baseUrl)===b&&s.config.model.trim()===d.model.trim())&&s?.connectionValidated&&!Y),q=k,oe=!!(m&&S&&!c&&!x&&(!d.enabled||q)),ce=!!(s?.config.enabled&&s.needsReindex&&!S&&!c),me=ze(b),v=s?.progress,he=s?De[s.phase]:ie?"Loading":"Unavailable",ue=d.queryInstruction.trim()?"Customized":"Optional",xe=Qe({hasConnectionFields:k,enabled:d.enabled,savedConnectionValidated:le,dirty:S,phase:s?.phase,available:s?.available}),W=r.useMemo(()=>{const a=[...y],l=d.model.trim();return l&&!a.some(h=>h.id===l)&&a.unshift({id:l,likelyEmbedding:Ve(l)}),a},[y,d.model]),I=(a,l)=>{g(h=>({...h,[a]:l}))},K=()=>{$(""),u.reset()},B=()=>{H([]),D(""),K(),p.reset()},ge=a=>{const l=b!==w(a);g(h=>({...h,baseUrl:a,model:l?"":h.model})),l&&B()},pe=a=>{P(a),L(!1),V(l=>l+1),B()},be=()=>{P(""),L(a=>!a),V(a=>a+1),B()},ye=()=>{const a=w(d.baseUrl);g(l=>({...l,baseUrl:a})),K(),p.mutate(F({baseUrl:a}))},G=a=>{I("model",a),K()},fe=a=>{(!a||q)&&I("enabled",a)};return e.jsx(we,{title:"Search",variant:"default",description:"Keyword search is always available. Add an embedding API only when you want meaning-based recall.",headerRight:e.jsx(n,{as:"span",variant:"meta",weight:"medium",tone:s?.phase==="error"?"error":"secondary",className:"rounded-full border border-border-subtle bg-muted px-3 py-1.5",children:he}),children:e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("section",{className:"surface-base flex flex-col gap-4 p-4","aria-labelledby":"embedding-api-heading",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-muted text-sm font-semibold text-fg-secondary",children:"1"}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx(n,{id:"embedding-api-heading",as:"h2",variant:"label",weight:"medium",children:"Connect an embedding API"}),e.jsx(n,{as:"p",variant:"meta",tone:"secondary",className:"leading-relaxed",children:"Enter an OpenAI-compatible API URL and an API key when the provider requires one."})]})]}),e.jsxs("div",{className:"ml-0 space-y-2 sm:ml-10",children:[e.jsx(A,{htmlFor:"semantic-search-base-url",className:"font-medium text-fg-tertiary",children:"API base URL"}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(R,{id:"semantic-search-base-url",inputMode:"url",placeholder:"http://127.0.0.1:1234/v1",value:d.baseUrl,disabled:!m||c||x,onChange:a=>ge(a.target.value),className:"w-full min-w-0 sm:flex-1"}),e.jsxs(N,{type:"button",variant:"subtle",onClick:ye,isLoading:p.isPending,disabled:!b||c||u.isPending,className:"w-full sm:w-auto",children:[e.jsx(Ue,{className:"h-4 w-4"}),"Find models"]})]}),me&&e.jsx("div",{className:"rounded-[12px] border border-border-secondary/70 bg-muted px-3 py-2.5",children:e.jsx(n,{as:"p",variant:"meta",tone:"secondary",className:"leading-relaxed",children:"This provider uses unencrypted HTTP. API credentials and note text can be read on the network."})}),e.jsxs("div",{className:"space-y-2 pt-1",children:[e.jsxs(A,{htmlFor:"semantic-search-api-key",className:"font-medium text-fg-tertiary",children:["API key ",e.jsx("span",{className:"font-normal text-fg-tertiary",children:"(optional)"})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(R,{id:"semantic-search-api-key",type:"password",autoComplete:"new-password",placeholder:f?"No API key":s?.apiKeyConfigured?"Saved API key":"Enter API key",value:M,disabled:!m||c||x||f,onChange:a=>pe(a.target.value),className:"w-full min-w-0 sm:flex-1"}),s?.apiKeyConfigured&&e.jsx(N,{type:"button",variant:"subtle",onClick:be,disabled:c||x,className:"w-full sm:w-auto",children:f?"Keep saved key":"Remove saved key"})]}),f&&e.jsx(n,{as:"p",variant:"meta",tone:"tertiary",children:"The saved key will be removed when you save."})]}),_&&e.jsxs("div",{className:"flex items-start gap-2 rounded-[12px] border border-border-subtle bg-accent-soft-success px-3 py-2.5",role:"status",children:[e.jsx(T,{className:"mt-0.5 h-4 w-4 shrink-0 text-accent-success"}),e.jsxs(n,{as:"p",variant:"meta",className:"leading-relaxed text-accent-success",children:["API connected. Found ",y.length," ",y.length===1?"model":"models","."]})]}),p.isError&&e.jsx("div",{className:"rounded-[12px] border border-border-error bg-accent-soft-danger/40 px-3 py-2.5",children:e.jsx(n,{as:"p",variant:"meta",tone:"error",className:"leading-relaxed",children:C(p.error,"Could not list models from this API.")})})]})]}),e.jsxs("section",{className:"surface-base flex flex-col gap-4 p-4","aria-labelledby":"embedding-model-heading",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-muted text-sm font-semibold text-fg-secondary",children:"2"}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx(n,{id:"embedding-model-heading",as:"h2",variant:"label",weight:"medium",children:"Choose and test a model"}),e.jsx(n,{as:"p",variant:"meta",tone:"secondary",className:"leading-relaxed",children:"Choose an embedding model and verify the connection."})]})]}),e.jsxs("div",{className:"ml-0 space-y-3 sm:ml-10",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{htmlFor:"semantic-search-model",className:"font-medium text-fg-tertiary",children:"Embedding model"}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(Ce,{id:"semantic-search-model",ariaLabel:"Embedding model",value:d.model,placeholder:p.isPending?"Loading models…":"Find models first",disabled:!W.length||!m||c||x,onValueChange:G,className:"w-full min-w-0 sm:flex-1",children:W.map(a=>e.jsxs(ke,{value:a.id,children:[a.id,a.likelyEmbedding?" · Embedding":""]},a.id))}),e.jsxs(N,{type:"button",variant:"subtle",onClick:()=>u.mutate({input:F(d),connectionKey:O}),isLoading:u.isPending,disabled:!k||c||p.isPending,className:"w-full sm:w-auto",children:[e.jsx(T,{className:"h-4 w-4"}),"Test selected model"]})]}),_&&y.every(a=>!a.likelyEmbedding)&&e.jsx(n,{as:"p",variant:"meta",tone:"tertiary",className:"leading-relaxed",children:"None of these model names clearly identifies an embedding model. Choose one only if your provider documents it as an embedding model, then run the test."})]}),de&&u.data&&e.jsxs("div",{className:"flex items-start gap-2 rounded-[12px] border border-border-subtle bg-accent-soft-success px-3 py-2.5",role:"status",children:[e.jsx(T,{className:"mt-0.5 h-4 w-4 shrink-0 text-accent-success"}),e.jsxs(n,{as:"p",variant:"meta",className:"leading-relaxed text-accent-success",children:["This model works · ",u.data.dimensions," dimensions"]})]}),u.isError&&e.jsx("div",{className:"rounded-[12px] border border-border-error bg-accent-soft-danger/40 px-3 py-2.5",children:e.jsx(n,{as:"p",variant:"meta",tone:"error",className:"leading-relaxed",children:C(u.error,"Could not connect to the embedding API.")})}),e.jsxs("details",{className:"group rounded-[12px] border border-border-subtle bg-muted",children:[e.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-3 px-3 py-2.5 marker:hidden",children:[e.jsx(n,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:"Can't find the model? Enter its ID manually"}),e.jsx(ee,{className:"h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-open:rotate-180","aria-hidden":"true"})]}),e.jsxs("div",{className:"space-y-2 border-t border-border-subtle px-3 py-3",children:[e.jsx(A,{htmlFor:"semantic-search-manual-model",className:"font-medium text-fg-tertiary",children:"Model ID"}),e.jsx(R,{id:"semantic-search-manual-model",placeholder:"text-embedding-qwen3-embedding-0.6b",value:d.model,disabled:!m||c||x,onChange:a=>G(a.target.value)}),e.jsx(n,{as:"p",variant:"meta",tone:"tertiary",children:"Use this fallback when a compatible API does not support model listing."})]})]}),e.jsxs("details",{className:"group rounded-[12px] border border-border-subtle bg-muted",children:[e.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-3 px-3 py-2.5 marker:hidden",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(n,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:"Advanced query instruction"}),e.jsxs(n,{as:"span",variant:"meta",tone:"tertiary",children:[" · ",ue]})]}),e.jsx(ee,{className:"h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-open:rotate-180","aria-hidden":"true"})]}),e.jsxs("div",{className:"space-y-3 border-t border-border-subtle px-3 py-3",children:[e.jsx(n,{as:"p",variant:"meta",tone:"secondary",className:"leading-relaxed",children:"Leave this blank unless your embedding model documentation explicitly recommends a query instruction. Ocean Brain does not assume a language or retrieval prompt."}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{htmlFor:"semantic-search-instruction",className:"font-medium text-fg-tertiary",children:"Query instruction"}),e.jsx(Ae,{id:"semantic-search-instruction",rows:3,placeholder:"Leave blank unless your model recommends an instruction.",value:d.queryInstruction,disabled:!m||c||x,onChange:a=>I("queryInstruction",a.target.value)})]}),d.queryInstruction&&e.jsx("div",{className:"flex flex-wrap gap-2",children:e.jsx(N,{type:"button",size:"sm",variant:"ghost",disabled:c||x,onClick:()=>I("queryInstruction",""),children:"Clear"})}),e.jsx(n,{as:"p",variant:"meta",tone:"tertiary",className:"leading-relaxed",children:"This is added only to the search query, never to note chunks. Changing it does not require rebuilding the index."})]})]})]})]}),e.jsxs("section",{className:"surface-base flex flex-col gap-4 p-4","aria-labelledby":"meaning-search-heading",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-muted text-sm font-semibold text-fg-secondary",children:"3"}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsx(n,{id:"meaning-search-heading",as:"h2",variant:"label",weight:"medium",children:"Turn on meaning search"}),e.jsx(n,{as:"p",variant:"meta",tone:"secondary",className:"max-w-[44rem] leading-relaxed",children:"This adds Meaning and All modes to the full search page. Keyword search remains the default fallback and keeps working even when this feature is off."})]})]}),e.jsx("div",{className:"ml-0 rounded-[14px] border border-border-subtle bg-muted px-3.5 py-3 sm:ml-10",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx(n,{as:"p",variant:"meta",weight:"medium",children:"Meaning search"}),e.jsx(n,{as:"p",variant:"meta",tone:"tertiary",children:xe})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(n,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:d.enabled?"Enabled":"Disabled"}),e.jsx(Se,{"aria-label":"Meaning search",checked:d.enabled,disabled:!m||c||x||!d.enabled&&!q,onCheckedChange:fe})]})]})}),e.jsx("div",{className:"flex flex-wrap justify-end gap-2 border-t border-border-subtle pt-4",children:e.jsx(N,{type:"button",variant:"primary",onClick:()=>Q.mutate(F(d)),isLoading:Q.isPending,disabled:!oe,children:"Save settings"})})]}),e.jsxs("section",{className:"surface-base flex flex-col gap-4 p-4","aria-labelledby":"search-index-heading",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1 basis-[28rem] space-y-1",children:[e.jsx(n,{id:"search-index-heading",as:"h2",variant:"label",weight:"medium",children:"Local search index"}),e.jsx(n,{as:"p",variant:"meta",tone:"secondary",children:s?.available?`${s.noteCount} notes · ${s.chunkCount} chunks · ${s.dimensions??0} dimensions`:"Keyword search works without this index."}),e.jsxs(n,{as:"p",variant:"meta",tone:"tertiary",children:["Last synced: ",Ze(s?.lastSyncedAt??s?.indexedAt??null)]}),(s?.pendingNoteCount??0)>0&&e.jsxs(n,{as:"p",variant:"meta",tone:"tertiary",role:"status",children:[s?.pendingNoteCount," ",s?.pendingNoteCount===1?"note is":"notes are"," waiting to sync. Recent edits are grouped before embedding."]})]}),e.jsxs(N,{type:"button",variant:"primary",onClick:()=>Z.mutate(),isLoading:Z.isPending,disabled:!ce,children:[e.jsx(Te,{className:"h-4 w-4"}),s?.available&&!s.needsReindex?"Index is up to date":"Build search index"]})]}),S&&e.jsx(n,{as:"p",variant:"meta",tone:"tertiary",children:"Save these settings before building the index."}),c&&e.jsxs("div",{className:"space-y-2","aria-live":"polite",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(n,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:"Building embeddings"}),e.jsx(n,{as:"span",variant:"meta",tone:"tertiary",children:v&&v.totalChunks>0?`${v.processedChunks} / ${v.totalChunks} chunks`:"Preparing notes…"})]}),e.jsx(Ie,{value:v?.processedChunks??0,max:Math.max(v?.totalChunks??0,1)})]}),s?.needsReindex&&!c&&s.phase!=="error"&&e.jsx(n,{as:"p",variant:"meta",tone:"tertiary",children:"Build the index once to activate meaning search for this model."}),s?.error&&e.jsx("div",{className:"rounded-[14px] border border-border-error bg-accent-soft-danger/40 px-3.5 py-3",children:e.jsx(n,{as:"p",variant:"meta",tone:"error",className:"leading-relaxed",children:s.error})}),s?.syncError&&e.jsx("div",{className:"rounded-[14px] border border-border-error bg-accent-soft-danger/40 px-3.5 py-3",children:e.jsxs(n,{as:"p",variant:"meta",tone:"error",className:"leading-relaxed",children:["Automatic note sync will retry: ",s.syncError]})}),e.jsx(n,{as:"p",variant:"meta",tone:"tertiary",className:"leading-relaxed",children:"Note and query text is sent to the embedding API you configure."}),z&&e.jsx(n,{as:"p",variant:"meta",tone:"error",children:C(z,"Could not load search settings.")})]})]})})};export{na as default};
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
<link rel="icon" type="image/png" href="/icon.png" />
|
|
9
9
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
10
10
|
<title>Ocean Brain</title>
|
|
11
|
-
<script type="module" crossorigin src="/assets/app-
|
|
11
|
+
<script type="module" crossorigin src="/assets/app-Clwvoiwx.js"></script>
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/floating-ui.react-dom-BWTnA00G.js">
|
|
13
13
|
<link rel="modulepreload" crossorigin href="/assets/url-BvjSC8PU.js">
|
|
14
14
|
<link rel="modulepreload" crossorigin href="/assets/time-DZKkPFUi.js">
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/assets/useNoteMutate-VJYw0Vt_.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-BXl3LOEh.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/sortable.esm-DgSW3bAA.js">
|
|
18
|
-
<link rel="stylesheet" crossorigin href="/assets/app-
|
|
18
|
+
<link rel="stylesheet" crossorigin href="/assets/app-DGFNtdpS.css">
|
|
19
19
|
</head>
|
|
20
20
|
|
|
21
21
|
<body>
|
package/server/dist/app.js
CHANGED
|
@@ -6,19 +6,19 @@ import { createSessionMiddleware } from "./modules/auth-guard.js";
|
|
|
6
6
|
import { createErrorHandler } from "./modules/error-handler.js";
|
|
7
7
|
import logger from "./modules/logger.js";
|
|
8
8
|
import { createApiRouter, createAuthPagesRouter, createClientRouter, createGraphqlRouter } from "./routes/index.js";
|
|
9
|
-
const createApp = (authConfig) => {
|
|
9
|
+
const createApp = (authConfig, options = {}) => {
|
|
10
10
|
const mcpAdminService = createMcpAdminService();
|
|
11
|
-
return createAppWithMcpAuth(authConfig, mcpAdminService);
|
|
11
|
+
return createAppWithMcpAuth(authConfig, mcpAdminService, options);
|
|
12
12
|
};
|
|
13
|
-
const createAppWithMcpAuth = (authConfig, mcpAdminService) => {
|
|
14
|
-
const app = express();
|
|
13
|
+
const createAppWithMcpAuth = (authConfig, mcpAdminService, options = {}) => {
|
|
14
|
+
const app = options.application ?? express();
|
|
15
15
|
app.locals.authConfig = authConfig;
|
|
16
16
|
void Promise.all([purgeExpiredNoteSnapshots(), purgeExpiredTrashedNotes()]).catch((error) => {
|
|
17
17
|
const message = error instanceof Error ? error.message : "Unknown recovery cleanup error";
|
|
18
18
|
process.stderr.write(`[recovery] Startup cleanup failed: ${message}
|
|
19
19
|
`);
|
|
20
20
|
});
|
|
21
|
-
app.use(logger).use(createSessionMiddleware(authConfig)).use(express.urlencoded({ extended: false, inflate: false })).use(express.json({ limit: "50mb", inflate: false })).use("/api", createApiRouter(authConfig, mcpAdminService)).use(createAuthPagesRouter(authConfig)).use("/graphql", createGraphqlRouter(authConfig, mcpAdminService)).use(createClientRouter(authConfig)).use(createErrorHandler());
|
|
21
|
+
app.use(logger).use(createSessionMiddleware(authConfig)).use(express.urlencoded({ extended: false, inflate: false })).use(express.json({ limit: "50mb", inflate: false })).use("/api", createApiRouter(authConfig, mcpAdminService)).use(createAuthPagesRouter(authConfig)).use("/graphql", createGraphqlRouter(authConfig, mcpAdminService)).use(createClientRouter(authConfig, options.clientContentMiddleware)).use(createErrorHandler());
|
|
22
22
|
return app;
|
|
23
23
|
};
|
|
24
24
|
var app_default = createApp;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { mkdir } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import { DatabaseSync } from "node:sqlite";
|
|
4
|
+
import { setImmediate as yieldToEventLoop } from "node:timers/promises";
|
|
3
5
|
import { getLoadablePath } from "sqlite-vec";
|
|
4
|
-
import sqlite3 from "sqlite3";
|
|
5
6
|
const SEMANTIC_INDEX_SCHEMA_VERSION = 2;
|
|
6
7
|
const SEARCH_DATABASE_SCHEMA_VERSION = 1;
|
|
7
8
|
const SEARCH_DATABASE_SCHEMA_SQL = `
|
|
@@ -50,69 +51,27 @@ const openDatabase = async (filePath) => {
|
|
|
50
51
|
if (filePath !== ":memory:") {
|
|
51
52
|
await mkdir(path.dirname(filePath), { recursive: true });
|
|
52
53
|
}
|
|
53
|
-
const database =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
await new Promise((resolve, reject) => {
|
|
63
|
-
database.loadExtension(getLoadablePath(), (error) => {
|
|
64
|
-
if (error) {
|
|
65
|
-
reject(error);
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
resolve();
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
return database;
|
|
54
|
+
const database = new DatabaseSync(filePath, { allowExtension: true });
|
|
55
|
+
try {
|
|
56
|
+
database.loadExtension(getLoadablePath());
|
|
57
|
+
database.enableLoadExtension(false);
|
|
58
|
+
return database;
|
|
59
|
+
} catch (error) {
|
|
60
|
+
database.close();
|
|
61
|
+
throw error;
|
|
62
|
+
}
|
|
72
63
|
};
|
|
73
64
|
const run = (database, sql, parameters = []) => {
|
|
74
|
-
return
|
|
75
|
-
database.run(sql, parameters, function onRun(error) {
|
|
76
|
-
if (error) {
|
|
77
|
-
reject(error);
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
resolve(this);
|
|
81
|
-
});
|
|
82
|
-
});
|
|
65
|
+
return database.prepare(sql).run(...parameters);
|
|
83
66
|
};
|
|
84
67
|
const get = (database, sql, parameters = []) => {
|
|
85
|
-
return
|
|
86
|
-
database.get(sql, parameters, (error, row) => {
|
|
87
|
-
if (error) {
|
|
88
|
-
reject(error);
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
resolve(row);
|
|
92
|
-
});
|
|
93
|
-
});
|
|
68
|
+
return database.prepare(sql).get(...parameters);
|
|
94
69
|
};
|
|
95
70
|
const all = (database, sql, parameters = []) => {
|
|
96
|
-
return
|
|
97
|
-
database.all(sql, parameters, (error, rows) => {
|
|
98
|
-
if (error) {
|
|
99
|
-
reject(error);
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
resolve(rows);
|
|
103
|
-
});
|
|
104
|
-
});
|
|
71
|
+
return database.prepare(sql).all(...parameters);
|
|
105
72
|
};
|
|
106
73
|
const exec = (database, sql) => {
|
|
107
|
-
|
|
108
|
-
database.exec(sql, (error) => {
|
|
109
|
-
if (error) {
|
|
110
|
-
reject(error);
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
resolve();
|
|
114
|
-
});
|
|
115
|
-
});
|
|
74
|
+
database.exec(sql);
|
|
116
75
|
};
|
|
117
76
|
const initializeSearchDatabase = async (database) => {
|
|
118
77
|
await exec(
|
|
@@ -134,19 +93,35 @@ const initializeSearchDatabase = async (database) => {
|
|
|
134
93
|
await exec(database, `PRAGMA user_version = ${SEARCH_DATABASE_SCHEMA_VERSION};`);
|
|
135
94
|
};
|
|
136
95
|
const close = (database) => {
|
|
137
|
-
|
|
138
|
-
database.close((error) => {
|
|
139
|
-
if (error) {
|
|
140
|
-
reject(error);
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
resolve();
|
|
144
|
-
});
|
|
145
|
-
});
|
|
96
|
+
database.close();
|
|
146
97
|
};
|
|
147
98
|
const serializeEmbedding = (embedding) => {
|
|
148
99
|
return Buffer.from(Float32Array.from(embedding).buffer);
|
|
149
100
|
};
|
|
101
|
+
const INSERT_YIELD_INTERVAL = 250;
|
|
102
|
+
const insertChunks = async (database, chunks) => {
|
|
103
|
+
const statement = database.prepare(`
|
|
104
|
+
INSERT INTO search_chunks (
|
|
105
|
+
note_id,
|
|
106
|
+
chunk_index,
|
|
107
|
+
source_hash,
|
|
108
|
+
text,
|
|
109
|
+
embedding
|
|
110
|
+
) VALUES (?, ?, ?, ?, ?)
|
|
111
|
+
`);
|
|
112
|
+
for (const [index, chunk] of chunks.entries()) {
|
|
113
|
+
statement.run(
|
|
114
|
+
chunk.noteId,
|
|
115
|
+
chunk.chunkIndex,
|
|
116
|
+
chunk.sourceHash,
|
|
117
|
+
chunk.text,
|
|
118
|
+
serializeEmbedding(chunk.embedding)
|
|
119
|
+
);
|
|
120
|
+
if ((index + 1) % INSERT_YIELD_INTERVAL === 0 && index + 1 < chunks.length) {
|
|
121
|
+
await yieldToEventLoop();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
150
125
|
const isSemanticIndexProfile = (value) => {
|
|
151
126
|
if (!value || typeof value !== "object") {
|
|
152
127
|
return false;
|
|
@@ -217,27 +192,7 @@ class SqliteSemanticVectorIndex {
|
|
|
217
192
|
try {
|
|
218
193
|
await run(database, "DELETE FROM search_chunks");
|
|
219
194
|
await run(database, "DELETE FROM search_index_state");
|
|
220
|
-
|
|
221
|
-
await run(
|
|
222
|
-
database,
|
|
223
|
-
`
|
|
224
|
-
INSERT INTO search_chunks (
|
|
225
|
-
note_id,
|
|
226
|
-
chunk_index,
|
|
227
|
-
source_hash,
|
|
228
|
-
text,
|
|
229
|
-
embedding
|
|
230
|
-
) VALUES (?, ?, ?, ?, ?)
|
|
231
|
-
`,
|
|
232
|
-
[
|
|
233
|
-
chunk.noteId,
|
|
234
|
-
chunk.chunkIndex,
|
|
235
|
-
chunk.sourceHash,
|
|
236
|
-
chunk.text,
|
|
237
|
-
serializeEmbedding(chunk.embedding)
|
|
238
|
-
]
|
|
239
|
-
);
|
|
240
|
-
}
|
|
195
|
+
await insertChunks(database, chunks);
|
|
241
196
|
await run(
|
|
242
197
|
database,
|
|
243
198
|
`
|
|
@@ -472,37 +427,35 @@ class SqliteSemanticVectorIndex {
|
|
|
472
427
|
async getNoteSyncQueueStatus() {
|
|
473
428
|
return this.runExclusive(async () => {
|
|
474
429
|
const database = await this.getDatabase();
|
|
475
|
-
const
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
)
|
|
505
|
-
]);
|
|
430
|
+
const queue = get(
|
|
431
|
+
database,
|
|
432
|
+
`
|
|
433
|
+
SELECT
|
|
434
|
+
COUNT(*) AS pendingNoteCount,
|
|
435
|
+
MIN(first_queued_at) AS oldestQueuedAt
|
|
436
|
+
FROM search_note_sync_queue
|
|
437
|
+
`
|
|
438
|
+
);
|
|
439
|
+
const state = get(
|
|
440
|
+
database,
|
|
441
|
+
`
|
|
442
|
+
SELECT
|
|
443
|
+
last_synced_at AS lastSyncedAt,
|
|
444
|
+
last_reconciled_at AS lastReconciledAt
|
|
445
|
+
FROM search_note_sync_state
|
|
446
|
+
WHERE id = 1
|
|
447
|
+
`
|
|
448
|
+
);
|
|
449
|
+
const latestError = get(
|
|
450
|
+
database,
|
|
451
|
+
`
|
|
452
|
+
SELECT last_error AS error
|
|
453
|
+
FROM search_note_sync_queue
|
|
454
|
+
WHERE last_error IS NOT NULL
|
|
455
|
+
ORDER BY next_attempt_at DESC, note_id ASC
|
|
456
|
+
LIMIT 1
|
|
457
|
+
`
|
|
458
|
+
);
|
|
506
459
|
return {
|
|
507
460
|
pendingNoteCount: queue?.pendingNoteCount ?? 0,
|
|
508
461
|
oldestQueuedAt: queue?.oldestQueuedAt === null || queue?.oldestQueuedAt === void 0 ? null : new Date(queue.oldestQueuedAt).toISOString(),
|
|
@@ -526,27 +479,7 @@ class SqliteSemanticVectorIndex {
|
|
|
526
479
|
await exec(database, "BEGIN IMMEDIATE;");
|
|
527
480
|
try {
|
|
528
481
|
await run(database, "DELETE FROM search_chunks WHERE note_id = ?", [noteId]);
|
|
529
|
-
|
|
530
|
-
await run(
|
|
531
|
-
database,
|
|
532
|
-
`
|
|
533
|
-
INSERT INTO search_chunks (
|
|
534
|
-
note_id,
|
|
535
|
-
chunk_index,
|
|
536
|
-
source_hash,
|
|
537
|
-
text,
|
|
538
|
-
embedding
|
|
539
|
-
) VALUES (?, ?, ?, ?, ?)
|
|
540
|
-
`,
|
|
541
|
-
[
|
|
542
|
-
chunk.noteId,
|
|
543
|
-
chunk.chunkIndex,
|
|
544
|
-
chunk.sourceHash,
|
|
545
|
-
chunk.text,
|
|
546
|
-
serializeEmbedding(chunk.embedding)
|
|
547
|
-
]
|
|
548
|
-
);
|
|
549
|
-
}
|
|
482
|
+
await insertChunks(database, chunks);
|
|
550
483
|
await this.refreshIndexCounts(database);
|
|
551
484
|
await exec(database, "COMMIT;");
|
|
552
485
|
} catch (error) {
|
package/server/dist/main.js
CHANGED
|
@@ -1,38 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ensureNoteReferenceIndex } from "./features/note/services/note-reference-index.js";
|
|
3
|
-
import { getDefaultSemanticSearchManager } from "./features/search/search-manager.js";
|
|
4
|
-
import { logAuthConfig, resolveAuthConfig } from "./modules/auth-mode.js";
|
|
5
|
-
import { startDataMaintenanceScheduler } from "./modules/data-maintenance.js";
|
|
6
|
-
const PORT = Number(process.env.PORT || 6683);
|
|
7
|
-
const HOST = process.env.HOST || "0.0.0.0";
|
|
8
|
-
const startServer = async () => {
|
|
9
|
-
const authConfig = resolveAuthConfig(process.env);
|
|
10
|
-
logAuthConfig(authConfig);
|
|
11
|
-
const app = createApp(authConfig);
|
|
12
|
-
getDefaultSemanticSearchManager();
|
|
13
|
-
const rebuiltReferenceCount = await ensureNoteReferenceIndex();
|
|
14
|
-
if (rebuiltReferenceCount > 0) {
|
|
15
|
-
process.stdout.write(`[maintenance] Rebuilt ${rebuiltReferenceCount} note reference rows
|
|
16
|
-
`);
|
|
17
|
-
}
|
|
18
|
-
app.listen(PORT, HOST, () => {
|
|
19
|
-
process.stdout.write(`http server listen on ${HOST}:${PORT} (auth: ${authConfig.mode})
|
|
20
|
-
`);
|
|
21
|
-
startDataMaintenanceScheduler({
|
|
22
|
-
onResults: (results) => {
|
|
23
|
-
for (const result of results) {
|
|
24
|
-
process.stdout.write(`[maintenance] Reconciled ${result.processedCount} rows for ${result.key}
|
|
25
|
-
`);
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
onError: (error) => {
|
|
29
|
-
const message = error instanceof Error ? error.message : "Unknown data maintenance error";
|
|
30
|
-
process.stderr.write(`[maintenance] Background run failed: ${message}
|
|
31
|
-
`);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
};
|
|
1
|
+
import { startServer } from "./server.js";
|
|
36
2
|
startServer().catch((error) => {
|
|
37
3
|
const message = error instanceof Error ? error.message : "Unknown auth configuration error";
|
|
38
4
|
process.stderr.write(`[auth] Startup failed: ${message}
|