@yuriai/web 0.2.27-beta.3 → 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.
Files changed (148) hide show
  1. package/README.md +9 -0
  2. package/dist/assets/{AgentAvatar-kIN4sZMz.js → AgentAvatar-Bi1vvWPC.js} +1 -1
  3. package/dist/assets/AssistantContactStatus-CWq-PDz6.js +3 -0
  4. package/dist/assets/AssistantUnreadBadge-DdJyySwn.js +1 -0
  5. package/dist/assets/AssistantView-Br1iETTs.js +1 -0
  6. package/dist/assets/{DiagramView-DK0iXm9b.js → DiagramView-CI4bTtxy.js} +1 -1
  7. package/dist/assets/{FadeInOnReveal-BJA9Za3T.js → FadeInOnReveal-BB4qEnAn.js} +1 -1
  8. package/dist/assets/GuiPluginSurface-CguxFUbM.js +1 -0
  9. package/dist/assets/{GuiPluginWindow-l4FYY6S-.js → GuiPluginWindow-DOJ7wuRH.js} +1 -1
  10. package/dist/assets/Icon-t2xvbAyN.js +1 -0
  11. package/dist/assets/{ImageLoadingPlaceholder-DCWssLJG.js → ImageLoadingPlaceholder-D1L13TK0.js} +1 -1
  12. package/dist/assets/{LoadingImage-C_Hryaqe.js → LoadingImage-5rY_edNm.js} +1 -1
  13. package/dist/assets/{MarkdownRenderer-Y6uQXIFH.js → MarkdownRenderer-BlGxjOei.js} +2 -2
  14. package/dist/assets/{MarkdownRendererImpl-qKp1tQrP.js → MarkdownRendererImpl-cE-0AYRg.js} +1 -1
  15. package/dist/assets/{MarkstreamRendererImpl-B_JTod0h.js → MarkstreamRendererImpl-BZyqDl82.js} +1 -1
  16. package/dist/assets/MobileDetailNavigation-tbfsMfB-.js +1 -0
  17. package/dist/assets/{MobileResizableSheet-F1zSUD1S.js → MobileResizableSheet-BeRmT6_x.js} +1 -1
  18. package/dist/assets/{MobileShareBridge-F70fkIfS.js → MobileShareBridge-C3Equ3P_.js} +2 -2
  19. package/dist/assets/MobileTabPageHeader-DQRqAAEf.js +2 -0
  20. package/dist/assets/{MultiRunWindow-D8m6R_4x.js → MultiRunWindow-CAM2XPII.js} +1 -1
  21. package/dist/assets/{OnboardingScreen-BAsPVV_W.js → OnboardingScreen-4ftRerP5.js} +1 -1
  22. package/dist/assets/{OverlayScrollbar-wiRM4AGj.js → OverlayScrollbar-CF0PCvQz.js} +1 -1
  23. package/dist/assets/{SettingsView-izzjIckv.js → SettingsView-2tk4WH7R.js} +13 -13
  24. package/dist/assets/{SettingsWindow-CSuHDq_c.js → SettingsWindow-B9zbeJaW.js} +1 -1
  25. package/dist/assets/TerminalView-DfxvTHye.js +8 -0
  26. package/dist/assets/{ToolOutputDialog-DJs9w1_J.js → ToolOutputDialog-CrjDIhru.js} +1 -1
  27. package/dist/assets/{YuriLogo-aBS6wlYU.js → YuriLogo-QvS1ZEHi.js} +1 -1
  28. package/dist/assets/{appThemeRegistry-BY5rY9-W.js → appThemeRegistry-Bb_DtiV9.js} +1 -1
  29. package/dist/assets/{button-Dt6Ygbc7.js → button-DinGM3tu.js} +1 -1
  30. package/dist/assets/{capgoAdapter-MQ1qpf60.js → capgoAdapter-DufzjXRs.js} +1 -1
  31. package/dist/assets/{collapsible-Dm7OHk7m.js → collapsible-Bh1GLNYV.js} +1 -1
  32. package/dist/assets/context-menu-DpbkRkk1.js +1 -0
  33. package/dist/assets/{diagram-DWZaG3_v.js → diagram-BmG-7Jb4.js} +1 -1
  34. package/dist/assets/{dialog-CjQeHVOc.js → dialog-BXssfGXA.js} +1 -1
  35. package/dist/assets/es-HP_Ise0X.js +15 -0
  36. package/dist/assets/{fileMentionTouchSelection-D7QtVxjI.js → fileMentionTouchSelection-DSl0tj2r.js} +1 -1
  37. package/dist/assets/{fileReferenceActions-BAoEu4z8.js → fileReferenceActions-CGpBSFq4.js} +1 -1
  38. package/dist/assets/fr-D0kJXJ6U.js +13 -0
  39. package/dist/assets/gitApi-Wo0IZow9.js +370 -0
  40. package/dist/assets/{gitApiHttp-DHrRqnYh.js → gitApiHttp-De9liKnG.js} +4 -4
  41. package/dist/assets/host-FR_grJxM.js +1 -0
  42. package/dist/assets/{input-Dq4usRDa.js → input-v8-rVbo-.js} +1 -1
  43. package/dist/assets/insertionBoundaries-CZz7TWJv.js +1 -0
  44. package/dist/assets/ja-BjHKXazE.js +15 -0
  45. package/dist/assets/ko-Llwnl876.js +15 -0
  46. package/dist/assets/main-Bp9HHqTr.js +2 -0
  47. package/dist/assets/main-DOwAfmxJ.js +169 -0
  48. package/dist/assets/{markdownHeightCache-C1u0bWDL.js → markdownHeightCache-BVV2dktw.js} +1 -1
  49. package/dist/assets/{mcpQueries-D2IxTr4k.js → mcpQueries-BoBrB4a4.js} +1 -1
  50. package/dist/assets/miniChat-BJDgCrfF.js +2 -0
  51. package/dist/assets/mobile-GM9931J_.js +2 -0
  52. package/dist/assets/{mobileBackNavigation-vpCg1S7j.js → mobileBackNavigation-DMSzAvb6.js} +1 -1
  53. package/dist/assets/{multirun-DT-dFXud.js → multirun-BhWttsRQ.js} +1 -1
  54. package/dist/assets/{native-De1DIkLZ.js → native-DSvNnKAm.js} +1 -1
  55. package/dist/assets/{native-config-ncdoz9Wl.js → native-config-DjdrW_9n.js} +1 -1
  56. package/dist/assets/{persistence-JyLTFv27.js → persistence-CfrHIiIS.js} +1 -1
  57. package/dist/assets/pl-BOd_idqn.js +15 -0
  58. package/dist/assets/{projectMeta-CG8NLahh.js → projectMeta-31PobC-M.js} +1 -1
  59. package/dist/assets/pt-BR-B8djxMsl.js +15 -0
  60. package/dist/assets/react-B9v0P7kT.js +1 -0
  61. package/dist/assets/{readiness-DSJs_3v4.js → readiness-CYNnsekT.js} +1 -1
  62. package/dist/assets/renderElectronMiniChatApp-N2r999Bf.js +2 -0
  63. package/dist/assets/renderMobileApp-CU1ec6Ak.js +28 -0
  64. package/dist/assets/{runtimeConfig-CZrflo-r.js → runtimeConfig-Db7yfo6L.js} +1 -1
  65. package/dist/assets/runtimeEndpointReset-DO5WVetV.js +149 -0
  66. package/dist/assets/scheduledTaskNavigation-Bsrhv3Ow.js +1 -0
  67. package/dist/assets/sessionLookup-DRVy7LM1.js +1 -0
  68. package/dist/assets/sortable-tabs-strip-yKyqsqut.js +1 -0
  69. package/dist/assets/speechSettingsQueries-DU25rmGc.js +4 -0
  70. package/dist/assets/src-Bckdo2XS.css +2 -0
  71. package/dist/assets/store-CUBymvAC.js +15 -0
  72. package/dist/assets/{terminalApi-B5o8UqWA.js → terminalApi-BblSkqch.js} +1 -1
  73. package/dist/assets/{textarea-vtIQM2iP.js → textarea-B39OCNPV.js} +1 -1
  74. package/dist/assets/{tooltip-BpG2mxrT.js → tooltip-d8TNN4lx.js} +1 -1
  75. package/dist/assets/{types-CNTgeeM1.js → types-BqFQhQTt.js} +1 -1
  76. package/dist/assets/{uk-B_JwElWz.js → uk-BNd7CjVO.js} +4 -4
  77. package/dist/assets/{useAppFontEffects-BguV1Hfa.js → useAppFontEffects-BVoVpJYO.js} +57 -55
  78. package/dist/assets/{useAssistantUIStore-C9FPlYQz.js → useAssistantUIStore-Bp6TxG5E.js} +1 -1
  79. package/dist/assets/useDesktopWindowControlsLayout-CYx1LNO5.js +1 -0
  80. package/dist/assets/{useEffectiveDirectory-Ci6Z13kj.js → useEffectiveDirectory-D8FFE5Yn.js} +1 -1
  81. package/dist/assets/{useFontPreferences-DMiP_Yy-.js → useFontPreferences-BFyBjtQ6.js} +1 -1
  82. package/dist/assets/useMobileNavigationStore-BHMFeMjo.js +23 -0
  83. package/dist/assets/useUIStore-BbYD420L.js +1 -0
  84. package/dist/assets/{useWorkerHighlightedLines-HKhuYGSj.js → useWorkerHighlightedLines-CPxG8Fya.js} +1 -1
  85. package/dist/assets/{vendor-codemirror-search-ZqtrPLjU.js → vendor-codemirror-search-DiPwvA-6.js} +2 -2
  86. package/dist/assets/{vendor-opencode-plugin-Bw7Q6Nv9.js → vendor-opencode-plugin-CgKz9Hcy.js} +1 -1
  87. package/dist/assets/{vendor-replit-codemirror-vim-DDj0dSVY.js → vendor-replit-codemirror-vim-DCdAdxvE.js} +3 -3
  88. package/dist/assets/zh-CN-BkTAEOZG.js +15 -0
  89. package/dist/assets/zh-TW-x8SfMzfc.js +15 -0
  90. package/dist/index.html +10 -10
  91. package/dist/mini-chat.html +10 -10
  92. package/dist/mobile.html +10 -10
  93. package/package.json +3 -3
  94. package/server/lib/assistants/DOCUMENTATION.md +20 -0
  95. package/server/lib/assistants/contracts.js +1 -0
  96. package/server/lib/assistants/service.js +23 -7
  97. package/server/lib/assistants/service.test.js +151 -0
  98. package/server/lib/assistants/weixin/DOCUMENTATION.md +58 -1
  99. package/server/lib/assistants/weixin/routes.js +4 -3
  100. package/server/lib/assistants/weixin/routes.test.js +30 -0
  101. package/server/lib/assistants/weixin/runtime.js +77 -8
  102. package/server/lib/assistants/weixin/runtime.test.js +216 -2
  103. package/server/lib/assistants/weixin/store.js +13 -0
  104. package/server/lib/opencode/DOCUMENTATION.md +2 -1
  105. package/server/lib/opencode/npm-registry.js +7 -21
  106. package/server/lib/opencode/npm-registry.test.js +36 -5
  107. package/server/lib/opencode/plugin-icon.d.ts +2 -0
  108. package/server/lib/opencode/plugin-icon.js +43 -0
  109. package/server/lib/opencode/plugin-icon.test.js +41 -0
  110. package/server/lib/opencode/plugin-routes.js +3 -1
  111. package/server/lib/opencode/plugin-routes.test.js +13 -0
  112. package/dist/assets/AssistantView-C2KQZ6a4.js +0 -3
  113. package/dist/assets/GuiPluginSurface-Dz2CdSUA.js +0 -1
  114. package/dist/assets/Icon-BP1sfnHn.js +0 -1
  115. package/dist/assets/MobileDetailNavigation-B3rUx5Ve.js +0 -1
  116. package/dist/assets/MobileTabPageHeader-0esgB2TO.js +0 -2
  117. package/dist/assets/TerminalView-BtM5-BVx.js +0 -8
  118. package/dist/assets/dropdown-menu.styles-PdxueXzN.js +0 -1
  119. package/dist/assets/es-BjI1GHJ5.js +0 -15
  120. package/dist/assets/fr-Bs7ndHkb.js +0 -13
  121. package/dist/assets/gitApi-BxQmH8Wg.js +0 -10
  122. package/dist/assets/host-D1EpSUMR.js +0 -1
  123. package/dist/assets/insertionBoundaries-CKQL85zy.js +0 -1
  124. package/dist/assets/ja-DkdV26EW.js +0 -15
  125. package/dist/assets/ko-B0qoC5da.js +0 -15
  126. package/dist/assets/main-CNwFqQQd.js +0 -2
  127. package/dist/assets/main-DPhcXanT.js +0 -169
  128. package/dist/assets/miniChat-CF2vb25D.js +0 -2
  129. package/dist/assets/mobile-C24qSj44.js +0 -2
  130. package/dist/assets/pl-D27Y_GBs.js +0 -15
  131. package/dist/assets/pt-BR-DbocEu4b.js +0 -15
  132. package/dist/assets/react-CURmDhtB.js +0 -1
  133. package/dist/assets/renderElectronMiniChatApp-ChZCxxH6.js +0 -2
  134. package/dist/assets/renderMobileApp-CRv3Il6P.js +0 -28
  135. package/dist/assets/runtimeEndpointReset-Cx3RE97b.js +0 -149
  136. package/dist/assets/scheduledTaskNavigation-rhgnZaaj.js +0 -1
  137. package/dist/assets/sessionChangeSummary-CVUA1AFw.js +0 -1
  138. package/dist/assets/sessionLookup-C3_vQwLe.js +0 -1
  139. package/dist/assets/sortable-tabs-strip-C1QmKFdb.js +0 -1
  140. package/dist/assets/speechSettingsQueries-BSQ-2JTv.js +0 -4
  141. package/dist/assets/src-NKCZI3Lg.css +0 -2
  142. package/dist/assets/store-DvN2L3vf.js +0 -15
  143. package/dist/assets/useDesktopWindowControlsLayout-CwgkVw9f.js +0 -1
  144. package/dist/assets/useMobileNavigationStore-TCj7ZnhV.js +0 -418
  145. package/dist/assets/useUIStore-DI7va1HH.js +0 -1
  146. package/dist/assets/zh-CN-DhFFdHQu.js +0 -15
  147. package/dist/assets/zh-TW-BvehppXO.js +0 -15
  148. /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-CNwFqQQd.js"></script>
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-DI7va1HH.js">
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-JyLTFv27.js">
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-DHrRqnYh.js">
592
- <link rel="modulepreload" crossorigin href="/assets/terminalApi-B5o8UqWA.js">
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-CNTgeeM1.js">
596
- <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-MQ1qpf60.js">
597
- <link rel="modulepreload" crossorigin href="/assets/native-config-ncdoz9Wl.js">
598
- <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-CZrflo-r.js">
599
- <link rel="stylesheet" crossorigin href="/assets/src-NKCZI3Lg.css">
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
@@ -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-CF2vb25D.js"></script>
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-DI7va1HH.js">
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-JyLTFv27.js">
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-DHrRqnYh.js">
109
- <link rel="modulepreload" crossorigin href="/assets/terminalApi-B5o8UqWA.js">
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-CNTgeeM1.js">
113
- <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-MQ1qpf60.js">
114
- <link rel="modulepreload" crossorigin href="/assets/native-config-ncdoz9Wl.js">
115
- <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-CZrflo-r.js">
116
- <link rel="stylesheet" crossorigin href="/assets/src-NKCZI3Lg.css">
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-C24qSj44.js"></script>
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-DI7va1HH.js">
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-JyLTFv27.js">
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-DHrRqnYh.js">
96
- <link rel="modulepreload" crossorigin href="/assets/terminalApi-B5o8UqWA.js">
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-CNTgeeM1.js">
100
- <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-MQ1qpf60.js">
101
- <link rel="modulepreload" crossorigin href="/assets/native-config-ncdoz9Wl.js">
102
- <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-CZrflo-r.js">
103
- <link rel="stylesheet" crossorigin href="/assets/src-NKCZI3Lg.css">
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",
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,21 @@
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
+
3
19
  ## WeChat message channel
4
20
 
5
21
  Each saved Bot has a Host-owned, QR-authorized text channel configured in the final
@@ -9,6 +25,10 @@ the existing `send()` pipeline and reads committed public replies through the in
9
25
  process leases are owned by `weixin/`, not ordinary Session delivery or UI state.
10
26
  See `weixin/DOCUMENTATION.md` for authorization, shared-context/output semantics,
11
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.
12
32
 
13
33
  ## New-contact greeting
14
34
 
@@ -3,6 +3,7 @@ export const assistantContractFixtures = Object.freeze({
3
3
  id: 'assistant_fixture',
4
4
  revision: 4,
5
5
  enabled: true,
6
+ pinnedAt: null,
6
7
  name: 'Fixture',
7
8
  defaultPrompt: '',
8
9
  workspacePath: null,
@@ -89,7 +89,7 @@ import { buildAssistantSessionMetadata } from '../session-metadata/system-sessio
89
89
  import { completionEvent, createFamilyCompletionGate, readSessionFamilyActivity } from '../notifications/family-completion-gate.js';
90
90
 
91
91
  const require = createRequire(import.meta.url);
92
- const SCHEMA_VERSION = 14;
92
+ const SCHEMA_VERSION = 16;
93
93
  const normalizeSessionDirectory = (value) => {
94
94
  if (typeof value !== 'string') return null;
95
95
  const trimmed = value.trim();
@@ -413,6 +413,7 @@ export const createAssistantsService = ({ dbPath, dataDir, buildOpenCodeUrl, get
413
413
  name: row.name,
414
414
  defaultPrompt: row.default_prompt,
415
415
  avatarSeed: row.avatar_seed ?? row.assistant_id,
416
+ pinnedAt: row.pinned_at ?? null,
416
417
  workspacePath: row.workspace_path,
417
418
  managedWorkspacePath: workspace(null, row.assistant_id, true),
418
419
  effectiveWorkspacePath: effectiveWorkspace(row),
@@ -508,11 +509,13 @@ export const createAssistantsService = ({ dbPath, dataDir, buildOpenCodeUrl, get
508
509
  if (!validAssistantDeliveryParts(parts, { allowAttachmentRefs: true })) fail('validation_error');
509
510
  };
510
511
  const migrate = () => {
511
- if (db.prepare("SELECT value FROM assistant_meta WHERE key='schema_version'").get()?.value === String(SCHEMA_VERSION)) return;
512
+ const previousVersion = Number(db.prepare("SELECT value FROM assistant_meta WHERE key='schema_version'").get()?.value ?? 0);
513
+ if (previousVersion === SCHEMA_VERSION) return;
512
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));
513
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;`);
514
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');
515
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');
516
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'");
517
520
  const managedConfig = (workspacePath, assistantID) => workspacePath != null && path.resolve(workspacePath) === workspaceFor(assistantID) ? null : workspacePath;
518
521
  const legacy = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='assistant'").get();
@@ -520,11 +523,19 @@ export const createAssistantsService = ({ dbPath, dataDir, buildOpenCodeUrl, get
520
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); }
521
524
  // v13: shared contact read watermark. Legacy transcripts default to fully read
522
525
  // so existing installs do not flash unread on upgrade; later messages count.
523
- migrateContactReadStateDefaultRead(db, { updatedAt: now() });
524
- db.prepare("INSERT OR REPLACE INTO assistant_meta(key,value) VALUES ('schema_version',?)").run(String(SCHEMA_VERSION));
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
+ })();
525
536
  };
526
- migrate();
527
537
  try {
538
+ migrate();
528
539
  db.transaction(() => {
529
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());
530
541
  if (restored.changes) bump();
@@ -1487,10 +1498,12 @@ export const createAssistantsService = ({ dbPath, dataDir, buildOpenCodeUrl, get
1487
1498
  };
1488
1499
  const updateAssistant = async (assistantID, input) => {
1489
1500
  const row = editable(assistantID);
1490
- 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']);
1491
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');
1492
1504
  const next = {
1493
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,
1494
1507
  name: input.name === undefined ? row.name : string(input.name, 256, true),
1495
1508
  prompt: input.defaultPrompt === undefined ? row.default_prompt : string(input.defaultPrompt, 200_000),
1496
1509
  provider: input.providerID === undefined ? row.provider_id : string(input.providerID, 256, true),
@@ -1507,7 +1520,10 @@ export const createAssistantsService = ({ dbPath, dataDir, buildOpenCodeUrl, get
1507
1520
  const created = workspaceChanged ? await createSession(nextRow) : null;
1508
1521
  try {
1509
1522
  db.transaction(() => {
1510
- const result = db.prepare('UPDATE assistant_v2 SET avatar_seed=?,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.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);
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);
1511
1527
  if (!result.changes) fail('revision_conflict');
1512
1528
  if (workspaceChanged && row.current_session_id) archiveSession(assistantID, row.current_session_id, effectiveWorkspace(row));
1513
1529
  bump();
@@ -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,有什么可以帮你的吗?'],
@@ -26,6 +26,22 @@ service protocol. No OpenClaw runtime or new dependency is installed.
26
26
 
27
27
  ## Authorization and persistence
28
28
 
29
+ Before opening storage or creating any timer, the runtime resolves the channel
30
+ policy from its environment. `NODE_ENV=development` or `YURI_ELECTRON_DEV=1/true`
31
+ disables WeChat by default; the web development server scripts explicitly set
32
+ `NODE_ENV=development`, including watch/HMR/full/mobile live-reload paths. An
33
+ explicit `YURI_WEIXIN_ENABLED=1/true` opts in; `0/false` or an unrecognized nonempty
34
+ value disables it in any environment. Production defaults remain enabled.
35
+
36
+ A disabled runtime does not open/create SQLite, acquire/release leases, poll,
37
+ send, infer live typing or mutate bindings. Status returns `disabled`; QR login,
38
+ verification, retry, disconnect and transfer fail with `channel_disabled` (403).
39
+ `forget` and shutdown are no-ops, so development does not erase production channel
40
+ credentials. Shared UI displays the disabled state without connection controls
41
+ and does not poll it. This gate is channel-specific, not general isolation of
42
+ assistant data; testing channels still requires an isolated data directory and
43
+ test account. Never copy production WeChat credentials into a second database.
44
+
29
45
  The QR-confirmed `ilink_user_id` is the only accepted sender. Group messages,
30
46
  other senders and messages without a stable platform ID never invoke tools. Each
31
47
  bound account maps to exactly one Bot within the Host data directory. The account
@@ -47,6 +63,46 @@ revocation API, so this is not a promise to revoke the platform's authorization.
47
63
  Deleting a Bot also forgets its local connection. Failed revision-checked Bot
48
64
  deletion leaves the connection intact.
49
65
 
66
+ ### Moving a connection between Yuri Bots
67
+
68
+ The current WeChat flow supports one Bot entry for a scanning WeChat user, not a
69
+ new independent entry on every scan. Multiple stored bindings represent separate
70
+ platform accounts, not evidence that one user can create multiple contacts. QR
71
+ `binded_redirect` and confirmed-account conflicts never silently steal a binding.
72
+
73
+ For an unbound target, authenticated status responses optionally list local
74
+ `transferSources` containing only the source Bot ID, display name and binding
75
+ revision (epoch). No platform account/user IDs, tokens or context tickets leave
76
+ the Host. The settings row offers an explicit two-step confirmation, including
77
+ the loss of unprocessed inbound messages and queued outgoing replies. No QR or
78
+ platform reauthorization is required to move an existing local authorization.
79
+
80
+ `POST /api/yuri/assistants/:assistantID/weixin/transfer` accepts `sourceAssistantID`,
81
+ `revision` and UI `language`. The Host requires the current lease, a live source
82
+ matching that exact epoch and an unbound target; it will not overwrite even an
83
+ expired target binding. Source/target are locked while receiving and sending are
84
+ aborted/drained, live typing is cancelled, and target QR attempts are invalidated.
85
+ Both Bots and the source epoch are revalidated after the wait. Concurrent moves,
86
+ disconnects and QR starts cannot race this boundary; stale confirmations return
87
+ `binding_changed` (409). Shutdown waits for the move before releasing storage.
88
+
89
+ One SQLite transaction moves credentials, paired owner, cursor and reply context,
90
+ assigns a new epoch, sets the target's current transcript tip and drops the source
91
+ outbox. Receipt IDs survive under the new epoch as done, with cleared text, so
92
+ platform replays cannot re-execute tools after a move or restart. Pending messages
93
+ are not reassigned to the new Bot. Histories stay with their original Bots; already
94
+ admitted tasks continue there without further WeChat synchronization. Already
95
+ submitted HTTP sends cannot be recalled. Failed validation or transaction writes
96
+ leave source credentials, cursor and queues intact and resume its receiver (an
97
+ interrupted in-flight send still has the normal uncertain-delivery semantics).
98
+
99
+ The UI invalidates the current Host's channel queries after mutations, including
100
+ the source and target, and rejects stale-runtime completions. Connection candidates
101
+ are dynamic entity rows, not global Settings search entries. A connection owned by
102
+ WorkBuddy or another Host cannot be imported: users must unlink in that application
103
+ and authorize Yuri through the platform flow. Local disconnect alone does not
104
+ promise to revoke a remote application's authorization.
105
+
50
106
  ## Delivery semantics
51
107
 
52
108
  Incoming receipt, reply context and platform cursor commit together before calling
@@ -136,7 +192,8 @@ unlimited proactive notifications or arbitrary rich-card support.
136
192
 
137
193
  Focused tests cover wire behavior, business errors, QR fencing, owner isolation,
138
194
  dedup, restart, conflicting bindings, process lease, shutdown, generation changes,
139
- unknown delivery, HTTP protection, typing cadence/cancellation/stale completions,
195
+ unknown delivery, HTTP protection, confirmed moves, failed-write rollback,
196
+ cursor/dedup preservation, concurrent/stale moves, typing cancellation/stale completions,
140
197
  and real contact-pipeline execution with a fake WeChat service. Real-account
141
198
  QR/verification, phone-visible delivery and typing presentation still require
142
199
  manual testing; mocks and builds are not evidence of platform acceptance.
@@ -1,5 +1,5 @@
1
- const failureStatus = (code) => code === 'not_found' ? 404
2
- : ['account_in_use', 'already_bound', 'channel_in_use'].includes(code) ? 409
1
+ const failureStatus = (code) => code === 'channel_disabled' ? 403 : code === 'not_found' ? 404
2
+ : ['account_in_use', 'already_bound', 'channel_in_use', 'binding_changed'].includes(code) ? 409
3
3
  : ['network_error', 'upstream_error', 'invalid_response'].includes(code) ? 502 : 400;
4
4
 
5
5
  /** Runs behind the Host's existing authenticated Yuri route gate. No public webhook. */
@@ -8,7 +8,7 @@ export function registerWeixinRoutes(app, runtime) {
8
8
  const respond = (res, work) => {
9
9
  res.setHeader('Cache-Control', 'no-store');
10
10
  Promise.resolve().then(work).then((body) => res.json(body)).catch((error) => {
11
- const allowed = new Set(['not_found', 'account_in_use', 'already_bound', 'channel_in_use', 'network_error',
11
+ const allowed = new Set(['not_found', 'account_in_use', 'already_bound', 'channel_in_use', 'channel_disabled', 'binding_changed', 'network_error',
12
12
  'upstream_error', 'invalid_response', 'validation_error', 'auth_expired', 'cancelled']);
13
13
  const code = allowed.has(error?.code) ? error.code : 'channel_error';
14
14
  // Never return upstream bodies, credentials or QR-status payloads as errors.
@@ -19,5 +19,6 @@ export function registerWeixinRoutes(app, runtime) {
19
19
  app.post(`${root}/login`, (req, res) => respond(res, () => runtime.startLogin(req.params.assistantID, req.body?.language)));
20
20
  app.post(`${root}/verify`, (req, res) => respond(res, () => runtime.verify(req.params.assistantID, req.body?.code)));
21
21
  app.post(`${root}/retry`, (req, res) => respond(res, () => runtime.retry(req.params.assistantID)));
22
+ app.post(`${root}/transfer`, (req, res) => respond(res, () => runtime.transfer(req.params.assistantID, req.body)));
22
23
  app.delete(root, (req, res) => respond(res, () => runtime.disconnect(req.params.assistantID)));
23
24
  }
@@ -2,8 +2,25 @@ import express from 'express';
2
2
  import request from 'supertest';
3
3
  import { describe, expect, it, vi } from 'vitest';
4
4
  import { registerWeixinRoutes } from './routes.js';
5
+ import { createWeixinRuntime } from './runtime.js';
5
6
 
6
7
  describe('authenticated Bot WeChat routes', () => {
8
+ it('reports a disabled channel and blocks direct mutation requests, not only UI buttons', async () => {
9
+ const app = express();
10
+ app.use(express.json());
11
+ const runtime = createWeixinRuntime({ env: { NODE_ENV: 'development' } });
12
+ registerWeixinRoutes(app, runtime);
13
+ const root = '/api/yuri/assistants/bot/weixin';
14
+ const response = await request(app).get(root).expect(200);
15
+ expect(response.body).toEqual({ status: 'disabled', error: null });
16
+ for (const action of ['login', 'verify', 'retry', 'transfer']) {
17
+ const result = await request(app).post(`${root}/${action}`).send({}).expect(403);
18
+ expect(result.body).toEqual({ error: 'channel_disabled' });
19
+ }
20
+ await request(app).delete(root).expect(403);
21
+ await runtime.close();
22
+ });
23
+
7
24
  it('keeps the existing authentication boundary, has explicit routes and no-store QR responses', async () => {
8
25
  const app = express();
9
26
  app.use(express.json());
@@ -14,6 +31,7 @@ describe('authenticated Bot WeChat routes', () => {
14
31
  verify: vi.fn(() => ({ status: 'verify', error: null })),
15
32
  retry: vi.fn(() => ({ status: 'connected', error: null })),
16
33
  disconnect: vi.fn(() => ({ status: 'disconnected', error: null })),
34
+ transfer: vi.fn(async () => ({ status: 'connected', error: null })),
17
35
  };
18
36
  registerWeixinRoutes(app, runtime);
19
37
  const root = '/api/yuri/assistants/bot/weixin';
@@ -27,6 +45,18 @@ describe('authenticated Bot WeChat routes', () => {
27
45
  expect(runtime.verify).toHaveBeenCalledWith('bot', '123456');
28
46
  await request(app).delete(root).auth('test-owner', { type: 'bearer' }).expect(200);
29
47
  expect(runtime.disconnect).toHaveBeenCalledWith('bot');
48
+ await request(app).post(`${root}/transfer`).send({ sourceAssistantID: 'old', revision: 'r1' }).expect(401);
49
+ expect(runtime.transfer).not.toHaveBeenCalled();
50
+ await request(app).post(`${root}/transfer`).auth('test-owner', { type: 'bearer' })
51
+ .send({ sourceAssistantID: 'old', revision: 'r1', language: 'zh-CN' }).expect('Cache-Control', 'no-store').expect(200);
52
+ expect(runtime.transfer).toHaveBeenCalledWith('bot', { sourceAssistantID: 'old', revision: 'r1', language: 'zh-CN' });
53
+ });
54
+
55
+ it('reports stale move confirmations as conflicts without leaking binding credentials', async () => {
56
+ const app = express();
57
+ registerWeixinRoutes(app, { transfer: () => { throw Object.assign(new Error('private-token'), { code: 'binding_changed' }); } });
58
+ const result = await request(app).post('/api/yuri/assistants/bot/weixin/transfer').expect(409);
59
+ expect(result.body).toEqual({ error: 'binding_changed' });
30
60
  });
31
61
 
32
62
  it('redacts untrusted errors and reports binding conflicts as conflicts', async () => {