@devries-cameron20 / composio Mirror · read-only / commits / 20aaa95c9
Fork 0

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

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 13:30 UTC

ci(ts): verify packed provider compatibility (#4355)

This PR: - adds a clean consumer harness that packs core, its internal JSON Schema dependency, and all ten TypeScript providers - verifies tarball contents, npm installation, named public exports, consumer typechecking, provider construction, and a credential-free `wrapTool` conversion - covers the current workspace core, one verified minimum-core lane per provider, and the packed workspace core presented as `1.0.0-beta.0` - preserves existing 0.x minimum peer ranges while recording the verified floors separately for the future breaking release - additively accepts core 1.0 prereleases without claiming stable 1.x support yet - widens the Anthropic and OpenAI Agents peer ranges to include the upstream versions already used by this repository - runs the gate in TypeScript CI and immediately before Changesets publishing The release guard fails before publication and its regression test verifies build -> compatibility -> publish ordering plus failure propagation. ## Non-breaking scope No public API is removed or renamed, and the existing 0.x core peer floors remain unchanged. All peer-range changes are additive. The gate reports the nine floor corrections that should be made with the planned breaking release. ## Validation - `pnpm run check:provider-compatibility` (12 packed consumer lanes) - `pnpm run test:provider-compatibility` - `pnpm run test:release-workflow` - `pnpm run build:packages` (19 packages) - focused TypeScript compile and Oxlint checks - Prettier, Changesets validation, and `git diff --check`

Alberto Schiabel committed Sep 7, 2026 at 12:33 UTC 20aaa95c96ef72248c22fab452ad67c01d881402
18 files changed +893 -14
.changeset/witty-shrimps-check.md new
+14
@@ -0,0 +1,14 @@
1 +---
2 +'@composio/anthropic': patch
3 +'@composio/claude-agent-sdk': patch
4 +'@composio/cloudflare': patch
5 +'@composio/google': patch
6 +'@composio/langchain': patch
7 +'@composio/llamaindex': patch
8 +'@composio/mastra': patch
9 +'@composio/openai': patch
10 +'@composio/openai-agents': patch
11 +'@composio/vercel': patch
12 +---
13 +
14 +Accept the upcoming core prerelease and the upstream versions already used to build and test providers.
.github/workflows/ts.test.yml
+8
@@ -15,6 +15,7 @@ on:
15 - 'pnpm-workspace.yaml'
16 - 'pnpm-lock.yaml'
17 - 'test/release-workflow.test.ts'
18 + - 'test/provider-compatibility.test.ts'
19 - 'turbo.jsonc'
20 pull_request:
21 branches: [master, next]
@@ -30,6 +31,7 @@ on:
31 - 'pnpm-workspace.yaml'
32 - 'pnpm-lock.yaml'
33 - 'test/release-workflow.test.ts'
34 + - 'test/provider-compatibility.test.ts'
35 - 'turbo.jsonc'
36
37 concurrency:
@@ -61,3 +63,9 @@ jobs:
63
64 - name: Run Tests
65 run: pnpm run test
66 +
67 + - name: Build packages for consumer compatibility
68 + run: pnpm run build:packages
69 +
70 + - name: Check packed provider compatibility
71 + run: pnpm run check:provider-compatibility
package.json
+4 -1
@@ -26,9 +26,10 @@
26 "build:packages": "turbo build --filter=./ts/packages/**",
27 "cli:record": "turbo run record --filter=./ts/packages/cli",
28 "record": "turbo run record",
29 - "test": "pnpm run test:toolchain && pnpm run test:install-sh && pnpm run test:release-workflow && turbo test --filter=./ts/packages/** --filter=!@e2e-tests/* && pnpm run test:examples",
29 + "test": "pnpm run test:toolchain && pnpm run test:install-sh && pnpm run test:release-workflow && pnpm run test:provider-compatibility && turbo test --filter=./ts/packages/** --filter=!@e2e-tests/* && pnpm run test:examples",
30 "test:install-sh": "bash test/install-sh-release-resolution.test.sh && bash test/install-sh-atomic-replace.test.sh",
31 "test:release-workflow": "bun run test/release-workflow.test.ts",
32 + "test:provider-compatibility": "bun test test/provider-compatibility.test.ts",
33 "test:toolchain": "bun run test/mise-bun-pin.test.ts",
34 "test:examples": "tsx ts/scripts/validate-examples.ts",
35 "test:e2e": "turbo test:e2e --filter='@e2e-tests/*'",
@@ -50,6 +51,7 @@
51 "create:provider": "bash ts/scripts/create-provider.sh",
52 "create:example": "bash ts/scripts/create-example.sh",
53 "check:peer-deps": "tsx ts/scripts/check-peer-deps.ts",
54 + "check:provider-compatibility": "tsx ts/scripts/check-provider-compatibility.ts",
55 "update:peer-deps": "tsx ts/scripts/update-peer-deps.ts",
56 "validate:agent-skills": "node ts/scripts/validate-agent-skills.mjs",
57 "validate:changesets": "node ts/scripts/validate-changesets.mjs",
@@ -80,6 +82,7 @@
82 "@composio/openai": "workspace:*",
83 "@types/bun": "catalog:",
84 "@types/node": "^26.3.0",
85 + "@types/semver": "^7.8.0",
86 "@vitest/ui": "catalog:",
87 "husky": "^9.1.7",
88 "lint-staged": "^17.3.0",
pnpm-lock.yaml
+3
@@ -158,6 +158,9 @@ importers:
158 '@types/node':
159 specifier: ^26.3.0
160 version: 26.3.0
161 + '@types/semver':
162 + specifier: ^7.8.0
163 + version: 7.8.0
164 '@vitest/ui':
165 specifier: 'catalog:'
166 version: 4.1.11(vitest@4.1.11)
test/provider-compatibility.test.ts new
+161
@@ -0,0 +1,161 @@
1 +import { describe, expect, it } from 'bun:test';
2 +import { spawnSync } from 'node:child_process';
3 +import { mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises';
4 +import { tmpdir } from 'node:os';
5 +import path from 'node:path';
6 +import {
7 + buildCompatibilityPlan,
8 + discoverProviderCases,
9 + parseCliOptions,
10 + repackCoreTarball,
11 +} from '../ts/scripts/check-provider-compatibility';
12 +
13 +describe('provider compatibility plan', () => {
14 + it('covers every provider at the workspace, verified minimum, and beta boundaries', async () => {
15 + const providers = await discoverProviderCases();
16 + const plan = buildCompatibilityPlan(providers, '1.0.0-beta.0');
17 + const providerNames = providers.map(provider => provider.name);
18 + const current = plan.find(lane => lane.id === 'workspace-current');
19 + const beta = plan.find(lane => lane.id === 'workspace-major-prerelease');
20 + const minimum = plan.filter(lane => lane.id.startsWith('verified-minimum-core-'));
21 +
22 + expect(providerNames).toHaveLength(10);
23 + expect(current?.providerNames).toEqual(providerNames);
24 + expect(beta?.providerNames).toEqual(providerNames);
25 + expect(beta?.core).toEqual({ kind: 'workspace-prerelease', version: '1.0.0-beta.0' });
26 + expect(minimum.flatMap(lane => lane.providerNames).sort()).toEqual([...providerNames].sort());
27 + expect(minimum).toHaveLength(10);
28 + expect(
29 + Object.fromEntries(
30 + minimum.map(lane => [
31 + lane.providerNames[0],
32 + lane.core.kind === 'registry' && lane.core.specifier,
33 + ])
34 + )
35 + ).toEqual({
36 + '@composio/anthropic': '0.14.0',
37 + '@composio/claude-agent-sdk': '0.11.0',
38 + '@composio/cloudflare': '0.14.0',
39 + '@composio/google': '0.16.0',
40 + '@composio/langchain': '0.11.0',
41 + '@composio/llamaindex': '0.11.0',
42 + '@composio/mastra': '0.18.0',
43 + '@composio/openai': '0.18.0',
44 + '@composio/openai-agents': '0.18.0',
45 + '@composio/vercel': '0.18.0',
46 + });
47 + expect(minimum.every(lane => lane.providerNames.length === 1)).toBe(true);
48 + expect(current?.lifecycleScripts).toBe('run');
49 + expect(beta?.lifecycleScripts).toBe('skip');
50 + expect(minimum.every(lane => lane.lifecycleScripts === 'skip')).toBe(true);
51 + expect(
52 + Object.fromEntries(
53 + providers.map(provider => [provider.name, provider.advertisedMinimumCoreVersion])
54 + )
55 + ).toEqual({
56 + '@composio/anthropic': '0.10.0',
57 + '@composio/claude-agent-sdk': '0.10.0',
58 + '@composio/cloudflare': '0.10.0',
59 + '@composio/google': '0.16.0',
60 + '@composio/langchain': '0.10.0',
61 + '@composio/llamaindex': '0.10.0',
62 + '@composio/mastra': '0.10.0',
63 + '@composio/openai': '0.10.0',
64 + '@composio/openai-agents': '0.10.0',
65 + '@composio/vercel': '0.10.0',
66 + });
67 + });
68 +
69 + it('selects all lanes by default and accepts focused runs', () => {
70 + expect([...parseCliOptions([]).lanes]).toEqual(['current', 'minimum', 'beta']);
71 + expect([...parseCliOptions(['--', '--lane', 'current', '--plan']).lanes]).toEqual(['current']);
72 + expect(parseCliOptions(['--', '--lane', 'current', '--plan']).planOnly).toBe(true);
73 + expect(() => parseCliOptions(['--lane', 'future'])).toThrow(
74 + '--lane must be current, minimum, or beta'
75 + );
76 + expect(() => parseCliOptions(['--unknown'])).toThrow('Unknown argument: --unknown');
77 + });
78 +});
79 +
80 +describe('repackCoreTarball', () => {
81 + async function withPackedManifest<T>(
82 + manifest: unknown,
83 + callback: (tarball: string, artifactDirectory: string) => Promise<T>
84 + ): Promise<T> {
85 + const root = await mkdtemp(path.join(tmpdir(), 'composio-repack-test-'));
86 + try {
87 + await mkdir(path.join(root, 'source/package'), { recursive: true });
88 + await writeFile(path.join(root, 'source/package/package.json'), JSON.stringify(manifest));
89 + const tarball = path.join(root, 'core.tgz');
90 + const packed = spawnSync('tar', [
91 + '-czf',
92 + tarball,
93 + '-C',
94 + path.join(root, 'source'),
95 + 'package',
96 + ]);
97 + if (packed.status !== 0) throw new Error(String(packed.stderr));
98 + return await callback(tarball, path.join(root, 'artifacts'));
99 + } finally {
100 + await rm(root, { recursive: true, force: true });
101 + }
102 + }
103 +
104 + const options = (artifactDirectory: string) => ({
105 + version: '1.0.0-beta.0',
106 + jsonSchemaTarball: '/artifacts/composio-json-schema-to-zod-0.1.0.tgz',
107 + artifactDirectory,
108 + });
109 +
110 + it('re-versions core and routes its helper dependency through the packed tarball', async () => {
111 + await withPackedManifest(
112 + {
113 + name: '@composio/core',
114 + version: '0.18.0',
115 + dependencies: { '@composio/json-schema-to-zod': 'workspace:*', zod: '^3.0.0' },
116 + peerDependencies: {},
117 + exports: { '.': './dist/index.mjs' },
118 + },
119 + async (tarball, artifactDirectory) => {
120 + const repacked = await repackCoreTarball(
121 + tarball,
122 + '@composio/core',
123 + options(artifactDirectory)
124 + );
125 + expect(path.basename(repacked)).toBe('composio-core-1.0.0-beta.0.tgz');
126 + const extracted = spawnSync('tar', ['-xzf', repacked, '-O', 'package/package.json'], {
127 + encoding: 'utf8',
128 + });
129 + const manifest = JSON.parse(extracted.stdout);
130 + expect(manifest.version).toBe('1.0.0-beta.0');
131 + expect(manifest.dependencies['@composio/json-schema-to-zod']).toBe(
132 + 'file:/artifacts/composio-json-schema-to-zod-0.1.0.tgz'
133 + );
134 + expect(manifest.dependencies.zod).toBe('^3.0.0');
135 + expect(manifest.exports).toEqual({ '.': './dist/index.mjs' });
136 + }
137 + );
138 + });
139 +
140 + it('rejects a packed core manifest that omits the helper dependency', async () => {
141 + await withPackedManifest(
142 + { name: '@composio/core', version: '0.18.0', dependencies: { zod: '^3.0.0' } },
143 + async (tarball, artifactDirectory) => {
144 + await expect(
145 + repackCoreTarball(tarball, '@composio/core', options(artifactDirectory))
146 + ).rejects.toThrow('must declare @composio/json-schema-to-zod as a dependency');
147 + }
148 + );
149 + });
150 +
151 + it('rejects a malformed packed core manifest', async () => {
152 + await withPackedManifest(
153 + { name: '@composio/core', dependencies: { '@composio/json-schema-to-zod': '*' } },
154 + async (tarball, artifactDirectory) => {
155 + await expect(
156 + repackCoreTarball(tarball, '@composio/core', options(artifactDirectory))
157 + ).rejects.toThrow('Invalid JSON in');
158 + }
159 + );
160 + });
161 +});
test/release-workflow.test.ts
+65 -1
@@ -28,6 +28,10 @@ const tsReleaseWorkflow = readFileSync(
28 new URL('../.github/workflows/ts.release.yml', import.meta.url),
29 'utf8'
30 );
31 +const tsTestWorkflow = readFileSync(
32 + new URL('../.github/workflows/ts.test.yml', import.meta.url),
33 + 'utf8'
34 +);
35 const pythonPyproject = readFileSync(new URL('../python/pyproject.toml', import.meta.url), 'utf8');
36 const pythonRuntimeVersionModule = readFileSync(
37 new URL('../python/composio/__version__.py', import.meta.url),
@@ -298,6 +302,25 @@ if (packageJson.scripts?.['validate:changesets'] !== 'node ts/scripts/validate-c
302 throw new Error('validate:changesets must use the ignored-package guard');
303 }
304
305 +if (
306 + packageJson.scripts?.['check:provider-compatibility'] !==
307 + 'tsx ts/scripts/check-provider-compatibility.ts'
308 +) {
309 + throw new Error('check:provider-compatibility must use the packed consumer harness');
310 +}
311 +
312 +const tsTestBuildIdx = tsTestWorkflow.indexOf('run: pnpm run build:packages');
313 +const tsTestProviderCompatibilityIdx = tsTestWorkflow.indexOf(
314 + 'run: pnpm run check:provider-compatibility'
315 +);
316 +if (
317 + tsTestBuildIdx === -1 ||
318 + tsTestProviderCompatibilityIdx === -1 ||
319 + tsTestBuildIdx > tsTestProviderCompatibilityIdx
320 +) {
321 + throw new Error('ts.test.yml must build packages before checking packed provider compatibility');
322 +}
323 +
324 {
325 const violations = findIgnoredChangesetReleases(
326 {
@@ -364,7 +387,9 @@ if (
387 throw new Error('ts.release.yml must validate pending changesets before changesets/action');
388 }
389
367 -if (!tsReleaseWorkflow.includes('changesets/action@8488615a623b1b9c987934bb89eae8af6a946ac1 # v2.1.1')) {
390 +if (
391 + !tsReleaseWorkflow.includes('changesets/action@8488615a623b1b9c987934bb89eae8af6a946ac1 # v2.1.1')
392 +) {
393 throw new Error('ts.release.yml must use changesets/action v2 with Changesets v3');
394 }
395
@@ -860,14 +885,23 @@ const fakeBin = mkdtempSync(join(tmpdir(), 'composio-release-test-'));
885 try {
886 const fakePnpmPath = join(fakeBin, 'pnpm');
887 const changesetsOutputPath = join(fakeBin, 'changesets-output.ndjson');
888 + const commandLogPath = join(fakeBin, 'commands.log');
889 + writeFileSync(commandLogPath, '');
890 writeFileSync(
891 fakePnpmPath,
892 `#!/usr/bin/env bash
893 set -euo pipefail
894 +printf '%s\n' "$*" >> "$COMMAND_LOG"
895 case "$*" in
896 "run build:packages")
897 exit 0
898 ;;
899 + "run check:provider-compatibility")
900 + if [[ "\${FAIL_PROVIDER_COMPATIBILITY:-}" == "1" ]]; then
901 + exit 42
902 + fi
903 + exit 0
904 + ;;
905 "changeset publish")
906 printf '%s\\n' '{"type":"git-tag","tag":"@composio/core@1.2.3","packageName":"@composio/core"}' > "$CHANGESETS_OUTPUT"
907 printf '%s\\n' '{"type":"git-tag","tag":"@composio/cli@9.9.9","packageName":"@composio/cli"}' >> "$CHANGESETS_OUTPUT"
@@ -888,6 +922,7 @@ esac
922 env: {
923 ...process.env,
924 CHANGESETS_OUTPUT: changesetsOutputPath,
925 + COMMAND_LOG: commandLogPath,
926 PATH: `${fakeBin}:${process.env.PATH}`,
927 },
928 });
@@ -913,6 +948,35 @@ esac
948 if (!result.stderr.includes('release warning preserved')) {
949 throw new Error('release script must preserve changeset publish stderr');
950 }
951 +
952 + const commands = readFileSync(commandLogPath, 'utf8').trim().split('\n');
953 + if (
954 + JSON.stringify(commands) !==
955 + JSON.stringify(['run build:packages', 'run check:provider-compatibility', 'changeset publish'])
956 + ) {
957 + throw new Error(
958 + `release script must run build → provider compatibility → publish: ${commands}`
959 + );
960 + }
961 +
962 + writeFileSync(commandLogPath, '');
963 + const failedCompatibility = spawnSync('bash', [releaseScriptPath], {
964 + encoding: 'utf8',
965 + env: {
966 + ...process.env,
967 + CHANGESETS_OUTPUT: changesetsOutputPath,
968 + COMMAND_LOG: commandLogPath,
969 + FAIL_PROVIDER_COMPATIBILITY: '1',
970 + PATH: `${fakeBin}:${process.env.PATH}`,
971 + },
972 + });
973 + const failedCommands = readFileSync(commandLogPath, 'utf8').trim().split('\n');
974 + if (failedCompatibility.status !== 42) {
975 + throw new Error('release script must preserve a provider compatibility gate failure');
976 + }
977 + if (failedCommands.includes('changeset publish')) {
978 + throw new Error('release script must not publish after provider compatibility fails');
979 + }
980 } finally {
981 rmSync(fakeBin, { recursive: true, force: true });
982 }
ts/packages/providers/anthropic/package.json
+2 -2
@@ -44,8 +44,8 @@
44 "author": "",
45 "license": "ISC",
46 "peerDependencies": {
47 - "@anthropic-ai/sdk": "^0.110.0",
48 - "@composio/core": ">=0.10.0 <1.0.0",
47 + "@anthropic-ai/sdk": "^0.110.0 || ^0.120.0",
48 + "@composio/core": ">=0.10.0 <1.0.0 || >=1.0.0-beta.0 <1.0.0",
49 "@mastra/mcp": "^1.13.1"
50 },
51 "devDependencies": {
ts/packages/providers/claude-agent-sdk/package.json
+1 -1
@@ -54,7 +54,7 @@
54 },
55 "peerDependencies": {
56 "@anthropic-ai/claude-agent-sdk": "^0.3.199",
57 - "@composio/core": ">=0.10.0 <1.0.0",
57 + "@composio/core": ">=0.10.0 <1.0.0 || >=1.0.0-beta.0 <1.0.0",
58 "zod": "^4.0.0"
59 },
60 "devDependencies": {
ts/packages/providers/cloudflare/package.json
+1 -1
@@ -41,7 +41,7 @@
41 "license": "ISC",
42 "peerDependencies": {
43 "@cloudflare/workers-types": "catalog:",
44 - "@composio/core": ">=0.10.0 <1.0.0"
44 + "@composio/core": ">=0.10.0 <1.0.0 || >=1.0.0-beta.0 <1.0.0"
45 },
46 "devDependencies": {
47 "@composio/core": "workspace:*",
ts/packages/providers/google/package.json
+1 -1
@@ -46,7 +46,7 @@
46 "author": "",
47 "license": "ISC",
48 "peerDependencies": {
49 - "@composio/core": ">=0.16.0 <1.0.0",
49 + "@composio/core": ">=0.16.0 <1.0.0 || >=1.0.0-beta.0 <1.0.0",
50 "@google/genai": "^1.1.0"
51 },
52 "devDependencies": {
ts/packages/providers/langchain/package.json
+1 -1
@@ -40,7 +40,7 @@
40 "author": "",
41 "license": "ISC",
42 "peerDependencies": {
43 - "@composio/core": ">=0.10.0 <1.0.0",
43 + "@composio/core": ">=0.10.0 <1.0.0 || >=1.0.0-beta.0 <1.0.0",
44 "@langchain/core": "^1.1.4"
45 },
46 "devDependencies": {
ts/packages/providers/llamaindex/package.json
+1 -1
@@ -43,7 +43,7 @@
43 "author": "",
44 "license": "ISC",
45 "peerDependencies": {
46 - "@composio/core": ">=0.10.0 <1.0.0",
46 + "@composio/core": ">=0.10.0 <1.0.0 || >=1.0.0-beta.0 <1.0.0",
47 "llamaindex": "^0.12.0"
48 },
49 "devDependencies": {
ts/packages/providers/mastra/package.json
+1 -1
@@ -45,7 +45,7 @@
45 "author": "",
46 "license": "ISC",
47 "peerDependencies": {
48 - "@composio/core": ">=0.10.0 <1.0.0",
48 + "@composio/core": ">=0.10.0 <1.0.0 || >=1.0.0-beta.0 <1.0.0",
49 "@mastra/core": "^1.46.0",
50 "zod": "^3.25 || ^4"
51 },
ts/packages/providers/openai-agents/package.json
+2 -2
@@ -40,8 +40,8 @@
40 "author": "",
41 "license": "ISC",
42 "peerDependencies": {
43 - "@composio/core": ">=0.10.0 <1.0.0",
44 - "@openai/agents": "^0.1.3",
43 + "@composio/core": ">=0.10.0 <1.0.0 || >=1.0.0-beta.0 <1.0.0",
44 + "@openai/agents": "^0.1.3 || ^0.17.0",
45 "zod": "catalog:"
46 },
47 "devDependencies": {
ts/packages/providers/openai/package.json
+1 -1
@@ -40,7 +40,7 @@
40 "author": "",
41 "license": "ISC",
42 "peerDependencies": {
43 - "@composio/core": ">=0.10.0 <1.0.0",
43 + "@composio/core": ">=0.10.0 <1.0.0 || >=1.0.0-beta.0 <1.0.0",
44 "openai": "^6.49.0 || ^7.0.0"
45 },
46 "devDependencies": {
ts/packages/providers/vercel/package.json
+1 -1
@@ -40,7 +40,7 @@
40 "author": "",
41 "license": "ISC",
42 "peerDependencies": {
43 - "@composio/core": ">=0.10.0 <1.0.0",
43 + "@composio/core": ">=0.10.0 <1.0.0 || >=1.0.0-beta.0 <1.0.0",
44 "ai": "^6.0.0 || ^7.0.0"
45 },
46 "devDependencies": {
ts/scripts/changeset-release.sh
+1
@@ -11,6 +11,7 @@ filtered_output_file=$(mktemp)
11 trap 'rm -f "$filtered_output_file"' EXIT
12
13 pnpm run build:packages
14 +pnpm run check:provider-compatibility
15
16 set +e
17 pnpm changeset publish
ts/scripts/check-provider-compatibility.ts new
+625
@@ -0,0 +1,625 @@
1 +#!/usr/bin/env node
2 +import { spawnSync } from 'node:child_process';
3 +import { access, mkdir, mkdtemp, readFile, readdir, rm, writeFile } from 'node:fs/promises';
4 +import { tmpdir } from 'node:os';
5 +import path from 'node:path';
6 +import { fileURLToPath, pathToFileURL } from 'node:url';
7 +import semver from 'semver';
8 +import { z } from 'zod';
9 +
10 +const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..');
11 +const providersDir = path.join(repoRoot, 'ts/packages/providers');
12 +const coreDir = path.join(repoRoot, 'ts/packages/core');
13 +const jsonSchemaToZodDir = path.join(repoRoot, 'ts/packages/json-schema-to-zod');
14 +const npmBin = process.platform === 'win32' ? 'npm.cmd' : 'npm';
15 +const pnpmBin = process.platform === 'win32' ? 'pnpm.cmd' : 'pnpm';
16 +
17 +// Published 0.x floors remain unchanged until the planned breaking release. These verified
18 +// floors keep the artifact gate green only for combinations the current providers can load.
19 +const PROVIDER_CONTRACTS: Record<
20 + string,
21 + { agentic: boolean; exportName: string; verifiedMinimumCore: string }
22 +> = {
23 + '@composio/anthropic': {
24 + agentic: false,
25 + exportName: 'AnthropicProvider',
26 + verifiedMinimumCore: '0.14.0',
27 + },
28 + '@composio/claude-agent-sdk': {
29 + agentic: true,
30 + exportName: 'ClaudeAgentSDKProvider',
31 + verifiedMinimumCore: '0.11.0',
32 + },
33 + '@composio/cloudflare': {
34 + agentic: false,
35 + exportName: 'CloudflareProvider',
36 + verifiedMinimumCore: '0.14.0',
37 + },
38 + '@composio/google': {
39 + agentic: false,
40 + exportName: 'GoogleProvider',
41 + verifiedMinimumCore: '0.16.0',
42 + },
43 + '@composio/langchain': {
44 + agentic: true,
45 + exportName: 'LangchainProvider',
46 + verifiedMinimumCore: '0.11.0',
47 + },
48 + '@composio/llamaindex': {
49 + agentic: true,
50 + exportName: 'LlamaindexProvider',
51 + verifiedMinimumCore: '0.11.0',
52 + },
53 + '@composio/mastra': {
54 + agentic: true,
55 + exportName: 'MastraProvider',
56 + verifiedMinimumCore: '0.18.0',
57 + },
58 + '@composio/openai': {
59 + agentic: false,
60 + exportName: 'OpenAIProvider',
61 + verifiedMinimumCore: '0.18.0',
62 + },
63 + '@composio/openai-agents': {
64 + agentic: true,
65 + exportName: 'OpenAIAgentsProvider',
66 + verifiedMinimumCore: '0.18.0',
67 + },
68 + '@composio/vercel': {
69 + agentic: true,
70 + exportName: 'VercelProvider',
71 + verifiedMinimumCore: '0.18.0',
72 + },
73 +};
74 +
75 +const StringRecordSchema = z.record(z.string(), z.string());
76 +const PackageManifestSchema = z
77 + .object({
78 + name: z.string().min(1),
79 + version: z.string().min(1),
80 + peerDependencies: StringRecordSchema.default({}),
81 + dependencies: StringRecordSchema.default({}),
82 + })
83 + .passthrough();
84 +const JSON_SCHEMA_TO_ZOD = '@composio/json-schema-to-zod';
85 +const InstalledPackageManifestSchema = z.object({ version: z.string().min(1) }).passthrough();
86 +
87 +export type ProviderCompatibilityCase = {
88 + directory: string;
89 + name: string;
90 + version: string;
91 + advertisedMinimumCoreVersion: string;
92 + verifiedMinimumCoreVersion: string;
93 + agentic: boolean;
94 + providerExportName: string;
95 + externalPeers: Record<string, string>;
96 +};
97 +
98 +export type CompatibilityLane = {
99 + id: string;
100 + core:
101 + | { kind: 'workspace' }
102 + | { kind: 'workspace-prerelease'; version: string }
103 + | { kind: 'registry'; specifier: string };
104 + providerNames: string[];
105 + // The release-blocking workspace lane installs exactly as a consumer does so install-time
106 + // lifecycle failures cannot pass the gate; the other lanes skip that cost.
107 + lifecycleScripts: 'run' | 'skip';
108 +};
109 +
110 +export type CliOptions = {
111 + lanes: Set<'current' | 'minimum' | 'beta'>;
112 + planOnly: boolean;
113 +};
114 +
115 +async function readJsonFile<T>(filePath: string, schema: z.ZodType<T>): Promise<T> {
116 + const raw: unknown = JSON.parse(await readFile(filePath, 'utf8'));
117 + const result = schema.safeParse(raw);
118 + if (!result.success) {
119 + throw new Error(
120 + `Invalid JSON in ${path.relative(repoRoot, filePath)}: ${result.error.message}`
121 + );
122 + }
123 + return result.data;
124 +}
125 +
126 +function installedPeerManifestPath(providerDirectory: string, peerName: string): string {
127 + return path.join(providerDirectory, 'node_modules', ...peerName.split('/'), 'package.json');
128 +}
129 +
130 +async function readInstalledPeerVersion(
131 + providerDirectory: string,
132 + peerName: string
133 +): Promise<string> {
134 + const manifestPath = installedPeerManifestPath(providerDirectory, peerName);
135 + try {
136 + const manifest = await readJsonFile(manifestPath, InstalledPackageManifestSchema);
137 + return manifest.version;
138 + } catch (error) {
139 + throw new Error(
140 + `Could not resolve installed peer ${peerName} for ${path.relative(repoRoot, providerDirectory)}. Run pnpm install first.`,
141 + { cause: error }
142 + );
143 + }
144 +}
145 +
146 +export async function discoverProviderCases(): Promise<ProviderCompatibilityCase[]> {
147 + const entries = await readdir(providersDir, { withFileTypes: true });
148 + const providers: ProviderCompatibilityCase[] = [];
149 +
150 + for (const entry of entries) {
151 + if (!entry.isDirectory()) continue;
152 +
153 + const directory = path.join(providersDir, entry.name);
154 + const manifestPath = path.join(directory, 'package.json');
155 + try {
156 + await access(manifestPath);
157 + } catch {
158 + continue;
159 + }
160 +
161 + const manifest = await readJsonFile(manifestPath, PackageManifestSchema);
162 + const coreRange = manifest.peerDependencies['@composio/core'];
163 + if (!coreRange) {
164 + throw new Error(`${manifest.name} must declare @composio/core as a peer dependency`);
165 + }
166 +
167 + const minimumCore = semver.minVersion(coreRange);
168 + if (!minimumCore) {
169 + throw new Error(`${manifest.name} has an invalid @composio/core peer range: ${coreRange}`);
170 + }
171 + const contract = PROVIDER_CONTRACTS[manifest.name];
172 + if (!contract) {
173 + throw new Error(`${manifest.name} must define a packed consumer contract`);
174 + }
175 +
176 + const externalPeers: Record<string, string> = {};
177 + for (const peerName of Object.keys(manifest.peerDependencies).sort()) {
178 + if (peerName === '@composio/core') continue;
179 + externalPeers[peerName] = await readInstalledPeerVersion(directory, peerName);
180 + }
181 +
182 + providers.push({
183 + directory,
184 + name: manifest.name,
185 + version: manifest.version,
186 + advertisedMinimumCoreVersion: minimumCore.version,
187 + verifiedMinimumCoreVersion: contract.verifiedMinimumCore,
188 + agentic: contract.agentic,
189 + providerExportName: contract.exportName,
190 + externalPeers,
191 + });
192 + }
193 +
194 + if (providers.length === 0) {
195 + throw new Error('No provider packages were found');
196 + }
197 +
198 + return providers.sort((left, right) => left.name.localeCompare(right.name));
199 +}
200 +
201 +export function buildCompatibilityPlan(
202 + providers: ProviderCompatibilityCase[],
203 + prereleaseVersion = process.env.COMPOSIO_CORE_PRERELEASE_VERSION || '1.0.0-beta.0'
204 +): CompatibilityLane[] {
205 + const providerNames = providers.map(provider => provider.name);
206 + const lanes: CompatibilityLane[] = [
207 + {
208 + id: 'workspace-current',
209 + core: { kind: 'workspace' },
210 + providerNames,
211 + lifecycleScripts: 'run',
212 + },
213 + ];
214 +
215 + for (const provider of providers) {
216 + lanes.push({
217 + id: `verified-minimum-core-${provider.verifiedMinimumCoreVersion}-${provider.name.replace('@', '').replace('/', '-')}`,
218 + core: { kind: 'registry', specifier: provider.verifiedMinimumCoreVersion },
219 + providerNames: [provider.name],
220 + lifecycleScripts: 'skip',
221 + });
222 + }
223 +
224 + lanes.push({
225 + id: 'workspace-major-prerelease',
226 + core: { kind: 'workspace-prerelease', version: prereleaseVersion },
227 + providerNames,
228 + lifecycleScripts: 'skip',
229 + });
230 +
231 + return lanes;
232 +}
233 +
234 +export function parseCliOptions(args: string[]): CliOptions {
235 + const lanes = new Set<'current' | 'minimum' | 'beta'>();
236 + let planOnly = false;
237 +
238 + for (let index = 0; index < args.length; index += 1) {
239 + const argument = args[index];
240 + if (argument === '--') {
241 + continue;
242 + }
243 + if (argument === '--plan') {
244 + planOnly = true;
245 + continue;
246 + }
247 + if (argument === '--lane') {
248 + const lane = args[index + 1];
249 + if (lane !== 'current' && lane !== 'minimum' && lane !== 'beta') {
250 + throw new Error('--lane must be current, minimum, or beta');
251 + }
252 + lanes.add(lane);
253 + index += 1;
254 + continue;
255 + }
256 + throw new Error(`Unknown argument: ${argument}`);
257 + }
258 +
259 + if (lanes.size === 0) {
260 + lanes.add('current');
261 + lanes.add('minimum');
262 + lanes.add('beta');
263 + }
264 +
265 + return { lanes, planOnly };
266 +}
267 +
268 +function laneCategory(lane: CompatibilityLane): 'current' | 'minimum' | 'beta' {
269 + if (lane.id === 'workspace-current') return 'current';
270 + if (lane.id === 'workspace-major-prerelease') return 'beta';
271 + return 'minimum';
272 +}
273 +
274 +function run(command: string, args: string[], cwd = repoRoot): string {
275 + const result = spawnSync(command, args, {
276 + cwd,
277 + encoding: 'utf8',
278 + env: {
279 + ...process.env,
280 + FORCE_COLOR: '0',
281 + NO_COLOR: '1',
282 + npm_config_update_notifier: 'false',
283 + },
284 + });
285 +
286 + if (result.status !== 0) {
287 + const output = [result.stdout, result.stderr].filter(Boolean).join('\n').trim();
288 + const lines = output.split('\n');
289 + const relevantOutput =
290 + lines.length > 120
291 + ? [
292 + ...lines.slice(0, 40),
293 + `... ${lines.length - 120} lines omitted ...`,
294 + ...lines.slice(-80),
295 + ].join('\n')
296 + : output;
297 + throw new Error(
298 + [`Command failed: ${command} ${args.join(' ')}`, relevantOutput].filter(Boolean).join('\n')
299 + );
300 + }
301 +
302 + return result.stdout.trim();
303 +}
304 +
305 +function packageTarballName(packageName: string, version: string): string {
306 + return `${packageName.replace(/^@/, '').replaceAll('/', '-')}-${version}.tgz`;
307 +}
308 +
309 +async function packPackage(
310 + packageDirectory: string,
311 + packageName: string,
312 + version: string,
313 + artifactDirectory: string
314 +): Promise<string> {
315 + run(pnpmBin, [
316 + '--dir',
317 + packageDirectory,
318 + 'pack',
319 + '--pack-destination',
320 + artifactDirectory,
321 + '--silent',
322 + ]);
323 + const tarballPath = path.join(artifactDirectory, packageTarballName(packageName, version));
324 + await access(tarballPath);
325 +
326 + const contents = run('tar', ['-tzf', tarballPath]);
327 + for (const requiredPath of [
328 + 'package/package.json',
329 + 'package/dist/index.mjs',
330 + 'package/dist/index.d.mts',
331 + ]) {
332 + if (!contents.split('\n').includes(requiredPath)) {
333 + throw new Error(`${packageName} tarball is missing ${requiredPath}`);
334 + }
335 + }
336 +
337 + return tarballPath;
338 +}
339 +
340 +async function packWorkspaceArtifacts(
341 + providers: ProviderCompatibilityCase[],
342 + artifactDirectory: string,
343 + prereleaseVersion: string
344 +): Promise<Map<string, string>> {
345 + const coreManifest = await readJsonFile(
346 + path.join(coreDir, 'package.json'),
347 + PackageManifestSchema
348 + );
349 + const jsonSchemaManifest = await readJsonFile(
350 + path.join(jsonSchemaToZodDir, 'package.json'),
351 + PackageManifestSchema
352 + );
353 + const tarballs = new Map<string, string>();
354 +
355 + const jsonSchemaTarball = await packPackage(
356 + jsonSchemaToZodDir,
357 + jsonSchemaManifest.name,
358 + jsonSchemaManifest.version,
359 + artifactDirectory
360 + );
361 + const packedCore = await packPackage(
362 + coreDir,
363 + coreManifest.name,
364 + coreManifest.version,
365 + artifactDirectory
366 + );
367 + tarballs.set(
368 + coreManifest.name,
369 + await repackCoreTarball(packedCore, coreManifest.name, {
370 + version: coreManifest.version,
371 + jsonSchemaTarball,
372 + artifactDirectory: path.join(artifactDirectory, 'core-workspace'),
373 + })
374 + );
375 + tarballs.set(
376 + `${coreManifest.name}@prerelease`,
377 + await repackCoreTarball(packedCore, coreManifest.name, {
378 + version: prereleaseVersion,
379 + jsonSchemaTarball,
380 + artifactDirectory: path.join(artifactDirectory, 'core-prerelease'),
381 + })
382 + );
383 +
384 + for (const provider of providers) {
385 + tarballs.set(
386 + provider.name,
387 + await packPackage(provider.directory, provider.name, provider.version, artifactDirectory)
388 + );
389 + }
390 +
391 + return tarballs;
392 +}
393 +
394 +export async function repackCoreTarball(
395 + tarballPath: string,
396 + packageName: string,
397 + options: { version: string; jsonSchemaTarball: string; artifactDirectory: string }
398 +): Promise<string> {
399 + // Consumers install core and providers only, so the unpublished workspace helper must reach
400 + // them through core's own dependency declaration. A release gate also cannot depend on a
401 + // prerelease that has not been published yet, so the same repack re-versions the exact
402 + // workspace tarball for the prerelease peer lane.
403 + const stagingDirectory = path.join(options.artifactDirectory, 'staging');
404 + await mkdir(stagingDirectory, { recursive: true });
405 + run('tar', ['-xzf', tarballPath, '-C', stagingDirectory]);
406 +
407 + const manifestPath = path.join(stagingDirectory, 'package/package.json');
408 + const manifest = await readJsonFile(manifestPath, PackageManifestSchema);
409 + if (!manifest.dependencies[JSON_SCHEMA_TO_ZOD]) {
410 + throw new Error(
411 + `${packageName} packed manifest must declare ${JSON_SCHEMA_TO_ZOD} as a dependency`
412 + );
413 + }
414 + manifest.version = options.version;
415 + manifest.dependencies[JSON_SCHEMA_TO_ZOD] = `file:${options.jsonSchemaTarball}`;
416 + await writeFile(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);
417 +
418 + const repackedTarball = path.join(
419 + options.artifactDirectory,
420 + packageTarballName(packageName, options.version)
421 + );
422 + run('tar', ['-czf', repackedTarball, '-C', stagingDirectory, 'package']);
423 + return repackedTarball;
424 +}
425 +
426 +function mergeExternalPeers(providers: ProviderCompatibilityCase[]): Record<string, string> {
427 + const peers: Record<string, string> = {};
428 + for (const provider of providers) {
429 + for (const [peerName, version] of Object.entries(provider.externalPeers)) {
430 + const existingVersion = peers[peerName];
431 + if (existingVersion && existingVersion !== version) {
432 + throw new Error(
433 + `${peerName} resolves to both ${existingVersion} and ${version} across provider fixtures`
434 + );
435 + }
436 + peers[peerName] = version;
437 + }
438 + }
439 + return peers;
440 +}
441 +
442 +async function writeConsumerFixture(
443 + fixtureDirectory: string,
444 + lane: CompatibilityLane,
445 + providers: ProviderCompatibilityCase[],
446 + tarballs: Map<string, string>
447 +): Promise<void> {
448 + const dependencies: Record<string, string> = {
449 + ...mergeExternalPeers(providers),
450 + typescript: (
451 + await readJsonFile(
452 + path.join(repoRoot, 'node_modules/typescript/package.json'),
453 + InstalledPackageManifestSchema
454 + )
455 + ).version,
456 + };
457 +
458 + for (const provider of providers) {
459 + const tarball = tarballs.get(provider.name);
460 + if (!tarball) throw new Error(`Missing packed artifact for ${provider.name}`);
461 + dependencies[provider.name] = `file:${tarball}`;
462 + }
463 +
464 + if (lane.core.kind !== 'registry') {
465 + const coreTarball = tarballs.get(
466 + lane.core.kind === 'workspace' ? '@composio/core' : '@composio/core@prerelease'
467 + );
468 + if (!coreTarball) {
469 + throw new Error('Missing packed core workspace artifact');
470 + }
471 + dependencies['@composio/core'] = `file:${coreTarball}`;
472 + } else {
473 + dependencies['@composio/core'] = lane.core.specifier;
474 + }
475 +
476 + const imports = providers.map((provider, index) => ({
477 + identifier: `provider${index}`,
478 + name: provider.name,
479 + exportName: provider.providerExportName,
480 + agentic: provider.agentic,
481 + }));
482 +
483 + await writeFile(
484 + path.join(fixtureDirectory, 'package.json'),
485 + `${JSON.stringify({ private: true, type: 'module', dependencies }, null, 2)}\n`
486 + );
487 + await writeFile(
488 + path.join(fixtureDirectory, 'index.ts'),
489 + `import type { ExecuteToolFn, Tool } from '@composio/core';\n${imports
490 + .map(item => `import { ${item.exportName} as ${item.identifier} } from '${item.name}';`)
491 + .join(
492 + '\n'
493 + )}\nconst tool: Tool = { slug: 'COMPATIBILITY_CHECK', name: 'Compatibility check', description: 'Checks packed provider conversion', inputParameters: { type: 'object', properties: { value: { type: 'string' } }, required: ['value'] }, toolkit: { slug: 'compatibility', name: 'Compatibility' }, tags: [] };\nconst executeTool: ExecuteToolFn = async () => ({ data: {}, error: null, successful: true });\n${imports
494 + .map(
495 + item =>
496 + `const ${item.identifier}Instance = new ${item.identifier}();\nconst ${item.identifier}Tool = ${item.identifier}Instance.wrapTool(tool${item.agentic ? ', executeTool' : ''});\nvoid ${item.identifier}Tool;`
497 + )
498 + .join('\n')}\n`
499 + );
500 + await writeFile(
501 + path.join(fixtureDirectory, 'index.mjs'),
502 + `const providerContracts = ${JSON.stringify(imports.map(item => [item.name, item.exportName, item.agentic]))};\nconst tool = { slug: 'COMPATIBILITY_CHECK', name: 'Compatibility check', description: 'Checks packed provider conversion', inputParameters: { type: 'object', properties: { value: { type: 'string' } }, required: ['value'] }, toolkit: { slug: 'compatibility', name: 'Compatibility' }, tags: [] };\nconst executeTool = async () => ({ data: {}, error: null, successful: true });\nfor (const [packageName, exportName, agentic] of providerContracts) {\n const packageExports = await import(packageName);\n const Provider = packageExports[exportName];\n if (typeof Provider !== 'function') throw new Error(\`\${packageName} does not export \${exportName}\`);\n const provider = new Provider();\n const wrappedTool = provider.wrapTool(tool, ...(agentic ? [executeTool] : []));\n if ((typeof wrappedTool !== 'object' || wrappedTool === null) && typeof wrappedTool !== 'function') throw new Error(\`\${packageName} did not wrap a minimal tool\`);\n}\nconst core = JSON.parse(await (await import('node:fs/promises')).readFile(new URL('./node_modules/@composio/core/package.json', import.meta.url), 'utf8'));\nconsole.log(\`${lane.id}: wrapped a tool with \${providerContracts.length} providers and @composio/core@\${core.version}\`);\n`
503 + );
504 + await writeFile(
505 + path.join(fixtureDirectory, 'tsconfig.json'),
506 + `${JSON.stringify(
507 + {
508 + compilerOptions: {
509 + strict: true,
510 + noEmit: true,
511 + // This aggregate fixture owns Composio's package boundary. Provider-specific
512 + // strict fixtures own upstream declaration compatibility so unrelated framework
513 + // internals cannot make every provider's packaging result unreadable.
514 + skipLibCheck: true,
515 + target: 'ES2022',
516 + module: 'NodeNext',
517 + moduleResolution: 'NodeNext',
518 + },
519 + include: ['index.ts'],
520 + },
521 + null,
522 + 2
523 + )}\n`
524 + );
525 +}
526 +
527 +async function runLane(
528 + lane: CompatibilityLane,
529 + allProviders: ProviderCompatibilityCase[],
530 + tarballs: Map<string, string>,
531 + runDirectory: string
532 +): Promise<void> {
533 + const providers = lane.providerNames.map(name => {
534 + const provider = allProviders.find(candidate => candidate.name === name);
535 + if (!provider) throw new Error(`Unknown provider in compatibility plan: ${name}`);
536 + return provider;
537 + });
538 + const fixtureDirectory = path.join(runDirectory, lane.id);
539 + await mkdir(fixtureDirectory, { recursive: true });
540 + await writeConsumerFixture(fixtureDirectory, lane, providers, tarballs);
541 +
542 + const installArgs = [
543 + 'install',
544 + ...(lane.lifecycleScripts === 'skip' ? ['--ignore-scripts'] : []),
545 + '--package-lock=false',
546 + '--no-audit',
547 + '--no-fund',
548 + ];
549 + console.log(
550 + `${lane.id}: installing ${providers.length} packed provider package(s), lifecycle scripts: ${lane.lifecycleScripts}`
551 + );
552 + run(npmBin, installArgs, fixtureDirectory);
553 + run(path.join(fixtureDirectory, 'node_modules/.bin/tsc'), ['--noEmit'], fixtureDirectory);
554 + const result = run(process.execPath, ['index.mjs'], fixtureDirectory);
555 + console.log(result);
556 +}
557 +
558 +async function main(): Promise<void> {
559 + const options = parseCliOptions(process.argv.slice(2));
560 + const providers = await discoverProviderCases();
561 + const plan = buildCompatibilityPlan(providers).filter(lane =>
562 + options.lanes.has(laneCategory(lane))
563 + );
564 + const prereleaseLane = plan.find(lane => lane.core.kind === 'workspace-prerelease');
565 + const prereleaseVersion =
566 + prereleaseLane?.core.kind === 'workspace-prerelease'
567 + ? prereleaseLane.core.version
568 + : process.env.COMPOSIO_CORE_PRERELEASE_VERSION || '1.0.0-beta.0';
569 +
570 + if (options.planOnly) {
571 + console.log(JSON.stringify({ providers, lanes: plan }, null, 2));
572 + return;
573 + }
574 +
575 + const deferredFloorCorrections = providers.filter(
576 + provider => provider.advertisedMinimumCoreVersion !== provider.verifiedMinimumCoreVersion
577 + );
578 + if (deferredFloorCorrections.length > 0) {
579 + console.log(
580 + `Using verified core floors without changing published 0.x ranges: ${deferredFloorCorrections
581 + .map(
582 + provider =>
583 + `${provider.name} ${provider.advertisedMinimumCoreVersion}→${provider.verifiedMinimumCoreVersion}`
584 + )
585 + .join(', ')}`
586 + );
587 + }
588 +
589 + const runDirectory = await mkdtemp(path.join(tmpdir(), 'composio-provider-compatibility-'));
590 + try {
591 + const artifactDirectory = path.join(runDirectory, 'artifacts');
592 + await mkdir(artifactDirectory, { recursive: true });
593 + const tarballs = await packWorkspaceArtifacts(providers, artifactDirectory, prereleaseVersion);
594 +
595 + console.log(
596 + `Checking ${providers.length} providers across ${plan.length} compatibility lanes...`
597 + );
598 + const failures: string[] = [];
599 + for (const lane of plan) {
600 + try {
601 + await runLane(lane, providers, tarballs, runDirectory);
602 + } catch (error) {
603 + const message = error instanceof Error ? error.message : String(error);
604 + console.error(`${lane.id}: failed\n${message}`);
605 + failures.push(lane.id);
606 + }
607 + }
608 + if (failures.length > 0) {
609 + throw new Error(
610 + `Provider compatibility failed in ${failures.length} lane(s): ${failures.join(', ')}`
611 + );
612 + }
613 + console.log('Packed provider compatibility checks passed.');
614 + } finally {
615 + await rm(runDirectory, { recursive: true, force: true });
616 + }
617 +}
618 +
619 +const entrypoint = process.argv[1] ? pathToFileURL(path.resolve(process.argv[1])).href : '';
620 +if (import.meta.url === entrypoint) {
621 + main().catch(error => {
622 + console.error(error instanceof Error ? error.message : String(error));
623 + process.exitCode = 1;
624 + });
625 +}