@yuriai/web 0.2.0-beta.6 → 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.
Files changed (118) hide show
  1. package/dist/assets/{AgentAvatar-DtMkzQZ_.js → AgentAvatar-CMpCBSy_.js} +1 -1
  2. package/dist/assets/{AssistantView-CH8_c8hM.js → AssistantView-BlPMro6O.js} +3 -3
  3. package/dist/assets/{DiagramView-CEK78uU2.js → DiagramView-BKXzTCL8.js} +1 -1
  4. package/dist/assets/{FadeInOnReveal-TjU_WL37.js → FadeInOnReveal-ANDXEIE7.js} +1 -1
  5. package/dist/assets/{GuiPluginSurface-Cm4QyBLo.js → GuiPluginSurface-BNly6Xlz.js} +1 -1
  6. package/dist/assets/{GuiPluginWindow-DWD2MAyQ.js → GuiPluginWindow-Cfi0SMUy.js} +1 -1
  7. package/dist/assets/{Icon-giRdbrNf.js → Icon-DgrlwLKs.js} +1 -1
  8. package/dist/assets/{ImageLoadingPlaceholder-iyU1QhoP.js → ImageLoadingPlaceholder-1ACRI1jC.js} +1 -1
  9. package/dist/assets/{LoadingImage-C7a7GyLc.js → LoadingImage-CVpLgSVp.js} +1 -1
  10. package/dist/assets/MarkdownRenderer-CgvK6Tz9.js +2 -0
  11. package/dist/assets/{MarkdownRendererImpl-1Hjd-zSW.js → MarkdownRendererImpl-TDDDij0i.js} +1 -1
  12. package/dist/assets/{MarkstreamRendererImpl-C4MyKG9L.js → MarkstreamRendererImpl-C6-UfI7p.js} +1 -1
  13. package/dist/assets/{MobileDetailNavigation-CAxWWuuz.js → MobileDetailNavigation-BdEfSCm4.js} +1 -1
  14. package/dist/assets/{MobileResizableSheet-inQgquPH.js → MobileResizableSheet-xE71zG4E.js} +1 -1
  15. package/dist/assets/MobileShareBridge-B5WB1WKT.js +4 -0
  16. package/dist/assets/{MobileTabPageHeader-CG-Or7Lk.js → MobileTabPageHeader-BBNJMFBw.js} +1 -1
  17. package/dist/assets/{MultiRunWindow-BXC_UiJz.js → MultiRunWindow-v4oq9X77.js} +1 -1
  18. package/dist/assets/{OnboardingScreen-B4FMt-Wd.js → OnboardingScreen-BH__JnO0.js} +1 -1
  19. package/dist/assets/{OverlayScrollbar-DJDdcmwv.js → OverlayScrollbar-bByT588g.js} +1 -1
  20. package/dist/assets/{SettingsView-0wt2B8lv.js → SettingsView-CvS8W9-A.js} +1 -1
  21. package/dist/assets/{SettingsWindow-0IifiXpI.js → SettingsWindow-C7EEBdGt.js} +1 -1
  22. package/dist/assets/{TerminalView-Dmnh-0xP.js → TerminalView-f9li4Dcm.js} +1 -1
  23. package/dist/assets/{ToolOutputDialog-Dwdyj0sf.js → ToolOutputDialog-zF7xpkS8.js} +1 -1
  24. package/dist/assets/{YuriLogo-BqA0pCyD.js → YuriLogo-Qr_mhaKp.js} +1 -1
  25. package/dist/assets/{appThemeRegistry-DE1bgMts.js → appThemeRegistry-BKP8vwhk.js} +1 -1
  26. package/dist/assets/{assistant-attachment-cache-tZmmQ6I2.js → assistant-attachment-cache-DWMcn4cE.js} +1 -1
  27. package/dist/assets/{button-D6gHjV_f.js → button-BuhP8T0R.js} +1 -1
  28. package/dist/assets/{capgoAdapter-Du233f4X.js → capgoAdapter-Bh3XnAlW.js} +1 -1
  29. package/dist/assets/{collapsible-CnA0u5S9.js → collapsible-CwLF0o1c.js} +1 -1
  30. package/dist/assets/{device-Dw1mUG7s.js → device-D_NngvEq.js} +1 -1
  31. package/dist/assets/{diagram-DwYOPB42.js → diagram-BIYywJNf.js} +1 -1
  32. package/dist/assets/{dialog-D6iTQ8x_.js → dialog-BUEUatKm.js} +1 -1
  33. package/dist/assets/{dropdown-menu.styles-BSUw0erN.js → dropdown-menu.styles-LCAyXnEk.js} +1 -1
  34. package/dist/assets/{es-BQC0Cjvs.js → es-BIEtnCM1.js} +2 -2
  35. package/dist/assets/{fileMentionTouchSelection-BMV-bn7Y.js → fileMentionTouchSelection-B9osqnyB.js} +1 -1
  36. package/dist/assets/{fileQueries-QvEzQ4wT.js → fileQueries-DbUx7NwP.js} +1 -1
  37. package/dist/assets/{fr-BEs3arTt.js → fr-CYbm8LUE.js} +2 -2
  38. package/dist/assets/{gitApi-BmehlssB.js → gitApi-B4bdEdqD.js} +1 -1
  39. package/dist/assets/gui-DZ723-fy.js +1 -0
  40. package/dist/assets/{host-srMXY66T.js → host-Bs4ljApp.js} +1 -1
  41. package/dist/assets/{image-loading-2rgFmXBb.js → image-loading-Ctpxfqla.js} +1 -1
  42. package/dist/assets/{input-BJ-BM-aV.js → input-BVgNVYou.js} +1 -1
  43. package/dist/assets/{insertionBoundaries-Cmswpm95.js → insertionBoundaries-BY22eMtE.js} +1 -1
  44. package/dist/assets/{ja-DwjQqURQ.js → ja-DJq4-rL4.js} +2 -2
  45. package/dist/assets/{ko-5ebvOeiM.js → ko-DUjfbG7o.js} +2 -2
  46. package/dist/assets/main-AMwJi-py.js +2 -0
  47. package/dist/assets/main-C7jIE2Fj.js +169 -0
  48. package/dist/assets/{markdownHeightCache-BWX84Di3.js → markdownHeightCache-BceTKVDK.js} +1 -1
  49. package/dist/assets/{mcpQueries-DxUPMkbb.js → mcpQueries-BUMvgK26.js} +1 -1
  50. package/dist/assets/miniChat-RvuopuxS.js +2 -0
  51. package/dist/assets/mobile-DIHyvbDs.js +2 -0
  52. package/dist/assets/{mobileBackNavigation-DnZfGb2B.js → mobileBackNavigation-BXe_06C5.js} +1 -1
  53. package/dist/assets/{multirun-B5Zo52zR.js → multirun-CQx2I3IZ.js} +1 -1
  54. package/dist/assets/{native-config-ENXrGGmj.js → native-config-3PInpl5r.js} +1 -1
  55. package/dist/assets/{pl-ptv06x7p.js → pl-CBlSVV3-.js} +2 -2
  56. package/dist/assets/{platform-BtuVsKCV.js → platform-BND-ZKbF.js} +2 -2
  57. package/dist/assets/{projectMeta-Enda95EO.js → projectMeta-B_eftQTB.js} +1 -1
  58. package/dist/assets/{pt-BR-DREchPJf.js → pt-BR-CY8I_bEt.js} +2 -2
  59. package/dist/assets/{readiness-Dwu9ibRz.js → readiness-CerJYd9R.js} +1 -1
  60. package/dist/assets/{renderElectronMiniChatApp-DoD-e7GD.js → renderElectronMiniChatApp-CPBlGAhU.js} +2 -2
  61. package/dist/assets/renderMobileApp-CrP_LwLi.js +28 -0
  62. package/dist/assets/{runtime-file-download-BHIiwnLA.js → runtime-file-download-CwP-HoXN.js} +1 -1
  63. package/dist/assets/runtime-file-resource-h3yIw4HU.js +2 -0
  64. package/dist/assets/runtime-file-store-BVRgEtI-.js +1 -0
  65. package/dist/assets/{runtimeConfig-DdBn2mS5.js → runtimeConfig-fwwvQvAp.js} +1 -1
  66. package/dist/assets/runtimeEndpointReset-CEwt353V.js +149 -0
  67. package/dist/assets/{runtimeEndpointReset-DmY_4gYI.css → runtimeEndpointReset-HYSytKO-.css} +1 -1
  68. package/dist/assets/{scheduledTaskNavigation-935X_XS3.js → scheduledTaskNavigation-DFa4lhwN.js} +1 -1
  69. package/dist/assets/{sessionChangeSummary-DHaY-qPt.js → sessionChangeSummary-D9-zyniS.js} +1 -1
  70. package/dist/assets/{sessionLookup-CAQ02JfI.js → sessionLookup-pq3vdPGh.js} +1 -1
  71. package/dist/assets/{sortable-tabs-strip-BH5E9ABJ.js → sortable-tabs-strip-DTWwlndW.js} +1 -1
  72. package/dist/assets/speechSettingsQueries-CCFpfJtJ.js +4 -0
  73. package/dist/assets/src-r07HspQy.css +2 -0
  74. package/dist/assets/{store-Dy_l1m3m.js → store-BhjP3zxz.js} +3 -3
  75. package/dist/assets/{terminalApi-DBa-4CzM.js → terminalApi-rE93RnSc.js} +1 -1
  76. package/dist/assets/{textarea-COmti5oi.js → textarea-BLvbQAIG.js} +1 -1
  77. package/dist/assets/{tooltip-DoKFlr59.js → tooltip-jf98dFQe.js} +1 -1
  78. package/dist/assets/{types-CJYCyR67.js → types-BG8ZDWn4.js} +1 -1
  79. package/dist/assets/{uk-HcldNNPe.js → uk-DZVrg2WI.js} +2 -2
  80. package/dist/assets/{useAppFontEffects-Cl46KRzc.js → useAppFontEffects-EC1-6ksC.js} +5 -5
  81. package/dist/assets/{useDesktopWindowControlsLayout-B-FL8O38.js → useDesktopWindowControlsLayout-Cz30O7Tu.js} +1 -1
  82. package/dist/assets/{useEffectiveDirectory-CVh1uKyD.js → useEffectiveDirectory-C8VRrWsr.js} +1 -1
  83. package/dist/assets/{useFontPreferences-AMSPolL9.js → useFontPreferences-qIHM7E9c.js} +1 -1
  84. package/dist/assets/{useMobileNavigationStore-BW6CZbF_.js → useMobileNavigationStore-YGHA7SiM.js} +7 -7
  85. package/dist/assets/{useWorkerHighlightedLines-CSb6g4H6.js → useWorkerHighlightedLines-Bfa_CBGR.js} +1 -1
  86. package/dist/assets/{zh-CN-Dg3fYgX1.js → zh-CN-b17bGCPK.js} +2 -2
  87. package/dist/assets/{zh-TW-FIWAmsGT.js → zh-TW-DN-AMZ3b.js} +2 -2
  88. package/dist/index.html +12 -11
  89. package/dist/mini-chat.html +12 -11
  90. package/dist/mobile.html +12 -11
  91. package/package.json +1 -1
  92. package/server/lib/content-search/DOCUMENTATION.md +5 -1
  93. package/server/lib/content-search/runtime.js +24 -0
  94. package/server/lib/content-search/runtime.test.js +19 -0
  95. package/server/lib/opencode/DOCUMENTATION.md +4 -0
  96. package/server/lib/opencode/plugin-gui-response.d.ts +7 -0
  97. package/server/lib/opencode/plugin-gui-response.js +62 -0
  98. package/server/lib/opencode/plugin-gui-response.test.js +89 -0
  99. package/server/lib/opencode/proxy.js +32 -0
  100. package/server/lib/relay/DOCUMENTATION.md +1 -0
  101. package/server/lib/request-cors.js +2 -2
  102. package/server/lib/request-cors.test.js +3 -0
  103. package/server/lib/session-index/DOCUMENTATION.md +4 -0
  104. package/server/lib/session-index/sync-runtime.js +3 -0
  105. package/server/lib/session-index/sync-runtime.test.js +18 -0
  106. package/server/plugin-gui-proxy.test.js +134 -0
  107. package/dist/assets/MarkdownRenderer-Dx_OlkJC.js +0 -2
  108. package/dist/assets/MobileShareBridge-RRbG1OeH.js +0 -4
  109. package/dist/assets/gui-DpIvy9qB.js +0 -1
  110. package/dist/assets/main-C1CRhrXG.js +0 -2
  111. package/dist/assets/main-ujyhnnF8.js +0 -169
  112. package/dist/assets/miniChat-AKE2TE9Q.js +0 -2
  113. package/dist/assets/mobile-CTw9gT8g.js +0 -2
  114. package/dist/assets/renderMobileApp-C5zsgozh.js +0 -28
  115. package/dist/assets/runtime-file-resource-4US6DwDy.js +0 -2
  116. package/dist/assets/runtimeEndpointReset-DOpGxDiO.js +0 -149
  117. package/dist/assets/speechSettingsQueries-BE4xY8Sj.js +0 -4
  118. package/dist/assets/src-CZA3gFyl.css +0 -2
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-C1CRhrXG.js"></script>
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">
@@ -583,18 +583,19 @@
583
583
  <link rel="modulepreload" crossorigin href="/assets/pathNormalization-ewtPqJWn.js">
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
- <link rel="modulepreload" crossorigin href="/assets/fileQueries-QvEzQ4wT.js">
586
+ <link rel="modulepreload" crossorigin href="/assets/fileQueries-DbUx7NwP.js">
587
+ <link rel="modulepreload" crossorigin href="/assets/runtime-file-store-BVRgEtI-.js">
587
588
  <link rel="modulepreload" crossorigin href="/assets/path-utils-jGozTg9d.js">
588
589
  <link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
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">
597
- <link rel="stylesheet" crossorigin href="/assets/src-CZA3gFyl.css">
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">
598
599
  </head>
599
600
  <body class="h-full bg-background text-foreground">
600
601
  <!-- Keep the startup layer outside #root. React replaces every child of
@@ -74,7 +74,7 @@
74
74
  }
75
75
  </style>
76
76
 
77
- <script type="module" crossorigin src="/assets/miniChat-AKE2TE9Q.js"></script>
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">
@@ -97,18 +97,19 @@
97
97
  <link rel="modulepreload" crossorigin href="/assets/pathNormalization-ewtPqJWn.js">
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
- <link rel="modulepreload" crossorigin href="/assets/fileQueries-QvEzQ4wT.js">
100
+ <link rel="modulepreload" crossorigin href="/assets/fileQueries-DbUx7NwP.js">
101
+ <link rel="modulepreload" crossorigin href="/assets/runtime-file-store-BVRgEtI-.js">
101
102
  <link rel="modulepreload" crossorigin href="/assets/path-utils-jGozTg9d.js">
102
103
  <link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
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">
111
- <link rel="stylesheet" crossorigin href="/assets/src-CZA3gFyl.css">
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">
112
113
  </head>
113
114
  <body class="h-full bg-background text-foreground">
114
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-CTw9gT8g.js"></script>
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">
@@ -86,18 +86,19 @@
86
86
  <link rel="modulepreload" crossorigin href="/assets/pathNormalization-ewtPqJWn.js">
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
- <link rel="modulepreload" crossorigin href="/assets/fileQueries-QvEzQ4wT.js">
89
+ <link rel="modulepreload" crossorigin href="/assets/fileQueries-DbUx7NwP.js">
90
+ <link rel="modulepreload" crossorigin href="/assets/runtime-file-store-BVRgEtI-.js">
90
91
  <link rel="modulepreload" crossorigin href="/assets/path-utils-jGozTg9d.js">
91
92
  <link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
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">
100
- <link rel="stylesheet" crossorigin href="/assets/src-CZA3gFyl.css">
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">
101
102
  </head>
102
103
  <body class="h-full bg-background text-foreground">
103
104
  <div id="root" class="h-full"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuriai/web",
3
- "version": "0.2.0-beta.6",
3
+ "version": "0.2.0-beta.8",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./server/index.js",
@@ -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 failures
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);