@yuriai/web 0.2.0-beta.4 → 0.2.0-beta.6
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/{AgentAvatar-k7s0gPMz.js → AgentAvatar-DtMkzQZ_.js} +1 -1
- package/dist/assets/{AssistantView-AVEdhX2E.js → AssistantView-CH8_c8hM.js} +3 -3
- package/dist/assets/DiagramView-CEK78uU2.js +1 -0
- package/dist/assets/{FadeInOnReveal-DuelAGXz.js → FadeInOnReveal-TjU_WL37.js} +1 -1
- package/dist/assets/{GuiPluginSurface-Clv5w8qE.js → GuiPluginSurface-Cm4QyBLo.js} +1 -1
- package/dist/assets/{GuiPluginWindow-BHbqKl7P.js → GuiPluginWindow-DWD2MAyQ.js} +1 -1
- package/dist/assets/{Icon-BX4GW-k_.js → Icon-giRdbrNf.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-OnlbaJBG.js → ImageLoadingPlaceholder-iyU1QhoP.js} +1 -1
- package/dist/assets/{LoadingImage-DDEN3tpH.js → LoadingImage-C7a7GyLc.js} +1 -1
- package/dist/assets/MarkdownRenderer-Dx_OlkJC.js +2 -0
- package/dist/assets/{MarkdownRendererImpl-BUhSSjjo.js → MarkdownRendererImpl-1Hjd-zSW.js} +1 -1
- package/dist/assets/MarkstreamRendererImpl-C4MyKG9L.js +3 -0
- package/dist/assets/{MobileDetailNavigation-CtYXRw3B.js → MobileDetailNavigation-CAxWWuuz.js} +1 -1
- package/dist/assets/{MobileResizableSheet-THVjYOSA.js → MobileResizableSheet-inQgquPH.js} +1 -1
- package/dist/assets/MobileShareBridge-RRbG1OeH.js +4 -0
- package/dist/assets/MobileTabPageHeader-CG-Or7Lk.js +2 -0
- package/dist/assets/{MultiRunWindow-9DdpcXYS.js → MultiRunWindow-BXC_UiJz.js} +1 -1
- package/dist/assets/OnboardingScreen-B4FMt-Wd.js +1 -0
- package/dist/assets/{OverlayScrollbar-C-Od80p5.js → OverlayScrollbar-DJDdcmwv.js} +1 -1
- package/dist/assets/SettingsView-0wt2B8lv.js +26 -0
- package/dist/assets/{SettingsWindow-Cgnhlx6v.js → SettingsWindow-0IifiXpI.js} +1 -1
- package/dist/assets/TerminalView-Dmnh-0xP.js +8 -0
- package/dist/assets/{ToolOutputDialog-Cy30GA5T.js → ToolOutputDialog-Dwdyj0sf.js} +1 -1
- package/dist/assets/{YuriLogo-DvKVga_x.js → YuriLogo-BqA0pCyD.js} +1 -1
- package/dist/assets/{appThemeRegistry-q9ZHhYPY.js → appThemeRegistry-DE1bgMts.js} +1 -1
- package/dist/assets/{assistant-attachment-cache-BIxi1vPM.js → assistant-attachment-cache-tZmmQ6I2.js} +1 -1
- package/dist/assets/button-D6gHjV_f.js +1 -0
- package/dist/assets/{capgoAdapter-ClmWgQsn.js → capgoAdapter-Du233f4X.js} +1 -1
- package/dist/assets/{collapsible-BT03pxhm.js → collapsible-CnA0u5S9.js} +1 -1
- package/dist/assets/desktop-DpAcrF1h.js +1 -0
- package/dist/assets/desktopHosts-CjH4TGh8.js +1 -0
- package/dist/assets/desktopRelayRestore-BLJo3sm7.js +1 -0
- package/dist/assets/device-Dw1mUG7s.js +2 -0
- package/dist/assets/{diagram-1AdssMXJ.js → diagram-DwYOPB42.js} +1 -1
- package/dist/assets/{dialog-DLc0nKV7.js → dialog-D6iTQ8x_.js} +1 -1
- package/dist/assets/{dropdown-menu.styles-B-E_v3QZ.js → dropdown-menu.styles-BSUw0erN.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-C5fQjVCV.js → fileMentionTouchSelection-BMV-bn7Y.js} +2 -2
- package/dist/assets/{path-utils-QNmCUIdP.js → fileQueries-QvEzQ4wT.js} +1 -1
- package/dist/assets/fileReferenceActions-DuYvTiGf.js +1 -0
- package/dist/assets/{fileReferenceParser-D6pFtXag.js → fileReferenceParser-1HHDBUum.js} +1 -1
- package/dist/assets/{gitApi-DL9TCObI.js → gitApi-BmehlssB.js} +1 -1
- package/dist/assets/host-srMXY66T.js +1 -0
- package/dist/assets/{image-loading-ClwkpTt4.js → image-loading-2rgFmXBb.js} +1 -1
- package/dist/assets/{input-BhopRvzu.js → input-BJ-BM-aV.js} +1 -1
- package/dist/assets/insertionBoundaries-Cmswpm95.js +1 -0
- package/dist/assets/main-C1CRhrXG.js +2 -0
- package/dist/assets/main-ujyhnnF8.js +169 -0
- package/dist/assets/{markdownHeightCache-Ci4Phpkv.js → markdownHeightCache-BWX84Di3.js} +1 -1
- package/dist/assets/{mcpQueries-Am1xehao.js → mcpQueries-DxUPMkbb.js} +1 -1
- package/dist/assets/miniChat-AKE2TE9Q.js +2 -0
- package/dist/assets/mobile-CTw9gT8g.js +2 -0
- package/dist/assets/{mobileBackNavigation-BjN2y4on.js → mobileBackNavigation-DnZfGb2B.js} +1 -1
- package/dist/assets/multirun-B5Zo52zR.js +3 -0
- package/dist/assets/{native-config-6ZcbOTlU.js → native-config-ENXrGGmj.js} +1 -1
- package/dist/assets/path-utils-jGozTg9d.js +1 -0
- package/dist/assets/persistence-D-W3L37Z.js +3 -0
- package/dist/assets/platform-BtuVsKCV.js +7 -0
- package/dist/assets/{projectMeta-Bh_8p-5O.js → projectMeta-Enda95EO.js} +1 -1
- package/dist/assets/{readiness-6dRSpsKU.js → readiness-Dwu9ibRz.js} +1 -1
- package/dist/assets/renderElectronMiniChatApp-DoD-e7GD.js +2 -0
- package/dist/assets/renderMobileApp-C5zsgozh.js +28 -0
- package/dist/assets/{runtime-file-download-CwMwe_O9.js → runtime-file-download-BHIiwnLA.js} +1 -1
- package/dist/assets/runtime-file-resource-4US6DwDy.js +2 -0
- package/dist/assets/runtimeConfig-DdBn2mS5.js +2 -0
- package/dist/assets/runtimeEndpointReset-DOpGxDiO.js +149 -0
- package/dist/assets/{scheduledTaskNavigation-CE4sIXxf.js → scheduledTaskNavigation-935X_XS3.js} +1 -1
- package/dist/assets/sessionChangeSummary-DHaY-qPt.js +1 -0
- package/dist/assets/{sessionLookup-EBl9PXiP.js → sessionLookup-CAQ02JfI.js} +1 -1
- package/dist/assets/{sortable-tabs-strip-dKp0SH4C.js → sortable-tabs-strip-BH5E9ABJ.js} +1 -1
- package/dist/assets/speechSettingsQueries-BE4xY8Sj.js +4 -0
- package/dist/assets/{terminalApi-Bs5skvIp.js → terminalApi-DBa-4CzM.js} +1 -1
- package/dist/assets/{textarea-CaGuTnhs.js → textarea-COmti5oi.js} +1 -1
- package/dist/assets/{tooltip-Bxj4llmx.js → tooltip-DoKFlr59.js} +1 -1
- package/dist/assets/{types-aeu41u0o.js → types-CJYCyR67.js} +1 -1
- package/dist/assets/{useAppFontEffects-By2DRO_9.js → useAppFontEffects-Cl46KRzc.js} +29 -29
- package/dist/assets/useDesktopWindowControlsLayout-B-FL8O38.js +1 -0
- package/dist/assets/{useEffectiveDirectory-C5E5H7K7.js → useEffectiveDirectory-CVh1uKyD.js} +1 -1
- package/dist/assets/{useFontPreferences-n13Q1-rH.js → useFontPreferences-AMSPolL9.js} +1 -1
- package/dist/assets/useMobileNavigationStore-BW6CZbF_.js +417 -0
- package/dist/assets/{useWorkerHighlightedLines-5IurZLOp.js → useWorkerHighlightedLines-CSb6g4H6.js} +1 -1
- package/dist/index.html +17 -15
- package/dist/mini-chat.html +17 -15
- package/dist/mobile.html +17 -15
- package/package.json +1 -1
- package/server/index.js +1 -12
- package/server/lib/content-search/DOCUMENTATION.md +12 -2
- package/server/lib/content-search/event-ingest.integration.test.js +52 -0
- package/server/lib/content-search/event-repair.test.js +48 -0
- package/server/lib/content-search/index.js +2 -2
- package/server/lib/content-search/runtime.js +4 -4
- package/server/lib/content-search/service.js +7 -1
- package/server/lib/fs/DOCUMENTATION.md +1 -0
- package/server/lib/fs/binary-file.d.ts +3 -0
- package/server/lib/fs/binary-file.js +21 -0
- package/server/lib/fs/routes.js +1 -21
- package/server/lib/fs/routes.test.js +43 -0
- package/server/lib/opencode/lifecycle.js +19 -1
- package/server/lib/question-auto-delegate/DOCUMENTATION.md +5 -1
- package/server/lib/question-auto-delegate/core.d.ts +2 -2
- package/server/lib/question-auto-delegate/runtime.js +11 -27
- package/server/lib/question-auto-delegate/runtime.test.js +25 -0
- package/server/lib/scheduled-tasks/DOCUMENTATION.md +5 -0
- package/server/lib/scheduled-tasks/runtime.js +16 -0
- package/server/lib/scheduled-tasks/runtime.test.js +33 -0
- package/dist/assets/DiagramView-kaRtAbB8.js +0 -1
- package/dist/assets/MarkdownRenderer-BsZicwlM.js +0 -2
- package/dist/assets/MarkstreamRendererImpl-Drf8lHZM.js +0 -3
- package/dist/assets/MobileShareBridge-sU74EJ95.js +0 -4
- package/dist/assets/MobileTabPageHeader-BWhQHf6s.js +0 -2
- package/dist/assets/OnboardingScreen-BHomvleJ.js +0 -1
- package/dist/assets/SettingsView-Dm-Zxoje.js +0 -26
- package/dist/assets/TerminalView-DpkoeLoM.js +0 -8
- package/dist/assets/button-4sNruiRJ.js +0 -1
- package/dist/assets/desktopHosts-DNc_ga0E.js +0 -1
- package/dist/assets/desktopRelayRestore-BWl7Zy8M.js +0 -1
- package/dist/assets/device-B-trKdcC.js +0 -2
- package/dist/assets/fileReferenceActions-EkHzD38t.js +0 -1
- package/dist/assets/host-DeoWZHPC.js +0 -1
- package/dist/assets/insertionBoundaries-DrjyD1xA.js +0 -1
- package/dist/assets/main-1iPWY6JE.js +0 -2
- package/dist/assets/main-ClH8U0K_.js +0 -169
- package/dist/assets/miniChat-DV5fIjdE.js +0 -2
- package/dist/assets/mobile-C7hRNLd2.js +0 -2
- package/dist/assets/multirun-Dj8jiZnI.js +0 -3
- package/dist/assets/persistence-CcGnI3Ek.js +0 -3
- package/dist/assets/platform-CxNhofMC.js +0 -7
- package/dist/assets/renderElectronMiniChatApp-fvAvjcX3.js +0 -2
- package/dist/assets/renderMobileApp-J5PuS_NT.js +0 -28
- package/dist/assets/runtime-file-resource-yx0xpKe-.js +0 -2
- package/dist/assets/runtimeConfig-BndFf_Fb.js +0 -2
- package/dist/assets/runtimeEndpointReset-DlxONsUh.js +0 -149
- package/dist/assets/sessionChangeSummary-CUnP0Mge.js +0 -1
- package/dist/assets/speechSettingsQueries-CgSGK19J.js +0 -4
- package/dist/assets/useDesktopWindowControlsLayout-B9xDW29G.js +0 -1
- package/dist/assets/useMobileNavigationStore-BDW0aRpC.js +0 -417
package/dist/assets/{useWorkerHighlightedLines-5IurZLOp.js → useWorkerHighlightedLines-CSb6g4H6.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-
|
|
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-D6gHjV_f.js";import{n as c}from"./useThemeSystem-8jhE4Zyk.js";import{n as l}from"./Icon-giRdbrNf.js";import{i as u,n as d,t as f}from"./tooltip-DoKFlr59.js";import{n as p}from"./MarkdownRenderer-Dx_OlkJC.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,14 +560,19 @@
|
|
|
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-C1CRhrXG.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">
|
|
567
567
|
<link rel="modulepreload" crossorigin href="/assets/runtime-fetch-BAN5Gnnp.js">
|
|
568
568
|
<link rel="modulepreload" crossorigin href="/assets/runtimeAPIRegistry-C2VogTny.js">
|
|
569
|
+
<link rel="modulepreload" crossorigin href="/assets/desktop-DpAcrF1h.js">
|
|
570
|
+
<link rel="modulepreload" crossorigin href="/assets/desktopHosts-CjH4TGh8.js">
|
|
571
|
+
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-BLJo3sm7.js">
|
|
569
572
|
<link rel="modulepreload" crossorigin href="/assets/vendor-base-ui-CdzJ6My_.js">
|
|
570
573
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-o69pgTEK.js">
|
|
574
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-effect-DXlObQuU.js">
|
|
575
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-BcpAhe9I.js">
|
|
571
576
|
<link rel="modulepreload" crossorigin href="/assets/brand-storage-migration-Bhz6UOBJ.js">
|
|
572
577
|
<link rel="modulepreload" crossorigin href="/assets/brand-storage-bootstrap-D4BW3w-M.js">
|
|
573
578
|
<link rel="modulepreload" crossorigin href="/assets/useUIStore-NMQx_cnG.js">
|
|
@@ -576,22 +581,19 @@
|
|
|
576
581
|
<link rel="modulepreload" crossorigin href="/assets/queryRuntime-BuRnpVtK.js">
|
|
577
582
|
<link rel="modulepreload" crossorigin href="/assets/vendor-pathe-vBmvQE8f.js">
|
|
578
583
|
<link rel="modulepreload" crossorigin href="/assets/pathNormalization-ewtPqJWn.js">
|
|
579
|
-
<link rel="modulepreload" crossorigin href="/assets/persistence-
|
|
580
|
-
<link rel="modulepreload" crossorigin href="/assets/desktopHosts-DNc_ga0E.js">
|
|
581
|
-
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-BWl7Zy8M.js">
|
|
582
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-effect-DXlObQuU.js">
|
|
583
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-BcpAhe9I.js">
|
|
584
|
+
<link rel="modulepreload" crossorigin href="/assets/persistence-D-W3L37Z.js">
|
|
584
585
|
<link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-react-query-CdqCAt40.js">
|
|
585
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
586
|
+
<link rel="modulepreload" crossorigin href="/assets/fileQueries-QvEzQ4wT.js">
|
|
587
|
+
<link rel="modulepreload" crossorigin href="/assets/path-utils-jGozTg9d.js">
|
|
586
588
|
<link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
|
|
587
|
-
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-
|
|
588
|
-
<link rel="modulepreload" crossorigin href="/assets/platform-
|
|
589
|
-
<link rel="modulepreload" crossorigin href="/assets/terminalApi-
|
|
590
|
-
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-
|
|
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-
|
|
589
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-4US6DwDy.js">
|
|
590
|
+
<link rel="modulepreload" crossorigin href="/assets/platform-BtuVsKCV.js">
|
|
591
|
+
<link rel="modulepreload" crossorigin href="/assets/terminalApi-DBa-4CzM.js">
|
|
592
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-BHIiwnLA.js">
|
|
593
|
+
<link rel="modulepreload" crossorigin href="/assets/types-CJYCyR67.js">
|
|
594
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-Du233f4X.js">
|
|
595
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-ENXrGGmj.js">
|
|
596
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-DdBn2mS5.js">
|
|
595
597
|
<link rel="stylesheet" crossorigin href="/assets/src-CZA3gFyl.css">
|
|
596
598
|
</head>
|
|
597
599
|
<body class="h-full bg-background text-foreground">
|
package/dist/mini-chat.html
CHANGED
|
@@ -74,14 +74,19 @@
|
|
|
74
74
|
}
|
|
75
75
|
</style>
|
|
76
76
|
|
|
77
|
-
<script type="module" crossorigin src="/assets/miniChat-
|
|
77
|
+
<script type="module" crossorigin src="/assets/miniChat-AKE2TE9Q.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">
|
|
81
81
|
<link rel="modulepreload" crossorigin href="/assets/runtime-fetch-BAN5Gnnp.js">
|
|
82
82
|
<link rel="modulepreload" crossorigin href="/assets/runtimeAPIRegistry-C2VogTny.js">
|
|
83
|
+
<link rel="modulepreload" crossorigin href="/assets/desktop-DpAcrF1h.js">
|
|
84
|
+
<link rel="modulepreload" crossorigin href="/assets/desktopHosts-CjH4TGh8.js">
|
|
85
|
+
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-BLJo3sm7.js">
|
|
83
86
|
<link rel="modulepreload" crossorigin href="/assets/vendor-base-ui-CdzJ6My_.js">
|
|
84
87
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-o69pgTEK.js">
|
|
88
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-effect-DXlObQuU.js">
|
|
89
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-BcpAhe9I.js">
|
|
85
90
|
<link rel="modulepreload" crossorigin href="/assets/brand-storage-migration-Bhz6UOBJ.js">
|
|
86
91
|
<link rel="modulepreload" crossorigin href="/assets/brand-storage-bootstrap-D4BW3w-M.js">
|
|
87
92
|
<link rel="modulepreload" crossorigin href="/assets/useUIStore-NMQx_cnG.js">
|
|
@@ -90,22 +95,19 @@
|
|
|
90
95
|
<link rel="modulepreload" crossorigin href="/assets/queryRuntime-BuRnpVtK.js">
|
|
91
96
|
<link rel="modulepreload" crossorigin href="/assets/vendor-pathe-vBmvQE8f.js">
|
|
92
97
|
<link rel="modulepreload" crossorigin href="/assets/pathNormalization-ewtPqJWn.js">
|
|
93
|
-
<link rel="modulepreload" crossorigin href="/assets/persistence-
|
|
94
|
-
<link rel="modulepreload" crossorigin href="/assets/desktopHosts-DNc_ga0E.js">
|
|
95
|
-
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-BWl7Zy8M.js">
|
|
96
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-effect-DXlObQuU.js">
|
|
97
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-BcpAhe9I.js">
|
|
98
|
+
<link rel="modulepreload" crossorigin href="/assets/persistence-D-W3L37Z.js">
|
|
98
99
|
<link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-react-query-CdqCAt40.js">
|
|
99
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
100
|
+
<link rel="modulepreload" crossorigin href="/assets/fileQueries-QvEzQ4wT.js">
|
|
101
|
+
<link rel="modulepreload" crossorigin href="/assets/path-utils-jGozTg9d.js">
|
|
100
102
|
<link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
|
|
101
|
-
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-
|
|
102
|
-
<link rel="modulepreload" crossorigin href="/assets/platform-
|
|
103
|
-
<link rel="modulepreload" crossorigin href="/assets/terminalApi-
|
|
104
|
-
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-
|
|
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-
|
|
103
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-4US6DwDy.js">
|
|
104
|
+
<link rel="modulepreload" crossorigin href="/assets/platform-BtuVsKCV.js">
|
|
105
|
+
<link rel="modulepreload" crossorigin href="/assets/terminalApi-DBa-4CzM.js">
|
|
106
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-BHIiwnLA.js">
|
|
107
|
+
<link rel="modulepreload" crossorigin href="/assets/types-CJYCyR67.js">
|
|
108
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-Du233f4X.js">
|
|
109
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-ENXrGGmj.js">
|
|
110
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-DdBn2mS5.js">
|
|
109
111
|
<link rel="stylesheet" crossorigin href="/assets/src-CZA3gFyl.css">
|
|
110
112
|
</head>
|
|
111
113
|
<body class="h-full bg-background text-foreground">
|
package/dist/mobile.html
CHANGED
|
@@ -63,14 +63,19 @@
|
|
|
63
63
|
})();
|
|
64
64
|
</script>
|
|
65
65
|
|
|
66
|
-
<script type="module" crossorigin src="/assets/mobile-
|
|
66
|
+
<script type="module" crossorigin src="/assets/mobile-CTw9gT8g.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">
|
|
70
70
|
<link rel="modulepreload" crossorigin href="/assets/runtime-fetch-BAN5Gnnp.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="/assets/runtimeAPIRegistry-C2VogTny.js">
|
|
72
|
+
<link rel="modulepreload" crossorigin href="/assets/desktop-DpAcrF1h.js">
|
|
73
|
+
<link rel="modulepreload" crossorigin href="/assets/desktopHosts-CjH4TGh8.js">
|
|
74
|
+
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-BLJo3sm7.js">
|
|
72
75
|
<link rel="modulepreload" crossorigin href="/assets/vendor-base-ui-CdzJ6My_.js">
|
|
73
76
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-o69pgTEK.js">
|
|
77
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-effect-DXlObQuU.js">
|
|
78
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-BcpAhe9I.js">
|
|
74
79
|
<link rel="modulepreload" crossorigin href="/assets/brand-storage-migration-Bhz6UOBJ.js">
|
|
75
80
|
<link rel="modulepreload" crossorigin href="/assets/brand-storage-bootstrap-D4BW3w-M.js">
|
|
76
81
|
<link rel="modulepreload" crossorigin href="/assets/useUIStore-NMQx_cnG.js">
|
|
@@ -79,22 +84,19 @@
|
|
|
79
84
|
<link rel="modulepreload" crossorigin href="/assets/queryRuntime-BuRnpVtK.js">
|
|
80
85
|
<link rel="modulepreload" crossorigin href="/assets/vendor-pathe-vBmvQE8f.js">
|
|
81
86
|
<link rel="modulepreload" crossorigin href="/assets/pathNormalization-ewtPqJWn.js">
|
|
82
|
-
<link rel="modulepreload" crossorigin href="/assets/persistence-
|
|
83
|
-
<link rel="modulepreload" crossorigin href="/assets/desktopHosts-DNc_ga0E.js">
|
|
84
|
-
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-BWl7Zy8M.js">
|
|
85
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-effect-DXlObQuU.js">
|
|
86
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-BcpAhe9I.js">
|
|
87
|
+
<link rel="modulepreload" crossorigin href="/assets/persistence-D-W3L37Z.js">
|
|
87
88
|
<link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-react-query-CdqCAt40.js">
|
|
88
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
89
|
+
<link rel="modulepreload" crossorigin href="/assets/fileQueries-QvEzQ4wT.js">
|
|
90
|
+
<link rel="modulepreload" crossorigin href="/assets/path-utils-jGozTg9d.js">
|
|
89
91
|
<link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
|
|
90
|
-
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-
|
|
91
|
-
<link rel="modulepreload" crossorigin href="/assets/platform-
|
|
92
|
-
<link rel="modulepreload" crossorigin href="/assets/terminalApi-
|
|
93
|
-
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-
|
|
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-
|
|
92
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-4US6DwDy.js">
|
|
93
|
+
<link rel="modulepreload" crossorigin href="/assets/platform-BtuVsKCV.js">
|
|
94
|
+
<link rel="modulepreload" crossorigin href="/assets/terminalApi-DBa-4CzM.js">
|
|
95
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-BHIiwnLA.js">
|
|
96
|
+
<link rel="modulepreload" crossorigin href="/assets/types-CJYCyR67.js">
|
|
97
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-Du233f4X.js">
|
|
98
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-ENXrGGmj.js">
|
|
99
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-DdBn2mS5.js">
|
|
98
100
|
<link rel="stylesheet" crossorigin href="/assets/src-CZA3gFyl.css">
|
|
99
101
|
</head>
|
|
100
102
|
<body class="h-full bg-background text-foreground">
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -1019,18 +1019,6 @@ questionAutoDelegateRuntime = createQuestionAutoDelegateRuntime({
|
|
|
1019
1019
|
buildOpenCodeUrl,
|
|
1020
1020
|
getOpenCodeAuthHeaders,
|
|
1021
1021
|
readSettingsFromDiskMigrated,
|
|
1022
|
-
sanitizeProjects,
|
|
1023
|
-
listIndexedDirectories: async () => {
|
|
1024
|
-
try {
|
|
1025
|
-
const snap = sessionIndexServiceRef?.snapshot?.();
|
|
1026
|
-
const directories = Array.isArray(snap?.directories) ? snap.directories : [];
|
|
1027
|
-
return directories
|
|
1028
|
-
.map((entry) => (typeof entry?.directory === 'string' ? entry.directory.trim() : ''))
|
|
1029
|
-
.filter(Boolean);
|
|
1030
|
-
} catch {
|
|
1031
|
-
return [];
|
|
1032
|
-
}
|
|
1033
|
-
},
|
|
1034
1022
|
broadcastGlobalUiEvent,
|
|
1035
1023
|
broadcastYuriEvent: broadcastQuestionAutoDelegateTip,
|
|
1036
1024
|
onUserTakeover: ({ sessionID, directory }) => {
|
|
@@ -1600,6 +1588,7 @@ async function main(options = {}) {
|
|
|
1600
1588
|
const contentSearch = createGlobalContentSearch({
|
|
1601
1589
|
dataDir: path.dirname(resolveSessionIndexDbPath({ sessionIndexDbPath }, YURI_DATA_DIR)),
|
|
1602
1590
|
getRuntimeKey: () => sessionIndexService.getRuntimeKey(),
|
|
1591
|
+
getEventRuntimeKey: () => messageQueueService?.getRuntimeKey() ?? null,
|
|
1603
1592
|
buildOpenCodeUrl, getOpenCodeAuthHeaders, waitForReady: waitForOpenCodeReady,
|
|
1604
1593
|
});
|
|
1605
1594
|
const unsubscribeContentSearch = globalMessageStreamHub.subscribeEvent((event) => contentSearch.runtime.observe(event));
|
|
@@ -38,6 +38,13 @@ queue populated by live events. Each dirty session is read by ID and refreshes i
|
|
|
38
38
|
own messages; unrelated sessions incur no upstream work. Initialization failures
|
|
39
39
|
retry using committed per-session checkpoints. Explicit `sync()` remains deliberate
|
|
40
40
|
catalog reconciliation; automatic scheduling uses incremental mode.
|
|
41
|
+
The event-identity hotfix adds `search_coverage.event_identity_repaired` without
|
|
42
|
+
changing existing runtime keys or deleting results. Older completed indexes perform
|
|
43
|
+
one bounded thirty-day catalog reconciliation to recover updates dropped by the
|
|
44
|
+
old event fence. Unchanged checkpoints are reused; changed/missing sessions are
|
|
45
|
+
refetched with the same two-worker limit. Partial failures preserve old hits and
|
|
46
|
+
retry after thirty seconds, including after restart. Only successful reconciliation
|
|
47
|
+
sets the durable repair marker; subsequent warm starts resume dirty work only.
|
|
41
48
|
Already verified unchanged sessions are reused, including
|
|
42
49
|
sessions with no searchable text. Each session now commits an `indexed_at`
|
|
43
50
|
completion timestamp atomically with its projection, source update time and
|
|
@@ -88,8 +95,11 @@ during the fetch survives for another pass. Thirty-second retries are scheduled
|
|
|
88
95
|
only for unfinished initialization or pending dirty sessions, never idle catalog
|
|
89
96
|
polling. Deleted-session events and confirmed 404 remove that session; a time-bounded
|
|
90
97
|
catalog is not authoritative absence for unvisited IDs. Indexing does not depend on
|
|
91
|
-
any UI session being opened.
|
|
92
|
-
|
|
98
|
+
any UI session being opened. The persisted partition is owned by the Host session
|
|
99
|
+
index; the incoming event fence is checked against the message queue's runtime key,
|
|
100
|
+
the same provider used by the global hub. These are distinct hash namespaces and
|
|
101
|
+
must never be compared to each other. Old-runtime events remain rejected;
|
|
102
|
+
in-flight results are rejected if the index partition changes. Stop aborts reads and drains the
|
|
93
103
|
active pass before closing SQLite.
|
|
94
104
|
|
|
95
105
|
`GET /api/yuri/content-search?q=...&limit=30` returns `{hits,index}`.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { expect, test, vi } from 'vitest';
|
|
2
|
+
import { createSessionIndexService } from '../session-index/service.js';
|
|
3
|
+
import { createMessageQueueService } from '../message-queue/service.js';
|
|
4
|
+
import { createGlobalMessageStreamHub } from '../event-stream/global-hub.js';
|
|
5
|
+
import { createContentSearchService } from './service.js';
|
|
6
|
+
import { createContentSearchRuntime } from './runtime.js';
|
|
7
|
+
|
|
8
|
+
test('real hub runtime identity admits completed replies into search and rejects a previous runtime', async () => {
|
|
9
|
+
let config = { apiBaseUrl: 'http://runtime-a' };
|
|
10
|
+
const getRuntimeConfig = () => config;
|
|
11
|
+
const index = createSessionIndexService({ dbPath: ':memory:', getRuntimeConfig });
|
|
12
|
+
const queue = createMessageQueueService({ dbPath: ':memory:', getRuntimeConfig });
|
|
13
|
+
const service = createContentSearchService({ dbPath: ':memory:' });
|
|
14
|
+
const key = index.getRuntimeKey();
|
|
15
|
+
service.beginInitialization(key, 1);
|
|
16
|
+
service.completeInitialization(key, 0, 2);
|
|
17
|
+
const listSessions = vi.fn();
|
|
18
|
+
const listMessages = vi.fn(async () => ({ data: [{
|
|
19
|
+
id: 'reply', sessionID: 's', type: 'assistant', time: { created: 10, completed: 20 },
|
|
20
|
+
finish: 'stop', content: [{ type: 'text', text: '卡顿和高资源占用属实' }],
|
|
21
|
+
}], cursor: {} }));
|
|
22
|
+
const runtime = createContentSearchRuntime({ service, getRuntimeKey: () => index.getRuntimeKey(),
|
|
23
|
+
getEventRuntimeKey: () => queue.getRuntimeKey(), now: () => 100, listSessions, listMessages,
|
|
24
|
+
getSession: async () => ({ id: 's', time: { updated: 20 } }),
|
|
25
|
+
});
|
|
26
|
+
let captured;
|
|
27
|
+
let stream;
|
|
28
|
+
const hub = createGlobalMessageStreamHub({
|
|
29
|
+
buildOpenCodeUrl: (pathname) => `http://runtime-a${pathname}`, getOpenCodeAuthHeaders: () => ({}),
|
|
30
|
+
getRuntimeIdentity: () => ({ runtimeKey: queue.getRuntimeKey() }),
|
|
31
|
+
fetchImpl: async () => new Response(new ReadableStream({ start(controller) {
|
|
32
|
+
stream = controller;
|
|
33
|
+
controller.enqueue(new TextEncoder().encode('id: event-1\ndata: {"type":"session.execution.succeeded","data":{"sessionID":"s"}}\n\n'));
|
|
34
|
+
} })),
|
|
35
|
+
});
|
|
36
|
+
hub.subscribeEvent((event) => { captured = event; runtime.observe(event); });
|
|
37
|
+
try {
|
|
38
|
+
hub.start();
|
|
39
|
+
await vi.waitFor(() => expect(captured).toBeDefined());
|
|
40
|
+
expect(queue.getRuntimeKey()).not.toBe(key);
|
|
41
|
+
expect(service.pending(key)).toHaveLength(1);
|
|
42
|
+
await runtime.sync({ incremental: true });
|
|
43
|
+
expect(service.search(key, '卡顿和高资源占用属实')).toMatchObject([{ sessionID: 's', messageID: 'reply' }]);
|
|
44
|
+
expect(listSessions).not.toHaveBeenCalled();
|
|
45
|
+
expect(listMessages).toHaveBeenCalledTimes(1);
|
|
46
|
+
config = { apiBaseUrl: 'http://runtime-b' };
|
|
47
|
+
runtime.observe(captured);
|
|
48
|
+
expect(service.pending(index.getRuntimeKey())).toEqual([]);
|
|
49
|
+
} finally {
|
|
50
|
+
hub.stop(); stream?.close(); await runtime.stop(); service.close(); index.close(); queue.close();
|
|
51
|
+
}
|
|
52
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { expect, test, vi } from 'vitest';
|
|
2
|
+
import Database from 'better-sqlite3';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import os from 'node:os';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { createContentSearchService } from './service.js';
|
|
7
|
+
import { createContentSearchRuntime } from './runtime.js';
|
|
8
|
+
|
|
9
|
+
test('old completed indexes repair missed updates once, preserve failed results and resume after restart', async () => {
|
|
10
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'content-event-repair-'));
|
|
11
|
+
const dbPath = path.join(dir, 'search.sqlite');
|
|
12
|
+
const old = new Database(dbPath);
|
|
13
|
+
old.exec(`CREATE TABLE search_coverage(runtime TEXT PRIMARY KEY, started_at REAL NOT NULL, completed_at REAL, since REAL, verified_at REAL);
|
|
14
|
+
INSERT INTO search_coverage VALUES('host',1,2,0,3);`);
|
|
15
|
+
old.close();
|
|
16
|
+
let service = createContentSearchService({ dbPath });
|
|
17
|
+
const now = 40 * 86400000;
|
|
18
|
+
const record = (id, text) => ({ info: { id, role: 'user', time: { created: now } }, parts: [{ type: 'text', text }] });
|
|
19
|
+
for (const id of ['unchanged', 'missed', 'failed']) service.replaceSession('host', { id, time: { updated: 10 } }, [record(id, 'previous result')], 0);
|
|
20
|
+
let fail = true;
|
|
21
|
+
const listSessions = vi.fn(async () => ({ data: [
|
|
22
|
+
{ id: 'missed', time: { updated: now } }, { id: 'failed', time: { updated: now } },
|
|
23
|
+
{ id: 'unchanged', time: { updated: 10 } },
|
|
24
|
+
], cursor: { next: 'older' } }));
|
|
25
|
+
const listMessages = vi.fn(async ({ sessionID }) => {
|
|
26
|
+
if (sessionID === 'failed' && fail) throw new Error('offline');
|
|
27
|
+
return { data: [{ type: 'user', id: sessionID, sessionID, time: { created: now }, text: 'recovered result' }], cursor: {} };
|
|
28
|
+
});
|
|
29
|
+
const create = () => createContentSearchRuntime({ service, getRuntimeKey: () => 'host', now: () => now, listSessions, listMessages });
|
|
30
|
+
let runtime = create();
|
|
31
|
+
try {
|
|
32
|
+
await runtime.sync({ incremental: true });
|
|
33
|
+
expect(service.search('host', 'recovered')).toHaveLength(1);
|
|
34
|
+
expect(service.search('host', 'previous').map((hit) => hit.sessionID).sort()).toEqual(['failed', 'unchanged']);
|
|
35
|
+
expect(runtime.status()).toMatchObject({ phase: 'partial', initializationRequired: false, indexCompletedAt: 2 });
|
|
36
|
+
await runtime.stop(); service.close();
|
|
37
|
+
service = createContentSearchService({ dbPath }); runtime = create(); fail = false;
|
|
38
|
+
await runtime.sync({ incremental: true });
|
|
39
|
+
expect(service.search('host', 'recovered')).toHaveLength(2);
|
|
40
|
+
expect(listMessages.mock.calls.map(([q]) => q.sessionID)).toEqual(['missed', 'failed', 'failed']);
|
|
41
|
+
expect(listSessions).toHaveBeenCalledTimes(2);
|
|
42
|
+
await runtime.stop(); service.close();
|
|
43
|
+
service = createContentSearchService({ dbPath }); runtime = create();
|
|
44
|
+
await runtime.sync({ incremental: true });
|
|
45
|
+
expect(listSessions).toHaveBeenCalledTimes(2);
|
|
46
|
+
expect(listMessages).toHaveBeenCalledTimes(3);
|
|
47
|
+
} finally { await runtime.stop(); service.close(); fs.rmSync(dir, { recursive: true, force: true }); }
|
|
48
|
+
});
|
|
@@ -3,10 +3,10 @@ import { makeOpenCodeV2Client } from '../opencode/v2-client.js';
|
|
|
3
3
|
import { createContentSearchService } from './service.js';
|
|
4
4
|
import { createContentSearchRuntime } from './runtime.js';
|
|
5
5
|
|
|
6
|
-
export function createGlobalContentSearch({ dataDir, getRuntimeKey, buildOpenCodeUrl, getOpenCodeAuthHeaders, waitForReady }) {
|
|
6
|
+
export function createGlobalContentSearch({ dataDir, getRuntimeKey, getEventRuntimeKey, buildOpenCodeUrl, getOpenCodeAuthHeaders, waitForReady }) {
|
|
7
7
|
const service = createContentSearchService({ dbPath: path.join(dataDir, 'content-search.sqlite') });
|
|
8
8
|
const client = () => makeOpenCodeV2Client({ baseUrl: buildOpenCodeUrl('/', ''), authHeaders: getOpenCodeAuthHeaders() });
|
|
9
|
-
const runtime = createContentSearchRuntime({ service, getRuntimeKey,
|
|
9
|
+
const runtime = createContentSearchRuntime({ service, getRuntimeKey, getEventRuntimeKey,
|
|
10
10
|
getSession: ({ sessionID, signal }) => client().session.get({ sessionID }, { signal: AbortSignal.any([signal, AbortSignal.timeout(30_000)]) }),
|
|
11
11
|
listSessions: async ({ signal, ...query }) => {
|
|
12
12
|
await waitForReady();
|
|
@@ -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, getSession, listMessages, now = Date.now }) {
|
|
8
|
+
export function createContentSearchRuntime({ service, getRuntimeKey, getEventRuntimeKey = getRuntimeKey, listSessions, getSession, listMessages, now = Date.now }) {
|
|
9
9
|
let stopped = false;
|
|
10
10
|
let flight;
|
|
11
11
|
let timer;
|
|
@@ -37,7 +37,7 @@ export function createContentSearchRuntime({ service, getRuntimeKey, listSession
|
|
|
37
37
|
for (const id of revisions.keys()) dirty.add(id);
|
|
38
38
|
const pendingDirty = new Set(dirty);
|
|
39
39
|
const initialized = service.coverage(runtime).indexCompletedAt !== null;
|
|
40
|
-
const scanCatalog = !incremental || !initialized;
|
|
40
|
+
const scanCatalog = !incremental || !initialized || service.needsEventIdentityRepair(runtime);
|
|
41
41
|
const sessions = [];
|
|
42
42
|
const ids = new Set();
|
|
43
43
|
let cursor;
|
|
@@ -148,7 +148,7 @@ export function createContentSearchRuntime({ service, getRuntimeKey, listSession
|
|
|
148
148
|
timer = setTimeout(async () => {
|
|
149
149
|
timer = undefined;
|
|
150
150
|
await sync({ incremental: true });
|
|
151
|
-
if (service.coverage(getRuntimeKey()).indexCompletedAt === null || service.pending(getRuntimeKey()).length) schedule(30_000);
|
|
151
|
+
if (service.coverage(getRuntimeKey()).indexCompletedAt === null || service.needsEventIdentityRepair(getRuntimeKey()) || service.pending(getRuntimeKey()).length) schedule(30_000);
|
|
152
152
|
}, delay);
|
|
153
153
|
timer.unref?.();
|
|
154
154
|
};
|
|
@@ -156,7 +156,7 @@ export function createContentSearchRuntime({ service, getRuntimeKey, listSession
|
|
|
156
156
|
sync, status,
|
|
157
157
|
start() { schedule(0); },
|
|
158
158
|
observe(event) {
|
|
159
|
-
if (event.runtimeIdentity?.runtimeKey && event.runtimeIdentity.runtimeKey !==
|
|
159
|
+
if (event.runtimeIdentity?.runtimeKey && event.runtimeIdentity.runtimeKey !== getEventRuntimeKey()) return;
|
|
160
160
|
if (state.runtime !== getRuntimeKey()) schedule(0);
|
|
161
161
|
const payload = event.payload?.payload ?? event.payload;
|
|
162
162
|
const type = normalizeSessionEventType(payload?.type ?? '');
|
|
@@ -36,6 +36,9 @@ export function createContentSearchService({ dbPath }) {
|
|
|
36
36
|
if (!sessionColumns.some((column) => column.name === 'indexed_at')) {
|
|
37
37
|
db.exec('ALTER TABLE search_session ADD COLUMN indexed_at REAL');
|
|
38
38
|
}
|
|
39
|
+
if (!db.prepare('PRAGMA table_info(search_coverage)').all().some((column) => column.name === 'event_identity_repaired')) {
|
|
40
|
+
db.exec('ALTER TABLE search_coverage ADD COLUMN event_identity_repaired INTEGER NOT NULL DEFAULT 0');
|
|
41
|
+
}
|
|
39
42
|
const remove = db.prepare('DELETE FROM search_message WHERE runtime=? AND session=?');
|
|
40
43
|
const write = db.prepare('INSERT INTO search_message(runtime,session,message,role,created,body) VALUES(?,?,?,?,?,?)');
|
|
41
44
|
const removeSession = db.transaction((runtime, id) => {
|
|
@@ -57,12 +60,15 @@ export function createContentSearchService({ dbPath }) {
|
|
|
57
60
|
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)
|
|
58
61
|
?? { indexStartedAt: null, indexCompletedAt: null, coveredSince: null, verifiedAt: null };
|
|
59
62
|
},
|
|
63
|
+
needsEventIdentityRepair(runtime) {
|
|
64
|
+
return db.prepare('SELECT event_identity_repaired FROM search_coverage WHERE runtime=?').get(runtime)?.event_identity_repaired !== 1;
|
|
65
|
+
},
|
|
60
66
|
beginInitialization(runtime, timestamp) {
|
|
61
67
|
db.prepare(`INSERT INTO search_coverage(runtime,started_at) VALUES(?,?)
|
|
62
68
|
ON CONFLICT(runtime) DO NOTHING`).run(runtime, timestamp);
|
|
63
69
|
},
|
|
64
70
|
completeInitialization(runtime, since, timestamp) {
|
|
65
|
-
db.prepare(`UPDATE search_coverage SET completed_at=COALESCE(completed_at,?), since=?, verified_at
|
|
71
|
+
db.prepare(`UPDATE search_coverage SET completed_at=COALESCE(completed_at,?), since=?, verified_at=?, event_identity_repaired=1 WHERE runtime=?`)
|
|
66
72
|
.run(timestamp, since, timestamp, runtime);
|
|
67
73
|
},
|
|
68
74
|
replaceSession: db.transaction((runtime, session, records, since = null, indexedAt = Date.now()) => {
|
|
@@ -6,6 +6,7 @@ Own filesystem API behavior for the web server runtime, including file operation
|
|
|
6
6
|
## Entrypoints and structure
|
|
7
7
|
- `packages/web/server/lib/fs/routes.js`: route registration and runtime-owned state for `/api/fs/*` endpoints.
|
|
8
8
|
- `packages/web/server/lib/fs/search.js`: fuzzy filesystem search runtime used by non-FS routes (for example project icon discovery).
|
|
9
|
+
- `packages/web/server/lib/fs/binary-file.js`: shared 8 KiB binary sniff for Web stat, Electron binary-path IPC, and both VS Code stat adapters. Strict UTF-8 decoding permits an incomplete trailing code point only when the opened file's size confirms more bytes remain; NUL, malformed sequences, and incomplete UTF-8 at EOF remain binary. File handles close on every outcome, and filesystem errors propagate.
|
|
9
10
|
|
|
10
11
|
## Public exports
|
|
11
12
|
- `registerFsRoutes(app, dependencies)` from `routes.js`
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const BINARY_SAMPLE_BYTES = 8192;
|
|
2
|
+
|
|
3
|
+
export const isBinaryFile = async (filePath, fsPromises) => {
|
|
4
|
+
const file = await fsPromises.open(filePath, 'r');
|
|
5
|
+
try {
|
|
6
|
+
const sample = Buffer.alloc(BINARY_SAMPLE_BYTES);
|
|
7
|
+
const { bytesRead } = await file.read(sample, 0, sample.length, 0);
|
|
8
|
+
const bytes = sample.subarray(0, bytesRead);
|
|
9
|
+
if (bytes.includes(0)) return true;
|
|
10
|
+
const { size } = await file.stat();
|
|
11
|
+
try {
|
|
12
|
+
// Only a non-EOF sample may end partway through a UTF-8 code point.
|
|
13
|
+
new TextDecoder('utf-8', { fatal: true }).decode(bytes, { stream: bytesRead < size });
|
|
14
|
+
return false;
|
|
15
|
+
} catch {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
} finally {
|
|
19
|
+
await file.close();
|
|
20
|
+
}
|
|
21
|
+
};
|
package/server/lib/fs/routes.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import { createImageFingerprintReader } from './image-fingerprint.js';
|
|
3
|
+
import { isBinaryFile } from './binary-file.js';
|
|
3
4
|
import { createRealpathCache } from '../path-realpath-cache.js';
|
|
4
5
|
import nodeFsPromises from 'node:fs/promises';
|
|
5
6
|
import nodePath from 'node:path';
|
|
@@ -127,27 +128,6 @@ const FILE_MIME_MAP = Object.freeze({
|
|
|
127
128
|
});
|
|
128
129
|
|
|
129
130
|
const MAX_SERVE_BYTES = 100 * 1024 * 1024;
|
|
130
|
-
const BINARY_SAMPLE_BYTES = 8192;
|
|
131
|
-
|
|
132
|
-
const isBinaryFile = async (filePath, fsPromises) => {
|
|
133
|
-
const file = await fsPromises.open(filePath, 'r');
|
|
134
|
-
try {
|
|
135
|
-
const sample = Buffer.alloc(BINARY_SAMPLE_BYTES);
|
|
136
|
-
const { bytesRead } = await file.read(sample, 0, sample.length, 0);
|
|
137
|
-
const bytes = sample.subarray(0, bytesRead);
|
|
138
|
-
if (bytes.includes(0)) {
|
|
139
|
-
return true;
|
|
140
|
-
}
|
|
141
|
-
try {
|
|
142
|
-
new TextDecoder('utf-8', { fatal: true }).decode(bytes);
|
|
143
|
-
return false;
|
|
144
|
-
} catch {
|
|
145
|
-
return true;
|
|
146
|
-
}
|
|
147
|
-
} finally {
|
|
148
|
-
await file.close();
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
131
|
|
|
152
132
|
// Only deterministic, side-effect-free git plumbing path queries are cacheable.
|
|
153
133
|
// Anything outside this allowlist (including any non-git command) runs normally
|
|
@@ -285,6 +285,48 @@ const callMkdir = async (handler, body) => {
|
|
|
285
285
|
};
|
|
286
286
|
|
|
287
287
|
describe('fs stat', () => {
|
|
288
|
+
it.each([
|
|
289
|
+
['two-byte code point split after byte 1', Buffer.from('a'.repeat(8191) + 'é'), false],
|
|
290
|
+
['Chinese split after byte 2', Buffer.from('a'.repeat(8190) + '好'), false],
|
|
291
|
+
['emoji split after byte 1', Buffer.from('a'.repeat(8191) + '😀'), false],
|
|
292
|
+
['emoji split after byte 2', Buffer.from('a'.repeat(8190) + '😀'), false],
|
|
293
|
+
['emoji split after byte 3', Buffer.from('a'.repeat(8189) + '😀'), false],
|
|
294
|
+
['complete Chinese at exact sample EOF', Buffer.from('a'.repeat(8189) + '好'), false],
|
|
295
|
+
['empty file', Buffer.alloc(0), false],
|
|
296
|
+
['incomplete UTF-8 at short EOF', Buffer.from([0xe5, 0xa5]), true],
|
|
297
|
+
['incomplete UTF-8 at exact sample EOF', Buffer.concat([Buffer.alloc(8191, 0x61), Buffer.from([0xe5])]), true],
|
|
298
|
+
['invalid leading byte before non-EOF boundary', Buffer.concat([Buffer.from([0xff]), Buffer.alloc(8192, 0x61)]), true],
|
|
299
|
+
['NUL before non-EOF boundary', Buffer.concat([Buffer.from([0]), Buffer.alloc(8192, 0x61)]), true],
|
|
300
|
+
['invalid continuation at non-EOF boundary', Buffer.concat([Buffer.alloc(8190, 0x61), Buffer.from([0xe5, 0x61, 0x61])]), true],
|
|
301
|
+
['overlong sequence at non-EOF boundary', Buffer.concat([Buffer.alloc(8190, 0x61), Buffer.from([0xe0, 0x80, 0x80])]), true],
|
|
302
|
+
['surrogate at non-EOF boundary', Buffer.concat([Buffer.alloc(8190, 0x61), Buffer.from([0xed, 0xa0, 0x80])]), true],
|
|
303
|
+
['out-of-range code point at non-EOF boundary', Buffer.concat([Buffer.alloc(8190, 0x61), Buffer.from([0xf4, 0x90, 0x80, 0x80])]), true],
|
|
304
|
+
])('classifies %s', async (_name, bytes, expected) => {
|
|
305
|
+
const directory = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'yuri-binary-sample-'));
|
|
306
|
+
const filePath = path.join(directory, 'report.eficy');
|
|
307
|
+
try {
|
|
308
|
+
await fs.promises.writeFile(filePath, bytes);
|
|
309
|
+
const res = await callStat(registerStat(fs.promises), { path: filePath });
|
|
310
|
+
expect(res.statusCode).toBe(200);
|
|
311
|
+
expect(res.body).toMatchObject({ isBinary: expected });
|
|
312
|
+
} finally {
|
|
313
|
+
await fs.promises.rm(directory, { recursive: true, force: true });
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
it('keeps Chinese UTF-8 crossing the 8192-byte sample boundary previewable', async () => {
|
|
318
|
+
const directory = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'yuri-binary-sample-'));
|
|
319
|
+
const filePath = path.join(directory, 'report.shadcn.eficy');
|
|
320
|
+
try {
|
|
321
|
+
await fs.promises.writeFile(filePath, 'a'.repeat(8191) + '好' + 'b'.repeat(28573));
|
|
322
|
+
const res = await callStat(registerStat(fs.promises), { path: filePath });
|
|
323
|
+
expect(res.statusCode).toBe(200);
|
|
324
|
+
expect(res.body).toMatchObject({ size: 36767, isBinary: false });
|
|
325
|
+
} finally {
|
|
326
|
+
await fs.promises.rm(directory, { recursive: true, force: true });
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
|
|
288
330
|
it('reports binary content from a bounded byte sample', async () => {
|
|
289
331
|
const file = {
|
|
290
332
|
read: vi.fn(async (buffer) => {
|
|
@@ -307,6 +349,7 @@ describe('fs stat', () => {
|
|
|
307
349
|
|
|
308
350
|
it('keeps UTF-8 text previewable', async () => {
|
|
309
351
|
const file = {
|
|
352
|
+
stat: vi.fn(async () => ({ size: 23 })),
|
|
310
353
|
read: vi.fn(async (buffer) => {
|
|
311
354
|
buffer.set(Buffer.from('export const value = 1;'));
|
|
312
355
|
return { bytesRead: 23 };
|