Commit Graph

6 Commits

Author SHA1 Message Date
Alberto Schiabel 20bf1b6345 chore(ts): quiet tsdown build warnings (#3665)
This PR:
- migrates shared tsdown dependency config from deprecated `external` /
`noExternal` aliases to `deps.neverBundle` / `deps.alwaysBundle`
- disables noisy Rolldown plugin timing and ineffective dynamic-import
diagnostics in shared config while keeping build checks enabled
- fixes the `json-schema-to-zod` `JSONSchema7TypeName` import so it
stays type-only
- keeps the CLI bundle graph aligned with `next` while quieting the
dynamic-import warning through `checks.ineffectiveDynamicImport: false`
- makes the Node file E2Es treat the current external storage
`Unauthorized` upload response as an explicit `UPLOAD_UNAVAILABLE`/skip
outcome instead of failing unrelated SDK build PRs

Verification:
- `pnpm build`
- build log scan for `WARN`, deprecated `external` / `noExternal`,
`deps.onlyBundle`, `PLUGIN_TIMINGS`, and `INEFFECTIVE_DYNAMIC_IMPORT`
- `pnpm --dir ts/packages/cli test -- --runInBand`
- `pnpm --dir ts/e2e-tests/runtimes/node/file-roundtrip typecheck`
- `pnpm --dir ts/e2e-tests/runtimes/node/tool-router-files typecheck`
- `pnpm lint:packages`
- CI: TypeScript build/typecheck/test and Node 22/24/25, Deno,
Cloudflare, and CLI e2e are green on the latest commit
2026-06-26 12:17:33 +04:00
Alberto Schiabel 6e7fc24d93 fix(ts): disable publint pack under Turbo to fix flaky build ENOENT (#3661)
This PR:

- fixes the intermittent `E2E Test CLI (scratch)` → **Build** failure
seen on the changeset release PR #3616, where
`@composio/anthropic#build` died with:
  ```
Error: ENOENT: no such file or directory, open
'/tmp/tsdown-pack-XXXXXX/composio-anthropic-0.10.0.tgz'
  ```
- gates `publint` with `!isTurboTask` in `tsdown.config.base.ts`,
mirroring the existing ATTW workaround, so neither publish-readiness
check packs a tarball under Turbo

## Root cause

`tsdown.config.base.ts` already disabled **ATTW** under Turbo to dodge a
"tarball path bug for scoped packages", but left **publint** enabled
with `pack: 'pnpm'`. In tsdown the pack is shared and runs whenever
*either* check is enabled:

```js
if (publintConfigs.length || attwConfigs.length) {
  const tarball = await packTarball(pkg.packageJsonPath); // pnpm pack → temp dir → readdir → readFile
  ...
}
```

So disabling ATTW alone did **not** stop the pack — publint kept
triggering it, and with it the intermittent `readdir`-then-`readFile`
race where the packed `.tgz` is gone by the time `readFile` runs. It's
flaky: this run it hit `@composio/anthropic` while 14 sibling scoped
packages packed fine.

## Fix

`publint.enabled: true` → `publint.enabled: !isTurboTask`. With both
ATTW and publint disabled under Turbo, `packTarball()` is never called
in workspace/CI builds, eliminating the race. Direct package builds (no
`TURBO_HASH`) keep running both checks with packing — where the bug does
not occur.

## Verification (local, `--force` to bypass cache)

- **Turbo build before:** `[publint]` runs for every package (packs the
tarball) → race surface present.
- **Turbo build after:** `0` publint runs, `3 successful, 3 total`, all
`🙏 Build succeeded!` → pack step gone.
- **Direct build after** (`env -u TURBO_HASH pnpm build` in
`providers/anthropic`): both `✔ [attw]` and `✔ [publint]` run and pass →
coverage retained off-Turbo.
2026-06-25 04:31:27 +04:00
Alberto Schiabel 025a657597 feat(ts): drop CommonJS support (#3494)
This PR moves the TypeScript SDK support floor to the latest Node.js 22
release and uses that as the point where we stop carrying custom
CommonJS compatibility machinery. The e2e runtime coverage now exercises
the latest Node 22, Node 24, and Node 25 lines, so the SDK is tested
against the minimum supported version and the newer runtimes users are
likely to adopt next.

Because the SDK packages are still on `0.x`, the accompanying changeset
uses `minor` bumps while calling out that this is a breaking change
inside the existing 0.x line.

It also moves pnpm under mise on this Node 22 layer. That belongs here,
not in #3493, because the pinned `pnpm@10.28.2` requires Node.js
`>=22.13`. Removing Corepack is intentional: Node.js documents that
Corepack is no longer distributed starting with Node.js v25, so relying
on `corepack enable` would keep a toolchain dependency that is already
on the way out of the Node distribution.

## What changed

- Pins the local/toolchain Node.js floor to `22.22.3` in `mise.toml`,
`mise.lock`, `toolchain-versions.json`, and root `devEngines`.
- Pins pnpm in `mise.toml` as `"npm:pnpm" = "10.28.2"` and makes mise
the single source of truth for the pnpm version. Removes the root
`packageManager` / `devEngines.packageManager` Corepack pin entirely
(rather than keeping a second copy of the version that could drift) and
removes stale `packageManager` metadata from real TS packages/examples
and generators.
- Sets `dangerouslyDisablePackageManagerCheck: true` in `turbo.jsonc` so
Turbo discovers pnpm from `pnpm-lock.yaml` instead of requiring a
`packageManager` field. Without this, Turbo fails workspace resolution
(`Could not resolve workspaces -> Missing 'packageManager' field`),
which is the only reason the field would otherwise need to stay.
- Replaces `corepack enable` in the shared setup action with
mise-managed pnpm. The E2E Docker images install bun + pnpm directly
from `mise.toml`/`mise.lock` (with
`dangerouslyDisablePackageManagerCheck`-style separation: Node/Deno stay
on the base image as the test matrix axis and are disabled via
`MISE_DISABLE_TOOLS` so mise does not shadow them; the tool binaries are
symlinked into `/usr/local/bin`). No `BUN_VERSION`/`PNPM_VERSION` build
args are threaded from the host anymore, and bun+pnpm now carry
`mise.lock` checksum verification.
- Extends the install-time toolchain check to validate pnpm against mise
alongside Bun.
- Sets the Node E2E matrix and install fallback checks to `22.22.3`,
`24.16.0`, and `25.9.0`.
- Makes TS package builds ESM-only: `tsdown` now emits `.mjs` / `.d.mts`
only and uses the ATTW `esm-only` profile.
- Removes explicit `require` / `.cjs` / `.d.cts` package export paths
and internal import mappings from the public TS SDK packages.
- Marks public TS SDK packages as `type: module` where they were missing
it.
- Replaces the remaining runtime `require('pusher-js')` with dynamic ESM
import.
- Deletes the legacy CJS example.
- Reintroduces `node/cjs-basic` as a modern Node `require(esm)` interop
E2E: it verifies `require('@composio/core')` works through Node's native
ESM loader on Node 22, 24, and 25 while resolving to `dist/index.mjs`,
not a `.cjs` artifact.
- Removes `.cjs` / `.cts` handling from example validation and CLI
project-language detection.
- Updates provider scaffolding so newly generated providers are
ESM-only.
- Adds a minor changeset warning that CommonJS callers can only rely on
Node's native `require(esm)` interop and that custom CommonJS
compatibility machinery is gone.

## Bundled behavior changes

Two changes here are technically independent of the CommonJS removal but
ride along because they touch the same files and ship in the same
release cut. Calling them out explicitly so they are not missed in
review:

- **`PusherUtils` realtime channel auth (`@composio/core`).** Replacing
the runtime `require('pusher-js')` with a dynamic ESM `import()` was
done alongside conforming `channelAuthorization` to pusher-js's typed
`customHandler(params, callback)` contract. The previous `(authOptions)
=> Promise` shape did not match pusher-js's actual calling convention —
it read `endpoint`/`headers`/`params` off an argument that pusher-js
never passes — so this also fixes that latent mismatch. New unit tests
(`ts/packages/core/test/utils/pusher.test.ts`) cover the auth request
shape (endpoint, `x-api-key` header, JSON `socket_id`/`channel_name`
body) and the success / invalid-JSON / network-failure callback paths.
- **CLI meta-tool slug list (`@composio/cli`).** Drops
`COMPOSIO_UPSERT_RECIPE` and `COMPOSIO_GET_RECIPE` from
`META_TOOL_SLUG_LIST` in `tools-executor.ts`; `@composio/client`
alpha.74 removed those slugs from the `SessionExecuteMetaParams['slug']`
union. The list is declared `satisfies
ReadonlyArray<SessionExecuteMetaParams['slug']>`, so this is enforced at
compile time (`pnpm typecheck`) — keeping the stale slugs would be a
type error — and needs no separate runtime test.

## Verification

- Verified latest Node 22/24/25 releases from the official Node dist
index: `22.22.3`, `24.16.0`, `25.9.0`
(https://nodejs.org/dist/index.json).
- Verified Node docs state Corepack is no longer distributed starting
with Node.js v25:
https://nodejs.org/download/release/v22.22.3/docs/api/corepack.html
- `mise exec -- pnpm --version` -> `10.28.2`
- `mise exec -- pnpm install --frozen-lockfile`
- `mise exec -- bun run ts/scripts/pre-install/check-toolchain.ts`
- `mise exec -- pnpm --filter @e2e-tests/utils typecheck`
- `mise exec -- pnpm --filter @e2e-tests/node-cjs-basic typecheck`
- `mise exec -- pnpm --filter @e2e-tests/node-cjs-basic test:e2e:node`
- `mise exec -- pnpm --filter @e2e-tests/node-esm-basic typecheck`
- `mise exec -- pnpm --filter @composio/cli typecheck`
- `mise exec -- pnpm --filter @composio/cli test -- --runInBand`
- `mise exec -- pnpm --filter @composio/core typecheck`
- `mise exec -- pnpm --filter @composio/core exec vitest run
test/utils/pusher.test.ts`
- `mise exec -- pnpm run build:packages`
- `mise exec -- turbo run build --dry-run` resolves all workspace
packages with no root `packageManager` field (pnpm discovered from
`pnpm-lock.yaml`).
- `mise exec -- pnpm --filter @composio/cli exec vitest run
test/src/services/project-environment-detector.test.ts`
- `mise exec -- pnpm exec prettier --check ...`
- `docker build -f ts/e2e-tests/_utils/Dockerfile.node --build-arg
NODE_VERSION=24.16.0 -t composio-e2e-node:misecheck .` (also
`Dockerfile.deno` with `DENO_VERSION=2.6.7 NODE_MAJOR=22`) — both build
green; runtime resolves Node/Deno from the base image and pnpm 10.28.2 /
bun 1.3.10 from mise.
- `docker manifest inspect node:24.16.0-slim`
- `docker manifest inspect node:25.9.0-slim`
- `bash -n ts/scripts/create-provider.sh && git diff --check`
- `ruby -e "require 'yaml';
YAML.load_file('.github/workflows/ts.test-e2e.yml')"`
- Tracked example validation in a clean temporary tree: `Validated 21
example packages.`
2026-06-19 22:22:17 +04:00
Rahul Tarak 1344e1cd34 Make root search/link/execute consumer-only (#2971)
## Summary
- make top-level `composio search`, `composio link`, and `composio
execute` consumer-only
- keep developer-scoped usage under `composio manage ...`
- remove developer-only flags from root help and add short
related-command hints
- use `consumer_user_id` from consumer project resolve and stop showing
internal test-user/project diagnostics on consumer flows

## Testing
- `pnpm -C ts/packages/cli exec tsc --noEmit -p ./tsconfig.src.json`
- `pnpm -C ts/packages/cli test -- --runInBand`

will show you the top level commands working

```
export COMPOSIO_BASE_URL="https://apollo-k05mgspn8-composio.vercel.app/"
export COMPOSIO_WEB_URL="https://dashboard-git-t3code-cli-landing-redesign-composio.vercel.app/"
pnpm -C ts/packages/cli run cli -- login
```

---------

Co-authored-by: jkomyno <12381818+jkomyno@users.noreply.github.com>
2026-03-20 16:13:27 -07:00
Musthaq Ahamad 277f02b1b0 Fix prevent providers from bundling @composio/core types (#2401) 2026-01-16 14:36:14 +05:30
Alberto Schiabel ded64beb75 feat(ts): support Cloudflare Workers + refactor build pipeline with tsdown + introduce e2e tests (#2360)
Co-authored-by: jkomyno <12381818+jkomyno@users.noreply.github.com>
2026-01-13 13:02:58 +05:30