@yuriai/web 0.2.27 → 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-BssH-RvV.js → AssistantUnreadBadge-BMCaH0Cc.js} +1 -1
- package/dist/assets/{AssistantView-CxQv-9Ms.js → AssistantView-C5ACV-pb.js} +1 -1
- package/dist/assets/{DiagramView-DPpG0fwx.js → DiagramView-DJDzscnd.js} +1 -1
- package/dist/assets/{FadeInOnReveal-S6UbimjB.js → FadeInOnReveal-8NiBU75a.js} +1 -1
- package/dist/assets/{GuiPluginSurface-BOf0JA1T.js → GuiPluginSurface-DfLl4Gd9.js} +1 -1
- package/dist/assets/{GuiPluginWindow-OrYkfQ4m.js → GuiPluginWindow-CW0-Tapi.js} +1 -1
- package/dist/assets/{Icon-BE4mEwzV.js → Icon-CLLDJn-P.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-CBFJC_KD.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-Cv6UnGG7.js → MarkdownRendererImpl-BjjAFHTQ.js} +3 -3
- package/dist/assets/MarkstreamRendererImpl-D8tam--u.js +3 -0
- package/dist/assets/{MobileDetailNavigation-CK4KbkeS.js → MobileDetailNavigation-B-AuJG6R.js} +1 -1
- package/dist/assets/{MobileResizableSheet-Deidw1br.js → MobileResizableSheet-CAj4YGtu.js} +1 -1
- package/dist/assets/{MobileShareBridge-CO_OWEfq.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-C8ld4wO7.js → OnboardingScreen-BdU6Tyax.js} +1 -1
- package/dist/assets/{OverlayScrollbar-B3auC2WH.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-CwRB6Yyr.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-B6woJIX5.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-BXxwtxsG.js → button-BF2cNEuq.js} +1 -1
- package/dist/assets/{capgoAdapter-C5HFS-rx.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-DyY8dxjZ.js → diagram-D9-jif9d.js} +1 -1
- package/dist/assets/dialog-r7RRePv5.js +1 -0
- package/dist/assets/{dropdown-menu.styles-DGaALKP0.js → dropdown-menu.styles-CX8oXdks.js} +1 -1
- package/dist/assets/es-C8kGYKZo.js +15 -0
- package/dist/assets/{fileMentionTouchSelection-C4dvP8GY.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-CEgiRlfa.js → fr-BV_9HcN9.js} +3 -3
- package/dist/assets/{gitApi-D2G9ny2O.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-CX-_p9jZ.js → ja-CIMpz4Z2.js} +3 -3
- package/dist/assets/{ko-D5xlLYJM.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-D2VWb_4E.js → markdownHeightCache-D02GlOiy.js} +1 -1
- package/dist/assets/{markdownTheme-hpURsgju.js → markdownTheme-CHNl6tUv.js} +1 -1
- package/dist/assets/{mcpQueries-DQ3KthDF.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-BJqt3oHk.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-BIY0Cr-l.js → native-config-5BNfonUF.js} +1 -1
- package/dist/assets/persistence-Dta0OwIa.js +3 -0
- package/dist/assets/{pl-BjH81A_q.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-CS5jTJq-.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-BX8JirIc.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-CC0fusUo.js → speechSettingsQueries-DEGyglgn.js} +2 -2
- package/dist/assets/src-DME3XM8W.css +2 -0
- package/dist/assets/{store-CkIHVrmT.js → store-BPYoxYhv.js} +4 -4
- package/dist/assets/{terminalApi-rl9mZAlB.js → terminalApi-CPVNQ5DH.js} +1 -1
- package/dist/assets/{textarea-7eTptEtD.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-Ck2PdQRx.js → useAppFontEffects-C__cAJlw.js} +54 -54
- package/dist/assets/{useAssistantUIStore-CfaQV3ID.js → useAssistantUIStore-CYyXdd5c.js} +1 -1
- package/dist/assets/useDesktopWindowControlsLayout-BYt7I5so.js +1 -0
- package/dist/assets/{useEffectiveDirectory-CNCQfN_x.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-CN_RGaSw.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/assistants/DOCUMENTATION.md +7 -0
- package/server/lib/assistants/channel-output.integration.test.js +15 -1
- package/server/lib/assistants/harness.js +1 -0
- package/server/lib/assistants/harness.test.js +16 -0
- 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-DNm_jMna.js +0 -1
- package/dist/assets/AssistantContactStatus-BPRpgMFh.js +0 -3
- package/dist/assets/LoadingImage-NLq7_P-i.js +0 -1
- package/dist/assets/MarkdownRenderer-BaMotAOQ.js +0 -2
- package/dist/assets/MarkstreamRendererImpl-Rb9O6wkW.js +0 -3
- package/dist/assets/MobileTabPageHeader-DbC8L6A4.js +0 -2
- package/dist/assets/MultiRunWindow-DtVW9NTV.js +0 -1
- package/dist/assets/SettingsView-BRIvklfP.css +0 -1
- package/dist/assets/SettingsView-Cm7woZWl.js +0 -29
- package/dist/assets/SettingsWindow-CdL4PFxW.js +0 -1
- package/dist/assets/ToolOutputDialog-B4BfmoVH.js +0 -10
- package/dist/assets/YuriLogo-BOx0s0Ue.js +0 -1
- package/dist/assets/collapsible-BEm0787p.js +0 -1
- package/dist/assets/context-menu-DUwvVUDY.js +0 -1
- package/dist/assets/desktopRelayRestore-D1UX7HW2.js +0 -1
- package/dist/assets/dialog-CLca6ojn.js +0 -1
- package/dist/assets/es-CrsHvgue.js +0 -15
- package/dist/assets/host-CnVx34Dh.js +0 -1
- package/dist/assets/image-loading-D5UhMj7Z.js +0 -1
- package/dist/assets/input-D59Q2pm8.js +0 -1
- package/dist/assets/insertionBoundaries-CedfTSM5.js +0 -1
- package/dist/assets/main-CxpUooVS.js +0 -2
- package/dist/assets/main-Dpm4KxWX.js +0 -169
- package/dist/assets/miniChat-CTdj8Ug9.js +0 -2
- package/dist/assets/mobile-ChbA3Q8j.js +0 -2
- package/dist/assets/multirun-BILeETbd.js +0 -3
- package/dist/assets/native-BYMhr-xH.js +0 -1
- package/dist/assets/persistence-CWuLIq1J.js +0 -3
- package/dist/assets/projectMeta-B9_Uh8YH.js +0 -1
- package/dist/assets/pt-BR-Dp5oK2x3.js +0 -15
- package/dist/assets/readiness-BNIgH81X.js +0 -1
- package/dist/assets/renderElectronMiniChatApp-asOqV7FB.js +0 -2
- package/dist/assets/renderMobileApp-DAfque7-.js +0 -28
- package/dist/assets/runtimeEndpointReset-CFQgUiUr.js +0 -149
- package/dist/assets/scheduledTaskNavigation-EomDNVu2.js +0 -1
- package/dist/assets/sessionLookup-BxAaxPOw.js +0 -1
- package/dist/assets/sortable-tabs-strip-DpbW5MqX.js +0 -1
- package/dist/assets/src-BMKjN2ip.css +0 -2
- package/dist/assets/tooltip-BPwoSTzO.js +0 -1
- package/dist/assets/types-CUtSV1V8.js +0 -2
- package/dist/assets/uk-BEfkaLtM.js +0 -15
- package/dist/assets/useDesktopWindowControlsLayout-DxxOUZj1.js +0 -1
- package/dist/assets/useMobileNavigationStore-BmVr5a5c.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-DipfA56P.js +0 -15
- package/dist/assets/zh-TW-B7pXMVjt.js +0 -15
|
@@ -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
|
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { customProviderProtocols } from '../../../shared/custom-provider-protocol.js';
|
|
2
|
+
|
|
3
|
+
const fail = () => Object.assign(new Error('Unable to discover provider models'), { status: 502 });
|
|
4
|
+
const positive = (value) => Number.isSafeInteger(value) && value > 0 ? value : undefined;
|
|
5
|
+
|
|
6
|
+
/** Draft discovery has no persistence and never returns upstream bodies or credentials. */
|
|
7
|
+
export async function discoverCustomProviderModels(input, { signal, fetchImpl = fetch } = {}) {
|
|
8
|
+
if (!input || !customProviderProtocols.some((protocol) => protocol.package === input.package)
|
|
9
|
+
|| typeof input.baseURL !== 'string' || (input.apiKey !== undefined && typeof input.apiKey !== 'string')) throw fail();
|
|
10
|
+
let base;
|
|
11
|
+
try {
|
|
12
|
+
base = new URL(input.baseURL);
|
|
13
|
+
if (!['http:', 'https:'].includes(base.protocol) || base.username || base.password || base.search || base.hash || input.baseURL.includes('\\')) throw fail();
|
|
14
|
+
} catch { throw fail(); }
|
|
15
|
+
const google = input.package === '@opencode/ai/providers/google';
|
|
16
|
+
const anthropic = input.package === '@opencode/ai/providers/anthropic-compatible';
|
|
17
|
+
const headers = { Accept: 'application/json' };
|
|
18
|
+
const key = input.apiKey?.trim();
|
|
19
|
+
if (google && key) headers['x-goog-api-key'] = key;
|
|
20
|
+
else if (anthropic) {
|
|
21
|
+
headers['anthropic-version'] = '2023-06-01';
|
|
22
|
+
if (key) headers['x-api-key'] = key;
|
|
23
|
+
} else if (key) headers.Authorization = `Bearer ${key}`;
|
|
24
|
+
const deadline = AbortSignal.timeout(15000);
|
|
25
|
+
const abort = signal ? AbortSignal.any([signal, deadline]) : deadline;
|
|
26
|
+
const models = new Map();
|
|
27
|
+
const cursors = new Set();
|
|
28
|
+
let cursor;
|
|
29
|
+
try {
|
|
30
|
+
for (let page = 0; page < 20; page++) {
|
|
31
|
+
const url = new URL(`${input.baseURL.replace(/\/+$/, '')}/models`);
|
|
32
|
+
if (google) { url.searchParams.set('pageSize', '1000'); if (cursor) url.searchParams.set('pageToken', cursor); }
|
|
33
|
+
if (anthropic) { url.searchParams.set('limit', '1000'); if (cursor) url.searchParams.set('after_id', cursor); }
|
|
34
|
+
const response = await fetchImpl(url, { headers, signal: abort, redirect: 'error', cache: 'no-store' });
|
|
35
|
+
if (!response.ok) { await response.body?.cancel(); throw fail(); }
|
|
36
|
+
const reader = response.body?.getReader();
|
|
37
|
+
if (!reader) throw fail();
|
|
38
|
+
const chunks = [];
|
|
39
|
+
let bytes = 0;
|
|
40
|
+
try {
|
|
41
|
+
while (true) {
|
|
42
|
+
const chunk = await reader.read();
|
|
43
|
+
if (chunk.done) break;
|
|
44
|
+
bytes += chunk.value.byteLength;
|
|
45
|
+
if (bytes > 2 * 1024 * 1024) throw fail();
|
|
46
|
+
chunks.push(chunk.value);
|
|
47
|
+
}
|
|
48
|
+
} finally { await reader.cancel(); }
|
|
49
|
+
const payload = JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
50
|
+
const entries = google ? payload.models : payload.data;
|
|
51
|
+
if (!Array.isArray(entries)) throw fail();
|
|
52
|
+
for (const item of entries) {
|
|
53
|
+
if (!item || typeof item !== 'object') continue;
|
|
54
|
+
if (google && Array.isArray(item.supportedGenerationMethods) && !item.supportedGenerationMethods.includes('generateContent')) continue;
|
|
55
|
+
const id = google && typeof item.name === 'string' ? item.name.replace(/^models\//, '') : item.id;
|
|
56
|
+
if (typeof id !== 'string' || !id.trim() || /[\s#]/.test(id)) continue;
|
|
57
|
+
const name = item.displayName || item.display_name || item.name;
|
|
58
|
+
models.set(id, { id, name: typeof name === 'string' ? name : id,
|
|
59
|
+
...(positive(item.inputTokenLimit) ? { context: item.inputTokenLimit } : {}),
|
|
60
|
+
...(positive(item.outputTokenLimit) ? { output: item.outputTokenLimit } : {}) });
|
|
61
|
+
if (models.size > 5000) throw fail();
|
|
62
|
+
}
|
|
63
|
+
cursor = google ? payload.nextPageToken : anthropic && payload.has_more ? payload.last_id : undefined;
|
|
64
|
+
if (anthropic && payload.has_more && !cursor) throw fail();
|
|
65
|
+
if (!cursor) return { models: [...models.values()] };
|
|
66
|
+
if (typeof cursor !== 'string' || cursors.has(cursor)) throw fail();
|
|
67
|
+
cursors.add(cursor);
|
|
68
|
+
}
|
|
69
|
+
throw fail();
|
|
70
|
+
} catch { throw fail(); }
|
|
71
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { resolveCustomProviderURL } from '../../../shared/custom-provider-protocol.js';
|
|
3
|
+
import { discoverCustomProviderModels } from './custom-provider-models.js';
|
|
4
|
+
|
|
5
|
+
const chat = '@opencode/ai/providers/openai-compatible';
|
|
6
|
+
const responses = `${chat}/responses`;
|
|
7
|
+
const anthropic = '@opencode/ai/providers/anthropic-compatible';
|
|
8
|
+
const google = '@opencode/ai/providers/google';
|
|
9
|
+
const listing = (pkg = chat) => ({ package: pkg, baseURL: 'https://api.example.com/v1', apiKey: 'fixture-key' });
|
|
10
|
+
const json = (value) => new Response(JSON.stringify(value), { headers: { 'Content-Type': 'application/json' } });
|
|
11
|
+
|
|
12
|
+
describe('Cherry-compatible URL completion with native OpenCode endpoints', () => {
|
|
13
|
+
it.each([
|
|
14
|
+
['https://api.example.com', chat, 'https://api.example.com/v1/chat/completions'],
|
|
15
|
+
['https://api.example.com/', chat, 'https://api.example.com/v1/chat/completions'],
|
|
16
|
+
['https://api.example.com/v2/', responses, 'https://api.example.com/v2/responses'],
|
|
17
|
+
['https://api.example.com/gateway#', chat, 'https://api.example.com/gateway/chat/completions'],
|
|
18
|
+
['https://api.example.com/custom/messages#', anthropic, 'https://api.example.com/custom/messages'],
|
|
19
|
+
['https://api.example.com/custom/responses#', responses, 'https://api.example.com/custom/responses'],
|
|
20
|
+
['https://api.example.com', anthropic, 'https://api.example.com/v1/messages'],
|
|
21
|
+
['https://api.example.com', google, 'https://api.example.com/v1beta/models/coder:streamGenerateContent?alt=sse'],
|
|
22
|
+
['https://api.example.com/v1beta/', google, 'https://api.example.com/v1beta/models/coder:streamGenerateContent?alt=sse'],
|
|
23
|
+
['https://api.example.com/v1/proxy', chat, 'https://api.example.com/v1/proxy/chat/completions'],
|
|
24
|
+
])('%s → %s uses exactly the displayed request path', (value, pkg, expected) => {
|
|
25
|
+
const result = resolveCustomProviderURL(value, pkg, 'coder');
|
|
26
|
+
expect(result?.requestURL).toBe(expected);
|
|
27
|
+
expect(result?.modelsURL).toBe(`${result?.baseURL}/models`);
|
|
28
|
+
expect(result?.baseURL).not.toContain('#');
|
|
29
|
+
});
|
|
30
|
+
it.each(['', 'wrong', 'file:///local', 'https://user:pass@example.com', 'https://api.example.com?key=hidden', 'https://api.example.com#fragment', 'https:\\example.com'])('rejects invalid/credential-bearing address %s', (value) => {
|
|
31
|
+
expect(resolveCustomProviderURL(value, chat)).toBeNull();
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe('draft model discovery', () => {
|
|
36
|
+
it.each([chat, responses])('uses Bearer for %s and returns safe unique model IDs', async (pkg) => {
|
|
37
|
+
const fetchImpl = vi.fn().mockResolvedValue(json({ data: [{ id: 'coder', secret: 'never-return' }, { id: 'coder' }, { id: 'vendor/code', name: 'Code' }] }));
|
|
38
|
+
expect(await discoverCustomProviderModels(listing(pkg), { fetchImpl })).toEqual({ models: [{ id: 'coder', name: 'coder' }, { id: 'vendor/code', name: 'Code' }] });
|
|
39
|
+
const [url, options] = fetchImpl.mock.calls[0];
|
|
40
|
+
expect(url.toString()).toBe('https://api.example.com/v1/models');
|
|
41
|
+
expect(options.headers.Authorization).toBe('Bearer fixture-key'); expect(options.redirect).toBe('error');
|
|
42
|
+
expect(url.toString()).not.toContain('fixture-key');
|
|
43
|
+
});
|
|
44
|
+
it('paginates Anthropic with native authentication and does not accept an incomplete inventory', async () => {
|
|
45
|
+
const fetchImpl = vi.fn()
|
|
46
|
+
.mockResolvedValueOnce(json({ data: [{ id: 'claude', display_name: 'Claude' }], has_more: true, last_id: 'claude' }))
|
|
47
|
+
.mockResolvedValueOnce(json({ data: [{ id: 'claude-next' }], has_more: false }));
|
|
48
|
+
const result = await discoverCustomProviderModels(listing(anthropic), { fetchImpl });
|
|
49
|
+
expect(result.models.map((model) => model.id)).toEqual(['claude', 'claude-next']);
|
|
50
|
+
expect(fetchImpl.mock.calls[0][1].headers).toMatchObject({ 'x-api-key': 'fixture-key', 'anthropic-version': '2023-06-01' });
|
|
51
|
+
expect(fetchImpl.mock.calls[1][0].searchParams.get('after_id')).toBe('claude');
|
|
52
|
+
});
|
|
53
|
+
it('paginates Gemini, strips models/ and keeps only content-generating models with supplied limits', async () => {
|
|
54
|
+
const fetchImpl = vi.fn()
|
|
55
|
+
.mockResolvedValueOnce(json({ models: [{ name: 'models/gemini', displayName: 'Gemini', supportedGenerationMethods: ['generateContent'], inputTokenLimit: 32768, outputTokenLimit: 8192 }, { name: 'models/embedding', supportedGenerationMethods: ['embedContent'] }], nextPageToken: 'second' }))
|
|
56
|
+
.mockResolvedValueOnce(json({ models: [{ name: 'models/gemini-next', supportedGenerationMethods: ['generateContent'] }] }));
|
|
57
|
+
const request = { ...listing(google), baseURL: 'https://api.example.com/v1beta' };
|
|
58
|
+
expect(await discoverCustomProviderModels(request, { fetchImpl })).toEqual({ models: [
|
|
59
|
+
{ id: 'gemini', name: 'Gemini', context: 32768, output: 8192 }, { id: 'gemini-next', name: 'models/gemini-next' },
|
|
60
|
+
] });
|
|
61
|
+
expect(fetchImpl.mock.calls[0][1].headers['x-goog-api-key']).toBe('fixture-key');
|
|
62
|
+
expect(fetchImpl.mock.calls[1][0].searchParams.get('pageToken')).toBe('second');
|
|
63
|
+
});
|
|
64
|
+
it('allows keyless local services without an authorization header', async () => {
|
|
65
|
+
const fetchImpl = vi.fn().mockResolvedValue(json({ data: [] }));
|
|
66
|
+
expect(await discoverCustomProviderModels({ package: chat, baseURL: 'http://127.0.0.1:1234/v1' }, { fetchImpl })).toEqual({ models: [] });
|
|
67
|
+
expect(fetchImpl.mock.calls[0][1].headers.Authorization).toBeUndefined();
|
|
68
|
+
});
|
|
69
|
+
it.each([new Response('fixture-key private body', { status: 401 }), json({ error: 'fixture-key' })])('rejects failed or malformed responses without exposing upstream text', async (response) => {
|
|
70
|
+
const fetchImpl = vi.fn().mockResolvedValue(response);
|
|
71
|
+
await expect(discoverCustomProviderModels(listing(), { fetchImpl })).rejects.toThrow('Unable to discover provider models');
|
|
72
|
+
});
|
|
73
|
+
it('rejects a failed second page instead of returning partial success', async () => {
|
|
74
|
+
const fetchImpl = vi.fn().mockResolvedValueOnce(json({ data: [{ id: 'first' }], has_more: true, last_id: 'first' }))
|
|
75
|
+
.mockResolvedValueOnce(new Response('failed', { status: 500 }));
|
|
76
|
+
await expect(discoverCustomProviderModels(listing(anthropic), { fetchImpl })).rejects.toThrow();
|
|
77
|
+
});
|
|
78
|
+
it('rejects repeated pagination cursors', async () => {
|
|
79
|
+
const fetchImpl = vi.fn().mockImplementation(async () => json({ models: [{ name: 'models/coder' }], nextPageToken: 'repeated' }));
|
|
80
|
+
await expect(discoverCustomProviderModels(listing(google), { fetchImpl })).rejects.toThrow();
|
|
81
|
+
expect(fetchImpl).toHaveBeenCalledTimes(2);
|
|
82
|
+
});
|
|
83
|
+
it('propagates cancellation to the actual model endpoint', async () => {
|
|
84
|
+
const controller = new AbortController();
|
|
85
|
+
const fetchImpl = vi.fn(async (_url, { signal }) => {
|
|
86
|
+
controller.abort(); expect(signal.aborted).toBe(true); throw new Error('aborted');
|
|
87
|
+
});
|
|
88
|
+
await expect(discoverCustomProviderModels(listing(), { signal: controller.signal, fetchImpl })).rejects.toThrow();
|
|
89
|
+
});
|
|
90
|
+
});
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { ConfigProvider } from '@opencode/schema/config/provider';
|
|
2
|
+
import { Schema } from 'effect';
|
|
3
|
+
import { currentClient } from './auth.js';
|
|
4
|
+
import { getConfigForPath, isPlainObject, readConfigLayers, writeConfig } from './config-files.js';
|
|
5
|
+
import { customProviderProtocols } from '../../../shared/custom-provider-protocol.js';
|
|
6
|
+
|
|
7
|
+
const packages = new Set(customProviderProtocols.map((protocol) => protocol.package));
|
|
8
|
+
const pending = new Set();
|
|
9
|
+
const failure = (code, status = 400) => Object.assign(new Error(code), { code, status });
|
|
10
|
+
|
|
11
|
+
function validate(input) {
|
|
12
|
+
if (!isPlainObject(input) || (input.providerId !== undefined && (typeof input.providerId !== 'string'
|
|
13
|
+
|| !/^custom-[a-z0-9-]{1,80}$/.test(input.providerId)))) throw failure('INVALID_PROVIDER');
|
|
14
|
+
let config;
|
|
15
|
+
try {
|
|
16
|
+
config = Schema.decodeUnknownSync(ConfigProvider.Info, { onExcessProperty: 'error' })(input.config);
|
|
17
|
+
} catch {
|
|
18
|
+
throw failure('INVALID_PROVIDER');
|
|
19
|
+
}
|
|
20
|
+
if (!config.name?.trim() || !packages.has(config.package)
|
|
21
|
+
|| !isPlainObject(config.settings) || Object.keys(config.settings).some((key) => key !== 'baseURL')
|
|
22
|
+
|| !isPlainObject(config.models) || !Object.keys(config.models).length
|
|
23
|
+
|| (input.apiKey !== undefined && typeof input.apiKey !== 'string')) throw failure('INVALID_PROVIDER');
|
|
24
|
+
try {
|
|
25
|
+
const url = new URL(config.settings.baseURL);
|
|
26
|
+
if (!['http:', 'https:'].includes(url.protocol) || url.username || url.password || url.search || url.hash) throw new Error();
|
|
27
|
+
} catch {
|
|
28
|
+
throw failure('INVALID_BASE_URL');
|
|
29
|
+
}
|
|
30
|
+
for (const [id, model] of Object.entries(config.models)) {
|
|
31
|
+
if (!id.trim() || /[\s#]/.test(id) || ['__proto__', 'constructor', 'prototype'].includes(id)
|
|
32
|
+
|| Object.keys(model).some((key) => !['name', 'capabilities', 'limit'].includes(key))
|
|
33
|
+
|| Object.values(model.limit ?? {}).some((value) => !Number.isSafeInteger(value) || value <= 0)
|
|
34
|
+
|| (model.limit?.context && model.limit?.output && model.limit.output > model.limit.context)) throw failure('INVALID_MODELS');
|
|
35
|
+
}
|
|
36
|
+
if (Object.keys(input.config).some((key) => !['name', 'package', 'settings', 'models'].includes(key))) throw failure('INVALID_PROVIDER');
|
|
37
|
+
return { providerId: input.providerId, config: input.config, apiKey: input.apiKey?.trim() };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function targetForCreation(providerId, directory) {
|
|
41
|
+
const layers = readConfigLayers(directory);
|
|
42
|
+
if (layers.documents.some(({ config }) => Object.hasOwn(config.providers ?? {}, providerId)
|
|
43
|
+
|| Object.hasOwn(config.provider ?? {}, providerId))) throw failure('PROVIDER_EXISTS', 409);
|
|
44
|
+
const path = layers.paths.customPath || layers.paths.userPath;
|
|
45
|
+
const config = getConfigForPath(layers, path);
|
|
46
|
+
if (config.providers !== undefined && !isPlainObject(config.providers)) throw failure('INVALID_PROVIDER_CONFIG');
|
|
47
|
+
return { path, config };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async function allocateProviderId(name, directory, client) {
|
|
51
|
+
const location = directory ? { directory } : undefined;
|
|
52
|
+
const [providers, integrations] = await Promise.all([
|
|
53
|
+
client.provider.list({ location }, { signal: AbortSignal.timeout(8000) }),
|
|
54
|
+
client.integration.list({ location }, { signal: AbortSignal.timeout(8000) }),
|
|
55
|
+
]);
|
|
56
|
+
if (!Array.isArray(providers.data) || !Array.isArray(integrations.data)) throw failure('PROVIDER_SAVE_FAILED', 502);
|
|
57
|
+
const layers = readConfigLayers(directory);
|
|
58
|
+
const used = new Set(['__proto__', 'constructor', 'prototype', ...pending,
|
|
59
|
+
...providers.data.map((entry) => entry.id), ...integrations.data.map((entry) => entry.id),
|
|
60
|
+
...layers.documents.flatMap(({ config }) => [...Object.keys(config.providers ?? {}), ...Object.keys(config.provider ?? {})]),
|
|
61
|
+
]);
|
|
62
|
+
const base = name.normalize('NFKC').trim().toLowerCase().replace(/[^\p{L}\p{N}]+/gu, '-').slice(0, 80).replace(/^-+|-+$/g, '') || 'custom-provider';
|
|
63
|
+
let id = base;
|
|
64
|
+
for (let suffix = 2; used.has(id); suffix++) id = `${base}-${suffix}`;
|
|
65
|
+
pending.add(id);
|
|
66
|
+
return id;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Keys only enter OpenCode's credential store; JSONC edits share the atomic config writer. */
|
|
70
|
+
export async function createCustomProvider(input, directory, client = currentClient()) {
|
|
71
|
+
const validated = validate(input);
|
|
72
|
+
const { config, apiKey } = validated;
|
|
73
|
+
const providerId = validated.providerId ?? await allocateProviderId(config.name, directory, client);
|
|
74
|
+
if (validated.providerId) {
|
|
75
|
+
if (pending.has(providerId)) throw failure('PROVIDER_EXISTS', 409);
|
|
76
|
+
pending.add(providerId);
|
|
77
|
+
}
|
|
78
|
+
let credentialID;
|
|
79
|
+
try {
|
|
80
|
+
targetForCreation(providerId, directory);
|
|
81
|
+
if (apiKey) {
|
|
82
|
+
try {
|
|
83
|
+
const credential = await client.credential.create({ integrationID: providerId, label: config.name,
|
|
84
|
+
value: { type: 'key', key: apiKey }, activate: true }, { signal: AbortSignal.timeout(15000) });
|
|
85
|
+
credentialID = credential.id;
|
|
86
|
+
} catch {
|
|
87
|
+
throw failure('PROVIDER_CREDENTIAL_FAILED', 502);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const target = targetForCreation(providerId, directory);
|
|
91
|
+
writeConfig({ ...target.config, $schema: target.config.$schema ?? 'https://opencode.ai/config.json',
|
|
92
|
+
providers: { ...target.config.providers, [providerId]: config } }, target.path);
|
|
93
|
+
return { providerId };
|
|
94
|
+
} catch (error) {
|
|
95
|
+
if (credentialID) {
|
|
96
|
+
try {
|
|
97
|
+
await client.credential.remove({ credentialID }, { signal: AbortSignal.timeout(15000) });
|
|
98
|
+
} catch {
|
|
99
|
+
throw failure('PROVIDER_CLEANUP_FAILED', 500);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (typeof error.status === 'number') throw error;
|
|
103
|
+
throw failure('PROVIDER_SAVE_FAILED', 500);
|
|
104
|
+
} finally {
|
|
105
|
+
pending.delete(providerId);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { Schema } from 'effect';
|
|
5
|
+
import { ConfigProvider } from '@opencode/schema/config/provider';
|
|
6
|
+
import { beforeEach, afterEach, describe, expect, it, vi } from 'vitest';
|
|
7
|
+
import { createCustomProvider } from './custom-provider.js';
|
|
8
|
+
import { readConfigFile } from './config-files.js';
|
|
9
|
+
import { configureOpenCodeCredentials } from './auth.js';
|
|
10
|
+
import { registerOpenCodeRoutes } from './routes.js';
|
|
11
|
+
import { registerCommonRequestMiddleware } from './core-routes.js';
|
|
12
|
+
import express from 'express';
|
|
13
|
+
import request from 'supertest';
|
|
14
|
+
|
|
15
|
+
let root;
|
|
16
|
+
let file;
|
|
17
|
+
let client;
|
|
18
|
+
const input = (pkg = '@opencode/ai/providers/openai-compatible') => ({
|
|
19
|
+
providerId: 'custom-fixture', apiKey: 'fixture-key',
|
|
20
|
+
config: { name: 'Gateway', package: pkg, settings: { baseURL: 'https://api.example.com/v1' },
|
|
21
|
+
models: { 'upstream/coder': { name: 'Coder', capabilities: { tools: true, input: ['text', 'image'], output: ['text'] }, limit: { context: 32768, output: 8192 } } } },
|
|
22
|
+
});
|
|
23
|
+
beforeEach(() => {
|
|
24
|
+
root = fs.mkdtempSync(path.join(os.tmpdir(), 'yuri-custom-provider-'));
|
|
25
|
+
vi.stubEnv('OPENCODE_CONFIG_DIR', root);
|
|
26
|
+
vi.stubEnv('OPENCODE_CONFIG', '');
|
|
27
|
+
file = path.join(root, 'opencode.jsonc');
|
|
28
|
+
client = { credential: { create: vi.fn().mockResolvedValue({ id: 'fixture-credential' }), remove: vi.fn().mockResolvedValue(undefined) } };
|
|
29
|
+
client.provider = { list: vi.fn().mockResolvedValue({ data: [] }) };
|
|
30
|
+
client.integration = { list: vi.fn().mockResolvedValue({ data: [] }) };
|
|
31
|
+
});
|
|
32
|
+
afterEach(() => { configureOpenCodeCredentials(null); vi.restoreAllMocks(); vi.unstubAllEnvs(); fs.rmSync(root, { recursive: true, force: true }); });
|
|
33
|
+
|
|
34
|
+
describe('custom provider native V2 persistence', () => {
|
|
35
|
+
it.each([
|
|
36
|
+
[' My Gateway ', 'my-gateway'],
|
|
37
|
+
['My__Gateway / Test', 'my-gateway-test'],
|
|
38
|
+
['我的 网关', '我的-网关'],
|
|
39
|
+
['!!!', 'custom-provider'],
|
|
40
|
+
['constructor', 'constructor-2'],
|
|
41
|
+
])('derives a lowercase hyphenated ID from %s', async (name, expectedId) => {
|
|
42
|
+
const draft = input(); delete draft.providerId; draft.config.name = name;
|
|
43
|
+
expect(await createCustomProvider(draft, root, client)).toEqual({ providerId: expectedId });
|
|
44
|
+
expect(readConfigFile(file).providers[expectedId]).toEqual(draft.config);
|
|
45
|
+
expect(client.credential.create).toHaveBeenCalledWith(expect.objectContaining({ integrationID: expectedId }), expect.anything());
|
|
46
|
+
expect(client.provider.list).toHaveBeenCalledWith({ location: { directory: root } }, expect.anything());
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('suffixes duplicate names without replacing saved, runtime or built-in integrations', async () => {
|
|
50
|
+
fs.writeFileSync(file, '{"providers":{"gateway-3":{"name":"Keep"}}}');
|
|
51
|
+
client.provider.list.mockResolvedValue({ data: [{ id: 'gateway' }] });
|
|
52
|
+
client.integration.list.mockResolvedValue({ data: [{ id: 'gateway-2' }] });
|
|
53
|
+
const draft = input(); delete draft.providerId;
|
|
54
|
+
expect(await createCustomProvider(draft, undefined, client)).toEqual({ providerId: 'gateway-4' });
|
|
55
|
+
expect(readConfigFile(file).providers['gateway-3']).toEqual({ name: 'Keep' });
|
|
56
|
+
expect(readConfigFile(file).providers['gateway-4']).toEqual(draft.config);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('reserves distinct name-based IDs for simultaneous creates', async () => {
|
|
60
|
+
const draft = input(); delete draft.providerId;
|
|
61
|
+
const results = await Promise.all([createCustomProvider(draft, undefined, client), createCustomProvider(draft, undefined, client)]);
|
|
62
|
+
expect(results.map((entry) => entry.providerId)).toEqual(['gateway', 'gateway-2']);
|
|
63
|
+
expect(Object.keys(readConfigFile(file).providers)).toEqual(['gateway', 'gateway-2']);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('does not create credentials or config when the ID inventory cannot be read', async () => {
|
|
67
|
+
const draft = input(); delete draft.providerId;
|
|
68
|
+
client.provider.list.mockRejectedValue(new Error('offline'));
|
|
69
|
+
await expect(createCustomProvider(draft, undefined, client)).rejects.toThrow();
|
|
70
|
+
expect(client.credential.create).not.toHaveBeenCalled();
|
|
71
|
+
expect(fs.existsSync(file)).toBe(false);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('parses draft discovery JSON through the common middleware without persisting credentials or config', async () => {
|
|
75
|
+
const fetch = vi.spyOn(globalThis, 'fetch').mockResolvedValue(new Response(JSON.stringify({ data: [{ id: 'coder', name: 'Coder' }] })));
|
|
76
|
+
const app = express(); registerCommonRequestMiddleware(app, { express });
|
|
77
|
+
registerOpenCodeRoutes(app, {});
|
|
78
|
+
const response = await request(app).post('/api/config/providers/custom/models').send({
|
|
79
|
+
package: '@opencode/ai/providers/openai-compatible', baseURL: 'https://api.example.com/v1', apiKey: 'fixture-key',
|
|
80
|
+
}).expect(200);
|
|
81
|
+
expect(response.body).toEqual({ models: [{ id: 'coder', name: 'Coder' }] });
|
|
82
|
+
expect(fetch.mock.calls[0][0].toString()).toBe('https://api.example.com/v1/models');
|
|
83
|
+
expect(fetch.mock.calls[0][1].headers.Authorization).toBe('Bearer fixture-key');
|
|
84
|
+
expect(JSON.stringify(response.body)).not.toContain('fixture-key');
|
|
85
|
+
expect(client.credential.create).not.toHaveBeenCalled(); expect(fs.existsSync(file)).toBe(false);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('exposes only the created provider ID through the authenticated host route and uses the captured directory', async () => {
|
|
89
|
+
configureOpenCodeCredentials(() => client);
|
|
90
|
+
const app = express(); registerCommonRequestMiddleware(app, { express });
|
|
91
|
+
const validateDirectoryPath = vi.fn().mockResolvedValue({ ok: true, directory: root });
|
|
92
|
+
registerOpenCodeRoutes(app, { validateDirectoryPath });
|
|
93
|
+
const response = await request(app).post('/api/config/providers/custom').send({ ...input(), directory: root }).expect(200);
|
|
94
|
+
expect(response.body).toEqual({ providerId: 'custom-fixture' });
|
|
95
|
+
expect(validateDirectoryPath).toHaveBeenCalledWith(root);
|
|
96
|
+
expect(JSON.stringify(response.body)).not.toContain('fixture-key');
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('does not write for an invalid requested directory', async () => {
|
|
100
|
+
configureOpenCodeCredentials(() => client);
|
|
101
|
+
const app = express(); registerCommonRequestMiddleware(app, { express });
|
|
102
|
+
registerOpenCodeRoutes(app, { validateDirectoryPath: async () => ({ ok: false }) });
|
|
103
|
+
await request(app).post('/api/config/providers/custom').send({ ...input(), directory: 'missing' }).expect(400);
|
|
104
|
+
expect(client.credential.create).not.toHaveBeenCalled(); expect(fs.existsSync(file)).toBe(false);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it.each([
|
|
108
|
+
'@opencode/ai/providers/openai-compatible', '@opencode/ai/providers/openai-compatible/responses',
|
|
109
|
+
'@opencode/ai/providers/anthropic-compatible', '@opencode/ai/providers/google',
|
|
110
|
+
])('round-trips %s through the official schema, preserving comments and unrelated config', async (pkg) => {
|
|
111
|
+
const original = '{ // keep this comment\n"model":"existing/coder","providers":{"existing":{"name":"Existing"}},}';
|
|
112
|
+
fs.writeFileSync(file, original);
|
|
113
|
+
expect(await createCustomProvider(input(pkg), undefined, client)).toEqual({ providerId: 'custom-fixture' });
|
|
114
|
+
const saved = readConfigFile(file);
|
|
115
|
+
expect(saved).toEqual({ $schema: 'https://opencode.ai/config.json', model: 'existing/coder',
|
|
116
|
+
providers: { existing: { name: 'Existing' }, 'custom-fixture': input(pkg).config } });
|
|
117
|
+
expect(() => Schema.decodeUnknownSync(ConfigProvider.Info)(saved.providers['custom-fixture'])).not.toThrow();
|
|
118
|
+
expect(fs.readFileSync(file, 'utf8')).toContain('// keep this comment');
|
|
119
|
+
expect(fs.readFileSync(file, 'utf8')).not.toContain('fixture-key');
|
|
120
|
+
expect(fs.readFileSync(`${file}.yuri.backup`, 'utf8')).toBe(original);
|
|
121
|
+
expect(client.credential.create).toHaveBeenCalledWith(expect.objectContaining({ integrationID: 'custom-fixture', value: { type: 'key', key: 'fixture-key' } }), expect.anything());
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it('supports keyless services and writes only the target document, not merged project settings', async () => {
|
|
125
|
+
fs.writeFileSync(path.join(root, 'opencode.json'), '{"model":"global/coder"}');
|
|
126
|
+
const project = path.join(root, 'project'); fs.mkdirSync(project);
|
|
127
|
+
fs.writeFileSync(path.join(project, 'opencode.json'), '{"instructions":["project.md"]}');
|
|
128
|
+
const request = input(); delete request.apiKey;
|
|
129
|
+
await createCustomProvider(request, project, client);
|
|
130
|
+
const saved = readConfigFile(path.join(root, 'opencode.json'));
|
|
131
|
+
expect(saved.model).toBe('global/coder'); expect(saved.instructions).toBeUndefined();
|
|
132
|
+
expect(saved.providers['custom-fixture']).toEqual(request.config);
|
|
133
|
+
expect(client.credential.create).not.toHaveBeenCalled();
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it('honors the explicit config path', async () => {
|
|
137
|
+
const custom = path.join(root, 'explicit.jsonc'); vi.stubEnv('OPENCODE_CONFIG', custom);
|
|
138
|
+
await createCustomProvider(input(), undefined, client);
|
|
139
|
+
expect(readConfigFile(custom).providers['custom-fixture']).toEqual(input().config);
|
|
140
|
+
expect(fs.existsSync(file)).toBe(false);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it('rejects duplicate providers before touching credentials or files', async () => {
|
|
144
|
+
fs.writeFileSync(file, '{"providers":{"custom-fixture":{"name":"Keep"}}}');
|
|
145
|
+
await expect(createCustomProvider(input(), undefined, client)).rejects.toMatchObject({ code: 'PROVIDER_EXISTS' });
|
|
146
|
+
expect(client.credential.create).not.toHaveBeenCalled();
|
|
147
|
+
expect(readConfigFile(file)).toEqual({ providers: { 'custom-fixture': { name: 'Keep' } } });
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
it.each(['Gateway Two', 'Gateway One'])('keeps multiple providers independent even with the same endpoint and second name %s', async (secondName) => {
|
|
151
|
+
const first = input(); first.providerId = 'custom-first'; first.config.name = 'Gateway One';
|
|
152
|
+
const second = input(); second.providerId = 'custom-second'; second.config.name = secondName;
|
|
153
|
+
client.credential.create.mockImplementation(async ({ integrationID }) => ({ id: `credential-${integrationID}` }));
|
|
154
|
+
await Promise.all([
|
|
155
|
+
createCustomProvider(first, undefined, client),
|
|
156
|
+
createCustomProvider(second, undefined, client),
|
|
157
|
+
]);
|
|
158
|
+
const saved = readConfigFile(file);
|
|
159
|
+
expect(saved.providers).toEqual({ 'custom-first': first.config, 'custom-second': second.config });
|
|
160
|
+
expect(client.credential.create.mock.calls.map(([credential]) => ({ integrationID: credential.integrationID, label: credential.label })))
|
|
161
|
+
.toEqual([{ integrationID: 'custom-first', label: 'Gateway One' }, { integrationID: 'custom-second', label: secondName }]);
|
|
162
|
+
expect(client.credential.remove).not.toHaveBeenCalled();
|
|
163
|
+
expect(fs.readFileSync(file, 'utf8')).not.toContain('fixture-key');
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it.each([
|
|
167
|
+
(request) => { request.config.npm = '@ai-sdk/openai'; },
|
|
168
|
+
(request) => { request.config.settings.apiKey = 'do-not-write'; },
|
|
169
|
+
(request) => { request.config.settings.baseURL = 'https://user:password@example.com/v1'; },
|
|
170
|
+
(request) => { request.config.settings.baseURL = 'file:///example'; },
|
|
171
|
+
(request) => { request.config.models['upstream/coder'].limit.output = 999999; },
|
|
172
|
+
(request) => { request.config.models['upstream/coder'].limit.context = -1; },
|
|
173
|
+
(request) => { request.config.models = {}; },
|
|
174
|
+
(request) => { request.config.models['upstream/coder'].options = {}; },
|
|
175
|
+
(request) => { request.providerId = '__proto__'; },
|
|
176
|
+
(request) => { request.config.package = 'file:///untrusted.js'; },
|
|
177
|
+
])('rejects malformed/legacy/untrusted input without side effects (%#)', async (change) => {
|
|
178
|
+
const request = input(); change(request);
|
|
179
|
+
await expect(createCustomProvider(request, undefined, client)).rejects.toMatchObject({ status: 400 });
|
|
180
|
+
expect(client.credential.create).not.toHaveBeenCalled(); expect(fs.existsSync(file)).toBe(false);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it('does not replace malformed existing JSONC or persist a credential', async () => {
|
|
184
|
+
fs.writeFileSync(file, '{ broken');
|
|
185
|
+
await expect(createCustomProvider(input(), undefined, client)).rejects.toMatchObject({ code: 'PROVIDER_SAVE_FAILED' });
|
|
186
|
+
expect(fs.readFileSync(file, 'utf8')).toBe('{ broken'); expect(client.credential.create).not.toHaveBeenCalled();
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
it('keeps the original file on failed atomic replacement and rolls back only the new credential', async () => {
|
|
190
|
+
fs.writeFileSync(file, '{ // keep\n"model":"existing/coder"}');
|
|
191
|
+
const original = fs.readFileSync(file, 'utf8');
|
|
192
|
+
vi.spyOn(fs, 'renameSync').mockImplementation(() => { throw new Error('fixture IO error'); });
|
|
193
|
+
await expect(createCustomProvider(input(), undefined, client)).rejects.toMatchObject({ code: 'PROVIDER_SAVE_FAILED' });
|
|
194
|
+
expect(fs.readFileSync(file, 'utf8')).toBe(original);
|
|
195
|
+
expect(client.credential.remove).toHaveBeenCalledWith({ credentialID: 'fixture-credential' }, expect.anything());
|
|
196
|
+
expect(fs.readdirSync(root).some((name) => name.endsWith('.tmp'))).toBe(false);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it('sanitizes credential failures and never writes config after a failed credential save', async () => {
|
|
200
|
+
client.credential.create.mockRejectedValue(new Error('fixture-key in upstream body'));
|
|
201
|
+
const error = await createCustomProvider(input(), undefined, client).catch((error) => error);
|
|
202
|
+
expect(error.message).toBe('PROVIDER_CREDENTIAL_FAILED'); expect(fs.existsSync(file)).toBe(false);
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
it('reports a failed rollback explicitly', async () => {
|
|
206
|
+
vi.spyOn(fs, 'renameSync').mockImplementation(() => { throw new Error('fixture IO error'); });
|
|
207
|
+
client.credential.remove.mockRejectedValue(new Error('fixture cleanup error'));
|
|
208
|
+
await expect(createCustomProvider(input(), undefined, client)).rejects.toMatchObject({ code: 'PROVIDER_CLEANUP_FAILED' });
|
|
209
|
+
expect(fs.existsSync(file)).toBe(false);
|
|
210
|
+
});
|
|
211
|
+
});
|
|
@@ -16,6 +16,7 @@ import { registerProjectIconRoutes } from './project-icon-routes.js';
|
|
|
16
16
|
import { registerScheduledTaskRoutes } from '../scheduled-tasks/routes.js';
|
|
17
17
|
import { registerScheduledTaskToolRoute } from '../scheduled-tasks/managed-tool-route.js';
|
|
18
18
|
import { registerScheduledTaskSessionSkill } from '../scheduled-tasks/session-skill.js';
|
|
19
|
+
import { registerCustomizationSessionSkill } from '../gui-customization/session-skill.js';
|
|
19
20
|
import { registerConversationRoutes } from '../conversations/routes.js';
|
|
20
21
|
import { registerSessionTurnPageRoutes } from '../session-turn-pages/routes.js';
|
|
21
22
|
import { registerAssistantRoutes } from '../assistants/routes.js';
|
|
@@ -247,6 +248,10 @@ export const createFeatureRoutesRuntime = (dependencies) => {
|
|
|
247
248
|
readSettingsFromDiskMigrated, sanitizeProjects, validateDirectoryPath,
|
|
248
249
|
scheduledTaskRouter,
|
|
249
250
|
});
|
|
251
|
+
registerCustomizationSessionSkill(app, {
|
|
252
|
+
express, yuriDataDir, getIsSharedOpenCodeService, getIsExternalOpenCode, waitForOpenCodeReady,
|
|
253
|
+
createClient: () => makeOpenCodeV2Client({ baseUrl: buildOpenCodeUrl('/', ''), authHeaders: getOpenCodeAuthHeaders(), getRuntimeContract }),
|
|
254
|
+
});
|
|
250
255
|
app.use(scheduledTaskRouter);
|
|
251
256
|
|
|
252
257
|
registerScheduledTaskToolRoute(app, {
|