@yuriai/web 0.2.0-beta.7 → 0.2.0-beta.8
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-CfyUDUVG.js → AssistantView-BlPMro6O.js} +3 -3
- package/dist/assets/{DiagramView-CZg5AAli.js → DiagramView-BKXzTCL8.js} +1 -1
- package/dist/assets/{GuiPluginSurface-CqqJymvB.js → GuiPluginSurface-BNly6Xlz.js} +1 -1
- package/dist/assets/{GuiPluginWindow-B2G2-nAK.js → GuiPluginWindow-Cfi0SMUy.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-DdaN0XMj.js → ImageLoadingPlaceholder-1ACRI1jC.js} +1 -1
- package/dist/assets/{LoadingImage-BJc5SC-0.js → LoadingImage-CVpLgSVp.js} +1 -1
- package/dist/assets/{MarkdownRenderer-DZwskKzl.js → MarkdownRenderer-CgvK6Tz9.js} +2 -2
- package/dist/assets/{MarkdownRendererImpl-BQhcJNsK.js → MarkdownRendererImpl-TDDDij0i.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-CsURmqQY.js → MarkstreamRendererImpl-C6-UfI7p.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-CH4Oyt33.js → MobileDetailNavigation-BdEfSCm4.js} +1 -1
- package/dist/assets/{MobileShareBridge-DEDl3YCM.js → MobileShareBridge-B5WB1WKT.js} +2 -2
- package/dist/assets/{MobileTabPageHeader-C7Bkm6-_.js → MobileTabPageHeader-BBNJMFBw.js} +1 -1
- package/dist/assets/{MultiRunWindow-DI0-Ur1w.js → MultiRunWindow-v4oq9X77.js} +1 -1
- package/dist/assets/{SettingsView-BVmOocRh.js → SettingsView-CvS8W9-A.js} +1 -1
- package/dist/assets/{SettingsWindow-BJQyV3do.js → SettingsWindow-C7EEBdGt.js} +1 -1
- package/dist/assets/{TerminalView-DRwLYPvJ.js → TerminalView-f9li4Dcm.js} +1 -1
- package/dist/assets/{ToolOutputDialog-O25CmHgA.js → ToolOutputDialog-zF7xpkS8.js} +1 -1
- package/dist/assets/{appThemeRegistry-B-rbBHC4.js → appThemeRegistry-BKP8vwhk.js} +1 -1
- package/dist/assets/{assistant-attachment-cache-DNbxU1Fq.js → assistant-attachment-cache-DWMcn4cE.js} +1 -1
- package/dist/assets/{capgoAdapter-BgDvFDUs.js → capgoAdapter-Bh3XnAlW.js} +1 -1
- package/dist/assets/{device-BVEAUyle.js → device-D_NngvEq.js} +1 -1
- package/dist/assets/{dropdown-menu.styles-tzNMk1yW.js → dropdown-menu.styles-LCAyXnEk.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-C6ylhQkG.js → fileMentionTouchSelection-B9osqnyB.js} +1 -1
- package/dist/assets/{gitApi-4JPWt45Y.js → gitApi-B4bdEdqD.js} +1 -1
- package/dist/assets/gui-DZ723-fy.js +1 -0
- package/dist/assets/{image-loading-CU4V_A1c.js → image-loading-Ctpxfqla.js} +1 -1
- package/dist/assets/{insertionBoundaries-BSPv205d.js → insertionBoundaries-BY22eMtE.js} +1 -1
- package/dist/assets/{main-foDhMZ24.js → main-AMwJi-py.js} +2 -2
- package/dist/assets/{main-CETRwACI.js → main-C7jIE2Fj.js} +4 -4
- package/dist/assets/{mcpQueries-AswEbyXP.js → mcpQueries-BUMvgK26.js} +1 -1
- package/dist/assets/{miniChat-Dsodcwqi.js → miniChat-RvuopuxS.js} +2 -2
- package/dist/assets/{mobile-C4F47gek.js → mobile-DIHyvbDs.js} +2 -2
- package/dist/assets/{mobileBackNavigation-C03Z5phB.js → mobileBackNavigation-BXe_06C5.js} +1 -1
- package/dist/assets/{multirun-CWGx21Ol.js → multirun-CQx2I3IZ.js} +1 -1
- package/dist/assets/{native-config-DC-Ccre6.js → native-config-3PInpl5r.js} +1 -1
- package/dist/assets/{platform-CQG2KlHW.js → platform-BND-ZKbF.js} +2 -2
- package/dist/assets/{projectMeta-6Sbr-Iiw.js → projectMeta-B_eftQTB.js} +1 -1
- package/dist/assets/{readiness-DWh0yJFu.js → readiness-CerJYd9R.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-CQHm04xq.js → renderElectronMiniChatApp-CPBlGAhU.js} +2 -2
- package/dist/assets/{renderMobileApp-D4lOGRzz.js → renderMobileApp-CrP_LwLi.js} +4 -4
- package/dist/assets/{runtime-file-download-BdNCQkDe.js → runtime-file-download-CwP-HoXN.js} +1 -1
- package/dist/assets/{runtime-file-resource-DdAheq3y.js → runtime-file-resource-h3yIw4HU.js} +1 -1
- package/dist/assets/{runtime-file-store-hFlndg-n.js → runtime-file-store-BVRgEtI-.js} +1 -1
- package/dist/assets/{runtimeConfig-5btjngJ7.js → runtimeConfig-fwwvQvAp.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-NHpx5wGb.js → runtimeEndpointReset-CEwt353V.js} +4 -4
- package/dist/assets/{scheduledTaskNavigation-Cy2nZl_A.js → scheduledTaskNavigation-DFa4lhwN.js} +1 -1
- package/dist/assets/{sessionChangeSummary-C70M_uHA.js → sessionChangeSummary-D9-zyniS.js} +1 -1
- package/dist/assets/{sessionLookup-CCOa3Jeq.js → sessionLookup-pq3vdPGh.js} +1 -1
- package/dist/assets/{sortable-tabs-strip-CAkRGa2f.js → sortable-tabs-strip-DTWwlndW.js} +1 -1
- package/dist/assets/{speechSettingsQueries-CIcSgao2.js → speechSettingsQueries-CCFpfJtJ.js} +2 -2
- package/dist/assets/src-r07HspQy.css +2 -0
- package/dist/assets/{terminalApi-DY0KJOiK.js → terminalApi-rE93RnSc.js} +1 -1
- package/dist/assets/{types-D5ocrnEK.js → types-BG8ZDWn4.js} +1 -1
- package/dist/assets/{useAppFontEffects-DSR2ev_Q.js → useAppFontEffects-EC1-6ksC.js} +5 -5
- package/dist/assets/{useDesktopWindowControlsLayout-pyawlD_R.js → useDesktopWindowControlsLayout-Cz30O7Tu.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-W6wf50T7.js → useEffectiveDirectory-C8VRrWsr.js} +1 -1
- package/dist/assets/{useFontPreferences-CH3iNDUl.js → useFontPreferences-qIHM7E9c.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-BTF3FUmY.js → useMobileNavigationStore-YGHA7SiM.js} +4 -4
- package/dist/assets/{useWorkerHighlightedLines-Dhr3xUQY.js → useWorkerHighlightedLines-Bfa_CBGR.js} +1 -1
- package/dist/index.html +11 -11
- package/dist/mini-chat.html +11 -11
- package/dist/mobile.html +11 -11
- package/package.json +1 -1
- package/server/lib/content-search/DOCUMENTATION.md +5 -1
- package/server/lib/content-search/runtime.js +24 -0
- package/server/lib/content-search/runtime.test.js +19 -0
- package/server/lib/opencode/DOCUMENTATION.md +4 -0
- package/server/lib/opencode/plugin-gui-response.d.ts +7 -0
- package/server/lib/opencode/plugin-gui-response.js +62 -0
- package/server/lib/opencode/plugin-gui-response.test.js +89 -0
- package/server/lib/opencode/proxy.js +32 -0
- package/server/lib/relay/DOCUMENTATION.md +1 -0
- package/server/lib/request-cors.js +2 -2
- package/server/lib/request-cors.test.js +3 -0
- package/server/lib/session-index/DOCUMENTATION.md +4 -0
- package/server/lib/session-index/sync-runtime.js +3 -0
- package/server/lib/session-index/sync-runtime.test.js +18 -0
- package/server/plugin-gui-proxy.test.js +134 -0
- package/dist/assets/gui-B56BgPNQ.js +0 -1
- package/dist/assets/src-BR-siHj2.css +0 -2
package/dist/assets/{useWorkerHighlightedLines-Dhr3xUQY.js → useWorkerHighlightedLines-Bfa_CBGR.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-BuhP8T0R.js";import{n as c}from"./useThemeSystem-8jhE4Zyk.js";import{n as l}from"./Icon-DgrlwLKs.js";import{i as u,n as d,t as f}from"./tooltip-jf98dFQe.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-BuhP8T0R.js";import{n as c}from"./useThemeSystem-8jhE4Zyk.js";import{n as l}from"./Icon-DgrlwLKs.js";import{i as u,n as d,t as f}from"./tooltip-jf98dFQe.js";import{n as p}from"./MarkdownRenderer-CgvK6Tz9.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-AMwJi-py.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">
|
|
@@ -584,18 +584,18 @@
|
|
|
584
584
|
<link rel="modulepreload" crossorigin href="/assets/persistence-D-W3L37Z.js">
|
|
585
585
|
<link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-react-query-CdqCAt40.js">
|
|
586
586
|
<link rel="modulepreload" crossorigin href="/assets/fileQueries-DbUx7NwP.js">
|
|
587
|
-
<link rel="modulepreload" crossorigin href="/assets/runtime-file-store-
|
|
587
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-store-BVRgEtI-.js">
|
|
588
588
|
<link rel="modulepreload" crossorigin href="/assets/path-utils-jGozTg9d.js">
|
|
589
589
|
<link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
|
|
590
|
-
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-
|
|
591
|
-
<link rel="modulepreload" crossorigin href="/assets/platform-
|
|
592
|
-
<link rel="modulepreload" crossorigin href="/assets/terminalApi-
|
|
593
|
-
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-
|
|
594
|
-
<link rel="modulepreload" crossorigin href="/assets/types-
|
|
595
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
596
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
597
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
598
|
-
<link rel="stylesheet" crossorigin href="/assets/src-
|
|
590
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-h3yIw4HU.js">
|
|
591
|
+
<link rel="modulepreload" crossorigin href="/assets/platform-BND-ZKbF.js">
|
|
592
|
+
<link rel="modulepreload" crossorigin href="/assets/terminalApi-rE93RnSc.js">
|
|
593
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-CwP-HoXN.js">
|
|
594
|
+
<link rel="modulepreload" crossorigin href="/assets/types-BG8ZDWn4.js">
|
|
595
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-Bh3XnAlW.js">
|
|
596
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-3PInpl5r.js">
|
|
597
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-fwwvQvAp.js">
|
|
598
|
+
<link rel="stylesheet" crossorigin href="/assets/src-r07HspQy.css">
|
|
599
599
|
</head>
|
|
600
600
|
<body class="h-full bg-background text-foreground">
|
|
601
601
|
<!-- Keep the startup layer outside #root. React replaces every child of
|
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-RvuopuxS.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">
|
|
@@ -98,18 +98,18 @@
|
|
|
98
98
|
<link rel="modulepreload" crossorigin href="/assets/persistence-D-W3L37Z.js">
|
|
99
99
|
<link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-react-query-CdqCAt40.js">
|
|
100
100
|
<link rel="modulepreload" crossorigin href="/assets/fileQueries-DbUx7NwP.js">
|
|
101
|
-
<link rel="modulepreload" crossorigin href="/assets/runtime-file-store-
|
|
101
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-store-BVRgEtI-.js">
|
|
102
102
|
<link rel="modulepreload" crossorigin href="/assets/path-utils-jGozTg9d.js">
|
|
103
103
|
<link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
|
|
104
|
-
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-
|
|
105
|
-
<link rel="modulepreload" crossorigin href="/assets/platform-
|
|
106
|
-
<link rel="modulepreload" crossorigin href="/assets/terminalApi-
|
|
107
|
-
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-
|
|
108
|
-
<link rel="modulepreload" crossorigin href="/assets/types-
|
|
109
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
110
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
111
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
112
|
-
<link rel="stylesheet" crossorigin href="/assets/src-
|
|
104
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-h3yIw4HU.js">
|
|
105
|
+
<link rel="modulepreload" crossorigin href="/assets/platform-BND-ZKbF.js">
|
|
106
|
+
<link rel="modulepreload" crossorigin href="/assets/terminalApi-rE93RnSc.js">
|
|
107
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-CwP-HoXN.js">
|
|
108
|
+
<link rel="modulepreload" crossorigin href="/assets/types-BG8ZDWn4.js">
|
|
109
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-Bh3XnAlW.js">
|
|
110
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-3PInpl5r.js">
|
|
111
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-fwwvQvAp.js">
|
|
112
|
+
<link rel="stylesheet" crossorigin href="/assets/src-r07HspQy.css">
|
|
113
113
|
</head>
|
|
114
114
|
<body class="h-full bg-background text-foreground">
|
|
115
115
|
<div id="root" class="h-full">
|
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-DIHyvbDs.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">
|
|
@@ -87,18 +87,18 @@
|
|
|
87
87
|
<link rel="modulepreload" crossorigin href="/assets/persistence-D-W3L37Z.js">
|
|
88
88
|
<link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-react-query-CdqCAt40.js">
|
|
89
89
|
<link rel="modulepreload" crossorigin href="/assets/fileQueries-DbUx7NwP.js">
|
|
90
|
-
<link rel="modulepreload" crossorigin href="/assets/runtime-file-store-
|
|
90
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-store-BVRgEtI-.js">
|
|
91
91
|
<link rel="modulepreload" crossorigin href="/assets/path-utils-jGozTg9d.js">
|
|
92
92
|
<link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
|
|
93
|
-
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-
|
|
94
|
-
<link rel="modulepreload" crossorigin href="/assets/platform-
|
|
95
|
-
<link rel="modulepreload" crossorigin href="/assets/terminalApi-
|
|
96
|
-
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-
|
|
97
|
-
<link rel="modulepreload" crossorigin href="/assets/types-
|
|
98
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
99
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
100
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
101
|
-
<link rel="stylesheet" crossorigin href="/assets/src-
|
|
93
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-h3yIw4HU.js">
|
|
94
|
+
<link rel="modulepreload" crossorigin href="/assets/platform-BND-ZKbF.js">
|
|
95
|
+
<link rel="modulepreload" crossorigin href="/assets/terminalApi-rE93RnSc.js">
|
|
96
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-CwP-HoXN.js">
|
|
97
|
+
<link rel="modulepreload" crossorigin href="/assets/types-BG8ZDWn4.js">
|
|
98
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-Bh3XnAlW.js">
|
|
99
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-3PInpl5r.js">
|
|
100
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-fwwvQvAp.js">
|
|
101
|
+
<link rel="stylesheet" crossorigin href="/assets/src-r07HspQy.css">
|
|
102
102
|
</head>
|
|
103
103
|
<body class="h-full bg-background text-foreground">
|
|
104
104
|
<div id="root" class="h-full"></div>
|
package/package.json
CHANGED
|
@@ -35,7 +35,11 @@ timestamps, not installation/version timestamps or browser onboarding flags.
|
|
|
35
35
|
An absent completion marker requires initialization. A completed runtime does not
|
|
36
36
|
walk the catalog on startup or on a timer. It resumes only the durable dirty-session
|
|
37
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
|
|
38
|
+
own messages; unrelated sessions incur no upstream work. Initialization passes
|
|
39
|
+
resolve pending IDs outside a bounded catalog through `session.get`; excluded
|
|
40
|
+
children and expired sessions leave the dirty queue, while failed reads retain it.
|
|
41
|
+
This prevents filtered-out dirty IDs from keeping initialization in a rescan loop.
|
|
42
|
+
Initialization failures
|
|
39
43
|
retry using committed per-session checkpoints. Explicit `sync()` remains deliberate
|
|
40
44
|
catalog reconciliation; automatic scheduling uses incremental mode.
|
|
41
45
|
The event-identity hotfix adds `search_coverage.event_identity_repaired` without
|
|
@@ -84,6 +84,30 @@ export function createContentSearchRuntime({ service, getRuntimeKey, getEventRun
|
|
|
84
84
|
state.total = sessions.length;
|
|
85
85
|
state.completed = 0;
|
|
86
86
|
const recentIDs = new Set(sessions.map((session) => session.id));
|
|
87
|
+
// A time-bounded catalog cannot classify pending IDs outside its pages.
|
|
88
|
+
// Resolve those IDs directly so excluded children/expired roots cannot
|
|
89
|
+
// keep initialization dirty forever. Failed reads remain pending.
|
|
90
|
+
if (scanCatalog && !completeCatalog) for (const sessionID of pendingDirty) if (!recentIDs.has(sessionID)) {
|
|
91
|
+
try {
|
|
92
|
+
const session = await getSession({ sessionID, signal });
|
|
93
|
+
if (!current()) return;
|
|
94
|
+
if (!session?.id || !Number.isFinite(session.time?.updated)) throw new Error('Invalid dirty session');
|
|
95
|
+
if (!session.parentID && session.time.updated >= state.since && !deleted.has(sessionID)) {
|
|
96
|
+
sessions.push(session);
|
|
97
|
+
recentIDs.add(sessionID);
|
|
98
|
+
} else {
|
|
99
|
+
service.removeSession(runtime, sessionID);
|
|
100
|
+
dirty.delete(sessionID);
|
|
101
|
+
}
|
|
102
|
+
} catch (error) {
|
|
103
|
+
if (!current()) return;
|
|
104
|
+
if ((error?.status ?? error?.response?.status) === 404) {
|
|
105
|
+
service.removeSession(runtime, sessionID);
|
|
106
|
+
dirty.delete(sessionID);
|
|
107
|
+
} else state.failed++;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
state.total = sessions.length;
|
|
87
111
|
if (scanCatalog && completeCatalog) for (const id of pendingDirty) if (!recentIDs.has(id)) {
|
|
88
112
|
dirty.delete(id);
|
|
89
113
|
service.acknowledge(runtime, id, revisions.get(id));
|
|
@@ -2,6 +2,25 @@ import { expect, test, vi } from 'vitest';
|
|
|
2
2
|
import { createContentSearchService } from './service.js';
|
|
3
3
|
import { createContentSearchRuntime } from './runtime.js';
|
|
4
4
|
|
|
5
|
+
test('bounded backfill drains excluded dirty children without repeating the catalog scan', async () => {
|
|
6
|
+
const service = createContentSearchService({ dbPath: ':memory:' });
|
|
7
|
+
const day = 86400000;
|
|
8
|
+
const now = 40 * day;
|
|
9
|
+
service.markDirty('host', 'child');
|
|
10
|
+
const listSessions = vi.fn(async () => ({ data: [{ id: 'old', time: { updated: 1 } }], cursor: { next: 'older' } }));
|
|
11
|
+
const runtime = createContentSearchRuntime({ service, getRuntimeKey: () => 'host', now: () => now,
|
|
12
|
+
listSessions, getSession: async () => ({ id: 'child', parentID: 'parent', time: { updated: now } }),
|
|
13
|
+
listMessages: vi.fn(),
|
|
14
|
+
});
|
|
15
|
+
try {
|
|
16
|
+
await runtime.sync({ incremental: true });
|
|
17
|
+
expect(service.pending('host')).toEqual([]);
|
|
18
|
+
expect(runtime.status().initializationRequired).toBe(false);
|
|
19
|
+
await runtime.sync({ incremental: true });
|
|
20
|
+
expect(listSessions).toHaveBeenCalledTimes(1);
|
|
21
|
+
} finally { await runtime.stop(); service.close(); }
|
|
22
|
+
});
|
|
23
|
+
|
|
5
24
|
test('warm startup and idle time do not scan history; durable dirty events refresh only their session', async () => {
|
|
6
25
|
vi.useFakeTimers();
|
|
7
26
|
const service = createContentSearchService({ dbPath: ':memory:' });
|
|
@@ -68,6 +68,10 @@ This module provides OpenCode server integration utilities for the web server ru
|
|
|
68
68
|
- `packages/web/server/lib/opencode/settings-normalization-runtime.js`: path/settings normalization and sanitization helpers runtime used by settings/routes/config wiring.
|
|
69
69
|
- `packages/web/server/lib/opencode/theme-runtime.js`: custom theme JSON validation and theme directory loading runtime for settings utility routes.
|
|
70
70
|
- `packages/web/server/lib/opencode/proxy.js`: OpenCode API/SSE forwarding and readiness-gate route registration.
|
|
71
|
+
- `plugin-gui-response.js`: shared Web/Electron/VS Code code-only revision response owner for exact `GET /api/plugin/gui?id=…` (one nonempty id). The installed GUI client alias is official `@opencode/client@2.2.0`: HTTP returns `{ location, data: { code, revision, options } }`. Every call still reads the complete current upstream response through the existing auth/readiness/abort boundary; there is no Host bundle cache.
|
|
72
|
+
- Request `X-Yuri-Gui-Revision: <lowercase SHA-256 hex of UTF-8 revision>` opts into code reuse. This header and HTTP condition/range headers are stripped before upstream so Yuri always requests a complete representation. Other query and request headers retain proxy semantics.
|
|
73
|
+
- A valid upstream 200 JSON bundle (`code` string, nonempty `revision` string, `options` object) receives `X-Yuri-Gui-Revision` and `Cache-Control: private, no-store`. Matching tokens additionally receive `X-Yuri-Gui-Code: cached` and only `data.code` becomes `''`; current `options`, `revision`, location and other fields remain. Unmatched/ordinary calls preserve original body bytes. No 304 or Yuri ETag is generated. Upstream failure statuses/bodies remain failures; malformed successful bodies remain unchanged without a revision receipt.
|
|
74
|
+
- Clients restore code before SDK decoding and may persist code/revision only, never options. Browser caches must not store these option-bearing responses. Stale validators and decoded compression/length headers are removed at the response boundary. Packaged/mobile cross-origin clients receive the two response headers through CORS; Relay forwards them transparently on the same `/api/plugin/gui` path.
|
|
71
75
|
- `packages/web/server/lib/opencode/instance-recovery-runtime.js`: directory-instance health recovery before turn admission (`prompt_async` / `command` / `shell`). When OpenCode's per-directory instance is poisoned (MCP probe returns 503 empty while HTTP still accepts prompts that immediately abort as `MessageAbortedError`), dispose the instance so the next admission recreates a healthy one.
|
|
72
76
|
- `packages/web/server/lib/opencode/session-runtime.js`: session status/attention/activity runtime for OpenCode SSE events.
|
|
73
77
|
- `packages/web/server/lib/opencode/watcher.js`: global SSE watcher runtime for push/session event fanout.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function preparePluginGuiRequest(
|
|
2
|
+
method: string,
|
|
3
|
+
requestPath: string,
|
|
4
|
+
headers: Record<string, string>,
|
|
5
|
+
): { headers: Record<string, string>; revision: string | null } | null;
|
|
6
|
+
|
|
7
|
+
export function projectPluginGuiResponse(response: Response, requestedRevision: string | null): Promise<Response>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
|
|
3
|
+
const REVISION_HEADER = 'x-yuri-gui-revision';
|
|
4
|
+
const CODE_HEADER = 'x-yuri-gui-code';
|
|
5
|
+
const FULL_RESPONSE_HEADERS = new Set([
|
|
6
|
+
REVISION_HEADER, CODE_HEADER, 'if-none-match', 'if-modified-since',
|
|
7
|
+
'if-match', 'if-unmodified-since', 'if-range', 'range',
|
|
8
|
+
]);
|
|
9
|
+
|
|
10
|
+
/** Only the official GUI read opts into Yuri's code-only reuse protocol. */
|
|
11
|
+
export const preparePluginGuiRequest = (method, requestPath, headers) => {
|
|
12
|
+
if (method !== 'GET') return null;
|
|
13
|
+
const url = new URL(requestPath, 'http://yuri.invalid');
|
|
14
|
+
if (url.pathname !== '/api/plugin/gui'
|
|
15
|
+
|| url.searchParams.getAll('id').length !== 1
|
|
16
|
+
|| !url.searchParams.get('id')) return null;
|
|
17
|
+
|
|
18
|
+
let revision = null;
|
|
19
|
+
const forwarded = {};
|
|
20
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
21
|
+
const name = key.toLowerCase();
|
|
22
|
+
if (name === REVISION_HEADER && /^[a-f0-9]{64}$/.test(value)) revision = value;
|
|
23
|
+
if (!FULL_RESPONSE_HEADERS.has(name)) forwarded[key] = value;
|
|
24
|
+
}
|
|
25
|
+
forwarded['accept-encoding'] = 'identity';
|
|
26
|
+
return { headers: forwarded, revision };
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const isRecord = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
30
|
+
|
|
31
|
+
/** No history/cache: only this request's complete, validated upstream 200 can omit code. */
|
|
32
|
+
export const projectPluginGuiResponse = async (response, requestedRevision) => {
|
|
33
|
+
if (response.status !== 200) return response;
|
|
34
|
+
const headers = new Headers(response.headers);
|
|
35
|
+
headers.set('cache-control', 'private, no-store');
|
|
36
|
+
headers.delete(REVISION_HEADER);
|
|
37
|
+
headers.delete(CODE_HEADER);
|
|
38
|
+
headers.delete('etag');
|
|
39
|
+
headers.delete('last-modified');
|
|
40
|
+
headers.delete('content-length');
|
|
41
|
+
headers.delete('content-encoding');
|
|
42
|
+
headers.delete('transfer-encoding');
|
|
43
|
+
|
|
44
|
+
// Fetch has decoded compression. Keep original bytes even for malformed JSON.
|
|
45
|
+
let body = Buffer.from(await response.arrayBuffer());
|
|
46
|
+
if (/^application\/(?:json|[^;]+\+json)(?:\s*;|$)/i.test(headers.get('content-type') || '')) {
|
|
47
|
+
let envelope;
|
|
48
|
+
try { envelope = JSON.parse(body.toString('utf8')); } catch { /* Preserve upstream bytes. */ }
|
|
49
|
+
const bundle = isRecord(envelope) && isRecord(envelope.location) ? envelope.data : null;
|
|
50
|
+
if (isRecord(bundle) && typeof bundle.code === 'string'
|
|
51
|
+
&& typeof bundle.revision === 'string' && bundle.revision.length > 0
|
|
52
|
+
&& isRecord(bundle.options)) {
|
|
53
|
+
const revision = createHash('sha256').update(bundle.revision).digest('hex');
|
|
54
|
+
headers.set(REVISION_HEADER, revision);
|
|
55
|
+
if (requestedRevision === revision) {
|
|
56
|
+
body = Buffer.from(JSON.stringify({ ...envelope, data: { ...bundle, code: '' } }));
|
|
57
|
+
headers.set(CODE_HEADER, 'cached');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return new Response(body, { status: response.status, statusText: response.statusText, headers });
|
|
62
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import { preparePluginGuiRequest, projectPluginGuiResponse } from './plugin-gui-response.js';
|
|
4
|
+
|
|
5
|
+
const revision = 'revision-with-private-path';
|
|
6
|
+
const token = createHash('sha256').update(revision).digest('hex');
|
|
7
|
+
const envelope = { location: { directory: '/workspace' }, data: { code: 'module.exports = {};', revision, options: { key: 'current-value' } } };
|
|
8
|
+
const response = (value, status = 200) => new Response(JSON.stringify(value), {
|
|
9
|
+
status, headers: { 'content-type': 'application/json', 'x-upstream': 'kept', etag: 'upstream-etag' },
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
describe('GUI code-only revision protocol', () => {
|
|
13
|
+
it('is exact GET with one nonempty id and strips only GUI/conditional request controls', () => {
|
|
14
|
+
for (const [method, path] of [
|
|
15
|
+
['POST', '/api/plugin/gui?id=x'], ['HEAD', '/api/plugin/gui?id=x'],
|
|
16
|
+
['GET', '/api/plugin/gui/child?id=x'], ['GET', '/api/plugin/gui/?id=x'],
|
|
17
|
+
['GET', '/api/plugin'], ['GET', '/api/plugin/gui'], ['GET', '/api/plugin/gui?id='],
|
|
18
|
+
['GET', '/api/plugin/gui?id=x&id=y'],
|
|
19
|
+
]) expect(preparePluginGuiRequest(method, path, {})).toBeNull();
|
|
20
|
+
const headers = { 'X-Yuri-Gui-Revision': token, 'If-None-Match': 'old', 'If-Modified-Since': 'yesterday',
|
|
21
|
+
Range: 'bytes=0-20', Authorization: 'upstream-auth', 'x-opencode-directory': '/workspace', accept: 'application/json' };
|
|
22
|
+
expect(preparePluginGuiRequest('GET', '/api/plugin/gui?id=x&location%5Bdirectory%5D=%2Fworkspace', headers)).toEqual({
|
|
23
|
+
revision: token, headers: { Authorization: 'upstream-auth', 'x-opencode-directory': '/workspace', accept: 'application/json', 'accept-encoding': 'identity' },
|
|
24
|
+
});
|
|
25
|
+
expect(headers['If-None-Match']).toBe('old');
|
|
26
|
+
for (const value of ['*', token.toUpperCase(), '"' + token + '"', 'not-a-token']) {
|
|
27
|
+
expect(preparePluginGuiRequest('GET', '/api/plugin/gui?id=x', { 'x-yuri-gui-revision': value }).revision).toBeNull();
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('keeps original bytes without opt-in and returns only a hashed revision', async () => {
|
|
32
|
+
const raw = JSON.stringify(envelope, null, 2) + '\n';
|
|
33
|
+
const result = await projectPluginGuiResponse(new Response(raw, { headers: { 'content-type': 'application/json' } }), null);
|
|
34
|
+
expect(await result.text()).toBe(raw);
|
|
35
|
+
expect(result.headers.get('x-yuri-gui-revision')).toBe(token);
|
|
36
|
+
expect(result.headers.get('x-yuri-gui-code')).toBeNull();
|
|
37
|
+
expect(result.headers.get('cache-control')).toBe('private, no-store');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('omits only code on a matching revision, retaining fresh options and all envelope fields', async () => {
|
|
41
|
+
for (const options of [{ key: 'new-value' }, { changed: [1, null] }]) {
|
|
42
|
+
const input = { ...envelope, extra: 1, data: { ...envelope.data, options, extra: true } };
|
|
43
|
+
const result = await projectPluginGuiResponse(response(input), token);
|
|
44
|
+
expect(result.status).toBe(200);
|
|
45
|
+
expect(result.headers.get('x-yuri-gui-code')).toBe('cached');
|
|
46
|
+
expect(result.headers.get('etag')).toBeNull();
|
|
47
|
+
expect(result.headers.get('x-upstream')).toBe('kept');
|
|
48
|
+
expect(await result.json()).toEqual({ ...input, data: { ...input.data, code: '' } });
|
|
49
|
+
}
|
|
50
|
+
const changed = { ...envelope, data: { ...envelope.data, revision: 'new-revision' } };
|
|
51
|
+
const result = await projectPluginGuiResponse(response(changed), token);
|
|
52
|
+
expect(result.headers.get('x-yuri-gui-code')).toBeNull();
|
|
53
|
+
expect(result.headers.get('x-yuri-gui-revision')).not.toBe(token);
|
|
54
|
+
expect(await result.json()).toEqual(changed);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it.each([401, 403, 404, 429, 500, 503])('never replaces upstream %i with historical success', async (status) => {
|
|
58
|
+
const upstream = response(envelope, status);
|
|
59
|
+
expect(await projectPluginGuiResponse(upstream, token)).toBe(upstream);
|
|
60
|
+
expect(await upstream.json()).toEqual(envelope);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it.each([
|
|
64
|
+
{ ...envelope.data, code: 1 }, { ...envelope.data, revision: '' },
|
|
65
|
+
{ ...envelope.data, revision: null }, { ...envelope.data, options: null },
|
|
66
|
+
{ ...envelope.data, options: [] }, { code: 'x', revision },
|
|
67
|
+
])('does not issue a revision receipt for malformed bundles: %j', async (data) => {
|
|
68
|
+
const input = { ...envelope, data };
|
|
69
|
+
const result = await projectPluginGuiResponse(response(input), token);
|
|
70
|
+
expect(result.headers.get('x-yuri-gui-revision')).toBeNull();
|
|
71
|
+
expect(result.headers.get('x-yuri-gui-code')).toBeNull();
|
|
72
|
+
expect(await result.json()).toEqual(input);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('preserves malformed JSON and non-JSON success bytes without a receipt', async () => {
|
|
76
|
+
for (const [body, contentType] of [['{invalid', 'application/json'], ['<html>not a GUI</html>', 'text/html']]) {
|
|
77
|
+
const result = await projectPluginGuiResponse(new Response(body, { headers: { 'content-type': contentType } }), token);
|
|
78
|
+
expect(await result.text()).toBe(body);
|
|
79
|
+
expect(result.headers.get('x-yuri-gui-code')).toBeNull();
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('does not hide a failed body read behind a matching revision', async () => {
|
|
84
|
+
const upstream = new Response(new ReadableStream({
|
|
85
|
+
start(controller) { controller.error(new Error('upstream body failed')); },
|
|
86
|
+
}), { headers: { 'content-type': 'application/json' } });
|
|
87
|
+
await expect(projectPluginGuiResponse(upstream, token)).rejects.toThrow('upstream body failed');
|
|
88
|
+
});
|
|
89
|
+
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createProxyMiddleware } from 'http-proxy-middleware';
|
|
2
2
|
import { isSensitiveCredentialResponse } from './credential-boundary.js';
|
|
3
|
+
import { preparePluginGuiRequest, projectPluginGuiResponse } from './plugin-gui-response.js';
|
|
3
4
|
import { registerSessionDeliveryRoute } from './session-delivery-runtime.js';
|
|
4
5
|
import { stripSessionMessageNativePayload } from '../session-turn-pages/native-payload.js';
|
|
5
6
|
|
|
@@ -1363,5 +1364,36 @@ export const registerOpenCodeProxy = (app, deps) => {
|
|
|
1363
1364
|
});
|
|
1364
1365
|
|
|
1365
1366
|
app.use('/api', applyProxyResponseDeadline);
|
|
1367
|
+
app.use('/api', async (req, res, next) => {
|
|
1368
|
+
if (req.method !== 'GET' || req.path !== '/plugin/gui') return next();
|
|
1369
|
+
const upstreamPath = toUpstreamOpenCodeApiPath(req.url);
|
|
1370
|
+
const gui = preparePluginGuiRequest(req.method, upstreamPath, normalizeForwardedDirectoryHeaders(
|
|
1371
|
+
collectForwardProxyHeaders(req.headers, getOpenCodeAuthHeaders()),
|
|
1372
|
+
));
|
|
1373
|
+
if (!gui) return next();
|
|
1374
|
+
|
|
1375
|
+
const controller = new AbortController();
|
|
1376
|
+
const abort = () => controller.abort();
|
|
1377
|
+
req.once('aborted', abort);
|
|
1378
|
+
res.once('close', abort);
|
|
1379
|
+
try {
|
|
1380
|
+
const upstream = await fetch(buildOpenCodeUrl(upstreamPath, ''), {
|
|
1381
|
+
method: req.method, headers: gui.headers, signal: controller.signal, redirect: 'manual',
|
|
1382
|
+
});
|
|
1383
|
+
const response = await projectPluginGuiResponse(upstream, gui.revision);
|
|
1384
|
+
const body = Buffer.from(await response.arrayBuffer());
|
|
1385
|
+
if (res.writableEnded || res.destroyed) return;
|
|
1386
|
+
res.status(response.status);
|
|
1387
|
+
applyForwardProxyResponseHeaders(response.headers, res);
|
|
1388
|
+
res.end(body);
|
|
1389
|
+
} catch (error) {
|
|
1390
|
+
if (!controller.signal.aborted && !req[PROXY_TIMEOUT_MARKER]) {
|
|
1391
|
+
sendProxyErrorResponse(res, isProxyTimeoutError(error) ? 504 : 503);
|
|
1392
|
+
}
|
|
1393
|
+
} finally {
|
|
1394
|
+
req.off('aborted', abort);
|
|
1395
|
+
res.off('close', abort);
|
|
1396
|
+
}
|
|
1397
|
+
});
|
|
1366
1398
|
app.use('/api', apiProxy);
|
|
1367
1399
|
};
|
|
@@ -55,6 +55,7 @@ Private Relay is transparent for allowlisted HTTP paths, so most “works on LAN
|
|
|
55
55
|
|
|
56
56
|
- **Same path, real Host route required.** Clients call the ordinary `/api/...` path through the tunnel. If that route is missing on the Host process currently holding the relay claim (wrong git worktree, stale packaged Desktop build, or a backend that never registered the Yuri route before the OpenCode proxy/SPA fallback), the tunnel still returns HTTP 200 with SPA HTML or proxied OpenCode content. Symptom: chat and status work, Provider/model catalog does not.
|
|
57
57
|
- **HTTP allowlist is prefix-based for `/api/`.** New REST/SSE APIs under `/api/` do not need a tunnel-host allowlist edit. New **WebSocket** paths still need both tunnel-host allowlisting (`isTunnelWsPathAllowed` / exact `ALLOWED_WS_PATHS`, plus the **`/api/preview/proxy/` prefix** for Preview HMR only) and `isUrlAuthWebSocketPath` (see the `relay-transport` skill). Config sync (`/api/yuri/config-sync/*`, ticket 05/06) therefore works over Relay without a tunnel-host allowlist change; identity and credential grants remain endpoint concerns (`relay:<serverId>`, pairing-settings / inbound host grant).
|
|
58
|
+
- GUI code reuse uses the same `GET /api/plugin/gui?id=…` path: the tunnel preserves `X-Yuri-Gui-Revision` requests and `X-Yuri-Gui-Revision` / `X-Yuri-Gui-Code` responses. The authenticated Host still fetches upstream on each call; matching responses are 200 with current options and empty code, never a tunnel-cached bundle or 304. `Cache-Control: private, no-store` crosses unchanged. The Web GUI proxy integration test exercises this actual dispatcher path.
|
|
58
59
|
- **Transport identity ≠ runtime key.** After LAN⇄relay swaps, UI catalog loaders commit only when `useConfigStore.catalogTransportIdentity` matches `getRuntimeTransportIdentity()`. `runtimeEndpointReset.ts` must write that transport fingerprint on both full endpoint reset and in-place transport reconnect. Writing `runtimeKey` instead leaves Providers empty because the stable device/instance id is shared across LAN and relay.
|
|
59
60
|
- **Safe catalog projection stays Host-owned.** Provider credentials never cross the browser; Relay only carries the already-allowlisted `GET /api/config/catalog/providers` JSON. Keep Host projection, client parser bounds, and `partial` rules in sync (empty `release_date` is absent, not partial).
|
|
60
61
|
|
|
@@ -4,12 +4,12 @@ export const applyRuntimeCorsHeaders = ({ origin, setHeader }) => {
|
|
|
4
4
|
setHeader('Access-Control-Allow-Origin', origin);
|
|
5
5
|
setHeader('Access-Control-Allow-Credentials', 'true');
|
|
6
6
|
setHeader('Access-Control-Allow-Methods', 'GET,POST,PUT,PATCH,DELETE,OPTIONS');
|
|
7
|
-
setHeader('Access-Control-Allow-Headers', 'Content-Type,Authorization,Accept,X-Requested-With,Cache-Control,X-OpenCode-Directory,X-OpenCode-Directory-Encoding,X-Message-Queue-Upload-Token,X-Message-Queue-Sha256,X-Message-Queue-Content-Length,X-Yuri-Content-Length,X-Yuri-Sha256,X-Yuri-Mime,X-Yuri-Filename');
|
|
7
|
+
setHeader('Access-Control-Allow-Headers', 'Content-Type,Authorization,Accept,X-Requested-With,Cache-Control,X-OpenCode-Directory,X-OpenCode-Directory-Encoding,X-Message-Queue-Upload-Token,X-Message-Queue-Sha256,X-Message-Queue-Content-Length,X-Yuri-Content-Length,X-Yuri-Sha256,X-Yuri-Mime,X-Yuri-Filename,X-Yuri-Gui-Revision');
|
|
8
8
|
// Packaged clients (Electron yuri-ui://app, Capacitor, Vite HMR) are
|
|
9
9
|
// cross-origin to the runtime API. Without an expose list, browsers hide
|
|
10
10
|
// custom response headers from JS — including the optional-read existence
|
|
11
11
|
// marker that FilesAPI.readFile({ optional: true }) requires.
|
|
12
|
-
setHeader('Access-Control-Expose-Headers', 'x-next-cursor, x-yuri-file-exists, x-speech-pitch, x-speech-volume');
|
|
12
|
+
setHeader('Access-Control-Expose-Headers', 'x-next-cursor, x-yuri-file-exists, x-speech-pitch, x-speech-volume, x-yuri-gui-revision, x-yuri-gui-code');
|
|
13
13
|
setHeader('Access-Control-Max-Age', PREFLIGHT_CACHE_SECONDS);
|
|
14
14
|
setHeader('Vary', 'Origin');
|
|
15
15
|
};
|
|
@@ -18,6 +18,9 @@ describe('applyRuntimeCorsHeaders', () => {
|
|
|
18
18
|
expect(headers.get('Access-Control-Allow-Headers')).toContain('X-Yuri-Sha256');
|
|
19
19
|
expect(headers.get('Access-Control-Allow-Headers')).toContain('X-Yuri-Content-Length');
|
|
20
20
|
expect(headers.get('Access-Control-Allow-Headers')).toContain('X-Yuri-Filename');
|
|
21
|
+
expect(headers.get('Access-Control-Allow-Headers')).toContain('X-Yuri-Gui-Revision');
|
|
22
|
+
expect(headers.get('Access-Control-Expose-Headers')).toContain('x-yuri-gui-revision');
|
|
23
|
+
expect(headers.get('Access-Control-Expose-Headers')).toContain('x-yuri-gui-code');
|
|
21
24
|
expect(headers.get('Access-Control-Expose-Headers')).toContain('x-next-cursor');
|
|
22
25
|
expect(headers.get('Access-Control-Expose-Headers')).toContain('x-yuri-file-exists');
|
|
23
26
|
});
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Session Index Runtime
|
|
2
2
|
|
|
3
|
+
Directory refresh retains its previous snapshot when the pagination budget is
|
|
4
|
+
exhausted before filling the visible root limit. Filtered global pages with a
|
|
5
|
+
continuation are partial results, not authoritative empty directories.
|
|
6
|
+
|
|
3
7
|
## Missing local directories
|
|
4
8
|
|
|
5
9
|
The Host probes local directory existence asynchronously before background root
|
|
@@ -301,6 +301,9 @@ export const createSessionIndexSyncRuntime = ({
|
|
|
301
301
|
active.push(session);
|
|
302
302
|
}
|
|
303
303
|
|
|
304
|
+
if (hitPageBudget && active.length < SESSION_LIMIT) {
|
|
305
|
+
throw new Error('Directory scan incomplete; retaining prior session index');
|
|
306
|
+
}
|
|
304
307
|
const oldest = active[active.length - 1];
|
|
305
308
|
const cursorNumber = lastCursorToken && Number.isFinite(Number(lastCursorToken))
|
|
306
309
|
? Number(lastCursorToken)
|
|
@@ -41,6 +41,24 @@ const isFullyIdle = (runtime) => (
|
|
|
41
41
|
);
|
|
42
42
|
|
|
43
43
|
describe('session index background sync runtime', () => {
|
|
44
|
+
it('preserves prior directory rows when filtered global pages exhaust the scan budget', async () => {
|
|
45
|
+
const service = createService([{ directory: '/repo', sessions: [session('existing', 10)] }]);
|
|
46
|
+
let page = 0;
|
|
47
|
+
const runtime = createSessionIndexSyncRuntime({
|
|
48
|
+
sessionIndexService: service,
|
|
49
|
+
buildOpenCodeUrl: (route) => `http://opencode.test${route}`,
|
|
50
|
+
getOpenCodeAuthHeaders: () => ({}),
|
|
51
|
+
waitForOpenCodeReady: async () => true,
|
|
52
|
+
fetchFn: async () => Response.json({ data: [], cursor: { next: `page-${++page}` } }),
|
|
53
|
+
});
|
|
54
|
+
try {
|
|
55
|
+
runtime.enqueue(['/repo']);
|
|
56
|
+
await waitUntil(() => isFullyIdle(runtime));
|
|
57
|
+
expect(page).toBe(5);
|
|
58
|
+
expect(service.replaceDirectory).not.toHaveBeenCalled();
|
|
59
|
+
expect(service.snapshot().directories[0].sessions[0].id).toBe('existing');
|
|
60
|
+
} finally { runtime.stop(); }
|
|
61
|
+
});
|
|
44
62
|
it('does not probe indexed directories at startup', async () => {
|
|
45
63
|
const service = createService([{ directory: '/repo', sessions: [], hasMore: false }]);
|
|
46
64
|
service.removeEmptyDirectory = vi.fn(() => true);
|