Skip to content

fix: avoid importing non-exported ai/dist#1541

Open
kr1shna-exe wants to merge 1 commit intobrowserbase:mainfrom
kr1shna-exe:fix-tsc-types-check
Open

fix: avoid importing non-exported ai/dist#1541
kr1shna-exe wants to merge 1 commit intobrowserbase:mainfrom
kr1shna-exe:fix-tsc-types-check

Conversation

@kr1shna-exe
Copy link

@kr1shna-exe kr1shna-exe commented Jan 14, 2026

Why

Under moduleResolution: "NodeNext" with full type checking enabled, the build fails because the code attempts to import ai/dist, which is not exposed via the ai package exports field.

This import is tolerated under less strict module resolution settings, but NodeNext rejects it due to it's strict nature.

What changed

Updated the import to reference the public ai entry point instead of the non-exported ai/dist path, aligning the code with the package’s declared exports.

Test plan

  • Ran tsc --noEmit with moduleResolution: "NodeNext"
  • Verified that strict type checking passes without errors

Fixes #1531


Summary by cubic

Switched ToolSet import from "ai/dist" to the public "ai" entry to comply with package exports and NodeNext strict resolution, fixing TypeScript type-check failures.
Build now passes with moduleResolution: "NodeNext" and strict type checking.

Written for commit b1ff6fe. Summary will update on new commits.

@changeset-bot
Copy link

changeset-bot bot commented Jan 14, 2026

⚠️ No Changeset found

Latest commit: b1ff6fe

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 14, 2026

Greptile Summary

Changed the import statement from ai/dist to ai to fix TypeScript compilation failures under NodeNext module resolution. The ai package's exports field only exposes the main entry point, not the internal dist directory, causing strict type checking to reject the previous import path.

Key Changes:

  • Updated ToolSet import to use the public ai entry point
  • Aligns with custom instruction rule 08cb1f73-802a-4353-ab6e-9ec169000325 requiring top-level imports for non-optional dependencies
  • Matches existing import patterns throughout the codebase (all other files use from "ai")
  • Fixes issue Failed tsc types with full check #1531 reported with NodeNext strict type checking

Confidence Score: 5/5

  • This PR is completely safe to merge with zero risk
  • This is a trivial one-line fix that changes an incorrect import path to the correct one. The change has been tested with strict TypeScript checking, aligns with package exports standards, matches existing codebase patterns, and follows project custom instructions for top-level imports
  • No files require special attention

Important Files Changed

Filename Overview
packages/core/lib/v3/agent/AgentProvider.ts Fixed import to use public ai entry point instead of non-exported ai/dist, aligning with NodeNext module resolution requirements

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant TS as TypeScript Compiler
    participant AI as ai Package
    participant AP as AgentProvider
    
    Note over Dev,AP: Before: import from ai/dist
    Dev->>TS: Build with NodeNext resolution
    TS->>AI: Resolve ai/dist
    AI-->>TS: ❌ Not in exports field
    TS-->>Dev: Type check fails
    
    Note over Dev,AP: After: import from ai
    Dev->>TS: Build with NodeNext resolution
    TS->>AI: Resolve ai
    AI-->>TS: ✅ Found in exports field
    TS->>AP: Load ToolSet type
    AP-->>TS: ✅ Type available
    TS-->>Dev: Build succeeds
Loading

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 14, 2026

Greptile found no issues!

From now on, if a review finishes and we haven't found any issues, we will not post anything, but you can confirm that we reviewed your changes in the status check section.

This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR".

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed tsc types with full check

1 participant