@yuriai/web 0.2.20-beta.3 → 0.2.24-beta.1
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/README.md +8 -0
- package/dist/assets/{AgentAvatar-D5KPQI1N.js → AgentAvatar-uHQNjXpd.js} +1 -1
- package/dist/assets/AssistantView-Drd8VDEa.js +3 -0
- package/dist/assets/{DiagramView-DWV04Xws.js → DiagramView-DkCNPVGi.js} +1 -1
- package/dist/assets/{FadeInOnReveal-CdoLG8fY.js → FadeInOnReveal-C4jDW1zu.js} +1 -1
- package/dist/assets/{GuiPluginSurface-DhD8BqvL.js → GuiPluginSurface-3kvNh8k7.js} +1 -1
- package/dist/assets/{GuiPluginWindow-ezsy5l_y.js → GuiPluginWindow-CBFALwNv.js} +1 -1
- package/dist/assets/Icon-B0ebXdpZ.js +1 -0
- package/dist/assets/{ImageLoadingPlaceholder-BVlgaa2r.js → ImageLoadingPlaceholder-BsOal94e.js} +1 -1
- package/dist/assets/{LoadingImage-BSG8jmn5.js → LoadingImage-DU15BNuP.js} +1 -1
- package/dist/assets/{MarkdownRenderer-BiRplAST.js → MarkdownRenderer--MUzfNV1.js} +2 -2
- package/dist/assets/{MarkdownRendererImpl-CH8TUMKZ.js → MarkdownRendererImpl-CRQzKIUS.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-Bmz56IzM.js → MarkstreamRendererImpl-BwCal960.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-kKHM_dU3.js → MobileDetailNavigation-Do2TWnlQ.js} +1 -1
- package/dist/assets/{MobileResizableSheet-jHNytoyX.js → MobileResizableSheet-C5UIcZMP.js} +1 -1
- package/dist/assets/{MobileShareBridge-CSDivsPk.js → MobileShareBridge-D1uMFffj.js} +1 -1
- package/dist/assets/MobileTabPageHeader-qFcP_0DQ.js +2 -0
- package/dist/assets/{MultiRunWindow-DbllgaJR.js → MultiRunWindow-ChKPsoQo.js} +1 -1
- package/dist/assets/{OnboardingScreen-DONIcirJ.js → OnboardingScreen-D5tX10Ru.js} +1 -1
- package/dist/assets/{OverlayScrollbar-DB2eeXFh.js → OverlayScrollbar-Cd3itQWo.js} +1 -1
- package/dist/assets/SettingsView-BRIvklfP.css +1 -0
- package/dist/assets/SettingsView-lVlHvszE.js +29 -0
- package/dist/assets/{SettingsWindow-BrrnHfnR.js → SettingsWindow-BHTfrkKB.js} +1 -1
- package/dist/assets/{TerminalView-8JYW5f-c.js → TerminalView-o9kbH9L7.js} +1 -1
- package/dist/assets/{ToolOutputDialog-DZO89hKv.js → ToolOutputDialog-C-oQW3hF.js} +4 -4
- package/dist/assets/{YuriLogo-CYdRUurL.js → YuriLogo-mo6nZ3PX.js} +1 -1
- package/dist/assets/{appThemeRegistry-Nb-sUfbK.js → appThemeRegistry-Dj_lXuWN.js} +1 -1
- package/dist/assets/{button-nola46HU.js → button-RqfOQVDY.js} +1 -1
- package/dist/assets/{capgoAdapter-CHeo9q51.js → capgoAdapter-BBkQfU5y.js} +1 -1
- package/dist/assets/{collapsible-BQaMLh6O.js → collapsible-Dv8u92TF.js} +1 -1
- package/dist/assets/desktop-5DP3-Bao.js +1 -0
- package/dist/assets/{desktopHosts-B4HMNmrx.js → desktopHosts-CrVcscUO.js} +1 -1
- package/dist/assets/{desktopRelayRestore-CRl62mqn.js → desktopRelayRestore-DJFLfsuw.js} +1 -1
- package/dist/assets/{device-Coc5tapU.js → device-BKQ_0FdZ.js} +1 -1
- package/dist/assets/{diagram-COti_aKS.js → diagram-ChmjoQ5M.js} +1 -1
- package/dist/assets/{dialog-B2CTTXwv.js → dialog-BNwN9E77.js} +1 -1
- package/dist/assets/{dropdown-menu.styles-BzpQaok_.js → dropdown-menu.styles-BeD-5cZr.js} +1 -1
- package/dist/assets/es-BA49Soe0.js +15 -0
- package/dist/assets/{fileMentionTouchSelection-CXepBNtQ.js → fileMentionTouchSelection-BOqFOFuS.js} +1 -1
- package/dist/assets/{fileReferenceActions-BnPPqYXw.js → fileReferenceActions-B1o8IWgw.js} +1 -1
- package/dist/assets/fr-BC5SbQkf.js +13 -0
- package/dist/assets/{gitApi-B7AeNXrj.js → gitApi-BBTlZPHJ.js} +1 -1
- package/dist/assets/{gitApiHttp-CoNokuDM.js → gitApiHttp-Bnr4_wxy.js} +2 -2
- package/dist/assets/{host-BCXyr41J.js → host-DgJqhX6n.js} +1 -1
- package/dist/assets/{input-DGnhaqoc.js → input-0mf9njqM.js} +1 -1
- package/dist/assets/insertionBoundaries-CeIZ6Ryc.js +1 -0
- package/dist/assets/ja-ZVSLBCEX.js +15 -0
- package/dist/assets/ko-UEhdI-6j.js +15 -0
- package/dist/assets/{main-d2AaD_PZ.js → main-B5RgfV79.js} +2 -2
- package/dist/assets/main-DmpGPZGl.js +169 -0
- package/dist/assets/{markdownHeightCache-C_JI5qIR.js → markdownHeightCache-CghsqV5O.js} +1 -1
- package/dist/assets/{mcpQueries-BgFj7wfO.js → mcpQueries-BoO0luGM.js} +1 -1
- package/dist/assets/{miniChat-BHdsTyJ3.js → miniChat-DqITTK1M.js} +2 -2
- package/dist/assets/mobile-BIr1jV5q.js +2 -0
- package/dist/assets/{mobileBackNavigation-s9RsXUUH.js → mobileBackNavigation-BX15eKz3.js} +1 -1
- package/dist/assets/{multirun-BZsBsBAj.js → multirun-YUG6khun.js} +1 -1
- package/dist/assets/{native-config-BmrfOzkM.js → native-config-Bd2dhq7v.js} +1 -1
- package/dist/assets/{persistence-CNEHspb4.js → persistence-BPb2hZ3c.js} +2 -2
- package/dist/assets/pl-CtZa8Aps.js +15 -0
- package/dist/assets/{platform-Q45KPuGv.js → platform-wGCQUVxr.js} +1 -1
- package/dist/assets/{projectMeta-BCGIXTbR.js → projectMeta-zvmpMSQf.js} +1 -1
- package/dist/assets/pt-BR-BLYFPwVu.js +15 -0
- package/dist/assets/{readiness-BxT5OBkk.js → readiness-Cdk9qFe5.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-BbfF6SjM.js → renderElectronMiniChatApp-BGE9uFhc.js} +2 -2
- package/dist/assets/renderMobileApp-6mtuJQ65.js +28 -0
- package/dist/assets/{runtimeConfig-BHRHZbwI.js → runtimeConfig-D-CPiNCJ.js} +1 -1
- package/dist/assets/runtimeEndpointReset-DJiib7qk.js +149 -0
- package/dist/assets/{scheduledTaskNavigation-CkBcoGV4.js → scheduledTaskNavigation-Dhcdlsyj.js} +1 -1
- package/dist/assets/{sessionChangeSummary-CAU-06Bu.js → sessionChangeSummary-CG0wKqkP.js} +1 -1
- package/dist/assets/{sessionLookup-YvkfClst.js → sessionLookup-B61-CKn2.js} +1 -1
- package/dist/assets/{sortable-tabs-strip-pCvZjmMt.js → sortable-tabs-strip-B2s-35-E.js} +1 -1
- package/dist/assets/{speechSettingsQueries-1LD5eEHK.js → speechSettingsQueries-B8ZUB8kC.js} +3 -3
- package/dist/assets/src-CTDGzqeS.css +2 -0
- package/dist/assets/store-DRfILWJT.js +15 -0
- package/dist/assets/{terminalApi-DFhCeMya.js → terminalApi-Cjd7Jry6.js} +1 -1
- package/dist/assets/{textarea-DSHEMw8t.js → textarea-Brud1txt.js} +1 -1
- package/dist/assets/{tooltip-BwTvgqWG.js → tooltip-Bs7jQMa0.js} +1 -1
- package/dist/assets/{types-CiQgQf3s.js → types-DuOMU6Kx.js} +1 -1
- package/dist/assets/uk-CLu6Q5Pq.js +15 -0
- package/dist/assets/{useAppFontEffects-Cz9eoInx.js → useAppFontEffects-BbNLfgyg.js} +53 -53
- package/dist/assets/{useDesktopWindowControlsLayout-HpOlTBoV.js → useDesktopWindowControlsLayout-BobcZLtl.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-DE-YccE8.js → useEffectiveDirectory-DFrDhjCc.js} +1 -1
- package/dist/assets/{useFontPreferences-DmeLn0t9.js → useFontPreferences-CGThMzt0.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-DPE5LVui.js → useMobileNavigationStore-BoltsZEH.js} +16 -15
- package/dist/assets/useWorkerHighlightedLines-BtEOUB_j.js +7 -0
- package/dist/assets/zh-CN-794F19S6.js +15 -0
- package/dist/assets/{zh-TW-CtLsIcFb.js → zh-TW-CIVkGGCd.js} +4 -4
- package/dist/index.html +13 -13
- package/dist/mini-chat.html +13 -13
- package/dist/mobile.html +13 -13
- package/package.json +1 -1
- package/server/index.d.ts +9 -0
- package/server/index.js +10 -0
- package/server/lib/assistants/DOCUMENTATION.md +19 -4
- package/server/lib/assistants/contact-store.js +151 -17
- package/server/lib/assistants/contact-store.test.js +44 -2
- package/server/lib/assistants/contact-tools.js +43 -2
- package/server/lib/assistants/contact-tools.test.js +21 -0
- package/server/lib/assistants/harness.js +18 -12
- package/server/lib/assistants/harness.test.js +62 -8
- package/server/lib/assistants/service.js +64 -6
- package/server/lib/assistants/service.test.js +62 -19
- package/server/lib/assistants/summary.js +90 -0
- package/server/lib/assistants/summary.test.js +118 -0
- package/server/lib/llm/DOCUMENTATION.md +12 -2
- package/server/lib/llm/bridge-client.js +65 -16
- package/server/lib/llm/bridge-client.test.js +63 -2
- package/server/lib/opencode/DOCUMENTATION.md +1 -0
- package/server/lib/opencode/npm-registry.js +106 -11
- package/server/lib/opencode/npm-registry.test.js +64 -0
- package/server/lib/opencode/plugin-routes.js +3 -1
- package/server/lib/opencode/plugin-routes.test.js +3 -3
- package/server/lib/quota/magpie.js +2 -2
- package/server/lib/realtime-proxy.js +2 -1
- package/server/lib/relay/tunnel-host.js +1 -0
- package/server/lib/remote-desktop/DOCUMENTATION.md +52 -0
- package/server/lib/remote-desktop/protocol.js +26 -0
- package/server/lib/remote-desktop/protocol.test.js +18 -0
- package/server/lib/remote-desktop/runtime.js +112 -0
- package/server/lib/remote-desktop/runtime.test.js +135 -0
- package/server/lib/small-model/DOCUMENTATION.md +2 -1
- package/server/lib/ui-auth/DOCUMENTATION.md +2 -0
- package/server/lib/ui-auth/ui-auth.js +2 -1
- package/dist/assets/AssistantView-huAUB-2Y.js +0 -3
- package/dist/assets/Icon-DvqOB4Dx.js +0 -1
- package/dist/assets/MobileTabPageHeader-BkWvNBtr.js +0 -2
- package/dist/assets/SettingsView-6D55BNjw.js +0 -26
- package/dist/assets/desktop-CiqEZVr5.js +0 -1
- package/dist/assets/es-DklBd0ox.js +0 -15
- package/dist/assets/fr-CVUs46wM.js +0 -13
- package/dist/assets/insertionBoundaries-Db0R1aBj.js +0 -1
- package/dist/assets/ja-5reg09JK.js +0 -15
- package/dist/assets/ko-DZdC6ooz.js +0 -15
- package/dist/assets/main-DQ0F0yuL.js +0 -169
- package/dist/assets/mobile-BEhQq4tx.js +0 -2
- package/dist/assets/pl-BerZSK-a.js +0 -15
- package/dist/assets/pt-BR-ydmV6U49.js +0 -15
- package/dist/assets/renderMobileApp-ulSQxT-l.js +0 -28
- package/dist/assets/runtimeEndpointReset-H2W1kxcO.js +0 -149
- package/dist/assets/src-DGCTlpkW.css +0 -2
- package/dist/assets/store-ClIuNNU7.js +0 -15
- package/dist/assets/uk-BnTevguX.js +0 -15
- package/dist/assets/useWorkerHighlightedLines-o-elkNrd.js +0 -7
- package/dist/assets/zh-CN-DT6qIAPJ.js +0 -15
package/dist/index.html
CHANGED
|
@@ -560,15 +560,15 @@
|
|
|
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-B5RgfV79.js"></script>
|
|
564
564
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
565
565
|
<link rel="modulepreload" crossorigin href="/assets/runtime-auth-BaBM02zI.js">
|
|
566
566
|
<link rel="modulepreload" crossorigin href="/assets/runtime-switch-DhMY9eiB.js">
|
|
567
567
|
<link rel="modulepreload" crossorigin href="/assets/runtime-fetch-DfALP7-b.js">
|
|
568
568
|
<link rel="modulepreload" crossorigin href="/assets/runtimeAPIRegistry-C2VogTny.js">
|
|
569
|
-
<link rel="modulepreload" crossorigin href="/assets/desktop-
|
|
570
|
-
<link rel="modulepreload" crossorigin href="/assets/desktopHosts-
|
|
571
|
-
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-
|
|
569
|
+
<link rel="modulepreload" crossorigin href="/assets/desktop-5DP3-Bao.js">
|
|
570
|
+
<link rel="modulepreload" crossorigin href="/assets/desktopHosts-CrVcscUO.js">
|
|
571
|
+
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-DJFLfsuw.js">
|
|
572
572
|
<link rel="modulepreload" crossorigin href="/assets/vendor-base-ui-CdzJ6My_.js">
|
|
573
573
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-o69pgTEK.js">
|
|
574
574
|
<link rel="modulepreload" crossorigin href="/assets/vendor-effect-DV9F8PTZ.js">
|
|
@@ -581,22 +581,22 @@
|
|
|
581
581
|
<link rel="modulepreload" crossorigin href="/assets/queryRuntime-DWgXfxGx.js">
|
|
582
582
|
<link rel="modulepreload" crossorigin href="/assets/vendor-pathe-vBmvQE8f.js">
|
|
583
583
|
<link rel="modulepreload" crossorigin href="/assets/pathNormalization-ewtPqJWn.js">
|
|
584
|
-
<link rel="modulepreload" crossorigin href="/assets/persistence-
|
|
584
|
+
<link rel="modulepreload" crossorigin href="/assets/persistence-BPb2hZ3c.js">
|
|
585
585
|
<link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-react-query-CdqCAt40.js">
|
|
586
586
|
<link rel="modulepreload" crossorigin href="/assets/fileQueries-Bd-OEFmO.js">
|
|
587
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
590
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-DtsKbFf3.js">
|
|
591
|
-
<link rel="modulepreload" crossorigin href="/assets/gitApiHttp-
|
|
592
|
-
<link rel="modulepreload" crossorigin href="/assets/terminalApi-
|
|
591
|
+
<link rel="modulepreload" crossorigin href="/assets/gitApiHttp-Bnr4_wxy.js">
|
|
592
|
+
<link rel="modulepreload" crossorigin href="/assets/terminalApi-Cjd7Jry6.js">
|
|
593
593
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-xvItwYMc.js">
|
|
594
|
-
<link rel="modulepreload" crossorigin href="/assets/platform-
|
|
595
|
-
<link rel="modulepreload" crossorigin href="/assets/types-
|
|
596
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
597
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
598
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
599
|
-
<link rel="stylesheet" crossorigin href="/assets/src-
|
|
594
|
+
<link rel="modulepreload" crossorigin href="/assets/platform-wGCQUVxr.js">
|
|
595
|
+
<link rel="modulepreload" crossorigin href="/assets/types-DuOMU6Kx.js">
|
|
596
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-BBkQfU5y.js">
|
|
597
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-Bd2dhq7v.js">
|
|
598
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-D-CPiNCJ.js">
|
|
599
|
+
<link rel="stylesheet" crossorigin href="/assets/src-CTDGzqeS.css">
|
|
600
600
|
</head>
|
|
601
601
|
<body class="h-full bg-background text-foreground">
|
|
602
602
|
<!-- Keep the startup layer outside #root. React replaces every child of
|
package/dist/mini-chat.html
CHANGED
|
@@ -77,15 +77,15 @@
|
|
|
77
77
|
.dark #initial-loading img { filter: invert(1); }
|
|
78
78
|
</style>
|
|
79
79
|
|
|
80
|
-
<script type="module" crossorigin src="/assets/miniChat-
|
|
80
|
+
<script type="module" crossorigin src="/assets/miniChat-DqITTK1M.js"></script>
|
|
81
81
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
82
82
|
<link rel="modulepreload" crossorigin href="/assets/runtime-auth-BaBM02zI.js">
|
|
83
83
|
<link rel="modulepreload" crossorigin href="/assets/runtime-switch-DhMY9eiB.js">
|
|
84
84
|
<link rel="modulepreload" crossorigin href="/assets/runtime-fetch-DfALP7-b.js">
|
|
85
85
|
<link rel="modulepreload" crossorigin href="/assets/runtimeAPIRegistry-C2VogTny.js">
|
|
86
|
-
<link rel="modulepreload" crossorigin href="/assets/desktop-
|
|
87
|
-
<link rel="modulepreload" crossorigin href="/assets/desktopHosts-
|
|
88
|
-
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-
|
|
86
|
+
<link rel="modulepreload" crossorigin href="/assets/desktop-5DP3-Bao.js">
|
|
87
|
+
<link rel="modulepreload" crossorigin href="/assets/desktopHosts-CrVcscUO.js">
|
|
88
|
+
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-DJFLfsuw.js">
|
|
89
89
|
<link rel="modulepreload" crossorigin href="/assets/vendor-base-ui-CdzJ6My_.js">
|
|
90
90
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-o69pgTEK.js">
|
|
91
91
|
<link rel="modulepreload" crossorigin href="/assets/vendor-effect-DV9F8PTZ.js">
|
|
@@ -98,22 +98,22 @@
|
|
|
98
98
|
<link rel="modulepreload" crossorigin href="/assets/queryRuntime-DWgXfxGx.js">
|
|
99
99
|
<link rel="modulepreload" crossorigin href="/assets/vendor-pathe-vBmvQE8f.js">
|
|
100
100
|
<link rel="modulepreload" crossorigin href="/assets/pathNormalization-ewtPqJWn.js">
|
|
101
|
-
<link rel="modulepreload" crossorigin href="/assets/persistence-
|
|
101
|
+
<link rel="modulepreload" crossorigin href="/assets/persistence-BPb2hZ3c.js">
|
|
102
102
|
<link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-react-query-CdqCAt40.js">
|
|
103
103
|
<link rel="modulepreload" crossorigin href="/assets/fileQueries-Bd-OEFmO.js">
|
|
104
104
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-store-BVRgEtI-.js">
|
|
105
105
|
<link rel="modulepreload" crossorigin href="/assets/path-utils-jGozTg9d.js">
|
|
106
106
|
<link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
|
|
107
107
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-DtsKbFf3.js">
|
|
108
|
-
<link rel="modulepreload" crossorigin href="/assets/gitApiHttp-
|
|
109
|
-
<link rel="modulepreload" crossorigin href="/assets/terminalApi-
|
|
108
|
+
<link rel="modulepreload" crossorigin href="/assets/gitApiHttp-Bnr4_wxy.js">
|
|
109
|
+
<link rel="modulepreload" crossorigin href="/assets/terminalApi-Cjd7Jry6.js">
|
|
110
110
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-xvItwYMc.js">
|
|
111
|
-
<link rel="modulepreload" crossorigin href="/assets/platform-
|
|
112
|
-
<link rel="modulepreload" crossorigin href="/assets/types-
|
|
113
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
114
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
115
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
116
|
-
<link rel="stylesheet" crossorigin href="/assets/src-
|
|
111
|
+
<link rel="modulepreload" crossorigin href="/assets/platform-wGCQUVxr.js">
|
|
112
|
+
<link rel="modulepreload" crossorigin href="/assets/types-DuOMU6Kx.js">
|
|
113
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-BBkQfU5y.js">
|
|
114
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-Bd2dhq7v.js">
|
|
115
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-D-CPiNCJ.js">
|
|
116
|
+
<link rel="stylesheet" crossorigin href="/assets/src-CTDGzqeS.css">
|
|
117
117
|
</head>
|
|
118
118
|
<body class="h-full bg-background text-foreground">
|
|
119
119
|
<div id="root" class="h-full">
|
package/dist/mobile.html
CHANGED
|
@@ -64,15 +64,15 @@
|
|
|
64
64
|
</script>
|
|
65
65
|
|
|
66
66
|
<style>.dark #mobile-startup-logo img { filter: invert(1); }</style>
|
|
67
|
-
<script type="module" crossorigin src="/assets/mobile-
|
|
67
|
+
<script type="module" crossorigin src="/assets/mobile-BIr1jV5q.js"></script>
|
|
68
68
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
69
69
|
<link rel="modulepreload" crossorigin href="/assets/runtime-auth-BaBM02zI.js">
|
|
70
70
|
<link rel="modulepreload" crossorigin href="/assets/runtime-switch-DhMY9eiB.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="/assets/runtime-fetch-DfALP7-b.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="/assets/runtimeAPIRegistry-C2VogTny.js">
|
|
73
|
-
<link rel="modulepreload" crossorigin href="/assets/desktop-
|
|
74
|
-
<link rel="modulepreload" crossorigin href="/assets/desktopHosts-
|
|
75
|
-
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-
|
|
73
|
+
<link rel="modulepreload" crossorigin href="/assets/desktop-5DP3-Bao.js">
|
|
74
|
+
<link rel="modulepreload" crossorigin href="/assets/desktopHosts-CrVcscUO.js">
|
|
75
|
+
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-DJFLfsuw.js">
|
|
76
76
|
<link rel="modulepreload" crossorigin href="/assets/vendor-base-ui-CdzJ6My_.js">
|
|
77
77
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-o69pgTEK.js">
|
|
78
78
|
<link rel="modulepreload" crossorigin href="/assets/vendor-effect-DV9F8PTZ.js">
|
|
@@ -85,22 +85,22 @@
|
|
|
85
85
|
<link rel="modulepreload" crossorigin href="/assets/queryRuntime-DWgXfxGx.js">
|
|
86
86
|
<link rel="modulepreload" crossorigin href="/assets/vendor-pathe-vBmvQE8f.js">
|
|
87
87
|
<link rel="modulepreload" crossorigin href="/assets/pathNormalization-ewtPqJWn.js">
|
|
88
|
-
<link rel="modulepreload" crossorigin href="/assets/persistence-
|
|
88
|
+
<link rel="modulepreload" crossorigin href="/assets/persistence-BPb2hZ3c.js">
|
|
89
89
|
<link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-react-query-CdqCAt40.js">
|
|
90
90
|
<link rel="modulepreload" crossorigin href="/assets/fileQueries-Bd-OEFmO.js">
|
|
91
91
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-store-BVRgEtI-.js">
|
|
92
92
|
<link rel="modulepreload" crossorigin href="/assets/path-utils-jGozTg9d.js">
|
|
93
93
|
<link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
|
|
94
94
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-DtsKbFf3.js">
|
|
95
|
-
<link rel="modulepreload" crossorigin href="/assets/gitApiHttp-
|
|
96
|
-
<link rel="modulepreload" crossorigin href="/assets/terminalApi-
|
|
95
|
+
<link rel="modulepreload" crossorigin href="/assets/gitApiHttp-Bnr4_wxy.js">
|
|
96
|
+
<link rel="modulepreload" crossorigin href="/assets/terminalApi-Cjd7Jry6.js">
|
|
97
97
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-xvItwYMc.js">
|
|
98
|
-
<link rel="modulepreload" crossorigin href="/assets/platform-
|
|
99
|
-
<link rel="modulepreload" crossorigin href="/assets/types-
|
|
100
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
101
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
102
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
103
|
-
<link rel="stylesheet" crossorigin href="/assets/src-
|
|
98
|
+
<link rel="modulepreload" crossorigin href="/assets/platform-wGCQUVxr.js">
|
|
99
|
+
<link rel="modulepreload" crossorigin href="/assets/types-DuOMU6Kx.js">
|
|
100
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-BBkQfU5y.js">
|
|
101
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-Bd2dhq7v.js">
|
|
102
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-D-CPiNCJ.js">
|
|
103
|
+
<link rel="stylesheet" crossorigin href="/assets/src-CTDGzqeS.css">
|
|
104
104
|
</head>
|
|
105
105
|
<body class="h-full bg-background text-foreground">
|
|
106
106
|
<div id="root" class="h-full">
|
package/package.json
CHANGED
package/server/index.d.ts
CHANGED
|
@@ -31,6 +31,15 @@ export interface StartWebUiServerOptions {
|
|
|
31
31
|
messageQueueAttachmentRoot?: string | null;
|
|
32
32
|
hostUpdateStateFile?: string;
|
|
33
33
|
getHostUpdateVersion?: () => string;
|
|
34
|
+
remoteDesktopAdapter?: {
|
|
35
|
+
supported: boolean;
|
|
36
|
+
readonly enabled: boolean;
|
|
37
|
+
start: (options: { send: (message: unknown) => boolean; onEnded: () => void; signal: AbortSignal; client: { id: string; label: string } | null }) => Promise<{
|
|
38
|
+
handle: (message: unknown) => void | Promise<void>;
|
|
39
|
+
close: () => void;
|
|
40
|
+
}>;
|
|
41
|
+
stop?: () => void;
|
|
42
|
+
};
|
|
34
43
|
hostUpdateAdapter?: {
|
|
35
44
|
host: 'cli' | 'electron';
|
|
36
45
|
supported: boolean;
|
package/server/index.js
CHANGED
|
@@ -122,6 +122,7 @@ import { createProjectConfigRuntime } from './lib/projects/project-config.js';
|
|
|
122
122
|
import { createRemoteClientAuthRuntime } from './lib/client-auth/remote-clients.js';
|
|
123
123
|
import { createHostUpdateRuntime } from './lib/host-update/runtime.js';
|
|
124
124
|
import { createCliUpdateAdapter } from './lib/host-update/cli.js';
|
|
125
|
+
import { attachRemoteDesktop } from './lib/remote-desktop/runtime.js';
|
|
125
126
|
import { getOrCreateInstallId } from './lib/package-manager.js';
|
|
126
127
|
import { applyRuntimeCorsHeaders } from './lib/request-cors.js';
|
|
127
128
|
import { createClientPairingRuntime } from './lib/client-auth/pairing.js';
|
|
@@ -1920,6 +1921,14 @@ async function main(options = {}) {
|
|
|
1920
1921
|
}, 0);
|
|
1921
1922
|
}
|
|
1922
1923
|
uiAuthController = bootstrapResult.uiAuthController;
|
|
1924
|
+
const remoteDesktopRuntime = attachRemoteDesktop({
|
|
1925
|
+
app, server, adapter: options.remoteDesktopAdapter, uiAuthController, isRequestOriginAllowed,
|
|
1926
|
+
isClientActive: async (id) => {
|
|
1927
|
+
const clients = await remoteClientAuthRuntime.listClients();
|
|
1928
|
+
return clients.some((client) => client.id === id && !client.revokedAt
|
|
1929
|
+
&& (!client.expiresAt || Date.parse(client.expiresAt) > Date.now()));
|
|
1930
|
+
},
|
|
1931
|
+
});
|
|
1923
1932
|
realtimeProxyRuntime = attachRealtimeProxy({
|
|
1924
1933
|
app,
|
|
1925
1934
|
server,
|
|
@@ -2228,6 +2237,7 @@ async function main(options = {}) {
|
|
|
2228
2237
|
console.warn('[message-queue] Failed to close durable database during shutdown');
|
|
2229
2238
|
}
|
|
2230
2239
|
realtimeProxyRuntime.stop();
|
|
2240
|
+
remoteDesktopRuntime.stop();
|
|
2231
2241
|
liveActivityRefreshRuntime.dispose();
|
|
2232
2242
|
notificationTriggerRuntime.dispose();
|
|
2233
2243
|
if (relayReconcileTimer) clearInterval(relayReconcileTimer);
|
|
@@ -48,6 +48,21 @@ show temporary error feedback until a newer message arrives; reconnect/restart d
|
|
|
48
48
|
not recover errors. Errors do not become list previews, unread counts, or LLM memory.
|
|
49
49
|
Worker-card execution status remains part of the card's authoritative state.
|
|
50
50
|
|
|
51
|
+
## Contact attachment chronology
|
|
52
|
+
|
|
53
|
+
Historical files stay on their original user message in model context. The
|
|
54
|
+
completion adapter's pending-file fallback contains only the current turn's
|
|
55
|
+
`userParts`, never files collected from history. A text-only confirmation must
|
|
56
|
+
not resubmit older images or documents as new attachments; a new upload must not
|
|
57
|
+
be mixed with historical files. This also holds across tool follow-up completions.
|
|
58
|
+
The Host owns this behavior for web, Electron, hosted mobile and Capacitor clients;
|
|
59
|
+
no transcript migration or attachment deletion is needed.
|
|
60
|
+
|
|
61
|
+
When a turn falls out of the bounded history window, its file parts fall out with
|
|
62
|
+
it. Rolling summaries receive text only, not original attachment bytes; relevant
|
|
63
|
+
facts already described in conversation may survive as summary text. Stored
|
|
64
|
+
attachments remain available in the transcript UI.
|
|
65
|
+
|
|
51
66
|
## Avatar identity
|
|
52
67
|
|
|
53
68
|
`avatarSeed` is an optional nonempty string (maximum 256 characters) on create
|
|
@@ -427,7 +442,7 @@ and keep their existing error result handling.
|
|
|
427
442
|
- **`watch_session`:** listen-only attach for an existing session (`sessionID` required). No `session.prompt`. Emits the same session card slot and reuses `assistant_contact_watch` + `reportAssignedSession` / reconcile / resume. Baseline card/watch status comes from live `session.get` (+ messages when needed) via `mapSessionToWatchStatus` so an already-terminal idle is **not** treated as a fresh complete transition (no false resume). In-flight baseline (`busy`/`question`) keeps the watch until real settle. A plain user `@session:id` (or JSON title/sessionID/directory) reference is **context only** — it does not auto-call `watch_session`; the model must hear an explicit listen/watch/monitor intent.
|
|
428
443
|
- **`stop_session`:** calls real OpenCode `session.interrupt` for `sessionID` after the same authoritative directory resolve. Returns the true abort result — transport/`not_found`/upstream errors stay errors (never claim stopped on failure). Abort is registered in a private per-session inflight map before `await abort` so concurrent SSE `complete`/`error` cannot schedule a `resume=true` continuation ahead of `resume=false`. On successful abort the service marks the watch/card `cancelled` even when upstream emits no idle/error event. Idle/error events still flow through the existing watch reporter when a watch exists.
|
|
429
444
|
- **Worker model selection:** optional tool args `providerID` / `modelID` / `model` resolve against the live connected OpenCode catalog (`loadConnectedCatalog` / `GET /provider` + `GET /config/providers`). Explicit selection must match uniquely — missing or ambiguous names fail closed (`model_not_found` / `model_ambiguous`) with **no silent fallback**. Omitting model args on a **new** worker keeps the contact assistant's default provider/model. **Reusing `sessionID` without an explicit model** follows that session's last model (`session.get` → `session.model` `{ providerID, id|modelID }`, else newest user/assistant `info.model`) when it is still an exact providerID+modelID match in the connected catalog (`source: 'session'`); missing session model, catalog miss, or lookup failure **degrades** to the assistant default (`source: 'assistant'`) and never fails assign once the session itself resolved. Selecting a worker model **never** mutates the contact assistant row.
|
|
430
|
-
-
|
|
445
|
+
- The connected model catalog is **not** injected into turns. The base tool `list_models({ query? })` (absent from read-only background reviews) loads it on demand; each call reloads the current instance's **Connected OpenCode models** block (exact providerID, modelID, providerName, name, acceptsImages), plus settings-backed favorite models in saved order and recent models newest first. Only connected catalog entries qualify as preference candidates; variants remain separate from model IDs. Catalog and preference read failures remain explicit unknown states, distinct from successful empty lists; either read can succeed independently. The tool projects only favoriteModels/recentModels from the strict settings reader; defaultModel/defaultVariant are used separately for initial contact creation, never arbitrary settings or credentials. No catalog is cached across turns or runtime switches. Informal `model` aliases normalize punctuation/spacing and require a unique catalog match; explicit `modelID` stays exact. Ambiguous aliases never silently prefer a favorite/provider. This server-owned context is shared by web, desktop, and mobile clients of that instance.
|
|
431
446
|
- **Current-turn attachments:** server-authoritative `userParts` file parts from this contact turn are forwarded into worker `session.prompt` parts by default (including “just open a session” intents). The model must not base64-encode or invent local paths. History images are **not** unbounded-forwarded. Image parts require a vision-capable catalog entry (`acceptsImages`); otherwise assign fails with `image_not_supported` before create. Sensitive file bodies are never logged.
|
|
432
447
|
- **Create-then-prompt failure:** if `session.create` succeeds and `session.prompt` fails, assign best-effort `session.delete`s the new worker so empty sessions are not left behind. Reused `sessionID` paths never delete on prompt failure.
|
|
433
448
|
- Successful `assign_session` and `watch_session` return `terminate: true` to stop the mutation loop. The harness then requests a tools-disabled model summary. Prerequisite tools (`list_projects` / `list_sessions`) may still run before assign/watch/stop in the same turn; multi-operation user intents remain ordered **across turns** after a successful assign/watch.
|
|
@@ -448,7 +463,7 @@ and keep their existing error result handling.
|
|
|
448
463
|
|
|
449
464
|
**Registered projects + sessions (this PR)**
|
|
450
465
|
|
|
451
|
-
- Every contact turn injects a **Registered projects** block (`id`, `path`, `label`) from `listProjects()`
|
|
466
|
+
- Every contact turn injects a **Registered projects** block (`id`, `path`, `label`) from `listProjects()` via `formatRegisteredProjectsPrompt`, sorted by path for byte-stable output. It travels in a turn-context user message placed immediately before the latest user message of each completion request (`createContactStreamFn({ turnContext })`, never stored in Agent state or the transcript), not in the system prompt. A catalog change therefore invalidates only the prompt-cache tail; the system prompt orders static content first and the load_tools-dependent tool list last. The model can fuzzy-match names like "yuri yee" without a tool call first. Empty catalog → discover the relevant existing workspace using sessions and directory lookups, then request registration in Settings before assignment.
|
|
452
467
|
- `list_projects` refreshes/filters that catalog (`query` optional). `list_sessions` searches the existing session-index (`sessionIndexService.snapshot()`) for sessions in a project (`projectPath` / `projectID`, optional title query). Results are bounded (`sessionID`, `title`, `directory`, `updatedAt`). Index/catalog failure is an error, never an empty success.
|
|
453
468
|
- After matching a project, open work with `assign_session` (`projectPath` and/or existing `sessionID`).
|
|
454
469
|
|
|
@@ -486,7 +501,7 @@ Reply language follows the user's latest substantive message and conversation co
|
|
|
486
501
|
|
|
487
502
|
**Contact LLM window (this PR)**
|
|
488
503
|
|
|
489
|
-
- `contactHistoryForLlm` is a short algorithmic window documented in `contact-store.js`: durable context boundary first, then `CONTACT_LLM_MAX_TURNS` (32), `CONTACT_LLM_MAX_CHARS` (48000), `CONTACT_LLM_FETCH_LIMIT` (100), `CONTACT_LLM_FILE_CHAR_WEIGHT` (80). Newest user+assistant text pairs after the watermark are kept; peer / error rows are dropped; cards retain structured ID/status context.
|
|
504
|
+
- `contactHistoryForLlm` is a short algorithmic window documented in `contact-store.js`: durable context boundary first, then `CONTACT_LLM_MAX_TURNS` (32), `CONTACT_LLM_MAX_CHARS` (48000), `CONTACT_LLM_FETCH_LIMIT` (100), `CONTACT_LLM_FILE_CHAR_WEIGHT` (80). Newest user+assistant text pairs after the watermark are kept; peer / error rows are dropped; cards retain structured ID/status context. The window start is aligned to a multiple of `CONTACT_LLM_ALIGN_STEP` (16) message ordinals, so once the budget is full the history prefix stays byte-stable for several turns (prompt-cache friendly) and the window runs a few turns under budget right after each jump. Turns that fall out are folded into a rolling summary (`summary.js`, table `assistant_contact_summary`) that is prepended as a leading user item labelled lossy background; it is regenerated on the contact lane before the window loads, only when the window start moved past the summarized ordinal, with the assistant's own provider/model (60 s limit). A summary is valid only while the clear-memory boundaries and transcript generation it was written under are unchanged; clear-memory and wipe delete it, and a write racing a clear is discarded. A failed summary call logs a warning, keeps the previous summary, and the turn still runs. There is no user-facing compress or continuous/stateless memory control. SQLite and the transcript UI may still scroll older bubbles, including rows before the boundary.
|
|
490
505
|
|
|
491
506
|
**Contact attachments (this PR)**
|
|
492
507
|
|
|
@@ -614,7 +629,7 @@ Contact tools expose `assign_session` (new or continued session), `steer_session
|
|
|
614
629
|
|
|
615
630
|
### Contact context and background notification boundary
|
|
616
631
|
|
|
617
|
-
- The model history is bounded to 32 recent turns, 48,000 estimated characters and 100 transcript rows (newest turn remains intact).
|
|
632
|
+
- The model history is bounded to 32 recent turns, 48,000 estimated characters and 100 transcript rows (newest turn remains intact). Older turns are represented only by the lossy rolling summary above; it is not unlimited memory. Clear-memory still applies its persisted ordinal boundary. User instructions and assistant replies retain chronological ordering; card-only rows now contribute structured card context with exact session ID, directory and current status, instead of disappearing from the next model request. Peer inbox and failed rows remain excluded.
|
|
618
633
|
- Assigned-session settlement is a read-only result notification. The harness filters its tools to project/session/settings lookups and does not create a coding runtime. It cannot restart, assign, steer, archive, delete or write files even if the model attempts to do so. The latest user constraints remain in history.
|
|
619
634
|
- A new admitted user turn cancels running background notifications and durably disables notifications from existing watches (`resume_allowed`). Live card status continues updating truthfully. Explicit assign/watch admission rearms only that watch. This prevents a delayed completion after a stop/new instruction from restarting an obsolete background turn, including after server restart.
|
|
620
635
|
- Contact turns own AbortControllers. The existing session-abort route validates the current binding/generation, cancels active/queued contact turns and background notifications even without a legacy OpenCode binding, propagates the signal into the harness, and discards late generated output. With no active contact work it retains the legacy binding abort behavior. Already committed side effects are not rolled back.
|
|
@@ -53,6 +53,17 @@ export const CONTACT_SCHEMA_SQL = `
|
|
|
53
53
|
);
|
|
54
54
|
-- Contact transcript generation: bumps only on clear_chat_history / resetContact.
|
|
55
55
|
-- clear memory (context boundary) must not change this. Cursor keyset embeds it.
|
|
56
|
+
-- Rolling summary of turns that fell out of the LLM window. Valid only while
|
|
57
|
+
-- the stored boundaries and generation still match (see getContactSummary).
|
|
58
|
+
CREATE TABLE IF NOT EXISTS assistant_contact_summary (
|
|
59
|
+
assistant_id TEXT PRIMARY KEY,
|
|
60
|
+
summary_text TEXT NOT NULL,
|
|
61
|
+
covers_through_ordinal INTEGER NOT NULL,
|
|
62
|
+
after_ordinal INTEGER NOT NULL,
|
|
63
|
+
assistant_after_ordinal INTEGER NOT NULL,
|
|
64
|
+
generation INTEGER NOT NULL,
|
|
65
|
+
updated_at INTEGER NOT NULL
|
|
66
|
+
);
|
|
56
67
|
CREATE TABLE IF NOT EXISTS assistant_contact_generation (
|
|
57
68
|
assistant_id TEXT PRIMARY KEY,
|
|
58
69
|
generation INTEGER NOT NULL DEFAULT 0
|
|
@@ -1157,6 +1168,7 @@ export function deleteContactMessages(db, assistantID, { upToOrdinal = null } =
|
|
|
1157
1168
|
}
|
|
1158
1169
|
db.prepare('DELETE FROM assistant_contact_watch WHERE assistant_id=?').run(assistantID);
|
|
1159
1170
|
db.prepare('DELETE FROM assistant_contact_context_boundary WHERE assistant_id=?').run(assistantID);
|
|
1171
|
+
db.prepare('DELETE FROM assistant_contact_summary WHERE assistant_id=?').run(assistantID);
|
|
1160
1172
|
// Unbounded wipe leaves generation/read_state for the service layer to rebind
|
|
1161
1173
|
// (resetContact bumps generation + resetContactReadWatermarkForGeneration).
|
|
1162
1174
|
// Assistant delete clears read_state via deleteContactReadState.
|
|
@@ -1231,6 +1243,8 @@ export function clearContactMemory(db, assistantID, { updatedAt = Date.now(), up
|
|
|
1231
1243
|
db.prepare(
|
|
1232
1244
|
'INSERT INTO assistant_contact_context_boundary(assistant_id, after_ordinal, assistant_after_ordinal, updated_at) VALUES (?,?,?,?) ON CONFLICT(assistant_id) DO UPDATE SET after_ordinal=excluded.after_ordinal, assistant_after_ordinal=excluded.assistant_after_ordinal, updated_at=excluded.updated_at',
|
|
1233
1245
|
).run(assistantID, afterOrdinal, assistantAfterOrdinal, updatedAt);
|
|
1246
|
+
// Cleared memory must not survive inside a rolling summary.
|
|
1247
|
+
db.prepare('DELETE FROM assistant_contact_summary WHERE assistant_id=?').run(assistantID);
|
|
1234
1248
|
return { assistantID, afterOrdinal, memoryCleared: true };
|
|
1235
1249
|
}
|
|
1236
1250
|
|
|
@@ -1299,8 +1313,8 @@ export function updateSessionCardStatus(db, { assistantID, sessionID, status })
|
|
|
1299
1313
|
* LLM-only contact window. SQLite and the transcript UI may keep older bubbles
|
|
1300
1314
|
* (including rows before the durable context boundary). This budget owns the
|
|
1301
1315
|
* automatic model context; explicit recall uses the same boundaries in memory.js.
|
|
1302
|
-
*
|
|
1303
|
-
* continuous / stateless control on this path.
|
|
1316
|
+
* Turns that fall out are folded into a rolling summary by summary.js; there is
|
|
1317
|
+
* no user-facing compress / continuous / stateless control on this path.
|
|
1304
1318
|
*
|
|
1305
1319
|
* A turn is a user message plus the assistant replies that follow it until the
|
|
1306
1320
|
* next user. Newest turn is always kept, even when it exceeds the char budget.
|
|
@@ -1339,40 +1353,108 @@ const isLlmEligibleContactMessage = (message) => {
|
|
|
1339
1353
|
return hasText || hasFiles || hasCards;
|
|
1340
1354
|
};
|
|
1341
1355
|
|
|
1342
|
-
/**
|
|
1343
|
-
|
|
1356
|
+
/**
|
|
1357
|
+
* Prompt-cache friendly window start. Once the budget is full, a plain sliding
|
|
1358
|
+
* window drops the oldest turn on every request, so the whole history prefix
|
|
1359
|
+
* changes each time. With a step, the window start only moves to the next
|
|
1360
|
+
* multiple of `alignStep` message ordinals, keeping the prefix byte-stable for
|
|
1361
|
+
* several turns between jumps. The window therefore runs slightly under budget
|
|
1362
|
+
* right after a jump. 0 disables alignment (pure sliding window).
|
|
1363
|
+
*/
|
|
1364
|
+
export const CONTACT_LLM_ALIGN_STEP = 16;
|
|
1365
|
+
|
|
1366
|
+
/**
|
|
1367
|
+
* Turn-aware window for the model. Returns the kept items, the ordinal of the
|
|
1368
|
+
* oldest kept turn (null when unknown) and whether older turns were dropped.
|
|
1369
|
+
*/
|
|
1370
|
+
export function windowContactHistoryForLlm(messages, {
|
|
1344
1371
|
maxTurns = CONTACT_LLM_MAX_TURNS,
|
|
1345
1372
|
maxChars = CONTACT_LLM_MAX_CHARS,
|
|
1373
|
+
alignStep = 0,
|
|
1346
1374
|
} = {}) {
|
|
1347
1375
|
const eligible = (Array.isArray(messages) ? messages : [])
|
|
1348
1376
|
.filter(isLlmEligibleContactMessage)
|
|
1349
|
-
.map(toLlmHistoryItem)
|
|
1350
|
-
.filter((item) => item.content.trim().length > 0);
|
|
1377
|
+
.map((message) => ({ ordinal: Number(message.ordinal), item: toLlmHistoryItem(message) }))
|
|
1378
|
+
.filter(({ item }) => item.content.trim().length > 0);
|
|
1351
1379
|
|
|
1380
|
+
// Newest turn first; a turn's ordinal is its first (oldest) row.
|
|
1352
1381
|
const turns = [];
|
|
1353
1382
|
let current = [];
|
|
1354
1383
|
for (let index = eligible.length - 1; index >= 0; index -= 1) {
|
|
1355
|
-
const
|
|
1356
|
-
|
|
1357
|
-
|
|
1384
|
+
const entry = eligible[index];
|
|
1385
|
+
current.unshift(entry);
|
|
1386
|
+
if (entry.item.role === 'user') {
|
|
1358
1387
|
turns.push(current);
|
|
1359
1388
|
current = [];
|
|
1360
|
-
} else {
|
|
1361
|
-
current.unshift(item);
|
|
1362
1389
|
}
|
|
1363
1390
|
}
|
|
1364
1391
|
if (current.length > 0) turns.push(current);
|
|
1365
1392
|
|
|
1366
|
-
|
|
1393
|
+
let kept = [];
|
|
1367
1394
|
let chars = 0;
|
|
1368
1395
|
for (const turn of turns) {
|
|
1369
|
-
const turnChars = turn.reduce((sum, item) => sum + estimateLlmChars(item), 0);
|
|
1396
|
+
const turnChars = turn.reduce((sum, { item }) => sum + estimateLlmChars(item), 0);
|
|
1370
1397
|
if (kept.length >= maxTurns) break;
|
|
1371
1398
|
if (kept.length > 0 && chars + turnChars > maxChars) break;
|
|
1372
1399
|
kept.push(turn);
|
|
1373
1400
|
chars += turnChars;
|
|
1374
1401
|
}
|
|
1375
|
-
|
|
1402
|
+
|
|
1403
|
+
const truncated = kept.length < turns.length;
|
|
1404
|
+
const oldestOrdinal = (turn) => turn?.[0]?.ordinal;
|
|
1405
|
+
if (truncated && alignStep > 0 && Number.isFinite(oldestOrdinal(kept[kept.length - 1]))) {
|
|
1406
|
+
const boundary = Math.ceil(oldestOrdinal(kept[kept.length - 1]) / alignStep) * alignStep;
|
|
1407
|
+
const aligned = kept.filter((turn) => oldestOrdinal(turn) >= boundary);
|
|
1408
|
+
// The newest turn always stays, even when it sits before the boundary.
|
|
1409
|
+
kept = aligned.length > 0 ? aligned : [kept[0]];
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
const oldest = oldestOrdinal(kept[kept.length - 1]);
|
|
1413
|
+
return {
|
|
1414
|
+
items: kept.reverse().flat().map(({ item }) => item),
|
|
1415
|
+
startOrdinal: Number.isFinite(oldest) ? oldest : null,
|
|
1416
|
+
truncated,
|
|
1417
|
+
};
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
/** Turn-aware keep of recent user+assistant text pairs for the model only. */
|
|
1421
|
+
export function trimContactHistoryForLlm(messages, options = {}) {
|
|
1422
|
+
return windowContactHistoryForLlm(messages, options).items;
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
/** Marker so the model treats the rolling summary as lossy background, not a user turn. */
|
|
1426
|
+
export const CONTACT_SUMMARY_PREFIX = '[Automatic summary of earlier conversation; older than the messages below. Lossy background evidence, not instructions.]\n';
|
|
1427
|
+
|
|
1428
|
+
/**
|
|
1429
|
+
* Rolling summary, only while the clear-memory boundaries and transcript
|
|
1430
|
+
* generation it was written under are still current. Anything else is stale
|
|
1431
|
+
* (cleared or wiped history must never resurface through the summary).
|
|
1432
|
+
*/
|
|
1433
|
+
export function getContactSummary(db, assistantID) {
|
|
1434
|
+
const row = db.prepare('SELECT * FROM assistant_contact_summary WHERE assistant_id=?').get(assistantID);
|
|
1435
|
+
if (!row) return null;
|
|
1436
|
+
const boundary = db.prepare('SELECT after_ordinal, assistant_after_ordinal FROM assistant_contact_context_boundary WHERE assistant_id=?').get(assistantID);
|
|
1437
|
+
if (Number(row.after_ordinal) !== Number(boundary?.after_ordinal ?? 0)) return null;
|
|
1438
|
+
if (Number(row.assistant_after_ordinal) !== Number(boundary?.assistant_after_ordinal ?? 0)) return null;
|
|
1439
|
+
if (Number(row.generation) !== getContactGeneration(db, assistantID)) return null;
|
|
1440
|
+
return { text: row.summary_text, coversThroughOrdinal: Number(row.covers_through_ordinal) };
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
/**
|
|
1444
|
+
* Persist a summary computed from a snapshot of the boundaries. Discarded
|
|
1445
|
+
* (returns false) when a clear/wipe landed while the model call was in flight.
|
|
1446
|
+
*/
|
|
1447
|
+
export function saveContactSummary(db, assistantID, { text, coversThroughOrdinal, expected, updatedAt = Date.now() }) {
|
|
1448
|
+
return db.transaction(() => {
|
|
1449
|
+
const boundary = db.prepare('SELECT after_ordinal, assistant_after_ordinal FROM assistant_contact_context_boundary WHERE assistant_id=?').get(assistantID);
|
|
1450
|
+
if (Number(boundary?.after_ordinal ?? 0) !== expected.afterOrdinal
|
|
1451
|
+
|| Number(boundary?.assistant_after_ordinal ?? 0) !== expected.assistantAfterOrdinal
|
|
1452
|
+
|| getContactGeneration(db, assistantID) !== expected.generation) return false;
|
|
1453
|
+
db.prepare(
|
|
1454
|
+
'INSERT INTO assistant_contact_summary(assistant_id, summary_text, covers_through_ordinal, after_ordinal, assistant_after_ordinal, generation, updated_at) VALUES (?,?,?,?,?,?,?) ON CONFLICT(assistant_id) DO UPDATE SET summary_text=excluded.summary_text, covers_through_ordinal=excluded.covers_through_ordinal, after_ordinal=excluded.after_ordinal, assistant_after_ordinal=excluded.assistant_after_ordinal, generation=excluded.generation, updated_at=excluded.updated_at',
|
|
1455
|
+
).run(assistantID, text, coversThroughOrdinal, expected.afterOrdinal, expected.assistantAfterOrdinal, expected.generation, updatedAt);
|
|
1456
|
+
return true;
|
|
1457
|
+
})();
|
|
1376
1458
|
}
|
|
1377
1459
|
|
|
1378
1460
|
/**
|
|
@@ -1421,7 +1503,18 @@ export function projectActiveContactTurn(activeTurns) {
|
|
|
1421
1503
|
return valid[0] ?? null;
|
|
1422
1504
|
}
|
|
1423
1505
|
|
|
1424
|
-
|
|
1506
|
+
/** Raw boundary columns + generation a summary is written under. */
|
|
1507
|
+
export function getContactSummaryScope(db, assistantID) {
|
|
1508
|
+
const boundary = db.prepare('SELECT after_ordinal, assistant_after_ordinal FROM assistant_contact_context_boundary WHERE assistant_id=?').get(assistantID);
|
|
1509
|
+
return {
|
|
1510
|
+
afterOrdinal: Number(boundary?.after_ordinal ?? 0),
|
|
1511
|
+
assistantAfterOrdinal: Number(boundary?.assistant_after_ordinal ?? 0),
|
|
1512
|
+
generation: getContactGeneration(db, assistantID),
|
|
1513
|
+
};
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
/** Same eligibility rules for the window and for summary input. */
|
|
1517
|
+
function selectContactLlmMessages(db, assistantID, { excludeMessageIDs = [], beforeOrdinal = null } = {}) {
|
|
1425
1518
|
const afterOrdinal = getContactContextBoundary(db, assistantID);
|
|
1426
1519
|
const assistantAfterOrdinal = getContactAssistantContextBoundary(db, assistantID);
|
|
1427
1520
|
const exclude = new Set(
|
|
@@ -1434,7 +1527,7 @@ export function contactHistoryForLlm(db, assistantID, { excludeMessageIDs = [],
|
|
|
1434
1527
|
: Number(beforeOrdinal);
|
|
1435
1528
|
const userOrdinalCeiling = Number.isFinite(parsedCeiling) ? parsedCeiling : null;
|
|
1436
1529
|
const page = listContactMessages(db, assistantID, { limit: CONTACT_LLM_FETCH_LIMIT });
|
|
1437
|
-
|
|
1530
|
+
return page.messages.filter((message) => {
|
|
1438
1531
|
if (exclude.has(message.messageID)) return false;
|
|
1439
1532
|
if (!(message.ordinal > afterOrdinal)) return false;
|
|
1440
1533
|
if (message.role === 'assistant' && message.ordinal <= assistantAfterOrdinal) return false;
|
|
@@ -1448,7 +1541,48 @@ export function contactHistoryForLlm(db, assistantID, { excludeMessageIDs = [],
|
|
|
1448
1541
|
}
|
|
1449
1542
|
return true;
|
|
1450
1543
|
});
|
|
1451
|
-
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
/**
|
|
1547
|
+
* Window plus the rolling summary of what fell out of it. `startOrdinal` is the
|
|
1548
|
+
* oldest kept ordinal: everything eligible before it is the summary's input.
|
|
1549
|
+
*/
|
|
1550
|
+
export function contactLlmWindow(db, assistantID, options = {}) {
|
|
1551
|
+
const window = windowContactHistoryForLlm(
|
|
1552
|
+
selectContactLlmMessages(db, assistantID, options),
|
|
1553
|
+
{ alignStep: CONTACT_LLM_ALIGN_STEP },
|
|
1554
|
+
);
|
|
1555
|
+
const summary = window.truncated ? getContactSummary(db, assistantID) : null;
|
|
1556
|
+
return { ...window, summary };
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
export function contactHistoryForLlm(db, assistantID, options = {}) {
|
|
1560
|
+
const { items, summary } = contactLlmWindow(db, assistantID, options);
|
|
1561
|
+
// A leading user item keeps the summary inside the cacheable history prefix;
|
|
1562
|
+
// it only changes when the window jumps, which already invalidates the prefix.
|
|
1563
|
+
return summary ? [{ role: 'user', content: `${CONTACT_SUMMARY_PREFIX}${summary.text}` }, ...items] : items;
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
/**
|
|
1567
|
+
* Eligible rows that fell out of the window and are not yet summarized, oldest
|
|
1568
|
+
* first, as LLM items. Bounded to the newest `limit` rows so one very long gap
|
|
1569
|
+
* cannot produce an unbounded summary request.
|
|
1570
|
+
*/
|
|
1571
|
+
export function listContactSummaryInput(db, assistantID, { afterOrdinal, beforeOrdinal, limit = 200 } = {}) {
|
|
1572
|
+
const lower = Math.max(
|
|
1573
|
+
Number(afterOrdinal) || 0,
|
|
1574
|
+
getContactContextBoundary(db, assistantID),
|
|
1575
|
+
);
|
|
1576
|
+
const assistantAfterOrdinal = getContactAssistantContextBoundary(db, assistantID);
|
|
1577
|
+
const rows = db.prepare(
|
|
1578
|
+
'SELECT * FROM assistant_contact_message WHERE assistant_id=? AND ordinal>? AND ordinal<? ORDER BY ordinal DESC, message_id DESC LIMIT ?',
|
|
1579
|
+
).all(assistantID, lower, beforeOrdinal, limit);
|
|
1580
|
+
return rows.reverse()
|
|
1581
|
+
.map((row) => hydrateMessage(db, row))
|
|
1582
|
+
.filter((message) => !(message.role === 'assistant' && message.ordinal <= assistantAfterOrdinal))
|
|
1583
|
+
.filter(isLlmEligibleContactMessage)
|
|
1584
|
+
.map((message) => ({ ordinal: message.ordinal, ...toLlmHistoryItem(message) }))
|
|
1585
|
+
.filter((item) => item.content.trim().length > 0);
|
|
1452
1586
|
}
|
|
1453
1587
|
|
|
1454
1588
|
export { parseContactCard };
|
|
@@ -33,6 +33,8 @@ import {
|
|
|
33
33
|
getContactGeneration,
|
|
34
34
|
getContactReadTip,
|
|
35
35
|
getContactReadWatermark,
|
|
36
|
+
getContactSummary,
|
|
37
|
+
getContactSummaryScope,
|
|
36
38
|
getContactUnreadSnapshots,
|
|
37
39
|
getLatestContactMessagePreview,
|
|
38
40
|
getLatestContactMessagePreviews,
|
|
@@ -45,6 +47,7 @@ import {
|
|
|
45
47
|
projectActiveContactTurn,
|
|
46
48
|
resetContactReadWatermarkForGeneration,
|
|
47
49
|
sanitizeContactPreviewText,
|
|
50
|
+
saveContactSummary,
|
|
48
51
|
trimContactHistoryForLlm,
|
|
49
52
|
} from './contact-store.js';
|
|
50
53
|
|
|
@@ -95,8 +98,11 @@ describe('contact LLM history trim', () => {
|
|
|
95
98
|
insert(db, assistantID, { role: 'assistant', text: `assistant-${index}` });
|
|
96
99
|
}
|
|
97
100
|
const history = contactHistoryForLlm(db, assistantID);
|
|
98
|
-
|
|
99
|
-
|
|
101
|
+
// Budget alone would start at user-4 (ordinal 9); the cache-friendly window
|
|
102
|
+
// start snaps to the next multiple of CONTACT_LLM_ALIGN_STEP (16) → user-8.
|
|
103
|
+
expect(history).toHaveLength((36 - 8) * 2);
|
|
104
|
+
expect(history.length).toBeLessThanOrEqual(CONTACT_LLM_MAX_TURNS * 2);
|
|
105
|
+
expect(history[0]).toEqual({ role: 'user', content: 'user-8' });
|
|
100
106
|
expect(history.at(-1)).toEqual({ role: 'assistant', content: 'assistant-35' });
|
|
101
107
|
const page = listContactMessages(db, assistantID, { limit: 100 });
|
|
102
108
|
expect(page.messages).toHaveLength(72);
|
|
@@ -104,6 +110,42 @@ describe('contact LLM history trim', () => {
|
|
|
104
110
|
db.close();
|
|
105
111
|
});
|
|
106
112
|
|
|
113
|
+
it('keeps the window start stable across turns until the next alignment step', () => {
|
|
114
|
+
const db = openDb();
|
|
115
|
+
const assistantID = 'asst_stable';
|
|
116
|
+
const starts = [];
|
|
117
|
+
for (let index = 0; index < 60; index += 1) {
|
|
118
|
+
insert(db, assistantID, { role: 'user', text: `user-${index}` });
|
|
119
|
+
starts.push(contactHistoryForLlm(db, assistantID)[0].content);
|
|
120
|
+
insert(db, assistantID, { role: 'assistant', text: `assistant-${index}` });
|
|
121
|
+
}
|
|
122
|
+
// A pure sliding window would change the first item on every turn past 32.
|
|
123
|
+
expect(new Set(starts.slice(32)).size).toBeLessThanOrEqual(5);
|
|
124
|
+
db.close();
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('prepends a valid rolling summary and drops it once memory is cleared', () => {
|
|
128
|
+
const db = openDb();
|
|
129
|
+
const assistantID = 'asst_summary';
|
|
130
|
+
for (let index = 0; index < 40; index += 1) {
|
|
131
|
+
insert(db, assistantID, { role: 'user', text: `user-${index}` });
|
|
132
|
+
insert(db, assistantID, { role: 'assistant', text: `assistant-${index}` });
|
|
133
|
+
}
|
|
134
|
+
const scope = getContactSummaryScope(db, assistantID);
|
|
135
|
+
expect(saveContactSummary(db, assistantID, { text: 'prefers tabs', coversThroughOrdinal: 15, expected: scope })).toBe(true);
|
|
136
|
+
const history = contactHistoryForLlm(db, assistantID);
|
|
137
|
+
expect(history[0].role).toBe('user');
|
|
138
|
+
expect(history[0].content).toContain('prefers tabs');
|
|
139
|
+
expect(getContactSummary(db, assistantID)).toMatchObject({ text: 'prefers tabs', coversThroughOrdinal: 15 });
|
|
140
|
+
|
|
141
|
+
// A write computed under stale boundaries is discarded.
|
|
142
|
+
clearContactMemory(db, assistantID);
|
|
143
|
+
expect(saveContactSummary(db, assistantID, { text: 'stale', coversThroughOrdinal: 15, expected: scope })).toBe(false);
|
|
144
|
+
expect(getContactSummary(db, assistantID)).toBeNull();
|
|
145
|
+
expect(JSON.stringify(contactHistoryForLlm(db, assistantID))).not.toContain('prefers tabs');
|
|
146
|
+
db.close();
|
|
147
|
+
});
|
|
148
|
+
|
|
107
149
|
it('keeps card identity and drops peer and error rows from the LLM window', () => {
|
|
108
150
|
const db = openDb();
|
|
109
151
|
const assistantID = 'asst_filter';
|