@yuriai/web 0.1.21 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/assets/{AgentAvatar-Dn3d91Bp.js → AgentAvatar-C2p8G_Xw.js} +1 -1
- package/dist/assets/{AssistantView-DQiNW-MW.js → AssistantView-Cl8dtJE-.js} +3 -3
- package/dist/assets/{DiagramView-BmhwoZBs.js → DiagramView-zXlQky2c.js} +1 -1
- package/dist/assets/{FadeInOnReveal-D7ifJQAw.js → FadeInOnReveal-DhAYqopy.js} +1 -1
- package/dist/assets/{Icon-DZmADJWp.js → Icon-DKFfVCeK.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-Dw4P79Ms.js → ImageLoadingPlaceholder-DD2g7FjK.js} +1 -1
- package/dist/assets/{LoadingImage-CCKvcYRc.js → LoadingImage-Dc7hnEQ7.js} +1 -1
- package/dist/assets/{MarkdownRenderer-cLMYjCOZ.js → MarkdownRenderer-C1PXw_8U.js} +2 -2
- package/dist/assets/{MarkdownRendererImpl-Bv94t0JE.js → MarkdownRendererImpl-CWVOJcvk.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-BXX_Gr__.js → MarkstreamRendererImpl-BwkPAY1P.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-DiMju5tJ.js → MobileDetailNavigation-B4ZBK4cl.js} +1 -1
- package/dist/assets/{MobileShareBridge-BvT-pieE.js → MobileShareBridge-B5LUJJ99.js} +1 -1
- package/dist/assets/{MobileTabPageHeader-6TnrgU8f.js → MobileTabPageHeader-CkUhuZP6.js} +1 -1
- package/dist/assets/{MultiRunWindow-BKAWbnyr.js → MultiRunWindow-CqNrUij5.js} +1 -1
- package/dist/assets/{OnboardingScreen-DE2iB21m.js → OnboardingScreen-Dau5R5ew.js} +1 -1
- package/dist/assets/{OverlayScrollbar-BlzvB3ct.js → OverlayScrollbar-eBG-DXgX.js} +1 -1
- package/dist/assets/{SettingsView-CUuhQWoK.js → SettingsView-vZx4AKc1.js} +3 -3
- package/dist/assets/{SettingsWindow-h59i73ov.js → SettingsWindow-Rqxks-AG.js} +1 -1
- package/dist/assets/{TerminalView-Zo7cDHfo.js → TerminalView-CGYEbWpv.js} +1 -1
- package/dist/assets/{ToolOutputDialog-DDBPTFEY.js → ToolOutputDialog-B24XEhve.js} +1 -1
- package/dist/assets/{YuriLogo-Dm011NCM.js → YuriLogo-CgTkNYZf.js} +1 -1
- package/dist/assets/{appThemeRegistry-DK-CSk5S.js → appThemeRegistry-DD8LRHDT.js} +1 -1
- package/dist/assets/{button-CEcZQm-B.js → button-LPikURUk.js} +1 -1
- package/dist/assets/{capgoAdapter-CZGKOfbD.js → capgoAdapter-BCy22KX-.js} +1 -1
- package/dist/assets/{collapsible-B6ON5Mai.js → collapsible-CbQmi7qt.js} +1 -1
- package/dist/assets/{diagram-9xxUjDb_.js → diagram-DWkoS1Uc.js} +1 -1
- package/dist/assets/{dialog-CjPdvmr0.js → dialog-D8AYQa70.js} +1 -1
- package/dist/assets/{dropdown-menu.styles-Cm3A3LAl.js → dropdown-menu.styles-BqAI_N66.js} +1 -1
- package/dist/assets/{es-CqWNlkik.js → es-Le3f45R2.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-9jKjMJHB.js → fileMentionTouchSelection-CnxrRlNO.js} +1 -1
- package/dist/assets/{fr-CpxexYkk.js → fr-Knp2_Wkz.js} +1 -1
- package/dist/assets/{gitApi-IVSP2ro3.js → gitApi-D3cHH50Y.js} +1 -1
- package/dist/assets/{input-yYSzMq8L.js → input-CAhwlkOT.js} +1 -1
- package/dist/assets/{insertionBoundaries-3xRx4bIM.js → insertionBoundaries-19EJsmCA.js} +1 -1
- package/dist/assets/{ja-ByTgQPSi.js → ja-_KJ_VLgM.js} +1 -1
- package/dist/assets/{ko-BGfRP-3B.js → ko-CmWIeRHF.js} +1 -1
- package/dist/assets/{main-C3lkHYme.js → main-BO2UnYBd.js} +2 -2
- package/dist/assets/{main-SwAGPxrJ.js → main-b2a4ZRXC.js} +4 -4
- package/dist/assets/{markdownHeightCache-w0HDCLwk.js → markdownHeightCache-CylzGsAe.js} +1 -1
- package/dist/assets/{mcpQueries-DF-qg0ML.js → mcpQueries-BBt1ELI8.js} +1 -1
- package/dist/assets/{miniChat-KQ7dhYRy.js → miniChat-BpvsuSKB.js} +2 -2
- package/dist/assets/{mobile-GqxrcIvm.js → mobile-CyklTbWh.js} +2 -2
- package/dist/assets/{mobileBackNavigation-CM08LMho.js → mobileBackNavigation-Df81BnZ5.js} +1 -1
- package/dist/assets/{multirun-w_nrm1ZM.js → multirun-BrpKcjYv.js} +1 -1
- package/dist/assets/{native-config-B2T-ZIEW.js → native-config-C3EM05Jz.js} +1 -1
- package/dist/assets/{pl-DIwCzbXW.js → pl-BoXY-ki3.js} +1 -1
- package/dist/assets/{platform-7bX6qtBV.js → platform-CCTs9UKZ.js} +1 -1
- package/dist/assets/{projectMeta-C6-BO3Sf.js → projectMeta-DOs0HlSf.js} +1 -1
- package/dist/assets/{pt-BR-4MjIbbWQ.js → pt-BR-C3gsTrhe.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-DWdbSIM5.js → renderElectronMiniChatApp-DaeIwT-e.js} +2 -2
- package/dist/assets/{renderMobileApp-Dzc3S0T9.js → renderMobileApp-C-Rhiqyk.js} +5 -5
- package/dist/assets/{runtimeConfig-BkVhmUl_.js → runtimeConfig-CQ3TyMLm.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-DOv4PgLe.js → runtimeEndpointReset-CINPdy23.js} +2 -2
- package/dist/assets/{scheduledTaskNavigation-BhsUww-K.js → scheduledTaskNavigation-FME9NQYP.js} +1 -1
- package/dist/assets/{sessionChangeSummary-CtU8ntJA.js → sessionChangeSummary-DYp-0K8f.js} +1 -1
- package/dist/assets/{sessionLookup-BPj-TfyV.js → sessionLookup-BMSCT9Y1.js} +1 -1
- package/dist/assets/{sortable-tabs-strip-MyKMqyvw.js → sortable-tabs-strip-DiXAHgws.js} +1 -1
- package/dist/assets/speechSettingsQueries-Ci2kILTe.js +4 -0
- package/dist/assets/src-DlJVKekb.css +2 -0
- package/dist/assets/{store-JjNwX_aQ.js → store-CnVXA4NH.js} +2 -2
- package/dist/assets/{terminalApi-BHXvha-U.js → terminalApi-DhXTmxps.js} +1 -1
- package/dist/assets/{textarea-CO8JEdzP.js → textarea-BZhmG_bD.js} +1 -1
- package/dist/assets/{tooltip-Dmw1nU2I.js → tooltip-CFuO3PUH.js} +1 -1
- package/dist/assets/{types-FsIkN0-g.js → types-Du8LnIGl.js} +1 -1
- package/dist/assets/{uk-D9WsfZqn.js → uk-VUOVH9qH.js} +1 -1
- package/dist/assets/{useAppFontEffects-BBmnsBzL.js → useAppFontEffects-C-CZuq33.js} +5 -5
- package/dist/assets/{useDesktopWindowControlsLayout-2uBv60jr.js → useDesktopWindowControlsLayout-C8BGnh2S.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-_OW1qW0a.js → useEffectiveDirectory-B85HOZow.js} +1 -1
- package/dist/assets/{useFontPreferences-D9PX5t6Y.js → useFontPreferences-CMyrMAmq.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-BwspReaN.js → useMobileNavigationStore-_8410bpu.js} +7 -7
- package/dist/assets/{useWorkerHighlightedLines-BBUyEoH8.js → useWorkerHighlightedLines-D4HmbcHr.js} +1 -1
- package/dist/assets/vendor-opencode-client-XDI8AfPJ.js +12 -0
- package/dist/assets/{zh-CN-CAIBZPD7.js → zh-CN-CqOn122C.js} +1 -1
- package/dist/assets/{zh-TW-IpFLeeKe.js → zh-TW-53yr6Fdj.js} +1 -1
- package/dist/index.html +9 -9
- package/dist/mini-chat.html +9 -9
- package/dist/mobile.html +9 -9
- package/package.json +3 -3
- package/server/lib/config-sync/DOCUMENTATION.md +6 -2
- package/server/lib/config-sync/magpie.js +31 -6
- package/server/lib/config-sync/magpie.test.js +94 -1
- package/server/lib/opencode/DOCUMENTATION.md +9 -9
- package/server/lib/opencode/ensure-cli.js +12 -14
- package/server/lib/opencode/ensure-cli.test.js +8 -8
- package/server/lib/opencode/env-runtime.test.js +1 -1
- package/server/lib/opencode/opencode2-pin.js +3 -4
- package/server/lib/opencode/opencode2-pin.test.js +5 -4
- package/server/lib/opencode/owned-runtime-upgrade.js +4 -11
- package/server/lib/opencode/owned-runtime-upgrade.test.js +4 -0
- package/server/lib/opencode/routes.js +2 -1
- package/server/lib/opencode/routes.test.js +1 -1
- package/server/lib/opencode/runtime-contract.js +3 -4
- package/server/lib/opencode/session-directory-runtime.js +2 -13
- package/server/lib/opencode/session-directory-runtime.test.js +69 -4
- package/server/lib/opencode/upgrade-screen.js +9 -5
- package/server/lib/opencode/upgrade-screen.test.js +20 -0
- package/server/lib/opencode/version-alignment.test.js +6 -6
- package/server/lib/session-index/DOCUMENTATION.md +18 -8
- package/server/lib/session-index/routes.js +3 -1
- package/server/lib/session-index/routes.test.js +2 -0
- package/server/lib/session-index/service.js +23 -0
- package/server/lib/session-index/sync-runtime.js +75 -20
- package/server/lib/session-index/sync-runtime.test.js +5 -5
- package/dist/assets/speechSettingsQueries-BicoJlEO.js +0 -4
- package/dist/assets/src-CfEhXfYn.css +0 -2
- package/dist/assets/vendor-opencode-client-MF2GBrFx.js +0 -12
package/dist/index.html
CHANGED
|
@@ -560,7 +560,7 @@
|
|
|
560
560
|
opacity: 0.72;
|
|
561
561
|
}
|
|
562
562
|
</style>
|
|
563
|
-
<script type="module" crossorigin src="/assets/main-
|
|
563
|
+
<script type="module" crossorigin src="/assets/main-BO2UnYBd.js"></script>
|
|
564
564
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
565
565
|
<link rel="modulepreload" crossorigin href="/assets/runtime-auth-ef9W7A43.js">
|
|
566
566
|
<link rel="modulepreload" crossorigin href="/assets/runtime-switch-CAZiOV2G.js">
|
|
@@ -576,18 +576,18 @@
|
|
|
576
576
|
<link rel="modulepreload" crossorigin href="/assets/persistence-Dzooc9Xg.js">
|
|
577
577
|
<link rel="modulepreload" crossorigin href="/assets/desktopHosts-DW8THEMC.js">
|
|
578
578
|
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-BFn1FsR3.js">
|
|
579
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-
|
|
579
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-XDI8AfPJ.js">
|
|
580
580
|
<link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-react-query-CdqCAt40.js">
|
|
581
581
|
<link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
|
|
582
582
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-C1k5nbWb.js">
|
|
583
|
-
<link rel="modulepreload" crossorigin href="/assets/platform-
|
|
584
|
-
<link rel="modulepreload" crossorigin href="/assets/terminalApi-
|
|
583
|
+
<link rel="modulepreload" crossorigin href="/assets/platform-CCTs9UKZ.js">
|
|
584
|
+
<link rel="modulepreload" crossorigin href="/assets/terminalApi-DhXTmxps.js">
|
|
585
585
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-DAOam_oV.js">
|
|
586
|
-
<link rel="modulepreload" crossorigin href="/assets/types-
|
|
587
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
588
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
589
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
590
|
-
<link rel="stylesheet" crossorigin href="/assets/src-
|
|
586
|
+
<link rel="modulepreload" crossorigin href="/assets/types-Du8LnIGl.js">
|
|
587
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-BCy22KX-.js">
|
|
588
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-C3EM05Jz.js">
|
|
589
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-CQ3TyMLm.js">
|
|
590
|
+
<link rel="stylesheet" crossorigin href="/assets/src-DlJVKekb.css">
|
|
591
591
|
</head>
|
|
592
592
|
<body class="h-full bg-background text-foreground">
|
|
593
593
|
<!-- Keep the startup layer outside #root. React replaces every child of
|
package/dist/mini-chat.html
CHANGED
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
}
|
|
75
75
|
</style>
|
|
76
76
|
|
|
77
|
-
<script type="module" crossorigin src="/assets/miniChat-
|
|
77
|
+
<script type="module" crossorigin src="/assets/miniChat-BpvsuSKB.js"></script>
|
|
78
78
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
79
79
|
<link rel="modulepreload" crossorigin href="/assets/runtime-auth-ef9W7A43.js">
|
|
80
80
|
<link rel="modulepreload" crossorigin href="/assets/runtime-switch-CAZiOV2G.js">
|
|
@@ -90,18 +90,18 @@
|
|
|
90
90
|
<link rel="modulepreload" crossorigin href="/assets/persistence-Dzooc9Xg.js">
|
|
91
91
|
<link rel="modulepreload" crossorigin href="/assets/desktopHosts-DW8THEMC.js">
|
|
92
92
|
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-BFn1FsR3.js">
|
|
93
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-
|
|
93
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-XDI8AfPJ.js">
|
|
94
94
|
<link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-react-query-CdqCAt40.js">
|
|
95
95
|
<link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
|
|
96
96
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-C1k5nbWb.js">
|
|
97
|
-
<link rel="modulepreload" crossorigin href="/assets/platform-
|
|
98
|
-
<link rel="modulepreload" crossorigin href="/assets/terminalApi-
|
|
97
|
+
<link rel="modulepreload" crossorigin href="/assets/platform-CCTs9UKZ.js">
|
|
98
|
+
<link rel="modulepreload" crossorigin href="/assets/terminalApi-DhXTmxps.js">
|
|
99
99
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-DAOam_oV.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-Du8LnIGl.js">
|
|
101
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-BCy22KX-.js">
|
|
102
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-C3EM05Jz.js">
|
|
103
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-CQ3TyMLm.js">
|
|
104
|
+
<link rel="stylesheet" crossorigin href="/assets/src-DlJVKekb.css">
|
|
105
105
|
</head>
|
|
106
106
|
<body class="h-full bg-background text-foreground">
|
|
107
107
|
<div id="root" class="h-full">
|
package/dist/mobile.html
CHANGED
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
})();
|
|
64
64
|
</script>
|
|
65
65
|
|
|
66
|
-
<script type="module" crossorigin src="/assets/mobile-
|
|
66
|
+
<script type="module" crossorigin src="/assets/mobile-CyklTbWh.js"></script>
|
|
67
67
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
68
68
|
<link rel="modulepreload" crossorigin href="/assets/runtime-auth-ef9W7A43.js">
|
|
69
69
|
<link rel="modulepreload" crossorigin href="/assets/runtime-switch-CAZiOV2G.js">
|
|
@@ -79,18 +79,18 @@
|
|
|
79
79
|
<link rel="modulepreload" crossorigin href="/assets/persistence-Dzooc9Xg.js">
|
|
80
80
|
<link rel="modulepreload" crossorigin href="/assets/desktopHosts-DW8THEMC.js">
|
|
81
81
|
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-BFn1FsR3.js">
|
|
82
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-
|
|
82
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-XDI8AfPJ.js">
|
|
83
83
|
<link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-react-query-CdqCAt40.js">
|
|
84
84
|
<link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
|
|
85
85
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-C1k5nbWb.js">
|
|
86
|
-
<link rel="modulepreload" crossorigin href="/assets/platform-
|
|
87
|
-
<link rel="modulepreload" crossorigin href="/assets/terminalApi-
|
|
86
|
+
<link rel="modulepreload" crossorigin href="/assets/platform-CCTs9UKZ.js">
|
|
87
|
+
<link rel="modulepreload" crossorigin href="/assets/terminalApi-DhXTmxps.js">
|
|
88
88
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-DAOam_oV.js">
|
|
89
|
-
<link rel="modulepreload" crossorigin href="/assets/types-
|
|
90
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
91
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
92
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
93
|
-
<link rel="stylesheet" crossorigin href="/assets/src-
|
|
89
|
+
<link rel="modulepreload" crossorigin href="/assets/types-Du8LnIGl.js">
|
|
90
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-BCy22KX-.js">
|
|
91
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-C3EM05Jz.js">
|
|
92
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-CQ3TyMLm.js">
|
|
93
|
+
<link rel="stylesheet" crossorigin href="/assets/src-DlJVKekb.css">
|
|
94
94
|
</head>
|
|
95
95
|
<body class="h-full bg-background text-foreground">
|
|
96
96
|
<div id="root" class="h-full"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuriai/web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.23",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./server/index.js",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"@clack/prompts": "^1.1.0",
|
|
27
27
|
"@earendil-works/pi-agent-core": "0.84.4",
|
|
28
28
|
"@octokit/rest": "^22.0.1",
|
|
29
|
-
"@opencode/client": "2.0.23",
|
|
30
|
-
"@opencode/schema": "2.0.23",
|
|
29
|
+
"@opencode/client": "^2.0.23",
|
|
30
|
+
"@opencode/schema": "^2.0.23",
|
|
31
31
|
"@simplewebauthn/server": "13.3.1",
|
|
32
32
|
"adm-zip": "^0.5.16",
|
|
33
33
|
"better-sqlite3": "^12.10.0",
|
|
@@ -41,6 +41,8 @@ Own the direction-agnostic OpenCode config sync contract: allowlist planning on
|
|
|
41
41
|
|
|
42
42
|
Switching direction in the wizard **must** discard the previous preview and re-call preview IPC (no client-side flip of an old plan).
|
|
43
43
|
|
|
44
|
+
Within one direction, scope changes retain the displayed preview and discovered options while refreshing. Preview requests are serialized, superseded queued selections are skipped, and stale completions cannot replace the latest review. Apply stays disabled until the latest selection snapshot is confirmed. Closing or changing the target invalidates pending results. The dialog expands naturally with its content, without a fixed height or nested scrolling body/list; only the shared dialog's viewport overflow protection remains. Static help and the footer do not depend on preview loading.
|
|
45
|
+
|
|
44
46
|
## Invariants
|
|
45
47
|
|
|
46
48
|
- Plan is computed on the source filesystem/inventory snapshot; destination executors never re-walk the source.
|
|
@@ -89,12 +91,14 @@ Discovery checks `MAGPIE_BINARY`, PATH, the user's `.local/bin`, macOS applicati
|
|
|
89
91
|
|
|
90
92
|
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.
|
|
91
93
|
|
|
92
|
-
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. 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.
|
|
94
|
+
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.
|
|
95
|
+
|
|
96
|
+
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.
|
|
93
97
|
|
|
94
98
|
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.
|
|
95
99
|
|
|
96
100
|
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.
|
|
97
101
|
|
|
98
|
-
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
|
|
102
|
+
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.
|
|
99
103
|
|
|
100
104
|
`/put/magpie` requires a selected prepared plan and finalize requires its receipt. Standalone `/magpie` is the corresponding authenticated host operation for SSH and local pull. Both use one host-local import/export lock. Desktop main only moves bytes and resolves the local host at call time; the web host owns process execution and installation, including under backend OTA. Web/mobile hosts can receive this operation; the initiating wizard remains desktop-only. No credential values enter previews or sync-run summaries.
|
|
@@ -56,7 +56,14 @@ const runCli = (binary, args, { input = '', env, timeout = 600_000 } = {}) => ne
|
|
|
56
56
|
child.on('error', () => { clearTimeout(timer); reject(new Error('Unable to start Magpie CLI')); });
|
|
57
57
|
child.on('close', (code) => {
|
|
58
58
|
clearTimeout(timer);
|
|
59
|
-
if (code !== 0 || exceeded)
|
|
59
|
+
if (code !== 0 || exceeded) {
|
|
60
|
+
const error = new Error('Magpie CLI operation failed or timed out');
|
|
61
|
+
if (!exceeded && code === 1 && args[0] === 'accounts' && args[1] === 'import' && args[2] === 'codex'
|
|
62
|
+
&& /ChatGPT didn't take the refresh token/i.test(output)) {
|
|
63
|
+
error.code = 'magpie_codex_authorization_rejected';
|
|
64
|
+
}
|
|
65
|
+
reject(error);
|
|
66
|
+
}
|
|
60
67
|
else resolve(output.replace(/\x1b\[[0-9;]*m/g, ''));
|
|
61
68
|
});
|
|
62
69
|
child.stdin.end(input);
|
|
@@ -254,34 +261,51 @@ export function createMagpieSync({
|
|
|
254
261
|
let output;
|
|
255
262
|
try { output = await run(binary, ['restore', file], { env, input: `${decoded.passphrase}\n` }); }
|
|
256
263
|
catch { throw new Error('Magpie restore failed; some configuration may already have been applied. Retry to finish.'); }
|
|
257
|
-
|
|
264
|
+
// Private/unreachable plugin specs can fail while the rest of restore still applies.
|
|
265
|
+
let pluginInstallFailed = /Couldn't add the plugin/i.test(output);
|
|
258
266
|
if (/Library:.*couldn't/i.test(output)) throw new Error('Magpie restore partially completed: library application failed. Check the target Magpie library.');
|
|
259
267
|
if (/Needs a key/i.test(output)) throw new Error('Magpie restore partially completed: some providers still require API keys.');
|
|
260
268
|
let needsSignIn = /not signed in on this computer/i.test(output);
|
|
261
269
|
if (decoded.format === 'magpie-sync-v2') {
|
|
262
270
|
const dir = await dataDir(binary);
|
|
271
|
+
const rejected = new Set();
|
|
263
272
|
try {
|
|
264
273
|
await restoreMagpieAuth(dir, decoded.authorization, async (auth) => {
|
|
265
274
|
const credentialFile = path.join(path.dirname(file), 'codex.json');
|
|
266
275
|
try {
|
|
267
276
|
await fs.writeFile(credentialFile, JSON.stringify(auth), { mode: 0o600, flag: 'wx' });
|
|
268
|
-
|
|
277
|
+
try {
|
|
278
|
+
await run(binary, ['accounts', 'import', 'codex', credentialFile, '--yes'], { env });
|
|
279
|
+
} catch (error) {
|
|
280
|
+
if (error.code !== 'magpie_codex_authorization_rejected') throw error;
|
|
281
|
+
rejected.add(auth);
|
|
282
|
+
}
|
|
269
283
|
} finally { await fs.rm(credentialFile, { force: true }); }
|
|
270
284
|
});
|
|
271
285
|
const accounts = parseMagpieAccountsJson(await run(binary, ['accounts', '--json'], { env }));
|
|
272
|
-
|
|
286
|
+
const known = new Set(accounts.map((account) => account.agent));
|
|
287
|
+
// Skip verification for plugins that never installed and for spent Codex tokens.
|
|
288
|
+
const expected = {
|
|
289
|
+
...decoded.authorization,
|
|
290
|
+
plugins: Object.fromEntries(Object.entries(decoded.authorization.plugins)
|
|
291
|
+
.filter(([key]) => !pluginInstallFailed || known.has(key.split('#')[0]))),
|
|
292
|
+
logins: decoded.authorization.logins.filter((row) => !rejected.has(row.auth)
|
|
293
|
+
&& (!pluginInstallFailed || known.has(row.agent.replace(/^plugin:/, '')))),
|
|
294
|
+
};
|
|
295
|
+
verifyMagpieAuth(expected, accounts);
|
|
273
296
|
const configured = JSON.parse(await fs.readFile(path.join(dir, 'providers.json'), 'utf8').catch((error) => {
|
|
274
297
|
if (error.code === 'ENOENT') return '{"providers":[]}';
|
|
275
298
|
throw error;
|
|
276
299
|
}));
|
|
277
300
|
if (!Array.isArray(configured.providers)) throw new Error();
|
|
278
301
|
const signedIn = new Set(accounts.map((account) => account.agent));
|
|
279
|
-
needsSignIn = decoded.authorization.incomplete || configured.providers.some((provider) =>
|
|
302
|
+
needsSignIn = rejected.size > 0 || decoded.authorization.incomplete || configured.providers.some((provider) =>
|
|
280
303
|
!provider.hidden && provider.id && !['chat', 'responses', 'anthropic', 'gemini'].some((key) => provider[key])
|
|
281
304
|
&& !signedIn.has(provider.id));
|
|
282
305
|
if (/Left as they are/i.test(output)) {
|
|
283
306
|
output = await run(binary, ['restore', file], { env, input: `${decoded.passphrase}\n` });
|
|
284
|
-
if (/Couldn't add the plugin
|
|
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();
|
|
285
309
|
}
|
|
286
310
|
} catch (error) {
|
|
287
311
|
throw new Error('Magpie authorization sync or verification failed; some configuration and accounts may already be applied. Retry to finish.', { cause: error });
|
|
@@ -289,6 +313,7 @@ export function createMagpieSync({
|
|
|
289
313
|
}
|
|
290
314
|
const magpieWarnings = [];
|
|
291
315
|
if (needsSignIn) magpieWarnings.push('sign_in_required');
|
|
316
|
+
if (pluginInstallFailed) magpieWarnings.push('plugin_install_failed');
|
|
292
317
|
if (/Left as they are/i.test(output)) magpieWarnings.push('agent_settings_skipped');
|
|
293
318
|
return { ok: true, ...(magpieWarnings.length ? { magpieWarnings } : {}) };
|
|
294
319
|
});
|
|
@@ -159,6 +159,34 @@ describe('Magpie discovery and native transfer', () => {
|
|
|
159
159
|
expect((await fs.readdir(target.home)).filter((name) => name.startsWith('yuri-magpie-'))).toEqual([]);
|
|
160
160
|
});
|
|
161
161
|
|
|
162
|
+
it('treats a spent Codex refresh token as recoverable when the destination already recognizes the account', async () => {
|
|
163
|
+
const source = await machine();
|
|
164
|
+
const target = await machine();
|
|
165
|
+
for (const item of [source, target]) await write(path.join(item.home, '.local/bin/magpie'), 'fixture');
|
|
166
|
+
const sourceDir = path.join(source.home, '.config/magpie');
|
|
167
|
+
const targetDir = path.join(target.home, '.config/magpie');
|
|
168
|
+
await write(path.join(sourceDir, 'providers.json'), '{"providers":[{"id":"codex"}]}');
|
|
169
|
+
await write(path.join(sourceDir, 'logins.json'), JSON.stringify([
|
|
170
|
+
{ agent: 'codex', user: 'fixture@example.invalid', auth: { tokens: { refresh_token: 'spent-token' } } },
|
|
171
|
+
]));
|
|
172
|
+
const payload = await createMagpieSync({ ...source.options, run: async (_binary, args) => {
|
|
173
|
+
if (args[0] === '--version') return 'magpie 0.1.1319';
|
|
174
|
+
if (args[0] === 'accounts') return '[{"agent":"codex","user":"fixture@example.invalid"}]';
|
|
175
|
+
await write(args[1], '{"format":"magpie-backup"}');
|
|
176
|
+
return '';
|
|
177
|
+
} }).download();
|
|
178
|
+
const run = vi.fn(async (_binary, args) => {
|
|
179
|
+
if (args[0] === '--version') return 'magpie 0.1.1319';
|
|
180
|
+
if (args[0] === 'restore') {
|
|
181
|
+
await write(path.join(targetDir, 'providers.json'), await fs.readFile(path.join(sourceDir, 'providers.json')));
|
|
182
|
+
return 'restored';
|
|
183
|
+
}
|
|
184
|
+
if (args[1] === 'import') throw Object.assign(new Error('Magpie CLI operation failed or timed out'), { code: 'magpie_codex_authorization_rejected' });
|
|
185
|
+
return '[{"agent":"codex","user":"fixture@example.invalid"}]';
|
|
186
|
+
});
|
|
187
|
+
await expect(createMagpieSync({ ...target.options, run }).import(payload)).resolves.toEqual({ ok: true, magpieWarnings: ['sign_in_required'] });
|
|
188
|
+
});
|
|
189
|
+
|
|
162
190
|
it('rejects malformed v2 authorization before installing or restoring', async () => {
|
|
163
191
|
const { options } = await machine();
|
|
164
192
|
const run = vi.fn();
|
|
@@ -171,6 +199,36 @@ describe('Magpie discovery and native transfer', () => {
|
|
|
171
199
|
expect(fetchImpl).not.toHaveBeenCalled();
|
|
172
200
|
});
|
|
173
201
|
|
|
202
|
+
it.each([true, false])('continues only for a confirmed Codex rejection (rejected=%s)', async (rejected) => {
|
|
203
|
+
const { home, options } = await machine();
|
|
204
|
+
const binary = path.join(home, '.local/bin/magpie');
|
|
205
|
+
await write(binary, `#!${process.execPath}
|
|
206
|
+
const fs = require('node:fs');
|
|
207
|
+
const args = process.argv.slice(2);
|
|
208
|
+
if (args[0] === '--version') console.log('magpie 0.1.1820');
|
|
209
|
+
else if (args[1] === 'import') {
|
|
210
|
+
const auth = JSON.parse(fs.readFileSync(args[3], 'utf8'));
|
|
211
|
+
if (auth.tokens.refresh_token === 'fixture-rejected') {
|
|
212
|
+
console.error(${JSON.stringify(rejected ? "ChatGPT didn't take the refresh token — expired or signed out" : 'Network connection failed')});
|
|
213
|
+
process.exitCode = 1;
|
|
214
|
+
}
|
|
215
|
+
} else if (args[0] === 'accounts') console.log(JSON.stringify([{ agent: 'codex', user: 'second@example.invalid' }, { agent: 'astra' }]));
|
|
216
|
+
else console.log('restored');
|
|
217
|
+
`);
|
|
218
|
+
await fs.chmod(binary, 0o700);
|
|
219
|
+
const payload = Buffer.from(JSON.stringify({ format: 'magpie-sync-v2', passphrase: 'a'.repeat(64),
|
|
220
|
+
backup: Buffer.from('{"format":"magpie-backup"}').toString('base64'),
|
|
221
|
+
authorization: { plugins: { astra: { type: 'api', key: 'fixture' } }, incomplete: false, logins: [
|
|
222
|
+
{ agent: 'codex', user: 'first@example.invalid', auth: { tokens: { refresh_token: 'fixture-rejected' } } },
|
|
223
|
+
{ agent: 'codex', user: 'second@example.invalid', auth: { tokens: { refresh_token: 'fixture-valid' } } },
|
|
224
|
+
] } }));
|
|
225
|
+
const result = createMagpieSync(options).import(payload);
|
|
226
|
+
if (rejected) await expect(result).resolves.toEqual({ ok: true, magpieWarnings: ['sign_in_required'] });
|
|
227
|
+
else await expect(result).rejects.toThrow('authorization sync or verification failed');
|
|
228
|
+
expect(JSON.parse(await fs.readFile(path.join(home, '.config/magpie/plugin-auth.json'), 'utf8')).astra).toEqual({ type: 'api', key: 'fixture' });
|
|
229
|
+
expect((await fs.readdir(home)).filter((name) => name.startsWith('yuri-magpie-'))).toEqual([]);
|
|
230
|
+
});
|
|
231
|
+
|
|
174
232
|
it('retries agent settings after authorizations instead of keeping a pre-login skip warning', async () => {
|
|
175
233
|
const { home, options } = await machine();
|
|
176
234
|
await write(path.join(home, '.local/bin/magpie'), 'fixture');
|
|
@@ -191,7 +249,7 @@ describe('Magpie discovery and native transfer', () => {
|
|
|
191
249
|
const { home, options } = await machine();
|
|
192
250
|
const fetchImpl = vi.fn();
|
|
193
251
|
const run = vi.fn(async (_binary, args) => args[0] === '--version'
|
|
194
|
-
? 'magpie 0.1.0' :
|
|
252
|
+
? 'magpie 0.1.0' : 'Library: fixture-library couldn\'t apply');
|
|
195
253
|
const sync = createMagpieSync({ ...options, fetchImpl, run });
|
|
196
254
|
await expect(sync.import(Buffer.from('{}'))).rejects.toThrow('Invalid Magpie sync payload');
|
|
197
255
|
expect(fetchImpl).not.toHaveBeenCalled();
|
|
@@ -202,6 +260,41 @@ describe('Magpie discovery and native transfer', () => {
|
|
|
202
260
|
expect((await fs.readdir(home)).filter((name) => name.startsWith('yuri-magpie-'))).toEqual([]);
|
|
203
261
|
});
|
|
204
262
|
|
|
263
|
+
it('continues when a plugin fails to install and warns instead of aborting', async () => {
|
|
264
|
+
const source = await machine();
|
|
265
|
+
const target = await machine();
|
|
266
|
+
for (const item of [source, target]) await write(path.join(item.home, '.local/bin/magpie'), 'fixture');
|
|
267
|
+
const sourceDir = path.join(source.home, '.config/magpie');
|
|
268
|
+
const targetDir = path.join(target.home, '.config/magpie');
|
|
269
|
+
await write(path.join(sourceDir, 'providers.json'), '{"providers":[{"id":"cursor"},{"id":"private-plugin"}]}');
|
|
270
|
+
await write(path.join(sourceDir, 'plugin-auth.json'), JSON.stringify({
|
|
271
|
+
cursor: { type: 'api', key: 'fixture-key' },
|
|
272
|
+
'private-plugin': { type: 'api', key: 'fixture-private' },
|
|
273
|
+
}));
|
|
274
|
+
await write(path.join(sourceDir, 'logins.json'), JSON.stringify([
|
|
275
|
+
{ agent: 'plugin:cursor', user: 'fixture@example.invalid', home: 'cursor', auth: { type: 'api' } },
|
|
276
|
+
{ agent: 'plugin:private-plugin', user: 'secret', home: 'private-plugin', auth: { type: 'api' } },
|
|
277
|
+
]));
|
|
278
|
+
const payload = await createMagpieSync({ ...source.options, run: async (_binary, args) => {
|
|
279
|
+
if (args[0] === '--version') return 'magpie 0.1.1319';
|
|
280
|
+
if (args[0] === 'accounts') return '[{"agent":"cursor","user":"fixture@example.invalid"},{"agent":"private-plugin","user":"secret"}]';
|
|
281
|
+
await write(args[1], '{"format":"magpie-backup"}');
|
|
282
|
+
return '';
|
|
283
|
+
} }).download();
|
|
284
|
+
const run = vi.fn(async (_binary, args) => {
|
|
285
|
+
if (args[0] === '--version') return 'magpie 0.1.1319';
|
|
286
|
+
if (args[0] === 'restore') {
|
|
287
|
+
await write(path.join(targetDir, 'providers.json'), await fs.readFile(path.join(sourceDir, 'providers.json')));
|
|
288
|
+
return "Couldn't add the plugin private-plugin@latest";
|
|
289
|
+
}
|
|
290
|
+
if (args[0] === 'accounts') return '[{"agent":"cursor","user":"fixture@example.invalid"}]';
|
|
291
|
+
return '';
|
|
292
|
+
});
|
|
293
|
+
await expect(createMagpieSync({ ...target.options, run }).import(payload)).resolves.toEqual({
|
|
294
|
+
ok: true, magpieWarnings: ['sign_in_required', 'plugin_install_failed'],
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
|
|
205
298
|
it('reports excluded sign-ins as a warning after a successful native restore', async () => {
|
|
206
299
|
const { home, options } = await machine();
|
|
207
300
|
await write(path.join(home, '.local', 'bin', 'magpie'), 'fixture-cli');
|
|
@@ -20,7 +20,7 @@ This module provides OpenCode server integration utilities for the web server ru
|
|
|
20
20
|
connection shortcuts to exclude themselves without changing management lists.
|
|
21
21
|
- `plugins.js`: config entries and plugin-directory files are inventory, not compatibility checks. They do not synthesize `compatibility` or `compatible` fields; Settings uses the OpenCode runtime inventory for actual load status and errors.
|
|
22
22
|
- Reads native V2 `plugins` (strings or `{ package, options }`) with legacy `plugin`/tuple fallback. A native array, including an empty one, wins within each document. Entry mutations write only `plugins`, convert retained legacy tuples, and remove the shadowed legacy key in the touched source file. Options, ordering, unrelated configuration and JSONC comments are preserved through the shared atomic config writer; malformed entries or write failures do not replace the original file. Web, Electron and mobile use this host implementation; VS Code mirrors the same persistence contract.
|
|
23
|
-
- `session-directory-runtime.js`: Host-side physical directory identity for session index/list/detail/live projection. Uses a runtime-scoped, bounded 256-entry cache (60s success / 5s failed resolution), cleared when the upstream URL changes. Local directory lists use
|
|
23
|
+
- `session-directory-runtime.js`: Host-side physical directory identity for session index/list/detail/live projection. Uses a runtime-scoped, bounded 256-entry cache (60s success / 5s failed resolution), cleared when the upstream URL changes. Local directory lists use session pages and physical-directory filtering to include legacy symlink sessions without mixing worktrees; they never request `/location` to discover project identity. Startup backfill reads one global session stream rather than one stream per project. One request reads one page and preserves opaque cursors; consumers must follow continuations even after filtered-empty pages. Non-loopback upstreams keep their own path namespace.
|
|
24
24
|
- `packages/web/server/lib/opencode/index.js`: public entrypoint (currently baseline placeholder).
|
|
25
25
|
- `packages/web/server/lib/opencode/auth.js`: host-only authoritative provider credential API reads and deletion.
|
|
26
26
|
- `packages/web/server/lib/opencode/auth-state-runtime.js`: managed OpenCode server auth password/header runtime.
|
|
@@ -32,8 +32,8 @@ This module provides OpenCode server integration utilities for the web server ru
|
|
|
32
32
|
- `packages/web/server/lib/opencode/v1-migration-gate.js`: pure V1→v2 migration admission gate (`GET /api/experimental/migration/v1` → whether transcript may be fetched).
|
|
33
33
|
- `packages/web/server/lib/opencode/managed-capabilities-runtime.js`: managed-child scheduled-task resources, config injection, rotating bridge identity, and bridge authorization.
|
|
34
34
|
- `packages/web/server/lib/opencode/env-runtime.js`: OpenCode CLI/binary resolution and shell environment runtime.
|
|
35
|
-
- `packages/web/server/lib/opencode/ensure-cli.js`: detect local `opencode` version and install the latest stable official V2 into the Yuri data dir when no usable CLI exists
|
|
36
|
-
- `packages/web/server/lib/opencode/upgrade-screen.js`: startup gate for the running OpenCode below `2.0.20`. Client/schema dependencies
|
|
35
|
+
- `packages/web/server/lib/opencode/ensure-cli.js`: detect local `opencode` version and install the latest stable official V2 into the Yuri data dir when no usable CLI exists. Registry lookup failures remain errors; verified cached installations can be reused offline. Never uses a packaged/bundled binary.
|
|
36
|
+
- `packages/web/server/lib/opencode/upgrade-screen.js`: startup gate for the running OpenCode below `2.0.20`. Client/schema dependencies accept compatible 2.x updates; fresh installations and required upgrades resolve latest stable 2.x at installation time. The compatible execution floor is independently `2.0.20` (credential API). An unreadable running version is unavailable even when the local CLI is compatible. `POST /api/opencode/install-required` upgrades the selected shared global CLI in place; other supported local installations use the owned-cache installer. Global upgrades do not persist a binary override, so subsequent launches still follow shell discovery. Success requires the running service to meet both the floor and selected target. External services are not replaced; compatible newer shared services are not automatically downgraded. Failure restores binary selection and reports `upgraded: false`, without claiming process or package-manager rollback.
|
|
37
37
|
- `packages/web/server/lib/opencode/env-config.js`: OpenCode-related environment variable parsing and validation (host/port/hostname).
|
|
38
38
|
- `packages/web/server/lib/opencode/hmr-state-runtime.js`: HMR-persistent runtime state initialization, auth-state bootstrap, and HMR sync helpers.
|
|
39
39
|
- `packages/web/server/lib/opencode/bootstrap-runtime.js`: base app bootstrap runtime for status/auth/tts/notification/Yuri route wiring.
|
|
@@ -111,8 +111,8 @@ This module provides OpenCode server integration utilities for the web server ru
|
|
|
111
111
|
- `POST /api/opencode/upgrade` (ticket 12): upgrades the remote latest or explicitly targeted version. Shared services using a global CLI invoke that selected installation's `upgrade <version>` and verify its disk version; owned-cache installations download into `~/.config/yuri/opencode-cli/<version>/`. Shared services restart through the selected CLI entry path and adopt its registration again. Success requires fresh CLI/service version probes and runtime contract verification. Global upgrades never switch to an owned cache on failure. Arbitrary external servers, private processes using global CLI, and private bundled binaries return HTTP 409. Concurrent upgrades are single-flight (`operation` state). Active sessions do not block an explicitly requested upgrade or require additional confirmation. Failure restores binary selection and reports the failed phase; it cannot undo package-manager changes and does not claim process restoration.
|
|
112
112
|
- `GET /api/opencode/upgrade-status`: returns `currentVersion`/`serveVersion`/`cliVersion`, `targetVersion`/`latestVersion` (official npm `@opencode/cli` latest stable 2.x release), `supplySource`, `ownership`, `canManage`, `management`, `guidance`, `contract`, and `operation`. Official shared services report `ownership: 'shared-service'`, `processOwnership: 'shared'`, and `canManage: true`. `available` is true only when `canManage` and target > current; unmanaged global/external runtimes report `available: null` plus manual guidance. `update-discovery.js` shares one in-flight registry request per host, caches successful checks for five minutes and failed checks for thirty seconds, with a five-second request deadline. Failed registry checks return HTTP 500 with `available: null`, never a false up-to-date result. An upgrade without an explicit target resolves this same remote release. Shared Web/Electron/hosted-mobile/Capacitor clients check after startup, every five minutes while visible, on focus/reconnect, and on runtime changes; query results and dismissed notifications are scoped to the host. Successful upgrade already includes process restart and live version verification, so no second reload is needed.
|
|
113
113
|
- `GET /api/opencode/compatibility`: startup upgrade-screen status. `compatible` requires the running OpenCode 2.x at `2.0.20` or newer; older/invalid versions are `incompatible`; unreadable running versions are `unavailable`. External serves are not replaced.
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
- `POST /api/opencode/install-required`: resolves the latest stable 2.x release (never below the `2.0.20` floor), upgrades the selected shared global CLI or owned cache, and restarts through the existing lifecycle. Discovery failure does not install a historical fallback. `upgraded: true` requires live version verification. Concurrent installs are single-flight; failures remain errors. Compatibility status reports the minimum before installation resolves its actual target.
|
|
115
|
+
- `GET /api/opencode/contract`: runtime contract admission for the **running serve**. Reachability, auth, execution, migration, and CLI↔serve mismatch are separate. The `2.0.20` floor is independent of installation targets; compatible newer 2.x services remain admitted. The legacy `pinnedVersion` response field is null.
|
|
116
116
|
- `GET /api/opencode/health`: probes managed OpenCode `GET /api/info` (Basic auth, 4s timeout). `healthy` is reachability/version shape via `evaluateOpenCodeHealthBody` (admits official 2.x `ServerInfo` and classic `{ healthy: true, version }`; rejects 1.x / missing / `healthy: false`). Response also includes `executionAllowed`, `protocolCompatible`, and `contract` so clients do not treat health success as full execution semantics. Upstream non-OK responses pass through status with `{ healthy: false, error, contract }`; transport failures return HTTP 503.
|
|
117
117
|
- `GET /api/opencode/version`: serve + CLI versions, mismatch flag, and contract snapshot
|
|
118
118
|
- `POST /api/opencode/directory`
|
|
@@ -145,12 +145,12 @@ This module provides OpenCode server integration utilities for the web server ru
|
|
|
145
145
|
- Native `session.execution.started/succeeded/failed/interrupted` and `session.retry.scheduled` feed the same status/activity/attention transitions. Shutdown interruption retains busy ownership; other terminal events settle idle. `extractSessionStatusUpdate` is shared by Host forwarding, index ingestion and Goal timer handling so retry metadata and shutdown semantics stay aligned.
|
|
146
146
|
|
|
147
147
|
## Public exports (opencode2-pin.js)
|
|
148
|
-
- `
|
|
148
|
+
- `MINIMUM_OPENCODE2_VERSION`: compatibility floor, not an installation pin.
|
|
149
149
|
- `OPENCODE2_NPM_PACKAGE`: `@opencode/cli` (global install that ships the official `opencode` v2 binary; not 1.x `opencode-ai`).
|
|
150
150
|
- `parseOpenCode2VersionOutput(stdout)` / `compareOpenCode2Versions(left, right)` / `isOpenCode2VersionAtLeast(version, minimum)`: CLI `--version` parse and pin comparison.
|
|
151
151
|
- `openCode2BinaryName(platform)` / `npmPackageForOpenCode2(platform, arch)`: staged binary name `opencode` (`opencode.exe` on Windows) and official platform package `@opencode/cli-<os>-<arch>[-baseline]`.
|
|
152
152
|
- `isOpenCode1xVersion(value)` / `isAcceptableOpenCode2HealthVersion(value)` / `evaluateOpenCodeHealthBody(body)`: health admission accepts only 2.x. 1.x, `0.x` pre-2 binaries, and missing/unknown versions are rejected even when `healthy: true`.
|
|
153
|
-
- `resolveOpenCode2UpgradeTarget(target)` / `rejectOpenCode1xUpgradeTarget(target)`:
|
|
153
|
+
- `resolveOpenCode2UpgradeTarget(target)` / `rejectOpenCode1xUpgradeTarget(target)`: require a resolved upgrade target and refuse 1.x; no historical default.
|
|
154
154
|
|
|
155
155
|
## Public exports (runtime-contract.js)
|
|
156
156
|
- Pure admission matrix. `RUNTIME_CONTRACT_MIN_VERIFIED` (`2.0.20`) is the documented 2.x floor, shared with the startup gate through `MINIMUM_OPENCODE2_VERSION`; the VS Code sidecar mirrors this floor. Capabilities include `core.protocol`, `session.prompt`, `session.queuedInput`, `session.background`, `session.generationFallback`, `migration.v1Read`.
|
|
@@ -167,8 +167,8 @@ This module provides OpenCode server integration utilities for the web server ru
|
|
|
167
167
|
- `buildUpgradeStatusSnapshot` / `evaluateOwnedUpgradeResult` / `createUpgradeOperationState` / `resolveOwnedCacheBinaryPath`.
|
|
168
168
|
|
|
169
169
|
## Public exports (ensure-cli.js)
|
|
170
|
-
- `ensurePinnedOpenCode2Cli({ discoveredPath, pin, autoInstall, install, readVersion })`: reuse any discovered acceptable 2.x CLI (official name `opencode`), then the newest verified owned cache. Only a fresh installation queries the stable 2.x release via `update-discovery.js`;
|
|
171
|
-
- `installPinnedOpenCode2Cli(options)`: download `@opencode/cli-<os>-<arch
|
|
170
|
+
- `ensurePinnedOpenCode2Cli({ discoveredPath, pin, autoInstall, install, readVersion })`: reuse any discovered acceptable 2.x CLI (official name `opencode`), then the newest verified owned cache. Only a fresh installation queries the stable 2.x release via `update-discovery.js`; the optional explicit `pin` remains an override, not a product default. Registry errors propagate without a historical fallback. Downloads stay under `~/.config/yuri/opencode-cli/<version>/opencode`. `YURI_OPENCODE2_AUTO_INSTALL=0` disables download (`OPENCODE_CLI_MISSING`).
|
|
171
|
+
- `installPinnedOpenCode2Cli(options)`: resolve latest stable 2.x unless a concrete version was supplied, download its `@opencode/cli-<os>-<arch>` package, extract, copy as `opencode`, chmod, verify `--version` against the resolved version.
|
|
172
172
|
- `installedOpenCode2BinaryPath(version)` / `installedOpenCode2BinaryCandidates(options)` / `readOpenCode2BinaryVersion(path)` / `isOpenCode2AutoInstallEnabled()`. Cache candidates are stable 2.x directories ordered by numeric version, so an offline restart discovers a newer installation rather than reverting to the packaged pin.
|
|
173
173
|
- `terminal-path.js` exposes owned-cache CLIs to new terminals on installation/reuse. It writes an idempotent source line to zsh `.zprofile`/`.zshrc` (including `ZDOTDIR`), bash `.bashrc` and the active login profile, POSIX `.profile`, or fish `config.fish`. The sourced file in the Yuri data directory selects the verified executable directory. Windows updates only user PATH, retaining unrelated entries, broadcasts the environment change, and records `opencode-path.windows` in the data directory. Subsequent owned-cache upgrades refresh an existing terminal integration after binary verification. Existing global installations do not trigger shell edits. PATH-setup failure warns and keeps the working Yuri runtime; a later startup retries. Existing terminal processes need a new shell, and shell-file changes already completed before a failure are retained.
|
|
174
174
|
- `upgradeSelectedOpenCodeCli({ binaryPath, version, launchSpec, env })`: runs the selected CLI's official `upgrade <version>` without a shell, with a five-minute deadline and bounded captured output. Returns the original CLI entry path, preserving Homebrew symlinks. Windows launch specs unwrap native/runtime shims; unresolved batch wrappers require terminal upgrade instead of spawning console grandchildren. Child output is not returned or logged. Package-manager failures never fall back to another installation; callers verify the original entry's version before restarting. Package-manager file changes cannot be rolled back by restoring Yuri's binary selection.
|
|
@@ -5,7 +5,7 @@ import path from 'node:path';
|
|
|
5
5
|
import { createOpenCodeUpdateDiscovery } from './update-discovery.js';
|
|
6
6
|
import { configureOpenCodeTerminalPath } from './terminal-path.js';
|
|
7
7
|
import {
|
|
8
|
-
|
|
8
|
+
MINIMUM_OPENCODE2_VERSION,
|
|
9
9
|
compareOpenCode2Versions,
|
|
10
10
|
isAcceptableOpenCode2HealthVersion,
|
|
11
11
|
isOpenCode2VersionAtLeast,
|
|
@@ -54,7 +54,7 @@ export function resolveYuriDataDir(env = process.env, homedir = os.homedir) {
|
|
|
54
54
|
return path.join(home, '.config', 'yuri');
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
export function installedOpenCode2BinaryPath(version =
|
|
57
|
+
export function installedOpenCode2BinaryPath(version = MINIMUM_OPENCODE2_VERSION, options = {}) {
|
|
58
58
|
const dataDir = options.dataDir || resolveYuriDataDir(options.env, options.homedir);
|
|
59
59
|
return path.join(dataDir, 'opencode-cli', version, openCodeBinaryName(options.platform));
|
|
60
60
|
}
|
|
@@ -160,7 +160,10 @@ const findBinary = (root, binaryName) => {
|
|
|
160
160
|
};
|
|
161
161
|
|
|
162
162
|
export async function installPinnedOpenCode2Cli(options = {}) {
|
|
163
|
-
const version = options.version ||
|
|
163
|
+
const version = options.version || await discoverLatestVersion();
|
|
164
|
+
if (!/^2\.\d+\.\d+$/.test(version) || (!options.version && !isOpenCode2VersionAtLeast(version))) {
|
|
165
|
+
throw new Error(`Invalid stable OpenCode installation target: ${version}`);
|
|
166
|
+
}
|
|
164
167
|
const platform = options.platform || process.platform;
|
|
165
168
|
const arch = options.arch || process.arch;
|
|
166
169
|
const dataDir = options.dataDir || resolveYuriDataDir(options.env, options.homedir);
|
|
@@ -239,10 +242,10 @@ export async function installPinnedOpenCode2Cli(options = {}) {
|
|
|
239
242
|
|
|
240
243
|
/**
|
|
241
244
|
* Reuse any discovered acceptable 2.x CLI. Fresh installs resolve stable 2.x;
|
|
242
|
-
*
|
|
245
|
+
* registry failures remain errors when no usable local installation exists.
|
|
243
246
|
*/
|
|
244
247
|
export async function ensurePinnedOpenCode2Cli(input = {}) {
|
|
245
|
-
const pin = input.pin ||
|
|
248
|
+
const pin = input.pin || MINIMUM_OPENCODE2_VERSION;
|
|
246
249
|
const discoveredPath = typeof input.discoveredPath === 'string' ? input.discoveredPath.trim() : '';
|
|
247
250
|
const autoInstall = input.autoInstall ?? isOpenCode2AutoInstallEnabled(input.env);
|
|
248
251
|
const readVersion = typeof input.readVersion === 'function'
|
|
@@ -276,20 +279,15 @@ export async function ensurePinnedOpenCode2Cli(input = {}) {
|
|
|
276
279
|
|
|
277
280
|
if (!autoInstall) {
|
|
278
281
|
const error = new Error(
|
|
279
|
-
|
|
282
|
+
'Unable to locate OpenCode 2. Set OPENCODE_BINARY or install @opencode/cli@2.',
|
|
280
283
|
);
|
|
281
284
|
error.code = 'OPENCODE_CLI_MISSING';
|
|
282
285
|
throw error;
|
|
283
286
|
}
|
|
284
287
|
|
|
285
|
-
|
|
286
|
-
if (!
|
|
287
|
-
|
|
288
|
-
const latest = await (input.resolveLatestVersion || discoverLatestVersion)();
|
|
289
|
-
if (/^2\.\d+\.\d+$/.test(latest) && isOpenCode2VersionAtLeast(latest, pin)) target = latest;
|
|
290
|
-
} catch {
|
|
291
|
-
console.warn('[OpenCode] Latest version lookup failed; using the tested fallback version.');
|
|
292
|
-
}
|
|
288
|
+
const target = input.pin || await (input.resolveLatestVersion || discoverLatestVersion)();
|
|
289
|
+
if (!/^2\.\d+\.\d+$/.test(target) || !isOpenCode2VersionAtLeast(target)) {
|
|
290
|
+
throw new Error(`Invalid stable OpenCode installation target: ${target}`);
|
|
293
291
|
}
|
|
294
292
|
const installedPath = await install({ ...input, version: target });
|
|
295
293
|
const version = readVersion(installedPath);
|
|
@@ -2,7 +2,7 @@ import fs from 'node:fs';
|
|
|
2
2
|
import os from 'node:os';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
5
|
-
|
|
5
|
+
const PINNED_OPENCODE2_VERSION = '2.0.23';
|
|
6
6
|
import { configureOpenCodeTerminalPath } from './terminal-path.js';
|
|
7
7
|
import {
|
|
8
8
|
ensurePinnedOpenCode2Cli,
|
|
@@ -45,11 +45,11 @@ describe('ensurePinnedOpenCode2Cli', () => {
|
|
|
45
45
|
|
|
46
46
|
it.each(['1.18.4', '3.0.0', '2.9.1-beta.1', '2.0.1'])('never chooses an unsuitable fresh-install target %s', async (latest) => {
|
|
47
47
|
const install = vi.fn(async () => '/installed/opencode');
|
|
48
|
-
await ensurePinnedOpenCode2Cli({ dataDir: createTempDir('yuri-invalid-cli-'), install,
|
|
48
|
+
await expect(ensurePinnedOpenCode2Cli({ dataDir: createTempDir('yuri-invalid-cli-'), install,
|
|
49
49
|
resolveLatestVersion: async () => latest,
|
|
50
50
|
readVersion: (file) => file === '/installed/opencode' ? PINNED_OPENCODE2_VERSION : '',
|
|
51
|
-
});
|
|
52
|
-
expect(install).
|
|
51
|
+
})).rejects.toThrow('Invalid stable OpenCode installation target');
|
|
52
|
+
expect(install).not.toHaveBeenCalled();
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
it('reuses the newest verified cache offline instead of reinstalling the pin', async () => {
|
|
@@ -67,14 +67,14 @@ describe('ensurePinnedOpenCode2Cli', () => {
|
|
|
67
67
|
expect(resolveLatestVersion).not.toHaveBeenCalled();
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
-
it('
|
|
70
|
+
it('reports registry failure without installing an obsolete fallback', async () => {
|
|
71
71
|
const dataDir = createTempDir('yuri-offline-cli-');
|
|
72
72
|
const install = vi.fn(async () => '/installed/opencode');
|
|
73
|
-
await ensurePinnedOpenCode2Cli({ dataDir, install,
|
|
73
|
+
await expect(ensurePinnedOpenCode2Cli({ dataDir, install,
|
|
74
74
|
resolveLatestVersion: async () => { throw new Error('offline'); },
|
|
75
75
|
readVersion: (file) => file === '/installed/opencode' ? PINNED_OPENCODE2_VERSION : '',
|
|
76
|
-
});
|
|
77
|
-
expect(install).
|
|
76
|
+
})).rejects.toThrow('offline');
|
|
77
|
+
expect(install).not.toHaveBeenCalled();
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
it('runs upgrade through the selected launch target and preserves its CLI entry path', async () => {
|
|
@@ -4,7 +4,7 @@ import os from 'node:os';
|
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { afterEach, describe, expect, it } from 'vitest';
|
|
6
6
|
import { createOpenCodeEnvRuntime } from './env-runtime.js';
|
|
7
|
-
|
|
7
|
+
const PINNED_OPENCODE2_VERSION = '2.0.23';
|
|
8
8
|
|
|
9
9
|
const originalOpencodeBinary = process.env.OPENCODE_BINARY;
|
|
10
10
|
const originalComSpec = process.env.ComSpec;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
//
|
|
2
|
-
export const PINNED_OPENCODE2_VERSION = '2.0.23';
|
|
1
|
+
// Runtime compatibility floor, independent of the latest stable installation target.
|
|
3
2
|
export const MINIMUM_OPENCODE2_VERSION = '2.0.20';
|
|
4
3
|
|
|
5
4
|
// Global npm/bun package that installs the opencode v2 binary (not 1.x opencode-ai).
|
|
@@ -66,7 +65,7 @@ export function resolveOpenCode2UpgradeTarget(target) {
|
|
|
66
65
|
rejectOpenCode1xUpgradeTarget(trimmed);
|
|
67
66
|
return trimmed;
|
|
68
67
|
}
|
|
69
|
-
|
|
68
|
+
throw new Error('Resolve a stable OpenCode 2.x version before upgrading');
|
|
70
69
|
}
|
|
71
70
|
|
|
72
71
|
/**
|
|
@@ -134,7 +133,7 @@ export function compareOpenCode2Versions(left, right) {
|
|
|
134
133
|
return 0;
|
|
135
134
|
}
|
|
136
135
|
|
|
137
|
-
export function isOpenCode2VersionAtLeast(version, minimum =
|
|
136
|
+
export function isOpenCode2VersionAtLeast(version, minimum = MINIMUM_OPENCODE2_VERSION) {
|
|
138
137
|
if (!isAcceptableOpenCode2HealthVersion(version)) return false;
|
|
139
138
|
return compareOpenCode2Versions(version, minimum) >= 0;
|
|
140
139
|
}
|