@yuriai/web 0.2.28 → 0.2.29-beta.4
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-GVufO03R.js +1 -0
- package/dist/assets/AssistantContactStatus-AG7iGeRF.js +3 -0
- package/dist/assets/{AssistantUnreadBadge-DqThZdCe.js → AssistantUnreadBadge-BMCaH0Cc.js} +1 -1
- package/dist/assets/{AssistantView-DPUDCXoY.js → AssistantView-C5ACV-pb.js} +1 -1
- package/dist/assets/{DiagramView-CHVLoYrV.js → DiagramView-DJDzscnd.js} +1 -1
- package/dist/assets/{FadeInOnReveal-Cj3JXYvE.js → FadeInOnReveal-8NiBU75a.js} +1 -1
- package/dist/assets/{GuiPluginSurface-CBZYeKHb.js → GuiPluginSurface-DfLl4Gd9.js} +1 -1
- package/dist/assets/{GuiPluginWindow-_Z5wycnH.js → GuiPluginWindow-CW0-Tapi.js} +1 -1
- package/dist/assets/{Icon-CeRMtJa8.js → Icon-CLLDJn-P.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-DjLaKB4o.js → ImageLoadingPlaceholder-DTWzB26a.js} +1 -1
- package/dist/assets/LoadingImage-B89ghYMH.js +1 -0
- package/dist/assets/MarkdownRenderer-YzZqs3v5.js +2 -0
- package/dist/assets/{MarkdownRendererImpl-_plqOlsV.js → MarkdownRendererImpl-BjjAFHTQ.js} +3 -3
- package/dist/assets/MarkstreamRendererImpl-D8tam--u.js +3 -0
- package/dist/assets/{MobileDetailNavigation-SeT764Ps.js → MobileDetailNavigation-B-AuJG6R.js} +1 -1
- package/dist/assets/{MobileResizableSheet-BY1-oo_E.js → MobileResizableSheet-CAj4YGtu.js} +1 -1
- package/dist/assets/{MobileShareBridge-Dw8gLtJD.js → MobileShareBridge-B8X_MEk1.js} +2 -2
- package/dist/assets/MobileTabPageHeader-vvveBlBV.js +2 -0
- package/dist/assets/MultiRunWindow-C0dOS6fA.js +1 -0
- package/dist/assets/{OnboardingScreen-CGqabMbp.js → OnboardingScreen-BdU6Tyax.js} +1 -1
- package/dist/assets/{OverlayScrollbar-AGSWQKg-.js → OverlayScrollbar-CzQC0JQI.js} +1 -1
- package/dist/assets/SettingsView-C0HSdVvS.css +1 -0
- package/dist/assets/SettingsView-aWGqxCrZ.js +30 -0
- package/dist/assets/SettingsWindow-rX0TNPNO.js +1 -0
- package/dist/assets/{TerminalView-OHqpkHzz.js → TerminalView-BArR-jEl.js} +3 -3
- package/dist/assets/ToolOutputDialog-Bdwio4o_.js +10 -0
- package/dist/assets/YuriLogo-BZC0ckt0.js +1 -0
- package/dist/assets/{appThemeRegistry-9j-rCSlE.js → appThemeRegistry-DOuA757r.js} +1 -1
- package/dist/assets/appearance--vFosLNi.js +1 -0
- package/dist/assets/{assistant-attachment-cache-B_qRvy-k.js → assistant-attachment-cache-DMw2Smc8.js} +1 -1
- package/dist/assets/{button-Bjh2BSXh.js → button-BF2cNEuq.js} +1 -1
- package/dist/assets/{capgoAdapter-DERfot6h.js → capgoAdapter-BBnW57us.js} +1 -1
- package/dist/assets/collapsible-CS5qCQRU.js +1 -0
- package/dist/assets/context-menu-C6l4ycZG.js +1 -0
- package/dist/assets/desktopRelayRestore-C7pjf6fE.js +1 -0
- package/dist/assets/{device-BcRP6Tjd.js → device-DN1GigI_.js} +1 -1
- package/dist/assets/{diagram-CXVm2vzI.js → diagram-D9-jif9d.js} +1 -1
- package/dist/assets/dialog-r7RRePv5.js +1 -0
- package/dist/assets/{dropdown-menu.styles-M78xpvb2.js → dropdown-menu.styles-CX8oXdks.js} +1 -1
- package/dist/assets/es-C8kGYKZo.js +15 -0
- package/dist/assets/{fileMentionTouchSelection-B9NbPN9D.js → fileMentionTouchSelection-dpFpcetU.js} +2 -2
- package/dist/assets/{fileQueries-BeXkd3o6.js → fileQueries-DWj9yB2g.js} +1 -1
- package/dist/assets/{fileReferenceActions-CrIAce3K.js → fileReferenceActions-BBLYnGEx.js} +1 -1
- package/dist/assets/{fr-CIGqV46N.js → fr-BV_9HcN9.js} +3 -3
- package/dist/assets/{gitApi-CY3D5CF0.js → gitApi-b2Mo4rXl.js} +1 -1
- package/dist/assets/{gitApiHttp-B7vYwgBh.js → gitApiHttp-DGAlAuET.js} +4 -4
- package/dist/assets/host-DB6QzbOw.js +1 -0
- package/dist/assets/image-loading-BUouaouB.js +1 -0
- package/dist/assets/input-DvF_mp0Y.js +1 -0
- package/dist/assets/insertionBoundaries-BviApxnS.js +1 -0
- package/dist/assets/{ja-DAhnTq6V.js → ja-CIMpz4Z2.js} +3 -3
- package/dist/assets/{ko-FbMgNKcI.js → ko-DPUsuWV1.js} +3 -3
- package/dist/assets/magpie-BuRvkGVQ.svg +1 -0
- package/dist/assets/main-BchAIbLD.js +2 -0
- package/dist/assets/main-Cp31rg32.js +169 -0
- package/dist/assets/{markdownHeightCache-DVWGXtAX.js → markdownHeightCache-D02GlOiy.js} +1 -1
- package/dist/assets/{markdownTheme-hpURsgju.js → markdownTheme-CHNl6tUv.js} +1 -1
- package/dist/assets/{mcpQueries-CdOYmUdO.js → mcpQueries-Cksi876R.js} +1 -1
- package/dist/assets/miniChat-BbuRxk9z.js +2 -0
- package/dist/assets/mobile-CBiiV7GW.js +2 -0
- package/dist/assets/{mobileBackNavigation-CgZndzFA.js → mobileBackNavigation-BsbWBz8h.js} +1 -1
- package/dist/assets/multirun-Ce977k1P.js +3 -0
- package/dist/assets/native-CILcYDJz.js +1 -0
- package/dist/assets/{native-config-BpsFKLGl.js → native-config-5BNfonUF.js} +1 -1
- package/dist/assets/persistence-Dta0OwIa.js +3 -0
- package/dist/assets/{pl-DzX0cbiQ.js → pl-ChxP5OZm.js} +3 -3
- package/dist/assets/projectMeta-KTYl7ter.js +1 -0
- package/dist/assets/pt-BR-9N8nJVqC.js +15 -0
- package/dist/assets/{queue-abort-optimistic-DCLBpirg.js → queue-abort-optimistic-CJmevpBJ.js} +1 -1
- package/dist/assets/{react-DRe85o5s.js → react-Bwr5-XPi.js} +1 -1
- package/dist/assets/readiness-CdCOcZnK.js +1 -0
- package/dist/assets/renderElectronMiniChatApp-wFpIvOFT.js +2 -0
- package/dist/assets/renderMobileApp-QJ2XwXGj.js +28 -0
- package/dist/assets/{runtime-file-download-Cf1WxfeW.js → runtime-file-download-o29morT6.js} +1 -1
- package/dist/assets/{runtime-file-resource-UJjHUF2C.js → runtime-file-resource-qB_oVdE6.js} +1 -1
- package/dist/assets/{runtimeConfig-BBgkLVr_.js → runtimeConfig-IuT6iZ4x.js} +1 -1
- package/dist/assets/runtimeEndpointReset-DEWSVYyD.js +149 -0
- package/dist/assets/scheduledTaskNavigation-BqkeRfVc.js +1 -0
- package/dist/assets/sessionLookup-mvlGQJTe.js +1 -0
- package/dist/assets/sortable-tabs-strip-Dc4Jr4ml.js +1 -0
- package/dist/assets/{speechSettingsQueries-CBSEAKyj.js → speechSettingsQueries-DEGyglgn.js} +2 -2
- package/dist/assets/src-DME3XM8W.css +2 -0
- package/dist/assets/{store-DVfZQktm.js → store-BPYoxYhv.js} +4 -4
- package/dist/assets/{terminalApi-rl9mZAlB.js → terminalApi-CPVNQ5DH.js} +1 -1
- package/dist/assets/{textarea-C6VQ7dHH.js → textarea-CIhiRPB2.js} +1 -1
- package/dist/assets/theme-validation-BGYdrOu7.js +1 -0
- package/dist/assets/themes-BgDJcxRc.js +1 -0
- package/dist/assets/tooltip-BoAbDVNP.js +1 -0
- package/dist/assets/{touch-gestures-K2_ZOkKW.js → touch-gestures-CErgaXZ7.js} +1 -1
- package/dist/assets/types-COEinOJU.js +2 -0
- package/dist/assets/uk-C-aeGNQI.js +15 -0
- package/dist/assets/{useAppFontEffects-CEgDiZHu.js → useAppFontEffects-C__cAJlw.js} +43 -43
- package/dist/assets/{useAssistantUIStore-CfaQV3ID.js → useAssistantUIStore-CYyXdd5c.js} +1 -1
- package/dist/assets/useDesktopWindowControlsLayout-BYt7I5so.js +1 -0
- package/dist/assets/{useEffectiveDirectory-BOYMJ6k7.js → useEffectiveDirectory-CcDsvhjq.js} +1 -1
- package/dist/assets/{useFontPreferences-DeqW9nRx.js → useFontPreferences-UzjDmx4b.js} +1 -1
- package/dist/assets/useMobileNavigationStore-BgM0EvUr.js +17 -0
- package/dist/assets/{useThemeSystem-CGF5jnIh.js → useThemeSystem-CNzUUkFn.js} +1 -1
- package/dist/assets/useUIStore-BDZCXouA.js +1 -0
- package/dist/assets/{useWorkerHighlightedLines-EcJThS4x.js → useWorkerHighlightedLines-ZOArIAed.js} +1 -1
- package/dist/assets/vendor-base-ui-CzHs0bHY.js +1 -0
- package/dist/assets/{vendor-cmdk-C3oBVL9X.js → vendor-cmdk-C_tivUtr.js} +1 -1
- package/dist/assets/vendor-codemirror-autocomplete-C0FrlFqZ.js +12 -0
- package/dist/assets/vendor-codemirror-commands-5saeUOVY.js +1 -0
- package/dist/assets/vendor-codemirror-lang-angular-Cm7vBE3E.js +23 -0
- package/dist/assets/vendor-codemirror-lang-cpp-BjixvwC2.js +1 -0
- package/dist/assets/vendor-codemirror-lang-go-DFb2d_8t.js +11 -0
- package/dist/assets/vendor-codemirror-lang-java-CHitPigf.js +1 -0
- package/dist/assets/vendor-codemirror-lang-jinja-B8yrwpok.js +1 -0
- package/dist/assets/{vendor-codemirror-lang-json-mLulNbwB.js → vendor-codemirror-lang-json-DowyFczU.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-less-CNvptX3P.js → vendor-codemirror-lang-less-B1_0-sTl.js} +1 -1
- package/dist/assets/vendor-codemirror-lang-liquid-FIsA7YFN.js +1 -0
- package/dist/assets/vendor-codemirror-lang-markdown-npWBZIoE.js +6 -0
- package/dist/assets/vendor-codemirror-lang-php-wyEc0fdz.js +1 -0
- package/dist/assets/vendor-codemirror-lang-python-OPRdU26g.js +9 -0
- package/dist/assets/{vendor-codemirror-lang-rust-CtafR0gt.js → vendor-codemirror-lang-rust-DgovszuH.js} +1 -1
- package/dist/assets/vendor-codemirror-lang-sass-BdU-i07o.js +1 -0
- package/dist/assets/{vendor-codemirror-lang-sql-C6q09UUZ.js → vendor-codemirror-lang-sql-DUutq98l.js} +2 -2
- package/dist/assets/{vendor-codemirror-lang-vue-DIB78UsR.js → vendor-codemirror-lang-vue-CuRNbe8H.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-wast-C_JVdOCF.js → vendor-codemirror-lang-wast-CGFAOCoB.js} +1 -1
- package/dist/assets/vendor-codemirror-lang-xml-CMKBqGXF.js +1 -0
- package/dist/assets/{vendor-codemirror-lang-yaml-BO0hIfQM.js → vendor-codemirror-lang-yaml-CH9a1QiY.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-Ctd4WxgW.js → vendor-codemirror-language-data-B3pLWvv-.js} +2 -2
- package/dist/assets/vendor-codemirror-search-hZY-L2l8.js +2 -0
- package/dist/assets/{vendor-dnd-kit-accessibility-DxpFzZhi.js → vendor-dnd-kit-accessibility-BOtnpZt5.js} +1 -1
- package/dist/assets/{vendor-dnd-kit-core-B3g3zWQd.js → vendor-dnd-kit-core-DK4OoOTr.js} +1 -1
- package/dist/assets/{vendor-dnd-kit-sortable-BKewx0Py.js → vendor-dnd-kit-sortable-Cv69eQm1.js} +1 -1
- package/dist/assets/{vendor-framer-motion-C1twy-GF.js → vendor-framer-motion-DDMKlXiP.js} +1 -1
- package/dist/assets/vendor-lodash-es-BS45jPoZ.js +1 -0
- package/dist/assets/{vendor-markstream-react-BlbOg72y.js → vendor-markstream-react-DfLaSG3W.js} +3 -3
- package/dist/assets/vendor-motion-C9oiAdx-.js +1 -0
- package/dist/assets/{vendor-pierre-diffs-Bj9Nqn6w.js → vendor-pierre-diffs-BFiZ3IhI.js} +2 -2
- package/dist/assets/{vendor-react-D5d-V1vN.js → vendor-react-DlzBev0S.js} +1 -1
- package/dist/assets/{vendor-react-drawio-C-iPmmED.js → vendor-react-drawio-Dyg1-39Q.js} +1 -1
- package/dist/assets/vendor-reactuses-core-DWo5Wn6R.js +1 -0
- package/dist/assets/{vendor-replit-codemirror-vim-DCdAdxvE.js → vendor-replit-codemirror-vim-BmQmU1lR.js} +6 -6
- package/dist/assets/{vendor-sonner-r2EJnfoo.js → vendor-sonner-BEHGipm5.js} +1 -1
- package/dist/assets/{vendor-stream-diffs-BnLmeqg2.js → vendor-stream-diffs-wcQxoPZk.js} +2 -2
- package/dist/assets/{vendor-tanstack-react-query-C4SG3JZB.js → vendor-tanstack-react-query-B2psfNaU.js} +1 -1
- package/dist/assets/{vendor-tanstack-react-virtual-BeZn51tF.js → vendor-tanstack-react-virtual-DSFNK3qc.js} +1 -1
- package/dist/assets/{vendor-zustand-B43HCgwC.js → vendor-zustand-vDaAPGfl.js} +1 -1
- package/dist/assets/zh-CN-DOchDQti.js +15 -0
- package/dist/assets/zh-TW-Dtigv2CE.js +15 -0
- package/dist/index.html +18 -18
- package/dist/mini-chat.html +18 -18
- package/dist/mobile.html +18 -18
- package/package.json +2 -1
- package/server/lib/config-sync/DOCUMENTATION.md +1 -0
- package/server/lib/config-sync/config-sync.test.js +22 -0
- package/server/lib/config-sync/constants.js +0 -3
- package/server/lib/gui-customization/DOCUMENTATION.md +45 -0
- package/server/lib/gui-customization/session-skill.js +58 -0
- package/server/lib/gui-customization/session-skill.test.js +53 -0
- package/server/lib/gui-customization/skill/SKILL.md +33 -0
- package/server/lib/gui-customization/skill/references/appearance.md +79 -0
- package/server/lib/gui-customization/skill/references/file-previews.md +113 -0
- package/server/lib/gui-customization/skill/references/global-pages.md +81 -0
- package/server/lib/gui-customization/skill/references/gui-api.md +37 -0
- package/server/lib/gui-customization/skill/references/preview-exports.md +74 -0
- package/server/lib/gui-customization/skill/references/workflow.md +81 -0
- package/server/lib/opencode/DOCUMENTATION.md +74 -1
- package/server/lib/opencode/config-entity-routes.js +2 -4
- package/server/lib/opencode/config-entity-routes.test.js +16 -13
- package/server/lib/opencode/core-routes.js +2 -0
- package/server/lib/opencode/core-routes.test.js +2 -2
- package/server/lib/opencode/custom-provider-models.d.ts +2 -0
- package/server/lib/opencode/custom-provider-models.js +71 -0
- package/server/lib/opencode/custom-provider-models.test.js +90 -0
- package/server/lib/opencode/custom-provider.d.ts +2 -0
- package/server/lib/opencode/custom-provider.js +107 -0
- package/server/lib/opencode/custom-provider.test.js +211 -0
- package/server/lib/opencode/feature-routes-runtime.js +5 -0
- package/server/lib/opencode/provider-catalog.js +14 -0
- package/server/lib/opencode/provider-catalog.test.js +15 -0
- package/server/lib/opencode/provider-configuration.test.js +64 -0
- package/server/lib/opencode/provider-model-config.d.ts +1 -0
- package/server/lib/opencode/provider-model-config.js +39 -0
- package/server/lib/opencode/provider-model-config.test.js +69 -0
- package/server/lib/opencode/provider-sources.d.ts +10 -0
- package/server/lib/opencode/provider-sources.js +52 -0
- package/server/lib/opencode/provider-sources.test.js +73 -0
- package/server/lib/opencode/providers.d.ts +5 -0
- package/server/lib/opencode/providers.js +28 -0
- package/server/lib/opencode/routes.js +50 -1
- package/server/lib/remote-desktop/DOCUMENTATION.md +6 -2
- package/server/lib/remote-desktop/runtime.js +3 -2
- package/server/lib/remote-desktop/runtime.test.js +20 -0
- package/server/lib/scheduled-tasks/session-skill.js +3 -0
- package/server/lib/scheduled-tasks/session-skill.test.js +4 -2
- package/shared/custom-provider-protocol.d.ts +4 -0
- package/shared/custom-provider-protocol.js +32 -0
- package/dist/assets/AgentAvatar-BybF1ayP.js +0 -1
- package/dist/assets/AssistantContactStatus-BwpxTn0d.js +0 -3
- package/dist/assets/LoadingImage-DG3otL5V.js +0 -1
- package/dist/assets/MarkdownRenderer-C8rv6z7p.js +0 -2
- package/dist/assets/MarkstreamRendererImpl-bs8HZ4Ra.js +0 -3
- package/dist/assets/MobileTabPageHeader-EsrOCLyg.js +0 -2
- package/dist/assets/MultiRunWindow-C-Qw_g7N.js +0 -1
- package/dist/assets/SettingsView-BLfFnnnX.js +0 -29
- package/dist/assets/SettingsView-BRIvklfP.css +0 -1
- package/dist/assets/SettingsWindow-lyYO8Byy.js +0 -1
- package/dist/assets/ToolOutputDialog-DU4Pb1s0.js +0 -10
- package/dist/assets/YuriLogo-Bb6yHagP.js +0 -1
- package/dist/assets/collapsible-BEAHoxNi.js +0 -1
- package/dist/assets/context-menu-BxLcot-3.js +0 -1
- package/dist/assets/desktopRelayRestore-D1UX7HW2.js +0 -1
- package/dist/assets/dialog-nshKUSE5.js +0 -1
- package/dist/assets/es-N9ZkQwG9.js +0 -15
- package/dist/assets/host-CnVx34Dh.js +0 -1
- package/dist/assets/image-loading-D6kOgU4w.js +0 -1
- package/dist/assets/input-3Re4pmHm.js +0 -1
- package/dist/assets/insertionBoundaries-DK7XYF8d.js +0 -1
- package/dist/assets/main-B_THXYMs.js +0 -2
- package/dist/assets/main-CpcudEZb.js +0 -169
- package/dist/assets/miniChat-DxZiTnAZ.js +0 -2
- package/dist/assets/mobile-BJuATiaC.js +0 -2
- package/dist/assets/multirun-BlaYsQi2.js +0 -3
- package/dist/assets/native-BYMhr-xH.js +0 -1
- package/dist/assets/persistence-CWuLIq1J.js +0 -3
- package/dist/assets/projectMeta-CnXHTolN.js +0 -1
- package/dist/assets/pt-BR-C5yvwyDK.js +0 -15
- package/dist/assets/readiness-U16Qor79.js +0 -1
- package/dist/assets/renderElectronMiniChatApp-n-nhgy1V.js +0 -2
- package/dist/assets/renderMobileApp-DBj_7RlD.js +0 -28
- package/dist/assets/runtimeEndpointReset-BvSQVFfx.js +0 -149
- package/dist/assets/scheduledTaskNavigation-EomDNVu2.js +0 -1
- package/dist/assets/sessionLookup-C_CCp7MJ.js +0 -1
- package/dist/assets/sortable-tabs-strip-p16Pn6Zz.js +0 -1
- package/dist/assets/src-u-YDfCVw.css +0 -2
- package/dist/assets/tooltip-Dnc6GA-X.js +0 -1
- package/dist/assets/types-DnZw0gLD.js +0 -2
- package/dist/assets/uk-zbDcUpBy.js +0 -15
- package/dist/assets/useDesktopWindowControlsLayout-B2o4IFmd.js +0 -1
- package/dist/assets/useMobileNavigationStore-DlvrZQ49.js +0 -17
- package/dist/assets/useUIStore-C6CE42oh.js +0 -1
- package/dist/assets/vendor-base-ui-BQjbsJ43.js +0 -1
- package/dist/assets/vendor-codemirror-autocomplete-7c2L_4dM.js +0 -12
- package/dist/assets/vendor-codemirror-commands-B8KrBQ9B.js +0 -1
- package/dist/assets/vendor-codemirror-lang-angular-DXOgWEVj.js +0 -23
- package/dist/assets/vendor-codemirror-lang-cpp-Dh8C3xqP.js +0 -1
- package/dist/assets/vendor-codemirror-lang-go-BXAJ1_dh.js +0 -11
- package/dist/assets/vendor-codemirror-lang-java-DAyCHRhk.js +0 -1
- package/dist/assets/vendor-codemirror-lang-jinja-0TICrMfO.js +0 -1
- package/dist/assets/vendor-codemirror-lang-liquid-8g5seytq.js +0 -1
- package/dist/assets/vendor-codemirror-lang-markdown-CV1IO6Qs.js +0 -6
- package/dist/assets/vendor-codemirror-lang-php-xP7rf28_.js +0 -1
- package/dist/assets/vendor-codemirror-lang-python-YM2WVLHF.js +0 -9
- package/dist/assets/vendor-codemirror-lang-sass-B4iav_Ps.js +0 -1
- package/dist/assets/vendor-codemirror-lang-xml-DIuzY_d4.js +0 -1
- package/dist/assets/vendor-codemirror-search-DiPwvA-6.js +0 -2
- package/dist/assets/vendor-lodash-es-DfLbG5Af.js +0 -1
- package/dist/assets/vendor-motion-BmLx2V78.js +0 -1
- package/dist/assets/vendor-reactuses-core-BcebBLwF.js +0 -1
- package/dist/assets/zh-CN-BHRJ7CF3.js +0 -15
- package/dist/assets/zh-TW-BFI_YFd-.js +0 -15
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Custom file formats and previews
|
|
2
|
+
|
|
3
|
+
A file parser/viewer uses official `LinkHandler` + `Panel` + `PanelTab.file`, optionally `yuri.file-icon`. Yuri matches the tab's normalized complete file path to its existing file preview and mounts your Solid view there, including the mobile file sheet. The plugin owns format parsing and rendering; a custom format can use ordinary DOM/Solid without an iframe or compiler. Upstream `FileViewer` is unsupported in Yuri.
|
|
4
|
+
|
|
5
|
+
## Complete JSON-format viewer
|
|
6
|
+
|
|
7
|
+
This working entry recognizes `.report.json`, parses JSON into formatted text, retains its DOM on background updates, and localizes errors. Use the package/build config in [workflow](workflow.md). A real visual report renderer replaces only the parsing/rendering part.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { bindPlugin, createKeyed, LinkHandler, Panel, Plugin, usePlugin, type PanelProps, type PanelTab } from '@opencode/plugin/gui'
|
|
11
|
+
import { createComponent, onCleanup } from 'solid-js'
|
|
12
|
+
|
|
13
|
+
const suffix = '.report.json'
|
|
14
|
+
function matches(href: string): boolean {
|
|
15
|
+
if (!href || /[\u0000\r\n]/.test(href) || /^[#?]/.test(href)) return false
|
|
16
|
+
if (/^[a-z][a-z\d+.-]*:/i.test(href) && !/^file:/i.test(href) && !/^[a-z]:[\\/]/i.test(href)) return false
|
|
17
|
+
return href.split(/[?#]/, 1)[0].toLowerCase().endsWith(suffix)
|
|
18
|
+
}
|
|
19
|
+
function linkPath(link: { href: string; base?: string }): string {
|
|
20
|
+
const href = link.href.split(/[?#]/, 1)[0]
|
|
21
|
+
return link.base && !/^(?:[a-z]+:|[\\/])/i.test(href) ? `${link.base}/${href}` : href
|
|
22
|
+
}
|
|
23
|
+
function Preview(props: PanelProps): HTMLElement {
|
|
24
|
+
const ctx = usePlugin()
|
|
25
|
+
const root = document.createElement('section')
|
|
26
|
+
const status = document.createElement('p')
|
|
27
|
+
status.setAttribute('role', 'status')
|
|
28
|
+
const content = document.createElement('pre')
|
|
29
|
+
content.style.cssText = 'white-space:pre-wrap;overflow-wrap:anywhere'
|
|
30
|
+
root.append(status, content)
|
|
31
|
+
createKeyed(() => JSON.stringify([props.session.key, props.screen.file.root, props.tab.file]), () => {
|
|
32
|
+
const file = props.screen.file
|
|
33
|
+
const path = props.tab.file
|
|
34
|
+
if (!path) return
|
|
35
|
+
let active = true
|
|
36
|
+
status.textContent = ctx.t('loading')
|
|
37
|
+
content.textContent = ''
|
|
38
|
+
void file.sync(path).catch(() => { if (active) status.textContent = ctx.t('failed') })
|
|
39
|
+
onCleanup(() => { active = false; file.unwatch(path) })
|
|
40
|
+
createKeyed(() => file.get(path), (state) => {
|
|
41
|
+
if (state.error || state.notFound) { status.textContent = ctx.t('failed'); return }
|
|
42
|
+
if (!state.loaded || !state.content) return
|
|
43
|
+
try {
|
|
44
|
+
const report: unknown = JSON.parse(state.content.content)
|
|
45
|
+
content.textContent = JSON.stringify(report, null, 2)
|
|
46
|
+
status.textContent = ''
|
|
47
|
+
} catch { status.textContent = ctx.t('invalid') }
|
|
48
|
+
})
|
|
49
|
+
})
|
|
50
|
+
return root
|
|
51
|
+
}
|
|
52
|
+
export default Plugin.define({
|
|
53
|
+
i18n: {
|
|
54
|
+
en: { loading: 'Loading report…', failed: 'Could not read report', invalid: 'Invalid report JSON' },
|
|
55
|
+
'zh-CN': { loading: '正在加载报告…', failed: '无法读取报告', invalid: '报告 JSON 格式无效' },
|
|
56
|
+
},
|
|
57
|
+
setup(ctx) {
|
|
58
|
+
const tabs = new Map<string, PanelTab>()
|
|
59
|
+
const View = bindPlugin((props: PanelProps) => createComponent(Preview, props))
|
|
60
|
+
ctx.add(LinkHandler, {
|
|
61
|
+
priority: 10,
|
|
62
|
+
match: (link) => matches(link.href),
|
|
63
|
+
exists: (link) => {
|
|
64
|
+
const file = ctx.screen.current()?.file
|
|
65
|
+
return file ? file.exists(file.resolve(linkPath(link))) : false
|
|
66
|
+
},
|
|
67
|
+
open: (link) => {
|
|
68
|
+
const screen = ctx.screen.current()
|
|
69
|
+
const session = link.session ?? ctx.sessions.current()
|
|
70
|
+
if (screen && session) ctx.layout.open(`${ctx.id}:${screen.file.resolve(linkPath(link))}`, session, { background: link.background })
|
|
71
|
+
},
|
|
72
|
+
})
|
|
73
|
+
ctx.add(Panel, {
|
|
74
|
+
id: 'report', region: 'side', mobile: { title: 'Reports', order: 46, kind: 'menu' },
|
|
75
|
+
list: (input) => {
|
|
76
|
+
const wanted = input.open.filter(matches)
|
|
77
|
+
for (const path of tabs.keys()) if (!wanted.includes(path)) tabs.delete(path)
|
|
78
|
+
return wanted.map((path) => {
|
|
79
|
+
let tab = tabs.get(path)
|
|
80
|
+
if (!tab) { tab = { id: path, title: path.split(/[\\/]/).at(-1) ?? path, file: path, closable: 'compact' }; tabs.set(path, tab) }
|
|
81
|
+
return tab
|
|
82
|
+
})
|
|
83
|
+
},
|
|
84
|
+
render: (props) => createComponent(View, props),
|
|
85
|
+
})
|
|
86
|
+
},
|
|
87
|
+
})
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
`Panel.list` returns stable tab objects; `file` is the full canonical workspace-relative or absolute path, not its basename. Read `props.session`, `props.tab`, and `props.screen.file` through live getters. The owner changes on directory/file identity, not on each token or ordinary parent render. `file.sync(path)` reads and acquires a watch; `file.get(path)` is reactive; `file.unwatch(path)` releases it. There is no public `file.watch` method. Source reads are bounded at 128 KiB UTF-8, 64 model entries; a held lease observes changes at a 2-second foreground stat interval, not push-real-time.
|
|
91
|
+
|
|
92
|
+
Register `yuri.file-icon` as `{ id, extensions: ['report'], svg, lightSvg? }` for a dedicated extension. Matching uses the final extension only: `.report.json` is still `json`, so registering `json` changes **all** JSON file icons. Prefer a distinct suffix such as `.report` when you want a dedicated icon. Directories are never overridden. SVG safety rules are shared with branding; limits are 64 entries/plugin, 512/window, 1–64 extensions/entry, 8 MiB total raw SVG.
|
|
93
|
+
|
|
94
|
+
## Optional: executable formats
|
|
95
|
+
|
|
96
|
+
When a format executes source rather than displaying data:
|
|
97
|
+
|
|
98
|
+
- Treat source as untrusted content. Decide the iframe sandbox, allowed dependencies and network policy deliberately; a same-document plugin is not a security sandbox.
|
|
99
|
+
- Keep the outer preview DOM/iframe stable for background changes. Send revisioned updates; don't reset the reading position or recreate the frame on every file poll.
|
|
100
|
+
- Validate message source, expected origin (or the explicitly designed opaque-origin protocol), frame ID and source revision. Ignore messages from old attempts/closed panels.
|
|
101
|
+
- `iframe.onload`, runtime initialization and content commit are different milestones. Show local loading until the current source actually commits; retain prior interactive content during a background update. A file/read/compile error is not authoritative empty success.
|
|
102
|
+
- Close/retry/source-mode transitions remove listeners, cancel stale work and dispose the frame. Two mounted instances of one tab must not share mutable DOM, screenshot targets or controllers.
|
|
103
|
+
- If preview actions or exports are requested, use [preview actions and exports](preview-exports.md). The host owns placement; the plugin owns rendering and capture for each mounted instance.
|
|
104
|
+
|
|
105
|
+
### Case study: Eficy
|
|
106
|
+
|
|
107
|
+
Source: npm `@eficy/opencode2-plugin`, https://github.com/yee94/opencode-eficy. See `src/gui.tsx`, `src/file-links.ts`, `src/frame.ts`, and `packages/opencode2-plugin/README.md`.
|
|
108
|
+
|
|
109
|
+
Eficy routes `.eficy` into a Panel and supplies an iframe runtime to compile/render TSX. Its separate server entry registers an agent skill and validation tool. This illustrates an executable format with server-side authoring support; neither the TSX runtime nor the server entry is required for a data-only viewer. Consult the integration's current source for its frame protocol and dependencies.
|
|
110
|
+
|
|
111
|
+
## Verification
|
|
112
|
+
|
|
113
|
+
Verify local-path matching, unrelated-link handling, valid/invalid/missing input, background updates preserving the view, and cleanup on close or disable. Exercise two mounted instances and the target mobile layout when applicable. Executable formats also need stale-result and execution-boundary checks.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Global pages and tabs
|
|
2
|
+
|
|
3
|
+
Yuri provides a global **main-content placement**, not a new renderer. `yuri.page` registers Solid content; `yuri.pages` opens the caller's page. The same host mounting, plugin context, options and cleanup are used by pages, file panels and settings. A page can render ordinary Solid/DOM or embed an existing web app in an iframe. It does not need a session or plugin `main`.
|
|
4
|
+
|
|
5
|
+
## Complete window entry
|
|
6
|
+
|
|
7
|
+
Use the package and Vite config from [workflow](workflow.md), replacing `src/gui.tsx` with:
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { Command, Contract, Plugin, Registry, TitlebarItem, usePlugin, type IconName, type TitlebarItem as TitlebarContribution } from '@opencode/plugin/gui'
|
|
11
|
+
import { createComponent, type JSX } from 'solid-js'
|
|
12
|
+
|
|
13
|
+
const Page = Registry.define<{
|
|
14
|
+
id: string; title: string; icon?: IconName; render(): JSX.Element
|
|
15
|
+
}>('yuri.page')
|
|
16
|
+
const Pages = Contract.define<{
|
|
17
|
+
open(id: string): boolean; current(): string | undefined
|
|
18
|
+
}, 'yuri.pages'>('yuri.pages')
|
|
19
|
+
|
|
20
|
+
function Dashboard(): HTMLElement {
|
|
21
|
+
const ctx = usePlugin()
|
|
22
|
+
const root = document.createElement('section')
|
|
23
|
+
root.className = 'studio-dashboard'
|
|
24
|
+
root.textContent = typeof ctx.options.message === 'string' ? ctx.options.message : ctx.t('welcome')
|
|
25
|
+
return root
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default Plugin.define({
|
|
29
|
+
i18n: {
|
|
30
|
+
en: { open: 'Open Studio', welcome: 'Studio dashboard', unavailable: 'Studio is unavailable in this layout' },
|
|
31
|
+
'zh-CN': { open: '打开 Studio', welcome: 'Studio 看板', unavailable: '当前布局不支持 Studio' },
|
|
32
|
+
},
|
|
33
|
+
setup(ctx) {
|
|
34
|
+
const pages = ctx.use(Pages)
|
|
35
|
+
ctx.add(Page, { id: 'dashboard', title: 'Studio', icon: 'window-analytics', render: () => createComponent(Dashboard, {}) })
|
|
36
|
+
const open = () => {
|
|
37
|
+
const live = pages()
|
|
38
|
+
if (!ctx.layout.narrow() && live.status === 'active' && live.value.open('dashboard')) return
|
|
39
|
+
ctx.toast.show({ title: ctx.t('unavailable'), variant: 'error' })
|
|
40
|
+
}
|
|
41
|
+
ctx.add(TitlebarItem, (): TitlebarContribution | undefined => {
|
|
42
|
+
if (ctx.layout.narrow()) return
|
|
43
|
+
const live = pages()
|
|
44
|
+
return {
|
|
45
|
+
id: 'dashboard', label: 'Studio', title: ctx.t('open'), icon: 'window-analytics',
|
|
46
|
+
pressed: live.status === 'active' && live.value.current() === 'dashboard', run: open,
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
ctx.add(Command, () => ({ id: 'dashboard', title: ctx.t('open'), enabled: !ctx.layout.narrow(), run: open }))
|
|
50
|
+
},
|
|
51
|
+
})
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The host key is `JSON.stringify([pluginId, pageId])`; pass only your **local** page ID to `pages.open`. The API cannot open another plugin's page or override a host contract. It returns false if navigation is unavailable. Access `ctx.use(Pages)()` live when clicking; it can be inactive while a provider is unavailable.
|
|
55
|
+
|
|
56
|
+
Global pages and their entry points are for desktop/Web desktop layouts and VS Code. On mobile the pages contract is inactive and the page is not mounted; hide the titlebar item and disable its command when `ctx.layout.narrow()`. Use a file Panel for mobile file previews instead. Registration itself does not navigate.
|
|
57
|
+
|
|
58
|
+
## Optional: embed an existing application
|
|
59
|
+
|
|
60
|
+
Use ordinary Solid/DOM for plugin-owned content; an iframe is an option for an existing web application, not a page requirement. For an embedded application:
|
|
61
|
+
|
|
62
|
+
- Verify browser reachability, CSP, mixed-content and framing policy before choosing this design.
|
|
63
|
+
- Use the service's supported authentication flow. A message-based handshake requires a receiver on both sides; validate message source and origin and send credentials only to the exact recipient origin. Keep credentials out of URLs and persisted page snapshots.
|
|
64
|
+
- Keep embedded navigation within the page's intended scope. Custom history controls and navigation messages are needed only if the requested interaction calls for them.
|
|
65
|
+
- Own frames and listeners within the mounted component; release them with `onCleanup`. Preserve the mounted view across unrelated session/render updates.
|
|
66
|
+
|
|
67
|
+
### Case study: Runmark
|
|
68
|
+
|
|
69
|
+
Source: npm `@runmarks/opencode-plugin`, repository package `packages/plugin-opencode`; see `src/gui.ts`, `src/gui-pages.ts`, `src/gui-frame.ts`, `src/gui-navigation.ts`, and its README.
|
|
70
|
+
|
|
71
|
+
Runmark embeds its existing Dashboard. `DashboardFrame` reads `endpoint` / `apiKey` from `usePlugin().options`; a source/origin-checked `runmark.embed.ready` / `runmark.embed.auth` handshake supplies in-memory `X-API-Key` authentication. Its embedded fetches omit cookies and reject redirects. Its navigation UI uses bounded in-memory history and `runmark.embed.location` / `runmark.embed.navigate` messages.
|
|
72
|
+
|
|
73
|
+
Those message names, header and navigation rules form Runmark's service protocol, not the `yuri.page` contract. Consult the integration's current source when adapting it.
|
|
74
|
+
|
|
75
|
+
## Entry icon versus content branding
|
|
76
|
+
|
|
77
|
+
The top-level plugin `package.json` `icon` supplies Yuri's plugin-entry artwork when available (validated image/data resource; monochrome SVG can follow `currentColor` through the host mask). `TitlebarItem.icon` is a name from the official icon catalog. Neither replaces the application's Logo; use `yuri.branding` for that. Keep existing official product artwork instead of inventing a substitute.
|
|
78
|
+
|
|
79
|
+
## Verification
|
|
80
|
+
|
|
81
|
+
Verify opening/current-page state, access to the plugin's options, inactive-layout behavior, and cleanup on close, disable or replacement. For an embedded service, also verify its authentication and navigation boundaries and confirm unrelated session updates retain the view.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Yuri GUI host reference
|
|
2
|
+
|
|
3
|
+
The supported contract is OpenCode GUI SDK **2.2.0**. Consult current official docs at https://opencode.ai/v2/docs/build/plugins/gui for SDK syntax, then respect Yuri's narrower implementation below. Never assume an upstream feature is implemented here.
|
|
4
|
+
|
|
5
|
+
## Window APIs
|
|
6
|
+
|
|
7
|
+
- `Command`: command palette and plugin management execution; hidden commands can be called by `ctx.commands.run`. No GUI shortcut registration or slash autocomplete yet.
|
|
8
|
+
- `TitlebarItem`: global action/status, independent of a session; reactive label/title/icon/busy/pressed.
|
|
9
|
+
- `Panel`: Solid `list/render`, reactive session/tab getters; file panels mount in existing file previews. An independent panel uses a dialog/mobile sheet, not upstream's full draggable workspace layout.
|
|
10
|
+
- `LinkHandler`: match, exists and open file/custom links. Use `ctx.links.open({ href, base, session })` for navigation. Preserve workspace-relative identity; never resolve against a different session's directory.
|
|
11
|
+
- `SettingsPage`: independent plugin settings pages; host `page/section` injection is unsupported.
|
|
12
|
+
- `MenuItem`: `session.panel` only.
|
|
13
|
+
- `Style`: document CSS, automatic cleanup.
|
|
14
|
+
- `Registry` / `Contract`: contribution lists and live APIs. Own provided token IDs under your plugin ID; `yuri.*` is host-reserved for providers. Declare tokens once in a contract module. Use `bindPlugin` for Solid components shared with another plugin.
|
|
15
|
+
- `Store.global` / `Store.session`, translation dictionaries, `ctx.options`; no `from` migration or live cross-window store sync yet. Do not publish options/credentials in URLs, DOM or storage snapshots.
|
|
16
|
+
- `ctx.sessions.current()`, current screen files and implemented layout operations; missing members explicitly reject.
|
|
17
|
+
- `ctx.toast.show`: pure-text title/description, default/success/error/loading, duration/persistent, returned dismiss; no icon/actions.
|
|
18
|
+
- `ctx.system.save`: client-owned UTF-8 file save (32 MiB bound); platform cancellation returns false. `ctx.system.copy` / `openExternal` are available.
|
|
19
|
+
- Server plugin RPC through the current authenticated `ctx.client`; GUI cannot install remote server tools by itself.
|
|
20
|
+
|
|
21
|
+
Unsupported registries include upstream `Server`, `ComposerPill`, `Slot`, `FileViewer`, native menu/embeds. Unsupported APIs reject rather than succeeding silently.
|
|
22
|
+
|
|
23
|
+
## Yuri supplemental registries and contracts
|
|
24
|
+
|
|
25
|
+
- `yuri.theme`, `yuri.branding`: see [appearance](appearance.md).
|
|
26
|
+
- `yuri.file-icon`: `{ id, extensions: string[], svg, lightSvg? }`; static SVG resources for file extensions, not app/Dock icons.
|
|
27
|
+
- `yuri.page` / `yuri.pages`: global main-content Solid pages, desktop layouts/VS Code only. Exact types, entry points and optional web-app embedding: [global pages](global-pages.md).
|
|
28
|
+
- Custom suffix parsing, normalized file identities, `PanelTab.file` and mobile sheets: [file previews](file-previews.md).
|
|
29
|
+
- `yuri.exportPDF`, `yuri.exportLongImage`, `yuri.previewActions`: separate host contracts for client-owned export/preview actions. Exact types, registration lifetime, capture protocol and runtime matrix: [preview actions and exports](preview-exports.md).
|
|
30
|
+
|
|
31
|
+
## Lifecycle and platforms
|
|
32
|
+
|
|
33
|
+
`setup` is synchronous and runs under a Solid owner. Register contributions there; timers/listeners require `onCleanup`, long work must observe `ctx.signal`. Never use module-global mutable state. Async setup is invalid. Keep heavy work out of startup and streaming renders. Read reactive `props.session` / `props.tab` inside reactive calculations, rather than destructuring once.
|
|
34
|
+
|
|
35
|
+
`main` is optional, app-scoped, and only available on trusted local Electron with an active native lease. It may import Electron and Node built-ins. Window evaluation sees inert placeholders for those imports, not native access. IPC uses official `Ipc.define` schemas; remote/Relay/Web/VS Code/mobile remain window-only. Native storage, serverEndpoints, cli, embeds and menus are unsupported in Yuri's main host.
|
|
36
|
+
|
|
37
|
+
Consume `ctx.use(token)` as a live accessor: `pending`, `inactive`, or `active`. Check status before using its value. A disabled provider must not break the consumer. Prefer declarative contributions over DOM replacement, private React stores, or direct native APIs.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Preview actions and device exports
|
|
2
|
+
|
|
3
|
+
These are **Yuri** host contracts declared through official `Contract.define`. They do not require a plugin `main`, do not grant filesystem access, and remain separate from OpenCode's experimental IPC.
|
|
4
|
+
|
|
5
|
+
## Exact structural contracts
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { Contract } from '@opencode/plugin/gui'
|
|
9
|
+
|
|
10
|
+
export type Snapshot = { html: string; width: number; height: number }
|
|
11
|
+
export type Progress = { stage: 'preparing' | 'capturing' | 'rendering' | 'encoding' | 'saving'; completed?: number; total?: number }
|
|
12
|
+
type Options = { signal?: AbortSignal; onProgress?: (value: Progress) => void }
|
|
13
|
+
type Limits = { maxHTMLBytes: number; maxWidth: number; maxHeight: number; maxPixels: number }
|
|
14
|
+
type Result = { status: 'saved' | 'cancelled' }
|
|
15
|
+
export type Surface = {
|
|
16
|
+
readonly element: HTMLElement
|
|
17
|
+
readonly signal: AbortSignal
|
|
18
|
+
snapshot(options?: Options): Promise<Snapshot>
|
|
19
|
+
}
|
|
20
|
+
export interface PreviewActionsAPI {
|
|
21
|
+
readonly version: 1
|
|
22
|
+
register(input: {
|
|
23
|
+
element: HTMLElement
|
|
24
|
+
capture(options: Options): Promise<Snapshot>
|
|
25
|
+
render(surface: Surface): HTMLElement
|
|
26
|
+
}): () => void
|
|
27
|
+
}
|
|
28
|
+
export interface PDFAPI {
|
|
29
|
+
version: 1; limits: Limits
|
|
30
|
+
exportPDF(input: { snapshot: Snapshot; filename: string; pageSize?: 'a4' | 'letter' }, options?: Options): Promise<Result>
|
|
31
|
+
}
|
|
32
|
+
export interface LongImageAPI {
|
|
33
|
+
version: 1; limits: Limits
|
|
34
|
+
exportLongImage(input: { snapshot: Snapshot; filename: string }, options?: Options): Promise<Result>
|
|
35
|
+
}
|
|
36
|
+
export const PreviewActions = Contract.define<PreviewActionsAPI, 'yuri.previewActions'>('yuri.previewActions')
|
|
37
|
+
export const ExportPDF = Contract.define<PDFAPI, 'yuri.exportPDF'>('yuri.exportPDF')
|
|
38
|
+
export const ExportLongImage = Contract.define<LongImageAPI, 'yuri.exportLongImage'>('yuri.exportLongImage')
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The `capturing` stage belongs to preview capture; device export reports preparing/rendering/encoding/saving. Keep the two export capabilities separate: a device may expose one without the other.
|
|
42
|
+
|
|
43
|
+
## Registration and action flow
|
|
44
|
+
|
|
45
|
+
Inside the owning Panel's Solid render/component, follow `ctx.use(PreviewActions)` with `createKeyed`. While active and `version === 1`, call `register({ element, capture, render })` and register its returned disposer with `onCleanup`. Registering in `setup`, from an async callback without the owning context, or against another panel's element is invalid.
|
|
46
|
+
|
|
47
|
+
`render(surface)` creates the plugin-owned toolbar DOM; Yuri places it beside source controls on desktop and in the mobile preview title row. At click time:
|
|
48
|
+
|
|
49
|
+
1. Read the corresponding export live accessor; hide PDF/PNG actions unless its status is active and version is 1. Keep HTML save independent.
|
|
50
|
+
2. Combine `surface.signal` and the action's cancellation signal. Call `surface.snapshot({ signal, onProgress })`; it invokes this instance's latest `capture` and excludes the toolbar.
|
|
51
|
+
3. Build static, self-contained HTML with inline styles and data images. Serialize current input values, filters and expanded state; remove executable scripts/external dependencies. Use actual nonzero width/height, not stale initial dimensions. For iframe content, implement a source/frame/revision-checked snapshot message protocol; the host cannot read arbitrary cross-origin DOM for you.
|
|
52
|
+
4. Check the returned HTML UTF-8 bytes, width, height and width×height against the export capability's `limits`. Re-read the live accessor after capture and require the same provider generation before calling it.
|
|
53
|
+
5. Call `exportPDF({ snapshot, filename, pageSize: 'a4' }, options)` or `exportLongImage({ snapshot, filename }, options)`. Treat saved/cancelled distinctly; surface failure to the user without retrying an already completed save. `EXPORT_UNSUPPORTED` withdraws that action; other failures remain retryable.
|
|
54
|
+
|
|
55
|
+
Unmount, source-mode switch, retry, disable, replacement and runtime switch dispose the toolbar and abort capture/export. Do not cache the document HTML during toolbar registration. A page/file snapshot belongs to the mounted instance, not to the global active tab.
|
|
56
|
+
|
|
57
|
+
## Runtime matrix
|
|
58
|
+
|
|
59
|
+
| Capability | Electron | iOS / Android Capacitor | Web / hosted mobile / VS Code |
|
|
60
|
+
| --- | --- | --- | --- |
|
|
61
|
+
| Preview action placement | Yes | Yes | Yes |
|
|
62
|
+
| PDF / long image | Probe each capability | Probe each capability | Inactive unless the runtime explicitly provides it |
|
|
63
|
+
| Connection to local, remote or Relay Host | Current device capabilities, independent of Host location | Same | Same |
|
|
64
|
+
| `ctx.system.save({ name, content })` | Browser download path | Native file picker for UTF-8 content | Browser download |
|
|
65
|
+
|
|
66
|
+
Unlike native plugin `main`, current-device exports can be available in remote/Relay sessions. Never use the Host's filesystem or shell to imitate saving on the user's device. HTML export preserves rerunnable source only when deliberately implemented by the plugin; it is a different artifact from the static native-export snapshot.
|
|
67
|
+
|
|
68
|
+
## Case study: Eficy
|
|
69
|
+
|
|
70
|
+
See `src/gui.tsx`, `src/preview-actions.ts`, `src/export-contract.ts`, `src/export-types.ts` and `src/export-toolbar.ts` of https://github.com/yee94/opencode-eficy. Eficy implements iframe capture and an inline toolbar fallback for older hosts without `yuri.previewActions`. That fallback is an integration choice: add compatibility behavior only for hosts the plugin intends to support.
|
|
71
|
+
|
|
72
|
+
## Verification
|
|
73
|
+
|
|
74
|
+
For each requested export format, verify current-state capture, saved/cancelled/failed outcomes, limits, capability withdrawal, and cancellation when its view closes. Test multiple mounted previews to confirm each action captures its own content. Native save verification requires the target device; a browser-only test proves only the capture/toolbar contract.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Package, build, install, verify
|
|
2
|
+
|
|
3
|
+
## Complete minimal appearance plugin
|
|
4
|
+
|
|
5
|
+
Use a separate plugin directory, not Yuri's source tree. These three files illustrate a complete theme + logo + CSS package. For pages, file viewers or other capabilities, keep the package/build structure and use the matching reference's GUI entry. A Dock contribution is needed only when requested.
|
|
6
|
+
|
|
7
|
+
`package.json`:
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"name": "yuri-studio-skin",
|
|
12
|
+
"version": "0.1.0",
|
|
13
|
+
"private": true,
|
|
14
|
+
"type": "module",
|
|
15
|
+
"exports": { "./gui-experimental": "./dist/gui-experimental.cjs" },
|
|
16
|
+
"files": ["dist"],
|
|
17
|
+
"scripts": { "build": "vite build", "dev": "vite build --watch" },
|
|
18
|
+
"dependencies": { "@opencode/plugin": "2.2.0" },
|
|
19
|
+
"devDependencies": { "vite": "^7.0.0", "vite-plugin-solid": "^2.11.0", "solid-js": "^1.9.0" }
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`vite.config.ts`:
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { defineConfig } from 'vite'
|
|
27
|
+
import { gui } from '@opencode/plugin/gui/vite'
|
|
28
|
+
export default defineConfig({ plugins: [gui()] })
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
`src/gui.tsx`:
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import { Plugin, Registry, Style } from '@opencode/plugin/gui'
|
|
35
|
+
|
|
36
|
+
const Theme = Registry.define<{
|
|
37
|
+
id: string; title: string; variant: 'dark' | 'light';
|
|
38
|
+
colors?: { primary?: { base?: string }; surface?: { background?: string } }
|
|
39
|
+
}>('yuri.theme')
|
|
40
|
+
const Branding = Registry.define<{
|
|
41
|
+
id: string; title: string; logo?: { svg: string; lightSvg?: string }
|
|
42
|
+
}>('yuri.branding')
|
|
43
|
+
|
|
44
|
+
export default Plugin.define({
|
|
45
|
+
setup(ctx) {
|
|
46
|
+
ctx.add(Theme, {
|
|
47
|
+
id: 'studio-dark', title: 'Studio Dark', variant: 'dark',
|
|
48
|
+
colors: { primary: { base: '#8dafff' }, surface: { background: '#151820' } },
|
|
49
|
+
})
|
|
50
|
+
ctx.add(Branding, {
|
|
51
|
+
id: 'studio', title: 'Studio',
|
|
52
|
+
logo: {
|
|
53
|
+
svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9" fill="#8dafff"/></svg>',
|
|
54
|
+
lightSvg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9" fill="#3155a0"/></svg>',
|
|
55
|
+
},
|
|
56
|
+
})
|
|
57
|
+
ctx.add(Style, '[data-yuri-logo] { border-radius: 12%; }')
|
|
58
|
+
},
|
|
59
|
+
})
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
This package has no server entry and no `main`; its package name becomes its plugin ID. For a mixed server/GUI plugin, use the server part's `Plugin.define` ID consistently. No separate Yuri entrypoint is needed. The official Vite preset compiles Solid, inlines dynamic imports/dependencies, and emits one CJS file. Shared SDK/Solid/Effect modules must remain host-provided, not bundled duplicates.
|
|
63
|
+
|
|
64
|
+
## Installation and updates
|
|
65
|
+
|
|
66
|
+
1. Ask permission before installing dependencies or changing config. Use the user's selected package manager to install this standalone package's declared dependencies and run `build`. Verify `dist/gui-experimental.cjs` exists and exports a definition; do not point the host at TSX or an ES module.
|
|
67
|
+
2. Inspect the user's **global** `opencode.json(c)` and preserve unrelated configuration/comments. Add the absolute plugin directory to `plugins`, or use the documented OpenCode plugin installation command after checking that CLI's current help/docs. Do not invent CLI flags. For example:
|
|
68
|
+
|
|
69
|
+
```jsonc
|
|
70
|
+
{ "plugins": ["/absolute/path/to/yuri-studio-skin"] }
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
3. Yuri loads GUI entries from the connected service's global inventory. A project-only plugin entry will not supply a window GUI. Local path changes rebuilt by Vite are revision updates, not new npm versions. Confirm the plugin appears active in plugin settings; explicit refresh can retry a failed instance. The GUI enable switch is separate from server plugin loading.
|
|
74
|
+
4. Verify appearance contributions apply when the GUI is enabled, using [appearance](appearance.md) for priority and fallback. For other capabilities, verify their registered entry points.
|
|
75
|
+
5. For publication, remove `private` only when requested, build first, and publish the package with its CJS artifact. Use a new npm version for updates. No publishing is implied by a local customization request.
|
|
76
|
+
|
|
77
|
+
## Verification and rollback
|
|
78
|
+
|
|
79
|
+
Verify each implemented capability in the target client, not only the bundler. Check its normal, failed and unavailable states, cleanup on disable/rebuild, and isolation from unrelated plugins. Capability-specific checks belong to the matching reference. Report checks not performed rather than inferring cross-platform success.
|
|
80
|
+
|
|
81
|
+
Rollback: disable this GUI plugin or remove only its config entry. Disabling cleans contributions and native leases; appearance falls back according to its resource priority. Preserve unrelated plugins, user data and Yuri app resources.
|
|
@@ -124,6 +124,71 @@ unrelated new SDK resources must not invalidate these host integration seams.
|
|
|
124
124
|
- `listSkillSupportingFiles(skillDir)`, `readSkillSupportingFile(skillDir, relativePath)`, `writeSkillSupportingFile(skillDir, relativePath, content)`, `deleteSkillSupportingFile(skillDir, relativePath)`: Skill supporting file management.
|
|
125
125
|
|
|
126
126
|
## Public exports (routes.js)
|
|
127
|
+
`GET /api/config/providers/sources` batches the running service's provider,
|
|
128
|
+
configuration-document and integration-connection metadata through
|
|
129
|
+
`provider-sources.js`. It returns only source paths/scopes, origin and credential
|
|
130
|
+
existence/method (`api`, `oauth`, `external`). It never reads or serializes raw
|
|
131
|
+
credentials, provider settings or headers. Missing/malformed authoritative reads
|
|
132
|
+
fail with 502. File-backed, pathless-document and runtime-injected origins remain
|
|
133
|
+
distinct; there is no authoritative provider-to-plugin mapping in the current API.
|
|
134
|
+
|
|
135
|
+
`DELETE /api/provider/:id/auth?scope=config` removes both `provider[id]` and
|
|
136
|
+
`providers[id]` from every physical document visible to the selected location,
|
|
137
|
+
deduplicating paths. It uses the shared atomic JSONC writer, preserves unrelated
|
|
138
|
+
configuration/comments, and requests no reload. These file mutations share the
|
|
139
|
+
existing co-located config-file boundary. Across files the operation is not a
|
|
140
|
+
transaction: failures may leave some files already updated; retry finishes the
|
|
141
|
+
remaining occurrences. Credential deletion is a separate official API step owned
|
|
142
|
+
by the UI mutation. Runtime/plugin registrations without independent configuration
|
|
143
|
+
cannot be removed by this file operation (`removed: false`).
|
|
144
|
+
|
|
145
|
+
Model capabilities project native image input modalities. Reasoning uses explicit
|
|
146
|
+
boolean/`reasoning.supported` first, otherwise actual reasoning-enabled variant
|
|
147
|
+
settings; variant payloads remain stripped from the response. Attachment support
|
|
148
|
+
alone does not imply image input.
|
|
149
|
+
|
|
150
|
+
Custom-provider endpoints are registered before the generic proxy:
|
|
151
|
+
|
|
152
|
+
- `PUT /api/config/providers/model`: `provider-model-config.js` updates a saved
|
|
153
|
+
model's name, context/output limits, tools and image input. It writes the highest
|
|
154
|
+
physical provider source, or the normal custom/global target for runtime models.
|
|
155
|
+
The provider/model IDs stay fixed; credentials, routing, variants, other limits,
|
|
156
|
+
non-image modalities and unrelated config/comments are preserved. Cleared limits
|
|
157
|
+
remove only that document's overrides, allowing inherited defaults. Payloads are
|
|
158
|
+
validated before the atomic write; failed writes retain the original file. Only
|
|
159
|
+
IDs are returned. Web/Electron/mobile and the VS Code bridge use the same owner.
|
|
160
|
+
|
|
161
|
+
- `POST /api/config/providers/custom`: `custom-provider.js` validates native V2
|
|
162
|
+
schema/package/URL/model fields and targets the explicit
|
|
163
|
+
`OPENCODE_CONFIG` file or highest-precedence global JSONC/JSON document. It never
|
|
164
|
+
copies a merged project snapshot. The existing atomic writer preserves unrelated
|
|
165
|
+
fields, JSONC comments and backups. Parse failures do not replace the original.
|
|
166
|
+
Keys are created through the trusted official OpenCode credential client; a failed
|
|
167
|
+
file write removes only the new credential. Failed cleanup is explicitly reported
|
|
168
|
+
as `PROVIDER_CLEANUP_FAILED`. Secret-bearing upstream errors are sanitized, and the
|
|
169
|
+
response contains only `{ providerId }`. OpenCode watches the file; no lifecycle
|
|
170
|
+
restart is needed. New clients omit `providerId`: the host derives it from the
|
|
171
|
+
normalized lowercase Provider Name, joins separators with hyphens, preserves
|
|
172
|
+
Unicode letters/numbers, and uses `custom-provider` for punctuation-only names.
|
|
173
|
+
Numeric suffixes avoid physical-config, runtime-provider, integration and in-flight
|
|
174
|
+
collisions. Reservation occurs before credential writes, including concurrent
|
|
175
|
+
same-name creates. Older clients' explicit `custom-*` IDs remain supported and
|
|
176
|
+
reject duplicates. Existing saved IDs are never renamed.
|
|
177
|
+
- `POST /api/config/providers/custom/models`: `custom-provider-models.js` discovers
|
|
178
|
+
a draft inventory without persistence. OpenAI Chat/Responses use Bearer auth;
|
|
179
|
+
Anthropic uses `x-api-key`/`anthropic-version`; Gemini uses `x-goog-api-key`, never
|
|
180
|
+
a query-string key. Anthropic/Gemini pagination must complete, under a 15s total
|
|
181
|
+
deadline, 20-page/5,000-model bounds and 2 MiB per-page bound. Failed later pages
|
|
182
|
+
remain failures, not partial or empty success. Redirects are refused; explicit
|
|
183
|
+
HTTP(S) local endpoints are supported. Requests abort on client response closure.
|
|
184
|
+
Only IDs, names and supported supplied token limits leave the host.
|
|
185
|
+
|
|
186
|
+
`packages/web/shared/custom-provider-protocol.js` holds browser-safe package metadata
|
|
187
|
+
and Cherry-compatible address completion shared with the UI; `shared/` is included in
|
|
188
|
+
the published Web package. It has no Node imports. VS Code invokes these same helpers;
|
|
189
|
+
its already-dispatched discovery may finish within the deadline after a webview wait
|
|
190
|
+
is cancelled, but obsolete results do not update the draft.
|
|
191
|
+
|
|
127
192
|
- `registerOpenCodeRoutes(app, dependencies)`: Registers OpenCode-owned HTTP routes and internal module runtime:
|
|
128
193
|
- `GET /api/config/settings`: returns the full formatted settings response. `?bootstrap=true` remains a safe bootstrap alias that returns schema version `1` and a bounded allowlist for bootstrap clients: default model/variant/agent, worktree/git/file-preview preferences, Zen model, message transport, STT settings, and response-style settings. The bootstrap projection omits credentials and accepts HTTP(S) STT URLs without URL credentials.
|
|
129
194
|
- `GET /api/config/settings/bootstrap`: returns the schema version `1` bootstrap allowlist. UI clients use this dedicated endpoint so older hosts return HTTP 404; this prevents an older server that ignores the `bootstrap` query parameter from returning the full settings response.
|
|
@@ -273,6 +338,14 @@ auth for other routes. See `scheduled-tasks/DOCUMENTATION.md` for ownership,
|
|
|
273
338
|
preflight, rollback and runtime coverage. The old managed-child bridge remains
|
|
274
339
|
separate.
|
|
275
340
|
|
|
341
|
+
The same shared-service admission also installs the short `yuri.customization`
|
|
342
|
+
instruction. Managed local session creation installs it through the following
|
|
343
|
+
customization admission route. It points at a shipped, content-fingerprinted skill
|
|
344
|
+
with GUI API, theme/branding, global tab (Runmark), file parser/preview (Eficy),
|
|
345
|
+
export and package workflow references. No global config or existing session is
|
|
346
|
+
changed; external servers receive no unverified local-file pointer. See
|
|
347
|
+
`../gui-customization/DOCUMENTATION.md` for runtime and rollback boundaries.
|
|
348
|
+
|
|
276
349
|
## Public exports (env-config.js)
|
|
277
350
|
- `resolveOpenCodeEnvConfig(options?)`: resolves and validates OpenCode host/port/hostname environment configuration.
|
|
278
351
|
- `OPENCODE_HOST` still requires an explicit port; HTTP `:80` and HTTPS `:443` retain their effective port even when URL normalization removes it. Host precedence, IPv6 and path/query/hash validation are unchanged.
|
|
@@ -402,7 +475,7 @@ Unrelated upstream failures are not retried.
|
|
|
402
475
|
- Provider catalog responses include only provider `id`, `name`, and safe models. Safe models include `id`, `name`, fixed text/audio/image/video/pdf capability modalities, bounded cost/limit fields, `release_date`, and variant names with `{}` values. v2 `ModelInfo.variants` is an array of `{ id, settings?, headers?, body? }`; projection keeps ids in array order as empty-object keys and drops request payloads. v2 `capabilities.tools` maps to `toolcall`, and `input`/`output` modality name arrays map to boolean maps. v2 `cost` tier arrays keep the untiered base price. Identifiers are bounded to 512 characters, display names to 1024, release dates to 64, numeric values to absolute 1e9, and catalog collections to 200 providers, 500 models per provider, and 100 defaults or variants. Provider credentials/configuration and unallowlisted model fields stay server-side. Malformed catalog roots and SDK error envelopes return HTTP 502. `partial: true` is structural only: provider/model/default truncation, dropped providers/models/defaults, or truncated variant dictionaries. Soft allowlist stripping of optional metadata (unknown modalities, non-boolean capability flags, out-of-range cost/limit numbers, empty/null/invalid `release_date`, invalid variant ids) keeps valid models and must not set `partial: true`, or UI refresh retains a stale complete snapshot after OpenCode provider updates. The same input shapes are accepted by the VS Code projector and `packages/ui/src/lib/configCatalogParser.ts`.
|
|
403
476
|
- Agents: `/api/config/agents/:name` and `/api/config/agents/:name/config`. A `native` create or update writes only the fields in that object into the selected user or project markdown file. `scope` chooses the file. `confirmDrop` removes fields the current format cannot represent; every other field already in the file stays unchanged.
|
|
404
477
|
- Commands: batched metadata via `POST /api/config/commands/metadata`; `{ catalog: true }` returns the compact autocomplete catalog without templates, plus CRUD at `/api/config/commands/:name`
|
|
405
|
-
- Global raw
|
|
478
|
+
- Global raw config: `GET /api/config/global` only offers OpenCode; `GET/PUT /api/config/global/opencode` reads and writes its JSON or JSONC file. Plugin-specific targets are not supported, even if their files exist. Missing OpenCode configuration returns an editable schema template without writing to disk; the first save creates `opencode.jsonc` (or the explicit `OPENCODE_CONFIG` path). Existing JSON/JSONC precedence and comments are preserved. The shared editor has no target tab bar; saves rely on OpenCode's config watcher rather than a manual restart dialog.
|
|
406
479
|
- MCP servers: `/api/config/mcp` and `/api/config/mcp/:name`
|
|
407
480
|
|
|
408
481
|
### Catalog / Yuri-owned API change checklist
|
|
@@ -112,8 +112,6 @@ const loadProviderCatalogUpstream = async (client, location, wait) => {
|
|
|
112
112
|
const MAX_GLOBAL_CONFIG_SIZE = 2 * 1024 * 1024;
|
|
113
113
|
const GLOBAL_CONFIG_FILES = {
|
|
114
114
|
opencode: ['opencode.jsonc', 'opencode.json'],
|
|
115
|
-
'oh-my-opencode-slim': ['oh-my-opencode-slim.json', 'oh-my-opencode-slim.jsonc'],
|
|
116
|
-
'oh-my-openagent': ['oh-my-openagent.json', 'oh-my-openagent.jsonc'],
|
|
117
115
|
};
|
|
118
116
|
|
|
119
117
|
const truncateDescription = (value, maximum = 160) => {
|
|
@@ -313,8 +311,8 @@ export const registerConfigEntityRoutes = (app, dependencies) => {
|
|
|
313
311
|
target: req.params.target,
|
|
314
312
|
fileName: target.fileName,
|
|
315
313
|
content,
|
|
316
|
-
requiresManualRestart:
|
|
317
|
-
application:
|
|
314
|
+
requiresManualRestart: false,
|
|
315
|
+
application: 'watch',
|
|
318
316
|
});
|
|
319
317
|
} catch (error) {
|
|
320
318
|
console.error('Failed to write global configuration:', error);
|
|
@@ -312,6 +312,7 @@ describe('provider catalog route', () => {
|
|
|
312
312
|
const response = await request(app).get('/api/config/catalog/providers').expect(200);
|
|
313
313
|
expect(response.body.providers[0].models['gpt-5.4'].variants).toEqual({ low: {}, high: {} });
|
|
314
314
|
expect(response.body.providers[0].models['gpt-5.4'].capabilities).toEqual({
|
|
315
|
+
reasoning: true,
|
|
315
316
|
toolcall: true,
|
|
316
317
|
input: { text: true, image: true },
|
|
317
318
|
output: { text: true },
|
|
@@ -518,21 +519,16 @@ describe('global raw configuration routes', () => {
|
|
|
518
519
|
}
|
|
519
520
|
});
|
|
520
521
|
|
|
521
|
-
it('reads and validates the configured OpenCode
|
|
522
|
+
it('reads and validates the configured OpenCode file', async () => {
|
|
522
523
|
const app = express();
|
|
523
524
|
app.use(express.json());
|
|
524
525
|
const configDirectory = await fs.mkdtemp(path.join(os.tmpdir(), 'yuri-global-config-'));
|
|
525
526
|
await fs.writeFile(path.join(configDirectory, 'opencode.jsonc'), `{
|
|
526
527
|
"$schema": "https://opencode.ai/config.json",
|
|
527
528
|
"model": "imate/deepseek-v4-pro",
|
|
528
|
-
"
|
|
529
|
+
"plugins": ["example-plugin"],
|
|
529
530
|
// Existing comments must round-trip unchanged.
|
|
530
531
|
}`, 'utf8');
|
|
531
|
-
await fs.writeFile(path.join(configDirectory, 'oh-my-opencode-slim.json'), JSON.stringify({
|
|
532
|
-
scoringEngineVersion: 'v2',
|
|
533
|
-
disabled_agents: ['observer'],
|
|
534
|
-
agents: { fixer: { model: ['openai/gpt-5.6-terra'] } },
|
|
535
|
-
}, null, 2), 'utf8');
|
|
536
532
|
|
|
537
533
|
registerConfigEntityRoutes(app, createDependencies(vi.fn(), configDirectory));
|
|
538
534
|
|
|
@@ -543,9 +539,6 @@ describe('global raw configuration routes', () => {
|
|
|
543
539
|
content: expect.stringContaining('// Existing comments must round-trip unchanged.'),
|
|
544
540
|
});
|
|
545
541
|
|
|
546
|
-
const slim = await request(app).get('/api/config/global/oh-my-opencode-slim').expect(200);
|
|
547
|
-
expect(slim.body.content).toContain('"disabled_agents"');
|
|
548
|
-
|
|
549
542
|
const invalid = await request(app)
|
|
550
543
|
.put('/api/config/global/opencode')
|
|
551
544
|
.send({ content: '{ "model": }' })
|
|
@@ -557,18 +550,23 @@ describe('global raw configuration routes', () => {
|
|
|
557
550
|
.send({ content: '{\n "model": "imate/deepseek-v4-pro",\n // preserved JSONC syntax\n}' })
|
|
558
551
|
.expect(200);
|
|
559
552
|
expect(saved.body.content).toContain('// preserved JSONC syntax');
|
|
553
|
+
expect(saved.body).toMatchObject({ requiresManualRestart: false, application: 'watch' });
|
|
560
554
|
expect(await fs.readFile(path.join(configDirectory, 'opencode.jsonc'), 'utf8')).toBe(saved.body.content);
|
|
561
555
|
|
|
562
556
|
await fs.rm(configDirectory, { recursive: true, force: true });
|
|
563
557
|
});
|
|
564
558
|
|
|
565
|
-
it('
|
|
559
|
+
it('ignores plugin-specific targets and edits the winning global JSONC document', async () => {
|
|
566
560
|
const app = express();
|
|
567
561
|
app.use(express.json());
|
|
568
562
|
const configDirectory = await fs.mkdtemp(path.join(os.tmpdir(), 'yuri-global-config-'));
|
|
569
563
|
await fs.writeFile(path.join(configDirectory, 'opencode.json'), '{ "model": "json-model" }', 'utf8');
|
|
570
564
|
await fs.writeFile(path.join(configDirectory, 'opencode.jsonc'), '{ "model": "jsonc-model" }', 'utf8');
|
|
571
|
-
|
|
565
|
+
const pluginTargets = ['oh-my-opencode', 'oh-my-opencode-slim', 'oh-my-openagent'];
|
|
566
|
+
const pluginContent = '{\n // JSONC configuration\n}';
|
|
567
|
+
for (const target of pluginTargets) {
|
|
568
|
+
await fs.writeFile(path.join(configDirectory, `${target}.jsonc`), pluginContent, 'utf8');
|
|
569
|
+
}
|
|
572
570
|
|
|
573
571
|
registerConfigEntityRoutes(app, createDependencies(vi.fn(), configDirectory));
|
|
574
572
|
|
|
@@ -576,10 +574,15 @@ describe('global raw configuration routes', () => {
|
|
|
576
574
|
expect(available.body).toEqual({
|
|
577
575
|
targets: [
|
|
578
576
|
{ target: 'opencode', fileName: 'opencode.jsonc' },
|
|
579
|
-
{ target: 'oh-my-openagent', fileName: 'oh-my-openagent.jsonc' },
|
|
580
577
|
],
|
|
581
578
|
});
|
|
582
579
|
|
|
580
|
+
for (const target of pluginTargets) {
|
|
581
|
+
await request(app).get(`/api/config/global/${target}`).expect(404);
|
|
582
|
+
await request(app).put(`/api/config/global/${target}`).send({ content: '{}' }).expect(404);
|
|
583
|
+
expect(await fs.readFile(path.join(configDirectory, `${target}.jsonc`), 'utf8')).toBe(pluginContent);
|
|
584
|
+
}
|
|
585
|
+
|
|
583
586
|
const openCode = await request(app).get('/api/config/global/opencode').expect(200);
|
|
584
587
|
expect(openCode.body).toMatchObject({ fileName: 'opencode.jsonc', content: '{ "model": "jsonc-model" }' });
|
|
585
588
|
|
|
@@ -1195,6 +1195,8 @@ export const registerCommonRequestMiddleware = (app, dependencies) => {
|
|
|
1195
1195
|
// Binary attachment uploads stream as the request body. Parsing JSON here
|
|
1196
1196
|
// would buffer the entire payload and block the relay tunnel / corrupt bytes.
|
|
1197
1197
|
next();
|
|
1198
|
+
} else if (req.path.startsWith('/api/config/providers/')) {
|
|
1199
|
+
express.json({ limit: '1mb' })(req, res, next);
|
|
1198
1200
|
} else if (req.path.startsWith('/api/yuri/message-queue')) {
|
|
1199
1201
|
express.json({ limit: req.method === 'POST' && req.path === '/api/yuri/message-queue/items' ? MESSAGE_QUEUE_ADMISSION_HTTP_MAX_BYTES : '1mb' })(req, res, next);
|
|
1200
1202
|
} else if (
|
|
@@ -334,12 +334,12 @@ describe('core-routes', () => {
|
|
|
334
334
|
it('should parse JSON bodies for global config routes', async () => {
|
|
335
335
|
const app = express();
|
|
336
336
|
registerCommonRequestMiddleware(app, { express });
|
|
337
|
-
app.put('/api/config/global/
|
|
337
|
+
app.put('/api/config/global/opencode', (req, res) => {
|
|
338
338
|
res.json({ body: req.body });
|
|
339
339
|
});
|
|
340
340
|
|
|
341
341
|
const response = await request(app)
|
|
342
|
-
.put('/api/config/global/
|
|
342
|
+
.put('/api/config/global/opencode')
|
|
343
343
|
.send({ content: '{\n "preset": "openai"\n}' })
|
|
344
344
|
.expect(200);
|
|
345
345
|
|