@yuriai/web 0.2.31 → 0.2.32-beta.10

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 (201) hide show
  1. package/README.md +19 -0
  2. package/dist/assets/{AgentAvatar-DLAQkFQe.js → AgentAvatar-DLzcNrQ0.js} +1 -1
  3. package/dist/assets/AssistantContactStatus-Bf1yg0yx.js +3 -0
  4. package/dist/assets/{AssistantUnreadBadge-BynxNQMk.js → AssistantUnreadBadge-BUFyxUrT.js} +1 -1
  5. package/dist/assets/{AssistantView-CDZyA9ft.js → AssistantView-CELFybSr.js} +1 -1
  6. package/dist/assets/{DiagramView-DdVFGHQQ.js → DiagramView-DV4P3-Wg.js} +1 -1
  7. package/dist/assets/{FadeInOnReveal-C9a7XnAh.js → FadeInOnReveal-BRrU2ivL.js} +1 -1
  8. package/dist/assets/{GuiPluginSurface-v8r-Hex5.js → GuiPluginSurface-NOHaJGy2.js} +1 -1
  9. package/dist/assets/{GuiPluginWindow-Ba1HfrjQ.js → GuiPluginWindow-BykPaQeY.js} +1 -1
  10. package/dist/assets/Icon-OJf0qBKf.js +1 -0
  11. package/dist/assets/{ImageLoadingPlaceholder-Dcy5lc7F.js → ImageLoadingPlaceholder-DlQbo9CM.js} +1 -1
  12. package/dist/assets/{LoadingImage-BxjJ_Xyj.js → LoadingImage-sZ5omN5L.js} +1 -1
  13. package/dist/assets/MarkdownRenderer-BFR9FWQL.js +2 -0
  14. package/dist/assets/MarkdownRendererImpl-iZFUMI3M.js +10 -0
  15. package/dist/assets/{MarkstreamRendererImpl-EpBnVy9J.css → MarkstreamRendererImpl-C6aiJnjl.css} +1 -1
  16. package/dist/assets/MarkstreamRendererImpl-DjC_Y4LS.js +3 -0
  17. package/dist/assets/{MobileDetailNavigation-o54juFXD.js → MobileDetailNavigation-BOZpHdI2.js} +1 -1
  18. package/dist/assets/{MobileResizableSheet-sV9XR-0k.js → MobileResizableSheet-DuAi_epR.js} +1 -1
  19. package/dist/assets/{MobileShareBridge-oqBZ_f6M.js → MobileShareBridge-D1DrqLWf.js} +1 -1
  20. package/dist/assets/MobileTabPageHeader-BT9gWugr.js +2 -0
  21. package/dist/assets/{MultiRunWindow-7W_86vL6.js → MultiRunWindow-C0GYNaUU.js} +1 -1
  22. package/dist/assets/{OnboardingScreen-CnkijSLE.js → OnboardingScreen-CqsI0632.js} +1 -1
  23. package/dist/assets/{OverlayScrollbar-CCtBTJQj.js → OverlayScrollbar-CZD1yU06.js} +1 -1
  24. package/dist/assets/SettingsView-BYO8LY5A.js +29 -0
  25. package/dist/assets/{SettingsWindow-C0HiNvXh.js → SettingsWindow-CM0Ph9WD.js} +1 -1
  26. package/dist/assets/SetupTourDialog-BYlSBPKZ.js +1 -0
  27. package/dist/assets/SetupTourDialog-DrL_4ODI.css +1 -0
  28. package/dist/assets/{TerminalView-y36H_fIe.js → TerminalView-DnyEAShU.js} +1 -1
  29. package/dist/assets/{ToolOutputDialog-BfjBeqGS.js → ToolOutputDialog-BWONfWze.js} +1 -1
  30. package/dist/assets/{VoiceSettings-BONwzGgR.js → VoiceSettings-Ru_0ySgM.js} +2 -2
  31. package/dist/assets/{YuriLogo-BA5FWp-g.js → YuriLogo-CMUoGUHc.js} +1 -1
  32. package/dist/assets/YuriWordmark-DHYo0FlR.js +1 -0
  33. package/dist/assets/{appThemeRegistry-BsLMp3bc.js → appThemeRegistry-BMlAlm0m.js} +1 -1
  34. package/dist/assets/{button-CBjOhOI0.js → button-C-gRcs_2.js} +1 -1
  35. package/dist/assets/{capgoAdapter-DjlyVxy_.js → capgoAdapter-GdNfjwXs.js} +1 -1
  36. package/dist/assets/checkbox-BrJBzET8.js +1 -0
  37. package/dist/assets/{collapsible-B0j5IQ0T.js → collapsible-B7esGYLd.js} +1 -1
  38. package/dist/assets/{context-menu-C4e_bpls.js → context-menu-DWn1nSZC.js} +1 -1
  39. package/dist/assets/desktopHosts-BLU1tGSX.js +1 -0
  40. package/dist/assets/{desktopRelayRestore-AE3_TnQz.js → desktopRelayRestore-2BIIs8mZ.js} +1 -1
  41. package/dist/assets/{diagram-WPmk0Qh6.js → diagram-Bnra5_6g.js} +1 -1
  42. package/dist/assets/{dialog-Dx3IT7dQ.js → dialog-3UseH0hM.js} +1 -1
  43. package/dist/assets/{es-JU--16Gd.js → es-J7a_sZ1u.js} +2 -2
  44. package/dist/assets/{fileMentionTouchSelection-Bizsisaj.js → fileMentionTouchSelection-ByaQJcTS.js} +1 -1
  45. package/dist/assets/{fr-BUZcRuMk.js → fr-BYxUMKWp.js} +2 -2
  46. package/dist/assets/{gitApi-CNgEj6X5.js → gitApi-BdwvoQFb.js} +1 -1
  47. package/dist/assets/historyImportQueries-C8VK9R5_.js +1 -0
  48. package/dist/assets/host-z9PU8q1e.js +1 -0
  49. package/dist/assets/{input-CEJGM-TS.js → input-CmLlZdeD.js} +1 -1
  50. package/dist/assets/insertionBoundaries-BpQ6nLjP.js +1 -0
  51. package/dist/assets/{ja-BwtVLTXD.js → ja-DCdBiJmD.js} +2 -2
  52. package/dist/assets/{ko--sLsRFpA.js → ko-D-Nb_RJY.js} +2 -2
  53. package/dist/assets/main-Dosy2jXg.js +2 -0
  54. package/dist/assets/main-oBh-dk5-.js +169 -0
  55. package/dist/assets/{markdownHeightCache-D6iSNJG2.js → markdownHeightCache-xNkQdlqi.js} +1 -1
  56. package/dist/assets/{mcpQueries-DVSsZeuk.js → mcpQueries-C8zsTQqJ.js} +1 -1
  57. package/dist/assets/miniChat-CI8ryDGT.js +2 -0
  58. package/dist/assets/mobile-e_mTK3dh.js +2 -0
  59. package/dist/assets/{mobileBackNavigation-Dmbf0kw1.js → mobileBackNavigation-sB7c0Pi4.js} +1 -1
  60. package/dist/assets/multirun-DbmgWrsY.js +3 -0
  61. package/dist/assets/{native-config-BaRHaY4y.js → native-config-C_mwkFzh.js} +1 -1
  62. package/dist/assets/{pl-C4_4J5yA.js → pl-AmU4w3aM.js} +2 -2
  63. package/dist/assets/{projectMeta-rrpZdm8D.js → projectMeta-1iUbVl_M.js} +1 -1
  64. package/dist/assets/{pt-BR-DvNC5K1q.js → pt-BR-BI4ft-Fj.js} +2 -2
  65. package/dist/assets/pwa-BdUAGhLt.js +2 -0
  66. package/dist/assets/{queue-abort-optimistic-CSkERbr4.js → queue-abort-optimistic-BwDsaym5.js} +1 -1
  67. package/dist/assets/react-a6PrrNTm.js +1 -0
  68. package/dist/assets/{readiness-BnO7IaZV.js → readiness-D2N0DtZF.js} +1 -1
  69. package/dist/assets/{renderElectronMiniChatApp-Bq3iNKtr.js → renderElectronMiniChatApp-DV0cNt_O.js} +2 -2
  70. package/dist/assets/{renderMobileApp-DiNeMgwp.js → renderMobileApp-b7--jT5z.js} +7 -7
  71. package/dist/assets/{runtimeConfig-BHOiBANF.js → runtimeConfig-DxmJLWUO.js} +1 -1
  72. package/dist/assets/runtimeEndpointReset-jYAYa3Rh.js +149 -0
  73. package/dist/assets/{select-bKMw5JE8.js → select-J8r9SxHt.js} +1 -1
  74. package/dist/assets/sessionLookup-CUQqj2N4.js +1 -0
  75. package/dist/assets/{sortable-tabs-strip-3sKiA7T1.js → sortable-tabs-strip-CiP6RIQa.js} +1 -1
  76. package/dist/assets/{speechSettingsQueries-BDDxw8LP.js → speechSettingsQueries-B3ziGQvb.js} +1 -1
  77. package/dist/assets/src-GtPQ8f4o.css +2 -0
  78. package/dist/assets/{store-X3lU0obe.js → store-OjrIiXCx.js} +5 -5
  79. package/dist/assets/{textarea-EsaDD051.js → textarea-BHgcxJdC.js} +1 -1
  80. package/dist/assets/{tooltip-LLDL5nIZ.js → tooltip-Degmpxnd.js} +1 -1
  81. package/dist/assets/tour-DDI0Zg7l.js +1 -0
  82. package/dist/assets/types-QETHY-S7.js +2 -0
  83. package/dist/assets/{uk-Dvj0JjiC.js → uk-CbdByxxj.js} +2 -2
  84. package/dist/assets/{useAppFontEffects-wIWWE59b.js → useAppFontEffects-LADr3Zl1.js} +53 -53
  85. package/dist/assets/useDesktopWindowControlsLayout-BVNnRHtc.js +1 -0
  86. package/dist/assets/{useDictation-DlEHSN6P.js → useDictation-DFVJpRbm.js} +1 -1
  87. package/dist/assets/{useEffectiveDirectory-DzqpWUC3.js → useEffectiveDirectory-8tqfGdV5.js} +1 -1
  88. package/dist/assets/{useMobileNavigationStore-BWLhXqci.js → useMobileNavigationStore-CLUFv-TZ.js} +13 -13
  89. package/dist/assets/usePluginsStore-B_SIDwsK.js +1 -0
  90. package/dist/assets/useStreamingTextThrottle-VhgGU_te.js +1 -0
  91. package/dist/assets/{useWorkerHighlightedLines-DMS69wKa.js → useWorkerHighlightedLines-jlxakDGs.js} +1 -1
  92. package/dist/assets/{vendor-markstream-react-DfLaSG3W.js → vendor-markstream-react-6zxyQLCD.js} +1 -1
  93. package/dist/assets/{zh-CN-2Y6u8t24.js → zh-CN-ufEVDbXp.js} +2 -2
  94. package/dist/assets/{zh-TW-Z5wVv4Fb.js → zh-TW-DTBlZ4YC.js} +2 -2
  95. package/dist/index.html +8 -8
  96. package/dist/mini-chat.html +8 -8
  97. package/dist/mobile.html +8 -8
  98. package/package.json +1 -1
  99. package/server/index.js +3 -0
  100. package/server/lib/client-auth/pairing.js +2 -0
  101. package/server/lib/client-auth/pairing.test.js +29 -0
  102. package/server/lib/config-sync/DOCUMENTATION.md +8 -4
  103. package/server/lib/config-sync/index.js +1 -1
  104. package/server/lib/config-sync/magpie-auth.js +10 -4
  105. package/server/lib/config-sync/magpie-auth.test.js +4 -0
  106. package/server/lib/config-sync/magpie.js +28 -22
  107. package/server/lib/config-sync/magpie.test.js +127 -2
  108. package/server/lib/config-sync/plugins.js +44 -0
  109. package/server/lib/config-sync/plugins.test.js +64 -0
  110. package/server/lib/config-sync/tar.js +61 -1
  111. package/server/lib/content-search/DOCUMENTATION.md +9 -0
  112. package/server/lib/content-search/routes.js +18 -1
  113. package/server/lib/content-search/routes.test.js +21 -0
  114. package/server/lib/content-search/runtime.js +7 -3
  115. package/server/lib/content-search/runtime.test.js +26 -0
  116. package/server/lib/gui-customization/DOCUMENTATION.md +21 -1
  117. package/server/lib/gui-customization/session-skill.js +2 -2
  118. package/server/lib/gui-customization/session-skill.test.js +3 -1
  119. package/server/lib/gui-customization/skill/SKILL.md +5 -1
  120. package/server/lib/gui-customization/skill/references/global-pages.md +1 -1
  121. package/server/lib/gui-customization/skill/references/gui-api.md +4 -1
  122. package/server/lib/gui-customization/skill/references/icons.md +134 -0
  123. package/server/lib/gui-customization/skill/references/plugin-styles.md +112 -0
  124. package/server/lib/gui-customization/skill/references/ui-surfaces.md +2 -0
  125. package/server/lib/gui-customization/skill/references/work-status.md +110 -0
  126. package/server/lib/history-import/AGENT_CONNECT_LICENSE +21 -0
  127. package/server/lib/history-import/DOCUMENTATION.md +223 -0
  128. package/server/lib/history-import/dev-proxy.integration.test.js +56 -0
  129. package/server/lib/history-import/events.js +322 -0
  130. package/server/lib/history-import/events.test.js +110 -0
  131. package/server/lib/history-import/installations.js +39 -0
  132. package/server/lib/history-import/installations.test.js +24 -0
  133. package/server/lib/history-import/native.js +49 -0
  134. package/server/lib/history-import/native.test.js +42 -0
  135. package/server/lib/history-import/routes.js +48 -0
  136. package/server/lib/history-import/routes.test.js +55 -0
  137. package/server/lib/history-import/service.js +374 -0
  138. package/server/lib/history-import/service.test.js +538 -0
  139. package/server/lib/history-import/settings.js +146 -0
  140. package/server/lib/history-import/settings.test.js +88 -0
  141. package/server/lib/history-import/sources.js +184 -0
  142. package/server/lib/history-import/sources.test.js +190 -0
  143. package/server/lib/history-import/sqlite.js +187 -0
  144. package/server/lib/history-import/store.js +58 -0
  145. package/server/lib/history-import/store.test.js +84 -0
  146. package/server/lib/history-import/targets.js +24 -0
  147. package/server/lib/host-update/DOCUMENTATION.md +6 -0
  148. package/server/lib/host-update/routes.test.js +1 -1
  149. package/server/lib/notifications/native-stream.relay.test.js +1 -0
  150. package/server/lib/opencode/DOCUMENTATION.md +14 -0
  151. package/server/lib/opencode/core-routes.js +1 -0
  152. package/server/lib/opencode/feature-routes-runtime.js +11 -1
  153. package/server/lib/opencode/plugin-routes.test.js +1 -0
  154. package/server/lib/opencode/plugins.js +1 -1
  155. package/server/lib/opencode/plugins.test.js +3 -2
  156. package/server/lib/opencode/proxy.js +29 -4
  157. package/server/lib/opencode/proxy.test.js +85 -1
  158. package/server/lib/opencode/server-utils-runtime.js +2 -0
  159. package/server/lib/opencode/settings-runtime.js +8 -6
  160. package/server/lib/opencode/settings-runtime.test.js +44 -0
  161. package/server/lib/opencode/yuri-routes.js +1 -1
  162. package/server/lib/relay/DOCUMENTATION.md +1 -1
  163. package/server/lib/relay/host-client.js +3 -1
  164. package/server/lib/relay/host-client.test.js +1 -0
  165. package/server/lib/relay/reasoning-projection.e2e.test.ts +1 -0
  166. package/server/lib/relay/relay-server.e2e.test.ts +32 -17
  167. package/server/lib/relay/service.js +2 -0
  168. package/server/lib/relay/tunnel-host.js +26 -1
  169. package/server/lib/relay/tunnel-host.test.js +27 -3
  170. package/server/lib/remote-desktop/runtime.test.js +2 -2
  171. package/server/lib/ui-auth/DOCUMENTATION.md +3 -0
  172. package/server/lib/ui-auth/ui-auth.js +27 -0
  173. package/server/lib/ui-auth/ui-auth.test.js +42 -1
  174. package/server/plugin-gui-proxy.test.js +1 -1
  175. package/dist/assets/AssistantContactStatus-DZGGspw4.js +0 -3
  176. package/dist/assets/Icon-Bh3TaKoN.js +0 -1
  177. package/dist/assets/MarkdownRenderer-CS6Pia5D.js +0 -2
  178. package/dist/assets/MarkdownRendererImpl-Bdwe3qUr.js +0 -10
  179. package/dist/assets/MarkstreamRendererImpl-CCQj9IkL.js +0 -3
  180. package/dist/assets/MobileTabPageHeader-CptcDWNS.js +0 -2
  181. package/dist/assets/SettingsView-CkJpYIMe.js +0 -29
  182. package/dist/assets/SetupTourDialog-BcEbaEO3.js +0 -1
  183. package/dist/assets/SetupTourDialog-CUzqT2sw.css +0 -1
  184. package/dist/assets/YuriWordmark-Cr1vkcue.js +0 -1
  185. package/dist/assets/desktopHosts-CMglnUdS.js +0 -1
  186. package/dist/assets/host-CBfSyi4l.js +0 -1
  187. package/dist/assets/insertionBoundaries-CgYf6gys.js +0 -1
  188. package/dist/assets/main-B8FcBwPM.js +0 -169
  189. package/dist/assets/main-DrqtyqDc.js +0 -2
  190. package/dist/assets/miniChat-CgeCl4RY.js +0 -2
  191. package/dist/assets/mobile-DAhJKHUq.js +0 -2
  192. package/dist/assets/multirun-BbWnHeaY.js +0 -3
  193. package/dist/assets/pwa-Dm_DJEr9.js +0 -2
  194. package/dist/assets/react-Bwr5-XPi.js +0 -1
  195. package/dist/assets/runtimeEndpointReset-DGxT24oE.js +0 -149
  196. package/dist/assets/sessionLookup-DGNxfDsP.js +0 -1
  197. package/dist/assets/src-PTWgTO6W.css +0 -2
  198. package/dist/assets/tour-Db44qwfs.js +0 -1
  199. package/dist/assets/types-Cl7nTpsb.js +0 -2
  200. package/dist/assets/useDesktopWindowControlsLayout-CdUr9mCZ.js +0 -1
  201. package/dist/assets/usePluginsStore-aZl0WTK8.js +0 -1
package/dist/index.html CHANGED
@@ -571,15 +571,15 @@
571
571
  opacity: 0.72;
572
572
  }
573
573
  </style>
574
- <script type="module" crossorigin src="/assets/main-DrqtyqDc.js"></script>
574
+ <script type="module" crossorigin src="/assets/main-Dosy2jXg.js"></script>
575
575
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
576
576
  <link rel="modulepreload" crossorigin href="/assets/runtime-auth-DBn9yahL.js">
577
577
  <link rel="modulepreload" crossorigin href="/assets/runtime-switch-DEZ1K7qW.js">
578
578
  <link rel="modulepreload" crossorigin href="/assets/runtime-fetch-D0YWp3FJ.js">
579
579
  <link rel="modulepreload" crossorigin href="/assets/runtimeAPIRegistry-C2VogTny.js">
580
580
  <link rel="modulepreload" crossorigin href="/assets/desktop-BAmoc_34.js">
581
- <link rel="modulepreload" crossorigin href="/assets/desktopHosts-CMglnUdS.js">
582
- <link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-AE3_TnQz.js">
581
+ <link rel="modulepreload" crossorigin href="/assets/desktopHosts-BLU1tGSX.js">
582
+ <link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-2BIIs8mZ.js">
583
583
  <link rel="modulepreload" crossorigin href="/assets/vendor-base-ui-CzHs0bHY.js">
584
584
  <link rel="modulepreload" crossorigin href="/assets/vendor-zustand-vDaAPGfl.js">
585
585
  <link rel="modulepreload" crossorigin href="/assets/vendor-effect-X1Hqc7ba.js">
@@ -604,11 +604,11 @@
604
604
  <link rel="modulepreload" crossorigin href="/assets/terminalApi-BMWW_0wH.js">
605
605
  <link rel="modulepreload" crossorigin href="/assets/runtime-file-download-D6bwc3Kj.js">
606
606
  <link rel="modulepreload" crossorigin href="/assets/platform-sEg2IOLZ.js">
607
- <link rel="modulepreload" crossorigin href="/assets/types-Cl7nTpsb.js">
608
- <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-DjlyVxy_.js">
609
- <link rel="modulepreload" crossorigin href="/assets/native-config-BaRHaY4y.js">
610
- <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-BHOiBANF.js">
611
- <link rel="stylesheet" crossorigin href="/assets/src-PTWgTO6W.css">
607
+ <link rel="modulepreload" crossorigin href="/assets/types-QETHY-S7.js">
608
+ <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-GdNfjwXs.js">
609
+ <link rel="modulepreload" crossorigin href="/assets/native-config-C_mwkFzh.js">
610
+ <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-DxmJLWUO.js">
611
+ <link rel="stylesheet" crossorigin href="/assets/src-GtPQ8f4o.css">
612
612
  </head>
613
613
  <body class="h-full bg-background text-foreground">
614
614
  <!-- Keep the startup layer outside #root. React replaces every child of
@@ -77,15 +77,15 @@
77
77
  .dark #initial-loading img { filter: invert(1); }
78
78
  </style>
79
79
 
80
- <script type="module" crossorigin src="/assets/miniChat-CgeCl4RY.js"></script>
80
+ <script type="module" crossorigin src="/assets/miniChat-CI8ryDGT.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">
84
84
  <link rel="modulepreload" crossorigin href="/assets/runtime-fetch-D0YWp3FJ.js">
85
85
  <link rel="modulepreload" crossorigin href="/assets/runtimeAPIRegistry-C2VogTny.js">
86
86
  <link rel="modulepreload" crossorigin href="/assets/desktop-BAmoc_34.js">
87
- <link rel="modulepreload" crossorigin href="/assets/desktopHosts-CMglnUdS.js">
88
- <link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-AE3_TnQz.js">
87
+ <link rel="modulepreload" crossorigin href="/assets/desktopHosts-BLU1tGSX.js">
88
+ <link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-2BIIs8mZ.js">
89
89
  <link rel="modulepreload" crossorigin href="/assets/vendor-base-ui-CzHs0bHY.js">
90
90
  <link rel="modulepreload" crossorigin href="/assets/vendor-zustand-vDaAPGfl.js">
91
91
  <link rel="modulepreload" crossorigin href="/assets/vendor-effect-X1Hqc7ba.js">
@@ -110,11 +110,11 @@
110
110
  <link rel="modulepreload" crossorigin href="/assets/terminalApi-BMWW_0wH.js">
111
111
  <link rel="modulepreload" crossorigin href="/assets/runtime-file-download-D6bwc3Kj.js">
112
112
  <link rel="modulepreload" crossorigin href="/assets/platform-sEg2IOLZ.js">
113
- <link rel="modulepreload" crossorigin href="/assets/types-Cl7nTpsb.js">
114
- <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-DjlyVxy_.js">
115
- <link rel="modulepreload" crossorigin href="/assets/native-config-BaRHaY4y.js">
116
- <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-BHOiBANF.js">
117
- <link rel="stylesheet" crossorigin href="/assets/src-PTWgTO6W.css">
113
+ <link rel="modulepreload" crossorigin href="/assets/types-QETHY-S7.js">
114
+ <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-GdNfjwXs.js">
115
+ <link rel="modulepreload" crossorigin href="/assets/native-config-C_mwkFzh.js">
116
+ <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-DxmJLWUO.js">
117
+ <link rel="stylesheet" crossorigin href="/assets/src-GtPQ8f4o.css">
118
118
  </head>
119
119
  <body class="h-full bg-background text-foreground">
120
120
  <div id="root" class="h-full">
package/dist/mobile.html CHANGED
@@ -64,15 +64,15 @@
64
64
  </script>
65
65
 
66
66
  <style>.dark #mobile-startup-logo img { filter: invert(1); }</style>
67
- <script type="module" crossorigin src="/assets/mobile-DAhJKHUq.js"></script>
67
+ <script type="module" crossorigin src="/assets/mobile-e_mTK3dh.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">
71
71
  <link rel="modulepreload" crossorigin href="/assets/runtime-fetch-D0YWp3FJ.js">
72
72
  <link rel="modulepreload" crossorigin href="/assets/runtimeAPIRegistry-C2VogTny.js">
73
73
  <link rel="modulepreload" crossorigin href="/assets/desktop-BAmoc_34.js">
74
- <link rel="modulepreload" crossorigin href="/assets/desktopHosts-CMglnUdS.js">
75
- <link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-AE3_TnQz.js">
74
+ <link rel="modulepreload" crossorigin href="/assets/desktopHosts-BLU1tGSX.js">
75
+ <link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-2BIIs8mZ.js">
76
76
  <link rel="modulepreload" crossorigin href="/assets/vendor-base-ui-CzHs0bHY.js">
77
77
  <link rel="modulepreload" crossorigin href="/assets/vendor-zustand-vDaAPGfl.js">
78
78
  <link rel="modulepreload" crossorigin href="/assets/vendor-effect-X1Hqc7ba.js">
@@ -97,11 +97,11 @@
97
97
  <link rel="modulepreload" crossorigin href="/assets/terminalApi-BMWW_0wH.js">
98
98
  <link rel="modulepreload" crossorigin href="/assets/runtime-file-download-D6bwc3Kj.js">
99
99
  <link rel="modulepreload" crossorigin href="/assets/platform-sEg2IOLZ.js">
100
- <link rel="modulepreload" crossorigin href="/assets/types-Cl7nTpsb.js">
101
- <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-DjlyVxy_.js">
102
- <link rel="modulepreload" crossorigin href="/assets/native-config-BaRHaY4y.js">
103
- <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-BHOiBANF.js">
104
- <link rel="stylesheet" crossorigin href="/assets/src-PTWgTO6W.css">
100
+ <link rel="modulepreload" crossorigin href="/assets/types-QETHY-S7.js">
101
+ <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-GdNfjwXs.js">
102
+ <link rel="modulepreload" crossorigin href="/assets/native-config-C_mwkFzh.js">
103
+ <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-DxmJLWUO.js">
104
+ <link rel="stylesheet" crossorigin href="/assets/src-GtPQ8f4o.css">
105
105
  </head>
106
106
  <body class="h-full bg-background text-foreground">
107
107
  <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.31",
3
+ "version": "0.2.32-beta.10",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./server/index.js",
package/server/index.js CHANGED
@@ -1008,6 +1008,7 @@ const serverUtilsRuntime = createServerUtilsRuntime({
1008
1008
  openCodeServeVersion,
1009
1009
  }),
1010
1010
  getOpenCodeAuthHeaders,
1011
+ isRequestOriginAllowed,
1011
1012
  buildOpenCodeUrl,
1012
1013
  ensureOpenCodeApiPrefix,
1013
1014
  getUiNotificationClients: () => uiNotificationClients,
@@ -1819,6 +1820,7 @@ async function main(options = {}) {
1819
1820
  readSettingsStrict: readSettingsFromDiskStrict,
1820
1821
  remoteClientAuthRuntime,
1821
1822
  getLocalPort: () => tunnelRuntimeContext.getActivePort(),
1823
+ authorizeRequest: (req) => uiAuthController.authorizeRelayRequest(req),
1822
1824
  // One relay host per machine: every instance sharing this data dir shares
1823
1825
  // the relay identity (serverId), so concurrent hosts evict each other at
1824
1826
  // the relay worker and devices land on a random local instance.
@@ -1861,6 +1863,7 @@ async function main(options = {}) {
1861
1863
 
1862
1864
  await featureRoutesRuntime.registerRoutes(app, {
1863
1865
  express,
1866
+ uiAuthController,
1864
1867
  crypto,
1865
1868
  fs,
1866
1869
  os,
@@ -241,6 +241,7 @@ export const createClientPairingRuntime = ({
241
241
  const redeemPairingSession = async ({
242
242
  pairingId,
243
243
  secret,
244
+ viaRelay = false,
244
245
  clientLabel,
245
246
  clientKind,
246
247
  deviceName,
@@ -258,6 +259,7 @@ export const createClientPairingRuntime = ({
258
259
  const store = await readStore();
259
260
  const session = store.sessions.find((entry) => entry.id === normalizedId);
260
261
  if (!session) throw redeemError();
262
+ if (viaRelay && session.usesRelay !== true) throw redeemError();
261
263
  if (session.cancelledAt || session.usedAt) throw redeemError();
262
264
  if (Date.parse(session.expiresAt) <= Date.now()) throw redeemError();
263
265
  if (!session.allowedClientKinds.includes(normalizedKind)) throw redeemError();
@@ -6,6 +6,7 @@ import crypto from 'node:crypto';
6
6
 
7
7
  import { createClientPairingRuntime } from './pairing.js';
8
8
  import { createRemoteClientAuthRuntime } from './remote-clients.js';
9
+ import { createUiAuth } from '../ui-auth/ui-auth.js';
9
10
 
10
11
  const makeRuntime = async (options = {}) => {
11
12
  const dir = await fs.mkdtemp(path.join(os.tmpdir(), 'yuri-pairing-test-'));
@@ -36,10 +37,26 @@ const makeRuntime = async (options = {}) => {
36
37
  };
37
38
 
38
39
  describe('client auth pairing runtime', () => {
40
+ it('rejects relay redemption of a direct-only pairing without consuming it', async () => {
41
+ const { runtime, dir, remoteClientAuthRuntime } = await makeRuntime();
42
+ try {
43
+ const { pairing } = await runtime.createPairingSession();
44
+ const input = { pairingId: pairing.id, secret: pairing.secret, clientKind: 'mobile' };
45
+ await expect(runtime.redeemPairingSession({ ...input, viaRelay: true })).rejects.toThrow('Invalid or expired pairing session');
46
+ expect(remoteClientAuthRuntime.createClient).not.toHaveBeenCalled();
47
+ await expect(runtime.redeemPairingSession(input)).resolves.toMatchObject({ token: 'token-1' });
48
+ const relay = await runtime.createPairingSession({ usesRelay: true, relayUrl: 'wss://relay.example/ws' });
49
+ await expect(runtime.redeemPairingSession({
50
+ pairingId: relay.pairing.id, secret: relay.pairing.secret, viaRelay: true,
51
+ })).resolves.toMatchObject({ token: 'token-2' });
52
+ } finally { await fs.rm(dir, { recursive: true, force: true }); }
53
+ });
39
54
  it('keeps the same device paired through different relays independently across restart', async () => {
40
55
  const dir = await fs.mkdtemp(path.join(os.tmpdir(), 'yuri-pairing-relays-test-'));
41
56
  const authOptions = { fsPromises: fs, path, crypto, storePath: path.join(dir, 'clients.json') };
42
57
  const clients = createRemoteClientAuthRuntime(authOptions);
58
+ const relayAuth = createUiAuth({ requireClientAuth: true, clientAuthController: createRemoteClientAuthRuntime(authOptions) });
59
+ const authorize = (token) => relayAuth.authorizeRelayRequest({ method: 'GET', url: '/auth/session', headers: { authorization: `Bearer ${token}` } });
43
60
  const pairingOptions = {
44
61
  fsPromises: fs, path, crypto, storePath: path.join(dir, 'pairing.json'), remoteClientAuthRuntime: clients,
45
62
  };
@@ -54,6 +71,13 @@ describe('client auth pairing runtime', () => {
54
71
  try {
55
72
  const first = await pair('wss://relay-one.example/ws', 'Phone via first relay');
56
73
  const second = await pair('wss://relay-two.example/ws', 'Phone via second relay');
74
+ const ssh = await clients.createClient({ label: 'SSH', clientKind: 'desktop-local', authMethod: 'password' });
75
+ expect((await clients.authenticateBearerToken(ssh.token))?.ok).toBe(true);
76
+ expect(await authorize(ssh.token)).toBe(false);
77
+ await clients.revokeClient(ssh.client.id);
78
+ await clients.purgeRevokedClients();
79
+ expect(await authorize(first.token)).toBe(true);
80
+ expect(await authorize(second.token)).toBe(true);
57
81
  const reopened = createRemoteClientAuthRuntime(authOptions);
58
82
  expect((await reopened.listClients()).map((client) => client.id)).toEqual([first.client.id, second.client.id]);
59
83
  expect((await reopened.authenticateBearerToken(first.token))?.ok).toBe(true);
@@ -61,17 +85,22 @@ describe('client auth pairing runtime', () => {
61
85
 
62
86
  const replacement = await pair('wss://relay-one.example/ws', 'Phone via first relay again');
63
87
  expect(await reopened.authenticateBearerToken(first.token)).toBe(null);
88
+ expect(await authorize(first.token)).toBe(false);
89
+ expect(await authorize(replacement.token)).toBe(true);
64
90
  expect((await reopened.authenticateBearerToken(second.token))?.ok).toBe(true);
65
91
  expect((await reopened.authenticateBearerToken(replacement.token))?.ok).toBe(true);
66
92
  expect(await reopened.listClients()).toHaveLength(2);
67
93
 
68
94
  const direct = await pair(null, 'Phone via LAN');
95
+ expect(await authorize(direct.token)).toBe(false);
69
96
  expect(await reopened.listClients()).toHaveLength(3);
70
97
  await reopened.revokeClient(second.client.id);
71
98
  expect(await reopened.authenticateBearerToken(second.token)).toBe(null);
99
+ expect(await authorize(second.token)).toBe(false);
72
100
  expect((await reopened.authenticateBearerToken(replacement.token))?.ok).toBe(true);
73
101
  expect((await reopened.authenticateBearerToken(direct.token))?.ok).toBe(true);
74
102
  } finally {
103
+ relayAuth.dispose();
75
104
  await fs.rm(dir, { recursive: true, force: true });
76
105
  }
77
106
  });
@@ -15,7 +15,8 @@ Own the direction-agnostic OpenCode config sync contract: allowlist planning on
15
15
  | `selections.js` | Default/normalize/filter whitelist selections |
16
16
  | `scripts.js` | Probe / inventory / generational prepare / finalize / remote tar scripts |
17
17
  | `local-backup.js` | Local (pull destination) generational backup + tar extract |
18
- | `tar.js` | `collectLocalTarBuffer` (buffered) |
18
+ | `tar.js` | Buffered archive collection, SSH config-file staging and pull filtering |
19
+ | `plugins.js` | JSONC-preserving NPM plugin declaration filtering |
19
20
  | `engine.js` | `applyConfigSyncPlan` orchestration for **push** (prepare → putTar* → finalize) |
20
21
  | `credentials.js` | V2 credential API transfer, validation, account merge and in-memory rollback |
21
22
  | `magpie.js` | Host-local Magpie discovery, verified CLI provisioning, native backup/restore |
@@ -46,6 +47,7 @@ Within one direction, scope changes retain the displayed preview and discovered
46
47
  ## Invariants
47
48
 
48
49
  - The allowlist includes OpenCode configuration and generic extension directories, not plugin-specific configuration files or private state directories. Existing excluded files are neither copied nor deleted.
50
+ - SSH config copies retain only NPM registry plugin declarations (strings, legacy `plugin` tuples and V2 `plugins` objects), preserving versions, options and unrelated JSONC/comments. Push injects `collectSshConfigTarBuffer` into the existing engine: only configuration files are staged, and other entries are packed directly from the source. Pull filters its POSIX archive locally before destination prepare. Invalid JSONC fails before target mutation; temporary copies are cleaned on success/failure. Source configuration and existing directory-selection semantics are unchanged. Direct/Relay keep their existing transfer behavior.
49
51
  - Plan is computed on the source filesystem/inventory snapshot; destination executors never re-walk the source.
50
52
  - All local, HTTP and SSH archive builders exclude `node_modules`, `.venv-asc` and `*.backup`
51
53
  at every depth, including followed symlinks, matching the inventory walk. Keep
@@ -92,13 +94,15 @@ Discovery checks `MAGPIE_BINARY`, PATH, the user's `.local/bin`, macOS applicati
92
94
 
93
95
  Selecting Magpie uses its native `backup` / `restore` with configuration, API keys, profiles, agent models, library and portable plugin declarations. Native provider/group restore merges by ID and does not propagate deletions; settings and library follow Magpie's own restore semantics, retaining machine-local settings. This is a full native bundle, not a provider-only restore.
94
96
 
95
- The v2 envelope additionally carries recognized plugin API/OAuth accounts and self-contained saved Codex credentials. The source CLI account inventory limits export to recognized providers; hidden and orphaned plugin sign-ins are excluded. Plugin accounts merge by their native account key into `plugin-auth.json` under Magpie's exclusive-create lock, using a private atomic replacement. Destination-only accounts remain; repeated transfers do not append duplicates. Codex uses native `accounts import codex --yes`, which owns account identity/deduplication and the OS-level `logins.json` lock. Yuri never writes `logins.json` or copies machine-local account homes. A spent or expired ChatGPT refresh token can make the native Codex import exit non-zero even when the destination already holds that account; import then continues and the post-transfer `accounts --json` inventory decides success. Other subscription formats and accounts discovered only from external clients are not inferred or silently treated as transferred: unsupported active source accounts produce `sign_in_required`. An import re-reads `accounts --json` and requires all transferred plugin account counts and Codex identities to be recognized before returning success. Plugin diagnostics on stderr are ignored when recovering the top-level JSON array from the merged CLI streams. This checks discovery, not successful model inference or future token renewal; revoked credentials still require login.
97
+ The v2 envelope additionally carries recognized plugin API/OAuth accounts and self-contained saved Codex credentials. The source CLI account inventory limits export to recognized providers; hidden and orphaned plugin sign-ins are excluded. Plugin accounts merge by their native account key into `plugin-auth.json` under Magpie's exclusive-create lock, using a private atomic replacement. Destination-only accounts remain; repeated transfers do not append duplicates. Codex uses native `accounts import codex --yes`, which owns account identity/deduplication and the OS-level `logins.json` lock. Yuri never writes `logins.json` or copies machine-local account homes. A spent or expired ChatGPT refresh token can make the native Codex import exit non-zero even when the destination already holds that account; import then continues and the post-transfer `accounts --json` inventory decides success. Other subscription formats and accounts discovered only from external clients are not inferred or silently treated as transferred: unsupported active source accounts still unavailable at the destination produce `sign_in_required`. An import re-reads `accounts --json` and requires all transferred plugin account counts and Codex identities to be recognized before returning success. Plugin diagnostics on stderr are ignored when recovering the top-level JSON array from the merged CLI streams. This checks discovery, not successful model inference or future token renewal; revoked credentials still require login.
96
98
 
97
- Codex rejection exception: only exit code 1 with the native `ChatGPT didn't take the refresh token` diagnostic is skippable. That account is excluded from required identity verification, subsequent accounts continue, and the receipt always includes `sign_in_required`, even if the destination already recognizes the account. All other import failures (including network errors, timeouts and filesystem errors) still abort. Raw CLI output is never included in the classified error. This exception supersedes the inventory-only success rule above; all non-rejected accounts still require verification.
99
+ Codex rejection exception: only exit code 1 with the native `ChatGPT didn't take the refresh token` diagnostic is skippable. That account is excluded from required identity verification and subsequent accounts continue. The final inventory suppresses `sign_in_required` only when the same account identity is recognized without a native `lapsed` marker; a different account for the same provider does not suffice. All other import failures (including network errors, timeouts and filesystem errors) still abort. Raw CLI output is never included in the classified error; all non-rejected accounts still require verification, even when an unrelated plugin failed to install.
100
+
101
+ New v2 senders include `authorization.untransferred`, a bounded list of `{ agent, user? }` identities for recognized source accounts whose credentials cannot be exported. It contains no credential fields and stays inside the sensitive transfer envelope, never receipts or run records. Receivers compare these identities with the final destination inventory instead of treating the source's `incomplete` flag as a permanent warning. Old v2 senders without this list retain their conservative `incomplete` warning; old receivers can ignore the optional list. Validation rejects malformed lists or lists inconsistent with `incomplete` before installation or writes.
98
102
 
99
103
  Missing destination executables are installed only when Magpie is explicitly selected for import, never in preview or ordinary OpenCode sync. The host selects the official pure CLI asset for macOS/Linux/Windows x64/arm64 from `https://usemagpie.ai/api/latest`, verifies SHA-256, checks `--version`, then atomically publishes it under `<YURI_DATA_DIR>/tools/magpie/` (default `~/.config/yuri`). Existing desktop clients and CLIs are reused. Installation is process-local single-flight, needs no global PATH change or desktop environment, and fails explicitly for unsupported platforms or unverifiable downloads.
100
104
 
101
- Selected sync also publishes `~/.local/bin/magpie` (`magpie.exe` on Windows), a path searched explicitly by `opencode-magpie-plugin`. POSIX uses a symlink, Windows a hard link for installed-mode data and a symlink for portable data; unsupported linking fails explicitly. Existing valid user commands using the same data directory are retained; conflicting/broken entries are not overwritten. Shared-service and private OpenCode startup repair the command entry for an already managed CLI before launching OpenCode; they never download Magpie just because Yuri starts. SSH/direct/Relay push and pull apply Magpie before OpenCode config archives, preventing a newly synced plugin from loading before its dependency is installed. Native agent settings skipped before sign-in are retried after authorization succeeds.
105
+ Selected sync also publishes `~/.local/bin/magpie` (`magpie.exe` on Windows), a path searched explicitly by `opencode-magpie-plugin`. POSIX uses a symlink, Windows a hard link for installed-mode data and a symlink for portable data; unsupported linking fails explicitly. Existing valid user commands using the same data directory are retained; conflicting/broken entries are not overwritten. Shared-service and private OpenCode startup repair the command entry for an already managed CLI before launching OpenCode; they never download Magpie just because Yuri starts. SSH/direct/Relay push and pull apply Magpie before OpenCode config archives, preventing a newly synced plugin from loading before its dependency is installed. Native restore is retried once after authorization when its first result reports missing sign-ins, plugin installation failures, or skipped agent settings. The last restore result replaces all earlier restore warnings, and account verification runs after that retry. Genuine agent skips (including agents not installed on the destination) remain warnings. Only native result lines are classified, not matching phrases embedded in plugin diagnostics. Sign-in requirements for backed-up providers come from this final native result rather than scanning unrelated destination providers or reimplementing Magpie's provider aliases.
102
106
 
103
107
  The `magpie` transfer kind exports a bounded `magpie-sync-v2` JSON envelope containing the encrypted native backup, a random per-transfer passphrase and portable authorizations. The envelope is sensitive and stays in memory on authenticated sync transports; Relay adds its existing E2EE. New receivers accept old `magpie-sync-v1` config-only envelopes with the original warning behavior; old receivers reject v2 rather than silently discarding its accounts. Upgrade both hosts for authorization sync. Validate the entire envelope before installation or restore. Passphrases go to child stdin, never argv, run logs or disk. Private temporary directories hold native encrypted backups and, during native Codex import only, a mode-0600 credential file; both are removed on success/failure. Raw child output is sanitized before reporting. A zero exit with genuinely missing/unsupported sign-ins, unavailable agent settings, or plugins that Magpie could not install returns `magpieWarnings` (`sign_in_required`, `agent_settings_skipped`, `plugin_install_failed`). Plugin-install failures no longer abort the transfer: remaining configuration and accounts continue, verification skips accounts for plugins that never appeared on the destination, and the receipt warns. The sign-in warning is recomputed after authorization transfer, not copied from the pre-transfer native restore. Receipts carry these codes through SSH/direct/Relay and desktop IPC to localized completion warnings. Provider/API-key, library and other account-import failures remain errors. CLI failure can leave configuration and earlier accounts applied; retry merges idempotently. There is no cross-application rollback, and process termination can interrupt cleanup.
104
108
 
@@ -43,7 +43,7 @@ export {
43
43
  sanitizeSyncRunIdForPath,
44
44
  shellQuote,
45
45
  } from './scripts.js';
46
- export { collectLocalTarBuffer } from './tar.js';
46
+ export { collectLocalTarBuffer, collectSshConfigTarBuffer, filterConfigSyncArchive } from './tar.js';
47
47
  export { applyConfigSyncPlan, probePathsForPlan } from './engine.js';
48
48
  export {
49
49
  buildDefaultSyncSelections,
@@ -30,7 +30,12 @@ export const validateMagpieAuth = (value) => {
30
30
  || !['api', 'oauth'].includes(auth.type)
31
31
  || (auth.type === 'api' ? typeof auth.key !== 'string' || !auth.key
32
32
  : typeof auth.access !== 'string' || typeof auth.refresh !== 'string'))
33
- || value.logins.some((row) => !portableLogin(row, value.plugins))) {
33
+ || value.logins.some((row) => !portableLogin(row, value.plugins))
34
+ || (value.untransferred !== undefined && (!Array.isArray(value.untransferred)
35
+ || value.incomplete !== (value.untransferred.length > 0)
36
+ || value.untransferred.some((row) => !object(row) || typeof row.agent !== 'string' || !row.agent
37
+ || (row.user !== undefined && typeof row.user !== 'string')
38
+ || Object.keys(row).some((key) => !['agent', 'user'].includes(key)))))) {
34
39
  throw new Error('Invalid Magpie authorization payload');
35
40
  }
36
41
  return value;
@@ -49,9 +54,10 @@ export const collectMagpieAuth = async (dir, accounts) => {
49
54
  const visiblePlugins = Object.fromEntries(Object.entries(plugins).filter(([key]) => available.has(key.split('#')[0])
50
55
  && !rows.some((row) => row.agent === `plugin:${key.split('#')[0]}` && row.home === key && row.hidden)));
51
56
  const logins = rows.filter((row) => !row.hidden && portableLogin(row, visiblePlugins));
52
- return validateMagpieAuth({ plugins: visiblePlugins, logins,
53
- incomplete: accounts.some((account) => !Object.keys(visiblePlugins).some((key) => key.split('#')[0] === account.agent)
54
- && !logins.some((row) => row.agent === account.agent && row.user === account.user)) });
57
+ const untransferred = accounts.filter((account) => !Object.keys(visiblePlugins).some((key) => key.split('#')[0] === account.agent)
58
+ && !logins.some((row) => row.agent === account.agent && row.user === account.user))
59
+ .map(({ agent, user }) => ({ agent, ...(typeof user === 'string' ? { user } : {}) }));
60
+ return validateMagpieAuth({ plugins: visiblePlugins, logins, incomplete: untransferred.length > 0, untransferred });
55
61
  };
56
62
 
57
63
  const writeStore = async (file, value) => {
@@ -26,6 +26,7 @@ describe('Magpie authorization transfer', () => {
26
26
  expect(result.plugins).toEqual(auth.plugins);
27
27
  expect(result.logins).toEqual([]);
28
28
  expect(result.incomplete).toBe(true);
29
+ expect(result.untransferred).toEqual([{ agent: 'chatgpt-api', user: 'fixture' }]);
29
30
  });
30
31
 
31
32
  it('does not turn corrupted stores into successful empty credentials', async () => {
@@ -75,5 +76,8 @@ describe('Magpie authorization transfer', () => {
75
76
  expect(() => verifyMagpieAuth(two, [{ agent: 'cursor' }])).toThrow('not recognized');
76
77
  expect(() => verifyMagpieAuth(two, [{ agent: 'cursor' }, { agent: 'cursor' }])).not.toThrow();
77
78
  expect(() => verifyMagpieAuth(auth, {})).toThrow('verify');
79
+ expect(() => validateMagpieAuth({ ...auth, untransferred: 'unknown' })).toThrow();
80
+ expect(() => validateMagpieAuth({ ...auth, incomplete: true, untransferred: [{ agent: 'claude', user: {} }] })).toThrow();
81
+ expect(() => validateMagpieAuth({ ...auth, incomplete: true, untransferred: [] })).toThrow();
78
82
  });
79
83
  });
@@ -33,6 +33,16 @@ export const parseMagpieAccountsJson = (raw) => {
33
33
  }
34
34
  };
35
35
 
36
+ const readRestoreResult = (output) => {
37
+ if (/^Library:.*couldn't/im.test(output)) throw new Error('Magpie restore partially completed: library application failed. Check the target Magpie library.');
38
+ if (/^Needs a key\b/im.test(output)) throw new Error('Magpie restore partially completed: some providers still require API keys.');
39
+ return {
40
+ pluginInstallFailed: /^Couldn't add the plugin\b/im.test(output),
41
+ agentSettingsSkipped: /^Left as they are\b[^\r\n]*:[ \t]*\S/im.test(output),
42
+ needsSignIn: /^The backup's settings use these, not signed in on this computer\b/im.test(output),
43
+ };
44
+ };
45
+
36
46
  // Raw CLI output may contain provider names, paths or credentials. Never forward it.
37
47
  const runCli = (binary, args, { input = '', env, timeout = 600_000 } = {}) => new Promise((resolve, reject) => {
38
48
  const child = spawn(binary, args, { env, windowsHide: true, detached: process.platform !== 'win32', stdio: ['pipe', 'pipe', 'pipe'] });
@@ -262,10 +272,8 @@ export function createMagpieSync({
262
272
  try { output = await run(binary, ['restore', file], { env, input: `${decoded.passphrase}\n` }); }
263
273
  catch { throw new Error('Magpie restore failed; some configuration may already have been applied. Retry to finish.'); }
264
274
  // Private/unreachable plugin specs can fail while the rest of restore still applies.
265
- let pluginInstallFailed = /Couldn't add the plugin/i.test(output);
266
- if (/Library:.*couldn't/i.test(output)) throw new Error('Magpie restore partially completed: library application failed. Check the target Magpie library.');
267
- if (/Needs a key/i.test(output)) throw new Error('Magpie restore partially completed: some providers still require API keys.');
268
- let needsSignIn = /not signed in on this computer/i.test(output);
275
+ let result = readRestoreResult(output);
276
+ let needsSignIn = result.needsSignIn;
269
277
  if (decoded.format === 'magpie-sync-v2') {
270
278
  const dir = await dataDir(binary);
271
279
  const rejected = new Set();
@@ -282,39 +290,37 @@ export function createMagpieSync({
282
290
  }
283
291
  } finally { await fs.rm(credentialFile, { force: true }); }
284
292
  });
293
+ if (result.pluginInstallFailed || result.agentSettingsSkipped || result.needsSignIn) {
294
+ output = await run(binary, ['restore', file], { env, input: `${decoded.passphrase}\n` });
295
+ result = readRestoreResult(output);
296
+ }
285
297
  const accounts = parseMagpieAccountsJson(await run(binary, ['accounts', '--json'], { env }));
286
298
  const known = new Set(accounts.map((account) => account.agent));
287
299
  // Skip verification for plugins that never installed and for spent Codex tokens.
288
300
  const expected = {
289
301
  ...decoded.authorization,
290
302
  plugins: Object.fromEntries(Object.entries(decoded.authorization.plugins)
291
- .filter(([key]) => !pluginInstallFailed || known.has(key.split('#')[0]))),
303
+ .filter(([key]) => !result.pluginInstallFailed || known.has(key.split('#')[0]))),
292
304
  logins: decoded.authorization.logins.filter((row) => !rejected.has(row.auth)
293
- && (!pluginInstallFailed || known.has(row.agent.replace(/^plugin:/, '')))),
305
+ && (row.agent === 'codex' || !result.pluginInstallFailed || known.has(row.agent.replace(/^plugin:/, '')))),
294
306
  };
295
307
  verifyMagpieAuth(expected, accounts);
296
- const configured = JSON.parse(await fs.readFile(path.join(dir, 'providers.json'), 'utf8').catch((error) => {
297
- if (error.code === 'ENOENT') return '{"providers":[]}';
298
- throw error;
299
- }));
300
- if (!Array.isArray(configured.providers)) throw new Error();
301
- const signedIn = new Set(accounts.map((account) => account.agent));
302
- needsSignIn = rejected.size > 0 || decoded.authorization.incomplete || configured.providers.some((provider) =>
303
- !provider.hidden && provider.id && !['chat', 'responses', 'anthropic', 'gemini'].some((key) => provider[key])
304
- && !signedIn.has(provider.id));
305
- if (/Left as they are/i.test(output)) {
306
- output = await run(binary, ['restore', file], { env, input: `${decoded.passphrase}\n` });
307
- if (/Couldn't add the plugin/i.test(output)) pluginInstallFailed = true;
308
- if (/Needs a key|Library:.*couldn't/i.test(output)) throw new Error();
309
- }
308
+ const recognized = (row) => accounts.some((account) => account.agent === row.agent.replace(/^plugin:/, '')
309
+ && (row.user === undefined || String(account.user).toLowerCase() === row.user.toLowerCase())
310
+ && !account.lapsed);
311
+ needsSignIn = result.needsSignIn
312
+ || decoded.authorization.logins.some((row) => !recognized(row))
313
+ || (decoded.authorization.untransferred
314
+ ? decoded.authorization.untransferred.some((row) => !recognized(row))
315
+ : decoded.authorization.incomplete);
310
316
  } catch (error) {
311
317
  throw new Error('Magpie authorization sync or verification failed; some configuration and accounts may already be applied. Retry to finish.', { cause: error });
312
318
  }
313
319
  }
314
320
  const magpieWarnings = [];
315
321
  if (needsSignIn) magpieWarnings.push('sign_in_required');
316
- if (pluginInstallFailed) magpieWarnings.push('plugin_install_failed');
317
- if (/Left as they are/i.test(output)) magpieWarnings.push('agent_settings_skipped');
322
+ if (result.pluginInstallFailed) magpieWarnings.push('plugin_install_failed');
323
+ if (result.agentSettingsSkipped) magpieWarnings.push('agent_settings_skipped');
318
324
  return { ok: true, ...(magpieWarnings.length ? { magpieWarnings } : {}) };
319
325
  });
320
326
  }),
@@ -184,7 +184,7 @@ describe('Magpie discovery and native transfer', () => {
184
184
  if (args[1] === 'import') throw Object.assign(new Error('Magpie CLI operation failed or timed out'), { code: 'magpie_codex_authorization_rejected' });
185
185
  return '[{"agent":"codex","user":"fixture@example.invalid"}]';
186
186
  });
187
- await expect(createMagpieSync({ ...target.options, run }).import(payload)).resolves.toEqual({ ok: true, magpieWarnings: ['sign_in_required'] });
187
+ await expect(createMagpieSync({ ...target.options, run }).import(payload)).resolves.toEqual({ ok: true });
188
188
  });
189
189
 
190
190
  it('rejects malformed v2 authorization before installing or restoring', async () => {
@@ -236,7 +236,7 @@ else console.log('restored');
236
236
  const run = async (_binary, args) => {
237
237
  if (args[0] === '--version') return 'magpie 0.1.1319';
238
238
  if (args[0] === 'accounts') return '[]';
239
- return ++restores === 1 ? 'Left as they are' : 'restored';
239
+ return ++restores === 1 ? "Left as they are (agent not here, or its model can't be reached yet): codex.model" : 'restored';
240
240
  };
241
241
  const payload = Buffer.from(JSON.stringify({ format: 'magpie-sync-v2', passphrase: 'a'.repeat(64),
242
242
  backup: Buffer.from('{"format":"magpie-backup"}').toString('base64'),
@@ -245,6 +245,131 @@ else console.log('restored');
245
245
  expect(restores).toBe(2);
246
246
  });
247
247
 
248
+ it.each([
249
+ "Couldn't add the plugin fixture-plugin@latest: registry unavailable",
250
+ "Couldn't add the plugin fixture-plugin@latest: registry unavailable\nLeft as they are (agent not here, or its model can't be reached yet): codex.model",
251
+ "The backup's settings use these, not signed in on this computer (a backup carries settings, not sign-ins; to use one here: magpie accounts add <id>): fixture-plugin",
252
+ ])('rechecks accounts after a recovered restore and clears earlier warnings: %s', async (firstOutput) => {
253
+ const { home, options } = await machine();
254
+ await write(path.join(home, '.local/bin/magpie'), 'fixture');
255
+ let restores = 0;
256
+ const run = vi.fn(async (_binary, args) => {
257
+ if (args[0] === '--version') return 'magpie 0.1.1319';
258
+ if (args[0] === 'accounts') return restores === 2 ? '[{"agent":"fixture-plugin"}]' : '[]';
259
+ return ++restores === 1 ? firstOutput : 'restored';
260
+ });
261
+ const payload = Buffer.from(JSON.stringify({ format: 'magpie-sync-v2', passphrase: 'a'.repeat(64),
262
+ backup: Buffer.from('{"format":"magpie-backup"}').toString('base64'),
263
+ authorization: { plugins: { 'fixture-plugin': { type: 'api', key: 'fixture' } }, logins: [], incomplete: false } }));
264
+ await expect(createMagpieSync({ ...options, run }).import(payload)).resolves.toEqual({ ok: true });
265
+ expect(restores).toBe(2);
266
+ expect(run.mock.calls.at(-1)[1]).toEqual(['accounts', '--json']);
267
+ });
268
+
269
+ it.each([true, false, 'lapsed'])('checks an untransferred account by identity on the destination (recognized=%s)', async (recognized) => {
270
+ const source = await machine();
271
+ const target = await machine();
272
+ for (const item of [source, target]) await write(path.join(item.home, '.local/bin/magpie'), 'fixture');
273
+ await write(path.join(source.home, '.config/magpie/providers.json'), '{"providers":[{"id":"claude"}]}');
274
+ const payload = await createMagpieSync({ ...source.options, run: async (_binary, args) => {
275
+ if (args[0] === '--version') return 'magpie 0.1.1319';
276
+ if (args[0] === 'accounts') return '[{"agent":"claude","user":"fixture@example.invalid"}]';
277
+ await write(args[1], '{"format":"magpie-backup"}');
278
+ return 'saved';
279
+ } }).download();
280
+ const run = async (_binary, args) => {
281
+ if (args[0] === '--version') return 'magpie 0.1.1319';
282
+ if (args[0] === 'accounts') return JSON.stringify([{ agent: 'claude',
283
+ user: recognized ? 'FIXTURE@example.invalid' : 'other@example.invalid',
284
+ ...(recognized === 'lapsed' ? { lapsed: 'signed out' } : {}),
285
+ }]);
286
+ return 'restored';
287
+ };
288
+ await expect(createMagpieSync({ ...target.options, run }).import(payload)).resolves.toEqual(
289
+ recognized === true ? { ok: true } : { ok: true, magpieWarnings: ['sign_in_required'] },
290
+ );
291
+ });
292
+
293
+ it('does not mistake plugin diagnostics quoting restore text for a restore warning', async () => {
294
+ const { home, options } = await machine();
295
+ await write(path.join(home, '.local/bin/magpie'), 'fixture');
296
+ const run = async (_binary, args) => args[0] === '--version' ? 'magpie 0.1.1319'
297
+ : args[0] === 'accounts' ? '[]'
298
+ : "plugin [debug]: Left as they are: fixture\nplugin [debug]: Couldn't add the plugin fixture\nrestored";
299
+ const payload = Buffer.from(JSON.stringify({ format: 'magpie-sync-v2', passphrase: 'a'.repeat(64),
300
+ backup: Buffer.from('{"format":"magpie-backup"}').toString('base64'),
301
+ authorization: { plugins: {}, logins: [], incomplete: false } }));
302
+ await expect(createMagpieSync({ ...options, run }).import(payload)).resolves.toEqual({ ok: true });
303
+ });
304
+
305
+ it('keeps genuine final warnings and bounds the post-authorization restore to one retry', async () => {
306
+ const { home, options } = await machine();
307
+ await write(path.join(home, '.local/bin/magpie'), 'fixture');
308
+ let restores = 0;
309
+ const run = async (_binary, args) => {
310
+ if (args[0] === '--version') return 'magpie 0.1.1319';
311
+ if (args[0] === 'accounts') return '[]';
312
+ restores++;
313
+ return "Couldn't add the plugin fixture-plugin: missing\nLeft as they are (agent not here, or its model can't be reached yet): codex.model\nThe backup's settings use these, not signed in on this computer (a backup carries settings, not sign-ins; to use one here: magpie accounts add <id>): claude";
314
+ };
315
+ const payload = Buffer.from(JSON.stringify({ format: 'magpie-sync-v2', passphrase: 'a'.repeat(64),
316
+ backup: Buffer.from('{"format":"magpie-backup"}').toString('base64'),
317
+ authorization: { plugins: {}, logins: [], incomplete: false } }));
318
+ await expect(createMagpieSync({ ...options, run }).import(payload)).resolves.toEqual({ ok: true,
319
+ magpieWarnings: ['sign_in_required', 'plugin_install_failed', 'agent_settings_skipped'] });
320
+ expect(restores).toBe(2);
321
+ });
322
+
323
+ it('retains the warning for older v2 senders with unknown untransferred identities', async () => {
324
+ const { home, options } = await machine();
325
+ await write(path.join(home, '.local/bin/magpie'), 'fixture');
326
+ const run = async (_binary, args) => args[0] === '--version' ? 'magpie 0.1.1319' : args[0] === 'accounts' ? '[]' : 'restored';
327
+ const payload = Buffer.from(JSON.stringify({ format: 'magpie-sync-v2', passphrase: 'a'.repeat(64),
328
+ backup: Buffer.from('{"format":"magpie-backup"}').toString('base64'),
329
+ authorization: { plugins: {}, logins: [], incomplete: true } }));
330
+ await expect(createMagpieSync({ ...options, run }).import(payload)).resolves.toEqual({ ok: true, magpieWarnings: ['sign_in_required'] });
331
+ });
332
+
333
+ it('does not use unrelated destination provider entries to produce sign-in warnings', async () => {
334
+ const { home, options } = await machine();
335
+ await write(path.join(home, '.local/bin/magpie'), 'fixture');
336
+ await write(path.join(home, '.config/magpie/providers.json'), '{"providers":[{"id":"destination-only"}]}');
337
+ const run = async (_binary, args) => args[0] === '--version' ? 'magpie 0.1.1319' : args[0] === 'accounts' ? '[]' : 'restored';
338
+ const payload = Buffer.from(JSON.stringify({ format: 'magpie-sync-v2', passphrase: 'a'.repeat(64),
339
+ backup: Buffer.from('{"format":"magpie-backup"}').toString('base64'),
340
+ authorization: { plugins: {}, logins: [], incomplete: false, untransferred: [] } }));
341
+ await expect(createMagpieSync({ ...options, run }).import(payload)).resolves.toEqual({ ok: true });
342
+ });
343
+
344
+ it.each(['missing-account', 'unrelated-plugin-failure', 'key-failure', 'library-failure', 'accounts-failure'])(
345
+ 'does not hide a final failure behind an earlier recoverable warning: %s', async (failure) => {
346
+ const { home, options } = await machine();
347
+ await write(path.join(home, '.local/bin/magpie'), 'fixture');
348
+ let restores = 0;
349
+ const run = async (_binary, args) => {
350
+ if (args[0] === '--version') return 'magpie 0.1.1319';
351
+ if (args[0] === 'accounts') {
352
+ if (failure === 'accounts-failure') throw new Error('offline');
353
+ return '[]';
354
+ }
355
+ if (args[0] === 'restore') {
356
+ if (++restores === 1 || failure === 'unrelated-plugin-failure') return "Couldn't add the plugin fixture-plugin: missing";
357
+ if (failure === 'key-failure') return 'Needs a key (magpie provider key <id>): fixture';
358
+ if (failure === 'library-failure') return "Library: fixture couldn't get skills: denied";
359
+ }
360
+ return 'restored';
361
+ };
362
+ const authorization = failure === 'unrelated-plugin-failure'
363
+ ? { plugins: {}, logins: [{ agent: 'codex', user: 'fixture', auth: { tokens: {} } }], incomplete: false }
364
+ : { plugins: { 'fixture-plugin': { type: 'api', key: 'fixture' } }, logins: [], incomplete: false };
365
+ const payload = Buffer.from(JSON.stringify({ format: 'magpie-sync-v2', passphrase: 'a'.repeat(64),
366
+ backup: Buffer.from('{"format":"magpie-backup"}').toString('base64'), authorization }));
367
+ await expect(createMagpieSync({ ...options, run }).import(payload)).rejects.toThrow('authorization sync or verification failed');
368
+ expect(restores).toBe(2);
369
+ expect((await fs.readdir(home)).filter((name) => name.startsWith('yuri-magpie-'))).toEqual([]);
370
+ },
371
+ );
372
+
248
373
  it('does not install on malformed payload and refuses partial restore without leaking CLI output', async () => {
249
374
  const { home, options } = await machine();
250
375
  const fetchImpl = vi.fn();