Skip to content

[Phase 0] @agentskit/core contains fs/promises import that breaks browser consumers #281

@EmersonBraun

Description

@EmersonBraun

Problem

packages/core/src/config.ts (the loadTsConfig helper) contains:

const mod = await import(path)

with fs/promises in the module graph. When @agentskit/core is consumed from a browser context (Vite/Next.js/etc.), the bundler correctly externalizes fs/promises but the dynamic import still runs at module load, crashing:

Module "fs/promises" has been externalized for browser compatibility. Cannot access "fs/promises.readFile" in client code.

This reproducibly breaks apps/example-react and apps/example-multi-agent at runtime — the root <div id="root"> never mounts.

Impact

  • Any browser-side consumer of @agentskit/core crashes on import
  • E2E Playwright tests for the two browser example apps cannot run (tracked in [P0.40] E2E Playwright on 4 apps/example-* #251)
  • Manifesto principle 1 ('core works in any environment — Node, Deno, edge, browser') is violated

Fix

Move loadTsConfig out of @agentskit/core into @agentskit/cli (or any non-core package). The core must not reach for Node builtins.

Priority

P0 for the Phase 0 launch — core browser-compat must be restored before public release.

Workaround

The two browser E2E tests in tests/e2e/example-react.spec.ts and tests/e2e/example-multi-agent.spec.ts are test.skip()-ed with a link to this issue until the core fix lands.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingphase-0-foundationPhase 0 - Foundation Hardeningpriority-p0P0 Critical - do now

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions