Skip to content

Standalone binary and dependency diet: --splitting, Node-only provider registration, webfetch DOM swap, jiti/codemode single-ship, dependency hygiene #1656

Description

@code-yeongyu

Summary

Track one release-oriented dependency-diet effort for standalone binaries and the published package.

Reproduction

Build the standalone binaries and inspect their entry graphs and published tarball. Exercise Bedrock, Cursor-agent, and Devin-agent from an embedded dist/cli.js consumer, and exercise webfetch and codemode in a compiled binary.

Expected

Standalone builds avoid duplicating the shared RPC session-worker graph, provider modules resolve when first used in every isolate, webfetch uses a compile-safe lightweight DOM, jiti and codemode are shipped once, and release artifacts omit unnecessary sourcemaps and unused dependencies.

Actual

Compiled standalone binaries bundle each entry point separately, so the RPC session worker duplicates approximately 21 MiB of the main graph. Bedrock/Cursor-agent/Devin-agent use variable-specifier lazy imports while only the senpi binary's own startup registers static overrides, so consumers embedding dist/cli.js can get Cannot find module at first provider use; Devin has no override setter. Webfetch pulls jsdom plus css-tree, approximately 8 MiB of a 21 MiB entry bundle, and css-tree needs compile-time patching inside $bunfs. jiti is statically imported in compiled binaries. Codemode ships twice (bundled factory plus on-disk sidecar). The published package includes 19 MiB of dist/**/*.map.

Evidence

Bun documentation states that multiple entrypoints are bundled separately; --splitting is supported with --compile and was verified with the production SessionWorkerClient. The startup-only static override is in src/bun/runtime-setup.ts. The dependency audit found exact-pinned packages behind: @anthropic-ai/sdk 0.125.0, claude-agent-sdk 0.3.270, bedrock 3.1131.0, @google/genai 2.22.0, @bufbuild/protobuf 2.15.0, typebox 1.3.30, and zod 4.6.4; glob, @opentelemetry/api, and canvas are unused.

Root cause

The release build treats entrypoints and runtime/provider registration as binary-local concerns, while several providers and runtime assets are discovered through variable-specifier imports. Heavy DOM and runtime tooling remains in the default graph, and packaging does not consistently enforce single-shipping or sourcemap exclusion.

Scope + acceptance criteria

Deliver the senpi todos 2-8 outcomes:

  • --splitting is enabled in the release script and build:binary, with CI on Bun 1.4.2.
  • @code-yeongyu/senpi/bun-runtime exports registerBunRuntimeModules with per-isolate registration.
  • Replace jsdom with linkedom and add 12 golden fixtures.
  • Add a native Bun extension importer.
  • Ship codemode once.
  • Complete the dependency-hygiene batch and exclude sourcemaps.
  • Publish the resulting version.

Related

Prior art and adjacent work: PRs #1499, #1038, #1540, #1053, #1049, #818, #1283, #1426, #1165, #1164, #643, #1108, #850, #860, and #64; issues #923, #1639, #1290, #854, #1422, #1603, #1604, and #1615. These are related or same-root-cause prior items, not replacements for this release tracker.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions