Skip to content

v0.6.0: type-only symbols re-exported as runtime values break Bun/strict-ESM consumers #25

@michaelbello-fw

Description

@michaelbello-fw

Summary

@lov3kaizen/agentsea-core@0.6.0 re-exports type-only symbols from @lov3kaizen/agentsea-types as runtime values. Under Bun's strict ESM loader this crashes at import time before any user code runs.

Repro

mkdir /tmp/agentsea-repro && cd /tmp/agentsea-repro
bun init -y
bun add @lov3kaizen/agentsea-core
cat > test.ts <<'TS'
import { Agent } from "@lov3kaizen/agentsea-core";
console.log(typeof Agent);
TS
bun test.ts

Actual

SyntaxError: export 'STTConfig' not found in '@lov3kaizen/agentsea-types'
    at loadAndEvaluateModule (2:1)

Reproducible with Bun 1.3.12 on macOS arm64. Any top-level import from the package fails — there is no workaround short of patching the built dist/index.mjs.

Root cause

dist/index.mjs around line 5743–5751 contains:

import {
  STTConfig,
  STTProvider,
  STTResult,
  TTSConfig,
  // …
} from \"@lov3kaizen/agentsea-types\";

These are declared in agentsea-types as interface / type only — they do not exist as runtime exports. Node is lenient about missing named imports (emits a warning in some modes), but Bun treats them as hard errors. TypeScript's bundler likely emitted a import { X } instead of import type { X } because verbatimModuleSyntax is off.

Suggested fix

In the agentsea-core build, set \"verbatimModuleSyntax\": true in tsconfig.json (or isolatedModules: true with importsNotUsedAsValues: \"error\"), then audit the imports in src/index.ts (or wherever the re-export barrel lives) and mark type-only imports/exports with the type keyword:

- import { STTConfig, STTProvider, STTResult, TTSConfig, ... } from \"@lov3kaizen/agentsea-types\";
+ import type { STTConfig, STTProvider, STTResult, TTSConfig, ... } from \"@lov3kaizen/agentsea-types\";

and equivalently on the re-export:

- export { STTConfig, ... };
+ export type { STTConfig, ... };

Impact

This blocks every Bun-based consumer — including agent-mesh runtimes that the plan calls out agentsea-core for. It also likely surfaces on Deno and on Node in --experimental-vm-modules strict mode.

Happy to send a PR if the repo is set up for external contributions.

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