feat: add ./browser export — supported browser-safe generation boundary (0.3.2) - #55
Merged
Conversation
…dary (0.3.2) The package index (`.`) re-exports the whole library, including the Node-only provider adapters (@anthropic-ai/sdk, undici via Ollama) and eval/serve helpers (node:fs/path), so it cannot be bundled for the browser. Consumers running the pipeline in a browser/edge host (e.g. dspack-studio's hosted Composer) were left deep-importing dist/run/orchestrator.js by path — a brittle dependency on the build layout that bypasses the exports map. `./browser` is the supported boundary: it exposes exactly what an in-browser host needs to RUN the governed pipeline — runPipeline + the deterministic ScriptedAdapter — and nothing else. The host brings its own adapter for real providers (the pipeline is provider-agnostic, ADR-9). The reachable subgraph is browser-safe except node:crypto in the audit report's provenance hash, which the host aliases to a synchronous SHA-256 shim. Verified: the transitive static-import graph from dist/browser.js reaches only `node:crypto` (no undici, no @anthropic-ai/sdk, no node:fs/path, no eval/serve). All 138 tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR adds a dedicated ./browser export surface so browser/edge consumers can import a supported, browser-safe entrypoint (instead of deep-importing internal dist/* files), while keeping the package root free to continue exporting Node-only utilities and provider adapters.
Changes:
- Added
src/browser.tsto re-export onlyrunPipelineand the deterministicScriptedAdapter(plus related types). - Exposed the new
./browsersubpath inpackage.jsonexports and bumped the package version to0.3.2.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/browser.ts | New browser-safe entrypoint that re-exports the minimal runtime surface (pipeline runner + scripted adapter). |
| package.json | Adds ./browser to the package export map and bumps version to 0.3.2. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Adds a
./browsersubpath exporting exactlyrunPipeline+ScriptedAdapter, so in-browser/edge hosts (dspack-studio's hosted Composer) import a supported package boundary instead of deep-importingdist/run/orchestrator.jsby path.The package root re-exports the Node-only provider adapters (
@anthropic-ai/sdk,undici) and eval/serve helpers (node:fs/path), so it can't bundle for the browser../browserexposes only what's needed to RUN the pipeline; the host brings its own adapter for real providers (provider-agnostic, ADR-9).Verified: the transitive static-import graph from
dist/browser.jsreaches onlynode:crypto(the audit provenance hash, which the host shims) — no undici, no anthropic SDK, nonode:fs/eval. 138 tests pass.🤖 Generated with Claude Code