Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

feat(ts): drop CommonJS support (#3494)

Alberto Schiabel025a657597c6
diff --git a/.changeset/drop-commonjs-entrypoints.md b/.changeset/drop-commonjs-entrypoints.md
new file mode 100644
index 000000000..347f05ef4
--- /dev/null
+++ b/.changeset/drop-commonjs-entrypoints.md
@@ -0,0 +1,20 @@
+---
+'@composio/core': minor
+'@composio/json-schema-to-zod': minor
+'@composio/ts-builders': minor
+'@composio/cli': minor
+'@composio/cli-keyring': minor
+'@composio/cli-local-tools': minor
+'@composio/anthropic': minor
+'@composio/claude-agent-sdk': minor
+'@composio/cloudflare': minor
+'@composio/google': minor
+'@composio/langchain': minor
+'@composio/llamaindex': minor
+'@composio/mastra': minor
+'@composio/openai': minor
+'@composio/openai-agents': minor
+'@composio/vercel': minor
+---
+
+Drop CommonJS entrypoints and publish the TypeScript SDK packages as ESM-only packages. This is a breaking change within the existing 0.x release line: consumers must use Node.js 22.22.3 or newer. CommonJS callers can only rely on Node's native `require(esm)` interop, and the SDK no longer ships custom CommonJS compatibility machinery or `.cjs` artifacts.
diff --git a/.github/workflows/ts.release.yml b/.github/workflows/ts.release.yml
index 4586093c9..e74ed2e2b 100644
--- a/.github/workflows/ts.release.yml
+++ b/.github/workflows/ts.release.yml
@@ -34,9 +34,9 @@ jobs:
- name: Setup Node.js, pnpm, Bun
uses: ./.github/actions/setup-node-pnpm-bun
with:
- # TODO: Once https://github.com/ComposioHQ/composio/pull/3494 lands,
- # centralize this trusted-publishing runtime in mise.toml and drop
- # the release-only override.
+ # Pin Node.js 24 for the release job only: the npm it bundles supports
+ # OIDC trusted publishing, which the toolchain's Node 22 (mise.toml)
+ # does not. Intentionally a release-only override, not centralized.
node-version: '24.17.0'
- name: Install Dependencies
diff --git a/.github/workflows/ts.test-e2e.yml b/.github/workflows/ts.test-e2e.yml
index 3597edc45..eb91a6045 100644
--- a/.github/workflows/ts.test-e2e.yml
+++ b/.github/workflows/ts.test-e2e.yml
@@ -39,7 +39,7 @@ jobs:
echo "deno=$(jq -c '.deno' toolchain-versions.json)" >> "$GITHUB_OUTPUT"
# Node.js E2E tests, running in Docker to isolate environment
- # Each test suite defines its own nodeVersions in e2e.test.ts
+ # Each test suite defines its own versions.node in e2e.test.ts
# Tests that don't support the matrix version are automatically skipped
test-e2e-node-docker:
name: E2E Test Node.js ${{ matrix.node-version }}
@@ -82,7 +82,6 @@ jobs:
run: |
docker build -f ts/e2e-tests/_utils/Dockerfile.node \
--build-arg NODE_VERSION=${{ matrix.node-version }} \
- --build-arg BUN_VERSION=${{ steps.setup-toolchain.outputs.bun-version }} \
--label composio.e2e=true \
--label composio.runtime=node \
--label "composio.node_version=${{ matrix.node-version }}" \
@@ -179,7 +178,6 @@ jobs:
docker build -f ts/e2e-tests/_utils/Dockerfile.cli \
--build-arg CLI_VERSION="${CLI_VERSION}" \
--build-arg NODE_VERSION="${{ steps.setup-toolchain.outputs.node-version }}" \
- --build-arg BUN_VERSION="${{ steps.setup-toolchain.outputs.bun-version }}" \
--label composio.e2e=true \
--label composio.runtime=cli \
--label "composio.cli_version=${CLI_VERSION}" \
diff --git a/AGENTS.md b/AGENTS.md
index 2e05e917a..ae4c8570c 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -28,8 +28,7 @@ pnpm test # Run tests
### Package Management
```bash
-mise install # Install Node, Bun, Deno, Python, uv (one-time; needs mise — https://mise.jdx.dev/installing-mise.html)
-corepack enable # Activate pnpm from package.json#packageManager
+mise install # Install Node, Bun, Deno, pnpm, Python, uv (one-time; needs mise — https://mise.jdx.dev/installing-mise.html)
pnpm install # Install dependencies
pnpm check:peer-deps # Check peer dependencies
pnpm update:peer-deps # Update peer dependencies
@@ -115,7 +114,7 @@ composio/
```bash
pnpm test:e2e # All (Node.js + Deno + Cloudflare)
-pnpm test:e2e:node # Node.js CJS/ESM compatibility (Docker)
+pnpm test:e2e:node # Node.js ESM and require(esm) interop (Docker)
pnpm test:e2e:deno # Deno npm: specifier compatibility (Docker)
pnpm test:e2e:cloudflare # Cloudflare Workers
```
@@ -227,9 +226,9 @@ Toolchain versions are coalesced in `mise.toml`. To check the current values:
- **Deno**: `mise current deno`
- **Python**: `mise current python`
- **uv**: `mise current uv`
-- **pnpm**: `node -p "require('./package.json').packageManager"`
+- **pnpm**: `mise current npm:pnpm`
-To bump, edit `mise.toml` (or `package.json#packageManager` for pnpm), then run:
+To bump, edit `mise.toml`, then run:
```bash
mise lock --platform linux-x64,linux-arm64,macos-arm64,macos-x64
diff --git a/CLAUDE.md b/CLAUDE.md
index 91bfe21d2..e9e5aee81 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -29,8 +29,7 @@ composio/
## TypeScript Commands
```bash
-mise install # Installs Node, Bun, Deno, Python, uv from mise.toml (one-time per machine)
-corepack enable # Activates pnpm pinned in package.json#packageManager
+mise install # Installs Node, Bun, Deno, pnpm, Python, uv from mise.toml (one-time per machine)
pnpm install # First-time setup
pnpm build # Build all packages (Turbo)
pnpm build:packages # TS packages only
@@ -38,8 +37,8 @@ pnpm lint / lint:fix
pnpm format
pnpm typecheck # MANDATORY before pushing CLI changes
pnpm test # Vitest, all packages
-pnpm test:e2e # All runtimes (Node CJS+ESM, Deno, Cloudflare Workers) via Docker
-pnpm test:e2e:node # Override with COMPOSIO_E2E_NODE_VERSION=22.12.0
+pnpm test:e2e # All runtimes (Node ESM + require(esm), Deno, Cloudflare Workers) via Docker
+pnpm test:e2e:node # Override with COMPOSIO_E2E_NODE_VERSION=22.22.3
pnpm test:e2e:deno # Override with COMPOSIO_E2E_DENO_VERSION=2.6.7
pnpm test:e2e:cloudflare
pnpm changeset # Create release changeset (required for stable CLI/SDK releases)
@@ -47,7 +46,7 @@ pnpm create:provider <name> [--agentic]
pnpm create:example <name>
```
-Toolchain versions are pinned in `mise.toml` (Node, Bun, Deno, Python, uv) and `package.json#packageManager` (pnpm via corepack). Install mise once with `brew install mise` (macOS), `winget install jdx.mise` (Windows), or `curl https://mise.run | sh` (any), then activate it in your shell — see https://mise.jdx.dev/installing-mise.html. CI can set `BYPASS_TOOLCHAIN_CHECK=1` only when using prebuilt toolchain images.
+Toolchain versions are pinned in `mise.toml` (Node, Bun, Deno, pnpm, Python, uv). Install mise once with `brew install mise` (macOS), `winget install jdx.mise` (Windows), or `curl https://mise.run | sh` (any), then activate it in your shell — see https://mise.jdx.dev/installing-mise.html. CI can set `BYPASS_TOOLCHAIN_CHECK=1` only when using prebuilt toolchain images.
## Python Commands
@@ -89,7 +88,7 @@ COMPOSIO_DISABLE_TELEMETRY # "true" to disable
- Core Composio class: `ts/packages/core/src/composio.ts`
- Types: `ts/packages/core/src/types/`, errors: `ts/packages/core/src/errors/`
- Build configs: `turbo.jsonc`, `tsconfig.base.json`, `tsdown.config.base.ts`
-- Toolchain pins: `mise.toml` (Node, Bun, Deno, Python, uv), `mise.lock`, `toolchain-versions.json` (test matrices), `package.json#packageManager` (pnpm)
+- Toolchain pins: `mise.toml` (Node, Bun, Deno, pnpm, Python, uv), `mise.lock`, `toolchain-versions.json` (test matrices)
- CI release docs to update when bumping toolchain: `ts/docs/internal/release.md`
- Python config: `python/Makefile`, `python/noxfile.py`, `python/config/{pytest.ini,ruff.toml}`
diff --git a/mise.lock b/mise.lock
index 70f36d889..8edf0fd9c 100644
--- a/mise.lock
+++ b/mise.lock
@@ -61,24 +61,24 @@ checksum = "sha256:fae025e69cada67fb57affdda26abbe72991b02b515c3221e92c58aa8a642
url = "https://dl.deno.land/release/v2.6.7/deno-x86_64-apple-darwin.zip"
[[tools.node]]
-version = "20.20.2"
+version = "22.22.3"
backend = "core:node"
[tools.node."platforms.linux-arm64"]
-checksum = "sha256:47ef73d543ecf6eb19435f6c03a0ac4809b3bf0dd6b26c7c571efc2a6572a74d"
-url = "https://nodejs.org/dist/v20.20.2/node-v20.20.2-linux-arm64.tar.gz"
+checksum = "sha256:cc8bc82b2dd0b595c3b95a4c3c9c8c350907cff011afbdee3d1379e812e1e3e3"
+url = "https://nodejs.org/dist/v22.22.3/node-v22.22.3-linux-arm64.tar.gz"
[tools.node."platforms.linux-x64"]
-checksum = "sha256:19e56f0825510207dd904f087fe52faa0a4eb6b2aab5f0ea7a33830d04888b8b"
-url = "https://nodejs.org/dist/v20.20.2/node-v20.20.2-linux-x64.tar.gz"
+checksum = "sha256:c7a10d6816da8eaaa7534dd73c71c6e2b2c391dbbf845e364902d156615dd1b8"
+url = "https://nodejs.org/dist/v22.22.3/node-v22.22.3-linux-x64.tar.gz"
[tools.node."platforms.macos-arm64"]
-checksum = "sha256:466e05f3477c20dfb723054dfebffe55bc74660ee77f612166fca121dacb65b6"
-url = "https://nodejs.org/dist/v20.20.2/node-v20.20.2-darwin-arm64.tar.gz"
+checksum = "sha256:0da7ff74ef8611328c8212f17943368713a2ad953fb7d89a8c8a0eae87c23207"
+url = "https://nodejs.org/dist/v22.22.3/node-v22.22.3-darwin-arm64.tar.gz"
[tools.node."platforms.macos-x64"]
-checksum = "sha256:8be6f5e4bb128c82774f8a0b8d7a1cc1365a7977d9657cece0ca647b3fe04e61"
-url = "https://nodejs.org/dist/v20.20.2/node-v20.20.2-darwin-x64.tar.gz"
+checksum = "sha256:45830ba752fa0d892c6dcd640946669801293cac820a33591ded40ac075198ec"
+url = "https://nodejs.org/dist/v22.22.3/node-v22.22.3-darwin-x64.tar.gz"
[[tools."npm:pnpm"]]
version = "10.28.2"
diff --git a/mise.toml b/mise.toml
index fc4cc85bf..12c531a3c 100644
--- a/mise.toml
+++ b/mise.toml
@@ -4,12 +4,13 @@
# CI: driven by `jdx/mise-action` in the composite actions under `.github/actions/`
#
# pnpm is pinned through mise's npm backend so mise owns the full local and CI
-# toolchain. CI cannot assume Corepack has created a pnpm shim before caching.
+# toolchain. We do not rely on Corepack because Node.js no longer distributes it
+# starting with v25.
min_version = "2026.1.0"
[tools]
-node = "20.20.2"
+node = "22.22.3"
bun = "1.3.10"
deno = "2.6.7"
python = "3.12"
diff --git a/package.json b/package.json
index a2ca9b928..e42305098 100644
--- a/package.json
+++ b/package.json
@@ -52,16 +52,10 @@
"clean": "git clean -xdf .turbo node_modules ts/packages/**/.turbo ts/packages/**/node_modules ts/packages/**/dist",
"clean:workspace": "pnpm turbo clean"
},
- "packageManager": "[email protected]",
"devEngines": {
"runtime": {
"name": "node",
- "version": "20.20.2",
- "onFail": "warn"
- },
- "packageManager": {
- "name": "pnpm",
- "version": "10.28.2",
+ "version": "22.22.3",
"onFail": "warn"
}
},
diff --git a/plans/feat-init-project-environment-detection.md b/plans/feat-init-project-environment-detection.md
deleted file mode 100644
index b31e3c7e5..000000000
--- a/plans/feat-init-project-environment-detection.md
+++ /dev/null
@@ -1,619 +0,0 @@
-# feat: Add project environment detection and dependency installation to `composio init`
-
-## Overview
-
-Enhance `composio init` to automatically detect the project environment (TypeScript/Python, package manager, monorepo vs single-package) and install Composio's SDK dependencies using the correct package manager command. This replaces the existing `EnvLangDetector` + `JsPackageManagerDetector` services with a unified `ProjectEnvironmentDetector` service that produces richer detection results, and adds a `CommandRunner` service for running install commands in tests.
-
-## Problem Statement / Motivation
-
-Currently, `composio init` writes config files but does **not**:
-- Detect what kind of project the user is working in
-- Install Composio SDK packages (`@composio/core` for TS, `composio` for Python)
-- Install framework-specific provider packages (`@composio/mastra`, `@composio/openai`, etc.)
-
-Users must manually figure out which packages to install and run the correct package manager command. This is error-prone, especially in monorepos where the package manager may differ from what the user expects.
-
-The `composio2` branch already has working implementations of `ProjectEnvironmentDetector`, `CommandRunner`, `core-dependency.ts`, and an `install.cmd.ts` with tests. This plan imports and adapts those implementations into the current `feat/cli-login-2.0` branch.
-
-## Proposed Solution
-
-### Architecture
-
-```mermaid
-graph TD
- A[composio init] --> B[Project Selection]
- B --> C[Init Wizard: usage mode + framework + skills]
- C --> D[ProjectEnvironmentDetector.detectProjectEnvironment]
- D --> E{Detected?}
- E -->|Yes| F[Show detection + confirm]
- E -->|Ambiguous| G[Prompt user to choose language]
- E -->|No indicators| H[Prompt user to choose language + PM]
- F --> I[resolveCoreDependencyState]
- G --> I
- H --> I
- I --> J{Already installed?}
- J -->|Yes, not --force| K[Skip install, log info]
- J -->|No or --force| L[Confirm install command]
- L --> M[CommandRunner.run with spinner]
- M --> N[Write config files]
- N --> O[Optionally install skills]
-```
-
-### Key Components
-
-1. **`ProjectEnvironmentDetector`** (new service) — replaces `EnvLangDetector` + `JsPackageManagerDetector` with a single service that:
- - Walks up the directory tree looking for project indicators
- - Produces a `ProjectEnvironment` discriminated union (`js` | `python`)
- - Includes `language`, `packageManager`, `rootDir`, and `evidence[]`
- - Handles ambiguity (both JS and Python indicators) with a tagged error
- - Supports Deno (`deno.json`, `deno.lock`) as a JS package manager
-
-2. **`CommandRunner`** (new service) — thin wrapper around `@effect/platform` `Command.exitCode` for testability. In production, it runs the actual command; in tests, it returns a configurable exit code.
-
-3. **`core-dependency.ts`** (new effect) — maps a `ProjectEnvironment` to a `CoreDependencyPlan` containing the install command string, dependency name, and package manager. Also detects if the dependency is already installed.
-
-4. **Updated `init.cmd.ts`** — integrates detection + installation into the wizard flow after project selection.
-
-## Technical Approach
-
-### Phase 1: New Services and Effects
-
-#### 1.1 Add `ProjectEnvironmentDetector` service
-
-**File:** `ts/packages/cli/src/services/project-environment-detector.ts`
-
-Import from: `/Users/jkomyno/work/composio/composio2/ts/packages/cli/src/services/project-environment-detector.ts`
-
-The reference implementation is 587 lines and provides:
-
-```typescript
-export type ProjectEnvironment =
- | { kind: 'js'; language: JsLanguage; packageManager: JsPackageManager; rootDir: string; evidence: string[] }
- | { kind: 'python'; language: 'python'; packageManager: PythonPackageManager; rootDir: string; evidence: string[] };
-
-export type JsLanguage = 'typescript' | 'javascript';
-export type JsPackageManager = 'pnpm' | 'bun' | 'yarn' | 'npm' | 'deno';
-export type PythonPackageManager = 'uv' | 'pip';
-```
-
-Key detection strategies:
-- **Strong JS indicators:** `package.json`, `tsconfig.json`, `pnpm-workspace.yaml`, lock files — each gets a high score
-- **Strong Python indicators:** `pyproject.toml`, `setup.py`, `requirements.txt`, `uv.lock`, `poetry.lock`
-- **Weak indicators:** file extension counts (`.ts`, `.py`), subdirectory scans
-- **Package manager from `package.json`:** reads `packageManager` field (e.g., `"[email protected]"`)
-- **Python package manager:** checks for `uv.lock` or `[tool.uv]` in `pyproject.toml`
-- **Ancestor walking:** walks up from CWD to filesystem root, checking each directory
-
-**Ambiguity handling:** If both JS and Python strong indicators exist at CWD depth 0, fails with `ProjectEnvironmentDetectorError`. At deeper levels, skips and continues searching.
-
-**Service pattern:** Uses `Effect.Service` class with `effect:` body and `dependencies: [BunFileSystem.layer]`.
-
-#### 1.2 Add `CommandRunner` service
-
-**File:** `ts/packages/cli/src/services/command-runner.ts`
-
-Import from: `/Users/jkomyno/work/composio/composio2/ts/packages/cli/src/services/command-runner.ts`
-
-```typescript
-import { Command } from '@effect/platform';
-import { Effect } from 'effect';
-
-export class CommandRunner extends Effect.Service<CommandRunner>()('services/CommandRunner', {
- sync: () => ({
- run: (command: Command.Command) => Command.exitCode(command),
- }),
- dependencies: [],
-}) {}
-```
-
-This is intentionally thin — the real value is in testability. In tests, we provide `Layer.succeed(CommandRunner, new CommandRunner({ run: () => Effect.succeed(ExitCode(0)) }))`.
-
-#### 1.3 Add `core-dependency.ts` effect
-
-**File:** `ts/packages/cli/src/effects/core-dependency.ts`
-
-Import from: `/Users/jkomyno/work/composio/composio2/ts/packages/cli/src/effects/core-dependency.ts`
-
-Key exports:
-- `CoreDependencyPlan` — discriminated union with `installCommand`, `dependency`, `packageManager`, `rootDir`
-- `detectCoreDependencyPlan(cwd)` — maps `ProjectEnvironment` → `CoreDependencyPlan`
-- `detectCoreDependencyVersion(plan)` — checks if `@composio/core` or `composio` is already installed
-- `resolveCoreDependencyState(cwd)` — combines plan + version check
-- `getJsInstallCommand(pm, dependency)` — maps package manager to install command
-- `getPythonInstallCommand(pm, dependency)` — same for Python
-
-Install command mapping:
-
-| PM | Command |
-|---|---|
-| pnpm | `pnpm add @composio/core` |
-| bun | `bun add @composio/core` |
-| yarn | `yarn add @composio/core` |
-| npm | `npm install -S @composio/core` |
-| deno | `deno add npm:@composio/core` |
-| uv | `uv pip install composio` |
-| pip | `pip install composio` |
-
-### Phase 2: Update `composio init` Command
-
-#### 2.1 Add new CLI flags
-
-```typescript
-const dryRunOpt = Options.boolean('dry-run').pipe(
- Options.withDefault(false),
- Options.withDescription('Print install command without executing it')
-);
-
-const forceOpt = Options.boolean('force').pipe(
- Options.withDefault(false),
- Options.withDescription('Reinstall even if dependency appears installed')
-);
-
-const yesOpt = Options.boolean('yes').pipe(
- Options.withAlias('y'),
- Options.withDefault(false),
- Options.withDescription('Skip confirmation prompts')
-);
-```
-
-#### 2.2 Extend `InitConfigBuilder` and `InitConfig`
-
-Add new builder steps and fields:
-
-```typescript
-interface InitConfig {
- readonly usageMode: UsageMode;
- readonly framework: NativeFramework | undefined;
- readonly installSkills: boolean;
- readonly detectedEnv: ProjectEnvironment; // NEW
- readonly installPlan: CoreDependencyPlan; // NEW
-}
-```
-
-Add `withDetectedEnv` and `withInstallPlan` methods to `InitConfigBuilder`, and update the `build()` type constraint.
-
-#### 2.3 Updated wizard flow
-
-After the existing wizard steps (usage mode → framework → skills), add:
-
-```typescript
-// Step 4: Detect project environment
-const envDetector = yield* ProjectEnvironmentDetector;
-const detectedEnv = yield* envDetector
- .detectProjectEnvironment(proc.cwd)
- .pipe(
- Effect.catchTag('services/ProjectEnvironmentDetectorError', e =>
- Effect.gen(function* () {
- yield* ui.log.warn(e.message);
- // Fallback: ask user to choose
- const lang = yield* ui.select('What language is your project?', [
- { value: 'typescript', label: 'TypeScript' },
- { value: 'python', label: 'Python' },
- ]);
- // ... prompt for package manager too
- })
- )
- );
-
-yield* ui.log.step(`Detected: ${detectedEnv.language} (${detectedEnv.packageManager})`);
-
-// Step 5: Check if already installed + determine install plan
-const { plan, installedVersion } = yield* resolveCoreDependencyState(proc.cwd);
-
-if (installedVersion && !forceOpt) {
- yield* ui.log.info(`Found ${plan.dependency}: ${installedVersion.version}`);
- yield* ui.log.success('Dependency already installed.');
-} else {
- // Step 6: Confirm and install
- if (dryRunOpt) {
- yield* ui.note(plan.installCommand, 'Install Command');
- } else {
- const shouldInstall = yesOpt || (yield* ui.confirm(`Run: ${plan.installCommand}?`));
- if (shouldInstall) {
- yield* ui.withSpinner(`Installing ${plan.dependency}...`, installEffect, {
- successMessage: `Installed ${plan.dependency}`,
- });
- }
- }
-}
-```
-
-#### 2.4 Framework provider installation
-
-When a framework is selected (not "skip"), also install the provider package:
-
-```typescript
-const frameworkPackage = getFrameworkPackage(config.framework, detectedEnv);
-// e.g., '@composio/mastra' for TS, 'composio[mastra]' for Python
-```
-
-| Framework | TS Package | Python Package |
-|---|---|---|
-| ai-sdk | `@composio/vercel` | `composio[vercel]` |
-| mastra | `@composio/mastra` | `composio[mastra]` |
-| openai-agents | `@composio/openai` | `composio[openai]` |
-| claude-agent-sdk | `@composio/anthropic` | `composio[anthropic]` |
-
-### Phase 3: Wire Services in Layer Composition
-
-#### 3.1 Update `bin.ts`
-
-Add to the layer composition:
-
-```typescript
-import { ProjectEnvironmentDetector } from 'src/services/project-environment-detector';
-import { CommandRunner } from 'src/services/command-runner';
-
-const layers = Layer.mergeAll(
- // ... existing layers ...
- ProjectEnvironmentDetector.Default, // NEW
- CommandRunner.Default, // NEW
-);
-```
-
-#### 3.2 Deprecate `EnvLangDetector` and `JsPackageManagerDetector`
-
-The new `ProjectEnvironmentDetector` subsumes both. However, `EnvLangDetector` is still used by `generate.cmd.ts`. Options:
-
-- **Option A (recommended):** Keep both old services for now, use `ProjectEnvironmentDetector` only in `init.cmd.ts`. Migrate `generate.cmd.ts` in a follow-up PR.
-- **Option B:** Replace both immediately and update `generate.cmd.ts` to use the new service.
-
-Go with **Option A** to keep this PR focused.
-
-### Phase 4: Testing (TDD)
-
-#### 4.1 Unit tests for `ProjectEnvironmentDetector`
-
-**File:** `ts/packages/cli/test/src/services/project-environment-detector.test.ts`
-
-Uses `tempy.temporaryDirectory()` to create isolated temp dirs with specific file layouts. Tests use `BunFileSystem.layer` (real filesystem).
-
-```
-describe('ProjectEnvironmentDetector', () => {
- describe('detectProjectEnvironment', () => {
- // TypeScript detection
- it('[Given] package.json + tsconfig.json [Then] detects typescript + npm')
- it('[Given] pnpm-lock.yaml + package.json with packageManager:pnpm@ [Then] detects typescript + pnpm')
- it('[Given] bun.lockb [Then] detects javascript + bun')
- it('[Given] deno.json [Then] detects typescript + deno')
- it('[Given] package.json with typescript dep [Then] detects typescript')
-
- // Python detection
- it('[Given] pyproject.toml with [tool.uv] [Then] detects python + uv')
- it('[Given] requirements.txt only [Then] detects python + pip')
- it('[Given] uv.lock [Then] detects python + uv')
- it('[Given] setup.py only [Then] detects python + pip')
-
- // Ambiguity
- it('[Given] both package.json + pyproject.toml at CWD [Then] fails with ambiguity error')
- it('[Given] both indicators but only at parent level [Then] skips and continues')
-
- // Ancestor walking
- it('[Given] indicators at parent directory [Then] detects from parent')
- it('[Given] no indicators anywhere [Then] fails with no-detection error')
-
- // File extension fallback
- it('[Given] only .ts files, no config files [Then] detects typescript via weak signals')
- it('[Given] only .py files, no config files [Then] detects python via weak signals')
-
- // Edge cases
- it('[Given] empty directory [Then] fails with no-detection error')
- it('[Given] monorepo root with pnpm-workspace.yaml [Then] detects pnpm')
- })
-
- describe('detectJsPackageManager', () => {
- it('[Given] packageManager field in package.json [Then] uses that')
- it('[Given] lock file present [Then] detects from lock file')
- it('[Given] no lock file, no packageManager field [Then] defaults to npm')
- })
-
- describe('detectPythonPackageManager', () => {
- it('[Given] uv.lock present [Then] detects uv')
- it('[Given] [tool.uv] in pyproject.toml [Then] detects uv')
- it('[Given] no uv indicators [Then] defaults to pip')
- })
-})
-```
-
-#### 4.2 Unit tests for `core-dependency.ts`
-
-**File:** `ts/packages/cli/test/src/effects/core-dependency.test.ts`
-
-```
-describe('core-dependency', () => {
- describe('getJsInstallCommand', () => {
- it('[Given] pnpm [Then] returns "pnpm add <dep>"')
- it('[Given] npm [Then] returns "npm install -S <dep>"')
- it('[Given] yarn [Then] returns "yarn add <dep>"')
- it('[Given] bun [Then] returns "bun add <dep>"')
- it('[Given] deno [Then] returns "deno add npm:<dep>"')
- })
-
- describe('getPythonInstallCommand', () => {
- it('[Given] uv [Then] returns "uv pip install <dep>"')
- it('[Given] pip [Then] returns "pip install <dep>"')
- })
-
- describe('detectCoreDependencyPlan', () => {
- it('[Given] TS project [Then] plans @composio/core install')
- it('[Given] Python project [Then] plans composio install')
- })
-
- describe('detectCoreDependencyVersion', () => {
- it('[Given] @composio/core in node_modules [Then] returns version')
- it('[Given] @composio/core in pnpm virtual store [Then] returns version')
- it('[Given] not installed [Then] returns null')
- })
-})
-```
-
-#### 4.3 Command tests for `composio init`
-
-**File:** `ts/packages/cli/test/src/commands/init.cmd.test.ts`
-
-Uses `TestLive` with fixtures and mocked services.
-
-```
-describe('CLI: composio init', () => {
- // Agent-native path (--org-id + --project-id)
- describe('[Given] --org-id + --project-id flags', () => {
- layer(TestLive({ fixture: 'typescript-project' }))(it => {
- it.scoped('[Then] detects TS project and shows install plan', () => ...)
- })
-
- layer(TestLive({ fixture: 'python-project' }))(it => {
- it.scoped('[Then] detects Python project and shows install plan', () => ...)
- })
- })
-
- // Dry-run mode
- describe('[Given] --dry-run flag', () => {
- layer(TestLive({ fixture: 'typescript-project' }))(it => {
- it.scoped('[Then] prints install command without executing', () => ...)
- })
- })
-
- // Already installed
- describe('[Given] @composio/core already in node_modules', () => {
- layer(TestLive({ fixture: 'typescript-project-with-composio-core' }))(it => {
- it.scoped('[Then] skips install', () => ...)
- })
- })
-
- // --force reinstall
- describe('[Given] --force flag with dependency installed', () => {
- layer(TestLive({ fixture: 'typescript-project-with-composio-core', commandRunner: successRunner }))(it => {
- it.scoped('[Then] reinstalls', () => ...)
- })
- })
-
- // Install failure
- describe('[Given] install command fails', () => {
- layer(TestLive({ fixture: 'typescript-project', commandRunner: failRunner }))(it => {
- it.scoped('[Then] shows error message', () => ...)
- })
- })
-})
-```
-
-#### 4.4 New test fixtures needed
-
-```
-test/__fixtures__/
- typescript-project/ # EXISTING: package.json + tsconfig.json
- python-project/ # EXISTING: requirements.txt + setup.py
- typescript-project-with-composio-core/ # EXISTING
- python-project-with-composio-core/ # EXISTING
- typescript-pnpm-monorepo/ # NEW: pnpm-workspace.yaml + package.json with packageManager:pnpm@
- typescript-bun-project/ # NEW: bun.lockb + package.json
- python-uv-project/ # NEW: pyproject.toml with [tool.uv] + uv.lock
- ambiguous-project/ # NEW: package.json + pyproject.toml (for error case)
-```
-
-#### 4.5 Test layer updates
-
-Update `TestLive` interface to accept optional overrides:
-
-```typescript
-interface TestLiveInput {
- // ... existing fields ...
- commandRunner?: CommandRunner; // NEW: mock for CommandRunner
- terminalUI?: TerminalUI; // NEW: override TerminalUI for custom prompt behavior
-}
-```
-
-Add `ProjectEnvironmentDetector.Default` and `CommandRunner.Default` (or mock) to the test layer composition.
-
-### Phase 5: E2E Tests
-
-#### 5.1 `composio init` deterministic E2E test
-
-**Directory:** `ts/e2e-tests/cli/init/`
-
-**Constraint:** E2E tests run inside Docker containers. The init command requires API access for project listing, which makes it hard to test end-to-end without mocking.
-
-**Deterministic test strategy:** Use `--org-id` + `--project-id` flags to bypass API calls. Pre-create a fixture project directory inside the Docker container.
-
-```typescript
-// ts/e2e-tests/cli/init/e2e.test.ts
-e2e(import.meta.url, {
- versions: { cli: ['current'] },
- defineTests: ({ runCmd }) => {
- describe('composio init --dry-run', () => {
- it('detects TypeScript project', async () => {
- // Create a minimal TS project in the container
- await runCmd('mkdir -p /tmp/test-ts && echo \'{"name":"test"}\' > /tmp/test-ts/package.json');
- await runCmd('echo \'{}\' > /tmp/test-ts/tsconfig.json');
-
- const result = await runCmd(
- 'cd /tmp/test-ts && composio init --org-id test-org --project-id test-proj --dry-run'
- );
-
- expect(result.exitCode).toBe(0);
- // In non-interactive (piped) mode, output() writes JSON to stdout
- expect(result.stdout).toContain('typescript');
- });
- });
-
- describe('composio init on Python project', () => {
- it('detects Python project', async () => {
- await runCmd('mkdir -p /tmp/test-py && echo "composio" > /tmp/test-py/requirements.txt');
-
- const result = await runCmd(
- 'cd /tmp/test-py && composio init --org-id test-org --project-id test-proj --dry-run'
- );
-
- expect(result.exitCode).toBe(0);
- expect(result.stdout).toContain('python');
- });
- });
- },
-});
-```
-
-**Note:** The init command's interactive prompts are automatically skipped in piped mode (TerminalUI returns defaults). The `--dry-run` flag prevents actual package installation.
-
-## Alternative Approaches Considered
-
-### A. Extend existing `EnvLangDetector` + `JsPackageManagerDetector`
-
-**Rejected because:** The existing services have separate interfaces that would need to be called independently and manually composed. The `ProjectEnvironmentDetector` provides a single, unified detection result with richer evidence tracking and proper ambiguity handling.
-
-### B. Separate `composio install` command
-
-**Reference:** The `composio2` branch already has a standalone `install.cmd.ts`.
-
-**Decision:** Both approaches have merit. The `composio init` command should include dependency installation as part of the initialization flow. A separate `composio install` command could be added later for re-installation or CI use. This plan focuses on integrating detection + installation into `init`.
-
-### C. Use `Effect.Service` class vs `Context.Tag` for new services
-
-**Decision:** Use `Effect.Service` class pattern (newer pattern) for consistency with `EnvLangDetector`, `JsPackageManagerDetector`, `NodeOs`, `NodeProcess`.
-
-## Acceptance Criteria
-
-### Functional Requirements
-
-- [ ] `composio init` detects TypeScript projects (from `tsconfig.json`, `package.json`, lock files)
-- [ ] `composio init` detects Python projects (from `pyproject.toml`, `setup.py`, `requirements.txt`)
-- [ ] `composio init` detects the correct package manager (pnpm, npm, yarn, bun, deno, uv, pip)
-- [ ] `composio init` walks up the directory tree to find project root (monorepo support)
-- [ ] `composio init` shows the detected environment and asks for confirmation before installing
-- [ ] `composio init` runs the correct install command (`pnpm add`, `npm install`, `uv pip install`, etc.)
-- [ ] `composio init --dry-run` prints the install command without executing
-- [ ] `composio init --force` reinstalls even if dependency is already present
-- [ ] `composio init --yes` skips confirmation prompts
-- [ ] `composio init` shows appropriate error messages when detection fails (ambiguous or empty project)
-- [ ] `composio init` gracefully handles install command failures
-- [ ] `composio init` skips installation when dependency is already installed (without `--force`)
-- [ ] `composio init` emits structured JSON to stdout when piped (agent-native)
-- [ ] `composio init` writes `detectedEnv` info to `.composio/config.json`
-
-### Non-Functional Requirements
-
-- [ ] `pnpm typecheck` passes from repo root
-- [ ] All existing tests continue to pass
-- [ ] Detection completes in < 500ms for typical projects (filesystem I/O only, no network)
-
-### Quality Gates
-
-- [ ] Unit tests for `ProjectEnvironmentDetector` covering all detection strategies
-- [ ] Unit tests for `core-dependency.ts` covering all package managers
-- [ ] Command tests for `composio init` covering happy path + error cases
-- [ ] At least one E2E test for `composio init --dry-run` in Docker container
-- [ ] New test fixtures for pnpm monorepo, bun project, uv project, ambiguous project
-
-## Success Metrics
-
-- Users can run `composio init` in any TypeScript or Python project and have dependencies installed automatically
-- Zero manual `npm install` / `pnpm add` / `uv pip install` steps needed after init
-- Package manager is correctly detected in monorepo setups (pnpm workspaces, etc.)
-
-## Dependencies & Prerequisites
-
-- `@effect/platform` `Command` module is already a dependency of the CLI package
-- The `composio2` reference implementations are available at `/Users/jkomyno/work/composio/composio2/ts/packages/cli/src/`
-- Test fixtures for `typescript-project` and `python-project` already exist
-
-## Risk Analysis & Mitigation
-
-| Risk | Impact | Mitigation |
-|---|---|---|
-| Ambiguous project detection (both TS + Python) | User confusion | Prompt user to choose, provide clear error message with evidence |
-| Install command fails (network, permissions) | Blocked init flow | Show error with the failing command, suggest manual install |
-| Package manager not installed on system | Install fails | Check binary existence before running, suggest install |
-| Monorepo: init from subdirectory | Wrong root dir detected | Ancestor walking already handles this; root dir = where lock file or package.json with workspaces lives |
-| Breaking existing `generate.cmd.ts` | Regression | Keep old services (Option A), migrate generate in follow-up PR |
-
-## Implementation Phases
-
-### Phase 1: Foundation (Services + Effects)
-- [x] Add `ProjectEnvironmentDetector` service (`src/services/project-environment-detector.ts`)
-- [x] Add `CommandRunner` service (`src/services/command-runner.ts`)
-- [x] Add `core-dependency.ts` effect (`src/effects/core-dependency.ts`)
-- [x] Wire new services in `bin.ts` layer composition
-- [x] Add new test fixtures (pnpm monorepo, bun project, uv project, ambiguous)
-
-### Phase 2: Unit Tests (TDD Red)
-- [x] Write `ProjectEnvironmentDetector` tests (17 test cases)
-- [x] Write `core-dependency.ts` tests (7 test cases)
-- [x] All tests pass (green)
-
-### Phase 3: Update `composio init` (Green)
-- [x] Add `--dry-run`, `--force`, `--yes` flags to init command
-- [x] Extend `InitConfigBuilder` with `withDetectedEnv` and `withInstallPlan`
-- [x] Integrate detection into the wizard flow
-- [x] Integrate installation with spinner and error handling
-- [x] Update structured JSON output to include detection info
-- [x] Update `.composio/config.json` to include detection info
-
-### Phase 4: Command Tests
-- [x] Write `init.cmd.test.ts` command tests (8 scenarios)
-- [x] Update `TestLive` to support `commandRunner` and `terminalUI` overrides
-- [x] Add `ProjectEnvironmentDetector.Default` to test layer
-
-### Phase 5: E2E Tests
-- [ ] Add `ts/e2e-tests/cli/init/` E2E test suite (deferred to follow-up PR)
-- [ ] Test `--dry-run` mode with TS and Python fixtures in Docker (deferred)
-- [ ] Update `ts/e2e-tests/cli/README.md` with new test info (deferred)
-
-### Phase 6: Cleanup
-- [x] Run `pnpm typecheck` and fix any issues
-- [x] Run full test suite and fix regressions
-- [ ] Update `CLAUDE.md` if needed (document new services)
-
-## Future Considerations
-
-- **`composio install` as standalone command** — extract install logic for re-use outside init
-- **Framework provider installation** — add framework-specific packages based on wizard selection
-- **Skills installation** — run `npx skills add ComposioHQ/skills` when `installSkills: true`
-- **Migrate `generate.cmd.ts`** — replace `EnvLangDetector` usage with `ProjectEnvironmentDetector`
-- **Deno support** — handle `deno add npm:@composio/core` pattern
-
-## References & Research
-
-### Internal References
-
-- Current `composio init`: `ts/packages/cli/src/commands/init.cmd.ts`
-- Existing `EnvLangDetector`: `ts/packages/cli/src/services/env-lang-detector.ts`
-- Existing `JsPackageManagerDetector`: `ts/packages/cli/src/services/js-package-manager-detector.ts`
-- Layer composition: `ts/packages/cli/src/bin.ts` (lines 93-112)
-- Test infrastructure: `ts/packages/cli/test/__utils__/services/test-layer.ts`
-- E2E test framework: `ts/e2e-tests/cli/README.md`
-- Login command tests (pattern reference): `ts/packages/cli/test/src/commands/login.cmd.test.ts`
-
-### Reference Implementations (composio2)
-
-- `ProjectEnvironmentDetector`: `/Users/jkomyno/work/composio/composio2/ts/packages/cli/src/services/project-environment-detector.ts`
-- `CommandRunner`: `/Users/jkomyno/work/composio/composio2/ts/packages/cli/src/services/command-runner.ts`
-- `core-dependency.ts`: `/Users/jkomyno/work/composio/composio2/ts/packages/cli/src/effects/core-dependency.ts`
-- `install.cmd.ts`: `/Users/jkomyno/work/composio/composio2/ts/packages/cli/src/commands/install.cmd.ts`
-- `install.cmd.test.ts`: `/Users/jkomyno/work/composio/composio2/ts/packages/cli/test/src/commands/install.cmd.test.ts`
-- `TerminalUI` with prompts: `/Users/jkomyno/work/composio/composio2/ts/packages/cli/src/services/terminal-ui.ts`
-
-### External References
-
-- Effect.ts Service pattern: `ts/vendor/effect/packages/effect/src/`
-- @effect/cli Command: `ts/vendor/effect/packages/cli/src/Command.ts`
-- @effect/platform FileSystem: `ts/vendor/effect/packages/platform/src/FileSystem.ts`
-- @effect/platform Command (subprocess): `ts/vendor/effect/packages/platform/src/Command.ts`
-- @clack/prompts: `ts/vendor/clack/packages/prompts/src/`
diff --git a/plans/fix-mastra-dangling-defs-ref.md b/plans/fix-mastra-dangling-defs-ref.md
deleted file mode 100644
index efdd36245..000000000
--- a/plans/fix-mastra-dangling-defs-ref.md
+++ /dev/null
@@ -1,435 +0,0 @@
-# fix: Tolerate dangling `$ref` in Mastra provider when API omits `$defs`
-
-## Overview
-
-`MastraProvider.wrapTool` calls `dereferenceJsonSchema` to inline JSON Schema `$ref`
-pointers before handing the schema to `@mastra/schema-compat`. That contract was
-introduced in PLEN-2244 (commit `cc673b654`) and assumes every `#/$defs/...` ref
-has a resolvable target. The Composio API ships at least one toolkit family
-(Gmail, and any other toolkit whose `outputParameters` uses `$ref`) where the
-schema declares `"$ref": "#/$defs/FetchEmailsResponse"` **without ever declaring
-`$defs`**. The current resolver correctly throws a typed
-`JsonSchemaRefResolutionError`, but that error escapes `wrapTool` and crashes
-`composio.tools.get(...)` upfront — making affected toolkits unusable through
-the Mastra provider.
-
-This plan makes `dereferenceJsonSchema` opt-in lenient against unresolved
-internal refs (using the existing cycle sentinel, `{ type: 'object', additionalProperties: true }`),
-opts the Mastra provider into that lenient mode with a one-shot per-tool warning,
-and locks the behavior in with red-green regression tests that mirror the exact
-`GMAIL_FETCH_EMAILS` shape from the Linear ticket.
-
-> **API-side follow-up (out of scope here):** the proper long-term fix is for
-> `/api/v3/tools/:slug` to emit a top-level `$defs` block alongside any `$ref`
-> it produces. That fix benefits every consumer (Mastra, Vercel AI SDK, future
-> providers). It is tracked separately so the SDK does not have to block on
-> the backend roll-out.
-
-## Problem Statement / Motivation
-
-### Reproduction (from PLEN-2451, verified 2026-05-10)
-
-Direct dump of `GMAIL_FETCH_EMAILS.outputParameters` via
-`composio.tools.getRawComposioTools(...)`:
-
-```jsonc
-{
- "type": "object",
- "properties": {
- "data": {
- "description": "Data from the action execution",
- "title": "Data",
- "$ref": "#/$defs/FetchEmailsResponse" // ← points into $defs
- },
- "error": { "type": "string", "description": "...", "title": "Error" },
- "successful": { "type": "boolean", "description": "...", "title": "Successful" }
- },
- "required": ["data", "successful"],
- "title": "FetchEmailsResponseWrapper"
- // ← no `$defs` block anywhere
-}
-```
-
-Observed behavior:
-
-| Version pair | Failure mode |
-| --------------------------------- | ----------------------------------------------------------------------------------------------------- |
-| `@composio/{core,mastra}@0.6.11` | `tools.get` returns a degraded Standard Schema whose `output()` crashes at runtime; agent sees a ~600B validation-error stub. |
-| `@composio/{core,mastra}@0.9.0` (latest) | `tools.get` itself throws `JsonSchemaRefResolutionError: Cannot resolve $ref #/$defs/FetchEmailsResponse` upfront. |
-
-The 0.9.0 behavior is *correct* given the PLEN-2244 strict contract — but the
-contract is wrong for upstream-supplied schemas the SDK cannot edit. Every
-toolkit whose `outputParameters` carries a `$ref` (Gmail, Slack, Google
-Calendar, …) currently breaks Mastra integration.
-
-### Why the reporter's "Option A" fix does not work
-
-GitHub issue [#3307](https://github.com/ComposioHQ/composio/issues/3307)
-proposes inlining `$defs` before calling `applyCompatLayer`. That is exactly
-what PLEN-2244 already does (`ts/packages/providers/mastra/src/index.ts:100-110`).
-The root cause is **upstream of** `applyCompatLayer`: there is no `$defs` to
-inline. PLEN-2244's fix surfaces a dangling pointer instead of silently
-producing a permissive `anyOf`, which is the right developer experience for
-custom tools but the wrong one for opaque API-supplied schemas.
-
-## Proposed Solution
-
-Two-tier fix that keeps the same architecture as PLEN-2244:
-
-### 1. `@composio/core` — add an `onUnresolved` option to `dereferenceJsonSchema`
-
-`ts/packages/core/src/utils/jsonSchema.ts`
-
-```typescript
-export type UnresolvedRefStrategy = 'throw' | 'sentinel';
-
-export interface DereferenceJsonSchemaOptions {
- /**
- * What to do when a `#/$defs/...` or `#/definitions/...` $ref cannot be
- * resolved (target missing, $defs/definitions block absent, malformed
- * pointer beneath an internal #/ prefix).
- *
- * - `'throw'` (default): preserve current behavior — throw
- * `JsonSchemaRefResolutionError`. Right for first-party / custom-tool
- * schemas where a dangling ref is a developer bug.
- * - `'sentinel'`: replace the offending node with the cycle-break
- * sentinel (`{ type: 'object', additionalProperties: true }`). Right for
- * schemas sourced from an upstream service the caller cannot edit.
- * Each replacement invokes `onReplace` exactly once.
- */
- onUnresolved?: UnresolvedRefStrategy;
- /**
- * Callback invoked once per replaced node (only when `onUnresolved === 'sentinel'`).
- * Lets callers emit one-shot warnings without losing the offending pointer.
- */
- onReplace?: (ref: string, reason: 'missing-target' | 'malformed-pointer') => void;
-}
-
-export function dereferenceJsonSchema<T = unknown>(
- schema: T,
- options?: DereferenceJsonSchemaOptions
-): T { /* … */ }
-```
-
-Implementation notes:
-
-- The walker already produces `CYCLE_BREAK_SENTINEL` on detected cycles
- (`jsonSchema.ts:9, 98, 107, 127`). The lenient branch reuses **the same
- sentinel constant** so cycles and dangling refs share semantics: "we can't
- resolve this further; fall back to a permissive object".
-- `resolvePointer` currently throws via `failResolution`
- (`jsonSchema.ts:19-24, 26-36`). Refactor: have `failResolution` return a
- discriminator (`{ kind: 'unresolved', ref, reason }`) consumed by the walker,
- so the lenient and strict branches share a single code path. Strict mode
- throws at the boundary, lenient mode emits the sentinel + invokes
- `onReplace`. Net change to strict-mode behavior: zero.
-- The chain-depth cap (`MAX_REF_CHAIN_DEPTH`) and node-depth cap
- (`MAX_NODE_DEPTH`) keep throwing in **both** modes — those are safety caps,
- not data-shape issues. Document this in the JSDoc.
-- External (`http://`, `https://`, `file://`) refs continue to be left as-is
- with a single audit-log `logger.warn` per call (`jsonSchema.ts:113-118`).
- Unchanged.
-- `$defs` / `definitions` continue to be stripped from the returned root
- (`jsonSchema.ts:148-152`). Unchanged.
-
-### 2. `@composio/mastra` — opt into lenient mode with a per-tool warning
-
-`ts/packages/providers/mastra/src/index.ts`
-
-```typescript
-wrapTool(tool: Tool, executeTool: ExecuteToolFn): MastraTool {
- // ...existing strict-mode branch for inputParameters...
-
- // Output schemas come straight from the Composio API. The API can emit a
- // `$ref: "#/$defs/..."` without declaring `$defs` (PLEN-2451) — strict
- // mode would crash `tools.get` upfront. Fall back to the permissive
- // object sentinel and emit a single warning so the degraded shape is
- // observable in the agent's logs.
- const onReplace = (ref: string) => this.warnDanglingRefOnce(tool.slug, ref);
-
- const inputSchema = applyCompatLayer({
- schema: dereferenceJsonSchema(parameters ?? {}, {
- onUnresolved: 'sentinel',
- onReplace,
- }),
- compatLayers: [],
- mode: 'jsonSchema',
- });
-
- const outputSchema = applyCompatLayer({
- schema: dereferenceJsonSchema(tool.outputParameters ?? {}, {
- onUnresolved: 'sentinel',
- onReplace,
- }),
- compatLayers: [],
- mode: 'jsonSchema',
- });
-
- // ...createTool(...)...
-}
-```
-
-Add a small instance-scoped `Set<string>` (`warnedDanglingRefs`, keyed by
-`${slug}:${ref}`) so a Mastra agent that wraps the same tool many times only
-emits one warning per `(tool, ref)` pair. The warning message names the
-toolkit slug, tool slug, and the dangling pointer:
-
-```
-[composio/mastra] Tool GMAIL_FETCH_EMAILS (toolkit gmail) declares
-$ref #/$defs/FetchEmailsResponse but no matching $defs entry. Falling
-back to a permissive object schema for this branch — the wrapped
-Mastra tool will validate the response loosely. Tracked in
-https://linear.app/composio/issue/PLEN-2451.
-```
-
-Why warn (not silent fallback)?
-
-- **Why:** customers iterating on a Mastra agent need to know they got a
- degraded schema; otherwise the failure mode becomes "agent validates loosely
- and you never find out why a downstream typed consumer broke". The warning
- also gives us a signal we can pipe into telemetry to prioritize the
- API-side fix.
-- **How to apply:** rate-limit per `(slug, ref)` so noisy agents don't spam
- the log; never emit at module-load (the warning has to point at a concrete
- tool slug).
-
-### Why the fix stays inside `MastraProvider.wrapTool`
-
-It is tempting to dereference centrally — in
-`Tools.transformToolCases` (`Tools.ts:140`) or
-`Tools.applyDefaultSchemaModifiers` (`Tools.ts:192`). That would be wrong for
-three reasons:
-
-1. **No other provider needs this for output schemas.** Vercel
- (`ts/packages/providers/vercel/src/index.ts:108-133`) only feeds
- `inputParameters` to its Zod converter, and OpenAI/Anthropic/Google bind
- tool *input* schemas to function-calling APIs that ignore output shapes.
- `outputParameters` validation is a Mastra-specific surface.
-2. **Centralized dereferencing would mutate `tools.get()`'s public shape.**
- Users today read raw `inputParameters` / `outputParameters` from
- `tools.get` and `getRawComposioToolBySlug` and expect them to mirror the
- API response (modulo case transformation in `transformToolCases`).
- Inlining `$defs` for every caller — including ones whose consumers can
- resolve `$ref` natively — is a silent behavior change for non-Mastra
- users.
-3. **PLEN-2244 set the precedent.** Both fixes share the same boundary:
- the provider that owns the validation contract is the provider that
- pre-processes the schema. Keeping the new lenient path at the same
- boundary preserves architectural consistency.
-
-## Acceptance Criteria
-
-### Code
-
-- [x] `dereferenceJsonSchema` accepts an optional second arg
- `{ onUnresolved?: 'throw' | 'sentinel'; onReplace?: (ref, reason) => void }`.
-- [x] Default behavior (no opts) is byte-for-byte unchanged: still throws
- `JsonSchemaRefResolutionError` on a dangling internal `$ref`.
-- [x] Lenient mode (`onUnresolved: 'sentinel'`) replaces the offending node
- with the existing `CYCLE_BREAK_SENTINEL` and invokes `onReplace` exactly
- once per replacement, passing the original ref pointer + reason.
-- [x] Lenient mode still throws on `MAX_REF_CHAIN_DEPTH` /
- `MAX_NODE_DEPTH` breaches (safety caps are not lenient).
-- [x] `MastraProvider.wrapTool` calls `dereferenceJsonSchema(..., {
- onUnresolved: 'sentinel', onReplace })` for both `inputParameters` and
- `outputParameters`.
-- [x] `MastraProvider` warns once per `(toolSlug, refPointer)` pair via
- `@composio/core`'s `logger.warn`.
-- [x] No public TypeScript API is *removed*; the new opts arg is purely additive.
-
-### Tests (red before fix; green after)
-
-- [x] New unit tests in `ts/packages/core/test/utils/jsonSchema.test.ts`
- (9 new cases, all under `describe("with onUnresolved: 'sentinel' lenient mode")`):
- sentinel replaces dangling ref; sentinel replaces missing-key ref;
- `onReplace` invoked with ref + `'missing-target'`; `onReplace` invoked
- with `'malformed-pointer'` for non-`#/` pointers; chain-depth cap still
- throws; node-depth cap still throws; explicit `'throw'` matches default;
- `onReplace` not called in strict mode; mixed schema preserves resolvable
- branches while replacing only the dangling one.
-- [x] New regression test file
- `ts/packages/providers/mastra/test/mastra-dangling-defs.test.ts`
- (6 cases, un-mocked `@mastra/schema-compat`): no throw on dangling
- output ref (GMAIL shape); defined outputSchema with no surviving `$ref`;
- one warn per `(slug, ref)` pair across repeat wraps; separate warning
- per slug; symmetric tolerance on input refs; resolvable `$defs` still
- preserved.
-- [x] All existing tests still pass: core 908; mastra-ref 3; mastra.test 39;
- every other provider/cli package green.
-
-### Changeset
-
-- [x] `.changeset/fix-mastra-dangling-defs-ref.md` added — `@composio/core`
- and `@composio/mastra` both bumped patch; body describes the API
- behavior, the new `onUnresolved`/`onReplace` opt, and the Mastra opt-in.
- No Linear IDs (per repo convention — changesets ship to npm).
-
-### Manual verification
-
-- [ ] (Post-merge) Reproduce against the live API using the script from the
- tracking issue: `tools.get(userId, { tools: ['GMAIL_FETCH_EMAILS'] })`
- should return a `MastraTool` object whose `outputSchema` is defined.
-- [ ] Confirm the SDK logs exactly one warning per process per `(slug, ref)`
- pair with the expected message.
-
-## Red-Green Test Strategy
-
-The TDD loop:
-
-1. **Red — write tests + the new error/option signature.** No production
- implementation yet.
- - Add the new `DereferenceJsonSchemaOptions` interface and export it.
- - Type-only stub: `dereferenceJsonSchema` still accepts an unused second
- arg (`_options?: DereferenceJsonSchemaOptions`).
- - Add the four new `jsonSchema.test.ts` cases. They fail with
- `JsonSchemaRefResolutionError` (current strict behavior) or compile
- errors (if `onReplace` callback isn't exposed yet).
- - Add the four new `mastra-dangling-defs.test.ts` cases. They fail with
- `JsonSchemaRefResolutionError` propagated up from `wrapTool`.
-
-2. **Green — minimum implementation.**
- - Plumb the `onUnresolved` strategy through `walk` / `resolvePointer` /
- `stepInto`. Reuse `CYCLE_BREAK_SENTINEL`.
- - Wire `onReplace` invocations at the two failure call sites
- (`resolvePointer`'s missing target, `stepInto`'s non-object cursor).
- - Add `warnDanglingRefOnce` to `MastraProvider`, invoke from the two
- `wrapTool` call sites.
-
-3. **Refactor — tighten.**
- - Verify no allocation in the strict path (the new branch must be a
- zero-cost extension on the existing happy path).
- - Run the full `jsonSchema.test.ts` + `mastra-ref.test.ts` +
- `mastra-dangling-defs.test.ts` matrix to confirm no regressions.
-
-## Technical Considerations
-
-### Security
-
-- The sentinel (`{ type: 'object', additionalProperties: true }`) is the
- most permissive valid object schema. A schema falling back to it means
- Mastra's `validateToolOutput` will accept anything — *for that branch
- only*. The siblings (e.g. `required`, `title`) at the parent level are
- unaffected. This is strictly more permissive than `dereferenceJsonSchema`'s
- current "throw and refuse to run" behavior, so it does not introduce a new
- validation-bypass vector for trusted tool authors.
-- Prototype-pollution filter (`POLLUTING_KEYS` at `jsonSchema.ts:10`) and
- `WeakSet` cycle tracking are unaffected.
-
-### Performance
-
-- Walker still visits each node at most once. The new branch is an extra
- `if (strategy === 'sentinel') return CYCLE_BREAK_SENTINEL` after
- `resolvePointer` throws or returns the "unresolved" discriminator. No new
- allocations in the common (resolvable) path.
-
-### Compatibility
-
-- `DereferenceJsonSchemaOptions` is **additive**. Both the public
- `dereferenceJsonSchema` export (consumed by `@composio/mastra`) and the
- internal call sites can ignore the new parameter.
-- The `JsonSchemaRefResolutionError` class is unchanged. Callers that catch
- it (none today outside the test suite) keep working.
-- The default mode is `'throw'`, matching the PLEN-2244 contract. Custom-tool
- authors who deliberately point `$ref` at a non-existent `$defs` entry will
- still get a hard error — that is the right behavior for *their* schemas.
-
-## Dependencies & Risks
-
-- **No dependency bumps.** Unlike PLEN-2244 (which bumped
- `@mastra/schema-compat` to `^1.2.9`), this fix is internal to the SDK.
-- **Risk: developer surprise on raw schemas.** A reader of
- `getRawComposioTools(...)` sees `$ref` in the raw schema and finds it
- resolved to a sentinel in `wrapTool` output. Mitigation: the JSDoc on
- `dereferenceJsonSchema` documents the lenient contract, and the warning
- emitted by `MastraProvider` names the offending pointer.
-- **Risk: telemetry noise.** A user wrapping every Gmail tool in a wide
- toolkit fetch could see many warnings on first run. Mitigation: per-tool
- dedup in the Mastra provider; warning text points at the upstream Linear
- ticket so callers know it is a known, tracked issue.
-
-## File-Level Plan
-
-```
-ts/packages/core/src/utils/jsonSchema.ts # add opts; reuse CYCLE_BREAK_SENTINEL
-ts/packages/core/test/utils/jsonSchema.test.ts # 4 new cases (red → green)
-ts/packages/core/src/index.ts # re-export DereferenceJsonSchemaOptions if needed
-ts/packages/providers/mastra/src/index.ts # opt into 'sentinel' + per-tool warn dedup
-ts/packages/providers/mastra/test/mastra-dangling-defs.test.ts # new file, 4 cases (red → green)
-.changeset/fix-mastra-dangling-defs-ref.md # patch/patch
-```
-
-Pseudocode for the touchpoints:
-
-### `ts/packages/core/src/utils/jsonSchema.ts`
-
-```typescript
-export type UnresolvedRefStrategy = 'throw' | 'sentinel';
-
-export interface DereferenceJsonSchemaOptions {
- onUnresolved?: UnresolvedRefStrategy;
- onReplace?: (ref: string, reason: 'missing-target' | 'malformed-pointer') => void;
-}
-
-const failResolution = (
- pointer: string,
- segment: string,
- strategy: UnresolvedRefStrategy,
- onReplace?: DereferenceJsonSchemaOptions['onReplace']
-): typeof CYCLE_BREAK_SENTINEL => {
- if (strategy === 'sentinel') {
- onReplace?.(pointer, 'malformed-pointer');
- return { ...CYCLE_BREAK_SENTINEL };
- }
- throw new JsonSchemaRefResolutionError(`Cannot resolve $ref ${pointer}`, {
- meta: { ref: pointer, failedAt: segment },
- possibleFixes: REF_RESOLUTION_FIXES,
- });
-};
-// `resolvePointer` and `stepInto` receive `strategy` + `onReplace` and forward to `failResolution`.
-// `walk` checks for the sentinel return shape and stops descending.
-```
-
-### `ts/packages/providers/mastra/src/index.ts`
-
-```typescript
-private warnedDanglingRefs = new Set<string>();
-
-private warnDanglingRefOnce(toolSlug: string, toolkitSlug: string, ref: string) {
- const key = `${toolSlug}:${ref}`;
- if (this.warnedDanglingRefs.has(key)) return;
- this.warnedDanglingRefs.add(key);
- logger.warn(
- `[composio/mastra] Tool ${toolSlug} (toolkit ${toolkitSlug}) declares ` +
- `$ref ${ref} but no matching $defs/definitions entry. Falling back to a ` +
- `permissive object schema for this branch — the wrapped Mastra tool will ` +
- `validate loosely. See https://linear.app/composio/issue/PLEN-2451.`
- );
-}
-```
-
-## References & Research
-
-### Linear / GitHub
-
-- Linear ticket: PLEN-2451 — *MastraProvider $defs/$ref schema is dangling at the API source*.
-- Customer-facing GitHub issue: https://github.com/ComposioHQ/composio/issues/3307 (reported by `@0xpaperhead`, 2026-04-28).
-- Prior, related fix: PLEN-2244 (commits `5300bf8ba` red tests, `cc673b654` fix). Closed by `.changeset/fix-mastra-ref-dereference.md`.
-
-### Files
-
-- `ts/packages/providers/mastra/src/index.ts:80-126` — `MastraProvider.wrapTool` (the call site that needs to opt into lenient mode).
-- `ts/packages/core/src/utils/jsonSchema.ts:64-153` — `dereferenceJsonSchema` (the helper that needs the new opt).
-- `ts/packages/core/src/utils/jsonSchema.ts:9` — `CYCLE_BREAK_SENTINEL` (the sentinel to reuse).
-- `ts/packages/core/src/utils/jsonSchema.ts:19-36` — `failResolution` / `stepInto` (refactor target).
-- `ts/packages/core/src/errors/ValidationErrors.ts:89-99` — `JsonSchemaRefResolutionError` (unchanged).
-- `ts/packages/core/test/utils/jsonSchema.test.ts:150-158` — existing strict-mode test (the contract we keep as default).
-- `ts/packages/providers/mastra/test/mastra-ref.test.ts` — pattern to mirror for the new test file.
-- `ts/packages/providers/vercel/src/index.ts:108-133` — confirms `outputParameters` is Mastra-only.
-- `ts/packages/core/src/types/tool.types.ts:29-102` — `JSONSchemaPropertySchema` admits `$ref` / `$defs` / `definitions` (so the raw shape we test against is valid against `ToolSchema`).
-- `ts/packages/core/src/models/Tools.ts:140-150, 192-198` — confirms the central pipeline does *not* pre-process schemas and that the provider boundary is the right one.
-
-### External
-
-- JSON Pointer (RFC 6901) — escape semantics already handled correctly at `jsonSchema.ts:16-17`.
-- JSON Schema 2020-12 — sibling-keyword merge semantics already handled correctly at `jsonSchema.ts:133-141`.
-- `@mastra/schema-compat` — AJV-backed; refuses to compile schemas with unresolved internal `$ref`. Bundles `convertSchemaToZod` which silently degrades `$ref` → permissive `anyOf` when AJV is bypassed (the pre-PLEN-2244 failure mode).
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 9d93e9289..f4ef2eba5 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -524,22 +524,6 @@ importers:
specifier: 'catalog:'
version: 5.9.3
- ts/examples/cjs:
- dependencies:
- '@composio/core':
- specifier: workspace:*
- version: link:../../packages/core
- dotenv:
- specifier: ^16.4.1
- version: 16.6.1
- devDependencies:
- '@types/bun':
- specifier: ^1.2.9
- version: 1.3.9
- typescript:
- specifier: 'catalog:'
- version: 5.9.3
-
ts/examples/cloudflare-wrangler:
dependencies:
'@composio/core':
diff --git a/test/release-workflow.test.ts b/test/release-workflow.test.ts
index a016962eb..5ffbf8bbc 100644
--- a/test/release-workflow.test.ts
+++ b/test/release-workflow.test.ts
@@ -381,7 +381,6 @@ esac
{
name: 'changeset-peer-fixture',
private: true,
- packageManager: packageJson.packageManager,
workspaces: ['packages/*'],
},
null,
diff --git a/ts/docs/internal/release.md b/ts/docs/internal/release.md
index 6cd5000d7..835780029 100644
--- a/ts/docs/internal/release.md
+++ b/ts/docs/internal/release.md
@@ -78,8 +78,7 @@ The manual release process is available for cases where direct control over the
### Prerequisites
-- Node.js, Bun, Python, Deno, and uv from `mise.toml`
-- pnpm from `package.json#packageManager` via corepack
+- Node.js, Bun, Python, Deno, uv, and pnpm from `mise.toml`
- Access to npm registry
- Write access to the repository
@@ -94,7 +93,6 @@ The manual release process is available for cases where direct control over the
# Install dependencies
mise install
- corepack enable
pnpm install
# Run quality checks
diff --git a/ts/e2e-tests/README.md b/ts/e2e-tests/README.md
index 059cf7837..b111bde0e 100644
--- a/ts/e2e-tests/README.md
+++ b/ts/e2e-tests/README.md
@@ -26,7 +26,7 @@ ts/e2e-tests/
│ └── README.md # Utils documentation
├── runtimes/
├── node/ # Node.js runtime tests
- │ ├── cjs-basic/ # CommonJS compatibility tests
+ │ ├── cjs-basic/ # Node.js 22 require(esm) interop tests
│ ├── custom-tools/ # Custom local tools execution (session.execute, proxyExecute, Zod validation)
│ ├── esm-basic/ # ESM compatibility tests
│ ├── json-schema-to-zod-v3/ # @composio/json-schema-to-zod + Zod v3 tests
@@ -196,7 +196,9 @@ import { TIMEOUTS } from '@e2e-tests/utils/const';
import { describe, it, expect, beforeAll } from 'bun:test';
e2e(import.meta.url, {
- nodeVersions: ['22.22.3', '24.16.0', '25.9.0'],
+ versions: {
+ node: ['22.22.3', '24.16.0', '25.9.0'],
+ },
usesFixtures: true, // Sets cwd to fixtures/ directory
env: { MY_API_KEY: process.env.MY_API_KEY },
defineTests: ({ runFixture }) => {
diff --git a/ts/e2e-tests/_utils/Dockerfile.cli b/ts/e2e-tests/_utils/Dockerfile.cli
index daf70340d..02bb19916 100644
--- a/ts/e2e-tests/_utils/Dockerfile.cli
+++ b/ts/e2e-tests/_utils/Dockerfile.cli
@@ -1,24 +1,33 @@
# Reusable Dockerfile for CLI e2e tests (debian runtime)
-# Usage: docker build -f Dockerfile.cli --build-arg CLI_VERSION=0.1.24 --build-arg NODE_VERSION=22.22.3 --build-arg BUN_VERSION=1.3.10 -t test-name .
+# Usage: docker build -f Dockerfile.cli --build-arg CLI_VERSION=0.1.24 --build-arg NODE_VERSION=22.22.3 -t test-name .
ARG NODE_VERSION
-ARG BUN_VERSION
ARG CLI_VERSION=0.0.0
-FROM oven/bun:${BUN_VERSION} AS bun
-
FROM node:${NODE_VERSION}-slim AS builder
-ENV PNPM_HOME="/pnpm"
-ENV PATH="$PNPM_HOME:/usr/local/bin:$PATH"
+ENV MISE_DATA_DIR="/mise"
+ENV MISE_DISABLE_TOOLS="node,deno,python,uv"
+ENV PATH="/mise/shims:$PATH"
WORKDIR /app
-# Bring in bun binary from the official image (no curl)
-COPY --from=bun /usr/local/bin/bun /usr/local/bin/bun
-
-# Install corepack (pnpm) without curl/git
-RUN corepack enable
+# Install system dependencies (mise needs curl + ca-certificates)
+RUN apt-get update && \
+ apt-get install -y --no-install-recommends ca-certificates curl unzip && \
+ rm -rf /var/lib/apt/lists/*
+
+# Install bun + pnpm via mise (versions pinned in mise.toml/mise.lock).
+# mise is installed to /usr/local/bin and the tool binaries are symlinked there too;
+# Node is disabled so the base image's Node is used.
+RUN curl -fsSL https://mise.run | MISE_INSTALL_PATH=/usr/local/bin/mise sh
+COPY mise.toml mise.lock ./
+RUN mise trust /app/mise.toml && \
+ mise install && \
+ ln -sf "$(mise which bun)" /usr/local/bin/bun && \
+ ln -sf "$(mise which pnpm)" /usr/local/bin/pnpm && \
+ pnpm --version && \
+ bun --version
# Copy lockfile first for optimal layer caching
COPY pnpm-lock.yaml ./
diff --git a/ts/e2e-tests/_utils/Dockerfile.deno b/ts/e2e-tests/_utils/Dockerfile.deno
index 266aa1ee8..4ac7a584e 100644
--- a/ts/e2e-tests/_utils/Dockerfile.deno
+++ b/ts/e2e-tests/_utils/Dockerfile.deno
@@ -1,18 +1,21 @@
# Reusable Dockerfile for Deno e2e tests
-# Usage: docker build -f Dockerfile.deno --build-arg DENO_VERSION=2.6.7 --build-arg NODE_MAJOR=20 --build-arg BUN_VERSION=1.3.10 -t test-name .
+# Usage: docker build -f Dockerfile.deno --build-arg DENO_VERSION=2.6.7 --build-arg NODE_MAJOR=22 -t test-name .
#
# Uses official denoland/deno images. For multi-version testing, run the build/run
# multiple times with different DENO_VERSION values from the shell script.
+#
+# Deno is the test matrix axis (base image); Node comes from nodesource (needed by
+# pnpm and the build). bun and pnpm are installed from mise.toml/mise.lock, with
+# node/deno disabled in mise so it does not shadow the base/nodesource binaries.
ARG DENO_VERSION
FROM denoland/deno:${DENO_VERSION}
ARG NODE_MAJOR
-ARG BUN_VERSION
-ENV PNPM_HOME="/pnpm"
-ENV BUN_INSTALL="/usr/local"
-ENV PATH="$BUN_INSTALL/bin:$PNPM_HOME:$PATH"
+ENV MISE_DATA_DIR="/mise"
+ENV MISE_DISABLE_TOOLS="node,deno,python,uv"
+ENV PATH="/mise/shims:$PATH"
# Switch to root for installation
USER root
@@ -24,17 +27,21 @@ RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates curl unzip && \
rm -rf /var/lib/apt/lists/*
-# Install Node.js (needed for pnpm and building packages)
+# Install Node.js (needed for pnpm's npm backend and building packages)
RUN curl -fsSL "https://deb.nodesource.com/setup_${NODE_MAJOR}.x" | bash - && \
apt-get install -y nodejs && \
rm -rf /var/lib/apt/lists/*
-# Install corepack (for pnpm)
-RUN npm i -g corepack@latest && \
- corepack enable
-
-# Install Bun
-RUN curl -fsSL https://bun.sh/install | BUN_INSTALL=/usr/local bash -s "bun-v${BUN_VERSION}" && \
+# Install bun + pnpm via mise (versions pinned in mise.toml/mise.lock).
+# mise is installed to /usr/local/bin and the tool binaries are symlinked there too so
+# they stay on PATH for the non-root runtime user (login shells reset PATH).
+RUN curl -fsSL https://mise.run | MISE_INSTALL_PATH=/usr/local/bin/mise sh
+COPY mise.toml mise.lock ./
+RUN mise trust /app/mise.toml && \
+ mise install && \
+ ln -sf "$(mise which bun)" /usr/local/bin/bun && \
+ ln -sf "$(mise which pnpm)" /usr/local/bin/pnpm && \
+ pnpm --version && \
bun --version
# Copy lockfile first for optimal layer caching
diff --git a/ts/e2e-tests/_utils/Dockerfile.node b/ts/e2e-tests/_utils/Dockerfile.node
index facce5cb0..f530f15e3 100644
--- a/ts/e2e-tests/_utils/Dockerfile.node
+++ b/ts/e2e-tests/_utils/Dockerfile.node
@@ -1,17 +1,20 @@
# Reusable Dockerfile for Node.js e2e tests
-# Usage: docker build -f Dockerfile.node --build-arg NODE_VERSION=22.22.3 --build-arg BUN_VERSION=1.3.10 -t test-name .
+# Usage: docker build -f Dockerfile.node --build-arg NODE_VERSION=22.22.3 -t test-name .
#
# Uses official node:slim images. For multi-version testing, run the build/run
# multiple times with different NODE_VERSION values from the shell script.
+#
+# bun and pnpm are installed from mise.toml/mise.lock (the single source of truth).
+# Node is the test matrix axis and stays on the base image, so it is disabled in
+# mise (MISE_DISABLE_TOOLS) to avoid shadowing the base image's Node.
ARG NODE_VERSION
FROM node:${NODE_VERSION}-slim
-ARG BUN_VERSION
-ENV PNPM_HOME="/pnpm"
-ENV BUN_INSTALL="/usr/local"
-ENV PATH="$BUN_INSTALL/bin:$PNPM_HOME:$PATH"
+ENV MISE_DATA_DIR="/mise"
+ENV MISE_DISABLE_TOOLS="node,deno,python,uv"
+ENV PATH="/mise/shims:$PATH"
WORKDIR /app
@@ -20,12 +23,16 @@ RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates curl unzip && \
rm -rf /var/lib/apt/lists/*
-# Install corepack (for pnpm)
-RUN npm i -g corepack@latest --force && \
- corepack enable
-
-# Install Bun
-RUN curl -fsSL https://bun.sh/install | BUN_INSTALL=/usr/local bash -s "bun-v${BUN_VERSION}" && \
+# Install bun + pnpm via mise (versions pinned in mise.toml/mise.lock).
+# mise is installed to /usr/local/bin; the tool binaries are symlinked there too so
+# they stay on PATH for the non-root runtime user (login shells reset PATH).
+RUN curl -fsSL https://mise.run | MISE_INSTALL_PATH=/usr/local/bin/mise sh
+COPY mise.toml mise.lock ./
+RUN mise trust /app/mise.toml && \
+ mise install && \
+ ln -sf "$(mise which bun)" /usr/local/bin/bun && \
+ ln -sf "$(mise which pnpm)" /usr/local/bin/pnpm && \
+ pnpm --version && \
bun --version
# Copy lockfile first for optimal layer caching
diff --git a/ts/e2e-tests/_utils/scripts/docker-build.ts b/ts/e2e-tests/_utils/scripts/docker-build.ts
index b883cd238..e54698175 100644
--- a/ts/e2e-tests/_utils/scripts/docker-build.ts
+++ b/ts/e2e-tests/_utils/scripts/docker-build.ts
@@ -21,7 +21,6 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
type DockerToolchain = {
nodeVersion: string;
nodeMajorVersion: string;
- bunVersion: string;
};
function getRepoRoot(): string {
@@ -29,7 +28,9 @@ function getRepoRoot(): string {
return resolve(__dirname, '../../../..');
}
-function getMiseVersion(repoRoot: string, tool: 'node' | 'bun' | 'deno'): string {
+// bun and pnpm are installed inside the images from mise.toml/mise.lock, so only the
+// matrixed runtimes (node, deno) need to be resolved on the host and threaded as build args.
+function getMiseVersion(repoRoot: string, tool: 'node' | 'deno'): string {
try {
return execFileSync('mise', ['current', tool], { cwd: repoRoot, encoding: 'utf-8' }).trim();
} catch (err) {
@@ -46,7 +47,6 @@ function getDockerToolchain(repoRoot: string): DockerToolchain {
return {
nodeVersion,
nodeMajorVersion: getMajorVersion(nodeVersion),
- bunVersion: getMiseVersion(repoRoot, 'bun'),
};
}
@@ -75,11 +75,7 @@ function defaultNodeLabels(nodeVersion: string): Record<string, string> {
};
}
-async function buildNodeImage(
- nodeVersion: string,
- toolchain: DockerToolchain,
- repoRoot: string
-): Promise<boolean> {
+async function buildNodeImage(nodeVersion: string, repoRoot: string): Promise<boolean> {
const dockerfilePath = resolve(repoRoot, 'ts/e2e-tests/_utils/Dockerfile.node');
const imageTag = imageTagForNodeVersion(nodeVersion);
const labels = defaultNodeLabels(nodeVersion);
@@ -90,7 +86,7 @@ async function buildNodeImage(
console.log(`\nBuilding image for Node.js ${nodeVersion}...`);
const result =
- await $`docker build -f ${dockerfilePath} --build-arg NODE_VERSION=${nodeVersion} --build-arg BUN_VERSION=${toolchain.bunVersion} ${{ raw: labelArgs }} -t ${imageTag} ${repoRoot}`
+ await $`docker build -f ${dockerfilePath} --build-arg NODE_VERSION=${nodeVersion} ${{ raw: labelArgs }} -t ${imageTag} ${repoRoot}`
.cwd(repoRoot)
.nothrow();
@@ -135,7 +131,7 @@ async function buildDenoImage(
console.log(`\nBuilding image for Deno ${denoVersion}...`);
const result =
- await $`docker build -f ${dockerfilePath} --build-arg DENO_VERSION=${denoVersion} --build-arg NODE_MAJOR=${toolchain.nodeMajorVersion} --build-arg BUN_VERSION=${toolchain.bunVersion} ${{ raw: labelArgs }} -t ${imageTag} ${repoRoot}`
+ await $`docker build -f ${dockerfilePath} --build-arg DENO_VERSION=${denoVersion} --build-arg NODE_MAJOR=${toolchain.nodeMajorVersion} ${{ raw: labelArgs }} -t ${imageTag} ${repoRoot}`
.cwd(repoRoot)
.nothrow();
@@ -180,7 +176,7 @@ async function buildCliImage(
console.log(`\nBuilding image for CLI ${cliVersion}...`);
const result =
- await $`docker build -f ${dockerfilePath} --build-arg CLI_VERSION=${cliVersion} --build-arg NODE_VERSION=${toolchain.nodeVersion} --build-arg BUN_VERSION=${toolchain.bunVersion} ${{ raw: labelArgs }} -t ${imageTag} ${repoRoot}`
+ await $`docker build -f ${dockerfilePath} --build-arg CLI_VERSION=${cliVersion} --build-arg NODE_VERSION=${toolchain.nodeVersion} ${{ raw: labelArgs }} -t ${imageTag} ${repoRoot}`
.cwd(repoRoot)
.nothrow();
@@ -271,7 +267,7 @@ async function main() {
// Build Node.js images
for (const version of nodeVersions) {
total++;
- const success = await buildNodeImage(version, dockerToolchain, repoRoot);
+ const success = await buildNodeImage(version, repoRoot);
if (!success) {
failed++;
}
diff --git a/ts/e2e-tests/_utils/src/image-lifecycle.ts b/ts/e2e-tests/_utils/src/image-lifecycle.ts
index bc52e8fe5..e17382818 100644
--- a/ts/e2e-tests/_utils/src/image-lifecycle.ts
+++ b/ts/e2e-tests/_utils/src/image-lifecycle.ts
@@ -185,7 +185,9 @@ export async function checkDocker(options: CheckDockerOptions = {}): Promise<Exe
return exec('docker', ['info'], { cwd: repoRoot });
}
-async function getMiseVersion(tool: 'node' | 'bun' | 'deno', repoRoot: string): Promise<string> {
+// bun and pnpm are installed inside the images from mise.toml/mise.lock, so only the
+// matrixed runtimes (node, deno) need to be resolved on the host and threaded as build args.
+async function getMiseVersion(tool: 'node' | 'deno', repoRoot: string): Promise<string> {
const result = await exec('mise', ['current', tool], { cwd: repoRoot });
const version = result.stdout.trim();
if (result.exitCode !== 0 || !version) {
@@ -230,7 +232,6 @@ export async function ensureNodeImage(
const dockerfilePath =
options.dockerfilePath ?? resolve(repoRoot, 'ts/e2e-tests/_utils/Dockerfile.node');
const imageTag = imageTagForNodeVersion(nodeVersion);
- const bunVersion = await getMiseVersion('bun', repoRoot);
const inspect = await exec('docker', ['image', 'inspect', imageTag], { cwd: repoRoot });
if (inspect.exitCode === 0) {
@@ -243,8 +244,6 @@ export async function ensureNodeImage(
dockerfilePath,
'--build-arg',
`NODE_VERSION=${nodeVersion}`,
- '--build-arg',
- `BUN_VERSION=${bunVersion}`,
...labelsToArgs(defaultNodeLabels(nodeVersion)),
'-t',
imageTag,
@@ -416,7 +415,6 @@ export async function ensureDenoImage(
options.dockerfilePath ?? resolve(repoRoot, 'ts/e2e-tests/_utils/Dockerfile.deno');
const imageTag = imageTagForDenoVersion(denoVersion);
const nodeVersion = await getMiseVersion('node', repoRoot);
- const bunVersion = await getMiseVersion('bun', repoRoot);
const inspect = await exec('docker', ['image', 'inspect', imageTag], { cwd: repoRoot });
if (inspect.exitCode === 0) {
@@ -431,8 +429,6 @@ export async function ensureDenoImage(
`DENO_VERSION=${denoVersion}`,
'--build-arg',
`NODE_MAJOR=${getMajorVersion(nodeVersion)}`,
- '--build-arg',
- `BUN_VERSION=${bunVersion}`,
...labelsToArgs(defaultDenoLabels(denoVersion)),
'-t',
imageTag,
@@ -605,7 +601,6 @@ export async function ensureCliImage(
options.dockerfilePath ?? resolve(repoRoot, 'ts/e2e-tests/_utils/Dockerfile.cli');
const imageTag = imageTagForCliVersion(cliVersion);
const nodeVersion = await getMiseVersion('node', repoRoot);
- const bunVersion = await getMiseVersion('bun', repoRoot);
const inspect = await exec('docker', ['image', 'inspect', imageTag], { cwd: repoRoot });
if (inspect.exitCode === 0) {
@@ -620,8 +615,6 @@ export async function ensureCliImage(
`CLI_VERSION=${cliVersion}`,
'--build-arg',
`NODE_VERSION=${nodeVersion}`,
- '--build-arg',
- `BUN_VERSION=${bunVersion}`,
...labelsToArgs(defaultCliLabels(cliVersion)),
'-t',
imageTag,
diff --git a/ts/e2e-tests/_utils/src/types.ts b/ts/e2e-tests/_utils/src/types.ts
index e9eb0242a..1240da9da 100644
--- a/ts/e2e-tests/_utils/src/types.ts
+++ b/ts/e2e-tests/_utils/src/types.ts
@@ -1,4 +1,8 @@
-import { WELL_KNOWN_NODE_VERSIONS, WELL_KNOWN_DENO_VERSIONS, WELL_KNOWN_CLI_VERSIONS } from './const';
+import {
+ WELL_KNOWN_NODE_VERSIONS,
+ WELL_KNOWN_DENO_VERSIONS,
+ WELL_KNOWN_CLI_VERSIONS,
+} from './const';
export type NonEmptyArray<T> = [T, ...T[]];
@@ -13,9 +17,9 @@ export type NonEmptyArray<T> = [T, ...T[]];
*/
export type NonEmptyString<T extends string> = T extends '' ? never : T;
-export type NodeVersionFromUser = typeof WELL_KNOWN_NODE_VERSIONS[number];
-export type DenoVersionFromUser = typeof WELL_KNOWN_DENO_VERSIONS[number];
-export type CliVersionFromUser = typeof WELL_KNOWN_CLI_VERSIONS[number];
+export type NodeVersionFromUser = (typeof WELL_KNOWN_NODE_VERSIONS)[number];
+export type DenoVersionFromUser = (typeof WELL_KNOWN_DENO_VERSIONS)[number];
+export type CliVersionFromUser = (typeof WELL_KNOWN_CLI_VERSIONS)[number];
/**
* Result of CI skip check for a specific Node version.
@@ -30,7 +34,11 @@ export interface SkipInCI {
* Includes skip state for CI mode.
*/
export type NodeVersionMeta =
- | { kind: 'static'; value: Exclude<typeof WELL_KNOWN_NODE_VERSIONS[number], 'current'>; skip: SkipInCI }
+ | {
+ kind: 'static';
+ value: Exclude<(typeof WELL_KNOWN_NODE_VERSIONS)[number], 'current'>;
+ skip: SkipInCI;
+ }
| { kind: 'overridden'; value: string; skip: SkipInCI }
| { kind: 'current'; value: string; skip: SkipInCI };
@@ -39,7 +47,11 @@ export type NodeVersionMeta =
* Includes skip state for CI mode.
*/
export type DenoVersionMeta =
- | { kind: 'static'; value: Exclude<typeof WELL_KNOWN_DENO_VERSIONS[number], 'current'>; skip: SkipInCI }
+ | {
+ kind: 'static';
+ value: Exclude<(typeof WELL_KNOWN_DENO_VERSIONS)[number], 'current'>;
+ skip: SkipInCI;
+ }
| { kind: 'overridden'; value: string; skip: SkipInCI }
| { kind: 'current'; value: string; skip: SkipInCI };
@@ -128,7 +140,10 @@ export interface DefineTestsContext {
/** Run an arbitrary command in the Docker container */
runCmd: {
<const C extends string>(command: NonEmptyString<C>): Promise<E2ETestResult>;
- <const C extends string, const F extends string>(options: { command: NonEmptyString<C>; files: NonEmptyArray<F> }): Promise<E2ETestResultWithFiles<F>>;
+ <const C extends string, const F extends string>(options: {
+ command: NonEmptyString<C>;
+ files: NonEmptyArray<F>;
+ }): Promise<E2ETestResultWithFiles<F>>;
};
/**
* Run a fixture file with Node.js.
diff --git a/ts/e2e-tests/runtimes/node/cjs-basic/README.md b/ts/e2e-tests/runtimes/node/cjs-basic/README.md
index 8d46d565a..07cf8f1ad 100644
--- a/ts/e2e-tests/runtimes/node/cjs-basic/README.md
+++ b/ts/e2e-tests/runtimes/node/cjs-basic/README.md
@@ -1,43 +1,37 @@
-# Node.js CommonJS Compatibility Test
+# Node.js CommonJS require(esm) Interop Test
-Verifies that `@composio/core` works correctly when imported via `require()` in CommonJS environments.
+Verifies that `@composio/core` can still be loaded from a CommonJS caller on Node.js 22 through Node's native `require(esm)` support, without Composio publishing CommonJS artifacts.
## Why This Exists
-Many Node.js projects still use CommonJS. This suite ensures:
+The TypeScript SDK packages are ESM-only. This suite ensures:
-- `require('@composio/core')` resolves without errors
-- All public exports are accessible
-- Classes can be instantiated
-- No ESM-only syntax leaks into CJS builds
+- `require('@composio/core')` works on Node.js 22, 24, and 25.
+- `require.resolve('@composio/core')` resolves to `dist/index.mjs`, not a `.cjs` artifact.
+- The main public exports remain available through Node's native CommonJS-to-ESM interop.
## What It Tests
-| Test | Description |
-| --------------------- | ----------------------------------------- |
-| Basic require | `require('@composio/core')` doesn't throw |
-| Composio class | Main class is exported and constructible |
-| OpenAIProvider | Provider class exports and instantiation |
-| AuthScheme | Auth enum is accessible |
-| ComposioError | Error classes are exported |
-| jsonSchemaToZodSchema | Utility function is exported |
-| constants | Constants namespace is accessible |
-| logger | Logger instance is exported |
+| Test | Description |
+| --------------------- | ----------------------------------------------------- |
+| require(esm) support | Node exposes native `process.features.require_module` |
+| Entry resolution | `@composio/core` resolves to `dist/index.mjs` |
+| CommonJS require | `require('@composio/core')` doesn't throw |
+| Composio class | Main class is exported and constructible |
+| OpenAIProvider | Provider class exports and instantiation |
+| AuthScheme | Auth enum is accessible |
+| ComposioError | Error classes are exported |
+| jsonSchemaToZodSchema | Utility function is exported |
+| constants | Constants namespace is accessible |
+| logger | Logger instance is exported |
## Fixture
```
fixtures/
-└── test.cjs # CommonJS test script using require()
+└── test.cjs # CommonJS script using require('@composio/core')
```
-The fixture is a standalone `.cjs` file that:
-
-- Uses `require('@composio/core')` to import the package
-- Verifies each export exists and has the correct type
-- Attempts to instantiate `OpenAIProvider` to catch runtime errors
-- Outputs test results to stdout with pass/fail markers
-
## Isolation Tool
**Docker** with Node.js versions: 22.22.3, 24.16.0, 25.9.0.
diff --git a/ts/e2e-tests/runtimes/node/cjs-basic/e2e.test.ts b/ts/e2e-tests/runtimes/node/cjs-basic/e2e.test.ts
index 5c87785a0..fc15c815a 100644
--- a/ts/e2e-tests/runtimes/node/cjs-basic/e2e.test.ts
+++ b/ts/e2e-tests/runtimes/node/cjs-basic/e2e.test.ts
@@ -1,7 +1,8 @@
/**
- * CommonJS compatibility e2e test
+ * CommonJS require(esm) interop e2e test.
*
- * Verifies that @composio/core can be imported using require() in Node.js.
+ * Verifies that Node.js 22 can require @composio/core through its native
+ * require(esm) support without us publishing CommonJS artifacts.
*/
import { e2e, type E2ETestResult } from '@e2e-tests/utils';
@@ -20,49 +21,57 @@ e2e(import.meta.url, {
result = await runFixture({ filename: 'test.cjs' });
}, TIMEOUTS.FIXTURE);
- describe('CommonJS compatibility', () => {
+ describe('CommonJS require(esm) interop', () => {
it('exits successfully', () => {
expect(result.exitCode).toBe(0);
});
+ it('uses Node.js native require(esm)', () => {
+ expect(result.stdout).toContain('Test 1 passed: require(esm) is available');
+ });
+
+ it('resolves the ESM entrypoint', () => {
+ expect(result.stdout).toContain('Test 2 passed: resolved ESM entrypoint');
+ });
+
it('require() succeeds', () => {
- expect(result.stdout).toContain('Test 1 passed: require() succeeded');
+ expect(result.stdout).toContain('Test 3 passed: require() succeeded');
});
it('exports Composio class', () => {
- expect(result.stdout).toContain('Test 2 passed: Composio class is exported');
+ expect(result.stdout).toContain('Test 4 passed: Composio class is exported');
});
it('exports OpenAIProvider class', () => {
- expect(result.stdout).toContain('Test 3 passed: OpenAIProvider class is exported');
+ expect(result.stdout).toContain('Test 5 passed: OpenAIProvider class is exported');
});
it('instantiates OpenAIProvider successfully', () => {
- expect(result.stdout).toContain('Test 4 passed: OpenAIProvider instantiated successfully');
+ expect(result.stdout).toContain('Test 6 passed: OpenAIProvider instantiated successfully');
});
it('exports AuthScheme', () => {
- expect(result.stdout).toContain('Test 5 passed: AuthScheme is exported');
+ expect(result.stdout).toContain('Test 7 passed: AuthScheme is exported');
});
it('exports Error classes', () => {
- expect(result.stdout).toContain('Test 6 passed: Error classes are exported');
+ expect(result.stdout).toContain('Test 8 passed: Error classes are exported');
});
it('exports jsonSchemaToZodSchema', () => {
- expect(result.stdout).toContain('Test 7 passed: jsonSchemaToZodSchema is exported');
+ expect(result.stdout).toContain('Test 9 passed: jsonSchemaToZodSchema is exported');
});
it('exports constants namespace', () => {
- expect(result.stdout).toContain('Test 8 passed: constants namespace is exported');
+ expect(result.stdout).toContain('Test 10 passed: constants namespace is exported');
});
it('exports logger', () => {
- expect(result.stdout).toContain('Test 9 passed: logger is exported');
+ expect(result.stdout).toContain('Test 11 passed: logger is exported');
});
it('completes all tests', () => {
- expect(result.stdout).toContain('All CommonJS compatibility tests passed!');
+ expect(result.stdout).toContain('All CommonJS require(esm) interop tests passed!');
});
});
},
diff --git a/ts/e2e-tests/runtimes/node/cjs-basic/fixtures/test.cjs b/ts/e2e-tests/runtimes/node/cjs-basic/fixtures/test.cjs
index a16f066a1..700c5db40 100644
--- a/ts/e2e-tests/runtimes/node/cjs-basic/fixtures/test.cjs
+++ b/ts/e2e-tests/runtimes/node/cjs-basic/fixtures/test.cjs
@@ -1,77 +1,97 @@
/**
- * CommonJS compatibility test for @composio/core
- * This test verifies that the package can be imported using require() in Node.js
+ * CommonJS require(esm) interop test for @composio/core.
+ *
+ * This fixture intentionally uses CommonJS syntax while resolving the ESM-only
+ * package entrypoint through Node.js 22 native require(esm) support.
*/
'use strict';
const assert = require('node:assert');
+const path = require('node:path');
-console.log('🧪 Testing CommonJS compatibility for @composio/core...\n');
+console.log('Testing CommonJS require(esm) interop for @composio/core...\n');
-// Test 1: Basic require() works
-console.log('Test 1: require("@composio/core") should not throw...');
+console.log('Test 1: Node.js require(esm) support should be available...');
+assert.strictEqual(
+ process.features.require_module,
+ true,
+ 'Node.js require(esm) support should be enabled'
+);
+console.log('Test 1 passed: require(esm) is available\n');
+
+console.log('Test 2: require.resolve("@composio/core") should use the ESM entrypoint...');
+const resolvedPath = require.resolve('@composio/core');
+const normalizedPath = resolvedPath.split(path.sep).join('/');
+assert.ok(
+ normalizedPath.endsWith('/dist/index.mjs'),
+ `Expected @composio/core to resolve to dist/index.mjs, got ${resolvedPath}`
+);
+assert.ok(!normalizedPath.endsWith('.cjs'), `Expected no CJS artifact, got ${resolvedPath}`);
+console.log('Test 2 passed: resolved ESM entrypoint\n');
+
+console.log('Test 3: require("@composio/core") should not throw...');
let composioModule;
try {
composioModule = require('@composio/core');
- console.log('✅ Test 1 passed: require() succeeded\n');
+ console.log('Test 3 passed: require() succeeded\n');
} catch (error) {
- console.error('❌ Test 1 failed: require() threw an error');
+ console.error('Test 3 failed: require() threw an error');
console.error(error);
process.exit(1);
}
-// Test 2: Composio class is exported
-console.log('Test 2: Composio class should be exported...');
+console.log('Test 4: Composio class should be exported...');
assert.ok(composioModule.Composio, 'Composio class should be exported');
assert.strictEqual(typeof composioModule.Composio, 'function', 'Composio should be a constructor');
-console.log('✅ Test 2 passed: Composio class is exported\n');
+console.log('Test 4 passed: Composio class is exported\n');
-// Test 3: OpenAIProvider class is exported
-console.log('Test 3: OpenAIProvider class should be exported...');
+console.log('Test 5: OpenAIProvider class should be exported...');
assert.ok(composioModule.OpenAIProvider, 'OpenAIProvider class should be exported');
-assert.strictEqual(typeof composioModule.OpenAIProvider, 'function', 'OpenAIProvider should be a constructor');
-console.log('✅ Test 3 passed: OpenAIProvider class is exported\n');
+assert.strictEqual(
+ typeof composioModule.OpenAIProvider,
+ 'function',
+ 'OpenAIProvider should be a constructor'
+);
+console.log('Test 5 passed: OpenAIProvider class is exported\n');
-// Test 4: Can instantiate OpenAIProvider (doesn't require API key)
-console.log('Test 4: OpenAIProvider should be instantiable...');
+console.log('Test 6: OpenAIProvider should be instantiable...');
try {
const provider = new composioModule.OpenAIProvider();
assert.ok(provider, 'Provider instance should exist');
- console.log('✅ Test 4 passed: OpenAIProvider instantiated successfully\n');
+ console.log('Test 6 passed: OpenAIProvider instantiated successfully\n');
} catch (error) {
- console.error('❌ Test 4 failed: Could not instantiate OpenAIProvider');
+ console.error('Test 6 failed: Could not instantiate OpenAIProvider');
console.error(error);
process.exit(1);
}
-// Test 5: AuthScheme is exported
-console.log('Test 5: AuthScheme should be exported...');
+console.log('Test 7: AuthScheme should be exported...');
assert.ok(composioModule.AuthScheme, 'AuthScheme should be exported');
-console.log('✅ Test 5 passed: AuthScheme is exported\n');
+console.log('Test 7 passed: AuthScheme is exported\n');
-// Test 6: Error classes are exported
-console.log('Test 6: Error classes should be exported...');
+console.log('Test 8: Error classes should be exported...');
assert.ok(composioModule.ComposioError, 'ComposioError should be exported');
-console.log('✅ Test 6 passed: Error classes are exported\n');
+console.log('Test 8 passed: Error classes are exported\n');
-// Test 7: jsonSchemaToZodSchema utility is exported
-console.log('Test 7: jsonSchemaToZodSchema should be exported...');
+console.log('Test 9: jsonSchemaToZodSchema should be exported...');
assert.ok(composioModule.jsonSchemaToZodSchema, 'jsonSchemaToZodSchema should be exported');
-assert.strictEqual(typeof composioModule.jsonSchemaToZodSchema, 'function', 'jsonSchemaToZodSchema should be a function');
-console.log('✅ Test 7 passed: jsonSchemaToZodSchema is exported\n');
+assert.strictEqual(
+ typeof composioModule.jsonSchemaToZodSchema,
+ 'function',
+ 'jsonSchemaToZodSchema should be a function'
+);
+console.log('Test 9 passed: jsonSchemaToZodSchema is exported\n');
-// Test 8: constants namespace is exported
-console.log('Test 8: constants namespace should be exported...');
+console.log('Test 10: constants namespace should be exported...');
assert.ok(composioModule.constants, 'constants should be exported');
-console.log('✅ Test 8 passed: constants namespace is exported\n');
+console.log('Test 10 passed: constants namespace is exported\n');
-// Test 9: logger is exported
-console.log('Test 9: logger should be exported...');
+console.log('Test 11: logger should be exported...');
assert.ok(composioModule.logger, 'logger should be exported');
-console.log('✅ Test 9 passed: logger is exported\n');
+console.log('Test 11 passed: logger is exported\n');
console.log('========================================');
-console.log('🎉 All CommonJS compatibility tests passed!');
+console.log('All CommonJS require(esm) interop tests passed!');
console.log('========================================');
process.exit(0);
diff --git a/ts/e2e-tests/runtimes/node/esm-basic/README.md b/ts/e2e-tests/runtimes/node/esm-basic/README.md
index d92147092..a6bde47da 100644
--- a/ts/e2e-tests/runtimes/node/esm-basic/README.md
+++ b/ts/e2e-tests/runtimes/node/esm-basic/README.md
@@ -9,7 +9,7 @@ ESM is the modern JavaScript module standard. This suite ensures:
- `import('@composio/core')` resolves without errors
- Named imports work (`import { Composio } from '@composio/core'`)
- All public exports are accessible
-- No CJS-only patterns break ESM consumers
+- The ESM-only package entrypoints resolve correctly
## What It Tests
diff --git a/ts/e2e-tests/runtimes/node/file-roundtrip/README.md b/ts/e2e-tests/runtimes/node/file-roundtrip/README.md
index d5709b90b..81c04ed6c 100644
--- a/ts/e2e-tests/runtimes/node/file-roundtrip/README.md
+++ b/ts/e2e-tests/runtimes/node/file-roundtrip/README.md
@@ -31,7 +31,7 @@ If `COMPOSIO_API_KEY` is not set, the suite is skipped.
## Isolation Tool
-**Docker** with Node.js versions: current (as specified in `mise.toml`).
+**Docker** with Node.js versions: 22.22.3, 24.16.0, 25.9.0.
This ensures the behavior is tested against specific Node.js versions independent of the developer's local setup.
diff --git a/ts/e2e-tests/runtimes/node/file-roundtrip/e2e.test.ts b/ts/e2e-tests/runtimes/node/file-roundtrip/e2e.test.ts
index a6f20709e..9dcc2cf71 100644
--- a/ts/e2e-tests/runtimes/node/file-roundtrip/e2e.test.ts
+++ b/ts/e2e-tests/runtimes/node/file-roundtrip/e2e.test.ts
@@ -8,7 +8,7 @@ declare module 'bun' {
}
e2e(import.meta.url, {
- versions: { node: ['current'] },
+ versions: { node: ['22.22.3', '24.16.0', '25.9.0'] },
usesFixtures: true,
env: {
COMPOSIO_API_KEY: Bun.env.COMPOSIO_API_KEY,
diff --git a/ts/e2e-tests/runtimes/node/json-schema-to-zod-v3/README.md b/ts/e2e-tests/runtimes/node/json-schema-to-zod-v3/README.md
index 86750d877..7227b8ac9 100644
--- a/ts/e2e-tests/runtimes/node/json-schema-to-zod-v3/README.md
+++ b/ts/e2e-tests/runtimes/node/json-schema-to-zod-v3/README.md
@@ -36,7 +36,7 @@ Tests use `bun:test` assertions to verify schema conversion and round-trip behav
## Isolation Tool
-**Docker** with Node.js versions: current (as specified in `mise.toml`).
+**Docker** with Node.js versions: 22.22.3, 24.16.0, 25.9.0.
## Running
diff --git a/ts/e2e-tests/runtimes/node/json-schema-to-zod-v3/e2e.test.ts b/ts/e2e-tests/runtimes/node/json-schema-to-zod-v3/e2e.test.ts
index e654380d3..3ac1c8795 100644
--- a/ts/e2e-tests/runtimes/node/json-schema-to-zod-v3/e2e.test.ts
+++ b/ts/e2e-tests/runtimes/node/json-schema-to-zod-v3/e2e.test.ts
@@ -11,7 +11,7 @@ import { describe, it, expect } from 'bun:test';
import zodToJsonSchema from 'zod-to-json-schema';
e2e(import.meta.url, {
- versions: { node: ['current'] },
+ versions: { node: ['22.22.3', '24.16.0', '25.9.0'] },
defineTests: () => {
describe('json-schema-to-zod with Zod v3', () => {
describe('Basic functionality', () => {
diff --git a/ts/e2e-tests/runtimes/node/json-schema-to-zod-v4/README.md b/ts/e2e-tests/runtimes/node/json-schema-to-zod-v4/README.md
index fa400737a..6e0423ff9 100644
--- a/ts/e2e-tests/runtimes/node/json-schema-to-zod-v4/README.md
+++ b/ts/e2e-tests/runtimes/node/json-schema-to-zod-v4/README.md
@@ -37,7 +37,7 @@ Tests use `bun:test` assertions to verify schema conversion and parsing behavior
## Isolation Tool
-**Docker** with Node.js versions: current (as specified in `mise.toml`).
+**Docker** with Node.js versions: 22.22.3, 24.16.0, 25.9.0.
## Running
diff --git a/ts/e2e-tests/runtimes/node/json-schema-to-zod-v4/e2e.test.ts b/ts/e2e-tests/runtimes/node/json-schema-to-zod-v4/e2e.test.ts
index 1e162205a..d7f1a3fa5 100644
--- a/ts/e2e-tests/runtimes/node/json-schema-to-zod-v4/e2e.test.ts
+++ b/ts/e2e-tests/runtimes/node/json-schema-to-zod-v4/e2e.test.ts
@@ -10,7 +10,7 @@ import { e2e } from '@e2e-tests/utils';
import { describe, it, expect } from 'bun:test';
e2e(import.meta.url, {
- versions: { node: ['current'] },
+ versions: { node: ['22.22.3', '24.16.0', '25.9.0'] },
defineTests: () => {
describe('json-schema-to-zod with Zod v4', () => {
describe('Basic functionality', () => {
diff --git a/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/README.md b/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/README.md
index 0d446e30e..f8d18b373 100644
--- a/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/README.md
+++ b/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/README.md
@@ -55,7 +55,7 @@ The fixture script:
## Isolation Tool
-**Docker** with Node.js versions: current (as specified in `mise.toml`).
+**Docker** with Node.js versions: 22.22.3, 24.16.0, 25.9.0.
## Running
diff --git a/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/e2e.test.ts b/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/e2e.test.ts
index c5039d441..bb991646d 100644
--- a/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/e2e.test.ts
+++ b/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/e2e.test.ts
@@ -9,7 +9,7 @@ import { e2e, type E2ETestResult } from '@e2e-tests/utils';
import { describe, it, expect, beforeAll } from 'bun:test';
e2e(import.meta.url, {
- versions: { node: ['current'] },
+ versions: { node: ['22.22.3', '24.16.0', '25.9.0'] },
defineTests: ({ runFixture }) => {
let result: E2ETestResult;
diff --git a/ts/examples/anthropic/package.json b/ts/examples/anthropic/package.json
index 2cbca5256..36445c49f 100644
--- a/ts/examples/anthropic/package.json
+++ b/ts/examples/anthropic/package.json
@@ -13,7 +13,6 @@
"keywords": [],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"dependencies": {
"@anthropic-ai/sdk": "^0.71.0",
"@anthropic-ai/claude-agent-sdk": "^0.1.9",
diff --git a/ts/examples/cjs/README.md b/ts/examples/cjs/README.md
deleted file mode 100644
index 6895bb1b7..000000000
--- a/ts/examples/cjs/README.md
+++ /dev/null
@@ -1,31 +0,0 @@
-# CJS Example
-
-This example demonstrates how to use Composio SDK with CommonJS.
-
-## Setup
-
-1. **Install dependencies:**
- ```bash
- pnpm install
- ```
-
-2. **Configure environment:**
- ```bash
- cp .env.example .env
- ```
-
- Then edit `.env` and add your API keys:
- - `COMPOSIO_API_KEY`: Get it from [Composio Dashboard](https://app.composio.dev)
-
-## Running the Example
-
-```bash
-# Run the example
-pnpm start
-```
-
-## Support
-
-- [Documentation](https://docs.composio.dev)
-- [Discord Community](https://discord.gg/composio)
-- [GitHub Issues](https://github.com/composio/composio/issues)
diff --git a/ts/examples/cjs/package.json b/ts/examples/cjs/package.json
deleted file mode 100644
index 0e6219712..000000000
--- a/ts/examples/cjs/package.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "name": "cjs-example",
- "type": "commonjs",
- "private": true,
- "version": "0.1.0",
- "description": "Example project for CommonJS",
- "main": "src/index.ts",
- "scripts": {
- "start": "node ./src/index.cjs"
- },
- "keywords": ["composio", "example", "cjs"],
- "author": "",
- "license": "ISC",
- "packageManager": "[email protected]",
- "dependencies": {
- "@composio/core": "workspace:*",
- "dotenv": "^16.4.1"
- },
- "devDependencies": {
- "@types/bun": "^1.2.9",
- "typescript": "catalog:"
- }
-}
diff --git a/ts/examples/cjs/src/index.cjs b/ts/examples/cjs/src/index.cjs
deleted file mode 100644
index 99e49e0a3..000000000
--- a/ts/examples/cjs/src/index.cjs
+++ /dev/null
@@ -1,20 +0,0 @@
-const { Composio } = require('@composio/core');
-require('dotenv/config');
-
-const composio = new Composio({
- apiKey: process.env.COMPOSIO_API_KEY,
-});
-
-async function main() {
- console.log('Fetching tools enum...');
-
- const tools = await composio.tools.getToolsEnum();
-
- console.log('Tools enum fetched:', tools.items.length);
-}
-
-main()
- .catch(e => {
- console.error(e);
- process.exit(1);
- })
diff --git a/ts/examples/cjs/tsconfig.json b/ts/examples/cjs/tsconfig.json
deleted file mode 100644
index f736a53ab..000000000
--- a/ts/examples/cjs/tsconfig.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "compilerOptions": {
- "target": "es2022",
- "module": "esnext",
- "declaration": true,
- "declarationDir": "./dist",
- "outDir": "./dist",
- "rootDir": "./src",
- "strict": true,
- "esModuleInterop": true,
- "moduleResolution": "bundler",
- "skipLibCheck": true,
- "resolveJsonModule": true
- },
- "include": ["src"]
-}
diff --git a/ts/examples/cloudflare-wrangler/package.json b/ts/examples/cloudflare-wrangler/package.json
index 8e9ffbdcd..fb37f367a 100644
--- a/ts/examples/cloudflare-wrangler/package.json
+++ b/ts/examples/cloudflare-wrangler/package.json
@@ -2,7 +2,6 @@
"name": "cloudflare-wrangler-example",
"version": "0.0.0",
"private": true,
- "packageManager": "[email protected]",
"scripts": {
"deploy": "wrangler deploy",
"dev": "wrangler dev",
diff --git a/ts/examples/connected-accounts/package.json b/ts/examples/connected-accounts/package.json
index 750b6dd1e..10a049b2a 100644
--- a/ts/examples/connected-accounts/package.json
+++ b/ts/examples/connected-accounts/package.json
@@ -12,7 +12,6 @@
"keywords": [],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"dependencies": {
"@composio/core": "workspace:*",
"openai": "catalog:"
diff --git a/ts/examples/error-handling-demo/package.json b/ts/examples/error-handling-demo/package.json
index bd2c5f14c..93c31b892 100644
--- a/ts/examples/error-handling-demo/package.json
+++ b/ts/examples/error-handling-demo/package.json
@@ -12,7 +12,6 @@
"keywords": [],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"dependencies": {
"@composio/core": "workspace:*",
"dotenv": "^16.5.0"
diff --git a/ts/examples/file-handling/package.json b/ts/examples/file-handling/package.json
index f45e4dbd2..6452e6768 100644
--- a/ts/examples/file-handling/package.json
+++ b/ts/examples/file-handling/package.json
@@ -9,10 +9,13 @@
"dev": "bun --watch src/index.ts",
"test": "echo \"Error: no test specified\" && exit 1"
},
- "keywords": ["composio", "example", "file-handling"],
+ "keywords": [
+ "composio",
+ "example",
+ "file-handling"
+ ],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"dependencies": {
"@composio/core": "workspace:*",
"dotenv": "^16.4.1"
diff --git a/ts/examples/google/package.json b/ts/examples/google/package.json
index 84423bdc0..f33b6e7db 100644
--- a/ts/examples/google/package.json
+++ b/ts/examples/google/package.json
@@ -19,7 +19,6 @@
],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"dependencies": {
"@composio/core": "workspace:*",
"@composio/google": "workspace:*",
diff --git a/ts/examples/json-schema-to-zod/package.json b/ts/examples/json-schema-to-zod/package.json
index aa7d33378..26e65bf96 100644
--- a/ts/examples/json-schema-to-zod/package.json
+++ b/ts/examples/json-schema-to-zod/package.json
@@ -17,7 +17,6 @@
],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"dependencies": {
"@composio/core": "workspace:*",
"@composio/vercel": "workspace:^",
diff --git a/ts/examples/langchain/package.json b/ts/examples/langchain/package.json
index 79b6b864f..69135dc00 100644
--- a/ts/examples/langchain/package.json
+++ b/ts/examples/langchain/package.json
@@ -12,7 +12,6 @@
"keywords": [],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"dependencies": {
"@composio/core": "workspace:*",
"@composio/langchain": "workspace:*",
diff --git a/ts/examples/llamaindex/package.json b/ts/examples/llamaindex/package.json
index 0d41152b2..de8add6b8 100644
--- a/ts/examples/llamaindex/package.json
+++ b/ts/examples/llamaindex/package.json
@@ -16,7 +16,6 @@
],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"dependencies": {
"@composio/core": "workspace:*",
"@composio/llamaindex": "workspace:*",
diff --git a/ts/examples/mastra/package.json b/ts/examples/mastra/package.json
index d48e6595d..36ef738c1 100644
--- a/ts/examples/mastra/package.json
+++ b/ts/examples/mastra/package.json
@@ -22,7 +22,6 @@
],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"dependencies": {
"@ai-sdk/openai": "^3.0.13",
"@composio/core": "workspace:*",
diff --git a/ts/examples/mcp/package.json b/ts/examples/mcp/package.json
index bbf05f73f..8460a34b0 100644
--- a/ts/examples/mcp/package.json
+++ b/ts/examples/mcp/package.json
@@ -16,7 +16,6 @@
],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"dependencies": {
"@ai-sdk/openai": "^2.0.35",
"@composio/core": "workspace:*",
diff --git a/ts/examples/modifiers/package.json b/ts/examples/modifiers/package.json
index cfd43740a..1ceb32a24 100644
--- a/ts/examples/modifiers/package.json
+++ b/ts/examples/modifiers/package.json
@@ -12,7 +12,6 @@
"keywords": [],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"dependencies": {
"@ai-sdk/openai": "^1.3.16",
"@composio/core": "workspace:*",
diff --git a/ts/examples/openai/package.json b/ts/examples/openai/package.json
index 8085924c6..b02843fd3 100644
--- a/ts/examples/openai/package.json
+++ b/ts/examples/openai/package.json
@@ -17,7 +17,6 @@
"keywords": [],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"dependencies": {
"@composio/core": "workspace:*",
"@composio/openai": "workspace:*",
diff --git a/ts/examples/session-management/package.json b/ts/examples/session-management/package.json
index aa09f2890..61c9e9454 100644
--- a/ts/examples/session-management/package.json
+++ b/ts/examples/session-management/package.json
@@ -10,10 +10,13 @@
"dev": "bun --watch src/index.ts",
"test": "echo \"Error: no test specified\" && exit 1"
},
- "keywords": ["composio", "example", "session-management"],
+ "keywords": [
+ "composio",
+ "example",
+ "session-management"
+ ],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"dependencies": {
"@composio/core": "workspace:*",
"dotenv": "^16.4.1"
diff --git a/ts/examples/tool-router/package.json b/ts/examples/tool-router/package.json
index 63d063c9e..c91436574 100644
--- a/ts/examples/tool-router/package.json
+++ b/ts/examples/tool-router/package.json
@@ -18,7 +18,6 @@
],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"dependencies": {
"@ai-sdk/mcp": "^0.0.11",
"@ai-sdk/openai": "^3.0.11",
diff --git a/ts/examples/toolkits/package.json b/ts/examples/toolkits/package.json
index a9c160799..0feef3d98 100644
--- a/ts/examples/toolkits/package.json
+++ b/ts/examples/toolkits/package.json
@@ -12,7 +12,6 @@
"keywords": [],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"dependencies": {
"@ai-sdk/openai": "^1.3.16",
"@composio/core": "workspace:*",
diff --git a/ts/examples/tools/package.json b/ts/examples/tools/package.json
index f38afbdab..2c6e158b1 100644
--- a/ts/examples/tools/package.json
+++ b/ts/examples/tools/package.json
@@ -16,7 +16,6 @@
],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"dependencies": {
"@ai-sdk/openai": "^3.0.12",
"@composio/core": "workspace:*",
diff --git a/ts/examples/triggers/package.json b/ts/examples/triggers/package.json
index 4ac049276..fb423e970 100644
--- a/ts/examples/triggers/package.json
+++ b/ts/examples/triggers/package.json
@@ -11,10 +11,13 @@
"webhook:server": "bun src/webhook-server.ts",
"test": "echo \"Error: no test specified\" && exit 1"
},
- "keywords": ["composio", "example", "triggers"],
+ "keywords": [
+ "composio",
+ "example",
+ "triggers"
+ ],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"dependencies": {
"@composio/core": "workspace:*",
"dotenv": "^16.4.1"
diff --git a/ts/examples/vercel/package.json b/ts/examples/vercel/package.json
index eb027440b..d54fbb720 100644
--- a/ts/examples/vercel/package.json
+++ b/ts/examples/vercel/package.json
@@ -14,7 +14,6 @@
"keywords": [],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"dependencies": {
"@ai-sdk/mcp": "^1.0.1",
"@ai-sdk/openai": "^3.0.11",
diff --git a/ts/examples/versioning/package.json b/ts/examples/versioning/package.json
index a205e20b9..3b487ee30 100644
--- a/ts/examples/versioning/package.json
+++ b/ts/examples/versioning/package.json
@@ -9,10 +9,13 @@
"dev": "bun --watch src/index.ts",
"test": "echo \"Error: no test specified\" && exit 1"
},
- "keywords": ["composio", "example", "versioning"],
+ "keywords": [
+ "composio",
+ "example",
+ "versioning"
+ ],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"dependencies": {
"@composio/core": "workspace:*",
"dotenv": "^16.4.1"
diff --git a/ts/packages/cli-keyring/package.json b/ts/packages/cli-keyring/package.json
index 88fb13592..9af2cd2e6 100644
--- a/ts/packages/cli-keyring/package.json
+++ b/ts/packages/cli-keyring/package.json
@@ -17,32 +17,12 @@
},
"exports": {
".": {
- "import": {
- "types": "./dist/index.d.mts",
- "default": "./dist/index.mjs"
- },
- "require": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- },
- "default": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- }
+ "types": "./dist/index.d.mts",
+ "default": "./dist/index.mjs"
},
"./effect": {
- "import": {
- "types": "./dist/effect.d.mts",
- "default": "./dist/effect.mjs"
- },
- "require": {
- "types": "./dist/effect.d.cts",
- "default": "./dist/effect.cjs"
- },
- "default": {
- "types": "./dist/effect.d.cts",
- "default": "./dist/effect.cjs"
- }
+ "types": "./dist/effect.d.mts",
+ "default": "./dist/effect.mjs"
}
},
"files": [
@@ -70,7 +50,6 @@
],
"author": "Composio",
"license": "ISC",
- "packageManager": "[email protected]",
"devDependencies": {
"@types/node": "^24.0.1",
"bun-types": "^1.3.11",
diff --git a/ts/packages/cli-keyring/tsdown.config.ts b/ts/packages/cli-keyring/tsdown.config.ts
index bfbbdca73..c2b8b1331 100644
--- a/ts/packages/cli-keyring/tsdown.config.ts
+++ b/ts/packages/cli-keyring/tsdown.config.ts
@@ -5,9 +5,8 @@ export default defineConfig({
...baseConfig,
entry: ['src/index.ts', 'src/effect.ts'],
tsconfig: 'tsconfig.src.json',
- // bun:ffi is a Bun built-in; in the Node/CJS output it must remain
- // an unresolved import so Node never tries to load the FFI backend
- // chunk at startup. The runtime branch in stores/macos-security.ts
+ // bun:ffi is a Bun built-in. Keep it external so Node never tries to
+ // load the FFI backend chunk at startup; stores/macos-security.ts
// guards `isBun` before reaching the dynamic import.
external: [...baseConfig.external, /^bun:/],
});
diff --git a/ts/packages/cli-local-tools/package.json b/ts/packages/cli-local-tools/package.json
index 9276f1143..9447d1b4a 100644
--- a/ts/packages/cli-local-tools/package.json
+++ b/ts/packages/cli-local-tools/package.json
@@ -9,18 +9,8 @@
"types": "dist/index.d.mts",
"exports": {
".": {
- "import": {
- "types": "./dist/index.d.mts",
- "default": "./dist/index.mjs"
- },
- "require": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- },
- "default": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- }
+ "types": "./dist/index.d.mts",
+ "default": "./dist/index.mjs"
}
},
"repository": {
diff --git a/ts/packages/cli/package.json b/ts/packages/cli/package.json
index 431299beb..41b332c2b 100644
--- a/ts/packages/cli/package.json
+++ b/ts/packages/cli/package.json
@@ -56,7 +56,6 @@
],
"author": "Alberto Schiabel <[email protected]> (https://github.com/jkomyno)",
"license": "ISC",
- "packageManager": "[email protected]",
"devDependencies": {
"@effect/eslint-plugin": "catalog:",
"@effect/language-service": "catalog:",
diff --git a/ts/packages/cli/src/services/env-lang-detector.ts b/ts/packages/cli/src/services/env-lang-detector.ts
index f1c61109f..3d758b997 100644
--- a/ts/packages/cli/src/services/env-lang-detector.ts
+++ b/ts/packages/cli/src/services/env-lang-detector.ts
@@ -75,11 +75,7 @@ export class EnvLangDetector extends Effect.Service<EnvLangDetector>()('services
if (!hasTypescriptIndicator && !hasPythonIndicator) {
// Get actual file names (not lowercase) for extension checking
const hasTypeScriptFiles = files.some(
- file =>
- file.endsWith('.ts') ||
- file.endsWith('.tsx') ||
- file.endsWith('.mts') ||
- file.endsWith('.cts')
+ file => file.endsWith('.ts') || file.endsWith('.tsx') || file.endsWith('.mts')
);
const hasPythonFiles = files.some(
@@ -153,11 +149,7 @@ export class EnvLangDetector extends Effect.Service<EnvLangDetector>()('services
const allFileNames = [...files, ...allFiles];
const deepTsFiles = allFileNames.filter(
- file =>
- file.endsWith('.ts') ||
- file.endsWith('.tsx') ||
- file.endsWith('.mts') ||
- file.endsWith('.cts')
+ file => file.endsWith('.ts') || file.endsWith('.tsx') || file.endsWith('.mts')
).length;
const deepPyFiles = allFileNames.filter(
diff --git a/ts/packages/cli/src/services/project-environment-detector.ts b/ts/packages/cli/src/services/project-environment-detector.ts
index e42c137ba..03d77f882 100644
--- a/ts/packages/cli/src/services/project-environment-detector.ts
+++ b/ts/packages/cli/src/services/project-environment-detector.ts
@@ -106,9 +106,9 @@ const countExtensions = (files: string[]) => {
for (const file of files) {
const ext = path.extname(file).toLowerCase();
- if (ext === '.ts' || ext === '.tsx' || ext === '.mts' || ext === '.cts') {
+ if (ext === '.ts' || ext === '.tsx' || ext === '.mts') {
ts += 1;
- } else if (ext === '.js' || ext === '.jsx' || ext === '.mjs' || ext === '.cjs') {
+ } else if (ext === '.js' || ext === '.jsx' || ext === '.mjs') {
js += 1;
} else if (ext === '.py' || ext === '.pyi' || ext === '.pyw' || ext === '.pyx') {
py += 1;
diff --git a/ts/packages/core/package.json b/ts/packages/core/package.json
index 946add992..c01c55896 100644
--- a/ts/packages/core/package.json
+++ b/ts/packages/core/package.json
@@ -13,80 +13,36 @@
"#platform": {
"workerd": "./dist/platform/workerd.mjs",
"edge-light": "./dist/platform/workerd.mjs",
- "node": {
- "import": "./dist/platform/node.mjs",
- "require": "./dist/platform/node.cjs"
- },
- "default": {
- "import": "./dist/platform/node.mjs",
- "require": "./dist/platform/node.cjs"
- }
+ "node": "./dist/platform/node.mjs",
+ "default": "./dist/platform/node.mjs"
},
"#files": {
"workerd": "./dist/models/Files.workerd.mjs",
"edge-light": "./dist/models/Files.workerd.mjs",
- "node": {
- "import": "./dist/models/Files.node.mjs",
- "require": "./dist/models/Files.node.cjs"
- },
- "default": {
- "import": "./dist/models/Files.node.mjs",
- "require": "./dist/models/Files.node.cjs"
- }
+ "node": "./dist/models/Files.node.mjs",
+ "default": "./dist/models/Files.node.mjs"
},
"#file_tool_modifier": {
"workerd": "./dist/utils/modifiers/FileToolModifier.workerd.mjs",
"edge-light": "./dist/utils/modifiers/FileToolModifier.workerd.mjs",
- "node": {
- "import": "./dist/utils/modifiers/FileToolModifier.node.mjs",
- "require": "./dist/utils/modifiers/FileToolModifier.node.cjs"
- },
- "default": {
- "import": "./dist/utils/modifiers/FileToolModifier.node.mjs",
- "require": "./dist/utils/modifiers/FileToolModifier.node.cjs"
- }
+ "node": "./dist/utils/modifiers/FileToolModifier.node.mjs",
+ "default": "./dist/utils/modifiers/FileToolModifier.node.mjs"
},
"#config_defaults": {
"workerd": "./dist/utils/config-defaults/ConfigDefaults.workerd.mjs",
"edge-light": "./dist/utils/config-defaults/ConfigDefaults.workerd.mjs",
- "node": {
- "import": "./dist/utils/config-defaults/ConfigDefaults.node.mjs",
- "require": "./dist/utils/config-defaults/ConfigDefaults.node.cjs"
- },
- "default": {
- "import": "./dist/utils/config-defaults/ConfigDefaults.node.mjs",
- "require": "./dist/utils/config-defaults/ConfigDefaults.node.cjs"
- }
+ "node": "./dist/utils/config-defaults/ConfigDefaults.node.mjs",
+ "default": "./dist/utils/config-defaults/ConfigDefaults.node.mjs"
}
},
"exports": {
".": {
- "import": {
- "types": "./dist/index.d.mts",
- "default": "./dist/index.mjs"
- },
- "require": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- },
- "default": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- }
+ "types": "./dist/index.d.mts",
+ "default": "./dist/index.mjs"
},
"./experimental": {
- "import": {
- "types": "./dist/experimental/index.d.mts",
- "default": "./dist/experimental/index.mjs"
- },
- "require": {
- "types": "./dist/experimental/index.d.cts",
- "default": "./dist/experimental/index.cjs"
- },
- "default": {
- "types": "./dist/experimental/index.d.cts",
- "default": "./dist/experimental/index.cjs"
- }
+ "types": "./dist/experimental/index.d.mts",
+ "default": "./dist/experimental/index.mjs"
},
"./platform": {
"workerd": {
@@ -98,24 +54,12 @@
"default": "./dist/platform/workerd.mjs"
},
"node": {
- "import": {
- "types": "./dist/platform/node.d.mts",
- "default": "./dist/platform/node.mjs"
- },
- "require": {
- "types": "./dist/platform/node.d.cts",
- "default": "./dist/platform/node.cjs"
- }
+ "types": "./dist/platform/node.d.mts",
+ "default": "./dist/platform/node.mjs"
},
"default": {
- "import": {
- "types": "./dist/platform/node.d.mts",
- "default": "./dist/platform/node.mjs"
- },
- "require": {
- "types": "./dist/platform/node.d.cts",
- "default": "./dist/platform/node.cjs"
- }
+ "types": "./dist/platform/node.d.mts",
+ "default": "./dist/platform/node.mjs"
}
},
"./generated": {
@@ -140,7 +84,6 @@
"keywords": [],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"devDependencies": {
"@type-challenges/utils": "^0.1.1",
"@types/semver": "^7.7.0",
diff --git a/ts/packages/core/src/utils/pusher.ts b/ts/packages/core/src/utils/pusher.ts
index 184598f11..31a16ad1d 100644
--- a/ts/packages/core/src/utils/pusher.ts
+++ b/ts/packages/core/src/utils/pusher.ts
@@ -21,12 +21,6 @@ type PusherClient = {
};
};
-type AuthOptions = {
- endpoint: string;
- headers: Record<string, string>;
- params?: Record<string, string>;
-};
-
type TChunkedTriggerData = {
id: string;
index: number;
@@ -62,40 +56,41 @@ export class PusherUtils {
static async getPusherClient(baseURL: string, apiKey: string): Promise<PusherClient> {
try {
if (!PusherUtils.pusherClient) {
- // Dynamic import not available, using require for now
- // TODO: Update to use dynamic import when available
- // eslint-disable-next-line @typescript-eslint/no-require-imports
- const PusherClient = require('pusher-js');
+ const { default: PusherClient } = await import('pusher-js');
+ const authEndpoint = `${baseURL}/api/v3/internal/sdk/realtime/auth`;
PusherUtils.pusherClient = new PusherClient(PUSHER_KEY, {
cluster: PUSHER_CLUSTER,
channelAuthorization: {
- endpoint: `${baseURL}/api/v3/internal/sdk/realtime/auth`,
- headers: {
- 'x-api-key': apiKey,
- },
+ // `transport` and `endpoint` are required by pusher-js's types but are
+ // unused at runtime: `customHandler` fully owns the auth request below.
transport: 'ajax',
- customHandler: async (authOptions: AuthOptions) => {
- try {
- const response = await fetch(authOptions.endpoint, {
- method: 'POST',
- headers: {
- ...authOptions.headers,
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify(authOptions.params),
+ endpoint: authEndpoint,
+ customHandler: (params, callback) => {
+ fetch(authEndpoint, {
+ method: 'POST',
+ headers: {
+ 'x-api-key': apiKey,
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify({
+ socket_id: params.socketId,
+ channel_name: params.channelName,
+ }),
+ })
+ .then(async response => {
+ const data = await response.text();
+ logger.debug('Pusher auth response:', data);
+ try {
+ callback(null, JSON.parse(data));
+ } catch (e) {
+ logger.error('Failed to parse auth response:', e);
+ callback(new Error('Invalid auth response format'), null);
+ }
+ })
+ .catch((error: unknown) => {
+ logger.error('Pusher auth request failed:', error);
+ callback(error instanceof Error ? error : new Error(String(error)), null);
});
- const data = await response.text();
- logger.debug('Pusher auth response:', data);
- try {
- return JSON.parse(data);
- } catch (e) {
- logger.error('Failed to parse auth response:', e);
- throw new Error('Invalid auth response format');
- }
- } catch (error) {
- logger.error('Pusher auth request failed:', error);
- throw error;
- }
},
},
});
diff --git a/ts/packages/core/test/utils/pusher.test.ts b/ts/packages/core/test/utils/pusher.test.ts
new file mode 100644
index 000000000..588b1976d
--- /dev/null
+++ b/ts/packages/core/test/utils/pusher.test.ts
@@ -0,0 +1,110 @@
+import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
+import { PusherUtils } from '../../src/utils/pusher';
+
+// Capture the options passed to the Pusher constructor so the
+// channelAuthorization.customHandler can be exercised in isolation.
+const { constructorCalls } = vi.hoisted(() => ({
+ constructorCalls: [] as Array<{ key: string; options: Record<string, any> }>,
+}));
+
+vi.mock('pusher-js', () => {
+ class FakePusher {
+ connection = { bind: vi.fn() };
+ subscribe = vi.fn();
+ unsubscribe = vi.fn();
+ bind = vi.fn();
+ constructor(key: string, options: Record<string, any>) {
+ constructorCalls.push({ key, options });
+ }
+ }
+ return { default: FakePusher };
+});
+
+type CustomHandler = (
+ params: { socketId: string; channelName: string },
+ callback: (error: Error | null, data: unknown) => void
+) => void;
+
+const baseURL = 'https://backend.composio.dev';
+const apiKey = 'test-api-key';
+const authEndpoint = `${baseURL}/api/v3/internal/sdk/realtime/auth`;
+
+async function getCustomHandler(): Promise<CustomHandler> {
+ await PusherUtils.getPusherClient(baseURL, apiKey);
+ const { options } = constructorCalls.at(-1)!;
+ return options.channelAuthorization.customHandler as CustomHandler;
+}
+
+describe('PusherUtils channelAuthorization', () => {
+ beforeEach(() => {
+ constructorCalls.length = 0;
+ // Reset the cached singleton so getPusherClient rebuilds the client.
+ (PusherUtils as unknown as { pusherClient?: unknown }).pusherClient = undefined;
+ });
+
+ afterEach(() => {
+ vi.unstubAllGlobals();
+ });
+
+ it('configures the realtime auth endpoint with ajax transport', async () => {
+ await PusherUtils.getPusherClient(baseURL, apiKey);
+ const { options } = constructorCalls.at(-1)!;
+
+ expect(options.channelAuthorization.endpoint).toBe(authEndpoint);
+ expect(options.channelAuthorization.transport).toBe('ajax');
+ expect(typeof options.channelAuthorization.customHandler).toBe('function');
+ });
+
+ it('POSTs socket_id/channel_name as JSON and returns the parsed auth payload', async () => {
+ const authData = { auth: 'app_key:signature' };
+ const fetchMock = vi.fn().mockResolvedValue({ text: async () => JSON.stringify(authData) });
+ vi.stubGlobal('fetch', fetchMock);
+
+ const customHandler = await getCustomHandler();
+ const callback = vi.fn();
+ customHandler({ socketId: '123.456', channelName: 'private-abc' }, callback);
+
+ await vi.waitFor(() => expect(callback).toHaveBeenCalled());
+
+ expect(fetchMock).toHaveBeenCalledWith(
+ authEndpoint,
+ expect.objectContaining({
+ method: 'POST',
+ headers: { 'x-api-key': apiKey, 'Content-Type': 'application/json' },
+ body: JSON.stringify({ socket_id: '123.456', channel_name: 'private-abc' }),
+ })
+ );
+ expect(callback).toHaveBeenCalledWith(null, authData);
+ });
+
+ it('reports an error to the callback when the response is not valid JSON', async () => {
+ const fetchMock = vi.fn().mockResolvedValue({ text: async () => 'not-json' });
+ vi.stubGlobal('fetch', fetchMock);
+
+ const customHandler = await getCustomHandler();
+ const callback = vi.fn();
+ customHandler({ socketId: '1', channelName: 'c' }, callback);
+
+ await vi.waitFor(() => expect(callback).toHaveBeenCalled());
+
+ const [error, data] = callback.mock.calls[0];
+ expect(error).toBeInstanceOf(Error);
+ expect(data).toBeNull();
+ });
+
+ it('reports an error to the callback when the auth request rejects', async () => {
+ const fetchMock = vi.fn().mockRejectedValue(new Error('network down'));
+ vi.stubGlobal('fetch', fetchMock);
+
+ const customHandler = await getCustomHandler();
+ const callback = vi.fn();
+ customHandler({ socketId: '1', channelName: 'c' }, callback);
+
+ await vi.waitFor(() => expect(callback).toHaveBeenCalled());
+
+ const [error, data] = callback.mock.calls[0];
+ expect(error).toBeInstanceOf(Error);
+ expect((error as Error).message).toBe('network down');
+ expect(data).toBeNull();
+ });
+});
diff --git a/ts/packages/core/tsdown.config.ts b/ts/packages/core/tsdown.config.ts
index d08b9f596..ee090dacc 100644
--- a/ts/packages/core/tsdown.config.ts
+++ b/ts/packages/core/tsdown.config.ts
@@ -25,23 +25,6 @@ export default defineConfig({
'src/utils/config-defaults/ConfigDefaults.node.ts',
'src/utils/config-defaults/ConfigDefaults.workerd.ts',
],
- attw: {
- ...baseConfig.attw,
- ignoreRules: [
- ...(baseConfig.attw?.ignoreRules ?? []),
-
- /**
- * We currently need `"type": "module"` in `@composio/core` package.json because:
- * - `@composio/cli` tests rely on it
- * - `@composio/cli` users rely on it
- * This causes issus with `attw`.
- *
- * Ideally, we can drop cjs support altogether in `@composio/core`.
- * Alternatively, we'd need to modify `composio ts generate` so that it generates .mjs files (and not .js).
- */
- 'cjs-resolves-to-esm',
- ],
- },
/**
* We don't want to accidentally bundle `node:*` packages (e.g., `node:module`)
* as not all of them are available in Cloudflare Workers / Vercel Edge runtimes.
diff --git a/ts/packages/json-schema-to-zod/package.json b/ts/packages/json-schema-to-zod/package.json
index b56be2812..e34516976 100644
--- a/ts/packages/json-schema-to-zod/package.json
+++ b/ts/packages/json-schema-to-zod/package.json
@@ -3,6 +3,7 @@
"version": "0.1.20",
"description": "",
"main": "src/index.ts",
+ "type": "module",
"repository": {
"type": "git",
"url": "https://github.com/ComposioHQ/composio.git",
@@ -19,18 +20,8 @@
},
"exports": {
".": {
- "import": {
- "types": "./dist/index.d.mts",
- "default": "./dist/index.mjs"
- },
- "require": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- },
- "default": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- }
+ "types": "./dist/index.d.mts",
+ "default": "./dist/index.mjs"
}
},
"files": [
@@ -51,7 +42,6 @@
"keywords": [],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"devDependencies": {
"@types/json-schema": "^7.0.15",
"@types/node": "^24.0.1",
diff --git a/ts/packages/providers/anthropic/package.json b/ts/packages/providers/anthropic/package.json
index d380fdb40..3733a334c 100644
--- a/ts/packages/providers/anthropic/package.json
+++ b/ts/packages/providers/anthropic/package.json
@@ -3,6 +3,7 @@
"version": "0.9.3",
"description": "Non-Agentic Provider for Anthropic in Composio SDK",
"main": "src/index.ts",
+ "type": "module",
"repository": {
"type": "git",
"url": "https://github.com/ComposioHQ/composio.git",
@@ -19,18 +20,8 @@
},
"exports": {
".": {
- "import": {
- "types": "./dist/index.d.mts",
- "default": "./dist/index.mjs"
- },
- "require": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- },
- "default": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- }
+ "types": "./dist/index.d.mts",
+ "default": "./dist/index.mjs"
}
},
"files": [
@@ -49,7 +40,6 @@
],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"peerDependencies": {
"@anthropic-ai/sdk": "^0.52.0",
"@composio/core": ">=0.10.0 <1.0.0",
diff --git a/ts/packages/providers/claude-agent-sdk/package.json b/ts/packages/providers/claude-agent-sdk/package.json
index fcfa012e8..f301b5d3f 100644
--- a/ts/packages/providers/claude-agent-sdk/package.json
+++ b/ts/packages/providers/claude-agent-sdk/package.json
@@ -3,6 +3,7 @@
"version": "0.9.3",
"description": "Composio provider for Claude Agent SDK",
"main": "src/index.ts",
+ "type": "module",
"repository": {
"type": "git",
"url": "https://github.com/ComposioHQ/composio.git",
@@ -19,18 +20,8 @@
},
"exports": {
".": {
- "import": {
- "types": "./dist/index.d.mts",
- "default": "./dist/index.mjs"
- },
- "require": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- },
- "default": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- }
+ "types": "./dist/index.d.mts",
+ "default": "./dist/index.mjs"
}
},
"files": [
@@ -52,7 +43,6 @@
],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"dependencies": {
"zod": "^3.25.76"
},
diff --git a/ts/packages/providers/cloudflare/package.json b/ts/packages/providers/cloudflare/package.json
index 660ec427e..5b2e24bd6 100644
--- a/ts/packages/providers/cloudflare/package.json
+++ b/ts/packages/providers/cloudflare/package.json
@@ -3,6 +3,7 @@
"version": "0.9.3",
"description": "",
"main": "src/index.ts",
+ "type": "module",
"repository": {
"type": "git",
"url": "https://github.com/ComposioHQ/composio.git",
@@ -19,18 +20,8 @@
},
"exports": {
".": {
- "import": {
- "types": "./dist/index.d.mts",
- "default": "./dist/index.mjs"
- },
- "require": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- },
- "default": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- }
+ "types": "./dist/index.d.mts",
+ "default": "./dist/index.mjs"
}
},
"files": [
@@ -45,7 +36,6 @@
"keywords": [],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"peerDependencies": {
"@cloudflare/workers-types": "catalog:",
"@composio/core": ">=0.10.0 <1.0.0"
diff --git a/ts/packages/providers/google/package.json b/ts/packages/providers/google/package.json
index eb18b7eee..cafd7bb17 100644
--- a/ts/packages/providers/google/package.json
+++ b/ts/packages/providers/google/package.json
@@ -3,6 +3,7 @@
"version": "0.9.3",
"description": "Google GenAI Provider for Composio SDK",
"main": "src/index.ts",
+ "type": "module",
"repository": {
"type": "git",
"url": "https://github.com/ComposioHQ/composio.git",
@@ -19,18 +20,8 @@
},
"exports": {
".": {
- "import": {
- "types": "./dist/index.d.mts",
- "default": "./dist/index.mjs"
- },
- "require": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- },
- "default": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- }
+ "types": "./dist/index.d.mts",
+ "default": "./dist/index.mjs"
}
},
"files": [
@@ -51,7 +42,6 @@
],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"peerDependencies": {
"@composio/core": ">=0.10.0 <1.0.0",
"@google/genai": "^1.1.0"
diff --git a/ts/packages/providers/langchain/package.json b/ts/packages/providers/langchain/package.json
index 5483e7116..aff1dd37e 100644
--- a/ts/packages/providers/langchain/package.json
+++ b/ts/packages/providers/langchain/package.json
@@ -3,6 +3,7 @@
"version": "0.9.3",
"description": "",
"main": "dist/index.js",
+ "type": "module",
"repository": {
"type": "git",
"url": "https://github.com/ComposioHQ/composio.git",
@@ -19,18 +20,8 @@
},
"exports": {
".": {
- "import": {
- "types": "./dist/index.d.mts",
- "default": "./dist/index.mjs"
- },
- "require": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- },
- "default": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- }
+ "types": "./dist/index.d.mts",
+ "default": "./dist/index.mjs"
}
},
"files": [
@@ -45,7 +36,6 @@
"keywords": [],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"peerDependencies": {
"@composio/core": ">=0.10.0 <1.0.0",
"@langchain/core": "^1.1.4"
diff --git a/ts/packages/providers/llamaindex/package.json b/ts/packages/providers/llamaindex/package.json
index 8cc042688..0723aed97 100644
--- a/ts/packages/providers/llamaindex/package.json
+++ b/ts/packages/providers/llamaindex/package.json
@@ -3,6 +3,7 @@
"version": "0.9.3",
"description": "Agentic Provider for llamaindex in Composio SDK",
"main": "src/index.ts",
+ "type": "module",
"repository": {
"type": "git",
"url": "https://github.com/ComposioHQ/composio.git",
@@ -19,18 +20,8 @@
},
"exports": {
".": {
- "import": {
- "types": "./dist/index.d.mts",
- "default": "./dist/index.mjs"
- },
- "require": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- },
- "default": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- }
+ "types": "./dist/index.d.mts",
+ "default": "./dist/index.mjs"
}
},
"files": [
@@ -48,7 +39,6 @@
],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"peerDependencies": {
"@composio/core": ">=0.10.0 <1.0.0",
"llamaindex": "^0.12.0"
diff --git a/ts/packages/providers/mastra/package.json b/ts/packages/providers/mastra/package.json
index e9b4286f6..ef856ec80 100644
--- a/ts/packages/providers/mastra/package.json
+++ b/ts/packages/providers/mastra/package.json
@@ -3,6 +3,7 @@
"version": "0.9.3",
"description": "Agentic Provider for mastra in Composio SDK",
"main": "src/index.ts",
+ "type": "module",
"repository": {
"type": "git",
"url": "https://github.com/ComposioHQ/composio.git",
@@ -19,18 +20,8 @@
},
"exports": {
".": {
- "import": {
- "types": "./dist/index.d.mts",
- "default": "./dist/index.mjs"
- },
- "require": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- },
- "default": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- }
+ "types": "./dist/index.d.mts",
+ "default": "./dist/index.mjs"
}
},
"files": [
@@ -51,7 +42,6 @@
],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"peerDependencies": {
"@composio/core": ">=0.10.0 <1.0.0",
"@mastra/core": "^1.0.4",
diff --git a/ts/packages/providers/openai-agents/package.json b/ts/packages/providers/openai-agents/package.json
index b072b1a30..86e712409 100644
--- a/ts/packages/providers/openai-agents/package.json
+++ b/ts/packages/providers/openai-agents/package.json
@@ -3,6 +3,7 @@
"version": "0.9.3",
"description": "",
"main": "src/index.ts",
+ "type": "module",
"repository": {
"type": "git",
"url": "https://github.com/ComposioHQ/composio.git",
@@ -19,18 +20,8 @@
},
"exports": {
".": {
- "import": {
- "types": "./dist/index.d.mts",
- "default": "./dist/index.mjs"
- },
- "require": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- },
- "default": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- }
+ "types": "./dist/index.d.mts",
+ "default": "./dist/index.mjs"
}
},
"files": [
@@ -45,7 +36,6 @@
"keywords": [],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"peerDependencies": {
"@composio/core": ">=0.10.0 <1.0.0",
"@openai/agents": "^0.1.3",
diff --git a/ts/packages/providers/openai/package.json b/ts/packages/providers/openai/package.json
index c13d32cb8..0f293ee90 100644
--- a/ts/packages/providers/openai/package.json
+++ b/ts/packages/providers/openai/package.json
@@ -3,6 +3,7 @@
"version": "0.9.3",
"description": "",
"main": "src/index.ts",
+ "type": "module",
"repository": {
"type": "git",
"url": "https://github.com/ComposioHQ/composio.git",
@@ -19,18 +20,8 @@
},
"exports": {
".": {
- "import": {
- "types": "./dist/index.d.mts",
- "default": "./dist/index.mjs"
- },
- "require": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- },
- "default": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- }
+ "types": "./dist/index.d.mts",
+ "default": "./dist/index.mjs"
}
},
"files": [
@@ -45,7 +36,6 @@
"keywords": [],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"peerDependencies": {
"@composio/core": ">=0.10.0 <1.0.0",
"openai": "catalog:"
diff --git a/ts/packages/providers/vercel/package.json b/ts/packages/providers/vercel/package.json
index 085792ebd..f2cf16acc 100644
--- a/ts/packages/providers/vercel/package.json
+++ b/ts/packages/providers/vercel/package.json
@@ -3,6 +3,7 @@
"version": "0.9.3",
"description": "",
"main": "src/index.ts",
+ "type": "module",
"repository": {
"type": "git",
"url": "https://github.com/ComposioHQ/composio.git",
@@ -19,18 +20,8 @@
},
"exports": {
".": {
- "import": {
- "types": "./dist/index.d.mts",
- "default": "./dist/index.mjs"
- },
- "require": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- },
- "default": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- }
+ "types": "./dist/index.d.mts",
+ "default": "./dist/index.mjs"
}
},
"files": [
@@ -45,7 +36,6 @@
"keywords": [],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"peerDependencies": {
"@composio/core": ">=0.10.0 <1.0.0",
"ai": "^5.0.0 || ^6.0.0"
diff --git a/ts/packages/ts-builders/package.json b/ts/packages/ts-builders/package.json
index ee71c38fc..ccecafd87 100644
--- a/ts/packages/ts-builders/package.json
+++ b/ts/packages/ts-builders/package.json
@@ -3,22 +3,13 @@
"version": "0.1.24",
"description": "Fork of @prisma/ts-builders",
"main": "dist/index.mjs",
+ "type": "module",
"module": "dist/index.mjs",
"types": "dist/index.d.mts",
"exports": {
".": {
- "import": {
- "types": "./dist/index.d.mts",
- "default": "./dist/index.mjs"
- },
- "require": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- },
- "default": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- }
+ "types": "./dist/index.d.mts",
+ "default": "./dist/index.mjs"
}
},
"repository": {
diff --git a/ts/scripts/create-example.sh b/ts/scripts/create-example.sh
index a12773566..6578b87e6 100755
--- a/ts/scripts/create-example.sh
+++ b/ts/scripts/create-example.sh
@@ -36,7 +36,6 @@ cat > "$EXAMPLE_PATH/package.json" << EOL
"keywords": ["composio", "example", "${EXAMPLE_NAME}"],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"dependencies": {
"@composio/core": "workspace:*",
"dotenv": "^16.4.1"
diff --git a/ts/scripts/create-provider.sh b/ts/scripts/create-provider.sh
index 678151919..f956ab401 100644
--- a/ts/scripts/create-provider.sh
+++ b/ts/scripts/create-provider.sh
@@ -30,14 +30,13 @@ cat > "$TOOLSET_PATH/package.json" << EOL
"type": "module",
"publishConfig": {
"access": "public",
- "main": "dist/index.js",
- "types": "dist/index.d.ts"
+ "main": "dist/index.mjs",
+ "types": "dist/index.d.mts"
},
"exports": {
".": {
- "import": "./dist/index.js",
- "types": "./dist/index.d.ts",
- "require": "./dist/index.cjs"
+ "types": "./dist/index.d.mts",
+ "default": "./dist/index.mjs"
}
},
"files": [
@@ -45,13 +44,12 @@ cat > "$TOOLSET_PATH/package.json" << EOL
"dist"
],
"scripts": {
- "build": "bun run --bun tsdown",
+ "build": "pnpm exec tsdown",
"test": "vitest run"
},
"keywords": ["composio", "provider", "${TOOLSET_NAME}"],
"author": "",
"license": "ISC",
- "packageManager": "[email protected]",
"peerDependencies": {
"@composio/core": "^0.1.0"
},
@@ -83,17 +81,14 @@ cat > "$TOOLSET_PATH/tsconfig.json" << EOL
}
EOL
-# Create tsup.config.ts
-cat > "$TOOLSET_PATH/tsup.config.ts" << EOL
-import { defineConfig } from 'tsup';
+# Create tsdown.config.ts
+cat > "$TOOLSET_PATH/tsdown.config.ts" << EOL
+import { defineConfig } from 'tsdown';
+import { baseConfig } from '../../../../tsdown.config.base.ts';
export default defineConfig({
- entry: ['src/index.ts'],
- format: ['esm', 'cjs'],
- dts: true,
- clean: true,
- minify: false,
- outDir: 'dist',
+ ...baseConfig,
+ tsconfig: 'tsconfig.json',
});
EOL
@@ -254,4 +249,4 @@ chmod +x "$TOOLSET_PATH"
cd "$TOOLSET_PATH" && pnpm install
echo "✨ Created new ${IS_AGENTIC:+agentic }provider at $TOOLSET_PATH"
-echo "✨ Dependencies installed successfully"
\ No newline at end of file
+echo "✨ Dependencies installed successfully"
diff --git a/ts/scripts/pre-install.sh b/ts/scripts/pre-install.sh
index cbfe2091c..2c0373c64 100755
--- a/ts/scripts/pre-install.sh
+++ b/ts/scripts/pre-install.sh
@@ -17,5 +17,5 @@ if ! command -v bun &> /dev/null; then
fi
echo "Bun is installed."
-echo "Checking if Bun version matches mise.toml..."
+echo "Checking if toolchain versions match mise.toml..."
bun run "$SCRIPT_DIR/pre-install/check-toolchain.ts"
diff --git a/ts/scripts/pre-install/check-toolchain.ts b/ts/scripts/pre-install/check-toolchain.ts
index 7c5c566e0..18c20786c 100644
--- a/ts/scripts/pre-install/check-toolchain.ts
+++ b/ts/scripts/pre-install/check-toolchain.ts
@@ -12,12 +12,19 @@ declare module 'bun' {
}
}
-function getRequiredBunVersion(): string {
+type CheckedTool = 'bun' | 'pnpm';
+
+const miseTool: Record<CheckedTool, string> = {
+ bun: 'bun',
+ pnpm: 'npm:pnpm',
+};
+
+function getRequiredVersion(tool: CheckedTool): string {
try {
- return execFileSync('mise', ['current', 'bun'], { encoding: 'utf-8' }).trim();
+ return execFileSync('mise', ['current', miseTool[tool]], { encoding: 'utf-8' }).trim();
} catch (err) {
console.error(
- `Failed to resolve Bun version from mise.toml.
+ `Failed to resolve ${tool} version from mise.toml.
Install mise and run:
\`mise install\`
@@ -28,17 +35,28 @@ Original error: ${(err as Error).message}`
}
}
-function main() {
- if (Bun.env.BYPASS_TOOLCHAIN_CHECK) {
- return;
+function getPnpmVersion(): string {
+ try {
+ return execFileSync('pnpm', ['--version'], { encoding: 'utf-8' }).trim();
+ } catch (err) {
+ console.error(
+ `Failed to resolve pnpm version.
+Install the repository toolchain by running:
+
+\`mise install\`
+
+Original error: ${(err as Error).message}`
+ );
+ process.exit(1);
}
+}
- const requiredBunVersion = getRequiredBunVersion();
- const actualBunVersion = Bun.version.trim();
+function assertVersion(tool: CheckedTool, actualVersion: string) {
+ const requiredVersion = getRequiredVersion(tool);
- if (actualBunVersion !== requiredBunVersion) {
+ if (actualVersion !== requiredVersion) {
console.error(
- `Bun version mismatch: expected ${requiredBunVersion}, got ${actualBunVersion}.
+ `${tool} version mismatch: expected ${requiredVersion}, got ${actualVersion}.
Install the repository toolchain by running:
\`mise install\`
@@ -48,6 +66,15 @@ Install the repository toolchain by running:
}
}
+function main() {
+ if (Bun.env.BYPASS_TOOLCHAIN_CHECK) {
+ return;
+ }
+
+ assertVersion('bun', Bun.version.trim());
+ assertVersion('pnpm', getPnpmVersion());
+}
+
if (import.meta.path === Bun.main) {
main();
}
diff --git a/ts/scripts/validate-examples.ts b/ts/scripts/validate-examples.ts
index 739f7f468..293af3e1c 100644
--- a/ts/scripts/validate-examples.ts
+++ b/ts/scripts/validate-examples.ts
@@ -4,17 +4,7 @@ import ts from 'typescript';
const repoRoot = process.cwd();
const examplesRoot = path.join(repoRoot, 'ts', 'examples');
-const allowedSourceExtensions = new Set([
- '.cjs',
- '.cts',
- '.js',
- '.jsx',
- '.mjs',
- '.mts',
- '.ts',
- '.tsx',
- '.json',
-]);
+const allowedSourceExtensions = new Set(['.js', '.jsx', '.mjs', '.mts', '.ts', '.tsx', '.json']);
type ValidationIssue = {
example: string;
@@ -53,7 +43,6 @@ const validatePackageJson = (exampleName: string, exampleDir: string) => {
dependencies?: Record<string, string>;
devDependencies?: Record<string, string>;
name?: string;
- packageManager?: string;
private?: boolean;
scripts?: Record<string, string>;
};
@@ -66,10 +55,6 @@ const validatePackageJson = (exampleName: string, exampleDir: string) => {
addIssue(exampleName, packageJsonPath, 'Examples must be marked private');
}
- if (!pkg.packageManager?.startsWith('pnpm@')) {
- addIssue(exampleName, packageJsonPath, 'Examples must declare a pnpm packageManager');
- }
-
if (!pkg.scripts || (!pkg.scripts.start && !pkg.scripts.dev)) {
addIssue(exampleName, packageJsonPath, 'Examples must expose a start or dev script');
}
@@ -80,7 +65,11 @@ const validatePackageJson = (exampleName: string, exampleDir: string) => {
};
if (!Object.keys(allDeps).some(dep => dep.startsWith('@composio/'))) {
- addIssue(exampleName, packageJsonPath, 'Examples must depend on at least one @composio package');
+ addIssue(
+ exampleName,
+ packageJsonPath,
+ 'Examples must depend on at least one @composio package'
+ );
}
} catch (error) {
addIssue(
@@ -140,14 +129,13 @@ const validateSourceFile = (exampleName: string, filePath: string) => {
}
const sourceText = fs.readFileSync(filePath, 'utf8');
- const isTsFile = ['.ts', '.tsx', '.mts', '.cts'].includes(extension);
- const scriptKind = extension === '.tsx'
- ? ts.ScriptKind.TSX
- : extension === '.jsx'
- ? ts.ScriptKind.JSX
- : extension === '.js'
- ? ts.ScriptKind.JS
- : extension === '.cjs'
+ const isTsFile = ['.ts', '.tsx', '.mts'].includes(extension);
+ const scriptKind =
+ extension === '.tsx'
+ ? ts.ScriptKind.TSX
+ : extension === '.jsx'
+ ? ts.ScriptKind.JSX
+ : extension === '.js'
? ts.ScriptKind.JS
: extension === '.mjs'
? ts.ScriptKind.JS
@@ -177,9 +165,7 @@ const validateSourceFile = (exampleName: string, filePath: string) => {
)
: undefined;
- const formattedLocation = location
- ? `:${location.line + 1}:${location.character + 1}`
- : '';
+ const formattedLocation = location ? `:${location.line + 1}:${location.character + 1}` : '';
addIssue(exampleName, `${relativePath}${formattedLocation}`, `Syntax error: ${message}`);
}
diff --git a/tsdown.config.base.ts b/tsdown.config.base.ts
index 6b5c3ca16..7add3a5fc 100644
--- a/tsdown.config.base.ts
+++ b/tsdown.config.base.ts
@@ -1,4 +1,4 @@
-import type { UserConfig, OutExtensionContext } from 'tsdown';
+import type { UserConfig } from 'tsdown';
// Turbo task execution triggers a tsdown ATTW tarball path bug for scoped packages.
// Keep ATTW for direct package builds, but disable it for workspace builds.
@@ -19,21 +19,16 @@ export const baseConfig = {
* Output directory for the build.
*/
outDir: 'dist',
- outExtensions: (ctx) => ({
- js: isESM(ctx)
- ? '.mjs'
- : '.cjs',
- dts: isESM(ctx)
- ? '.d.mts'
- : '.d.cts',
+ outExtensions: () => ({
+ js: '.mjs',
+ dts: '.d.mts',
}),
/**
* Configures the output formats for the build.
* - 'esm' generates ESM (ECMAScript Module) output
- * - 'cjs' generates lecayse CommonJS output
*/
- format: ['esm', 'cjs' /* legacy */],
+ format: ['esm'],
/**
* Generates TypeScript declaration files (.d.mts, .d.ts)
@@ -77,14 +72,16 @@ export const baseConfig = {
* Configuration for @arethetypeswrong/cli.
* Uses '.' entrypoint to check the package root via the exports field,
* since src/index.ts is only used during development and not exported.
- * Uses 'node16' profile since packages support both ESM and CJS.
+ * Uses the ESM-only profile because packages no longer publish CJS entrypoints.
*/
attw: {
entrypoints: ['.'],
enabled: !isTurboTask,
level: 'error',
- profile: 'node16',
- ignoreRules: [/* Node.js 10 only, attw doesn't automatically exclude it despite the selected profile */ 'internal-resolution-error'],
+ profile: 'esm-only',
+ ignoreRules: [
+ /* Node.js 10 only, attw doesn't automatically exclude it despite the selected profile */ 'internal-resolution-error',
+ ],
},
/**
@@ -95,8 +92,4 @@ export const baseConfig = {
level: 'error',
pack: 'pnpm',
},
-} satisfies UserConfig
-
-function isESM(ctx: OutExtensionContext) {
- return ctx.format === 'es'
-}
+} satisfies UserConfig;
diff --git a/turbo.jsonc b/turbo.jsonc
index 84cd33217..ce3ac4fa6 100644
--- a/turbo.jsonc
+++ b/turbo.jsonc
@@ -1,5 +1,10 @@
{
"$schema": "https://turbo.build/schema.json",
+ // pnpm is pinned solely by mise (`npm:pnpm` in mise.toml). We intentionally
+ // omit the root `packageManager` field rather than duplicate that version, so
+ // mise stays the single source of truth. Turbo then infers pnpm from
+ // pnpm-lock.yaml for workspace resolution.
+ "dangerouslyDisablePackageManagerCheck": true,
"tasks": {
"build": {
"dependsOn": ["^build"],