fix(deps): move CLI provider adapters + ffmpeg-static to optionalDependencies#131
Open
AtelyPham wants to merge 1 commit into
Open
fix(deps): move CLI provider adapters + ffmpeg-static to optionalDependencies#131AtelyPham wants to merge 1 commit into
AtelyPham wants to merge 1 commit into
Conversation
…ndencies The codex-cli / claude-code provider adapters and ffmpeg-static pull ~300 MB of platform-native binaries (@openai/codex, @anthropic-ai/claude-agent-sdk ripgrep, static ffmpeg) that the default --provider openai path never uses. Declaring them optionalDependencies lets slim consumers (e.g. sandbox runtime images) install with `npm install --omit=optional` instead of a post-install rm. Default installs are unchanged — optional deps still install by default. Route the five dynamic provider imports (brain/model-client.ts, supervisor/ critic.ts) through loadOptionalModule(), which maps a missing optional module to an actionable "reinstall without --omit=optional" error instead of a raw ERR_MODULE_NOT_FOUND. The keyless default resolves to claude-code, so a bare `bad run` on a lean install now explains itself.
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
Move the CLI-backed provider adapters and
ffmpeg-staticfromdependenciestooptionalDependencies, and make a missing optional dependency degrade with an actionable error instead of a rawERR_MODULE_NOT_FOUND.Why
@tangle-network/browser-agent-driverbundles ~300 MB of platform-native binaries that most consumers never use on the default--provider openaipath:ai-sdk-provider-codex-cli@openai/codex(Codex CLI binary)ai-sdk-provider-claude-code@anthropic-ai/claude-agent-sdk(ripgrep ×5 platforms)ffmpeg-staticbad showcase)Slim sandbox runtime images (e.g.
agent-thin, which only ever runs--provider openai) want to drop these. Today the only way is a post-installrm -rfin the image build (see agent-dev-container #3369). Declaring themoptionalDependencieslets those consumers use the standardnpm install --omit=optionalinstead.Change
optionalDependencies. Default installs are unchanged — optional dependencies still install by default, so the full provider + showcase surface works out of the box.import()sites for the two providers (brain/model-client.ts,supervisor/critic.ts) now go throughloadOptionalModule(), which maps a missing module to a clear message: "The 'codex-cli' provider requires the optional package "…", which is not installed. Reinstall … without--omit=optional… or use --provider openai." This matters because the keyless default resolves toclaude-code; on an--omit=optionalinstall a barebad run <url>now explains itself instead of crashing with a module-resolution stack trace.ffmpeg-staticalready degrades gracefully (lazyrequirein try/catch → system ffmpeg → skip video), and thepostinstallprovider-patch step alreadyfs.existsSync-guards the patched file, so--omit=optionalnever breaks install.Tests
tests/optional-dependency.test.tscoversloadOptionalModule: resolves a present module, mapsERR_MODULE_NOT_FOUNDto the actionable message, and passes unrelated errors through.Notes
patch. No API/CLI surface change; default install footprint is identical.rmtonpm install --omit=optionalonce this releases.