fix: install platform-correct native binaries for extensions (#102) - #106
Open
jackson-zhou wants to merge 1 commit into
Open
jackson-zhou wants to merge 1 commit into
jackson-zhou wants to merge 1 commit into
Conversation
…#102) Platform-specific extensions (e.g. Kilo Code, which bundles `kilo`, `ffmpeg`, `bwrap`) installed the wrong architecture on macOS - the downloaded `bin/kilo` was an `ELF ... musl aarch64` (Alpine Linux) binary, causing `ENOEXEC`. ## Root cause The SideX marketplace proxy's search returns a single "latest" version whose `targetPlatform` field is omitted but whose VSIX asset URI (base64-encoded in the path) points at `alpine-arm64`. The proxy serves whatever platform is baked into that base64 and ignores the `targetPlatform` query parameter, so every OS downloaded the alpine-arm64 build. ## Changes (6 files) - `marketplace.rs` / `lib.rs`: add `current_target_platform()` that maps the current build target (Rust `cfg!`, always correct for the host) to Open VSX's `targetPlatform` format (e.g. `darwin-arm64`, `linux-x64`). - `extensions.rs`: `rewrite_proxy_vsix_platform` decodes the proxy's base64 VSIX URL, swaps the embedded platform to `current_target_platform()`, and re-encodes. This is the authoritative correction point - the proxy can't be fixed without deploy access, so the backend rewrites the URL before downloading. `ensure_target_platform` also appends the param for non-proxy URLs. Includes unit tests. - `extensionResourceLoader.ts`: use the query-param form (`version?targetPlatform=`) for Open VSX manifest URLs in Tauri. The `version+platform` path segment that the Microsoft Marketplace uses 404s on Open VSX, aborting installation before the backend download runs. - `host.cjs`: stub `vscode.window` notebook/editor APIs (`visibleNotebookEditors`, `activeNotebookEditor`) in the SideX Node extension host. Extensions calling `.map()` on them (e.g. kilo-code's `gatherEditorContext`) crash with "Cannot read properties of undefined" because these APIs aren't implemented yet. - `extHost.api.impl.ts`: same notebook API stubs on the webview-side extension host, where kilo-code actually activates. ## Verification (macOS arm64, dev mode) - `bin/kilo` is `Mach-O 64-bit executable arm64` (was `ELF ... musl`) - Kilo Code sidebar loads, commands register, prompts send without `ENOEXEC` or "Cannot read properties of undefined". Fixes Sidenai#102
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.
Summary
Fixes #102. Platform-specific extensions (e.g. Kilo Code, which bundles
kilo/ffmpeg/bwrapnative binaries) installed the wrong architecture on macOS - the downloadedbin/kilowas anELF ... musl aarch64(Alpine Linux) binary, causingENOEXEC.Root cause
The SideX marketplace proxy's search returns a single "latest" version whose
targetPlatformfield is omitted but whose VSIX asset URI (base64-encoded in the path) points atalpine-arm64. The proxy serves whatever platform is baked into that base64 and ignores thetargetPlatformquery parameter, so every OS downloaded the alpine-arm64 build.Changes (6 files)
marketplace.rs/lib.rs: addcurrent_target_platform()that maps the current build target (Rustcfg!, always correct for the host) to Open VSX'stargetPlatformformat (e.g.darwin-arm64,linux-x64).extensions.rs:rewrite_proxy_vsix_platformdecodes the proxy's base64 VSIX URL, swaps the embedded platform tocurrent_target_platform(), and re-encodes. This is the authoritative correction point - the proxy can't be fixed without deploy access, so the backend rewrites the URL before downloading.ensure_target_platformalso appends the param for non-proxy URLs. Includes unit tests.extensionResourceLoader.ts: use the query-param form (version?targetPlatform=) for Open VSX manifest URLs in Tauri. Theversion+platformpath segment that the Microsoft Marketplace uses 404s on Open VSX, aborting installation before the backend download runs.host.cjs: stubvscode.windownotebook/editor APIs (visibleNotebookEditors,activeNotebookEditor) in the SideX Node extension host.extHost.api.impl.ts: same notebook API stubs on the webview-side extension host, where kilo-code actually activates.Why notebook API stubs are required for #102
The
host.cjs/extHost.api.impl.tschanges are not a separate improvement - they are required for #102 to be verifiably fixed:darwin-arm64instead ofalpine-arm64).vscode.window.visibleNotebookEditors.map(...)duringactivate().visibleNotebookEditorsisundefined, and.map()throws "Cannot read properties of undefined" - the extension fails to activate, registers no commands, and the sidebar won't load.The stubs are minimal (return empty array / undefined, matching VS Code's contract when no notebook editors are open) and only prevent the crash - they don't implement notebook functionality.
Verification (macOS arm64, dev mode)
bin/kiloisMach-O 64-bit executable arm64(wasELF ... musl)ENOEXECor "Cannot read properties of undefined"cargo check/eslint/prettier/cargo test(4 unit tests) all passFixes #102