@yuriai/web 0.2.0-beta.5 → 0.2.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AgentAvatar-DtMkzQZ_.js → AgentAvatar-CMpCBSy_.js} +1 -1
- package/dist/assets/{AssistantView-6O3NFtqC.js → AssistantView-CfyUDUVG.js} +3 -3
- package/dist/assets/{DiagramView-Hher-h6H.js → DiagramView-CZg5AAli.js} +1 -1
- package/dist/assets/{FadeInOnReveal-TjU_WL37.js → FadeInOnReveal-ANDXEIE7.js} +1 -1
- package/dist/assets/{GuiPluginSurface-DXeqcfY3.js → GuiPluginSurface-CqqJymvB.js} +1 -1
- package/dist/assets/{GuiPluginWindow-BZJ8izaH.js → GuiPluginWindow-B2G2-nAK.js} +1 -1
- package/dist/assets/{Icon-giRdbrNf.js → Icon-DgrlwLKs.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-iyU1QhoP.js → ImageLoadingPlaceholder-DdaN0XMj.js} +1 -1
- package/dist/assets/{LoadingImage-C7a7GyLc.js → LoadingImage-BJc5SC-0.js} +1 -1
- package/dist/assets/MarkdownRenderer-DZwskKzl.js +2 -0
- package/dist/assets/{MarkdownRendererImpl-DVoAsYmS.js → MarkdownRendererImpl-BQhcJNsK.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-CV6jjTpf.js → MarkstreamRendererImpl-CsURmqQY.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-DuSr0tTA.js → MobileDetailNavigation-CH4Oyt33.js} +1 -1
- package/dist/assets/{MobileResizableSheet-inQgquPH.js → MobileResizableSheet-xE71zG4E.js} +1 -1
- package/dist/assets/MobileShareBridge-DEDl3YCM.js +4 -0
- package/dist/assets/{MobileTabPageHeader-uJ8dKmgd.js → MobileTabPageHeader-C7Bkm6-_.js} +1 -1
- package/dist/assets/{MultiRunWindow-DZ1j0Dkd.js → MultiRunWindow-DI0-Ur1w.js} +1 -1
- package/dist/assets/{OnboardingScreen-B4FMt-Wd.js → OnboardingScreen-BH__JnO0.js} +1 -1
- package/dist/assets/{OverlayScrollbar-DJDdcmwv.js → OverlayScrollbar-bByT588g.js} +1 -1
- package/dist/assets/{SettingsView-sGrAs9ve.js → SettingsView-BVmOocRh.js} +1 -1
- package/dist/assets/{SettingsWindow-CS2FMIfT.js → SettingsWindow-BJQyV3do.js} +1 -1
- package/dist/assets/{TerminalView-CVPedDHn.js → TerminalView-DRwLYPvJ.js} +1 -1
- package/dist/assets/{ToolOutputDialog-iRAV-k1u.js → ToolOutputDialog-O25CmHgA.js} +1 -1
- package/dist/assets/{YuriLogo-BqA0pCyD.js → YuriLogo-Qr_mhaKp.js} +1 -1
- package/dist/assets/{appThemeRegistry-Bhv6nS-u.js → appThemeRegistry-B-rbBHC4.js} +1 -1
- package/dist/assets/{assistant-attachment-cache-tZmmQ6I2.js → assistant-attachment-cache-DNbxU1Fq.js} +1 -1
- package/dist/assets/{button-D6gHjV_f.js → button-BuhP8T0R.js} +1 -1
- package/dist/assets/{capgoAdapter-0ZtbMR6Z.js → capgoAdapter-BgDvFDUs.js} +1 -1
- package/dist/assets/{collapsible-CnA0u5S9.js → collapsible-CwLF0o1c.js} +1 -1
- package/dist/assets/{device-D6RHIV_h.js → device-BVEAUyle.js} +1 -1
- package/dist/assets/{diagram-DwYOPB42.js → diagram-BIYywJNf.js} +1 -1
- package/dist/assets/{dialog-D6iTQ8x_.js → dialog-BUEUatKm.js} +1 -1
- package/dist/assets/{dropdown-menu.styles-BRW8BT1V.js → dropdown-menu.styles-tzNMk1yW.js} +1 -1
- package/dist/assets/{es-BQC0Cjvs.js → es-BIEtnCM1.js} +2 -2
- package/dist/assets/{fileMentionTouchSelection-wDv5vIb4.js → fileMentionTouchSelection-C6ylhQkG.js} +1 -1
- package/dist/assets/{fileQueries-QvEzQ4wT.js → fileQueries-DbUx7NwP.js} +1 -1
- package/dist/assets/{fr-BEs3arTt.js → fr-CYbm8LUE.js} +2 -2
- package/dist/assets/{gitApi-CVxUMiqs.js → gitApi-4JPWt45Y.js} +1 -1
- package/dist/assets/gui-B56BgPNQ.js +1 -0
- package/dist/assets/{host-srMXY66T.js → host-Bs4ljApp.js} +1 -1
- package/dist/assets/{image-loading-2rgFmXBb.js → image-loading-CU4V_A1c.js} +1 -1
- package/dist/assets/{input-BJ-BM-aV.js → input-BVgNVYou.js} +1 -1
- package/dist/assets/{insertionBoundaries-Ctgm0pX6.js → insertionBoundaries-BSPv205d.js} +1 -1
- package/dist/assets/{ja-DwjQqURQ.js → ja-DJq4-rL4.js} +2 -2
- package/dist/assets/{ko-5ebvOeiM.js → ko-DUjfbG7o.js} +2 -2
- package/dist/assets/main-CETRwACI.js +169 -0
- package/dist/assets/main-foDhMZ24.js +2 -0
- package/dist/assets/{markdownHeightCache-BWX84Di3.js → markdownHeightCache-BceTKVDK.js} +1 -1
- package/dist/assets/{mcpQueries-DyCIeQmm.js → mcpQueries-AswEbyXP.js} +1 -1
- package/dist/assets/miniChat-Dsodcwqi.js +2 -0
- package/dist/assets/mobile-C4F47gek.js +2 -0
- package/dist/assets/{mobileBackNavigation-gnihJDQb.js → mobileBackNavigation-C03Z5phB.js} +1 -1
- package/dist/assets/{multirun-C11LDNc0.js → multirun-CWGx21Ol.js} +1 -1
- package/dist/assets/{native-config-BupiMhBe.js → native-config-DC-Ccre6.js} +1 -1
- package/dist/assets/{pl-ptv06x7p.js → pl-CBlSVV3-.js} +2 -2
- package/dist/assets/{platform-BxfprX15.js → platform-CQG2KlHW.js} +3 -3
- package/dist/assets/{projectMeta-CgbRkhl1.js → projectMeta-6Sbr-Iiw.js} +1 -1
- package/dist/assets/{pt-BR-DREchPJf.js → pt-BR-CY8I_bEt.js} +2 -2
- package/dist/assets/{readiness-D6Yhaj2W.js → readiness-DWh0yJFu.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-TX-wG67x.js → renderElectronMiniChatApp-CQHm04xq.js} +2 -2
- package/dist/assets/renderMobileApp-D4lOGRzz.js +28 -0
- package/dist/assets/{runtime-file-download-BHIiwnLA.js → runtime-file-download-BdNCQkDe.js} +1 -1
- package/dist/assets/runtime-file-resource-DdAheq3y.js +2 -0
- package/dist/assets/runtime-file-store-hFlndg-n.js +1 -0
- package/dist/assets/{runtimeConfig-BZbfvch8.js → runtimeConfig-5btjngJ7.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-DmY_4gYI.css → runtimeEndpointReset-HYSytKO-.css} +1 -1
- package/dist/assets/runtimeEndpointReset-NHpx5wGb.js +149 -0
- package/dist/assets/{scheduledTaskNavigation-8rJFjQWy.js → scheduledTaskNavigation-Cy2nZl_A.js} +1 -1
- package/dist/assets/{sessionChangeSummary-zFviJimG.js → sessionChangeSummary-C70M_uHA.js} +1 -1
- package/dist/assets/{sessionLookup-DKJNcuN_.js → sessionLookup-CCOa3Jeq.js} +1 -1
- package/dist/assets/{sortable-tabs-strip-kyGjL8Ym.js → sortable-tabs-strip-CAkRGa2f.js} +1 -1
- package/dist/assets/speechSettingsQueries-CIcSgao2.js +4 -0
- package/dist/assets/src-BR-siHj2.css +2 -0
- package/dist/assets/{store-Dy_l1m3m.js → store-BhjP3zxz.js} +3 -3
- package/dist/assets/{terminalApi-CbdyLKQc.js → terminalApi-DY0KJOiK.js} +1 -1
- package/dist/assets/{textarea-COmti5oi.js → textarea-BLvbQAIG.js} +1 -1
- package/dist/assets/{tooltip-DoKFlr59.js → tooltip-jf98dFQe.js} +1 -1
- package/dist/assets/{types-DYDLQOKT.js → types-D5ocrnEK.js} +1 -1
- package/dist/assets/{uk-HcldNNPe.js → uk-DZVrg2WI.js} +2 -2
- package/dist/assets/{useAppFontEffects-BFMuXOWZ.js → useAppFontEffects-DSR2ev_Q.js} +5 -5
- package/dist/assets/{useDesktopWindowControlsLayout-BRmymxlE.js → useDesktopWindowControlsLayout-pyawlD_R.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-B_KnXAgL.js → useEffectiveDirectory-W6wf50T7.js} +1 -1
- package/dist/assets/{useFontPreferences-B7zZSuJJ.js → useFontPreferences-CH3iNDUl.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-DT5mNqWh.js → useMobileNavigationStore-BTF3FUmY.js} +7 -7
- package/dist/assets/{useWorkerHighlightedLines-CUUmS5X0.js → useWorkerHighlightedLines-Dhr3xUQY.js} +1 -1
- package/dist/assets/{zh-CN-Dg3fYgX1.js → zh-CN-b17bGCPK.js} +2 -2
- package/dist/assets/{zh-TW-FIWAmsGT.js → zh-TW-DN-AMZ3b.js} +2 -2
- package/dist/index.html +12 -11
- package/dist/mini-chat.html +12 -11
- package/dist/mobile.html +12 -11
- package/package.json +1 -1
- package/server/index.js +1 -12
- package/server/lib/content-search/DOCUMENTATION.md +12 -2
- package/server/lib/content-search/event-ingest.integration.test.js +52 -0
- package/server/lib/content-search/event-repair.test.js +48 -0
- package/server/lib/content-search/index.js +2 -2
- package/server/lib/content-search/runtime.js +4 -4
- package/server/lib/content-search/service.js +7 -1
- package/server/lib/opencode/lifecycle.js +19 -1
- package/server/lib/question-auto-delegate/DOCUMENTATION.md +5 -1
- package/server/lib/question-auto-delegate/core.d.ts +2 -2
- package/server/lib/question-auto-delegate/runtime.js +11 -27
- package/server/lib/question-auto-delegate/runtime.test.js +25 -0
- package/server/lib/scheduled-tasks/DOCUMENTATION.md +5 -0
- package/server/lib/scheduled-tasks/runtime.js +16 -0
- package/server/lib/scheduled-tasks/runtime.test.js +33 -0
- package/dist/assets/MarkdownRenderer-D3_fpssn.js +0 -2
- package/dist/assets/MobileShareBridge-CgATSPbV.js +0 -4
- package/dist/assets/gui-DpIvy9qB.js +0 -1
- package/dist/assets/main-BH5wC5YF.js +0 -2
- package/dist/assets/main-C52hcXbF.js +0 -169
- package/dist/assets/miniChat-DoZ6DORs.js +0 -2
- package/dist/assets/mobile-yjjnJFod.js +0 -2
- package/dist/assets/renderMobileApp-B-GAh_XB.js +0 -28
- package/dist/assets/runtime-file-resource-4US6DwDy.js +0 -2
- package/dist/assets/runtimeEndpointReset-BJz7-nQ-.js +0 -149
- package/dist/assets/speechSettingsQueries-1kzEZaDk.js +0 -4
- 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-
|
|
563
|
+
<script type="module" crossorigin src="/assets/main-foDhMZ24.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-
|
|
586
|
+
<link rel="modulepreload" crossorigin href="/assets/fileQueries-DbUx7NwP.js">
|
|
587
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-store-hFlndg-n.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-
|
|
590
|
-
<link rel="modulepreload" crossorigin href="/assets/platform-
|
|
591
|
-
<link rel="modulepreload" crossorigin href="/assets/terminalApi-
|
|
592
|
-
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-
|
|
593
|
-
<link rel="modulepreload" crossorigin href="/assets/types-
|
|
594
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
595
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
596
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
597
|
-
<link rel="stylesheet" crossorigin href="/assets/src-
|
|
590
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-DdAheq3y.js">
|
|
591
|
+
<link rel="modulepreload" crossorigin href="/assets/platform-CQG2KlHW.js">
|
|
592
|
+
<link rel="modulepreload" crossorigin href="/assets/terminalApi-DY0KJOiK.js">
|
|
593
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-BdNCQkDe.js">
|
|
594
|
+
<link rel="modulepreload" crossorigin href="/assets/types-D5ocrnEK.js">
|
|
595
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-BgDvFDUs.js">
|
|
596
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-DC-Ccre6.js">
|
|
597
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-5btjngJ7.js">
|
|
598
|
+
<link rel="stylesheet" crossorigin href="/assets/src-BR-siHj2.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
|
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-Dsodcwqi.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-
|
|
100
|
+
<link rel="modulepreload" crossorigin href="/assets/fileQueries-DbUx7NwP.js">
|
|
101
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-store-hFlndg-n.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-
|
|
104
|
-
<link rel="modulepreload" crossorigin href="/assets/platform-
|
|
105
|
-
<link rel="modulepreload" crossorigin href="/assets/terminalApi-
|
|
106
|
-
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-
|
|
107
|
-
<link rel="modulepreload" crossorigin href="/assets/types-
|
|
108
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
109
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
110
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
111
|
-
<link rel="stylesheet" crossorigin href="/assets/src-
|
|
104
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-DdAheq3y.js">
|
|
105
|
+
<link rel="modulepreload" crossorigin href="/assets/platform-CQG2KlHW.js">
|
|
106
|
+
<link rel="modulepreload" crossorigin href="/assets/terminalApi-DY0KJOiK.js">
|
|
107
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-BdNCQkDe.js">
|
|
108
|
+
<link rel="modulepreload" crossorigin href="/assets/types-D5ocrnEK.js">
|
|
109
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-BgDvFDUs.js">
|
|
110
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-DC-Ccre6.js">
|
|
111
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-5btjngJ7.js">
|
|
112
|
+
<link rel="stylesheet" crossorigin href="/assets/src-BR-siHj2.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-
|
|
66
|
+
<script type="module" crossorigin src="/assets/mobile-C4F47gek.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-
|
|
89
|
+
<link rel="modulepreload" crossorigin href="/assets/fileQueries-DbUx7NwP.js">
|
|
90
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-store-hFlndg-n.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-
|
|
93
|
-
<link rel="modulepreload" crossorigin href="/assets/platform-
|
|
94
|
-
<link rel="modulepreload" crossorigin href="/assets/terminalApi-
|
|
95
|
-
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-
|
|
96
|
-
<link rel="modulepreload" crossorigin href="/assets/types-
|
|
97
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
98
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
99
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
100
|
-
<link rel="stylesheet" crossorigin href="/assets/src-
|
|
93
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-DdAheq3y.js">
|
|
94
|
+
<link rel="modulepreload" crossorigin href="/assets/platform-CQG2KlHW.js">
|
|
95
|
+
<link rel="modulepreload" crossorigin href="/assets/terminalApi-DY0KJOiK.js">
|
|
96
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-BdNCQkDe.js">
|
|
97
|
+
<link rel="modulepreload" crossorigin href="/assets/types-D5ocrnEK.js">
|
|
98
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-BgDvFDUs.js">
|
|
99
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-DC-Ccre6.js">
|
|
100
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-5btjngJ7.js">
|
|
101
|
+
<link rel="stylesheet" crossorigin href="/assets/src-BR-siHj2.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
package/server/index.js
CHANGED
|
@@ -1019,18 +1019,6 @@ questionAutoDelegateRuntime = createQuestionAutoDelegateRuntime({
|
|
|
1019
1019
|
buildOpenCodeUrl,
|
|
1020
1020
|
getOpenCodeAuthHeaders,
|
|
1021
1021
|
readSettingsFromDiskMigrated,
|
|
1022
|
-
sanitizeProjects,
|
|
1023
|
-
listIndexedDirectories: async () => {
|
|
1024
|
-
try {
|
|
1025
|
-
const snap = sessionIndexServiceRef?.snapshot?.();
|
|
1026
|
-
const directories = Array.isArray(snap?.directories) ? snap.directories : [];
|
|
1027
|
-
return directories
|
|
1028
|
-
.map((entry) => (typeof entry?.directory === 'string' ? entry.directory.trim() : ''))
|
|
1029
|
-
.filter(Boolean);
|
|
1030
|
-
} catch {
|
|
1031
|
-
return [];
|
|
1032
|
-
}
|
|
1033
|
-
},
|
|
1034
1022
|
broadcastGlobalUiEvent,
|
|
1035
1023
|
broadcastYuriEvent: broadcastQuestionAutoDelegateTip,
|
|
1036
1024
|
onUserTakeover: ({ sessionID, directory }) => {
|
|
@@ -1600,6 +1588,7 @@ async function main(options = {}) {
|
|
|
1600
1588
|
const contentSearch = createGlobalContentSearch({
|
|
1601
1589
|
dataDir: path.dirname(resolveSessionIndexDbPath({ sessionIndexDbPath }, YURI_DATA_DIR)),
|
|
1602
1590
|
getRuntimeKey: () => sessionIndexService.getRuntimeKey(),
|
|
1591
|
+
getEventRuntimeKey: () => messageQueueService?.getRuntimeKey() ?? null,
|
|
1603
1592
|
buildOpenCodeUrl, getOpenCodeAuthHeaders, waitForReady: waitForOpenCodeReady,
|
|
1604
1593
|
});
|
|
1605
1594
|
const unsubscribeContentSearch = globalMessageStreamHub.subscribeEvent((event) => contentSearch.runtime.observe(event));
|
|
@@ -38,6 +38,13 @@ queue populated by live events. Each dirty session is read by ID and refreshes i
|
|
|
38
38
|
own messages; unrelated sessions incur no upstream work. Initialization failures
|
|
39
39
|
retry using committed per-session checkpoints. Explicit `sync()` remains deliberate
|
|
40
40
|
catalog reconciliation; automatic scheduling uses incremental mode.
|
|
41
|
+
The event-identity hotfix adds `search_coverage.event_identity_repaired` without
|
|
42
|
+
changing existing runtime keys or deleting results. Older completed indexes perform
|
|
43
|
+
one bounded thirty-day catalog reconciliation to recover updates dropped by the
|
|
44
|
+
old event fence. Unchanged checkpoints are reused; changed/missing sessions are
|
|
45
|
+
refetched with the same two-worker limit. Partial failures preserve old hits and
|
|
46
|
+
retry after thirty seconds, including after restart. Only successful reconciliation
|
|
47
|
+
sets the durable repair marker; subsequent warm starts resume dirty work only.
|
|
41
48
|
Already verified unchanged sessions are reused, including
|
|
42
49
|
sessions with no searchable text. Each session now commits an `indexed_at`
|
|
43
50
|
completion timestamp atomically with its projection, source update time and
|
|
@@ -88,8 +95,11 @@ during the fetch survives for another pass. Thirty-second retries are scheduled
|
|
|
88
95
|
only for unfinished initialization or pending dirty sessions, never idle catalog
|
|
89
96
|
polling. Deleted-session events and confirmed 404 remove that session; a time-bounded
|
|
90
97
|
catalog is not authoritative absence for unvisited IDs. Indexing does not depend on
|
|
91
|
-
any UI session being opened.
|
|
92
|
-
|
|
98
|
+
any UI session being opened. The persisted partition is owned by the Host session
|
|
99
|
+
index; the incoming event fence is checked against the message queue's runtime key,
|
|
100
|
+
the same provider used by the global hub. These are distinct hash namespaces and
|
|
101
|
+
must never be compared to each other. Old-runtime events remain rejected;
|
|
102
|
+
in-flight results are rejected if the index partition changes. Stop aborts reads and drains the
|
|
93
103
|
active pass before closing SQLite.
|
|
94
104
|
|
|
95
105
|
`GET /api/yuri/content-search?q=...&limit=30` returns `{hits,index}`.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { expect, test, vi } from 'vitest';
|
|
2
|
+
import { createSessionIndexService } from '../session-index/service.js';
|
|
3
|
+
import { createMessageQueueService } from '../message-queue/service.js';
|
|
4
|
+
import { createGlobalMessageStreamHub } from '../event-stream/global-hub.js';
|
|
5
|
+
import { createContentSearchService } from './service.js';
|
|
6
|
+
import { createContentSearchRuntime } from './runtime.js';
|
|
7
|
+
|
|
8
|
+
test('real hub runtime identity admits completed replies into search and rejects a previous runtime', async () => {
|
|
9
|
+
let config = { apiBaseUrl: 'http://runtime-a' };
|
|
10
|
+
const getRuntimeConfig = () => config;
|
|
11
|
+
const index = createSessionIndexService({ dbPath: ':memory:', getRuntimeConfig });
|
|
12
|
+
const queue = createMessageQueueService({ dbPath: ':memory:', getRuntimeConfig });
|
|
13
|
+
const service = createContentSearchService({ dbPath: ':memory:' });
|
|
14
|
+
const key = index.getRuntimeKey();
|
|
15
|
+
service.beginInitialization(key, 1);
|
|
16
|
+
service.completeInitialization(key, 0, 2);
|
|
17
|
+
const listSessions = vi.fn();
|
|
18
|
+
const listMessages = vi.fn(async () => ({ data: [{
|
|
19
|
+
id: 'reply', sessionID: 's', type: 'assistant', time: { created: 10, completed: 20 },
|
|
20
|
+
finish: 'stop', content: [{ type: 'text', text: '卡顿和高资源占用属实' }],
|
|
21
|
+
}], cursor: {} }));
|
|
22
|
+
const runtime = createContentSearchRuntime({ service, getRuntimeKey: () => index.getRuntimeKey(),
|
|
23
|
+
getEventRuntimeKey: () => queue.getRuntimeKey(), now: () => 100, listSessions, listMessages,
|
|
24
|
+
getSession: async () => ({ id: 's', time: { updated: 20 } }),
|
|
25
|
+
});
|
|
26
|
+
let captured;
|
|
27
|
+
let stream;
|
|
28
|
+
const hub = createGlobalMessageStreamHub({
|
|
29
|
+
buildOpenCodeUrl: (pathname) => `http://runtime-a${pathname}`, getOpenCodeAuthHeaders: () => ({}),
|
|
30
|
+
getRuntimeIdentity: () => ({ runtimeKey: queue.getRuntimeKey() }),
|
|
31
|
+
fetchImpl: async () => new Response(new ReadableStream({ start(controller) {
|
|
32
|
+
stream = controller;
|
|
33
|
+
controller.enqueue(new TextEncoder().encode('id: event-1\ndata: {"type":"session.execution.succeeded","data":{"sessionID":"s"}}\n\n'));
|
|
34
|
+
} })),
|
|
35
|
+
});
|
|
36
|
+
hub.subscribeEvent((event) => { captured = event; runtime.observe(event); });
|
|
37
|
+
try {
|
|
38
|
+
hub.start();
|
|
39
|
+
await vi.waitFor(() => expect(captured).toBeDefined());
|
|
40
|
+
expect(queue.getRuntimeKey()).not.toBe(key);
|
|
41
|
+
expect(service.pending(key)).toHaveLength(1);
|
|
42
|
+
await runtime.sync({ incremental: true });
|
|
43
|
+
expect(service.search(key, '卡顿和高资源占用属实')).toMatchObject([{ sessionID: 's', messageID: 'reply' }]);
|
|
44
|
+
expect(listSessions).not.toHaveBeenCalled();
|
|
45
|
+
expect(listMessages).toHaveBeenCalledTimes(1);
|
|
46
|
+
config = { apiBaseUrl: 'http://runtime-b' };
|
|
47
|
+
runtime.observe(captured);
|
|
48
|
+
expect(service.pending(index.getRuntimeKey())).toEqual([]);
|
|
49
|
+
} finally {
|
|
50
|
+
hub.stop(); stream?.close(); await runtime.stop(); service.close(); index.close(); queue.close();
|
|
51
|
+
}
|
|
52
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { expect, test, vi } from 'vitest';
|
|
2
|
+
import Database from 'better-sqlite3';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import os from 'node:os';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { createContentSearchService } from './service.js';
|
|
7
|
+
import { createContentSearchRuntime } from './runtime.js';
|
|
8
|
+
|
|
9
|
+
test('old completed indexes repair missed updates once, preserve failed results and resume after restart', async () => {
|
|
10
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'content-event-repair-'));
|
|
11
|
+
const dbPath = path.join(dir, 'search.sqlite');
|
|
12
|
+
const old = new Database(dbPath);
|
|
13
|
+
old.exec(`CREATE TABLE search_coverage(runtime TEXT PRIMARY KEY, started_at REAL NOT NULL, completed_at REAL, since REAL, verified_at REAL);
|
|
14
|
+
INSERT INTO search_coverage VALUES('host',1,2,0,3);`);
|
|
15
|
+
old.close();
|
|
16
|
+
let service = createContentSearchService({ dbPath });
|
|
17
|
+
const now = 40 * 86400000;
|
|
18
|
+
const record = (id, text) => ({ info: { id, role: 'user', time: { created: now } }, parts: [{ type: 'text', text }] });
|
|
19
|
+
for (const id of ['unchanged', 'missed', 'failed']) service.replaceSession('host', { id, time: { updated: 10 } }, [record(id, 'previous result')], 0);
|
|
20
|
+
let fail = true;
|
|
21
|
+
const listSessions = vi.fn(async () => ({ data: [
|
|
22
|
+
{ id: 'missed', time: { updated: now } }, { id: 'failed', time: { updated: now } },
|
|
23
|
+
{ id: 'unchanged', time: { updated: 10 } },
|
|
24
|
+
], cursor: { next: 'older' } }));
|
|
25
|
+
const listMessages = vi.fn(async ({ sessionID }) => {
|
|
26
|
+
if (sessionID === 'failed' && fail) throw new Error('offline');
|
|
27
|
+
return { data: [{ type: 'user', id: sessionID, sessionID, time: { created: now }, text: 'recovered result' }], cursor: {} };
|
|
28
|
+
});
|
|
29
|
+
const create = () => createContentSearchRuntime({ service, getRuntimeKey: () => 'host', now: () => now, listSessions, listMessages });
|
|
30
|
+
let runtime = create();
|
|
31
|
+
try {
|
|
32
|
+
await runtime.sync({ incremental: true });
|
|
33
|
+
expect(service.search('host', 'recovered')).toHaveLength(1);
|
|
34
|
+
expect(service.search('host', 'previous').map((hit) => hit.sessionID).sort()).toEqual(['failed', 'unchanged']);
|
|
35
|
+
expect(runtime.status()).toMatchObject({ phase: 'partial', initializationRequired: false, indexCompletedAt: 2 });
|
|
36
|
+
await runtime.stop(); service.close();
|
|
37
|
+
service = createContentSearchService({ dbPath }); runtime = create(); fail = false;
|
|
38
|
+
await runtime.sync({ incremental: true });
|
|
39
|
+
expect(service.search('host', 'recovered')).toHaveLength(2);
|
|
40
|
+
expect(listMessages.mock.calls.map(([q]) => q.sessionID)).toEqual(['missed', 'failed', 'failed']);
|
|
41
|
+
expect(listSessions).toHaveBeenCalledTimes(2);
|
|
42
|
+
await runtime.stop(); service.close();
|
|
43
|
+
service = createContentSearchService({ dbPath }); runtime = create();
|
|
44
|
+
await runtime.sync({ incremental: true });
|
|
45
|
+
expect(listSessions).toHaveBeenCalledTimes(2);
|
|
46
|
+
expect(listMessages).toHaveBeenCalledTimes(3);
|
|
47
|
+
} finally { await runtime.stop(); service.close(); fs.rmSync(dir, { recursive: true, force: true }); }
|
|
48
|
+
});
|
|
@@ -3,10 +3,10 @@ import { makeOpenCodeV2Client } from '../opencode/v2-client.js';
|
|
|
3
3
|
import { createContentSearchService } from './service.js';
|
|
4
4
|
import { createContentSearchRuntime } from './runtime.js';
|
|
5
5
|
|
|
6
|
-
export function createGlobalContentSearch({ dataDir, getRuntimeKey, buildOpenCodeUrl, getOpenCodeAuthHeaders, waitForReady }) {
|
|
6
|
+
export function createGlobalContentSearch({ dataDir, getRuntimeKey, getEventRuntimeKey, buildOpenCodeUrl, getOpenCodeAuthHeaders, waitForReady }) {
|
|
7
7
|
const service = createContentSearchService({ dbPath: path.join(dataDir, 'content-search.sqlite') });
|
|
8
8
|
const client = () => makeOpenCodeV2Client({ baseUrl: buildOpenCodeUrl('/', ''), authHeaders: getOpenCodeAuthHeaders() });
|
|
9
|
-
const runtime = createContentSearchRuntime({ service, getRuntimeKey,
|
|
9
|
+
const runtime = createContentSearchRuntime({ service, getRuntimeKey, getEventRuntimeKey,
|
|
10
10
|
getSession: ({ sessionID, signal }) => client().session.get({ sessionID }, { signal: AbortSignal.any([signal, AbortSignal.timeout(30_000)]) }),
|
|
11
11
|
listSessions: async ({ signal, ...query }) => {
|
|
12
12
|
await waitForReady();
|
|
@@ -5,7 +5,7 @@ import { normalizeSessionEventType } from '../session-metadata/session-projectio
|
|
|
5
5
|
const RETENTION = 30 * 24 * 60 * 60 * 1000;
|
|
6
6
|
const nextCursor = (page) => typeof page?.cursor?.next === 'string' ? page.cursor.next : null;
|
|
7
7
|
|
|
8
|
-
export function createContentSearchRuntime({ service, getRuntimeKey, listSessions, getSession, listMessages, now = Date.now }) {
|
|
8
|
+
export function createContentSearchRuntime({ service, getRuntimeKey, getEventRuntimeKey = getRuntimeKey, listSessions, getSession, listMessages, now = Date.now }) {
|
|
9
9
|
let stopped = false;
|
|
10
10
|
let flight;
|
|
11
11
|
let timer;
|
|
@@ -37,7 +37,7 @@ export function createContentSearchRuntime({ service, getRuntimeKey, listSession
|
|
|
37
37
|
for (const id of revisions.keys()) dirty.add(id);
|
|
38
38
|
const pendingDirty = new Set(dirty);
|
|
39
39
|
const initialized = service.coverage(runtime).indexCompletedAt !== null;
|
|
40
|
-
const scanCatalog = !incremental || !initialized;
|
|
40
|
+
const scanCatalog = !incremental || !initialized || service.needsEventIdentityRepair(runtime);
|
|
41
41
|
const sessions = [];
|
|
42
42
|
const ids = new Set();
|
|
43
43
|
let cursor;
|
|
@@ -148,7 +148,7 @@ export function createContentSearchRuntime({ service, getRuntimeKey, listSession
|
|
|
148
148
|
timer = setTimeout(async () => {
|
|
149
149
|
timer = undefined;
|
|
150
150
|
await sync({ incremental: true });
|
|
151
|
-
if (service.coverage(getRuntimeKey()).indexCompletedAt === null || service.pending(getRuntimeKey()).length) schedule(30_000);
|
|
151
|
+
if (service.coverage(getRuntimeKey()).indexCompletedAt === null || service.needsEventIdentityRepair(getRuntimeKey()) || service.pending(getRuntimeKey()).length) schedule(30_000);
|
|
152
152
|
}, delay);
|
|
153
153
|
timer.unref?.();
|
|
154
154
|
};
|
|
@@ -156,7 +156,7 @@ export function createContentSearchRuntime({ service, getRuntimeKey, listSession
|
|
|
156
156
|
sync, status,
|
|
157
157
|
start() { schedule(0); },
|
|
158
158
|
observe(event) {
|
|
159
|
-
if (event.runtimeIdentity?.runtimeKey && event.runtimeIdentity.runtimeKey !==
|
|
159
|
+
if (event.runtimeIdentity?.runtimeKey && event.runtimeIdentity.runtimeKey !== getEventRuntimeKey()) return;
|
|
160
160
|
if (state.runtime !== getRuntimeKey()) schedule(0);
|
|
161
161
|
const payload = event.payload?.payload ?? event.payload;
|
|
162
162
|
const type = normalizeSessionEventType(payload?.type ?? '');
|
|
@@ -36,6 +36,9 @@ export function createContentSearchService({ dbPath }) {
|
|
|
36
36
|
if (!sessionColumns.some((column) => column.name === 'indexed_at')) {
|
|
37
37
|
db.exec('ALTER TABLE search_session ADD COLUMN indexed_at REAL');
|
|
38
38
|
}
|
|
39
|
+
if (!db.prepare('PRAGMA table_info(search_coverage)').all().some((column) => column.name === 'event_identity_repaired')) {
|
|
40
|
+
db.exec('ALTER TABLE search_coverage ADD COLUMN event_identity_repaired INTEGER NOT NULL DEFAULT 0');
|
|
41
|
+
}
|
|
39
42
|
const remove = db.prepare('DELETE FROM search_message WHERE runtime=? AND session=?');
|
|
40
43
|
const write = db.prepare('INSERT INTO search_message(runtime,session,message,role,created,body) VALUES(?,?,?,?,?,?)');
|
|
41
44
|
const removeSession = db.transaction((runtime, id) => {
|
|
@@ -57,12 +60,15 @@ export function createContentSearchService({ dbPath }) {
|
|
|
57
60
|
return db.prepare('SELECT started_at AS indexStartedAt, completed_at AS indexCompletedAt, since AS coveredSince, verified_at AS verifiedAt FROM search_coverage WHERE runtime=?').get(runtime)
|
|
58
61
|
?? { indexStartedAt: null, indexCompletedAt: null, coveredSince: null, verifiedAt: null };
|
|
59
62
|
},
|
|
63
|
+
needsEventIdentityRepair(runtime) {
|
|
64
|
+
return db.prepare('SELECT event_identity_repaired FROM search_coverage WHERE runtime=?').get(runtime)?.event_identity_repaired !== 1;
|
|
65
|
+
},
|
|
60
66
|
beginInitialization(runtime, timestamp) {
|
|
61
67
|
db.prepare(`INSERT INTO search_coverage(runtime,started_at) VALUES(?,?)
|
|
62
68
|
ON CONFLICT(runtime) DO NOTHING`).run(runtime, timestamp);
|
|
63
69
|
},
|
|
64
70
|
completeInitialization(runtime, since, timestamp) {
|
|
65
|
-
db.prepare(`UPDATE search_coverage SET completed_at=COALESCE(completed_at,?), since=?, verified_at
|
|
71
|
+
db.prepare(`UPDATE search_coverage SET completed_at=COALESCE(completed_at,?), since=?, verified_at=?, event_identity_repaired=1 WHERE runtime=?`)
|
|
66
72
|
.run(timestamp, since, timestamp, runtime);
|
|
67
73
|
},
|
|
68
74
|
replaceSession: db.transaction((runtime, session, records, since = null, indexedAt = Date.now()) => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { spawn, spawnSync } from 'node:child_process';
|
|
2
|
+
import fs from 'node:fs';
|
|
2
3
|
import net from 'node:net';
|
|
3
4
|
import { registerManagedProcess, unregisterManagedProcess, reapOrphanedProcesses } from './managed-process-registry.js';
|
|
4
5
|
import { evaluateOpenCodeHealthBody } from './opencode2-pin.js';
|
|
@@ -592,6 +593,23 @@ export const createOpenCodeLifecycleRuntime = (deps) => {
|
|
|
592
593
|
* @param {object | null | undefined} migrationGate
|
|
593
594
|
* @param {number | null | undefined} expectedGeneration
|
|
594
595
|
*/
|
|
596
|
+
// Health checks run every 15s; spawnSync `--version` blocks the event loop.
|
|
597
|
+
// Re-read only when the binary file is replaced (upgrade changes mtime/size).
|
|
598
|
+
let cliVersionCache = { key: '', version: null };
|
|
599
|
+
const readCliVersionCached = (binaryPath) => {
|
|
600
|
+
let key;
|
|
601
|
+
try {
|
|
602
|
+
const stat = fs.statSync(binaryPath);
|
|
603
|
+
key = `${binaryPath}\0${stat.mtimeMs}\0${stat.size}`;
|
|
604
|
+
} catch {
|
|
605
|
+
return readOpenCode2BinaryVersion(binaryPath) || null;
|
|
606
|
+
}
|
|
607
|
+
if (cliVersionCache.key === key) return cliVersionCache.version;
|
|
608
|
+
const version = readOpenCode2BinaryVersion(binaryPath) || null;
|
|
609
|
+
if (version) cliVersionCache = { key, version };
|
|
610
|
+
return version;
|
|
611
|
+
};
|
|
612
|
+
|
|
595
613
|
const refreshRuntimeContractFromProbe = (
|
|
596
614
|
probe,
|
|
597
615
|
migrationGate = state.v1Migration,
|
|
@@ -608,7 +626,7 @@ export const createOpenCodeLifecycleRuntime = (deps) => {
|
|
|
608
626
|
const binaryPath = typeof process.env.OPENCODE_BINARY === 'string'
|
|
609
627
|
? process.env.OPENCODE_BINARY.trim()
|
|
610
628
|
: '';
|
|
611
|
-
const cliVersion = binaryPath ? (
|
|
629
|
+
const cliVersion = binaryPath ? readCliVersionCached(binaryPath) : null;
|
|
612
630
|
const contract = evaluateRuntimeContract({
|
|
613
631
|
serveVersion: probe?.version ?? null,
|
|
614
632
|
cliVersion,
|
|
@@ -98,7 +98,11 @@ form IO and core, restoring `/api` for origin-only upstream URLs.
|
|
|
98
98
|
|
|
99
99
|
## Reconcile
|
|
100
100
|
|
|
101
|
-
- Inventory =
|
|
101
|
+
- Inventory = live upstream Locations (`GET /api/debug/location`) + observed request/event dirs.
|
|
102
|
+
Forms live in Location memory, so other directories cannot hold pending forms;
|
|
103
|
+
a scoped `form.list` there would boot a Location that upstream never evicts.
|
|
104
|
+
Never enumerate settings projects or session-index directories. An unreadable
|
|
105
|
+
live set is an inventory failure, not an empty catalog.
|
|
102
106
|
- Track `successfulDirectories`; only those may settle missing requests.
|
|
103
107
|
- Unscoped list discovers unknowns only; never means “all directories empty”.
|
|
104
108
|
- Unscoped / directory-less pending triggers `ensureSessionLineage(sessionID, hint, requestID)`
|
|
@@ -181,8 +181,8 @@ export interface QuestionAutoDelegateIO {
|
|
|
181
181
|
body: unknown,
|
|
182
182
|
sessionID: string,
|
|
183
183
|
): Promise<QuestionAutoDelegateUpstreamResult>;
|
|
184
|
-
/**
|
|
185
|
-
listDirectories(): Promise<string[]>;
|
|
184
|
+
/** Live upstream Location directories for reconnect/start reconcile; null when unreadable. */
|
|
185
|
+
listDirectories(): Promise<string[] | null>;
|
|
186
186
|
/**
|
|
187
187
|
* Persist-backed enabled flag.
|
|
188
188
|
* - `true` / `false` when readable (absent key ⇒ default true)
|
|
@@ -28,9 +28,6 @@ export function createQuestionAutoDelegateRuntime({
|
|
|
28
28
|
buildOpenCodeUrl,
|
|
29
29
|
getOpenCodeAuthHeaders,
|
|
30
30
|
readSettingsFromDiskMigrated,
|
|
31
|
-
sanitizeProjects,
|
|
32
|
-
/** Optional: session-index / worktree inventory directories. */
|
|
33
|
-
listIndexedDirectories,
|
|
34
31
|
broadcastGlobalUiEvent,
|
|
35
32
|
broadcastYuriEvent,
|
|
36
33
|
fetchImpl = fetch,
|
|
@@ -124,32 +121,19 @@ export function createQuestionAutoDelegateRuntime({
|
|
|
124
121
|
return null;
|
|
125
122
|
}
|
|
126
123
|
},
|
|
124
|
+
/**
|
|
125
|
+
* Forms live in Location memory, so only live Locations can hold pending
|
|
126
|
+
* forms. A scoped `/form` on any other directory boots a full Location
|
|
127
|
+
* that upstream never evicts; never list projects or indexed directories.
|
|
128
|
+
* @returns {Promise<string[]|null>} null when the live set is unreadable.
|
|
129
|
+
*/
|
|
127
130
|
async listDirectories() {
|
|
131
|
+
const result = await upstream('/debug/location');
|
|
132
|
+
if (!result.ok || !Array.isArray(result.body)) return null;
|
|
128
133
|
const dirs = new Set();
|
|
129
|
-
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
? (sanitizeProjects(settings?.projects ?? []) || [])
|
|
133
|
-
: (Array.isArray(settings?.projects) ? settings.projects : []);
|
|
134
|
-
for (const project of projects) {
|
|
135
|
-
const path = asTrimmedString(project?.path);
|
|
136
|
-
if (path) dirs.add(path);
|
|
137
|
-
}
|
|
138
|
-
} catch {
|
|
139
|
-
// Project list failure is not fatal when index inventory exists.
|
|
140
|
-
}
|
|
141
|
-
if (typeof listIndexedDirectories === 'function') {
|
|
142
|
-
try {
|
|
143
|
-
const indexed = await listIndexedDirectories();
|
|
144
|
-
if (Array.isArray(indexed)) {
|
|
145
|
-
for (const directory of indexed) {
|
|
146
|
-
const path = asTrimmedString(directory);
|
|
147
|
-
if (path) dirs.add(path);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
} catch {
|
|
151
|
-
// ignore index failures — core marks partial when inventory empty+failed
|
|
152
|
-
}
|
|
134
|
+
for (const entry of result.body) {
|
|
135
|
+
const path = asTrimmedString(entry?.directory);
|
|
136
|
+
if (path) dirs.add(path);
|
|
153
137
|
}
|
|
154
138
|
return Array.from(dirs);
|
|
155
139
|
},
|
|
@@ -26,6 +26,7 @@ const setup = async (pending = []) => {
|
|
|
26
26
|
let onEvent;
|
|
27
27
|
const fetchImpl = vi.fn(async (url, options) => {
|
|
28
28
|
const path = url.pathname;
|
|
29
|
+
if (path === '/api/debug/location') return Response.json([{ directory: '/project' }]);
|
|
29
30
|
if (path === '/api/form') return Response.json({ data: pending });
|
|
30
31
|
if (path === '/api/session/ses_test') return Response.json({ data: { id: 'ses_test', location: { directory: '/project' } } });
|
|
31
32
|
if (path === '/api/session/ses_test/form/frm_question') return Response.json({ data: form });
|
|
@@ -52,6 +53,30 @@ const setup = async (pending = []) => {
|
|
|
52
53
|
};
|
|
53
54
|
};
|
|
54
55
|
|
|
56
|
+
it('reconciles only live Locations and never boots project or indexed directories', async () => {
|
|
57
|
+
vi.useFakeTimers();
|
|
58
|
+
const fetchImpl = vi.fn(async (url) => {
|
|
59
|
+
if (url.pathname === '/api/debug/location') return Response.json([{ directory: '/live' }]);
|
|
60
|
+
if (url.pathname === '/api/form') return Response.json({ data: [] });
|
|
61
|
+
return Response.json({ error: 'Not found' }, { status: 404 });
|
|
62
|
+
});
|
|
63
|
+
const runtime = createQuestionAutoDelegateRuntime({
|
|
64
|
+
globalEventHub: { subscribeEvent: () => () => {} },
|
|
65
|
+
buildOpenCodeUrl: (path) => `http://opencode.test/api${path}`,
|
|
66
|
+
getOpenCodeAuthHeaders: () => ({}),
|
|
67
|
+
readSettingsFromDiskMigrated: async () => ({ projects: [{ path: '/project' }, { path: '/other' }] }),
|
|
68
|
+
fetchImpl,
|
|
69
|
+
pauseStore: createQuestionPauseStore(pauseDirectory),
|
|
70
|
+
});
|
|
71
|
+
runtimes.push(runtime);
|
|
72
|
+
runtime.start();
|
|
73
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
74
|
+
const scoped = fetchImpl.mock.calls
|
|
75
|
+
.map(([url]) => url.searchParams.get('location[directory]'))
|
|
76
|
+
.filter(Boolean);
|
|
77
|
+
expect(scoped).toEqual(['/live']);
|
|
78
|
+
});
|
|
79
|
+
|
|
55
80
|
it('auto-delegates a native question form after exactly 30 seconds without a UI', async () => {
|
|
56
81
|
const { emit, posts, runtime } = await setup();
|
|
57
82
|
emit('form.created', { sessionID: form.sessionID, form });
|
|
@@ -220,6 +220,7 @@ executions and rows without a session; missing session association is not proof
|
|
|
220
220
|
of execution failure. Such rows remain unresolved rather than inventing a result.
|
|
221
221
|
Recovery checks live `session.active` before examining terminal messages or Host
|
|
222
222
|
goal state. Active, unavailable, malformed, and incomplete results remain pending.
|
|
223
|
+
A session OpenCode confirms deleted (`SessionNotFoundError`) settles as `error`.
|
|
223
224
|
Only confirmed terminal evidence finalizes history, with duration through the
|
|
224
225
|
time recovery observes completion. It neither dispatches a new prompt nor sends
|
|
225
226
|
a second completion notification.
|
|
@@ -358,6 +359,10 @@ Every actual run (timer or manual):
|
|
|
358
359
|
after multiple incomplete idle probes.
|
|
359
360
|
- `session.active` / `message.list` failures stay **unknown** (keep
|
|
360
361
|
polling under the watchdog); they never masquerade as idle success.
|
|
362
|
+
Exception: a declared `SessionNotFoundError` (or HTTP 404) from
|
|
363
|
+
`message.list` / `session.get` is confirmed terminal evidence and
|
|
364
|
+
finalizes as `error: 'session not found'`, so recovery stops polling
|
|
365
|
+
deleted sessions. Transport failures never match.
|
|
361
366
|
- Assistant `error` (and terminal finish `error` / `length` /
|
|
362
367
|
`content-filter`) finalizes as `error`.
|
|
363
368
|
- Goal-enabled runs: settle via Host goal terminal status when the store
|
|
@@ -400,6 +400,15 @@ const extractGoalFromSession = (session) => {
|
|
|
400
400
|
* must be a real terminal (finish tool-calls / incomplete / model-switch ≠
|
|
401
401
|
* success). History rows are never rewritten here.
|
|
402
402
|
*/
|
|
403
|
+
const SESSION_NOT_FOUND_ERROR = 'session not found';
|
|
404
|
+
|
|
405
|
+
// Real `@opencode/client` throws declared errors by `_tag`; transport failures never match.
|
|
406
|
+
const isSessionNotFoundError = (error) => {
|
|
407
|
+
if (!error || typeof error !== 'object') return false;
|
|
408
|
+
if ((error._tag ?? error.name) === 'SessionNotFoundError') return true;
|
|
409
|
+
return Number(error.status ?? error.statusCode ?? error.response?.status) === 404;
|
|
410
|
+
};
|
|
411
|
+
|
|
403
412
|
const snapshotSessionOutcome = async ({
|
|
404
413
|
client,
|
|
405
414
|
sessionID,
|
|
@@ -474,6 +483,9 @@ const snapshotSessionOutcome = async ({
|
|
|
474
483
|
}
|
|
475
484
|
} catch (error) {
|
|
476
485
|
if (signal?.aborted) throw error;
|
|
486
|
+
if (isSessionNotFoundError(error)) {
|
|
487
|
+
return { outcome: 'error', error: SESSION_NOT_FOUND_ERROR };
|
|
488
|
+
}
|
|
477
489
|
}
|
|
478
490
|
}
|
|
479
491
|
return { outcome: 'busy' };
|
|
@@ -490,6 +502,10 @@ const snapshotSessionOutcome = async ({
|
|
|
490
502
|
}
|
|
491
503
|
} catch (error) {
|
|
492
504
|
if (signal?.aborted) throw error;
|
|
505
|
+
// Upstream confirmed the session is gone: terminal, or recovery polls it forever.
|
|
506
|
+
if (isSessionNotFoundError(error)) {
|
|
507
|
+
return { outcome: 'error', error: SESSION_NOT_FOUND_ERROR };
|
|
508
|
+
}
|
|
493
509
|
}
|
|
494
510
|
|
|
495
511
|
return { outcome: 'busy' };
|
|
@@ -223,6 +223,39 @@ describe('scheduled-tasks history recovery', () => {
|
|
|
223
223
|
}
|
|
224
224
|
});
|
|
225
225
|
|
|
226
|
+
it('settles running history whose session was deleted upstream and stops polling it', async () => {
|
|
227
|
+
vi.useFakeTimers();
|
|
228
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'scheduled-missing-'));
|
|
229
|
+
const store = createScheduledTaskRunHistoryStore({ dbPath: path.join(dir, 'runs.sqlite') });
|
|
230
|
+
for (const id of ['missing', 'offline']) {
|
|
231
|
+
store.startRun({ id, projectId: 'project-1', taskId: id, startedAt: Date.now() - 1000 });
|
|
232
|
+
store.attachSession(id, `ses_${id}`);
|
|
233
|
+
}
|
|
234
|
+
const messageList = vi.fn(async ({ sessionID }) => {
|
|
235
|
+
if (sessionID === 'ses_missing') {
|
|
236
|
+
throw Object.assign(new Error('SessionNotFoundError'), { _tag: 'SessionNotFoundError', name: 'SessionNotFoundError', sessionID });
|
|
237
|
+
}
|
|
238
|
+
throw new TypeError('fetch failed');
|
|
239
|
+
});
|
|
240
|
+
makeOpenCodeV2Client.mockReturnValue({ session: { active: vi.fn(async () => ({})) }, message: { list: messageList } });
|
|
241
|
+
const runtime = createRuntime(vi.fn(async () => ({ task: null })), { runHistoryStore: store });
|
|
242
|
+
try {
|
|
243
|
+
await runtime.start();
|
|
244
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
245
|
+
const runs = () => Object.fromEntries(store.listRuns().runs.map((run) => [run.id, run]));
|
|
246
|
+
expect(runs().missing).toMatchObject({ status: 'error', error: 'session not found' });
|
|
247
|
+
expect(runs().offline.status).toBe('running');
|
|
248
|
+
await vi.advanceTimersByTimeAsync(10_000);
|
|
249
|
+
expect(messageList.mock.calls.filter(([args]) => args.sessionID === 'ses_missing')).toHaveLength(1);
|
|
250
|
+
expect(runs().offline.status).toBe('running');
|
|
251
|
+
} finally {
|
|
252
|
+
runtime.stop();
|
|
253
|
+
store.close();
|
|
254
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
255
|
+
vi.useRealTimers();
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
|
|
226
259
|
it('discards recovery results arriving after stop', async () => {
|
|
227
260
|
let resolveMessages;
|
|
228
261
|
const messages = new Promise((resolve) => { resolveMessages = resolve; });
|