@yuriai/web 0.2.27-beta.2 → 0.2.27-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/assets/{AgentAvatar-BW4Zg8bo.js → AgentAvatar-Bi1vvWPC.js} +1 -1
- package/dist/assets/AssistantContactStatus-CWq-PDz6.js +3 -0
- package/dist/assets/AssistantUnreadBadge-DdJyySwn.js +1 -0
- package/dist/assets/AssistantView-Br1iETTs.js +1 -0
- package/dist/assets/{DiagramView-D6wdXRzu.js → DiagramView-CI4bTtxy.js} +1 -1
- package/dist/assets/{FadeInOnReveal-gOsILpSk.js → FadeInOnReveal-BB4qEnAn.js} +1 -1
- package/dist/assets/GuiPluginSurface-CguxFUbM.js +1 -0
- package/dist/assets/{GuiPluginWindow-tGvc4_0g.js → GuiPluginWindow-DOJ7wuRH.js} +1 -1
- package/dist/assets/Icon-t2xvbAyN.js +1 -0
- package/dist/assets/{ImageLoadingPlaceholder-9xYbKqtf.js → ImageLoadingPlaceholder-D1L13TK0.js} +1 -1
- package/dist/assets/{LoadingImage-CiOcKPfb.js → LoadingImage-5rY_edNm.js} +1 -1
- package/dist/assets/{MarkdownRenderer-DZkP4UNr.js → MarkdownRenderer-BlGxjOei.js} +2 -2
- package/dist/assets/{MarkdownRendererImpl-BXzPUEEo.js → MarkdownRendererImpl-cE-0AYRg.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-B-NWd069.js → MarkstreamRendererImpl-BZyqDl82.js} +1 -1
- package/dist/assets/MobileDetailNavigation-tbfsMfB-.js +1 -0
- package/dist/assets/{MobileResizableSheet-ZL-zPa3W.js → MobileResizableSheet-BeRmT6_x.js} +1 -1
- package/dist/assets/{MobileShareBridge-JSH_Y8Ps.js → MobileShareBridge-C3Equ3P_.js} +2 -2
- package/dist/assets/MobileTabPageHeader-DQRqAAEf.js +2 -0
- package/dist/assets/{MultiRunWindow-ZPz62Aqg.js → MultiRunWindow-CAM2XPII.js} +1 -1
- package/dist/assets/{OnboardingScreen-BQNoy9o1.js → OnboardingScreen-4ftRerP5.js} +1 -1
- package/dist/assets/{OverlayScrollbar-BwCFalSw.js → OverlayScrollbar-CF0PCvQz.js} +1 -1
- package/dist/assets/{SettingsView-B17qt8dh.js → SettingsView-2tk4WH7R.js} +15 -15
- package/dist/assets/{SettingsWindow-CIFNHb-F.js → SettingsWindow-B9zbeJaW.js} +1 -1
- package/dist/assets/TerminalView-DfxvTHye.js +8 -0
- package/dist/assets/{ToolOutputDialog-BKuVpgEu.js → ToolOutputDialog-CrjDIhru.js} +1 -1
- package/dist/assets/{YuriLogo-C1Ty-RTB.js → YuriLogo-QvS1ZEHi.js} +1 -1
- package/dist/assets/{appThemeRegistry-DqGuzMaH.js → appThemeRegistry-Bb_DtiV9.js} +1 -1
- package/dist/assets/{button-DuHjvKJJ.js → button-DinGM3tu.js} +1 -1
- package/dist/assets/{capgoAdapter-B-tddboe.js → capgoAdapter-DufzjXRs.js} +1 -1
- package/dist/assets/{collapsible-B8eL5nLo.js → collapsible-Bh1GLNYV.js} +1 -1
- package/dist/assets/context-menu-DpbkRkk1.js +1 -0
- package/dist/assets/{diagram-ChoQDKzy.js → diagram-BmG-7Jb4.js} +1 -1
- package/dist/assets/{dialog-CVhqZux0.js → dialog-BXssfGXA.js} +1 -1
- package/dist/assets/es-HP_Ise0X.js +15 -0
- package/dist/assets/{fileMentionTouchSelection-Dd-iSIe2.js → fileMentionTouchSelection-DSl0tj2r.js} +1 -1
- package/dist/assets/{fileReferenceActions-BAoEu4z8.js → fileReferenceActions-CGpBSFq4.js} +1 -1
- package/dist/assets/fr-D0kJXJ6U.js +13 -0
- package/dist/assets/gitApi-Wo0IZow9.js +370 -0
- package/dist/assets/{gitApiHttp-DHrRqnYh.js → gitApiHttp-De9liKnG.js} +4 -4
- package/dist/assets/host-FR_grJxM.js +1 -0
- package/dist/assets/{input-E_oYiXZT.js → input-v8-rVbo-.js} +1 -1
- package/dist/assets/insertionBoundaries-CZz7TWJv.js +1 -0
- package/dist/assets/ja-BjHKXazE.js +15 -0
- package/dist/assets/ko-Llwnl876.js +15 -0
- package/dist/assets/main-Bp9HHqTr.js +2 -0
- package/dist/assets/main-DOwAfmxJ.js +169 -0
- package/dist/assets/{markdownHeightCache-heNXHdzb.js → markdownHeightCache-BVV2dktw.js} +1 -1
- package/dist/assets/{mcpQueries-BqKVe4Su.js → mcpQueries-BoBrB4a4.js} +1 -1
- package/dist/assets/miniChat-BJDgCrfF.js +2 -0
- package/dist/assets/mobile-GM9931J_.js +2 -0
- package/dist/assets/{mobileBackNavigation-DHxFQ7SY.js → mobileBackNavigation-DMSzAvb6.js} +1 -1
- package/dist/assets/{multirun-CPOzaEQj.js → multirun-BhWttsRQ.js} +1 -1
- package/dist/assets/{native-De1DIkLZ.js → native-DSvNnKAm.js} +1 -1
- package/dist/assets/{native-config-oauL2ekt.js → native-config-DjdrW_9n.js} +1 -1
- package/dist/assets/{persistence-JyLTFv27.js → persistence-CfrHIiIS.js} +1 -1
- package/dist/assets/pl-BOd_idqn.js +15 -0
- package/dist/assets/{projectMeta-YDMdD3AP.js → projectMeta-31PobC-M.js} +1 -1
- package/dist/assets/pt-BR-B8djxMsl.js +15 -0
- package/dist/assets/react-B9v0P7kT.js +1 -0
- package/dist/assets/{readiness-BveVUOIb.js → readiness-CYNnsekT.js} +1 -1
- package/dist/assets/renderElectronMiniChatApp-N2r999Bf.js +2 -0
- package/dist/assets/renderMobileApp-CU1ec6Ak.js +28 -0
- package/dist/assets/{runtimeConfig-BpcgdIV9.js → runtimeConfig-Db7yfo6L.js} +1 -1
- package/dist/assets/runtimeEndpointReset-DO5WVetV.js +149 -0
- package/dist/assets/scheduledTaskNavigation-Bsrhv3Ow.js +1 -0
- package/dist/assets/sessionLookup-DRVy7LM1.js +1 -0
- package/dist/assets/sortable-tabs-strip-yKyqsqut.js +1 -0
- package/dist/assets/speechSettingsQueries-DU25rmGc.js +4 -0
- package/dist/assets/src-Bckdo2XS.css +2 -0
- package/dist/assets/store-CUBymvAC.js +15 -0
- package/dist/assets/{terminalApi-B5o8UqWA.js → terminalApi-BblSkqch.js} +1 -1
- package/dist/assets/{textarea-DmKaqHSb.js → textarea-B39OCNPV.js} +1 -1
- package/dist/assets/{tooltip-DUKu4nC6.js → tooltip-d8TNN4lx.js} +1 -1
- package/dist/assets/{types-DRTMRW4R.js → types-BqFQhQTt.js} +1 -1
- package/dist/assets/{uk-CYZXWdd7.js → uk-BNd7CjVO.js} +4 -4
- package/dist/assets/{useAppFontEffects-BiQf6tgZ.js → useAppFontEffects-BVoVpJYO.js} +57 -55
- package/dist/assets/{useAssistantUIStore-C9FPlYQz.js → useAssistantUIStore-Bp6TxG5E.js} +1 -1
- package/dist/assets/useDesktopWindowControlsLayout-CYx1LNO5.js +1 -0
- package/dist/assets/{useEffectiveDirectory-B8q00InF.js → useEffectiveDirectory-D8FFE5Yn.js} +1 -1
- package/dist/assets/{useFontPreferences-DMiP_Yy-.js → useFontPreferences-BFyBjtQ6.js} +1 -1
- package/dist/assets/useMobileNavigationStore-BHMFeMjo.js +23 -0
- package/dist/assets/useUIStore-BbYD420L.js +1 -0
- package/dist/assets/{useWorkerHighlightedLines-B6lWNk01.js → useWorkerHighlightedLines-CPxG8Fya.js} +1 -1
- package/dist/assets/{vendor-codemirror-search-ZqtrPLjU.js → vendor-codemirror-search-DiPwvA-6.js} +2 -2
- package/dist/assets/{vendor-opencode-plugin-Bw7Q6Nv9.js → vendor-opencode-plugin-CgKz9Hcy.js} +1 -1
- package/dist/assets/{vendor-replit-codemirror-vim-DDj0dSVY.js → vendor-replit-codemirror-vim-DCdAdxvE.js} +3 -3
- package/dist/assets/zh-CN-BkTAEOZG.js +15 -0
- package/dist/assets/zh-TW-x8SfMzfc.js +15 -0
- package/dist/index.html +10 -10
- package/dist/mini-chat.html +10 -10
- package/dist/mobile.html +10 -10
- package/package.json +3 -3
- package/server/lib/assistants/DOCUMENTATION.md +30 -0
- package/server/lib/assistants/contact-store.js +16 -0
- package/server/lib/assistants/contact-store.test.js +19 -0
- package/server/lib/assistants/contracts.js +1 -0
- package/server/lib/assistants/routes.js +25 -3
- package/server/lib/assistants/service.js +30 -8
- package/server/lib/assistants/service.test.js +151 -0
- package/server/lib/assistants/weixin/DOCUMENTATION.md +199 -0
- package/server/lib/assistants/weixin/api.js +113 -0
- package/server/lib/assistants/weixin/api.test.js +80 -0
- package/server/lib/assistants/weixin/routes.js +24 -0
- package/server/lib/assistants/weixin/routes.test.js +71 -0
- package/server/lib/assistants/weixin/runtime.js +426 -0
- package/server/lib/assistants/weixin/runtime.test.js +500 -0
- package/server/lib/assistants/weixin/store.js +116 -0
- package/server/lib/assistants/weixin/typing.js +88 -0
- package/server/lib/assistants/weixin/typing.test.js +185 -0
- package/server/lib/opencode/DOCUMENTATION.md +2 -1
- package/server/lib/opencode/npm-registry.js +7 -21
- package/server/lib/opencode/npm-registry.test.js +36 -5
- package/server/lib/opencode/plugin-icon.d.ts +2 -0
- package/server/lib/opencode/plugin-icon.js +43 -0
- package/server/lib/opencode/plugin-icon.test.js +41 -0
- package/server/lib/opencode/plugin-routes.js +3 -1
- package/server/lib/opencode/plugin-routes.test.js +13 -0
- package/server/lib/opencode/shutdown-runtime.js +1 -1
- package/server/lib/opencode/shutdown-runtime.test.js +12 -0
- package/dist/assets/AssistantView-Cl0ZeXwr.js +0 -3
- package/dist/assets/GuiPluginSurface-DOZAQKX0.js +0 -1
- package/dist/assets/Icon-DvUDsV1z.js +0 -1
- package/dist/assets/MobileDetailNavigation-5U28hfYf.js +0 -1
- package/dist/assets/MobileTabPageHeader-Bj9MIS38.js +0 -2
- package/dist/assets/TerminalView-BZZ8LW4d.js +0 -8
- package/dist/assets/dropdown-menu.styles-DGvlOX_5.js +0 -1
- package/dist/assets/es-B8sAsuo5.js +0 -15
- package/dist/assets/fr-BPpW8T-l.js +0 -13
- package/dist/assets/gitApi-D43bAQh1.js +0 -10
- package/dist/assets/host-D1EpSUMR.js +0 -1
- package/dist/assets/insertionBoundaries-BQjiZAmZ.js +0 -1
- package/dist/assets/ja-DEoFDi7P.js +0 -15
- package/dist/assets/ko-B45xHN6I.js +0 -15
- package/dist/assets/main-C6MDfyZy.js +0 -2
- package/dist/assets/main-u5iQScJs.js +0 -169
- package/dist/assets/miniChat-Dhfn71Re.js +0 -2
- package/dist/assets/mobile-DSVdPfcG.js +0 -2
- package/dist/assets/pl-Bm3Je_AX.js +0 -15
- package/dist/assets/pt-BR-BiQwFHhL.js +0 -15
- package/dist/assets/react-CURmDhtB.js +0 -1
- package/dist/assets/renderElectronMiniChatApp-NC8iRPyy.js +0 -2
- package/dist/assets/renderMobileApp-D5ai1i6y.js +0 -28
- package/dist/assets/runtimeEndpointReset-ByKa_0nu.js +0 -149
- package/dist/assets/scheduledTaskNavigation-CZfAnPD-.js +0 -1
- package/dist/assets/sessionChangeSummary-D6NlE_5k.js +0 -1
- package/dist/assets/sessionLookup-C70EoX-V.js +0 -1
- package/dist/assets/sortable-tabs-strip-aKussO2c.js +0 -1
- package/dist/assets/speechSettingsQueries-B6qf-mCh.js +0 -4
- package/dist/assets/src-NKCZI3Lg.css +0 -2
- package/dist/assets/store-BeD2keas.js +0 -15
- package/dist/assets/useDesktopWindowControlsLayout-DJxNmCWb.js +0 -1
- package/dist/assets/useMobileNavigationStore-Bn4SaalY.js +0 -418
- package/dist/assets/useUIStore-DI7va1HH.js +0 -1
- package/dist/assets/zh-CN-CMLBHipA.js +0 -15
- package/dist/assets/zh-TW-CJlmnnhK.js +0 -15
- /package/dist/assets/{sessionChangeSummary-8C8nv-EP.css → sessionLookup-8C8nv-EP.css} +0 -0
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-Bp9HHqTr.js"></script>
|
|
564
564
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
565
565
|
<link rel="modulepreload" crossorigin href="/assets/runtime-auth-DBn9yahL.js">
|
|
566
566
|
<link rel="modulepreload" crossorigin href="/assets/runtime-switch-DEZ1K7qW.js">
|
|
@@ -575,28 +575,28 @@
|
|
|
575
575
|
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-UL_TecvQ.js">
|
|
576
576
|
<link rel="modulepreload" crossorigin href="/assets/brand-storage-migration-Bhz6UOBJ.js">
|
|
577
577
|
<link rel="modulepreload" crossorigin href="/assets/brand-storage-bootstrap-D4BW3w-M.js">
|
|
578
|
-
<link rel="modulepreload" crossorigin href="/assets/useUIStore-
|
|
578
|
+
<link rel="modulepreload" crossorigin href="/assets/useUIStore-BbYD420L.js">
|
|
579
579
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-D5d-V1vN.js">
|
|
580
580
|
<link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-query-core-BWz0ose6.js">
|
|
581
581
|
<link rel="modulepreload" crossorigin href="/assets/queryRuntime-Dkpnq3Z1.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-CfrHIiIS.js">
|
|
585
585
|
<link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-react-query-C4SG3JZB.js">
|
|
586
586
|
<link rel="modulepreload" crossorigin href="/assets/fileQueries-5a1jkme2.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-6np6lzoV.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-De9liKnG.js">
|
|
592
|
+
<link rel="modulepreload" crossorigin href="/assets/terminalApi-BblSkqch.js">
|
|
593
593
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-CcNIVp7u.js">
|
|
594
594
|
<link rel="modulepreload" crossorigin href="/assets/platform-DFJEtBlo.js">
|
|
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-
|
|
595
|
+
<link rel="modulepreload" crossorigin href="/assets/types-BqFQhQTt.js">
|
|
596
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-DufzjXRs.js">
|
|
597
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-DjdrW_9n.js">
|
|
598
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-Db7yfo6L.js">
|
|
599
|
+
<link rel="stylesheet" crossorigin href="/assets/src-Bckdo2XS.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,7 +77,7 @@
|
|
|
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-BJDgCrfF.js"></script>
|
|
81
81
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
82
82
|
<link rel="modulepreload" crossorigin href="/assets/runtime-auth-DBn9yahL.js">
|
|
83
83
|
<link rel="modulepreload" crossorigin href="/assets/runtime-switch-DEZ1K7qW.js">
|
|
@@ -92,28 +92,28 @@
|
|
|
92
92
|
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-UL_TecvQ.js">
|
|
93
93
|
<link rel="modulepreload" crossorigin href="/assets/brand-storage-migration-Bhz6UOBJ.js">
|
|
94
94
|
<link rel="modulepreload" crossorigin href="/assets/brand-storage-bootstrap-D4BW3w-M.js">
|
|
95
|
-
<link rel="modulepreload" crossorigin href="/assets/useUIStore-
|
|
95
|
+
<link rel="modulepreload" crossorigin href="/assets/useUIStore-BbYD420L.js">
|
|
96
96
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-D5d-V1vN.js">
|
|
97
97
|
<link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-query-core-BWz0ose6.js">
|
|
98
98
|
<link rel="modulepreload" crossorigin href="/assets/queryRuntime-Dkpnq3Z1.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-CfrHIiIS.js">
|
|
102
102
|
<link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-react-query-C4SG3JZB.js">
|
|
103
103
|
<link rel="modulepreload" crossorigin href="/assets/fileQueries-5a1jkme2.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-6np6lzoV.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-De9liKnG.js">
|
|
109
|
+
<link rel="modulepreload" crossorigin href="/assets/terminalApi-BblSkqch.js">
|
|
110
110
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-CcNIVp7u.js">
|
|
111
111
|
<link rel="modulepreload" crossorigin href="/assets/platform-DFJEtBlo.js">
|
|
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-
|
|
112
|
+
<link rel="modulepreload" crossorigin href="/assets/types-BqFQhQTt.js">
|
|
113
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-DufzjXRs.js">
|
|
114
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-DjdrW_9n.js">
|
|
115
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-Db7yfo6L.js">
|
|
116
|
+
<link rel="stylesheet" crossorigin href="/assets/src-Bckdo2XS.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,7 +64,7 @@
|
|
|
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-GM9931J_.js"></script>
|
|
68
68
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
69
69
|
<link rel="modulepreload" crossorigin href="/assets/runtime-auth-DBn9yahL.js">
|
|
70
70
|
<link rel="modulepreload" crossorigin href="/assets/runtime-switch-DEZ1K7qW.js">
|
|
@@ -79,28 +79,28 @@
|
|
|
79
79
|
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-UL_TecvQ.js">
|
|
80
80
|
<link rel="modulepreload" crossorigin href="/assets/brand-storage-migration-Bhz6UOBJ.js">
|
|
81
81
|
<link rel="modulepreload" crossorigin href="/assets/brand-storage-bootstrap-D4BW3w-M.js">
|
|
82
|
-
<link rel="modulepreload" crossorigin href="/assets/useUIStore-
|
|
82
|
+
<link rel="modulepreload" crossorigin href="/assets/useUIStore-BbYD420L.js">
|
|
83
83
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-D5d-V1vN.js">
|
|
84
84
|
<link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-query-core-BWz0ose6.js">
|
|
85
85
|
<link rel="modulepreload" crossorigin href="/assets/queryRuntime-Dkpnq3Z1.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-CfrHIiIS.js">
|
|
89
89
|
<link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-react-query-C4SG3JZB.js">
|
|
90
90
|
<link rel="modulepreload" crossorigin href="/assets/fileQueries-5a1jkme2.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-6np6lzoV.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-De9liKnG.js">
|
|
96
|
+
<link rel="modulepreload" crossorigin href="/assets/terminalApi-BblSkqch.js">
|
|
97
97
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-CcNIVp7u.js">
|
|
98
98
|
<link rel="modulepreload" crossorigin href="/assets/platform-DFJEtBlo.js">
|
|
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-
|
|
99
|
+
<link rel="modulepreload" crossorigin href="/assets/types-BqFQhQTt.js">
|
|
100
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-DufzjXRs.js">
|
|
101
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-DjdrW_9n.js">
|
|
102
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-Db7yfo6L.js">
|
|
103
|
+
<link rel="stylesheet" crossorigin href="/assets/src-Bckdo2XS.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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuriai/web",
|
|
3
|
-
"version": "0.2.27-beta.
|
|
3
|
+
"version": "0.2.27-beta.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./server/index.js",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
15
|
"dev": "bun run build:watch",
|
|
16
|
-
"dev:server": "bun run build:llm-bridge && node ../../scripts/ensure-node-better-sqlite3.mjs && node server/index.js --port ${YURI_PORT:-3001}",
|
|
17
|
-
"dev:server:watch": "bun run build:llm-bridge && nodemon --exitcrash --watch server --ext js --exec \"node ../../scripts/ensure-node-better-sqlite3.mjs && node server/index.js --port ${YURI_PORT:-3001}\"",
|
|
16
|
+
"dev:server": "bun run build:llm-bridge && node ../../scripts/ensure-node-better-sqlite3.mjs && cross-env NODE_ENV=development node server/index.js --port ${YURI_PORT:-3001}",
|
|
17
|
+
"dev:server:watch": "bun run build:llm-bridge && nodemon --exitcrash --watch server --ext js --exec \"node ../../scripts/ensure-node-better-sqlite3.mjs && cross-env NODE_ENV=development node server/index.js --port ${YURI_PORT:-3001}\"",
|
|
18
18
|
"build": "bun run build:llm-bridge && vite build",
|
|
19
19
|
"build:llm-bridge": "bun scripts/build-llm-bridge.mjs",
|
|
20
20
|
"prepack": "bun run build:llm-bridge",
|
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# Assistants Module
|
|
2
2
|
|
|
3
|
+
## Contact pins
|
|
4
|
+
|
|
5
|
+
Schema v15 adds nullable `assistant_v2.pinned_at`; existing contacts start unpinned.
|
|
6
|
+
The ordinary revision-checked Assistant PATCH accepts `pinned: boolean` and returns
|
|
7
|
+
`pinnedAt: number | null` in every Assistant DTO/snapshot. The Host chooses the time;
|
|
8
|
+
repeated pinning and unrelated settings edits preserve it, and unpinning clears it.
|
|
9
|
+
Only one live Bot may be pinned per Host. Pinning another Bot atomically clears
|
|
10
|
+
the previous pin and revises both contacts. Schema v16 keeps the most recently
|
|
11
|
+
pinned live contact from v15 (source order breaks ties), clears the others without
|
|
12
|
+
changing unread/history, and installs a partial unique index to enforce the limit.
|
|
13
|
+
Normalization, the index and schema-version update commit together; failure can retry.
|
|
14
|
+
Writes and domain revision changes use the existing transaction, so failed replacement
|
|
15
|
+
preserves the previous pin and all revisions. Pins do not create/reset sessions, alter catalog/share-default
|
|
16
|
+
order, or change avatar/transcript/read state. Tombstoned contacts never appear in
|
|
17
|
+
the pinned list. Existing snapshot events distribute confirmed changes to clients.
|
|
18
|
+
|
|
19
|
+
## WeChat message channel
|
|
20
|
+
|
|
21
|
+
Each saved Bot has a Host-owned, QR-authorized text channel configured in the final
|
|
22
|
+
**Message channels** settings group. It admits only the QR-confirmed owner through
|
|
23
|
+
the existing `send()` pipeline and reads committed public replies through the internal
|
|
24
|
+
`channelPage()` feed. Bindings, private credentials, durable receipts/outbox and
|
|
25
|
+
process leases are owned by `weixin/`, not ordinary Session delivery or UI state.
|
|
26
|
+
See `weixin/DOCUMENTATION.md` for authorization, shared-context/output semantics,
|
|
27
|
+
restart ambiguity, local disconnect and the explicit platform-verification limits.
|
|
28
|
+
An existing local WeChat connection can be moved to an unbound Bot only through
|
|
29
|
+
explicit revision-checked confirmation; the source stops syncing, receipt IDs and
|
|
30
|
+
platform cursor survive, and histories/queued replies are not migrated. Repeated
|
|
31
|
+
scanning does not create independent WeChat entries for the same user.
|
|
32
|
+
|
|
3
33
|
## New-contact greeting
|
|
4
34
|
|
|
5
35
|
Every successful create (HTTP, contact tool, or first-run seed) atomically inserts
|
|
@@ -731,6 +731,22 @@ export function getContactMessage(db, messageID) {
|
|
|
731
731
|
return hydrateMessage(db, row);
|
|
732
732
|
}
|
|
733
733
|
|
|
734
|
+
/** Bounded, ascending durable output feed for Host-owned message channels. */
|
|
735
|
+
export function readContactChannelPage(db, assistantID, { afterOrdinal = 0, generation = null, tipOnly = false } = {}) {
|
|
736
|
+
return db.transaction(() => {
|
|
737
|
+
const tip = getContactReadTip(db, assistantID);
|
|
738
|
+
const after = generation === null || generation === tip.generation ? afterOrdinal : 0;
|
|
739
|
+
const rows = tipOnly ? [] : db.prepare(`SELECT * FROM assistant_contact_message WHERE assistant_id=? AND ordinal>?
|
|
740
|
+
ORDER BY ordinal ASC LIMIT 50`).all(assistantID, after);
|
|
741
|
+
return {
|
|
742
|
+
generation: tip.generation,
|
|
743
|
+
tipOrdinal: tip.ordinal,
|
|
744
|
+
ordinal: rows.at(-1)?.ordinal ?? after,
|
|
745
|
+
messages: rows.filter((row) => row.role === 'assistant').map((row) => hydrateMessage(db, row)),
|
|
746
|
+
};
|
|
747
|
+
})();
|
|
748
|
+
}
|
|
749
|
+
|
|
734
750
|
const isSettleOnlyText = (text) => {
|
|
735
751
|
const trimmed = typeof text === 'string' ? text.trim() : '';
|
|
736
752
|
return trimmed.startsWith('oc.settle.');
|
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
migrateContactReadStateDefaultRead,
|
|
46
46
|
nextContactOrdinal,
|
|
47
47
|
projectActiveContactTurn,
|
|
48
|
+
readContactChannelPage,
|
|
48
49
|
resetContactReadWatermarkForGeneration,
|
|
49
50
|
sanitizeContactPreviewText,
|
|
50
51
|
saveContactSummary,
|
|
@@ -61,6 +62,24 @@ const openDb = () => {
|
|
|
61
62
|
return db;
|
|
62
63
|
};
|
|
63
64
|
|
|
65
|
+
it('channel output feed is ascending, bounded, generation-aware and isolated by Bot', () => {
|
|
66
|
+
const db = openDb();
|
|
67
|
+
try {
|
|
68
|
+
for (let index = 0; index < 60; index++) insert(db, 'a', { role: index % 2 ? 'assistant' : 'user', text: `row-${index}` });
|
|
69
|
+
insert(db, 'b', { role: 'assistant', text: 'other Bot' });
|
|
70
|
+
const page = readContactChannelPage(db, 'a');
|
|
71
|
+
expect(page.ordinal).toBe(50);
|
|
72
|
+
expect(page.tipOrdinal).toBe(60);
|
|
73
|
+
expect(page.messages).toHaveLength(25);
|
|
74
|
+
expect(page.messages.every((message) => message.assistantID === 'a' && message.role === 'assistant')).toBe(true);
|
|
75
|
+
expect(readContactChannelPage(db, 'a', { afterOrdinal: page.ordinal, generation: page.generation }).messages).toHaveLength(5);
|
|
76
|
+
deleteContactMessages(db, 'a');
|
|
77
|
+
bumpContactGeneration(db, 'a');
|
|
78
|
+
insert(db, 'a', { role: 'assistant', text: 'new generation' });
|
|
79
|
+
expect(readContactChannelPage(db, 'a', { afterOrdinal: 60, generation: page.generation }).messages[0].text).toBe('new generation');
|
|
80
|
+
} finally { db.close(); }
|
|
81
|
+
});
|
|
82
|
+
|
|
64
83
|
const insert = (db, assistantID, {
|
|
65
84
|
role, text = '', parts, status = 'complete', fromAssistantID = null, fromAssistantName = null, turnID = null, messageID = null, createdAt = Date.now(),
|
|
66
85
|
}) => {
|
|
@@ -3,11 +3,15 @@ import { isSafeInlineImageMime } from './contact-attachments.js';
|
|
|
3
3
|
import { createChatCompletion } from '../llm/completions.js';
|
|
4
4
|
import { setAssignedSessionSettleHandler } from '../session-goal/runtime.js';
|
|
5
5
|
import { makeOpenCodeV2Client } from '../opencode/v2-client.js';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import { createWeixinRuntime } from './weixin/runtime.js';
|
|
8
|
+
import { registerWeixinRoutes } from './weixin/routes.js';
|
|
6
9
|
|
|
7
10
|
const respond = (res, work, success = 200) => Promise.resolve().then(work).then((body) => res.status(success).json(body)).catch((error) => { const code = error instanceof AssistantError ? error.code : error?.code || 'internal_error'; const status = code === 'not_found' ? 404 : ['revision_conflict', 'idempotency_conflict', 'contact_generation_conflict'].includes(code) ? 409 : code === 'assistant_disabled' ? 403 : code === 'no_provider' ? 400 : code === 'upstream_error' || code === 'llm_attachment_generation_unavailable' ? 502 : 400; res.status(status).json({ ok: false, error: code, message: typeof error?.message === 'string' && error.message.trim() ? error.message : code }); });
|
|
8
11
|
const gone = (_req, res) => res.status(410).json({ ok: false, error: 'assistant_topics_retired' });
|
|
9
12
|
|
|
10
13
|
export const registerAssistantRoutes = (app, dependencies) => {
|
|
14
|
+
let weixin;
|
|
11
15
|
const boundCompletion = (input) => createChatCompletion({
|
|
12
16
|
...input,
|
|
13
17
|
buildOpenCodeUrl: dependencies.buildOpenCodeUrl,
|
|
@@ -38,7 +42,10 @@ export const registerAssistantRoutes = (app, dependencies) => {
|
|
|
38
42
|
syncScheduledTaskProject: dependencies.syncScheduledTaskProject,
|
|
39
43
|
globalEventHub: dependencies.globalEventHub,
|
|
40
44
|
onRevisionTip: dependencies.onRevisionTip,
|
|
41
|
-
onContactTurnEvent:
|
|
45
|
+
onContactTurnEvent: (event) => {
|
|
46
|
+
weixin?.onTurnEvent(event);
|
|
47
|
+
dependencies.onContactTurnEvent?.(event);
|
|
48
|
+
},
|
|
42
49
|
onContactTurnComplete: dependencies.onContactTurnComplete,
|
|
43
50
|
archiveSessionHost: dependencies.archiveSessionHost,
|
|
44
51
|
forgetSessionHost: dependencies.forgetSessionHost,
|
|
@@ -52,7 +59,11 @@ export const registerAssistantRoutes = (app, dependencies) => {
|
|
|
52
59
|
app.get('/api/yuri/assistants/capability', (_req, res) => respond(res, () => service.capability()));
|
|
53
60
|
const snapshot = async () => { await service.ensureDefaultAssistant(); return service.snapshot(); };
|
|
54
61
|
app.get('/api/yuri/assistants', (_req, res) => respond(res, snapshot)); app.get('/api/yuri/assistants/snapshot', (_req, res) => respond(res, snapshot)); app.put('/api/yuri/assistants/settings', (req, res) => respond(res, () => service.setEnabled(req.body)));
|
|
55
|
-
app.post('/api/yuri/assistants', (req, res) => respond(res, () => service.createAssistant(req.body), 201)); app.patch('/api/yuri/assistants/:assistantID', (req, res) => respond(res, () => service.updateAssistant(req.params.assistantID, req.body))); app.delete('/api/yuri/assistants/:assistantID', (req, res) => respond(res, () =>
|
|
62
|
+
app.post('/api/yuri/assistants', (req, res) => respond(res, () => service.createAssistant(req.body), 201)); app.patch('/api/yuri/assistants/:assistantID', (req, res) => respond(res, () => service.updateAssistant(req.params.assistantID, req.body))); app.delete('/api/yuri/assistants/:assistantID', (req, res) => respond(res, async () => {
|
|
63
|
+
const result = service.removeAssistant(req.params.assistantID, req.body?.expectedRevision);
|
|
64
|
+
await weixin.forget(req.params.assistantID);
|
|
65
|
+
return result;
|
|
66
|
+
}));
|
|
56
67
|
app.post('/api/yuri/assistants/:assistantID/session/ensure', (req, res) => respond(res, () => service.ensure(req.params.assistantID))); app.post('/api/yuri/assistants/:assistantID/session/new', (req, res) => respond(res, () => service.createNew(req.params.assistantID))); app.post('/api/yuri/assistants/:assistantID/session/compact', (req, res) => respond(res, () => service.compact(req.params.assistantID, req.body))); app.post('/api/yuri/assistants/:assistantID/session/abort', (req, res) => respond(res, () => service.abort(req.params.assistantID, req.body)));
|
|
57
68
|
app.get('/api/yuri/assistants/:assistantID/messages', (req, res) => respond(res, () => service.historicalMessages(req.params.assistantID, req.query)));
|
|
58
69
|
app.get('/api/yuri/assistants/:assistantID/contact/messages', (req, res) => respond(res, () => service.contactMessages(req.params.assistantID, req.query)));
|
|
@@ -109,5 +120,16 @@ export const registerAssistantRoutes = (app, dependencies) => {
|
|
|
109
120
|
// Contact send admits the user message at 202; assistant bubbles stream on SSE.
|
|
110
121
|
app.post('/api/yuri/assistants/:assistantID/messages', (req, res) => respond(res, () => service.send(req.params.assistantID, req.body), 202)); app.post('/api/yuri/assistants/:assistantID/share', (req, res) => respond(res, () => service.share(req.params.assistantID, req.body), 202)); app.get('/api/yuri/assistants/share-operations/:operationID', (req, res) => respond(res, () => { const operation = service.shareOperation(req.params.operationID); if (!operation) throw new AssistantError('not_found'); return operation; }));
|
|
111
122
|
app.use('/api/yuri/assistants/topics', gone); app.use('/api/yuri/assistants/:assistantID/topics', gone);
|
|
112
|
-
|
|
123
|
+
weixin = createWeixinRuntime({
|
|
124
|
+
directory: path.join(dependencies.yuriDataDir, 'weixin'), service,
|
|
125
|
+
refreshAllowedRoots: dependencies.refreshAllowedRoots,
|
|
126
|
+
...(dependencies.weixinAPI ? { api: dependencies.weixinAPI } : {}),
|
|
127
|
+
});
|
|
128
|
+
registerWeixinRoutes(app, weixin);
|
|
129
|
+
return { service, close: async () => {
|
|
130
|
+
unsubscribeTaskResults?.();
|
|
131
|
+
setAssignedSessionSettleHandler(null);
|
|
132
|
+
await weixin.close();
|
|
133
|
+
service.close();
|
|
134
|
+
} };
|
|
113
135
|
};
|
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
migrateContactReadStateDefaultRead,
|
|
36
36
|
nextContactOrdinal,
|
|
37
37
|
projectActiveContactTurn,
|
|
38
|
+
readContactChannelPage,
|
|
38
39
|
resetContactReadWatermarkForGeneration,
|
|
39
40
|
updateSessionCardStatus,
|
|
40
41
|
upsertContactWatch,
|
|
@@ -88,7 +89,7 @@ import { buildAssistantSessionMetadata } from '../session-metadata/system-sessio
|
|
|
88
89
|
import { completionEvent, createFamilyCompletionGate, readSessionFamilyActivity } from '../notifications/family-completion-gate.js';
|
|
89
90
|
|
|
90
91
|
const require = createRequire(import.meta.url);
|
|
91
|
-
const SCHEMA_VERSION =
|
|
92
|
+
const SCHEMA_VERSION = 16;
|
|
92
93
|
const normalizeSessionDirectory = (value) => {
|
|
93
94
|
if (typeof value !== 'string') return null;
|
|
94
95
|
const trimmed = value.trim();
|
|
@@ -412,6 +413,7 @@ export const createAssistantsService = ({ dbPath, dataDir, buildOpenCodeUrl, get
|
|
|
412
413
|
name: row.name,
|
|
413
414
|
defaultPrompt: row.default_prompt,
|
|
414
415
|
avatarSeed: row.avatar_seed ?? row.assistant_id,
|
|
416
|
+
pinnedAt: row.pinned_at ?? null,
|
|
415
417
|
workspacePath: row.workspace_path,
|
|
416
418
|
managedWorkspacePath: workspace(null, row.assistant_id, true),
|
|
417
419
|
effectiveWorkspacePath: effectiveWorkspace(row),
|
|
@@ -507,11 +509,13 @@ export const createAssistantsService = ({ dbPath, dataDir, buildOpenCodeUrl, get
|
|
|
507
509
|
if (!validAssistantDeliveryParts(parts, { allowAttachmentRefs: true })) fail('validation_error');
|
|
508
510
|
};
|
|
509
511
|
const migrate = () => {
|
|
510
|
-
|
|
512
|
+
const previousVersion = Number(db.prepare("SELECT value FROM assistant_meta WHERE key='schema_version'").get()?.value ?? 0);
|
|
513
|
+
if (previousVersion === SCHEMA_VERSION) return;
|
|
511
514
|
const v2Info = db.prepare("SELECT name,\"notnull\" AS required FROM pragma_table_info('assistant_v2')").all(); const v2Columns = new Set(v2Info.map((column) => column.name));
|
|
512
515
|
if (v2Columns.has('skill_roots') || v2Info.some((column) => column.name === 'workspace_path' && column.required)) db.exec(`CREATE TABLE assistant_v2_next (assistant_id TEXT PRIMARY KEY, revision INTEGER NOT NULL, enabled INTEGER NOT NULL, name TEXT NOT NULL, default_prompt TEXT NOT NULL, workspace_path TEXT, provider_id TEXT NOT NULL, model_id TEXT NOT NULL, agent TEXT, variant TEXT, current_session_id TEXT, session_generation INTEGER NOT NULL DEFAULT 0, created_at INTEGER NOT NULL, updated_at INTEGER NOT NULL, tombstone_at INTEGER); INSERT INTO assistant_v2_next (assistant_id,revision,enabled,name,default_prompt,workspace_path,provider_id,model_id,agent,variant,current_session_id,session_generation,created_at,updated_at,tombstone_at) SELECT assistant_id,revision,enabled,name,default_prompt,workspace_path,provider_id,model_id,agent,NULL,current_session_id,session_generation,created_at,updated_at,tombstone_at FROM assistant_v2; DROP TABLE assistant_v2; ALTER TABLE assistant_v2_next RENAME TO assistant_v2;`);
|
|
513
516
|
if (!new Set(db.prepare("SELECT name FROM pragma_table_info('assistant_v2')").all().map((column) => column.name)).has('variant')) db.exec('ALTER TABLE assistant_v2 ADD COLUMN variant TEXT');
|
|
514
517
|
if (!new Set(db.prepare("SELECT name FROM pragma_table_info('assistant_v2')").all().map((column) => column.name)).has('avatar_seed')) db.exec('ALTER TABLE assistant_v2 ADD COLUMN avatar_seed TEXT');
|
|
518
|
+
if (!new Set(db.prepare("SELECT name FROM pragma_table_info('assistant_v2')").all().map((column) => column.name)).has('pinned_at')) db.exec('ALTER TABLE assistant_v2 ADD COLUMN pinned_at INTEGER');
|
|
515
519
|
if (!new Set(db.prepare("SELECT name FROM pragma_table_info('assistant_v2')").all().map((column) => column.name)).has('mode')) db.exec("ALTER TABLE assistant_v2 ADD COLUMN mode TEXT NOT NULL DEFAULT 'continuous'");
|
|
516
520
|
const managedConfig = (workspacePath, assistantID) => workspacePath != null && path.resolve(workspacePath) === workspaceFor(assistantID) ? null : workspacePath;
|
|
517
521
|
const legacy = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='assistant'").get();
|
|
@@ -519,11 +523,19 @@ export const createAssistantsService = ({ dbPath, dataDir, buildOpenCodeUrl, get
|
|
|
519
523
|
for (const row of db.prepare('SELECT assistant_id,workspace_path FROM assistant_v2 WHERE workspace_path IS NOT NULL').all()) { const workspacePath = managedConfig(row.workspace_path, row.assistant_id); if (workspacePath === null) db.prepare('UPDATE assistant_v2 SET workspace_path=NULL WHERE assistant_id=?').run(row.assistant_id); }
|
|
520
524
|
// v13: shared contact read watermark. Legacy transcripts default to fully read
|
|
521
525
|
// so existing installs do not flash unread on upgrade; later messages count.
|
|
522
|
-
migrateContactReadStateDefaultRead(db, { updatedAt: now() });
|
|
523
|
-
db.
|
|
526
|
+
if (previousVersion < 13) migrateContactReadStateDefaultRead(db, { updatedAt: now() });
|
|
527
|
+
db.transaction(() => {
|
|
528
|
+
const pinned = db.prepare('SELECT assistant_id FROM assistant_v2 WHERE pinned_at IS NOT NULL AND tombstone_at IS NULL ORDER BY pinned_at DESC, created_at, rowid LIMIT 1').get();
|
|
529
|
+
if (pinned) {
|
|
530
|
+
const cleared = db.prepare('UPDATE assistant_v2 SET pinned_at=NULL,revision=revision+1,updated_at=? WHERE pinned_at IS NOT NULL AND tombstone_at IS NULL AND assistant_id!=?').run(now(), pinned.assistant_id);
|
|
531
|
+
if (cleared.changes) bump();
|
|
532
|
+
}
|
|
533
|
+
db.exec('CREATE UNIQUE INDEX IF NOT EXISTS assistant_single_pin ON assistant_v2 ((1)) WHERE pinned_at IS NOT NULL AND tombstone_at IS NULL');
|
|
534
|
+
db.prepare("INSERT OR REPLACE INTO assistant_meta(key,value) VALUES ('schema_version',?)").run(String(SCHEMA_VERSION));
|
|
535
|
+
})();
|
|
524
536
|
};
|
|
525
|
-
migrate();
|
|
526
537
|
try {
|
|
538
|
+
migrate();
|
|
527
539
|
db.transaction(() => {
|
|
528
540
|
const restored = db.prepare('UPDATE assistant_v2 SET enabled=1, revision=revision+1, updated_at=? WHERE enabled!=1 AND tombstone_at IS NULL').run(now());
|
|
529
541
|
if (restored.changes) bump();
|
|
@@ -1486,10 +1498,12 @@ export const createAssistantsService = ({ dbPath, dataDir, buildOpenCodeUrl, get
|
|
|
1486
1498
|
};
|
|
1487
1499
|
const updateAssistant = async (assistantID, input) => {
|
|
1488
1500
|
const row = editable(assistantID);
|
|
1489
|
-
const allowed = new Set(['expectedRevision', 'enabled', 'name', 'avatarSeed', 'defaultPrompt', 'providerID', 'modelID', 'agent', 'variant', 'mode', 'workspacePath']);
|
|
1501
|
+
const allowed = new Set(['expectedRevision', 'enabled', 'name', 'avatarSeed', 'pinned', 'defaultPrompt', 'providerID', 'modelID', 'agent', 'variant', 'mode', 'workspacePath']);
|
|
1490
1502
|
if (!plainObject(input) || !Number.isInteger(input.expectedRevision) || Object.keys(input).some((key) => !allowed.has(key))) fail('validation_error');
|
|
1503
|
+
if (input.pinned !== undefined && typeof input.pinned !== 'boolean') fail('validation_error');
|
|
1491
1504
|
const next = {
|
|
1492
1505
|
avatarSeed: input.avatarSeed === undefined ? row.avatar_seed : string(input.avatarSeed, 256, true),
|
|
1506
|
+
pinnedAt: input.pinned === undefined ? row.pinned_at : input.pinned ? (row.pinned_at ?? now()) : null,
|
|
1493
1507
|
name: input.name === undefined ? row.name : string(input.name, 256, true),
|
|
1494
1508
|
prompt: input.defaultPrompt === undefined ? row.default_prompt : string(input.defaultPrompt, 200_000),
|
|
1495
1509
|
provider: input.providerID === undefined ? row.provider_id : string(input.providerID, 256, true),
|
|
@@ -1506,7 +1520,10 @@ export const createAssistantsService = ({ dbPath, dataDir, buildOpenCodeUrl, get
|
|
|
1506
1520
|
const created = workspaceChanged ? await createSession(nextRow) : null;
|
|
1507
1521
|
try {
|
|
1508
1522
|
db.transaction(() => {
|
|
1509
|
-
|
|
1523
|
+
if (input.pinned === true) {
|
|
1524
|
+
db.prepare('UPDATE assistant_v2 SET pinned_at=NULL,revision=revision+1,updated_at=? WHERE assistant_id!=? AND pinned_at IS NOT NULL AND tombstone_at IS NULL').run(now(), assistantID);
|
|
1525
|
+
}
|
|
1526
|
+
const result = db.prepare('UPDATE assistant_v2 SET avatar_seed=?,pinned_at=?,enabled=1,name=?,default_prompt=?,provider_id=?,model_id=?,agent=?,variant=?,mode=?,workspace_path=?,current_session_id=?,session_generation=session_generation+?,revision=revision+1,updated_at=? WHERE assistant_id=? AND revision=? AND session_generation=? AND tombstone_at IS NULL').run(next.avatarSeed, next.pinnedAt, next.name, next.prompt, next.provider, next.model, next.agent, next.variant, next.mode, next.workspacePath, created?.sessionID ?? row.current_session_id, workspaceChanged ? 1 : 0, now(), assistantID, input.expectedRevision, row.session_generation);
|
|
1510
1527
|
if (!result.changes) fail('revision_conflict');
|
|
1511
1528
|
if (workspaceChanged && row.current_session_id) archiveSession(assistantID, row.current_session_id, effectiveWorkspace(row));
|
|
1512
1529
|
bump();
|
|
@@ -4086,7 +4103,12 @@ export const createAssistantsService = ({ dbPath, dataDir, buildOpenCodeUrl, get
|
|
|
4086
4103
|
throw error;
|
|
4087
4104
|
}
|
|
4088
4105
|
};
|
|
4089
|
-
|
|
4106
|
+
// Internal Host seam only: no credentials, no OpenCode session projection.
|
|
4107
|
+
const channelPage = (assistantID, options) => {
|
|
4108
|
+
active(assistantID);
|
|
4109
|
+
return readContactChannelPage(db, assistantID, options);
|
|
4110
|
+
};
|
|
4111
|
+
return { capability: async () => ({ supported: true, enabled: enabled(), revision: revision(), serverInstanceID: await getServerId(), sharingAvailable: false, archiveMetadataAvailable: typeof archiveSessionHost === 'function', sessionMetadataAvailable: false }), snapshot, channelPage, ensureDefaultAssistant, createAssistant, updateAssistant, setEnabled: (input) => { if (!plainObject(input) || typeof input.enabled !== 'boolean' || input.expectedRevision !== revision()) fail('revision_conflict'); return { enabled: true, revision: revision() }; }, removeAssistant, ensure, createNew, compact, send, whenContactTurnSettled, abort, captureQueueDeliveryTarget, sendWithCapturedConfig, share, shareOperation, historicalMessages, contactMessages, clearContactMemory, resetContact, markContactRead, appendContactCard, deliverPeerMessage, listAssistantScheduledTasks, reportScheduledTaskResult, putAssistantContactAttachment, getAssistantContactAttachment, migrateContactAttachments, processEvent, reportAssignedSessionSettle: reportAssignedSession, reconcile, close: () => {
|
|
4090
4112
|
assignedCompletion.dispose();
|
|
4091
4113
|
cancelAssignedResumes({});
|
|
4092
4114
|
sessionAbortInflight.clear();
|
|
@@ -123,6 +123,157 @@ const toolBatch = (calls, content = '') => ({ completion: { choices: [{ message:
|
|
|
123
123
|
const sayThen = (text, name, args) => toolBatch([['notify_user', { text }], [name, args]]);
|
|
124
124
|
|
|
125
125
|
describe('assistants service', () => {
|
|
126
|
+
it('persists pins across clients and restarts without changing catalog, session or share-default order', async () => {
|
|
127
|
+
const directory = root();
|
|
128
|
+
const create = vi.fn();
|
|
129
|
+
let at = 100;
|
|
130
|
+
let service = setup(directory, { create }, { clock: () => at });
|
|
131
|
+
let peer;
|
|
132
|
+
try {
|
|
133
|
+
const first = service.createAssistant(assistantInput);
|
|
134
|
+
const second = service.createAssistant({ ...assistantInput, name: 'B' });
|
|
135
|
+
expect(first.pinnedAt).toBeNull();
|
|
136
|
+
const pinned = await service.updateAssistant(second.id, { expectedRevision: second.revision, pinned: true });
|
|
137
|
+
expect(pinned).toMatchObject({ pinnedAt: 100, sessionID: second.sessionID, sessionGeneration: second.sessionGeneration, avatarSeed: second.avatarSeed });
|
|
138
|
+
at = 200;
|
|
139
|
+
const renamed = await service.updateAssistant(second.id, { expectedRevision: pinned.revision, name: 'Renamed' });
|
|
140
|
+
const repinned = await service.updateAssistant(second.id, { expectedRevision: renamed.revision, pinned: true });
|
|
141
|
+
expect(repinned.pinnedAt).toBe(100);
|
|
142
|
+
expect(service.snapshot().assistants.map(item => item.id)).toEqual([first.id, second.id]);
|
|
143
|
+
peer = setup(directory);
|
|
144
|
+
expect(peer.snapshot().assistants.find(item => item.id === second.id).pinnedAt).toBe(100);
|
|
145
|
+
peer.close(); peer = null;
|
|
146
|
+
service.close(); service = setup(directory);
|
|
147
|
+
const restored = service.snapshot().assistants.find(item => item.id === second.id);
|
|
148
|
+
expect(restored.pinnedAt).toBe(100);
|
|
149
|
+
const unpinned = await service.updateAssistant(second.id, { expectedRevision: restored.revision, pinned: false });
|
|
150
|
+
expect(unpinned.pinnedAt).toBeNull();
|
|
151
|
+
expect(create).not.toHaveBeenCalled();
|
|
152
|
+
} finally {
|
|
153
|
+
peer?.close(); service.close(); fs.rmSync(directory, { recursive: true, force: true });
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
it('rejects invalid pins and stale revisions, and rolls back pin changes when storage fails', async () => {
|
|
157
|
+
const directory = root();
|
|
158
|
+
const service = setup(directory);
|
|
159
|
+
const db = new (require('better-sqlite3'))(path.join(directory, 'assistants.sqlite'));
|
|
160
|
+
try {
|
|
161
|
+
const created = service.createAssistant(assistantInput);
|
|
162
|
+
const before = service.snapshot();
|
|
163
|
+
for (const pinned of [null, 1, 'true', {}]) {
|
|
164
|
+
await expect(service.updateAssistant(created.id, { expectedRevision: created.revision, pinned })).rejects.toThrow('validation_error');
|
|
165
|
+
}
|
|
166
|
+
await expect(service.updateAssistant(created.id, { expectedRevision: 999, pinned: true })).rejects.toThrow('revision_conflict');
|
|
167
|
+
db.exec("CREATE TRIGGER reject_pin BEFORE UPDATE OF pinned_at ON assistant_v2 BEGIN SELECT RAISE(ABORT, 'pin write failed'); END");
|
|
168
|
+
await expect(service.updateAssistant(created.id, { expectedRevision: created.revision, pinned: true })).rejects.toThrow('pin write failed');
|
|
169
|
+
expect(service.snapshot()).toEqual(before);
|
|
170
|
+
db.exec('DROP TRIGGER reject_pin');
|
|
171
|
+
const pinned = await service.updateAssistant(created.id, { expectedRevision: created.revision, pinned: true });
|
|
172
|
+
service.removeAssistant(created.id, pinned.revision);
|
|
173
|
+
expect(service.snapshot().assistants).toEqual([]);
|
|
174
|
+
} finally {
|
|
175
|
+
db.close(); service.close(); fs.rmSync(directory, { recursive: true, force: true });
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
it('upgrades existing schema-v14 contacts as unpinned without losing identity or history', () => {
|
|
179
|
+
const directory = root();
|
|
180
|
+
let service = setup(directory);
|
|
181
|
+
try {
|
|
182
|
+
const created = service.createAssistant(assistantInput);
|
|
183
|
+
const messages = service.contactMessages(created.id).messages;
|
|
184
|
+
service.close();
|
|
185
|
+
const db = new (require('better-sqlite3'))(path.join(directory, 'assistants.sqlite'));
|
|
186
|
+
db.exec('DROP INDEX IF EXISTS assistant_single_pin');
|
|
187
|
+
db.exec('ALTER TABLE assistant_v2 DROP COLUMN pinned_at');
|
|
188
|
+
db.prepare("UPDATE assistant_meta SET value='14' WHERE key='schema_version'").run();
|
|
189
|
+
db.close();
|
|
190
|
+
service = setup(directory);
|
|
191
|
+
expect(service.snapshot().assistants[0]).toEqual(created);
|
|
192
|
+
expect(service.contactMessages(created.id).messages).toEqual(messages);
|
|
193
|
+
} finally {
|
|
194
|
+
service.close(); fs.rmSync(directory, { recursive: true, force: true });
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
it('atomically replaces the pinned Bot across clients and rejects stale edits to the previous owner', async () => {
|
|
198
|
+
const directory = root();
|
|
199
|
+
const service = setup(directory);
|
|
200
|
+
const peer = setup(directory);
|
|
201
|
+
try {
|
|
202
|
+
const first = service.createAssistant(assistantInput);
|
|
203
|
+
const second = service.createAssistant({ ...assistantInput, name: 'B' });
|
|
204
|
+
const before = service.snapshot();
|
|
205
|
+
const old = await service.updateAssistant(first.id, { expectedRevision: first.revision, pinned: true });
|
|
206
|
+
await peer.updateAssistant(second.id, { expectedRevision: second.revision, pinned: true });
|
|
207
|
+
const after = service.snapshot();
|
|
208
|
+
expect(after.assistants.filter(item => item.pinnedAt !== null).map(item => item.id)).toEqual([second.id]);
|
|
209
|
+
expect(after.assistants[0]).toMatchObject({ pinnedAt: null, revision: old.revision + 1, unreadCount: first.unreadCount, readWatermark: first.readWatermark });
|
|
210
|
+
expect(after.assistants.map(item => item.id)).toEqual(before.assistants.map(item => item.id));
|
|
211
|
+
await expect(service.updateAssistant(first.id, { expectedRevision: old.revision, pinned: true })).rejects.toThrow('revision_conflict');
|
|
212
|
+
expect(service.snapshot()).toEqual(after);
|
|
213
|
+
} finally { peer.close(); service.close(); fs.rmSync(directory, { recursive: true, force: true }); }
|
|
214
|
+
});
|
|
215
|
+
it('rolls back clearing the old pin when writing the replacement fails', async () => {
|
|
216
|
+
const directory = root();
|
|
217
|
+
const service = setup(directory);
|
|
218
|
+
const db = new (require('better-sqlite3'))(path.join(directory, 'assistants.sqlite'));
|
|
219
|
+
try {
|
|
220
|
+
const first = service.createAssistant(assistantInput);
|
|
221
|
+
const second = service.createAssistant({ ...assistantInput, name: 'B' });
|
|
222
|
+
await service.updateAssistant(first.id, { expectedRevision: first.revision, pinned: true });
|
|
223
|
+
const before = service.snapshot();
|
|
224
|
+
db.exec("CREATE TRIGGER reject_replacement BEFORE UPDATE OF pinned_at ON assistant_v2 WHEN NEW.pinned_at IS NOT NULL BEGIN SELECT RAISE(ABORT, 'replacement failed'); END");
|
|
225
|
+
await expect(service.updateAssistant(second.id, { expectedRevision: second.revision, pinned: true })).rejects.toThrow('replacement failed');
|
|
226
|
+
expect(service.snapshot()).toEqual(before);
|
|
227
|
+
db.exec('DROP TRIGGER reject_replacement');
|
|
228
|
+
await service.updateAssistant(second.id, { expectedRevision: second.revision, pinned: true });
|
|
229
|
+
expect(service.snapshot().assistants.filter(item => item.pinnedAt !== null).map(item => item.id)).toEqual([second.id]);
|
|
230
|
+
} finally { db.close(); service.close(); fs.rmSync(directory, { recursive: true, force: true }); }
|
|
231
|
+
});
|
|
232
|
+
it('keeps a single pin under competing client writes and a database constraint rejects bypasses', async () => {
|
|
233
|
+
const directory = root();
|
|
234
|
+
const service = setup(directory);
|
|
235
|
+
const peer = setup(directory);
|
|
236
|
+
const db = new (require('better-sqlite3'))(path.join(directory, 'assistants.sqlite'));
|
|
237
|
+
try {
|
|
238
|
+
const first = service.createAssistant(assistantInput);
|
|
239
|
+
const second = service.createAssistant({ ...assistantInput, name: 'B' });
|
|
240
|
+
await Promise.all([
|
|
241
|
+
service.updateAssistant(first.id, { expectedRevision: first.revision, pinned: true }),
|
|
242
|
+
peer.updateAssistant(second.id, { expectedRevision: second.revision, pinned: true }),
|
|
243
|
+
]);
|
|
244
|
+
const snapshot = service.snapshot();
|
|
245
|
+
expect(snapshot.assistants.filter(item => item.pinnedAt !== null)).toHaveLength(1);
|
|
246
|
+
const unpinned = snapshot.assistants.find(item => item.pinnedAt === null);
|
|
247
|
+
expect(() => db.prepare('UPDATE assistant_v2 SET pinned_at=123 WHERE assistant_id=?').run(unpinned.id)).toThrow();
|
|
248
|
+
expect(service.snapshot()).toEqual(snapshot);
|
|
249
|
+
} finally { db.close(); peer.close(); service.close(); fs.rmSync(directory, { recursive: true, force: true }); }
|
|
250
|
+
});
|
|
251
|
+
it('migrates multiple v15 pins to the latest one, preserves unread and retries a failed migration atomically', async () => {
|
|
252
|
+
const directory = root();
|
|
253
|
+
let service = setup(directory);
|
|
254
|
+
const first = service.createAssistant(assistantInput);
|
|
255
|
+
const second = service.createAssistant({ ...assistantInput, name: 'B' });
|
|
256
|
+
service.close();
|
|
257
|
+
const db = new (require('better-sqlite3'))(path.join(directory, 'assistants.sqlite'));
|
|
258
|
+
try {
|
|
259
|
+
db.exec('DROP INDEX assistant_single_pin');
|
|
260
|
+
db.prepare('UPDATE assistant_v2 SET pinned_at=? WHERE assistant_id=?').run(10, first.id);
|
|
261
|
+
db.prepare('UPDATE assistant_v2 SET pinned_at=? WHERE assistant_id=?').run(20, second.id);
|
|
262
|
+
db.prepare("UPDATE assistant_meta SET value='15' WHERE key='schema_version'").run();
|
|
263
|
+
db.exec("CREATE TRIGGER reject_pin_migration BEFORE UPDATE OF pinned_at ON assistant_v2 BEGIN SELECT RAISE(ABORT, 'pin migration failed'); END");
|
|
264
|
+
expect(() => setup(directory)).toThrow('pin migration failed');
|
|
265
|
+
expect(db.prepare("SELECT value FROM assistant_meta WHERE key='schema_version'").get().value).toBe('15');
|
|
266
|
+
expect(db.prepare('SELECT COUNT(*) AS count FROM assistant_v2 WHERE pinned_at IS NOT NULL').get().count).toBe(2);
|
|
267
|
+
db.exec('DROP TRIGGER reject_pin_migration');
|
|
268
|
+
service = setup(directory);
|
|
269
|
+
const snapshot = service.snapshot();
|
|
270
|
+
expect(snapshot.assistants.filter(item => item.pinnedAt !== null).map(item => item.id)).toEqual([second.id]);
|
|
271
|
+
expect(snapshot.assistants[0]).toMatchObject({ pinnedAt: null, revision: first.revision + 1, unreadCount: first.unreadCount, readWatermark: first.readWatermark });
|
|
272
|
+
expect(snapshot.assistants[1]).toMatchObject({ pinnedAt: 20, revision: second.revision, unreadCount: second.unreadCount });
|
|
273
|
+
service.close(); service = setup(directory);
|
|
274
|
+
expect(service.snapshot()).toEqual(snapshot);
|
|
275
|
+
} finally { db.close(); service.close(); fs.rmSync(directory, { recursive: true, force: true }); }
|
|
276
|
+
});
|
|
126
277
|
it.each([
|
|
127
278
|
['en', "Hi, I'm A. How can I help you?"],
|
|
128
279
|
['zh-CN', '你好,我是A,有什么可以帮你的吗?'],
|