feat(mount): resolve relayfile-mount from @relayfile/mount-* optional package, drop postinstall download#184
Conversation
… package, drop postinstall download Will's feedback: `npm i` ran a postinstall that downloaded the Go relayfile-mount binary from GitHub Releases, instead of it being a normal bundled dependency like the Rust broker. Switch to the broker distribution model: the binary now arrives via @relayfile/sdk's optionalDependencies (@relayfile/mount-<platform>-<arch>) and is bundled into the app from node_modules. - Remove the postinstall hook and unwire install-relayfile-mount from build/dist:mac/release:mac (kept relayfile-mount:install* as a manual escape hatch for pre-publish dev). - resolveRelayfileMountBinary now checks the per-platform optional package (top-level and SDK-nested), then the existing dev/source fallbacks. - electron-builder asarUnpacks node_modules/@relayfile/mount-*/bin/** so the binary is spawnable from the packaged app. - Update the launcher-import test to assert the new contract (no postinstall, no download in the release path, optional-package resolution + asarUnpack). Activates once the SDK + mount-* packages are published and pear's @relayfile/sdk dep is bumped to that version. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Your free trial PR review limit of 300 PRs has been reached. Please upgrade your plan to continue using CodeAnt AI. |
|
Warning Review limit reached
More reviews will be available in 59 minutes and 48 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
pr-reviewer could not complete review for #184 in AgentWorkforce/pear. |
There was a problem hiding this comment.
Code Review
This pull request transitions the distribution of the relayfile-mount binary from a postinstall download script to a per-platform optional package (@relayfile/mount--) installed transitively via @relayfile/sdk. It updates electron-builder.yml to unpack these binaries, removes the download scripts from package.json, updates the launcher to resolve the binary from node_modules, and updates the test suite accordingly. Feedback on these changes highlights that the fallback candidate paths in resolveRelayfileMountBinary still hardcode 'relayfile-mount' without the .exe extension on Windows, which will cause resolution to fail when falling back to development or packaged paths.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| // Locate the relayfile-mount binary shipped as the per-platform optional | ||
| // package (@relayfile/mount-<platform>-<arch>), installed transitively via | ||
| // @relayfile/sdk's optionalDependencies — the same distribution model as the | ||
| // agent-relay broker (see resolveBundledBrokerBinary in broker.ts). The SDK | ||
| // itself resolves this via import.meta.url, but that points at out/main/ once | ||
| // electron-vite bundles the main process, so we resolve from __dirname instead. | ||
| function optionalPackageMountBinaries(): string[] { | ||
| const pkgArch = `${process.platform}-${process.arch}` | ||
| const binName = process.platform === 'win32' ? 'relayfile-mount.exe' : 'relayfile-mount' | ||
| const unpackIfPackaged = (binary: string): string => | ||
| app.isPackaged ? binary.replace('app.asar', 'app.asar.unpacked') : binary | ||
| // __dirname is out/main; ../../ reaches the app root that holds node_modules. | ||
| const nodeModules = join(__dirname, '..', '..', 'node_modules') | ||
| return [ | ||
| // Hoisted to the app's top-level node_modules (the common case). | ||
| join(nodeModules, '@relayfile', `mount-${pkgArch}`, 'bin', binName), | ||
| // Nested under @relayfile/sdk when npm can't hoist it. | ||
| join(nodeModules, '@relayfile', 'sdk', 'node_modules', '@relayfile', `mount-${pkgArch}`, 'bin', binName) | ||
| ].map(unpackIfPackaged) | ||
| } | ||
|
|
||
| export function resolveRelayfileMountBinary(): string | null { | ||
| if (canExecute(process.env.RELAYFILE_MOUNT_BIN)) return resolve(process.env.RELAYFILE_MOUNT_BIN) | ||
|
|
||
| const appPath = app.getAppPath() | ||
| const candidates = app.isPackaged | ||
| ? [ | ||
| join(process.resourcesPath, 'bin', 'relayfile-mount'), | ||
| join(appPath.replace('app.asar', 'app.asar.unpacked'), 'bin', 'relayfile-mount') | ||
| ] | ||
| : [ | ||
| join(appPath, 'bin', 'relayfile-mount'), | ||
| join(process.cwd(), 'bin', 'relayfile-mount'), | ||
| join(appPath, '..', 'relayfile', 'dist', `relayfile-mount-${archSuffix()}`), | ||
| join(process.cwd(), '..', 'relayfile', 'dist', `relayfile-mount-${archSuffix()}`) | ||
| ] | ||
| const candidates = [ | ||
| // Primary production path: the per-platform optional-dependency package. | ||
| ...optionalPackageMountBinaries(), | ||
| // Development / source-checkout fallbacks. | ||
| ...(app.isPackaged | ||
| ? [ | ||
| join(process.resourcesPath, 'bin', 'relayfile-mount'), | ||
| join(appPath.replace('app.asar', 'app.asar.unpacked'), 'bin', 'relayfile-mount') | ||
| ] | ||
| : [ | ||
| join(appPath, 'bin', 'relayfile-mount'), | ||
| join(process.cwd(), 'bin', 'relayfile-mount'), | ||
| join(appPath, '..', 'relayfile', 'dist', `relayfile-mount-${archSuffix()}`), | ||
| join(process.cwd(), '..', 'relayfile', 'dist', `relayfile-mount-${archSuffix()}`) | ||
| ]) | ||
| ] |
There was a problem hiding this comment.
On Windows, executable binaries require the .exe extension to be correctly resolved and executed. While optionalPackageMountBinaries correctly appends .exe on Windows, the fallback candidate paths in resolveRelayfileMountBinary still hardcode 'relayfile-mount' without the extension. This will cause resolution to fail on Windows when falling back to development or packaged paths.
Extracting the binary name to a shared constant BIN_NAME and using it across all candidate paths (including appending .exe to the local dist build suffix on Windows) ensures consistent and correct resolution on Windows.
// Locate the relayfile-mount binary shipped as the per-platform optional
// package (@relayfile/mount-<platform>-<arch>), installed transitively via
// @relayfile/sdk's optionalDependencies — the same distribution model as the
// agent-relay broker (see resolveBundledBrokerBinary in broker.ts). The SDK
// itself resolves this via import.meta.url, but that points at out/main/ once
// electron-vite bundles the main process, so we resolve from __dirname instead.
const BIN_NAME = process.platform === 'win32' ? 'relayfile-mount.exe' : 'relayfile-mount'
function optionalPackageMountBinaries(): string[] {
const pkgArch = process.platform + '-' + process.arch
const unpackIfPackaged = (binary: string): string =>
app.isPackaged ? binary.replace('app.asar', 'app.asar.unpacked') : binary
// __dirname is out/main; ../../ reaches the app root that holds node_modules.
const nodeModules = join(__dirname, '..', '..', 'node_modules')
return [
// Hoisted to the app's top-level node_modules (the common case).
join(nodeModules, '@relayfile', 'mount-' + pkgArch, 'bin', BIN_NAME),
// Nested under @relayfile/sdk when npm can't hoist it.
join(nodeModules, '@relayfile', 'sdk', 'node_modules', '@relayfile', 'mount-' + pkgArch, 'bin', BIN_NAME)
].map(unpackIfPackaged)
}
export function resolveRelayfileMountBinary(): string | null {
if (canExecute(process.env.RELAYFILE_MOUNT_BIN)) return resolve(process.env.RELAYFILE_MOUNT_BIN)
const appPath = app.getAppPath()
const candidates = [
// Primary production path: the per-platform optional-dependency package.
...optionalPackageMountBinaries(),
// Development / source-checkout fallbacks.
...(app.isPackaged
? [
join(process.resourcesPath, 'bin', BIN_NAME),
join(appPath.replace('app.asar', 'app.asar.unpacked'), 'bin', BIN_NAME)
]
: [
join(appPath, 'bin', BIN_NAME),
join(process.cwd(), 'bin', BIN_NAME),
join(appPath, '..', 'relayfile', 'dist', 'relayfile-mount-' + archSuffix() + (process.platform === 'win32' ? '.exe' : '')),
join(process.cwd(), '..', 'relayfile', 'dist', 'relayfile-mount-' + archSuffix() + (process.platform === 'win32' ? '.exe' : ''))
])
]|
ℹ️ pr-reviewer: review only — no file changes were applied to the PR (nothing to commit after review). The notes below are advisory and were not pushed. pr-reviewer could not complete review for #184 in AgentWorkforce/pear. |
|
pr-reviewer could not complete review for #184 in AgentWorkforce/pear. |
1 similar comment
|
pr-reviewer could not complete review for #184 in AgentWorkforce/pear. |
|
ℹ️ pr-reviewer: review only — no file changes were applied to the PR (nothing to commit after review). The notes below are advisory and were not pushed. pr-reviewer could not complete review for #184 in AgentWorkforce/pear. |
|
pr-reviewer could not complete review for #184 in AgentWorkforce/pear. |
|
ℹ️ pr-reviewer: review only — no file changes were applied to the PR (nothing to commit after review). The notes below are advisory and were not pushed. pr-reviewer could not complete review for #184 in AgentWorkforce/pear. |
|
pr-reviewer could not complete review for #184 in AgentWorkforce/pear. |
|
ℹ️ pr-reviewer: review only — no file changes were applied to the PR (nothing to commit after review). The notes below are advisory and were not pushed. pr-reviewer could not complete review for #184 in AgentWorkforce/pear. |
…ount-optional-dep (#190) @relayfile/sdk@0.8.20 declares the @relayfile/mount-{darwin,linux}-{arm64,x64}@0.8.20 optional deps, so relocking pulls the platform mount binary as an npm optional package (no postinstall download) — activating the #184 launcher resolution (relayfile-mount-launcher.ts). All four mount-*@0.8.20 verified published on npm. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Summary
Changes how the
relayfile-mountbinary is acquired: instead of apostinstalldownload, it now resolves from the@relayfile/mount-*optional dependency of@relayfile/sdk(activates once the SDK + platformmount-*packages are published), with the bundledbin/relayfile-mount/ adjacent dist as fallback.package.json: drop the postinstall mount downloadrelayfile-mount-launcher.ts(+ test): resolve the binary from the optional@relayfile/mount-*package, fall back to the bundled binaryelectron-builder.yml: package the resolved binaryNotes
@relayfile/mount-*packages are published, a freshnpm imay not provide the optional binary — the bundledbin/relayfile-mountfallback covers local/dev. Integration remote reads (SDKjoinWorkspace) do not depend on the local mount binary.🤖 Generated with Claude Code