SIGN IN SIGN UP

fix(deepagents): add browser and node entrypoints (#574)

## Summary

Fixes #292, #543

This updates `deepagents` packaging to split environment-specific
exports and avoid browser build failures caused by Node-only imports in
the default bundle. Browser consumers now have an explicit
`deepagents/browser` entrypoint, while Node consumers can keep using
`deepagents` (or optionally `deepagents/node`) for the full runtime API.

## Changes

### `deepagents` package exports and entrypoints

- Added `src/browser.ts` as a browser-safe public barrel that excludes
Node-only APIs.
- Added `src/node.ts` as an explicit Node entrypoint that re-exports the
full API.
- Updated `package.json` exports to:
  - route the root `browser` condition to `./dist/browser.js`
  - expose `./browser` and `./node` subpath exports (ESM + CJS + types).
- Updated `tsdown` config to build `index`, `browser`, and `node`
outputs.

### Runtime import graph hardening

- Updated `createDeepAgent` to import `StateBackend` directly from
`backends/state` so it no longer pulls in the full Node-oriented
backends barrel.
- Updated `types.ts` to import `AnyBackendProtocol` from
`backends/protocol` instead of `backends/index`.
- Removed named Node builtin path imports from `backends/utils.ts` by
replacing `path.basename`/`path.extname` with local helpers.

### Documentation and release notes

- Added a README section documenting import guidance: browser apps
should use `deepagents/browser`, and Node apps can continue to use
`deepagents`.
- Added a patch changeset for `deepagents` describing the entrypoint and
packaging fix.
H
Hunter Lovell committed
84f3c0c2f1cad271191bcc138b84ba5b9c9205c9
Parent: 03df237
Committed by GitHub <noreply@github.com> on 6/2/2026, 5:32:55 PM