@yuriai/web 0.2.31 → 0.2.32-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AgentAvatar-DLAQkFQe.js → AgentAvatar-DG1RbFtI.js} +1 -1
- package/dist/assets/{AssistantContactStatus-DZGGspw4.js → AssistantContactStatus-DKbVOZjo.js} +3 -3
- package/dist/assets/{AssistantUnreadBadge-BynxNQMk.js → AssistantUnreadBadge-ftPNMymo.js} +1 -1
- package/dist/assets/{AssistantView-CDZyA9ft.js → AssistantView-CblJ2zy9.js} +1 -1
- package/dist/assets/{DiagramView-DdVFGHQQ.js → DiagramView-DXqhOl9l.js} +1 -1
- package/dist/assets/{FadeInOnReveal-C9a7XnAh.js → FadeInOnReveal-Bmxvkrf4.js} +1 -1
- package/dist/assets/{GuiPluginSurface-v8r-Hex5.js → GuiPluginSurface-m-Noj3aa.js} +1 -1
- package/dist/assets/{GuiPluginWindow-Ba1HfrjQ.js → GuiPluginWindow-CwP_vUoC.js} +1 -1
- package/dist/assets/{Icon-Bh3TaKoN.js → Icon-BOYrvHyJ.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-Dcy5lc7F.js → ImageLoadingPlaceholder-DlosWH_9.js} +1 -1
- package/dist/assets/{LoadingImage-BxjJ_Xyj.js → LoadingImage-D9r0ukc0.js} +1 -1
- package/dist/assets/MarkdownRenderer-DoXuuJkV.js +2 -0
- package/dist/assets/{MarkdownRendererImpl-Bdwe3qUr.js → MarkdownRendererImpl-BYuuFNfa.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-CCQj9IkL.js → MarkstreamRendererImpl-IKDf9jte.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-o54juFXD.js → MobileDetailNavigation-sEqCaRnY.js} +1 -1
- package/dist/assets/{MobileResizableSheet-sV9XR-0k.js → MobileResizableSheet-vAenroLZ.js} +1 -1
- package/dist/assets/{MobileShareBridge-oqBZ_f6M.js → MobileShareBridge-G3-CumcS.js} +1 -1
- package/dist/assets/{MobileTabPageHeader-CptcDWNS.js → MobileTabPageHeader-C8RbWBKV.js} +1 -1
- package/dist/assets/{MultiRunWindow-7W_86vL6.js → MultiRunWindow-CDpvE-zO.js} +1 -1
- package/dist/assets/{OnboardingScreen-CnkijSLE.js → OnboardingScreen-DNlK3zfZ.js} +1 -1
- package/dist/assets/{OverlayScrollbar-CCtBTJQj.js → OverlayScrollbar-W17unuIx.js} +1 -1
- package/dist/assets/{SettingsView-CkJpYIMe.js → SettingsView-Das1IHAu.js} +14 -14
- package/dist/assets/{SettingsWindow-C0HiNvXh.js → SettingsWindow-C7rgO3qt.js} +1 -1
- package/dist/assets/SetupTourDialog-BkbTIz8M.js +1 -0
- package/dist/assets/{TerminalView-y36H_fIe.js → TerminalView-DsIVQDlk.js} +1 -1
- package/dist/assets/{ToolOutputDialog-BfjBeqGS.js → ToolOutputDialog-BH3bOjDw.js} +1 -1
- package/dist/assets/{VoiceSettings-BONwzGgR.js → VoiceSettings-BlU2CJhd.js} +2 -2
- package/dist/assets/{YuriLogo-BA5FWp-g.js → YuriLogo-XH6UGXtF.js} +1 -1
- package/dist/assets/{appThemeRegistry-BsLMp3bc.js → appThemeRegistry-DMSk1I5B.js} +1 -1
- package/dist/assets/{button-CBjOhOI0.js → button-CyJvQsp5.js} +1 -1
- package/dist/assets/{capgoAdapter-DjlyVxy_.js → capgoAdapter-D8I8oJcn.js} +1 -1
- package/dist/assets/{collapsible-B0j5IQ0T.js → collapsible-CXjDO6DW.js} +1 -1
- package/dist/assets/{context-menu-C4e_bpls.js → context-menu-BajfnPcW.js} +1 -1
- package/dist/assets/{desktopRelayRestore-AE3_TnQz.js → desktopRelayRestore-DS44uXtb.js} +1 -1
- package/dist/assets/{diagram-WPmk0Qh6.js → diagram-_Js3imTf.js} +1 -1
- package/dist/assets/{dialog-Dx3IT7dQ.js → dialog-Bapd6e10.js} +1 -1
- package/dist/assets/{es-JU--16Gd.js → es-CBhZ80Z7.js} +2 -2
- package/dist/assets/{fileMentionTouchSelection-Bizsisaj.js → fileMentionTouchSelection-BqGxOZhB.js} +1 -1
- package/dist/assets/{fr-BUZcRuMk.js → fr-D9s0sHDF.js} +2 -2
- package/dist/assets/{gitApi-CNgEj6X5.js → gitApi-D92RH8FG.js} +1 -1
- package/dist/assets/{input-CEJGM-TS.js → input-SCAHBeSU.js} +1 -1
- package/dist/assets/{insertionBoundaries-CgYf6gys.js → insertionBoundaries-tD7rJ-pN.js} +1 -1
- package/dist/assets/{ja-BwtVLTXD.js → ja-BXQ3ox8H.js} +2 -2
- package/dist/assets/{ko--sLsRFpA.js → ko-DlUti1wK.js} +2 -2
- package/dist/assets/{main-DrqtyqDc.js → main-2gplybqp.js} +2 -2
- package/dist/assets/{main-B8FcBwPM.js → main-BalwAS4v.js} +4 -4
- package/dist/assets/{markdownHeightCache-D6iSNJG2.js → markdownHeightCache-B3MTnGA8.js} +1 -1
- package/dist/assets/{mcpQueries-DVSsZeuk.js → mcpQueries-Bvd8i21K.js} +1 -1
- package/dist/assets/{miniChat-CgeCl4RY.js → miniChat-CDgmbnvp.js} +2 -2
- package/dist/assets/{mobile-DAhJKHUq.js → mobile-B7XDs1Ej.js} +2 -2
- package/dist/assets/{mobileBackNavigation-Dmbf0kw1.js → mobileBackNavigation-AlDzsLZE.js} +1 -1
- package/dist/assets/{multirun-BbWnHeaY.js → multirun-Dvx2CH5O.js} +1 -1
- package/dist/assets/{native-config-BaRHaY4y.js → native-config-BfwOD9gu.js} +1 -1
- package/dist/assets/{pl-C4_4J5yA.js → pl-B7LIbV2C.js} +2 -2
- package/dist/assets/{projectMeta-rrpZdm8D.js → projectMeta-CDOI8wVV.js} +1 -1
- package/dist/assets/{pt-BR-DvNC5K1q.js → pt-BR-DyusczdZ.js} +2 -2
- package/dist/assets/{pwa-Dm_DJEr9.js → pwa-SCu_PpmX.js} +1 -1
- package/dist/assets/{queue-abort-optimistic-CSkERbr4.js → queue-abort-optimistic-C-AN4RTx.js} +1 -1
- package/dist/assets/{readiness-BnO7IaZV.js → readiness-CrZ59Om9.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-Bq3iNKtr.js → renderElectronMiniChatApp-D9PyhLc-.js} +2 -2
- package/dist/assets/{renderMobileApp-DiNeMgwp.js → renderMobileApp-JQguy_5y.js} +4 -4
- package/dist/assets/{runtimeConfig-BHOiBANF.js → runtimeConfig-DfLCc7A9.js} +1 -1
- package/dist/assets/runtimeEndpointReset-B--BY0YO.js +149 -0
- package/dist/assets/{select-bKMw5JE8.js → select-BCLecCtX.js} +1 -1
- package/dist/assets/{sessionLookup-DGNxfDsP.js → sessionLookup-cyEN12a0.js} +1 -1
- package/dist/assets/{sortable-tabs-strip-3sKiA7T1.js → sortable-tabs-strip-D474PwS8.js} +1 -1
- package/dist/assets/{speechSettingsQueries-BDDxw8LP.js → speechSettingsQueries-DHdSg2sh.js} +1 -1
- package/dist/assets/{src-PTWgTO6W.css → src-BqubNQyD.css} +1 -1
- package/dist/assets/{store-X3lU0obe.js → store-Diaywtmi.js} +4 -4
- package/dist/assets/{textarea-EsaDD051.js → textarea-CWQIq-Mn.js} +1 -1
- package/dist/assets/{tooltip-LLDL5nIZ.js → tooltip-D3WmiZ7G.js} +1 -1
- package/dist/assets/tour-DeA0Ksvj.js +1 -0
- package/dist/assets/types-DXHiIS-0.js +2 -0
- package/dist/assets/{uk-Dvj0JjiC.js → uk-BrwM67Dh.js} +2 -2
- package/dist/assets/{useAppFontEffects-wIWWE59b.js → useAppFontEffects-DdgYioGO.js} +13 -13
- package/dist/assets/{useDesktopWindowControlsLayout-CdUr9mCZ.js → useDesktopWindowControlsLayout-CZryTaVG.js} +1 -1
- package/dist/assets/{useDictation-DlEHSN6P.js → useDictation-C-waWdAq.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-DzqpWUC3.js → useEffectiveDirectory-DkFV660l.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-BWLhXqci.js → useMobileNavigationStore-BUlbm442.js} +7 -7
- package/dist/assets/usePluginsStore-cBba-pcU.js +1 -0
- package/dist/assets/{useWorkerHighlightedLines-DMS69wKa.js → useWorkerHighlightedLines-CdxTrkgu.js} +1 -1
- package/dist/assets/{zh-CN-2Y6u8t24.js → zh-CN-D9NAFloZ.js} +2 -2
- package/dist/assets/{zh-TW-Z5wVv4Fb.js → zh-TW-tuUKOuhs.js} +2 -2
- package/dist/index.html +7 -7
- package/dist/mini-chat.html +7 -7
- package/dist/mobile.html +7 -7
- package/package.json +1 -1
- package/server/lib/config-sync/DOCUMENTATION.md +8 -4
- package/server/lib/config-sync/index.js +1 -1
- package/server/lib/config-sync/magpie-auth.js +10 -4
- package/server/lib/config-sync/magpie-auth.test.js +4 -0
- package/server/lib/config-sync/magpie.js +28 -22
- package/server/lib/config-sync/magpie.test.js +127 -2
- package/server/lib/config-sync/plugins.js +44 -0
- package/server/lib/config-sync/plugins.test.js +64 -0
- package/server/lib/config-sync/tar.js +61 -1
- package/server/lib/opencode/DOCUMENTATION.md +2 -0
- package/server/lib/opencode/plugin-routes.test.js +1 -0
- package/server/lib/opencode/plugins.js +1 -1
- package/server/lib/opencode/plugins.test.js +3 -2
- package/server/lib/opencode/settings-runtime.js +8 -6
- package/server/lib/opencode/settings-runtime.test.js +44 -0
- package/dist/assets/MarkdownRenderer-CS6Pia5D.js +0 -2
- package/dist/assets/SetupTourDialog-BcEbaEO3.js +0 -1
- package/dist/assets/runtimeEndpointReset-DGxT24oE.js +0 -149
- package/dist/assets/tour-Db44qwfs.js +0 -1
- package/dist/assets/types-Cl7nTpsb.js +0 -2
- package/dist/assets/usePluginsStore-aZl0WTK8.js +0 -1
package/dist/index.html
CHANGED
|
@@ -571,7 +571,7 @@
|
|
|
571
571
|
opacity: 0.72;
|
|
572
572
|
}
|
|
573
573
|
</style>
|
|
574
|
-
<script type="module" crossorigin src="/assets/main-
|
|
574
|
+
<script type="module" crossorigin src="/assets/main-2gplybqp.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">
|
|
@@ -579,7 +579,7 @@
|
|
|
579
579
|
<link rel="modulepreload" crossorigin href="/assets/runtimeAPIRegistry-C2VogTny.js">
|
|
580
580
|
<link rel="modulepreload" crossorigin href="/assets/desktop-BAmoc_34.js">
|
|
581
581
|
<link rel="modulepreload" crossorigin href="/assets/desktopHosts-CMglnUdS.js">
|
|
582
|
-
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-
|
|
582
|
+
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-DS44uXtb.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-
|
|
608
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
609
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
610
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
611
|
-
<link rel="stylesheet" crossorigin href="/assets/src-
|
|
607
|
+
<link rel="modulepreload" crossorigin href="/assets/types-DXHiIS-0.js">
|
|
608
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-D8I8oJcn.js">
|
|
609
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-BfwOD9gu.js">
|
|
610
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-DfLCc7A9.js">
|
|
611
|
+
<link rel="stylesheet" crossorigin href="/assets/src-BqubNQyD.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
|
package/dist/mini-chat.html
CHANGED
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
.dark #initial-loading img { filter: invert(1); }
|
|
78
78
|
</style>
|
|
79
79
|
|
|
80
|
-
<script type="module" crossorigin src="/assets/miniChat-
|
|
80
|
+
<script type="module" crossorigin src="/assets/miniChat-CDgmbnvp.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">
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
<link rel="modulepreload" crossorigin href="/assets/runtimeAPIRegistry-C2VogTny.js">
|
|
86
86
|
<link rel="modulepreload" crossorigin href="/assets/desktop-BAmoc_34.js">
|
|
87
87
|
<link rel="modulepreload" crossorigin href="/assets/desktopHosts-CMglnUdS.js">
|
|
88
|
-
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-
|
|
88
|
+
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-DS44uXtb.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-
|
|
114
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
115
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
116
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
117
|
-
<link rel="stylesheet" crossorigin href="/assets/src-
|
|
113
|
+
<link rel="modulepreload" crossorigin href="/assets/types-DXHiIS-0.js">
|
|
114
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-D8I8oJcn.js">
|
|
115
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-BfwOD9gu.js">
|
|
116
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-DfLCc7A9.js">
|
|
117
|
+
<link rel="stylesheet" crossorigin href="/assets/src-BqubNQyD.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,7 +64,7 @@
|
|
|
64
64
|
</script>
|
|
65
65
|
|
|
66
66
|
<style>.dark #mobile-startup-logo img { filter: invert(1); }</style>
|
|
67
|
-
<script type="module" crossorigin src="/assets/mobile-
|
|
67
|
+
<script type="module" crossorigin src="/assets/mobile-B7XDs1Ej.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">
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
<link rel="modulepreload" crossorigin href="/assets/runtimeAPIRegistry-C2VogTny.js">
|
|
73
73
|
<link rel="modulepreload" crossorigin href="/assets/desktop-BAmoc_34.js">
|
|
74
74
|
<link rel="modulepreload" crossorigin href="/assets/desktopHosts-CMglnUdS.js">
|
|
75
|
-
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-
|
|
75
|
+
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-DS44uXtb.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-
|
|
101
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
102
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
103
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
104
|
-
<link rel="stylesheet" crossorigin href="/assets/src-
|
|
100
|
+
<link rel="modulepreload" crossorigin href="/assets/types-DXHiIS-0.js">
|
|
101
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-D8I8oJcn.js">
|
|
102
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-BfwOD9gu.js">
|
|
103
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-DfLCc7A9.js">
|
|
104
|
+
<link rel="stylesheet" crossorigin href="/assets/src-BqubNQyD.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
|
@@ -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` |
|
|
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
|
|
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
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
|
266
|
-
|
|
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
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
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 (
|
|
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
|
|
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 ?
|
|
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();
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { applyEdits, createScanner, getNodeValue, parseTree, SyntaxKind } from 'jsonc-parser';
|
|
2
|
+
import { isPathSpec, parseNpmSpec } from '../opencode/plugin-spec.js';
|
|
3
|
+
|
|
4
|
+
const isNpmPlugin = (entry) => {
|
|
5
|
+
const value = Array.isArray(entry) ? entry[0] : (typeof entry === 'object' && entry !== null ? entry.package : entry);
|
|
6
|
+
if (typeof value !== 'string') return false;
|
|
7
|
+
const spec = value.trim();
|
|
8
|
+
if (isPathSpec(spec)) return false;
|
|
9
|
+
const parsed = parseNpmSpec(spec);
|
|
10
|
+
if (parsed.malformed || !/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/i.test(parsed.name)) return false;
|
|
11
|
+
return parsed.version === null || /^[\w.*+~^<>=| -]+$/.test(parsed.version);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** Keep portable registry declarations without rewriting unrelated JSONC content. */
|
|
15
|
+
export const filterSyncedPluginConfig = (content) => {
|
|
16
|
+
const bom = content.startsWith('\uFEFF') ? '\uFEFF' : '';
|
|
17
|
+
const text = content.slice(bom.length);
|
|
18
|
+
const errors = [];
|
|
19
|
+
const tree = parseTree(text, errors, { allowTrailingComma: true, allowEmptyContent: true });
|
|
20
|
+
const invalid = () => new Error('Cannot sync plugins: invalid OpenCode JSONC configuration');
|
|
21
|
+
if (errors.length || (tree && tree.type !== 'object')) throw invalid();
|
|
22
|
+
const seen = new Set();
|
|
23
|
+
const edits = [];
|
|
24
|
+
for (const property of tree?.children || []) {
|
|
25
|
+
const [keyNode, valueNode] = property.children;
|
|
26
|
+
const key = keyNode.value;
|
|
27
|
+
if (key !== 'plugins' && key !== 'plugin') continue;
|
|
28
|
+
if (seen.has(key) || valueNode.type !== 'array') throw invalid();
|
|
29
|
+
seen.add(key);
|
|
30
|
+
const entries = valueNode.children || [];
|
|
31
|
+
const keep = entries.map((entry) => isNpmPlugin(getNodeValue(entry)));
|
|
32
|
+
if (keep.every(Boolean)) continue;
|
|
33
|
+
const lastKept = keep.lastIndexOf(true);
|
|
34
|
+
const scanner = createScanner(text, true);
|
|
35
|
+
for (const [index, entry] of entries.entries()) {
|
|
36
|
+
if (!keep[index]) edits.push({ offset: entry.offset, length: entry.length, content: '' });
|
|
37
|
+
scanner.setPosition(entry.offset + entry.length);
|
|
38
|
+
if (scanner.scan() === SyntaxKind.CommaToken && (!keep[index] || index >= lastKept)) {
|
|
39
|
+
edits.push({ offset: scanner.getTokenOffset(), length: scanner.getTokenLength(), content: '' });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return bom + applyEdits(text, edits);
|
|
44
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { parse } from 'jsonc-parser';
|
|
3
|
+
import { filterSyncedPluginConfig } from './plugins.js';
|
|
4
|
+
|
|
5
|
+
describe('portable plugin declarations', () => {
|
|
6
|
+
it.each([
|
|
7
|
+
'file:///home/user/plugin', 'file:../plugin', '/opt/plugins/local', '//server/share/plugin',
|
|
8
|
+
'./plugins/local', '../local', '~/plugins/local', 'C:\\plugins\\local', '\\\\server\\share\\local',
|
|
9
|
+
'plugins/local', '.\\plugins\\local', 'link:../plugin', 'workspace:*',
|
|
10
|
+
'https://example.com/plugin.tgz', 'git+https://example.com/plugin.git', 'github:org/plugin',
|
|
11
|
+
'plugin@file:../local', 'plugin@/opt/local', '@scope/plugin@link:../local',
|
|
12
|
+
])('excludes %s in string, tuple and object declarations', (spec) => {
|
|
13
|
+
const content = JSON.stringify({
|
|
14
|
+
plugin: [spec, [spec, { enabled: true }], 'registry-plugin@^1.2.0'],
|
|
15
|
+
plugins: [spec, { package: spec, options: { enabled: true } }, '@scope/registry@beta'],
|
|
16
|
+
});
|
|
17
|
+
expect(JSON.parse(filterSyncedPluginConfig(content))).toEqual({
|
|
18
|
+
plugin: ['registry-plugin@^1.2.0'], plugins: ['@scope/registry@beta'],
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('preserves registry versions, scopes, ordering, tuple options and V2 object fields', () => {
|
|
23
|
+
const config = {
|
|
24
|
+
plugin: [['existing@1.2.3', { mode: 'safe', path: '/keep-option' }]],
|
|
25
|
+
plugins: ['bare', '@scope/bare', 'range@>=1.0.0 <2.0.0', 'tag@latest',
|
|
26
|
+
{ package: '@scope/plugin@2.0.0-beta.1+build.3', options: { nested: [1, true] }, disabled: true }],
|
|
27
|
+
};
|
|
28
|
+
const content = JSON.stringify(config, null, 2);
|
|
29
|
+
expect(filterSyncedPluginConfig(content)).toBe(content);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('filters both keys while retaining BOM, comments, trailing commas and unrelated content', () => {
|
|
33
|
+
const content = '\uFEFF{\r\n // Keep provider configuration.\r\n "provider": { "example": { "options": { "baseURL": "http://localhost:3000" } } },\r\n "plugins": [\r\n "file:///opt/local",\r\n // Registry options stay intact.\r\n { "package": "@scope/plugin@^2", "options": { "mode": "safe" } },\r\n "./local",\r\n ],\r\n "plugin": [["../legacy", {}], ["legacy@1", { "flag": true }]],\r\n}\r\n';
|
|
34
|
+
const filtered = filterSyncedPluginConfig(content);
|
|
35
|
+
const config = parse(filtered.slice(1));
|
|
36
|
+
expect(config.plugins).toEqual([{ package: '@scope/plugin@^2', options: { mode: 'safe' } }]);
|
|
37
|
+
expect(config.plugin).toEqual([['legacy@1', { flag: true }]]);
|
|
38
|
+
expect(filtered.startsWith('\uFEFF')).toBe(true);
|
|
39
|
+
expect(filtered).toContain('// Keep provider configuration.\r\n "provider": { "example": { "options": { "baseURL": "http://localhost:3000" } } },');
|
|
40
|
+
expect(filtered).toContain('// Registry options stay intact.');
|
|
41
|
+
expect(filterSyncedPluginConfig(filtered)).toBe(filtered);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it.each(['{}\n', '// Empty configuration.\n', '', '{ "plugins": [], "plugin": [] }'])('leaves unchanged config byte-identical: %j', (content) => {
|
|
45
|
+
expect(filterSyncedPluginConfig(content)).toBe(content);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('retains empty plugin arrays when every declaration is local', () => {
|
|
49
|
+
expect(JSON.parse(filterSyncedPluginConfig('{"plugins":["/local"],"plugin":[["file:../local",{}]]}')))
|
|
50
|
+
.toEqual({ plugins: [], plugin: [] });
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('keeps strict JSON valid for every combination of leading, adjacent and trailing removals', () => {
|
|
54
|
+
for (let mask = 0; mask < 32; mask += 1) {
|
|
55
|
+
const plugins = Array.from({ length: 5 }, (_, index) => mask & (1 << index) ? `registry-${index}@latest` : `/local/${index}`);
|
|
56
|
+
const filtered = filterSyncedPluginConfig(JSON.stringify({ plugins, model: 'unchanged' }));
|
|
57
|
+
expect(JSON.parse(filtered)).toEqual({ plugins: plugins.filter((entry) => !entry.startsWith('/')), model: 'unchanged' });
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it.each(['{broken', 'null', '[]', '{"plugins":"/local"}', '{"plugin":{}}', '{"plugins":[],"plugins":["/local"]}'])('fails closed for invalid or ambiguous configuration: %s', (content) => {
|
|
62
|
+
expect(() => filterSyncedPluginConfig(content)).toThrow('invalid OpenCode JSONC configuration');
|
|
63
|
+
});
|
|
64
|
+
});
|