fix(bot-browser): support preview-metaapp URIs in browser-open RPC and skill - #7
Open
WuFenG-Hub wants to merge 1 commit into
Open
Conversation
…d skill The metabot-browser-open skill and the /api/idbots/bot-browser/open RPC rejected preview-metaapp:// URIs, so a local preview could not be opened through the skill path even though the Bot Browser renderer supports the scheme (equivalent to bot_browser_preview_local). - skill script: the SUPPORTED_URI_RE regex matched metaapp:// inside preview-metaapp:// and silently stripped the preview- prefix. Recognize preview-metaapp first and keep its authority/path case-sensitive. - metaidRpcServer: add preview-metaapp to BOT_BROWSER_URI_SCHEMES and restrict it to the localhost host (the renderer resolves local previews only when host === 'localhost'), so the RPC cannot be used to point the Bot Browser at arbitrary https URLs. - SKILL.md: document the preview-metaapp route target.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
metabot-browser-openand the local RPCPOST /api/idbots/bot-browser/openrejectedpreview-metaapp://URIs, so a local preview could not be opened through the skill path even though the Bot Browser renderer already supports the scheme (it is the same URI family used bybot_browser_preview_local).Two concrete failures:
SUPPORTED_URI_REregex (\b(metaid|pin|metaapp|map|metafile)://) matchedmetaapp://insidepreview-metaapp://, silently stripping thepreview-prefix and navigating the Bot Browser to an invalidmetaapp://localhost/...address.BOT_BROWSER_URI_SCHEMESdid not includepreview-metaapp, returningunsupported Bot Browser URI scheme: preview-metaappeven when the exact URI was posted.Changes
SKILLs/metabot-browser-open/scripts/index.jspreview-metaappfirst inSUPPORTED_URI_REso it is no longer split intometaapp://.preview-metaappinnormalizeSupportedUriand keep its authority/path case-sensitive (local file paths), matching howmap://is already treated.src/main/services/metaidRpcServer.tspreview-metaapptoBOT_BROWSER_URI_SCHEMES.preview-metaappto thelocalhosthost innormalizeBotBrowserUri, matching the renderer'spreview-metaappresolver (which resolves local previews only when host is exactlylocalhost). This keeps the RPC from being used to point the Bot Browser at arbitraryhttps://URLs.SKILLs/metabot-browser-open/SKILL.mdpreview-metaapp://localhost/<absolute-path>route target.Verification
preview-metaapp://localhost/<abs-path>(case preserved), mixed-casePreview-MetaApp://scheme, and existing behaviors (metaapp://pin, bare pin, bare globalMetaID).normalizeBotBrowserUriedge cases: acceptspreview-metaapp://localhost/..., rejects non-localhost hosts andlocalhost:<port>.npm run compile:electronpasses with 0 errors.eslintonmetaidRpcServer.tspasses with 0 warnings.Notes / risk
This widens the RPC open-URI input by one scheme. Risk is bounded because
preview-metaappis only accepted with alocalhosthost, and the renderer only serves local disk previews for that host. The change does not alter any other whitelisted scheme.