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
+}