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.

test(openai): cover v6 and v7 consumers

jkomynoa8d7401b7365
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index ea09468b8..f74138656 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -505,8 +505,26 @@ importers:
specifier: workspace:*
version: link:../../../_utils
+ ts/e2e-tests/runtimes/node/openai-v7-zod4-compat:
+ devDependencies:
+ '@composio/core':
+ specifier: workspace:*
+ version: link:../../../../packages/core
+ '@composio/openai':
+ specifier: workspace:*
+ version: link:../../../../packages/providers/openai
+ '@e2e-tests/utils':
+ specifier: workspace:*
+ version: link:../../../_utils
+
ts/e2e-tests/runtimes/node/openai-zod4-compat:
devDependencies:
+ '@composio/core':
+ specifier: workspace:*
+ version: link:../../../../packages/core
+ '@composio/openai':
+ specifier: workspace:*
+ version: link:../../../../packages/providers/openai
'@e2e-tests/utils':
specifier: workspace:*
version: link:../../../_utils
@@ -7802,6 +7820,10 @@ snapshots:
dependencies:
hono: 4.12.31
+ dependencies:
+ hono: 4.12.33
+
'@img/[email protected]': {}
@@ -8473,7 +8495,7 @@ snapshots:
'@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected])':
dependencies:
- '@hono/node-server': 2.0.11([email protected])
+ '@hono/node-server': 2.0.11([email protected])
ajv: 8.20.0
ajv-formats: 3.0.1([email protected])
content-type: 1.0.5
@@ -8483,7 +8505,7 @@ snapshots:
eventsource-parser: 3.1.0
express: 5.2.1
express-rate-limit: 8.6.0([email protected])
- hono: 4.12.31
+ hono: 4.12.33
jose: 6.2.4
json-schema-typed: 8.0.2
pkce-challenge: 5.0.1
diff --git a/ts/e2e-tests/runtimes/node/openai-v7-zod4-compat/README.md b/ts/e2e-tests/runtimes/node/openai-v7-zod4-compat/README.md
new file mode 100644
index 000000000..7f0d6dc03
--- /dev/null
+++ b/ts/e2e-tests/runtimes/node/openai-v7-zod4-compat/README.md
@@ -0,0 +1,16 @@
+# OpenAI v7 + Zod v4 Compatibility Test
+
+Verifies that packed `@composio/core` and `@composio/openai` packages install,
+typecheck, and run with explicit OpenAI 7 and Zod 4 versions.
+
+The consumer typecheck covers exported Chat Completions and Responses types
+without `skipLibCheck`. Runtime assertions construct clients with fake keys,
+wrap tools through both providers, and make no network requests.
+
+The Docker matrix covers Node.js 22.22.3, 24.17.0, and 25.9.0.
+
+Run it from the repository root:
+
+```bash
+pnpm --filter @e2e-tests/node-openai-v7-zod4-compat test:e2e:node
+```
diff --git a/ts/e2e-tests/runtimes/node/openai-v7-zod4-compat/e2e.test.ts b/ts/e2e-tests/runtimes/node/openai-v7-zod4-compat/e2e.test.ts
new file mode 100644
index 000000000..d912c3303
--- /dev/null
+++ b/ts/e2e-tests/runtimes/node/openai-v7-zod4-compat/e2e.test.ts
@@ -0,0 +1,52 @@
+/**
+ * Packed @composio/core and @composio/openai compatibility with OpenAI 7.
+ */
+
+import { e2e, type E2ETestResultWithSetup } from '@e2e-tests/utils';
+import { describe, it, expect, beforeAll } from 'bun:test';
+
+e2e(import.meta.url, {
+ versions: { node: ['22.22.3', '24.17.0', '25.9.0'] },
+ usesFixtures: true,
+ defineTests: ({ runFixture }) => {
+ let result: E2ETestResultWithSetup;
+
+ beforeAll(async () => {
+ result = await runFixture({
+ filename: 'index.mjs',
+ setup: 'npm run install:composio && npm run typecheck',
+ });
+ }, 300_000);
+
+ describe('setup', () => {
+ it('installs and typechecks successfully', () => {
+ expect(result.setup.exitCode).toBe(0);
+ expect(result.setup.stdout).toContain('openai v7 compatibility typecheck passed');
+ });
+ });
+
+ describe('OpenAI v7 + Zod v4 compatibility', () => {
+ it('exits successfully', () => {
+ expect(result.exitCode).toBe(0);
+ });
+
+ it('loads OpenAI 7 and Zod 4', () => {
+ expect(result.stdout).toContain('zod@4 works');
+ expect(result.stdout).toContain('openai@7 works');
+ });
+
+ it('constructs the Composio client', () => {
+ expect(result.stdout).toContain('@composio/core works');
+ });
+
+ it('wraps tools through both providers', () => {
+ expect(result.stdout).toContain('core wrapTool works');
+ expect(result.stdout).toContain('responses wrapTool works');
+ });
+
+ it('runs without network access', () => {
+ expect(result.stdout).toContain('All packages work together!');
+ });
+ });
+ },
+});
diff --git a/ts/e2e-tests/runtimes/node/openai-v7-zod4-compat/fixtures/index.mjs b/ts/e2e-tests/runtimes/node/openai-v7-zod4-compat/fixtures/index.mjs
new file mode 100644
index 000000000..bd98c014b
--- /dev/null
+++ b/ts/e2e-tests/runtimes/node/openai-v7-zod4-compat/fixtures/index.mjs
@@ -0,0 +1,45 @@
+import { z } from 'zod';
+import OpenAI from 'openai';
+import { Composio, OpenAIProvider } from '@composio/core';
+import { OpenAIResponsesProvider } from '@composio/openai';
+
+const schema = z.object({ name: z.string() });
+schema.parse({ name: 'OpenAI 7' });
+console.log('zod@4 works');
+
+const openai = new OpenAI({ apiKey: 'test-key' });
+if (!openai.responses) {
+ throw new Error('OpenAI client does not expose the Responses API');
+}
+console.log('openai@7 works');
+
+const chatProvider = new OpenAIProvider();
+const composio = new Composio({
+ provider: chatProvider,
+ apiKey: 'test-key',
+});
+if (!composio) {
+ throw new Error('Composio client construction failed');
+}
+console.log('@composio/core works');
+
+const composioTool = {
+ slug: 'TEST',
+ description: 'Test tool',
+ inputParameters: { type: 'object', properties: {} },
+};
+
+const chatTool = chatProvider.wrapTool(composioTool);
+if (chatTool.type !== 'function' || chatTool.function.name !== 'TEST') {
+ throw new Error('Core OpenAI provider returned an invalid tool');
+}
+console.log('core wrapTool works');
+
+const responsesProvider = new OpenAIResponsesProvider();
+const responsesTool = responsesProvider.wrapTool(composioTool);
+if (responsesTool.type !== 'function' || responsesTool.name !== 'TEST') {
+ throw new Error('Responses provider returned an invalid tool');
+}
+console.log('responses wrapTool works');
+
+console.log('All packages work together!');
diff --git a/ts/e2e-tests/runtimes/node/openai-v7-zod4-compat/fixtures/index.ts b/ts/e2e-tests/runtimes/node/openai-v7-zod4-compat/fixtures/index.ts
new file mode 100644
index 000000000..f794dbc99
--- /dev/null
+++ b/ts/e2e-tests/runtimes/node/openai-v7-zod4-compat/fixtures/index.ts
@@ -0,0 +1,31 @@
+import OpenAI from 'openai';
+import { OpenAIProvider, type Tool } from '@composio/core';
+import { OpenAIResponsesProvider } from '@composio/openai';
+
+const composioTool = {
+ slug: 'TEST_TOOL',
+ name: 'Test Tool',
+ description: 'A tool used by the OpenAI compatibility fixture',
+ version: '20260625_00',
+ availableVersions: ['20260625_00'],
+ inputParameters: {
+ type: 'object',
+ properties: {
+ query: { type: 'string' },
+ },
+ required: ['query'],
+ },
+ tags: [],
+} satisfies Tool;
+
+const chatProvider = new OpenAIProvider();
+const chatTool = chatProvider.wrapTool(composioTool);
+const _openAIChatTool: OpenAI.ChatCompletionTool = chatTool;
+
+const responsesProvider = new OpenAIResponsesProvider();
+const responsesTool = responsesProvider.wrapTool(composioTool);
+const _openAIResponsesTool: OpenAI.Responses.FunctionTool = responsesTool;
+
+type ProviderToolCall = Parameters<OpenAIResponsesProvider['executeToolCall']>[1];
+declare const openAIToolCall: OpenAI.Responses.ResponseFunctionToolCall;
+const _providerToolCall: ProviderToolCall = openAIToolCall;
diff --git a/ts/e2e-tests/runtimes/node/openai-v7-zod4-compat/fixtures/package.json b/ts/e2e-tests/runtimes/node/openai-v7-zod4-compat/fixtures/package.json
new file mode 100644
index 000000000..d855e2589
--- /dev/null
+++ b/ts/e2e-tests/runtimes/node/openai-v7-zod4-compat/fixtures/package.json
@@ -0,0 +1,13 @@
+{
+ "private": true,
+ "type": "module",
+ "scripts": {
+ "install:composio": "pnpm --dir /app/ts/packages/core pack --pack-destination . --silent >/dev/null && pnpm --dir /app/ts/packages/providers/openai pack --pack-destination . --silent >/dev/null && npm install --ignore-scripts --package-lock=false ./composio-core-*.tgz ./composio-openai-*.tgz",
+ "typecheck": "tsc --noEmit && echo openai v7 compatibility typecheck passed"
+ },
+ "dependencies": {
+ "openai": "7.2.0",
+ "typescript": "5.8.3",
+ "zod": "4.4.3"
+ }
+}
diff --git a/ts/e2e-tests/runtimes/node/openai-v7-zod4-compat/fixtures/tsconfig.json b/ts/e2e-tests/runtimes/node/openai-v7-zod4-compat/fixtures/tsconfig.json
new file mode 100644
index 000000000..9fb0d1b7a
--- /dev/null
+++ b/ts/e2e-tests/runtimes/node/openai-v7-zod4-compat/fixtures/tsconfig.json
@@ -0,0 +1,12 @@
+{
+ "$schema": "https://json.schemastore.org/tsconfig",
+ "compilerOptions": {
+ "target": "es2022",
+ "module": "nodenext",
+ "moduleResolution": "nodenext",
+ "strict": true,
+ "skipLibCheck": false,
+ "noEmit": true
+ },
+ "include": ["index.ts"]
+}
diff --git a/ts/e2e-tests/runtimes/node/openai-v7-zod4-compat/package.json b/ts/e2e-tests/runtimes/node/openai-v7-zod4-compat/package.json
new file mode 100644
index 000000000..c96d40c10
--- /dev/null
+++ b/ts/e2e-tests/runtimes/node/openai-v7-zod4-compat/package.json
@@ -0,0 +1,16 @@
+{
+ "name": "@e2e-tests/node-openai-v7-zod4-compat",
+ "version": "0.0.0",
+ "private": true,
+ "type": "module",
+ "scripts": {
+ "typecheck": "tsc --noEmit",
+ "test:e2e": "bun test e2e.test.ts",
+ "test:e2e:node": "bun test e2e.test.ts"
+ },
+ "devDependencies": {
+ "@composio/core": "workspace:*",
+ "@composio/openai": "workspace:*",
+ "@e2e-tests/utils": "workspace:*"
+ }
+}
diff --git a/ts/e2e-tests/runtimes/node/openai-v7-zod4-compat/tsconfig.json b/ts/e2e-tests/runtimes/node/openai-v7-zod4-compat/tsconfig.json
new file mode 100644
index 000000000..3eeaa418d
--- /dev/null
+++ b/ts/e2e-tests/runtimes/node/openai-v7-zod4-compat/tsconfig.json
@@ -0,0 +1,12 @@
+{
+ "$schema": "https://json.schemastore.org/tsconfig",
+ "compilerOptions": {
+ "target": "es2022",
+ "module": "esnext",
+ "moduleResolution": "bundler",
+ "strict": true,
+ "skipLibCheck": true,
+ "noEmit": true
+ },
+ "include": ["e2e.test.ts"]
+}
diff --git a/ts/e2e-tests/runtimes/node/openai-zod4-compat/README.md b/ts/e2e-tests/runtimes/node/openai-zod4-compat/README.md
index 817efc639..f8bf6692d 100644
--- a/ts/e2e-tests/runtimes/node/openai-zod4-compat/README.md
+++ b/ts/e2e-tests/runtimes/node/openai-zod4-compat/README.md
@@ -1,6 +1,7 @@
-# OpenAI + Zod v4 Compatibility Test
+# OpenAI v6 + Zod v4 Compatibility Test
-Verifies that `@composio/core` works correctly with `openai` and `zod@4`.
+Verifies that packed `@composio/core` and `@composio/openai` packages work with
+`openai@6` and `zod@4`.
## Background
@@ -8,29 +9,30 @@ Issue [#2336](https://github.com/ComposioHQ/composio/issues/2336) reported peer
## What It Tests
-| Test | Description |
-| ------------------- | ----------------------------------------------------- |
-| npm install | Installs `@composio/core`, `openai`, and `zod@4` |
-| Package integration | Verifies all packages work together without conflicts |
-| wrapTool | Confirms OpenAI provider tool wrapping works |
+| Test | Description |
+| ------------------- | --------------------------------------------------------- |
+| npm install | Installs packed Composio packages with OpenAI 6 and Zod 4 |
+| TypeScript | Checks exported provider types against OpenAI 6 |
+| Package integration | Verifies all packages work together without conflicts |
+| wrapTool | Confirms both OpenAI provider surfaces wrap tools |
## Fixture
```
fixtures/
-├── index.mjs # Test script that imports and uses all packages
-└── package.json # Declares dependencies: @composio/core, openai@^6.16.0, zod@^4.3.5
+├── index.mjs # Offline runtime assertions
+├── index.ts # Exported-type compatibility checks
+├── package.json # Explicit OpenAI 6 and Zod 4 dependencies
+└── tsconfig.json # Strict consumer compiler settings
```
-The fixture uses `usesFixtures: true` with a setup phase to install dependencies at runtime:
-
-- `package.json` declares `@composio/core` (linked from monorepo), `openai`, and `zod@4`
-- `index.mjs` imports all three packages and verifies they work together
-- Tests `wrapTool` to ensure schema conversion works with Zod v4
+The setup phase packs both Composio packages, installs them with explicit
+OpenAI 6 and Zod 4 versions, and typechecks without `skipLibCheck`.
## Setup
-The `setup` phase runs `npm install --legacy-peer-deps` in a Docker volume, then the fixture runs with the installed `node_modules` mounted read-only.
+The runtime phase constructs clients with fake keys and never makes a network
+request.
## Isolation Tool
diff --git a/ts/e2e-tests/runtimes/node/openai-zod4-compat/e2e.test.ts b/ts/e2e-tests/runtimes/node/openai-zod4-compat/e2e.test.ts
index 4f14eb65f..75333b703 100644
--- a/ts/e2e-tests/runtimes/node/openai-zod4-compat/e2e.test.ts
+++ b/ts/e2e-tests/runtimes/node/openai-zod4-compat/e2e.test.ts
@@ -1,25 +1,16 @@
/**
* OpenAI v6 + Zod v4 compatibility e2e test
*
- * Verifies that @composio/core works correctly with openai@6 and zod@4,
- * specifically testing the fix for https://github.com/ComposioHQ/composio/issues/2336
+ * Verifies that packed @composio/core and @composio/openai packages install,
+ * typecheck, and run with openai@6 and zod@4.
*/
import { e2e, type E2ETestResultWithSetup } from '@e2e-tests/utils';
import { describe, it, expect, beforeAll } from 'bun:test';
-declare module 'bun' {
- interface Env {
- COMPOSIO_API_KEY: string;
- }
-}
-
e2e(import.meta.url, {
versions: { node: ['22.22.3', '24.17.0', '25.9.0'] },
usesFixtures: true,
- env: {
- COMPOSIO_API_KEY: Bun.env.COMPOSIO_API_KEY,
- },
defineTests: ({ runFixture }) => {
let result: E2ETestResultWithSetup;
@@ -27,14 +18,14 @@ e2e(import.meta.url, {
beforeAll(async () => {
result = await runFixture({
filename: 'index.mjs',
- setup: 'npm install --legacy-peer-deps',
+ setup: 'npm run install:composio && npm run typecheck',
});
}, 300_000);
describe('setup', () => {
- it('npm install completes successfully', () => {
- expect(result.setup.stdout).toMatch(/added \d+ packages/);
+ it('installs and typechecks successfully', () => {
expect(result.setup.exitCode).toBe(0);
+ expect(result.setup.stdout).toContain('openai v6 compatibility typecheck passed');
});
});
@@ -47,8 +38,8 @@ e2e(import.meta.url, {
expect(result.stdout).toContain('zod@4 works');
});
- it('openai@5 works', () => {
- expect(result.stdout).toContain('openai@5 works');
+ it('openai@6 works', () => {
+ expect(result.stdout).toContain('openai@6 works');
});
it('@composio/core works', () => {
@@ -56,7 +47,8 @@ e2e(import.meta.url, {
});
it('wrapTool works', () => {
- expect(result.stdout).toContain('wrapTool works');
+ expect(result.stdout).toContain('core wrapTool works');
+ expect(result.stdout).toContain('responses wrapTool works');
});
it('all packages work together', () => {
diff --git a/ts/e2e-tests/runtimes/node/openai-zod4-compat/fixtures/index.mjs b/ts/e2e-tests/runtimes/node/openai-zod4-compat/fixtures/index.mjs
index d6de8d954..a62ace691 100644
--- a/ts/e2e-tests/runtimes/node/openai-zod4-compat/fixtures/index.mjs
+++ b/ts/e2e-tests/runtimes/node/openai-zod4-compat/fixtures/index.mjs
@@ -9,30 +9,49 @@
import { z } from 'zod';
import OpenAI from 'openai';
import { Composio, OpenAIProvider } from '@composio/core';
+import { OpenAIResponsesProvider } from '@composio/openai';
// Verify zod@4 works
const schema = z.object({ name: z.string() });
console.log('✅ zod@4 works');
-// Verify openai@6 works (note: the package says openai@5 in comments but uses ^6.16.0)
+// Verify openai@6 works without making a network request.
const openai = new OpenAI({ apiKey: 'test-key' });
-console.log('✅ openai@5 works');
+if (!openai.responses) {
+ throw new Error('OpenAI client does not expose the Responses API');
+}
+console.log('✅ openai@6 works');
// Verify @composio/core works
const provider = new OpenAIProvider();
const composio = new Composio({
provider,
- apiKey: process.env.COMPOSIO_API_KEY,
+ apiKey: 'test-key',
});
+if (!composio) {
+ throw new Error('Composio client construction failed');
+}
console.log('✅ @composio/core works');
-// Verify wrapTool works
-const _tool = provider.wrapTool({
+const composioTool = {
slug: 'TEST',
description: 'Test tool',
- inputParameters: { type: 'object', properties: {} }
-});
-console.log('✅ wrapTool works');
+ inputParameters: { type: 'object', properties: {} },
+};
+
+// Verify both published provider surfaces wrap tools without API calls.
+const chatTool = provider.wrapTool(composioTool);
+if (chatTool.type !== 'function' || chatTool.function.name !== 'TEST') {
+ throw new Error('Core OpenAI provider returned an invalid tool');
+}
+console.log('✅ core wrapTool works');
+
+const responsesProvider = new OpenAIResponsesProvider();
+const responsesTool = responsesProvider.wrapTool(composioTool);
+if (responsesTool.type !== 'function' || responsesTool.name !== 'TEST') {
+ throw new Error('Responses provider returned an invalid tool');
+}
+console.log('✅ responses wrapTool works');
console.log('\n🎉 All packages work together!');
process.exit(0);
diff --git a/ts/e2e-tests/runtimes/node/openai-zod4-compat/fixtures/index.ts b/ts/e2e-tests/runtimes/node/openai-zod4-compat/fixtures/index.ts
new file mode 100644
index 000000000..f794dbc99
--- /dev/null
+++ b/ts/e2e-tests/runtimes/node/openai-zod4-compat/fixtures/index.ts
@@ -0,0 +1,31 @@
+import OpenAI from 'openai';
+import { OpenAIProvider, type Tool } from '@composio/core';
+import { OpenAIResponsesProvider } from '@composio/openai';
+
+const composioTool = {
+ slug: 'TEST_TOOL',
+ name: 'Test Tool',
+ description: 'A tool used by the OpenAI compatibility fixture',
+ version: '20260625_00',
+ availableVersions: ['20260625_00'],
+ inputParameters: {
+ type: 'object',
+ properties: {
+ query: { type: 'string' },
+ },
+ required: ['query'],
+ },
+ tags: [],
+} satisfies Tool;
+
+const chatProvider = new OpenAIProvider();
+const chatTool = chatProvider.wrapTool(composioTool);
+const _openAIChatTool: OpenAI.ChatCompletionTool = chatTool;
+
+const responsesProvider = new OpenAIResponsesProvider();
+const responsesTool = responsesProvider.wrapTool(composioTool);
+const _openAIResponsesTool: OpenAI.Responses.FunctionTool = responsesTool;
+
+type ProviderToolCall = Parameters<OpenAIResponsesProvider['executeToolCall']>[1];
+declare const openAIToolCall: OpenAI.Responses.ResponseFunctionToolCall;
+const _providerToolCall: ProviderToolCall = openAIToolCall;
diff --git a/ts/e2e-tests/runtimes/node/openai-zod4-compat/fixtures/package.json b/ts/e2e-tests/runtimes/node/openai-zod4-compat/fixtures/package.json
index 17c797253..f92112b51 100644
--- a/ts/e2e-tests/runtimes/node/openai-zod4-compat/fixtures/package.json
+++ b/ts/e2e-tests/runtimes/node/openai-zod4-compat/fixtures/package.json
@@ -1,9 +1,13 @@
{
"private": true,
"type": "module",
+ "scripts": {
+ "install:composio": "pnpm --dir /app/ts/packages/core pack --pack-destination . --silent >/dev/null && pnpm --dir /app/ts/packages/providers/openai pack --pack-destination . --silent >/dev/null && npm install --ignore-scripts --package-lock=false ./composio-core-*.tgz ./composio-openai-*.tgz",
+ "typecheck": "tsc --noEmit && echo openai v6 compatibility typecheck passed"
+ },
"dependencies": {
- "@composio/core": "file:/app/ts/packages/core",
- "openai": "^6.16.0",
- "zod": "^4.3.5"
+ "openai": "6.49.0",
+ "typescript": "5.8.3",
+ "zod": "4.4.3"
}
}
diff --git a/ts/e2e-tests/runtimes/node/openai-zod4-compat/fixtures/tsconfig.json b/ts/e2e-tests/runtimes/node/openai-zod4-compat/fixtures/tsconfig.json
new file mode 100644
index 000000000..9fb0d1b7a
--- /dev/null
+++ b/ts/e2e-tests/runtimes/node/openai-zod4-compat/fixtures/tsconfig.json
@@ -0,0 +1,12 @@
+{
+ "$schema": "https://json.schemastore.org/tsconfig",
+ "compilerOptions": {
+ "target": "es2022",
+ "module": "nodenext",
+ "moduleResolution": "nodenext",
+ "strict": true,
+ "skipLibCheck": false,
+ "noEmit": true
+ },
+ "include": ["index.ts"]
+}
diff --git a/ts/e2e-tests/runtimes/node/openai-zod4-compat/package.json b/ts/e2e-tests/runtimes/node/openai-zod4-compat/package.json
index eb6973e93..b0fd44709 100644
--- a/ts/e2e-tests/runtimes/node/openai-zod4-compat/package.json
+++ b/ts/e2e-tests/runtimes/node/openai-zod4-compat/package.json
@@ -9,6 +9,8 @@
"test:e2e:node": "bun test e2e.test.ts"
},
"devDependencies": {
+ "@composio/core": "workspace:*",
+ "@composio/openai": "workspace:*",
"@e2e-tests/utils": "workspace:*"
}
}