@yuriai/web 0.2.0-beta.2 → 0.2.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AssistantView-8ju42ZTW.js → AssistantView-CLKNSmK0.js} +3 -3
- package/dist/assets/{DiagramView-rw0YYQMb.js → DiagramView-C_urOuXu.js} +1 -1
- package/dist/assets/{GuiPluginSurface-CZyG8VSt.js → GuiPluginSurface-736HcjIN.js} +1 -1
- package/dist/assets/{MarkdownRenderer-CtlVSzEr.js → MarkdownRenderer-CRYQRJ6O.js} +2 -2
- package/dist/assets/{MarkdownRendererImpl-wN873oJ5.js → MarkdownRendererImpl-DJcRI0hT.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-Bh0SBb3A.js → MarkstreamRendererImpl-BffzWk4G.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-BmVdW83D.js → MobileDetailNavigation-BEB3hlJ1.js} +1 -1
- package/dist/assets/{MobileShareBridge-DsEPHal0.js → MobileShareBridge-9gdwpoAb.js} +1 -1
- package/dist/assets/{MobileTabPageHeader-C3XsN5mD.js → MobileTabPageHeader-Dh5mqOcK.js} +1 -1
- package/dist/assets/{MultiRunWindow-E69FtA8j.js → MultiRunWindow-Bi3aly9b.js} +1 -1
- package/dist/assets/{SettingsView-cAxZUqrO.js → SettingsView-CIPoAFnD.js} +1 -1
- package/dist/assets/{SettingsWindow-lAKvVEKw.js → SettingsWindow-B24JgZnf.js} +1 -1
- package/dist/assets/{TerminalView-Dk4wVZaD.js → TerminalView-BWutwGtP.js} +1 -1
- package/dist/assets/{ToolOutputDialog-USJ-ZgXn.js → ToolOutputDialog-gcD1fSaB.js} +1 -1
- package/dist/assets/{appThemeRegistry-LtxIx7El.js → appThemeRegistry-ktbSDOFk.js} +1 -1
- package/dist/assets/{capgoAdapter-DCIeVZw_.js → capgoAdapter-3Uy_m4Za.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-CRlBHcv1.js → fileMentionTouchSelection-bVnePHdS.js} +1 -1
- package/dist/assets/{fileReferenceActions-ZQ5--HF8.js → fileReferenceActions-Ca5wtvOa.js} +1 -1
- package/dist/assets/{gitApi-BKjA7Bpe.js → gitApi-DccSJMYl.js} +1 -1
- package/dist/assets/{insertionBoundaries-D_wrLY-Q.js → insertionBoundaries-BZgMtXXz.js} +1 -1
- package/dist/assets/{main-C4Zc7_s8.js → main-DSa1W5SA.js} +2 -2
- package/dist/assets/{main-CkA5yk63.js → main-HBpfFsY-.js} +4 -4
- package/dist/assets/{mcpQueries-s9QcLjGw.js → mcpQueries-CFR_danB.js} +1 -1
- package/dist/assets/{miniChat-C_wwveSN.js → miniChat-DcG2PyMu.js} +2 -2
- package/dist/assets/{mobile-TuU7P2PX.js → mobile-DGUDmzLl.js} +2 -2
- package/dist/assets/{mobileBackNavigation-C6OcBTbS.js → mobileBackNavigation-i40NmwxE.js} +1 -1
- package/dist/assets/{multirun-cZcReWkT.js → multirun-D-E3RJbf.js} +1 -1
- package/dist/assets/{native-config-DnQvXgu6.js → native-config-BU8ochmh.js} +1 -1
- package/dist/assets/{projectMeta-DXlpoXd3.js → projectMeta-Ddp_NxcI.js} +1 -1
- package/dist/assets/{readiness-m2mD0fyj.js → readiness-CydU25xC.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-COXM_nk2.js → renderElectronMiniChatApp-C11y4O8g.js} +2 -2
- package/dist/assets/{renderMobileApp-CbU3BLr6.js → renderMobileApp-BeJqGLid.js} +4 -4
- package/dist/assets/{runtimeConfig-jHTvOptz.js → runtimeConfig-xiF5snk3.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-BOuzWhtp.js → runtimeEndpointReset-CWOI8alW.js} +3 -3
- package/dist/assets/{sessionChangeSummary-C7Y5e238.js → sessionChangeSummary-DA1ZMfkC.js} +1 -1
- package/dist/assets/{sessionLookup-BscEQpqH.js → sessionLookup-Mz6LvD5p.js} +1 -1
- package/dist/assets/{speechSettingsQueries-DVKcuOEf.js → speechSettingsQueries-CYiiOuya.js} +1 -1
- package/dist/assets/{types-eQY4TOgr.js → types-DoaGaihV.js} +1 -1
- package/dist/assets/{useAppFontEffects-DOp_gxxk.js → useAppFontEffects-sz1UI2pZ.js} +5 -5
- package/dist/assets/{useDesktopWindowControlsLayout-CPqgnywT.js → useDesktopWindowControlsLayout-D_0gn_5u.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-9Efzl9IZ.js → useEffectiveDirectory-Ct1Akmfw.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-Cwk7wARY.js → useMobileNavigationStore-BdTMlKQU.js} +3 -3
- package/dist/assets/{useWorkerHighlightedLines-ClwAu-Q3.js → useWorkerHighlightedLines-B3R3cGBi.js} +1 -1
- package/dist/index.html +5 -5
- package/dist/mini-chat.html +5 -5
- package/dist/mobile.html +5 -5
- package/package.json +1 -1
- package/server/lib/content-search/DOCUMENTATION.md +17 -11
- package/server/lib/content-search/index.js +1 -0
- package/server/lib/content-search/runtime.js +50 -9
- package/server/lib/content-search/runtime.test.js +72 -1
- package/server/lib/content-search/service.js +12 -1
package/dist/assets/{useWorkerHighlightedLines-ClwAu-Q3.js → useWorkerHighlightedLines-B3R3cGBi.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,rt as n}from"./vendor-base-ui-CdzJ6My_.js";import{v as r}from"./useUIStore-NMQx_cnG.js";import{n as i}from"./vendor-react-BP2cRVqX.js";import{f as a,r as o,t as s}from"./button-4sNruiRJ.js";import{n as c}from"./useThemeSystem-8jhE4Zyk.js";import{n as l}from"./Icon-BX4GW-k_.js";import{i as u,n as d,t as f}from"./tooltip-Bxj4llmx.js";import{n as p}from"./MarkdownRenderer-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,rt as n}from"./vendor-base-ui-CdzJ6My_.js";import{v as r}from"./useUIStore-NMQx_cnG.js";import{n as i}from"./vendor-react-BP2cRVqX.js";import{f as a,r as o,t as s}from"./button-4sNruiRJ.js";import{n as c}from"./useThemeSystem-8jhE4Zyk.js";import{n as l}from"./Icon-BX4GW-k_.js";import{i as u,n as d,t as f}from"./tooltip-Bxj4llmx.js";import{n as p}from"./MarkdownRenderer-CRYQRJ6O.js";import{n as m,r as h}from"./toolHelpers-DL452NVK.js";import{t as g}from"./vendor-tanstack-react-virtual-B_EO--9t.js";import{n as _}from"./markdownTheme-DHoKvD6O.js";import{n as v,t as y}from"./markdown-worker-oBGEB9Eg.js";var b=e(t(),1),x=i(),S=n(),C=`w-[min(30rem,calc(100cqw-1rem))] min-w-[280px] max-w-full overflow-hidden rounded-xl shadow-[inset_0_1px_0_0_rgba(255,255,255,0.8),inset_0_0_0_1px_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.10),0_1px_2px_-0.5px_rgba(0,0,0,0.08),0_4px_8px_-2px_rgba(0,0,0,0.08),0_12px_20px_-4px_rgba(0,0,0,0.08)] dark:shadow-[inset_0_1px_0_0_rgba(255,255,255,0.12),inset_0_0_0_1px_rgba(255,255,255,0.08),0_0_0_1px_rgba(0,0,0,0.36),0_1px_1px_-0.5px_rgba(0,0,0,0.22),0_3px_3px_-1.5px_rgba(0,0,0,0.20),0_6px_6px_-3px_rgba(0,0,0,0.16)]`,w={maxWidth:`min(28rem, calc(100cqw - 4ch))`,backgroundColor:`var(--surface-elevated)`,color:`var(--surface-elevated-foreground)`},T=`flex items-center justify-between gap-3 border-b border-[var(--surface-subtle)] px-3 py-2.5`,E=`text-xs font-medium leading-4 text-foreground md:text-[0.8125rem] md:leading-5`,D=`text-xs tabular-nums leading-4 text-muted-foreground md:text-[0.8125rem] md:leading-5`,O=`m-0 list-none divide-y divide-[var(--surface-subtle)] p-0`,k=`${O} max-h-[min(22rem,50vh)] overflow-y-auto`,A=`${O} w-full`,ee={className:`p-0 rounded-none`,maxHeightClass:`max-h-[46vh]`,disableHorizontal:!0},j=`px-2.5 py-1.5 text-xs leading-4 md:py-2 md:text-[0.8125rem] md:leading-5`,M=`flex min-w-0 items-center gap-1 text-xs leading-4 text-muted-foreground md:gap-1.5 md:text-[0.8125rem] md:leading-5`,te=`min-w-0 truncate text-xs leading-4 text-foreground md:text-[0.8125rem] md:leading-5`,ne=`inline-flex shrink-0 items-center gap-1 text-xs leading-4 tabular-nums text-muted-foreground md:text-[0.8125rem] md:leading-5`,re=`h-3 w-3 shrink-0 md:h-3.5 md:w-3.5`,ie={in_progress:`text-foreground`,pending:`text-foreground`,completed:`text-muted-foreground line-through`,cancelled:`text-muted-foreground line-through`},ae={in_progress:`chat.statusRow.todo.status.inProgress`,pending:`chat.statusRow.todo.status.pending`,completed:`chat.statusRow.todo.status.completed`,cancelled:`chat.statusRow.todo.status.cancelled`},N=e=>{let t=(0,x.c)(26),{todo:n,isActive:r,activeRef:i}=e,{t:s}=a(),c=oe.has(n.status)?n.status:`pending`,p=ae[c],m;t[0]!==s||t[1]!==p?(m=s(p),t[0]=s,t[1]=p,t[2]=m):m=t[2];let h=m,g;t[3]===c?g=t[4]:(g=c===`in_progress`?(0,S.jsx)(l,{name:`record-circle`,className:`h-3.5 w-3.5 text-[var(--status-info)]`,"aria-hidden":`true`}):c===`completed`?(0,S.jsx)(l,{name:`checkbox-circle`,className:`h-3.5 w-3.5 text-[var(--status-success)]`,"aria-hidden":`true`}):(0,S.jsx)(l,{name:`time`,className:`h-3.5 w-3.5 text-muted-foreground`,"aria-hidden":`true`}),t[3]=c,t[4]=g);let _=g,v=r?`step`:void 0,y=r&&`bg-[var(--surface-muted)] before:absolute before:inset-y-2 before:left-0 before:w-0.5 before:rounded-full before:bg-[var(--status-info)]`,b;t[5]===y?b=t[6]:(b=o(`group relative grid min-w-0 grid-cols-[1rem_minmax(0,1fr)] items-start gap-2.5`,j,y),t[5]=y,t[6]=b);let C;t[7]!==_||t[8]!==h?(C=(0,S.jsx)(u,{asChild:!0,children:(0,S.jsx)(`span`,{className:`flex size-4 items-center justify-center`,"aria-label":h,children:_})}),t[7]=_,t[8]=h,t[9]=C):C=t[9];let w;t[10]===h?w=t[11]:(w=(0,S.jsx)(d,{side:`left`,sideOffset:6,children:h}),t[10]=h,t[11]=w);let T;t[12]!==C||t[13]!==w?(T=(0,S.jsxs)(f,{children:[C,w]}),t[12]=C,t[13]=w,t[14]=T):T=t[14];let E=ie[c],D;t[15]===E?D=t[16]:(D=o(`block whitespace-normal break-words`,E),t[15]=E,t[16]=D);let O;t[17]!==D||t[18]!==n.content?(O=(0,S.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,S.jsx)(`span`,{className:D,children:n.content})}),t[17]=D,t[18]=n.content,t[19]=O):O=t[19];let k;return t[20]!==i||t[21]!==O||t[22]!==v||t[23]!==b||t[24]!==T?(k=(0,S.jsxs)(`li`,{ref:i,"aria-current":v,className:b,children:[T,O]}),t[20]=i,t[21]=O,t[22]=v,t[23]=b,t[24]=T,t[25]=k):k=t[25],k},oe=new Set([`in_progress`,`pending`,`completed`,`cancelled`]),P=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`),F=e=>e?Object.entries(e).map(([e,t])=>t==null?``:`${e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}:${typeof t==`number`?`${t}px`:t};`).join(``):``,I=(e,t,n)=>{let r=e.querySelector(`pre`);r&&(r.style.margin=`0`,r.style.background=`transparent`,r.style.whiteSpace=t?`pre-wrap`:`pre`,t&&(r.style.wordBreak=`break-word`,r.style.overflowWrap=`break-word`));let i=e.querySelector(`code`);if(i){let e=F(n);e&&i.setAttribute(`style`,`${i.getAttribute(`style`)??``}${e}`)}},L=e=>`<pre><code>${P(e)}</code></pre>`,R=e=>{let t=(0,x.c)(21),{code:n,language:r,className:i,style:a,codeStyle:s,wrap:l}=e,u=l!==void 0&&l,{currentTheme:d}=c(),f=b.useRef(null),p;t[0]===d?p=t[1]:(p=_(d),t[0]=d,t[1]=p);let m=p,h,g;t[2]!==n||t[3]!==s||t[4]!==u?(h=()=>{let e=f.current;e&&(e.innerHTML=L(n),I(e,u,s))},g=[n,u,s],t[2]=n,t[3]=s,t[4]=u,t[5]=h,t[6]=g):(h=t[5],g=t[6]),b.useLayoutEffect(h,g);let v,C;t[7]!==n||t[8]!==s||t[9]!==r||t[10]!==u?(v=()=>{let e=f.current;if(!e)return;let t=!0,i=new AbortController;return y(n,(r||`text`).toLowerCase(),{signal:i.signal,priority:`visible`}).then(n=>{!t||!e||!n||(e.innerHTML=n,I(e,u,s))}),()=>{t=!1,i.abort()}},C=[n,r,u,s],t[7]=n,t[8]=s,t[9]=r,t[10]=u,t[11]=v,t[12]=C):(v=t[11],C=t[12]),b.useEffect(v,C);let w;t[13]===i?w=t[14]:(w=o(`typography-code`,i),t[13]=i,t[14]=w);let T=m,E;t[15]!==a||t[16]!==T?(E={...T,...a},t[15]=a,t[16]=T,t[17]=E):E=t[17];let D;return t[18]!==w||t[19]!==E?(D=(0,S.jsx)(`div`,{ref:f,className:w,style:E}),t[18]=w,t[19]=E,t[20]=D):D=t[20],D},z=e=>{let t=e.replace(/^<file>\s*\n?/,``).replace(/\n?<\/file>\s*$/,``);return t=t.replace(/^\s*\d{5}\|\s?/gm,``),t.trim()},B=(e,t=``)=>{if(typeof e==`string`)return e;if(e==null)return t;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e);try{return JSON.stringify(e)}catch{return t}},V=e=>e?e.includes(`<diagnostics`)||e.includes(`<file_diagnostics>`)||e.includes(`LSP errors detected`)||e.includes(`This file has errors`):!1,H=e=>e?e.replace(/\n{0,2}LSP errors detected[\s\S]*?<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/\n{0,2}This file has errors[\s\S]*?<\/file_diagnostics>/g,``).replace(/<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/<file_diagnostics>[\s\S]*?<\/file_diagnostics>/g,``).trim():``,U=(e,t)=>!e||typeof e!=`object`?String(e):h(e,t||``),W=e=>{if(typeof e==`string`){let t=e.trim();return t.length>0?t:void 0}if(e&&typeof e==`object`){let t=e.patch;if(typeof t==`string`){let e=t.trim();return e.length>0?e:void 0}}},G=e=>{if(!e||typeof e!=`object`)return;let t=W(e.patch)??W(e.diff);if(t)return t;let n=Array.isArray(e.files)?e.files:[];for(let e of n){if(!e||typeof e!=`object`)continue;let t=W(e.patch)??W(e.diff);if(t)return t}},K=e=>{if(!e||typeof e!=`string`)return{data:null,isJson:!1};let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`)||!t.endsWith(`}`)&&!t.endsWith(`]`)||t.length<2)return{data:null,isJson:!1};try{let e=JSON.parse(t);return typeof e==`object`&&e?{data:e,isJson:!0}:{data:null,isJson:!1}}catch{return{data:null,isJson:!1}}},q=(e,t,n)=>{let r=z(e);if((t===`edit`||t===`multiedit`||t===`write`||t===`apply_patch`)&&V(r)&&(r=H(r)),(t===`edit`||t===`multiedit`||t===`apply_patch`)&&r.trim().length===0){let e=G(n);if(e)return e}return r},se=e=>{let t=e.match(/<type>(file|directory)<\/type>/i)?.[1]?.toLowerCase()??`unknown`,n=(e.match(/<content>([\s\S]*?)<\/content>/i)?.[1]??e).replace(/\r\n/g,`
|
|
2
2
|
`).split(`
|
|
3
3
|
`),r=e=>/\(\s*File has more lines\..*offset.*\)/i.test(e.trim());return{type:t,lines:n.map(e=>{let n=e.trim(),i=n.startsWith(`(`)&&n.endsWith(`)`)||r(n);if(t!==`directory`){let t=e.match(/^(\d+):\s?(.*)$/);if(t){let e=t[2],n=e.trim(),i=n.startsWith(`(`)&&n.endsWith(`)`)||r(n);return{lineNumber:i?null:Number(t[1]),text:e,isInfo:i}}}return{lineNumber:null,text:e,isInfo:i}}).filter((e,t,n)=>{if(e.text.trim().length>0)return!0;let r=n[t-1],i=n[t+1],a=!!(r?.isInfo||i?.isInfo),o=e.lineNumber!==null;return!(a&&o)})}},ce=(e,t)=>{try{let n=e.trim().split(`
|
|
4
4
|
`).filter(Boolean);if(n.length===0)return null;let i=[];return n.forEach(e=>{let t=e.match(/^(\s*)(.+)$/);if(t){let[,e,n]=t,r=Math.floor(e.length/2),a=!n.endsWith(`/`);i.push({name:n.replace(/\/$/,``),depth:r,isFile:a})}}),(0,S.jsx)(`div`,{className:o(`w-full min-w-0 font-mono space-y-0.5`,t?.unstyled?null:`p-3 bg-muted/20 rounded-xl border border-border/30`),style:r.tool.popup,children:i.map((e,t)=>(0,S.jsx)(`div`,{className:`min-w-0`,style:{paddingLeft:`${e.depth*20}px`},children:e.isFile?(0,S.jsx)(`span`,{className:`text-foreground/90 block truncate`,children:e.name}):(0,S.jsxs)(`span`,{className:`font-semibold text-foreground block truncate`,children:[e.name,`/`]})},t))})}catch{return null}},le={backgroundColor:`var(--status-info)`,opacity:.6},ue=(e,t,n)=>{try{let i=e.trim().split(`
|
package/dist/index.html
CHANGED
|
@@ -560,7 +560,7 @@
|
|
|
560
560
|
opacity: 0.72;
|
|
561
561
|
}
|
|
562
562
|
</style>
|
|
563
|
-
<script type="module" crossorigin src="/assets/main-
|
|
563
|
+
<script type="module" crossorigin src="/assets/main-DSa1W5SA.js"></script>
|
|
564
564
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
565
565
|
<link rel="modulepreload" crossorigin href="/assets/runtime-auth-ef9W7A43.js">
|
|
566
566
|
<link rel="modulepreload" crossorigin href="/assets/runtime-switch-CAZiOV2G.js">
|
|
@@ -588,10 +588,10 @@
|
|
|
588
588
|
<link rel="modulepreload" crossorigin href="/assets/platform-CxNhofMC.js">
|
|
589
589
|
<link rel="modulepreload" crossorigin href="/assets/terminalApi-Bs5skvIp.js">
|
|
590
590
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-CwMwe_O9.js">
|
|
591
|
-
<link rel="modulepreload" crossorigin href="/assets/types-
|
|
592
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
593
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
594
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
591
|
+
<link rel="modulepreload" crossorigin href="/assets/types-DoaGaihV.js">
|
|
592
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-3Uy_m4Za.js">
|
|
593
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-BU8ochmh.js">
|
|
594
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-xiF5snk3.js">
|
|
595
595
|
<link rel="stylesheet" crossorigin href="/assets/src-CZA3gFyl.css">
|
|
596
596
|
</head>
|
|
597
597
|
<body class="h-full bg-background text-foreground">
|
package/dist/mini-chat.html
CHANGED
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
}
|
|
75
75
|
</style>
|
|
76
76
|
|
|
77
|
-
<script type="module" crossorigin src="/assets/miniChat-
|
|
77
|
+
<script type="module" crossorigin src="/assets/miniChat-DcG2PyMu.js"></script>
|
|
78
78
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
79
79
|
<link rel="modulepreload" crossorigin href="/assets/runtime-auth-ef9W7A43.js">
|
|
80
80
|
<link rel="modulepreload" crossorigin href="/assets/runtime-switch-CAZiOV2G.js">
|
|
@@ -102,10 +102,10 @@
|
|
|
102
102
|
<link rel="modulepreload" crossorigin href="/assets/platform-CxNhofMC.js">
|
|
103
103
|
<link rel="modulepreload" crossorigin href="/assets/terminalApi-Bs5skvIp.js">
|
|
104
104
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-CwMwe_O9.js">
|
|
105
|
-
<link rel="modulepreload" crossorigin href="/assets/types-
|
|
106
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
107
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
108
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
105
|
+
<link rel="modulepreload" crossorigin href="/assets/types-DoaGaihV.js">
|
|
106
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-3Uy_m4Za.js">
|
|
107
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-BU8ochmh.js">
|
|
108
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-xiF5snk3.js">
|
|
109
109
|
<link rel="stylesheet" crossorigin href="/assets/src-CZA3gFyl.css">
|
|
110
110
|
</head>
|
|
111
111
|
<body class="h-full bg-background text-foreground">
|
package/dist/mobile.html
CHANGED
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
})();
|
|
64
64
|
</script>
|
|
65
65
|
|
|
66
|
-
<script type="module" crossorigin src="/assets/mobile-
|
|
66
|
+
<script type="module" crossorigin src="/assets/mobile-DGUDmzLl.js"></script>
|
|
67
67
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
68
68
|
<link rel="modulepreload" crossorigin href="/assets/runtime-auth-ef9W7A43.js">
|
|
69
69
|
<link rel="modulepreload" crossorigin href="/assets/runtime-switch-CAZiOV2G.js">
|
|
@@ -91,10 +91,10 @@
|
|
|
91
91
|
<link rel="modulepreload" crossorigin href="/assets/platform-CxNhofMC.js">
|
|
92
92
|
<link rel="modulepreload" crossorigin href="/assets/terminalApi-Bs5skvIp.js">
|
|
93
93
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-CwMwe_O9.js">
|
|
94
|
-
<link rel="modulepreload" crossorigin href="/assets/types-
|
|
95
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
96
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
97
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
94
|
+
<link rel="modulepreload" crossorigin href="/assets/types-DoaGaihV.js">
|
|
95
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-3Uy_m4Za.js">
|
|
96
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-BU8ochmh.js">
|
|
97
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-xiF5snk3.js">
|
|
98
98
|
<link rel="stylesheet" crossorigin href="/assets/src-CZA3gFyl.css">
|
|
99
99
|
</head>
|
|
100
100
|
<body class="h-full bg-background text-foreground">
|
package/package.json
CHANGED
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
The Host owns `content-search.sqlite` alongside the session index. This index is
|
|
4
4
|
independent of browser transcript caches and includes all projects exposed by the
|
|
5
5
|
active OpenCode runtime. `session.list` is called without a project/directory
|
|
6
|
-
filter
|
|
6
|
+
filter during initial backfill; descending opaque cursors stop at the thirty-day
|
|
7
|
+
boundary or exhaustion. The default coverage is
|
|
7
8
|
messages created in the last thirty days in recently updated root sessions.
|
|
8
9
|
Sessions with a non-empty `parentID` (subagents) are excluded before message
|
|
9
10
|
fetching and progress counting. Only root IDs enter the authoritative pruning
|
|
10
|
-
set, so a
|
|
11
|
+
set, so a fully exhausted catalog scan also removes previously indexed subagent
|
|
11
12
|
messages, FTS entries and checkpoints. Failed catalog reads preserve the old index.
|
|
12
13
|
|
|
13
14
|
Two workers page native `message.list` directly, normalize via the shared server
|
|
@@ -31,12 +32,13 @@ and checkpoint until a complete replacement succeeds.
|
|
|
31
32
|
`search_coverage` durably records each runtime's `indexStartedAt`,
|
|
32
33
|
`indexCompletedAt`, `coveredSince`, and `verifiedAt`. These are index operation
|
|
33
34
|
timestamps, not installation/version timestamps or browser onboarding flags.
|
|
34
|
-
An absent completion marker requires initialization.
|
|
35
|
-
the
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
An absent completion marker requires initialization. A completed runtime does not
|
|
36
|
+
walk the catalog on startup or on a timer. It resumes only the durable dirty-session
|
|
37
|
+
queue populated by live events. Each dirty session is read by ID and refreshes its
|
|
38
|
+
own messages; unrelated sessions incur no upstream work. Initialization failures
|
|
39
|
+
retry using committed per-session checkpoints. Explicit `sync()` remains deliberate
|
|
40
|
+
catalog reconciliation; automatic scheduling uses incremental mode.
|
|
41
|
+
Already verified unchanged sessions are reused, including
|
|
40
42
|
sessions with no searchable text. Each session now commits an `indexed_at`
|
|
41
43
|
completion timestamp atomically with its projection, source update time and
|
|
42
44
|
coverage boundary. Existing databases gain this nullable column and the coverage
|
|
@@ -60,7 +62,7 @@ coverage (for example after a system-clock correction).
|
|
|
60
62
|
The status response adds `initializationRequired` and these durable timestamps.
|
|
61
63
|
`updatedAt` remains the current process's latest completed pass, including partial
|
|
62
64
|
passes; clients must not confuse it with successful durable completion. A warm
|
|
63
|
-
startup may be `pending` with `initializationRequired: false`;
|
|
65
|
+
startup may be `pending` with `initializationRequired: false`; queued dirty sessions
|
|
64
66
|
remain background work. `initializationRequired` indicates unfinished first-time
|
|
65
67
|
initialization, not whether the latest incremental pass has caught up. No
|
|
66
68
|
UI-triggered import or OpenCode database conversion is needed:
|
|
@@ -80,8 +82,12 @@ dismissal; runtime changes recheck. Older Hosts without the new status fields
|
|
|
80
82
|
keep their existing behavior. VS Code's direct OpenCode connection has no Host
|
|
81
83
|
FTS service and does not mount this step.
|
|
82
84
|
|
|
83
|
-
Global upstream events mark sessions dirty and coalesce
|
|
84
|
-
|
|
85
|
+
Global upstream events durably mark sessions dirty and coalesce work within one
|
|
86
|
+
second. Successful writes acknowledge only the captured dirty revision, so an event
|
|
87
|
+
during the fetch survives for another pass. Thirty-second retries are scheduled
|
|
88
|
+
only for unfinished initialization or pending dirty sessions, never idle catalog
|
|
89
|
+
polling. Deleted-session events and confirmed 404 remove that session; a time-bounded
|
|
90
|
+
catalog is not authoritative absence for unvisited IDs. Indexing does not depend on
|
|
85
91
|
any UI session being opened. Runtime identity is owned by the Host session index;
|
|
86
92
|
in-flight results are rejected if it changes. Stop aborts reads and drains the
|
|
87
93
|
active pass before closing SQLite.
|
|
@@ -7,6 +7,7 @@ export function createGlobalContentSearch({ dataDir, getRuntimeKey, buildOpenCod
|
|
|
7
7
|
const service = createContentSearchService({ dbPath: path.join(dataDir, 'content-search.sqlite') });
|
|
8
8
|
const client = () => makeOpenCodeV2Client({ baseUrl: buildOpenCodeUrl('/', ''), authHeaders: getOpenCodeAuthHeaders() });
|
|
9
9
|
const runtime = createContentSearchRuntime({ service, getRuntimeKey,
|
|
10
|
+
getSession: ({ sessionID, signal }) => client().session.get({ sessionID }, { signal: AbortSignal.any([signal, AbortSignal.timeout(30_000)]) }),
|
|
10
11
|
listSessions: async ({ signal, ...query }) => {
|
|
11
12
|
await waitForReady();
|
|
12
13
|
return client().session.list(query, { signal: AbortSignal.any([signal, AbortSignal.timeout(30_000)]) });
|
|
@@ -5,7 +5,7 @@ import { normalizeSessionEventType } from '../session-metadata/session-projectio
|
|
|
5
5
|
const RETENTION = 30 * 24 * 60 * 60 * 1000;
|
|
6
6
|
const nextCursor = (page) => typeof page?.cursor?.next === 'string' ? page.cursor.next : null;
|
|
7
7
|
|
|
8
|
-
export function createContentSearchRuntime({ service, getRuntimeKey, listSessions, listMessages, now = Date.now }) {
|
|
8
|
+
export function createContentSearchRuntime({ service, getRuntimeKey, listSessions, getSession, listMessages, now = Date.now }) {
|
|
9
9
|
let stopped = false;
|
|
10
10
|
let flight;
|
|
11
11
|
let timer;
|
|
@@ -16,11 +16,12 @@ export function createContentSearchRuntime({ service, getRuntimeKey, listSession
|
|
|
16
16
|
const deleted = new Set();
|
|
17
17
|
const status = () => {
|
|
18
18
|
const runtime = getRuntimeKey();
|
|
19
|
+
if (!stopped && state.runtime !== runtime) schedule(0);
|
|
19
20
|
const coverage = service.coverage(runtime);
|
|
20
21
|
return { ...(state.runtime === runtime ? state : { runtime, phase: 'pending', since: now() - RETENTION, total: 0, completed: 0, failed: 0, updatedAt: null }),
|
|
21
22
|
...coverage, initializationRequired: coverage.indexCompletedAt === null, ...service.stats(runtime) };
|
|
22
23
|
};
|
|
23
|
-
const sync = () => {
|
|
24
|
+
const sync = ({ incremental = false } = {}) => {
|
|
24
25
|
if (stopped) return Promise.resolve();
|
|
25
26
|
if (flight) return flight;
|
|
26
27
|
const runtime = getRuntimeKey();
|
|
@@ -32,13 +33,37 @@ export function createContentSearchRuntime({ service, getRuntimeKey, listSession
|
|
|
32
33
|
state = { runtime, phase: previous ? 'ready' : 'indexing', since: now() - RETENTION, total: state.total, completed: 0, failed: 0, updatedAt: previous };
|
|
33
34
|
flight = (async () => {
|
|
34
35
|
if (service.coverage(runtime).indexCompletedAt === null) service.beginInitialization(runtime, now());
|
|
36
|
+
const revisions = new Map(service.pending(runtime).map(({ id, revision }) => [id, revision]));
|
|
37
|
+
for (const id of revisions.keys()) dirty.add(id);
|
|
35
38
|
const pendingDirty = new Set(dirty);
|
|
39
|
+
const initialized = service.coverage(runtime).indexCompletedAt !== null;
|
|
40
|
+
const scanCatalog = !incremental || !initialized;
|
|
36
41
|
const sessions = [];
|
|
37
42
|
const ids = new Set();
|
|
38
43
|
let cursor;
|
|
44
|
+
let completeCatalog = scanCatalog;
|
|
39
45
|
const cursors = new Set();
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
if (!scanCatalog) {
|
|
47
|
+
for (const sessionID of pendingDirty) {
|
|
48
|
+
try {
|
|
49
|
+
const session = await getSession({ sessionID, signal });
|
|
50
|
+
if (!current()) return;
|
|
51
|
+
if (!session?.id || !Number.isFinite(session.time?.updated)) throw new Error('Invalid dirty session');
|
|
52
|
+
if (!session.parentID && session.time.updated >= state.since && !deleted.has(sessionID)) sessions.push(session);
|
|
53
|
+
else {
|
|
54
|
+
service.removeSession(runtime, sessionID);
|
|
55
|
+
dirty.delete(sessionID);
|
|
56
|
+
}
|
|
57
|
+
} catch (error) {
|
|
58
|
+
if (!current()) return;
|
|
59
|
+
if ((error?.status ?? error?.response?.status) === 404) {
|
|
60
|
+
service.removeSession(runtime, sessionID);
|
|
61
|
+
dirty.delete(sessionID);
|
|
62
|
+
} else state.failed++;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
} else do {
|
|
66
|
+
const page = await listSessions({ limit: 100, ...(cursor ? { cursor } : { order: 'desc' }), signal });
|
|
42
67
|
if (!current()) return;
|
|
43
68
|
if (!Array.isArray(page?.data)) throw new Error('Invalid global session page');
|
|
44
69
|
for (const session of page.data) {
|
|
@@ -51,11 +76,18 @@ export function createContentSearchRuntime({ service, getRuntimeKey, listSession
|
|
|
51
76
|
cursor = nextCursor(page);
|
|
52
77
|
if (cursor && cursors.has(cursor)) throw new Error('Repeated session cursor');
|
|
53
78
|
if (cursor) cursors.add(cursor);
|
|
79
|
+
if (page.data.some((session) => session.time.updated < state.since)) {
|
|
80
|
+
completeCatalog = !cursor;
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
54
83
|
} while (cursor && current());
|
|
55
84
|
state.total = sessions.length;
|
|
56
85
|
state.completed = 0;
|
|
57
86
|
const recentIDs = new Set(sessions.map((session) => session.id));
|
|
58
|
-
for (const id of pendingDirty) if (!recentIDs.has(id))
|
|
87
|
+
if (scanCatalog && completeCatalog) for (const id of pendingDirty) if (!recentIDs.has(id)) {
|
|
88
|
+
dirty.delete(id);
|
|
89
|
+
service.acknowledge(runtime, id, revisions.get(id));
|
|
90
|
+
}
|
|
59
91
|
if (service.coverage(runtime).indexCompletedAt === null) state.phase = 'indexing';
|
|
60
92
|
let index = 0;
|
|
61
93
|
const worker = async () => {
|
|
@@ -85,7 +117,10 @@ export function createContentSearchRuntime({ service, getRuntimeKey, listSession
|
|
|
85
117
|
// Native pages are newest-first, including control records.
|
|
86
118
|
if (page.data.length && page.data.every((record) => Number(record.time?.created) < state.since)) break;
|
|
87
119
|
} while (before && current());
|
|
88
|
-
if (current() && !deleted.has(session.id))
|
|
120
|
+
if (current() && !deleted.has(session.id)) {
|
|
121
|
+
service.replaceSession(runtime, session, [...records.values()], state.since, now());
|
|
122
|
+
if (revisions.has(session.id)) service.acknowledge(runtime, session.id, revisions.get(session.id));
|
|
123
|
+
}
|
|
89
124
|
state.completed++;
|
|
90
125
|
} catch {
|
|
91
126
|
if (!current()) return;
|
|
@@ -96,7 +131,7 @@ export function createContentSearchRuntime({ service, getRuntimeKey, listSession
|
|
|
96
131
|
};
|
|
97
132
|
await Promise.all([worker(), worker()]);
|
|
98
133
|
if (current()) {
|
|
99
|
-
service.prune(runtime, state.since, ids);
|
|
134
|
+
service.prune(runtime, state.since, completeCatalog ? ids : undefined);
|
|
100
135
|
state.phase = state.failed ? 'partial' : 'ready';
|
|
101
136
|
state.updatedAt = now();
|
|
102
137
|
if (!state.failed && !dirty.size) service.completeInitialization(runtime, state.since, state.updatedAt);
|
|
@@ -110,7 +145,11 @@ export function createContentSearchRuntime({ service, getRuntimeKey, listSession
|
|
|
110
145
|
if (stopped || (timer && due <= Date.now() + delay)) return;
|
|
111
146
|
if (timer) clearTimeout(timer);
|
|
112
147
|
due = Date.now() + delay;
|
|
113
|
-
timer = setTimeout(async () => {
|
|
148
|
+
timer = setTimeout(async () => {
|
|
149
|
+
timer = undefined;
|
|
150
|
+
await sync({ incremental: true });
|
|
151
|
+
if (service.coverage(getRuntimeKey()).indexCompletedAt === null || service.pending(getRuntimeKey()).length) schedule(30_000);
|
|
152
|
+
}, delay);
|
|
114
153
|
timer.unref?.();
|
|
115
154
|
};
|
|
116
155
|
return {
|
|
@@ -118,6 +157,7 @@ export function createContentSearchRuntime({ service, getRuntimeKey, listSession
|
|
|
118
157
|
start() { schedule(0); },
|
|
119
158
|
observe(event) {
|
|
120
159
|
if (event.runtimeIdentity?.runtimeKey && event.runtimeIdentity.runtimeKey !== getRuntimeKey()) return;
|
|
160
|
+
if (state.runtime !== getRuntimeKey()) schedule(0);
|
|
121
161
|
const payload = event.payload?.payload ?? event.payload;
|
|
122
162
|
const type = normalizeSessionEventType(payload?.type ?? '');
|
|
123
163
|
if (!(type.startsWith('message.') || type.startsWith('session.'))) return;
|
|
@@ -125,7 +165,8 @@ export function createContentSearchRuntime({ service, getRuntimeKey, listSession
|
|
|
125
165
|
const data = payload.properties ?? payload.data ?? {};
|
|
126
166
|
const id = data.sessionID ?? data.info?.sessionID ?? data.session?.id ?? (type.startsWith('session.') ? data.id ?? data.info?.id : undefined);
|
|
127
167
|
if (id && type === 'session.deleted') { dirty.delete(id); deleted.add(id); service.removeSession(getRuntimeKey(), id); }
|
|
128
|
-
else if (id) dirty.add(id);
|
|
168
|
+
else if (id) { dirty.add(id); service.markDirty(getRuntimeKey(), id); }
|
|
169
|
+
if (!id) return;
|
|
129
170
|
// Coalesce bursts; ongoing scans retain dirty IDs for the next pass.
|
|
130
171
|
schedule(1000);
|
|
131
172
|
},
|
|
@@ -1,7 +1,78 @@
|
|
|
1
|
-
import { expect, test } from 'vitest';
|
|
1
|
+
import { expect, test, vi } from 'vitest';
|
|
2
2
|
import { createContentSearchService } from './service.js';
|
|
3
3
|
import { createContentSearchRuntime } from './runtime.js';
|
|
4
4
|
|
|
5
|
+
test('warm startup and idle time do not scan history; durable dirty events refresh only their session', async () => {
|
|
6
|
+
vi.useFakeTimers();
|
|
7
|
+
const service = createContentSearchService({ dbPath: ':memory:' });
|
|
8
|
+
service.beginInitialization('host', 1);
|
|
9
|
+
service.completeInitialization('host', 0, 2);
|
|
10
|
+
const listSessions = vi.fn(async () => ({ data: [], cursor: {} }));
|
|
11
|
+
const getSession = vi.fn(async ({ sessionID }) => ({ id: sessionID, time: { updated: Date.now() } }));
|
|
12
|
+
const listMessages = vi.fn(async () => ({ data: [], cursor: {} }));
|
|
13
|
+
let runtime = createContentSearchRuntime({ service, getRuntimeKey: () => 'host', listSessions, getSession, listMessages });
|
|
14
|
+
try {
|
|
15
|
+
runtime.start();
|
|
16
|
+
await vi.advanceTimersByTimeAsync(120_000);
|
|
17
|
+
expect(listSessions).not.toHaveBeenCalled();
|
|
18
|
+
expect(listMessages).not.toHaveBeenCalled();
|
|
19
|
+
runtime.observe({ payload: { type: 'message.updated', data: { sessionID: 'one' } } });
|
|
20
|
+
await runtime.stop();
|
|
21
|
+
runtime = createContentSearchRuntime({ service, getRuntimeKey: () => 'host', listSessions, getSession, listMessages });
|
|
22
|
+
runtime.start();
|
|
23
|
+
await vi.advanceTimersByTimeAsync(120_000);
|
|
24
|
+
expect(listSessions).not.toHaveBeenCalled();
|
|
25
|
+
expect(getSession).toHaveBeenCalledTimes(1);
|
|
26
|
+
expect(getSession.mock.calls[0][0].sessionID).toBe('one');
|
|
27
|
+
expect(listMessages).toHaveBeenCalledTimes(1);
|
|
28
|
+
} finally { await runtime.stop(); service.close(); vi.useRealTimers(); }
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('initial history stops at thirty days without pruning unseen sessions as deleted', async () => {
|
|
32
|
+
const service = createContentSearchService({ dbPath: ':memory:' });
|
|
33
|
+
const day = 86400000;
|
|
34
|
+
const now = 40 * day;
|
|
35
|
+
service.replaceSession('host', { id: 'unseen', time: { updated: now } }, [], 0);
|
|
36
|
+
const listSessions = vi.fn(async () => ({ data: [
|
|
37
|
+
{ id: 'recent', time: { updated: now } },
|
|
38
|
+
{ id: 'old', time: { updated: now - 31 * day } },
|
|
39
|
+
], cursor: { next: 'older-history' } }));
|
|
40
|
+
const listMessages = vi.fn(async () => ({ data: [], cursor: {} }));
|
|
41
|
+
const runtime = createContentSearchRuntime({ service, getRuntimeKey: () => 'host', now: () => now, listSessions, listMessages });
|
|
42
|
+
try {
|
|
43
|
+
await runtime.sync();
|
|
44
|
+
expect(listSessions).toHaveBeenCalledTimes(1);
|
|
45
|
+
expect(listMessages).toHaveBeenCalledTimes(1);
|
|
46
|
+
expect(listMessages.mock.calls[0][0].sessionID).toBe('recent');
|
|
47
|
+
expect(service.updated('host', 'unseen')).toBe(now);
|
|
48
|
+
expect(runtime.status().initializationRequired).toBe(false);
|
|
49
|
+
} finally { await runtime.stop(); service.close(); }
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('an event received while indexing survives acknowledgement and retries only that session', async () => {
|
|
53
|
+
const service = createContentSearchService({ dbPath: ':memory:' });
|
|
54
|
+
service.beginInitialization('host', 1);
|
|
55
|
+
service.completeInitialization('host', 0, 2);
|
|
56
|
+
const listSessions = vi.fn();
|
|
57
|
+
let reads = 0;
|
|
58
|
+
const runtime = createContentSearchRuntime({ service, getRuntimeKey: () => 'host', now: () => 100,
|
|
59
|
+
listSessions, getSession: async ({ sessionID }) => ({ id: sessionID, time: { updated: 10 } }),
|
|
60
|
+
listMessages: async () => {
|
|
61
|
+
if (++reads === 1) runtime.observe({ payload: { type: 'message.updated', data: { sessionID: 's' } } });
|
|
62
|
+
return { data: [], cursor: {} };
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
try {
|
|
66
|
+
runtime.observe({ payload: { type: 'message.updated', data: { sessionID: 's' } } });
|
|
67
|
+
await runtime.sync({ incremental: true });
|
|
68
|
+
expect(service.pending('host')).toHaveLength(1);
|
|
69
|
+
await runtime.sync({ incremental: true });
|
|
70
|
+
expect(reads).toBe(2);
|
|
71
|
+
expect(service.pending('host')).toEqual([]);
|
|
72
|
+
expect(listSessions).not.toHaveBeenCalled();
|
|
73
|
+
} finally { await runtime.stop(); service.close(); }
|
|
74
|
+
});
|
|
75
|
+
|
|
5
76
|
test('indexes only roots and prunes legacy subagents after a complete catalog, including dirty children', async () => {
|
|
6
77
|
const service = createContentSearchService({ dbPath: ':memory:' });
|
|
7
78
|
const root = { id: 'root', time: { updated: 10 } };
|
|
@@ -22,6 +22,7 @@ export function createContentSearchService({ dbPath }) {
|
|
|
22
22
|
CREATE TABLE IF NOT EXISTS search_message(id INTEGER PRIMARY KEY, runtime TEXT, session TEXT, message TEXT, role TEXT, created REAL, body TEXT, UNIQUE(runtime,session,message));
|
|
23
23
|
CREATE INDEX IF NOT EXISTS search_message_scope ON search_message(runtime,session);
|
|
24
24
|
CREATE TABLE IF NOT EXISTS search_coverage(runtime TEXT PRIMARY KEY, started_at REAL NOT NULL, completed_at REAL, since REAL, verified_at REAL);
|
|
25
|
+
CREATE TABLE IF NOT EXISTS search_dirty(runtime TEXT, id TEXT, revision INTEGER NOT NULL, PRIMARY KEY(runtime,id));
|
|
25
26
|
CREATE VIRTUAL TABLE IF NOT EXISTS search_fts USING fts5(body, content='search_message', content_rowid='id', tokenize='trigram');
|
|
26
27
|
CREATE TRIGGER IF NOT EXISTS search_insert AFTER INSERT ON search_message BEGIN
|
|
27
28
|
INSERT INTO search_fts(rowid,body) VALUES(new.id,new.body); END;
|
|
@@ -40,8 +41,18 @@ export function createContentSearchService({ dbPath }) {
|
|
|
40
41
|
const removeSession = db.transaction((runtime, id) => {
|
|
41
42
|
remove.run(runtime, id);
|
|
42
43
|
db.prepare('DELETE FROM search_session WHERE runtime=? AND id=?').run(runtime, id);
|
|
44
|
+
db.prepare('DELETE FROM search_dirty WHERE runtime=? AND id=?').run(runtime, id);
|
|
43
45
|
});
|
|
44
46
|
return {
|
|
47
|
+
markDirty(runtime, id) {
|
|
48
|
+
db.prepare('INSERT INTO search_dirty(runtime,id,revision) VALUES(?,?,1) ON CONFLICT(runtime,id) DO UPDATE SET revision=revision+1').run(runtime, id);
|
|
49
|
+
},
|
|
50
|
+
pending(runtime) {
|
|
51
|
+
return db.prepare('SELECT id,revision FROM search_dirty WHERE runtime=?').all(runtime);
|
|
52
|
+
},
|
|
53
|
+
acknowledge(runtime, id, revision) {
|
|
54
|
+
return db.prepare('DELETE FROM search_dirty WHERE runtime=? AND id=? AND revision=?').run(runtime, id, revision).changes > 0;
|
|
55
|
+
},
|
|
45
56
|
coverage(runtime) {
|
|
46
57
|
return db.prepare('SELECT started_at AS indexStartedAt, completed_at AS indexCompletedAt, since AS coveredSince, verified_at AS verifiedAt FROM search_coverage WHERE runtime=?').get(runtime)
|
|
47
58
|
?? { indexStartedAt: null, indexCompletedAt: null, coveredSince: null, verifiedAt: null };
|
|
@@ -73,7 +84,7 @@ export function createContentSearchService({ dbPath }) {
|
|
|
73
84
|
prune: db.transaction((runtime, since, ids) => {
|
|
74
85
|
db.prepare('DELETE FROM search_message WHERE runtime=? AND created<?').run(runtime, since);
|
|
75
86
|
db.prepare('UPDATE search_session SET since=MAX(since,?) WHERE runtime=? AND since IS NOT NULL').run(since, runtime);
|
|
76
|
-
for (const row of db.prepare('SELECT id FROM search_session WHERE runtime=?').all(runtime)) {
|
|
87
|
+
if (ids) for (const row of db.prepare('SELECT id FROM search_session WHERE runtime=?').all(runtime)) {
|
|
77
88
|
if (!ids.has(row.id)) removeSession(runtime, row.id);
|
|
78
89
|
}
|
|
79
90
|
}),
|