@rubytech/create-realagent 1.0.685 → 1.0.687
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +23 -215
- package/dist/pinned-binaries.js +10 -41
- package/dist/uninstall.js +23 -23
- package/package.json +1 -1
- package/payload/platform/plugins/cloudflare/scripts/setup-tunnel.sh +35 -9
- package/payload/platform/plugins/docs/PLUGIN.md +2 -0
- package/payload/platform/plugins/docs/references/cloudflare.md +1 -1
- package/payload/platform/plugins/docs/references/deployment.md +13 -10
- package/payload/platform/plugins/docs/references/graph.md +38 -0
- package/payload/platform/plugins/docs/references/platform.md +10 -7
- package/payload/platform/plugins/docs/references/troubleshooting.md +23 -13
- package/payload/platform/scripts/vnc.sh +7 -7
- package/payload/platform/templates/systemd/edge.service.template +5 -4
- package/payload/server/maxy-edge.js +5 -367
- package/payload/server/public/assets/admin-BqLtaMVu.js +352 -0
- package/payload/server/public/assets/{data-DUSyrydY.js → data-BZ7v-zug.js} +1 -1
- package/payload/server/public/assets/{file-CDJ6dUV3.js → file-CScYkZq5.js} +1 -1
- package/payload/server/public/assets/graph-tjXdtwk-.js +50 -0
- package/payload/server/public/assets/{house-CNP_bwvT.js → house-CdFRNujU.js} +1 -1
- package/payload/server/public/assets/{jsx-runtime-BFFQvkdQ.css → jsx-runtime-Og0q7dXg.css} +1 -1
- package/payload/server/public/assets/{public-sHoAccvb.js → public-CrkQJek6.js} +2 -2
- package/payload/server/public/assets/{share-2-DBcb9j6E.js → share-2-Ev-D4Lm9.js} +1 -1
- package/payload/server/public/assets/{useVoiceRecorder-CtSgpc95.js → useVoiceRecorder-DyDXH7EA.js} +2 -2
- package/payload/server/public/assets/{x-CTVJaC_u.js → x-D5W7ddgP.js} +1 -1
- package/payload/server/public/data.html +6 -6
- package/payload/server/public/graph.html +6 -6
- package/payload/server/public/index.html +7 -8
- package/payload/server/public/public.html +4 -4
- package/payload/server/server.js +830 -258
- package/payload/platform/templates/dotfiles/.tmux.conf +0 -1
- package/payload/platform/templates/systemd/ttyd.service.template +0 -30
- package/payload/server/public/assets/admin-BFmYXz1V.js +0 -362
- package/payload/server/public/assets/admin-kHJ-D0s7.css +0 -1
- package/payload/server/public/assets/graph-CWcYp5bE.js +0 -50
- /package/payload/server/public/assets/{jsx-runtime-BVKWELH6.js → jsx-runtime-CHqDsKlc.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-DD-I1_y5.js";import{i as t,n,o as r,r as i,t as a}from"./jsx-runtime-BVKWELH6.js";import{a as o,i as s,n as c,o as l,r as u,t as d}from"./share-2-DBcb9j6E.js";import{n as f,t as p}from"./file-CDJ6dUV3.js";import{t as m}from"./house-CNP_bwvT.js";var h=i(`circle-arrow-up`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]]),g=i(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),_=i(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),v=t(),y=e(r(),1),b=a();function x(){let[e,t]=(0,y.useState)(null),[n,r]=(0,y.useState)(!1);return(0,y.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem(`maxy-admin-session-key`)}catch{}if(!n){t(null),r(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(i=>{if(!e){if(i.status===401){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`;return}t(n),r(!0)}}).catch(()=>{e||(t(n),r(!0))}),()=>{e=!0}},[]),n?e?(0,b.jsxs)(`div`,{className:`data-page`,children:[(0,b.jsxs)(`header`,{className:`data-header`,children:[(0,b.jsxs)(`h1`,{className:`data-title`,children:[(0,b.jsx)(l,{size:18}),` Data`]}),(0,b.jsx)(S,{})]}),(0,b.jsxs)(`main`,{className:`data-main`,children:[(0,b.jsx)(C,{sessionKey:e}),(0,b.jsx)(O,{sessionKey:e})]})]}):(0,b.jsxs)(`div`,{className:`data-page`,children:[(0,b.jsx)(`header`,{className:`data-header`,children:(0,b.jsxs)(`h1`,{className:`data-title`,children:[(0,b.jsx)(l,{size:18}),` Data`]})}),(0,b.jsxs)(`div`,{className:`data-empty`,children:[(0,b.jsx)(`p`,{children:`You are not signed in.`}),(0,b.jsxs)(`p`,{children:[`Open the `,(0,b.jsx)(`a`,{href:`/`,className:`data-link`,children:`main admin page`}),` and log in, then return here.`]})]})]}):(0,b.jsx)(`div`,{className:`data-page`,children:(0,b.jsxs)(`div`,{className:`data-loading`,children:[(0,b.jsx)(o,{size:18,className:`spin`}),` Loading…`]})})}function S(){let[e,t]=(0,y.useState)(!1),n=(0,y.useRef)(null);(0,y.useEffect)(()=>{if(!e)return;let r=e=>{n.current&&(n.current.contains(e.target)||t(!1))},i=e=>{e.key===`Escape`&&t(!1)};return document.addEventListener(`mousedown`,r),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`keydown`,i)}},[e]);let r=(0,y.useCallback)(()=>{try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},[]);return(0,b.jsxs)(`div`,{className:`chat-burger-wrap`,ref:n,children:[(0,b.jsx)(`button`,{type:`button`,className:`chat-burger`,onClick:()=>t(e=>!e),"aria-label":`Menu`,"aria-haspopup":`true`,"aria-expanded":e,children:(0,b.jsx)(u,{size:20})}),e&&(0,b.jsxs)(`div`,{className:`chat-menu`,children:[(0,b.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,onClick:()=>{t(!1),window.location.href=`/`},children:[(0,b.jsx)(m,{size:14}),` Chat`]}),(0,b.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,onClick:()=>{t(!1),window.location.href=`/graph`},children:[(0,b.jsx)(d,{size:14}),` Graph`]}),(0,b.jsx)(`div`,{className:`chat-menu-divider`}),(0,b.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,onClick:()=>{t(!1),r()},children:[(0,b.jsx)(s,{size:14}),` Log out`]})]})]})}function C({sessionKey:e}){let[t,n]=(0,y.useState)(``),[r,i]=(0,y.useState)(``),[a,s]=(0,y.useState)(null),[l,u]=(0,y.useState)(!1),[d,f]=(0,y.useState)(null);return(0,y.useEffect)(()=>{let e=t.trim();if(!e){i(``),s(null);return}let n=setTimeout(()=>i(e),300);return()=>clearTimeout(n)},[t]),(0,y.useEffect)(()=>{if(!r)return;let t=!1;u(!0),f(null);let n=`/api/admin/graph-search?session_key=${encodeURIComponent(e)}&q=${encodeURIComponent(r)}&limit=20`;return fetch(n).then(async e=>{let t=await e.json().catch(()=>({error:`HTTP ${e.status}`}));if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);return t}).then(e=>{t||s(e.results)}).catch(e=>{t||f(e instanceof Error?e.message:String(e))}).finally(()=>{t||u(!1)}),()=>{t=!0}},[r,e]),(0,b.jsxs)(`section`,{className:`data-panel`,children:[(0,b.jsx)(`h2`,{className:`data-panel-title`,children:`Search`}),(0,b.jsx)(`p`,{className:`data-panel-subtitle`,children:`Find anything in your knowledge base by keyword.`}),(0,b.jsxs)(`div`,{className:`data-search-input`,children:[(0,b.jsx)(c,{size:14}),(0,b.jsx)(`input`,{type:`text`,placeholder:`Search your knowledge…`,value:t,onChange:e=>n(e.target.value),autoFocus:!0,autoComplete:`off`,spellCheck:!1}),l&&(0,b.jsx)(o,{size:14,className:`spin`})]}),d&&(0,b.jsxs)(`div`,{className:`data-error`,children:[`Search failed: `,d]}),a&&!l&&(0,b.jsxs)(`div`,{className:`data-results-meta`,children:[a.length,` result`,a.length===1?``:`s`]}),a&&a.length===0&&!l&&(0,b.jsx)(`div`,{className:`data-empty-results`,children:`No matches. Try a different keyword.`}),a&&a.length>0&&(0,b.jsx)(`ul`,{className:`data-results`,children:a.map(e=>(0,b.jsx)(w,{hit:e},e.nodeId))})]})}function w({hit:e}){let t=E(e.properties),n=D(e.properties),r=T(e.labels),[i,a]=(0,y.useState)(!1),o=n&&n.length>280,s=i||!o?n:n?.slice(0,280)+`…`;return(0,b.jsxs)(`li`,{className:`data-result`,children:[r&&(0,b.jsx)(`div`,{className:`data-result-header`,children:(0,b.jsx)(`span`,{className:`data-result-labels`,children:r})}),t&&(0,b.jsx)(`div`,{className:`data-result-title`,children:t}),n&&(0,b.jsx)(`pre`,{className:`data-result-body`,children:s}),o&&(0,b.jsx)(`button`,{type:`button`,className:`data-result-toggle`,onClick:()=>a(e=>!e),children:i?`Show less`:`Show more`})]})}function T(e){if(e.length===0)return null;let t=e[0].replace(/([a-z])([A-Z])/g,`$1 $2`);return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function E(e){for(let t of[`title`,`name`,`summary`,`headline`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n.length>140?n.slice(0,140)+`…`:n}return null}function D(e){for(let t of[`content`,`summary`,`body`,`description`,`text`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function O({sessionKey:e}){let[t,r]=(0,y.useState)(`.`),[i,a]=(0,y.useState)(null),[s,c]=(0,y.useState)([]),[l,u]=(0,y.useState)(!1),[d,m]=(0,y.useState)(null),[v,x]=(0,y.useState)(!1),[S,C]=(0,y.useState)(null),[w,T]=(0,y.useState)(null),[E,D]=(0,y.useState)(null),[O,j]=(0,y.useState)(null),M=(0,y.useRef)(null),[N,P]=(0,y.useState)(0);(0,y.useEffect)(()=>{let n=!1;u(!0),m(null);let r=`/api/admin/files?session_key=${encodeURIComponent(e)}&path=${encodeURIComponent(t===`.`?``:t)}`;return fetch(r).then(async e=>{let t=await e.json().catch(()=>({error:`HTTP ${e.status}`}));if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);return t}).then(e=>{n||(a(e.entries),c(e.displayPath??[]))}).catch(e=>{n||(a([]),c([]),m(e instanceof Error?e.message:String(e)))}).finally(()=>{n||u(!1)}),()=>{n=!0}},[e,t,N]);let F=(0,y.useCallback)(e=>{r(e)},[]),I=(0,y.useCallback)(()=>{if(t===`.`||t===``)return;let e=t.split(`/`).filter(Boolean);e.pop(),r(e.length===0?`.`:e.join(`/`))},[t]),L=(0,y.useCallback)(n=>{let r=t===`.`?n.name:`${t}/${n.name}`,i=`/api/admin/files/download?session_key=${encodeURIComponent(e)}&path=${encodeURIComponent(r)}`,a=document.createElement(`a`);a.href=i,a.rel=`noopener noreferrer`,document.body.appendChild(a),a.click(),a.remove()},[t,e]),R=(0,y.useCallback)(()=>{M.current?.click()},[]),z=(0,y.useCallback)(e=>{T(null),j(e.name)},[]),B=(0,y.useCallback)(()=>{j(null)},[]),V=(0,y.useCallback)(async n=>{let r=t===`.`?n.name:`${t}/${n.name}`;T(null),j(null),D(n.name);try{let t=`/api/admin/files?session_key=${encodeURIComponent(e)}&path=${encodeURIComponent(r)}`,n=await fetch(t,{method:`DELETE`}),i=await n.json().catch(()=>({error:`HTTP ${n.status}`}));if(!n.ok)throw Error(i.error??`HTTP ${n.status}`);P(e=>e+1)}catch(e){T(e instanceof Error?e.message:String(e))}finally{D(null)}},[t,e]);(0,y.useEffect)(()=>{if(!O)return;let e=e=>{e.key===`Escape`&&j(null)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[O]);let H=(0,y.useCallback)(async t=>{C(null),x(!0);try{let n=new FormData;n.append(`session_key`,e),n.append(`file`,t);let i=await fetch(`/api/admin/files/upload`,{method:`POST`,body:n}),a=await i.json().catch(()=>({error:`HTTP ${i.status}`}));if(!i.ok)throw Error(a.error??`HTTP ${i.status}`);r(a.path.split(`/`).slice(0,-1).join(`/`)||`.`),P(e=>e+1)}catch(e){C(e instanceof Error?e.message:String(e))}finally{x(!1),M.current&&(M.current.value=``)}},[e]);return(0,b.jsxs)(`section`,{className:`data-panel`,children:[(0,b.jsxs)(`div`,{className:`data-panel-heading`,children:[(0,b.jsx)(`h2`,{className:`data-panel-title`,children:`Files`}),(0,b.jsxs)(`div`,{className:`data-file-actions`,children:[(0,b.jsxs)(`button`,{type:`button`,className:`data-btn`,onClick:R,disabled:v,children:[v?(0,b.jsx)(o,{size:14,className:`spin`}):(0,b.jsx)(_,{size:14}),` Upload`]}),(0,b.jsx)(`input`,{type:`file`,ref:M,hidden:!0,onChange:e=>{let t=e.target.files?.[0];t&&H(t)}})]})]}),(0,b.jsxs)(`p`,{className:`data-panel-subtitle`,children:[`Everything under your install's `,(0,b.jsx)(`code`,{children:`data/`}),` directory. Click a folder to open it, a file to download it. Uploads go to `,(0,b.jsx)(`code`,{children:`data/uploads/`}),`.`]}),(0,b.jsxs)(`div`,{className:`data-breadcrumbs`,children:[(0,b.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>F(`.`),children:`data`}),s.map((e,t)=>{let n=s.slice(0,t+1).map(e=>e.name).join(`/`);return(0,b.jsxs)(`span`,{className:`data-crumb-wrap`,children:[(0,b.jsx)(`span`,{className:`data-crumb-sep`,children:`/`}),(0,b.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>F(n),title:e.name,children:e.displayName??e.name})]},n)}),t!==`.`&&(0,b.jsxs)(`button`,{type:`button`,className:`data-btn data-btn-ghost data-up-btn`,onClick:I,children:[(0,b.jsx)(h,{size:14}),` Up`]})]}),S&&(0,b.jsxs)(`div`,{className:`data-error`,children:[`Upload failed: `,S]}),w&&(0,b.jsxs)(`div`,{className:`data-error`,children:[`Delete failed: `,w]}),d&&(0,b.jsx)(`div`,{className:`data-error`,children:d}),l&&(0,b.jsxs)(`div`,{className:`data-loading`,children:[(0,b.jsx)(o,{size:14,className:`spin`}),` Loading…`]}),!l&&i&&i.length===0&&!d&&(0,b.jsx)(`div`,{className:`data-empty-results`,children:`Empty directory.`}),!l&&i&&i.length>0&&(0,b.jsx)(`ul`,{className:`data-entries`,children:i.map(e=>{let r=e.displayName??e.name,i=E===e.name,a=O===e.name;return(0,b.jsx)(`li`,{className:`data-entry`,children:e.kind===`directory`?(0,b.jsxs)(`button`,{type:`button`,className:`data-entry-btn`,onClick:()=>F(t===`.`?e.name:`${t}/${e.name}`),children:[(0,b.jsx)(g,{size:14}),(0,b.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:r})]}):e.kind===`file`?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`button`,{type:`button`,className:`data-entry-btn`,onClick:()=>L(e),title:`Download ${r}`,disabled:a,children:[(0,b.jsx)(p,{size:14}),(0,b.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:r}),(0,b.jsxs)(`span`,{className:`data-entry-meta`,title:`Modified ${A(e.modifiedAt)}`,children:[k(e.sizeBytes),` · `,A(e.modifiedAt)]}),(0,b.jsx)(f,{size:12,className:`data-entry-download-icon`})]}),a?(0,b.jsxs)(`div`,{className:`data-entry-confirm`,role:`group`,"aria-label":`Confirm delete ${r}`,children:[(0,b.jsx)(`span`,{className:`data-entry-confirm-label`,children:`Delete?`}),(0,b.jsx)(`button`,{type:`button`,className:`data-entry-confirm-yes`,onClick:()=>V(e),autoFocus:!0,children:`Yes`}),(0,b.jsx)(`button`,{type:`button`,className:`data-entry-confirm-no`,onClick:B,children:`No`})]}):(0,b.jsx)(`button`,{type:`button`,className:`data-entry-delete`,onClick:()=>z(e),disabled:i,title:`Delete ${r}`,"aria-label":`Delete ${r}`,children:i?(0,b.jsx)(o,{size:14,className:`spin`}):(0,b.jsx)(n,{size:14})})]}):(0,b.jsxs)(`div`,{className:`data-entry-btn data-entry-disabled`,children:[(0,b.jsx)(p,{size:14}),(0,b.jsx)(`span`,{className:`data-entry-name`,children:r}),(0,b.jsx)(`span`,{className:`data-entry-meta`,children:`special`})]})},e.name)})})]})}function k(e){return e==null?``:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/1024/1024).toFixed(1)} MB`:`${(e/1024/1024/1024).toFixed(1)} GB`}function A(e){try{let t=new Date(e);if(isNaN(t.getTime()))return`—`;let n=typeof navigator<`u`?navigator.languages&&navigator.languages.length>0?[...navigator.languages]:[navigator.language]:void 0;return t.toLocaleString(n,{dateStyle:`medium`,timeStyle:`short`})}catch{return`—`}}(0,v.createRoot)(document.getElementById(`root`)).render((0,b.jsx)(x,{}));
|
|
1
|
+
import{o as e}from"./chunk-DD-I1_y5.js";import{i as t,n,o as r,r as i,t as a}from"./jsx-runtime-CHqDsKlc.js";import{a as o,i as s,n as c,o as l,r as u,t as d}from"./share-2-Ev-D4Lm9.js";import{n as f,t as p}from"./file-CScYkZq5.js";import{t as m}from"./house-CdFRNujU.js";var h=i(`circle-arrow-up`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]]),g=i(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),_=i(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),v=t(),y=e(r(),1),b=a();function x(){let[e,t]=(0,y.useState)(null),[n,r]=(0,y.useState)(!1);return(0,y.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem(`maxy-admin-session-key`)}catch{}if(!n){t(null),r(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(i=>{if(!e){if(i.status===401){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`;return}t(n),r(!0)}}).catch(()=>{e||(t(n),r(!0))}),()=>{e=!0}},[]),n?e?(0,b.jsxs)(`div`,{className:`data-page`,children:[(0,b.jsxs)(`header`,{className:`data-header`,children:[(0,b.jsxs)(`h1`,{className:`data-title`,children:[(0,b.jsx)(l,{size:18}),` Data`]}),(0,b.jsx)(S,{})]}),(0,b.jsxs)(`main`,{className:`data-main`,children:[(0,b.jsx)(C,{sessionKey:e}),(0,b.jsx)(O,{sessionKey:e})]})]}):(0,b.jsxs)(`div`,{className:`data-page`,children:[(0,b.jsx)(`header`,{className:`data-header`,children:(0,b.jsxs)(`h1`,{className:`data-title`,children:[(0,b.jsx)(l,{size:18}),` Data`]})}),(0,b.jsxs)(`div`,{className:`data-empty`,children:[(0,b.jsx)(`p`,{children:`You are not signed in.`}),(0,b.jsxs)(`p`,{children:[`Open the `,(0,b.jsx)(`a`,{href:`/`,className:`data-link`,children:`main admin page`}),` and log in, then return here.`]})]})]}):(0,b.jsx)(`div`,{className:`data-page`,children:(0,b.jsxs)(`div`,{className:`data-loading`,children:[(0,b.jsx)(o,{size:18,className:`spin`}),` Loading…`]})})}function S(){let[e,t]=(0,y.useState)(!1),n=(0,y.useRef)(null);(0,y.useEffect)(()=>{if(!e)return;let r=e=>{n.current&&(n.current.contains(e.target)||t(!1))},i=e=>{e.key===`Escape`&&t(!1)};return document.addEventListener(`mousedown`,r),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`keydown`,i)}},[e]);let r=(0,y.useCallback)(()=>{try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},[]);return(0,b.jsxs)(`div`,{className:`chat-burger-wrap`,ref:n,children:[(0,b.jsx)(`button`,{type:`button`,className:`chat-burger`,onClick:()=>t(e=>!e),"aria-label":`Menu`,"aria-haspopup":`true`,"aria-expanded":e,children:(0,b.jsx)(u,{size:20})}),e&&(0,b.jsxs)(`div`,{className:`chat-menu`,children:[(0,b.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,onClick:()=>{t(!1),window.location.href=`/`},children:[(0,b.jsx)(m,{size:14}),` Chat`]}),(0,b.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,onClick:()=>{t(!1),window.location.href=`/graph`},children:[(0,b.jsx)(d,{size:14}),` Graph`]}),(0,b.jsx)(`div`,{className:`chat-menu-divider`}),(0,b.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,onClick:()=>{t(!1),r()},children:[(0,b.jsx)(s,{size:14}),` Log out`]})]})]})}function C({sessionKey:e}){let[t,n]=(0,y.useState)(``),[r,i]=(0,y.useState)(``),[a,s]=(0,y.useState)(null),[l,u]=(0,y.useState)(!1),[d,f]=(0,y.useState)(null);return(0,y.useEffect)(()=>{let e=t.trim();if(!e){i(``),s(null);return}let n=setTimeout(()=>i(e),300);return()=>clearTimeout(n)},[t]),(0,y.useEffect)(()=>{if(!r)return;let t=!1;u(!0),f(null);let n=`/api/admin/graph-search?session_key=${encodeURIComponent(e)}&q=${encodeURIComponent(r)}&limit=20`;return fetch(n).then(async e=>{let t=await e.json().catch(()=>({error:`HTTP ${e.status}`}));if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);return t}).then(e=>{t||s(e.results)}).catch(e=>{t||f(e instanceof Error?e.message:String(e))}).finally(()=>{t||u(!1)}),()=>{t=!0}},[r,e]),(0,b.jsxs)(`section`,{className:`data-panel`,children:[(0,b.jsx)(`h2`,{className:`data-panel-title`,children:`Search`}),(0,b.jsx)(`p`,{className:`data-panel-subtitle`,children:`Find anything in your knowledge base by keyword.`}),(0,b.jsxs)(`div`,{className:`data-search-input`,children:[(0,b.jsx)(c,{size:14}),(0,b.jsx)(`input`,{type:`text`,placeholder:`Search your knowledge…`,value:t,onChange:e=>n(e.target.value),autoFocus:!0,autoComplete:`off`,spellCheck:!1}),l&&(0,b.jsx)(o,{size:14,className:`spin`})]}),d&&(0,b.jsxs)(`div`,{className:`data-error`,children:[`Search failed: `,d]}),a&&!l&&(0,b.jsxs)(`div`,{className:`data-results-meta`,children:[a.length,` result`,a.length===1?``:`s`]}),a&&a.length===0&&!l&&(0,b.jsx)(`div`,{className:`data-empty-results`,children:`No matches. Try a different keyword.`}),a&&a.length>0&&(0,b.jsx)(`ul`,{className:`data-results`,children:a.map(e=>(0,b.jsx)(w,{hit:e},e.nodeId))})]})}function w({hit:e}){let t=E(e.properties),n=D(e.properties),r=T(e.labels),[i,a]=(0,y.useState)(!1),o=n&&n.length>280,s=i||!o?n:n?.slice(0,280)+`…`;return(0,b.jsxs)(`li`,{className:`data-result`,children:[r&&(0,b.jsx)(`div`,{className:`data-result-header`,children:(0,b.jsx)(`span`,{className:`data-result-labels`,children:r})}),t&&(0,b.jsx)(`div`,{className:`data-result-title`,children:t}),n&&(0,b.jsx)(`pre`,{className:`data-result-body`,children:s}),o&&(0,b.jsx)(`button`,{type:`button`,className:`data-result-toggle`,onClick:()=>a(e=>!e),children:i?`Show less`:`Show more`})]})}function T(e){if(e.length===0)return null;let t=e[0].replace(/([a-z])([A-Z])/g,`$1 $2`);return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function E(e){for(let t of[`title`,`name`,`summary`,`headline`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n.length>140?n.slice(0,140)+`…`:n}return null}function D(e){for(let t of[`content`,`summary`,`body`,`description`,`text`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function O({sessionKey:e}){let[t,r]=(0,y.useState)(`.`),[i,a]=(0,y.useState)(null),[s,c]=(0,y.useState)([]),[l,u]=(0,y.useState)(!1),[d,m]=(0,y.useState)(null),[v,x]=(0,y.useState)(!1),[S,C]=(0,y.useState)(null),[w,T]=(0,y.useState)(null),[E,D]=(0,y.useState)(null),[O,j]=(0,y.useState)(null),M=(0,y.useRef)(null),[N,P]=(0,y.useState)(0);(0,y.useEffect)(()=>{let n=!1;u(!0),m(null);let r=`/api/admin/files?session_key=${encodeURIComponent(e)}&path=${encodeURIComponent(t===`.`?``:t)}`;return fetch(r).then(async e=>{let t=await e.json().catch(()=>({error:`HTTP ${e.status}`}));if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);return t}).then(e=>{n||(a(e.entries),c(e.displayPath??[]))}).catch(e=>{n||(a([]),c([]),m(e instanceof Error?e.message:String(e)))}).finally(()=>{n||u(!1)}),()=>{n=!0}},[e,t,N]);let F=(0,y.useCallback)(e=>{r(e)},[]),I=(0,y.useCallback)(()=>{if(t===`.`||t===``)return;let e=t.split(`/`).filter(Boolean);e.pop(),r(e.length===0?`.`:e.join(`/`))},[t]),L=(0,y.useCallback)(n=>{let r=t===`.`?n.name:`${t}/${n.name}`,i=`/api/admin/files/download?session_key=${encodeURIComponent(e)}&path=${encodeURIComponent(r)}`,a=document.createElement(`a`);a.href=i,a.rel=`noopener noreferrer`,document.body.appendChild(a),a.click(),a.remove()},[t,e]),R=(0,y.useCallback)(()=>{M.current?.click()},[]),z=(0,y.useCallback)(e=>{T(null),j(e.name)},[]),B=(0,y.useCallback)(()=>{j(null)},[]),V=(0,y.useCallback)(async n=>{let r=t===`.`?n.name:`${t}/${n.name}`;T(null),j(null),D(n.name);try{let t=`/api/admin/files?session_key=${encodeURIComponent(e)}&path=${encodeURIComponent(r)}`,n=await fetch(t,{method:`DELETE`}),i=await n.json().catch(()=>({error:`HTTP ${n.status}`}));if(!n.ok)throw Error(i.error??`HTTP ${n.status}`);P(e=>e+1)}catch(e){T(e instanceof Error?e.message:String(e))}finally{D(null)}},[t,e]);(0,y.useEffect)(()=>{if(!O)return;let e=e=>{e.key===`Escape`&&j(null)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[O]);let H=(0,y.useCallback)(async t=>{C(null),x(!0);try{let n=new FormData;n.append(`session_key`,e),n.append(`file`,t);let i=await fetch(`/api/admin/files/upload`,{method:`POST`,body:n}),a=await i.json().catch(()=>({error:`HTTP ${i.status}`}));if(!i.ok)throw Error(a.error??`HTTP ${i.status}`);r(a.path.split(`/`).slice(0,-1).join(`/`)||`.`),P(e=>e+1)}catch(e){C(e instanceof Error?e.message:String(e))}finally{x(!1),M.current&&(M.current.value=``)}},[e]);return(0,b.jsxs)(`section`,{className:`data-panel`,children:[(0,b.jsxs)(`div`,{className:`data-panel-heading`,children:[(0,b.jsx)(`h2`,{className:`data-panel-title`,children:`Files`}),(0,b.jsxs)(`div`,{className:`data-file-actions`,children:[(0,b.jsxs)(`button`,{type:`button`,className:`data-btn`,onClick:R,disabled:v,children:[v?(0,b.jsx)(o,{size:14,className:`spin`}):(0,b.jsx)(_,{size:14}),` Upload`]}),(0,b.jsx)(`input`,{type:`file`,ref:M,hidden:!0,onChange:e=>{let t=e.target.files?.[0];t&&H(t)}})]})]}),(0,b.jsxs)(`p`,{className:`data-panel-subtitle`,children:[`Everything under your install's `,(0,b.jsx)(`code`,{children:`data/`}),` directory. Click a folder to open it, a file to download it. Uploads go to `,(0,b.jsx)(`code`,{children:`data/uploads/`}),`.`]}),(0,b.jsxs)(`div`,{className:`data-breadcrumbs`,children:[(0,b.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>F(`.`),children:`data`}),s.map((e,t)=>{let n=s.slice(0,t+1).map(e=>e.name).join(`/`);return(0,b.jsxs)(`span`,{className:`data-crumb-wrap`,children:[(0,b.jsx)(`span`,{className:`data-crumb-sep`,children:`/`}),(0,b.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>F(n),title:e.name,children:e.displayName??e.name})]},n)}),t!==`.`&&(0,b.jsxs)(`button`,{type:`button`,className:`data-btn data-btn-ghost data-up-btn`,onClick:I,children:[(0,b.jsx)(h,{size:14}),` Up`]})]}),S&&(0,b.jsxs)(`div`,{className:`data-error`,children:[`Upload failed: `,S]}),w&&(0,b.jsxs)(`div`,{className:`data-error`,children:[`Delete failed: `,w]}),d&&(0,b.jsx)(`div`,{className:`data-error`,children:d}),l&&(0,b.jsxs)(`div`,{className:`data-loading`,children:[(0,b.jsx)(o,{size:14,className:`spin`}),` Loading…`]}),!l&&i&&i.length===0&&!d&&(0,b.jsx)(`div`,{className:`data-empty-results`,children:`Empty directory.`}),!l&&i&&i.length>0&&(0,b.jsx)(`ul`,{className:`data-entries`,children:i.map(e=>{let r=e.displayName??e.name,i=E===e.name,a=O===e.name;return(0,b.jsx)(`li`,{className:`data-entry`,children:e.kind===`directory`?(0,b.jsxs)(`button`,{type:`button`,className:`data-entry-btn`,onClick:()=>F(t===`.`?e.name:`${t}/${e.name}`),children:[(0,b.jsx)(g,{size:14}),(0,b.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:r})]}):e.kind===`file`?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`button`,{type:`button`,className:`data-entry-btn`,onClick:()=>L(e),title:`Download ${r}`,disabled:a,children:[(0,b.jsx)(p,{size:14}),(0,b.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:r}),(0,b.jsxs)(`span`,{className:`data-entry-meta`,title:`Modified ${A(e.modifiedAt)}`,children:[k(e.sizeBytes),` · `,A(e.modifiedAt)]}),(0,b.jsx)(f,{size:12,className:`data-entry-download-icon`})]}),a?(0,b.jsxs)(`div`,{className:`data-entry-confirm`,role:`group`,"aria-label":`Confirm delete ${r}`,children:[(0,b.jsx)(`span`,{className:`data-entry-confirm-label`,children:`Delete?`}),(0,b.jsx)(`button`,{type:`button`,className:`data-entry-confirm-yes`,onClick:()=>V(e),autoFocus:!0,children:`Yes`}),(0,b.jsx)(`button`,{type:`button`,className:`data-entry-confirm-no`,onClick:B,children:`No`})]}):(0,b.jsx)(`button`,{type:`button`,className:`data-entry-delete`,onClick:()=>z(e),disabled:i,title:`Delete ${r}`,"aria-label":`Delete ${r}`,children:i?(0,b.jsx)(o,{size:14,className:`spin`}):(0,b.jsx)(n,{size:14})})]}):(0,b.jsxs)(`div`,{className:`data-entry-btn data-entry-disabled`,children:[(0,b.jsx)(p,{size:14}),(0,b.jsx)(`span`,{className:`data-entry-name`,children:r}),(0,b.jsx)(`span`,{className:`data-entry-meta`,children:`special`})]})},e.name)})})]})}function k(e){return e==null?``:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/1024/1024).toFixed(1)} MB`:`${(e/1024/1024/1024).toFixed(1)} GB`}function A(e){try{let t=new Date(e);if(isNaN(t.getTime()))return`—`;let n=typeof navigator<`u`?navigator.languages&&navigator.languages.length>0?[...navigator.languages]:[navigator.language]:void 0;return t.toLocaleString(n,{dateStyle:`medium`,timeStyle:`short`})}catch{return`—`}}(0,v.createRoot)(document.getElementById(`root`)).render((0,b.jsx)(x,{}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./jsx-runtime-
|
|
1
|
+
import{r as e}from"./jsx-runtime-CHqDsKlc.js";var t=e(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),n=e(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]);export{t as n,n as t};
|