Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
fix(cli): bundle mcp server into subagent helper (#3049)
## Summary - replace runtime MCP SDK path resolution with static imports in the structured-output helper - ensure the helper works when shipped next to the standalone CLI binary without repo-local node_modules ## Verification - pnpm --filter @composio/cli run typecheck:src - pnpm --filter @composio/cli test test/src/services/run-subagent-acp.test.ts - built and executed the bundled helper from a temp directory outside the repo
Rahul Tarak committed
Mar 27, 2026 at 10:12 UTC
456ee40e582285bfd657ce9f669b16fd3287a4cf
21 files changed
+976
-286
.github/workflows/build-cli-binaries.yml
+2
-11
@@ -72,17 +72,8 @@ jobs:
72
./dist/binaries/${{ matrix.artifact }} --help | head -5
73
74
- name: Create archive
75
- working-directory: ts/packages/cli/dist/binaries
76
- run: |
77
- # Create subdirectory structure expected by install script
78
- # Use a temp directory name to avoid name collision with the binary file
79
- temp_dir="archive-${{ matrix.artifact }}"
80
- rm -rf "$temp_dir"
81
- mkdir -p "$temp_dir/${{ matrix.artifact }}"
82
- cp "${{ matrix.artifact }}" "$temp_dir/${{ matrix.artifact }}/composio"
83
- cp companions/run-subagent-*.mjs "$temp_dir/${{ matrix.artifact }}/"
84
- cd "$temp_dir" && zip -r "../${{ matrix.artifact }}.zip" "${{ matrix.artifact }}"
85
- cd .. && rm -r "$temp_dir"
75
+ working-directory: ts/packages/cli
76
+ run: pnpm build:binary:package
77
78
- name: Upload artifact
79
uses: actions/upload-artifact@v6
.github/workflows/cli.test-installation.yml
+61
-2
@@ -252,6 +252,65 @@ jobs:
252
fi
253
fi
254
255
+ - name: Test bundled support files
256
+ shell: bash
257
+ run: |
258
+ echo "Checking bundled support files..."
259
+
260
+ install_dir="${COMPOSIO_INSTALL_DIR:-$HOME/.composio}"
261
+ release_tag=$(cat "$install_dir/release-tag.txt")
262
+
263
+ platform=$(uname -ms)
264
+ case $platform in
265
+ 'Darwin x86_64') target=darwin-x64 ;;
266
+ 'Darwin arm64') target=darwin-aarch64 ;;
267
+ 'Linux aarch64' | 'Linux arm64')
268
+ target=linux-aarch64 ;;
269
+ 'Linux x86_64') target=linux-x64 ;;
270
+ *) echo "❌ Unsupported platform: $platform"; exit 1 ;;
271
+ esac
272
+
273
+ if [[ $target = darwin-x64 ]]; then
274
+ if [[ $(sysctl -n sysctl.proc_translated 2>/dev/null) = 1 ]]; then
275
+ target=darwin-aarch64
276
+ fi
277
+ fi
278
+
279
+ archive_name="composio-$target.zip"
280
+ archive_url="https://github.com/ComposioHQ/composio/releases/download/$release_tag/$archive_name"
281
+ tmpdir="$(mktemp -d)"
282
+ trap 'rm -rf "$tmpdir"' EXIT
283
+
284
+ curl --fail --silent --location --output "$tmpdir/$archive_name" "$archive_url"
285
+
286
+ mapfile -t expected_paths < <(
287
+ unzip -Z1 "$tmpdir/$archive_name" \
288
+ | grep -v '/$' \
289
+ | sed "s#^composio-$target/##" \
290
+ | grep -v '^composio$' \
291
+ | sort
292
+ )
293
+
294
+ if [[ ${#expected_paths[@]} -eq 0 ]]; then
295
+ echo "❌ No bundled support files found in $archive_name"
296
+ exit 1
297
+ fi
298
+
299
+ missing_paths=()
300
+ for relative_path in "${expected_paths[@]}"; do
301
+ if [[ -f "$install_dir/$relative_path" ]]; then
302
+ echo "✅ Found $relative_path"
303
+ else
304
+ missing_paths+=("$relative_path")
305
+ fi
306
+ done
307
+
308
+ if [[ ${#missing_paths[@]} -gt 0 ]]; then
309
+ printf '❌ Missing bundled support files after install:\n' >&2
310
+ printf ' %s\n' "${missing_paths[@]}" >&2
311
+ exit 1
312
+ fi
313
+
314
- name: Test shell config updates
315
run: |
316
echo "Checking shell configuration updates..."
@@ -264,7 +323,7 @@ jobs:
323
exit 1
324
fi
325
267
- if grep -q 'PATH="\\$COMPOSIO_INSTALL_DIR:\\$PATH"' ~/.zshrc; then
326
+ if grep -q 'export PATH="\\$COMPOSIO_INSTALL_DIR:\\$PATH"' ~/.zshrc; then
327
echo "✅ .zshrc updated with PATH"
328
else
329
echo "❌ .zshrc PATH not updated"
@@ -278,7 +337,7 @@ jobs:
337
exit 1
338
fi
339
281
- if grep -q 'PATH="\\$COMPOSIO_INSTALL_DIR:\\$PATH"' ~/.bashrc; then
340
+ if grep -q 'export PATH="\\$COMPOSIO_INSTALL_DIR:\\$PATH"' ~/.bashrc; then
341
echo "✅ .bashrc updated with PATH"
342
else
343
echo "❌ .bashrc PATH not updated"
.gitignore
+2
-1
@@ -35,6 +35,7 @@ report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
35
36
# turbo
37
.turbo
38
+ts/packages/cli/.generated
39
40
# lerna
41
lerna-debug.log*
@@ -60,4 +61,4 @@ test/e2e/*/node_modules
61
62
63
# Agent memory
63
-.agent_cache
\ No newline at end of file
64
+.agent_cache
eslint.config.mjs
+2
@@ -6,6 +6,8 @@ export default [
6
{
7
ignores: [
8
'ts/packages/**/dist/**',
9
+ 'ts/packages/**/.generated/**',
10
+ 'ts/packages/**/acp-adapters/**',
11
'ts/packages/**/node_modules/**',
12
'node_modules/**',
13
'examples/',
install.sh
+15
-21
@@ -164,43 +164,37 @@ mkdir -p "$COMPOSIO_INSTALL_DIR" ||
164
error "Failed to create install directory \"$COMPOSIO_INSTALL_DIR\""
165
166
exe="$COMPOSIO_INSTALL_DIR/composio"
167
-companion_modules=(
168
- "run-subagent-shared.mjs"
169
- "run-subagent-acp.mjs"
170
- "run-subagent-legacy.mjs"
171
-)
167
release_tag_file="$COMPOSIO_INSTALL_DIR/release-tag.txt"
168
174
-install_companion_modules() {
169
+install_bundle_support_files() {
170
local source_dir="$1"
171
local installed_count=0
177
- local missing=()
172
179
- for module in "${companion_modules[@]}"; do
180
- if [[ -f "$source_dir/$module" ]]; then
181
- mv "$source_dir/$module" "$COMPOSIO_INSTALL_DIR/$module"
182
- installed_count=$((installed_count + 1))
183
- else
184
- missing+=("$module")
185
- fi
186
- done
173
+ while IFS= read -r -d '' source_path; do
174
+ local relative_path=${source_path#"$source_dir"/}
175
+ local target_path="$COMPOSIO_INSTALL_DIR/$relative_path"
176
188
- if (( installed_count > 0 && installed_count < ${#companion_modules[@]} )); then
189
- error "Downloaded archive is incomplete; missing companion modules: ${missing[*]}"
190
- fi
177
+ mkdir -p "$(dirname "$target_path")" ||
178
+ error "Failed to create support file directory \"$(dirname "$target_path")\""
179
+
180
+ mv "$source_path" "$target_path" ||
181
+ error "Failed to install support file \"$relative_path\""
182
+
183
+ installed_count=$((installed_count + 1))
184
+ done < <(find "$source_dir" -mindepth 1 -type f ! -path "$source_dir/composio" -print0)
185
186
if (( installed_count == 0 )); then
193
- warn "This release archive does not include the companion modules required by 'composio run'. That command may be unavailable in this version."
187
+ warn "This release archive does not include any bundled support files beyond the main binary. Some CLI features may be unavailable in this version."
188
fi
189
}
190
191
# Handle nested directory structure (composio-<target>/composio)
192
if [[ -f "$tmpdir/composio-$target/composio" ]]; then
193
mv "$tmpdir/composio-$target/composio" "$exe"
200
- install_companion_modules "$tmpdir/composio-$target"
194
+ install_bundle_support_files "$tmpdir/composio-$target"
195
elif [[ -f "$tmpdir/composio" ]]; then
196
mv "$tmpdir/composio" "$exe"
203
- install_companion_modules "$tmpdir"
197
+ install_bundle_support_files "$tmpdir"
198
else
199
error 'Binary not found in extracted archive'
200
fi
ts/e2e-tests/_utils/Dockerfile.cli
-1
@@ -1,4 +1,3 @@
1
-# syntax=docker/dockerfile:1
1
# Reusable Dockerfile for CLI e2e tests (debian runtime)
2
# Usage: docker build -f Dockerfile.cli --build-arg CLI_VERSION=0.1.24 -t test-name .
3
ts/e2e-tests/_utils/Dockerfile.deno
+4
-8
@@ -1,4 +1,3 @@
1
-# syntax=docker/dockerfile:1
1
# Reusable Dockerfile for Deno e2e tests
2
# Usage: docker build -f Dockerfile.deno --build-arg DENO_VERSION=2.6.7 -t test-name .
3
#
@@ -18,10 +17,8 @@ USER root
17
18
WORKDIR /app
19
21
-# Install system dependencies with cache mounts
22
-RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
23
- --mount=type=cache,target=/var/lib/apt,sharing=locked \
24
- apt-get update && \
20
+# Install system dependencies
21
+RUN apt-get update && \
22
apt-get install -y --no-install-recommends ca-certificates curl unzip && \
23
rm -rf /var/lib/apt/lists/*
24
@@ -30,9 +27,8 @@ RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
27
apt-get install -y nodejs && \
28
rm -rf /var/lib/apt/lists/*
29
33
-# Install corepack (for pnpm) with npm cache mount
34
-RUN --mount=type=cache,target=/root/.npm \
35
- npm i -g corepack@latest && \
30
+# Install corepack (for pnpm)
31
+RUN npm i -g corepack@latest && \
32
corepack enable
33
34
# Install bun (version from .bun-version)
ts/e2e-tests/_utils/Dockerfile.node
+4
-8
@@ -1,4 +1,3 @@
1
-# syntax=docker/dockerfile:1
1
# Reusable Dockerfile for Node.js e2e tests
2
# Usage: docker build -f Dockerfile.node --build-arg NODE_VERSION=20.19.0 -t test-name .
3
#
@@ -15,16 +14,13 @@ ENV PATH="$BUN_INSTALL/bin:$PNPM_HOME:$PATH"
14
15
WORKDIR /app
16
18
-# Install system dependencies with cache mounts
19
-RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
20
- --mount=type=cache,target=/var/lib/apt,sharing=locked \
21
- apt-get update && \
17
+# Install system dependencies
18
+RUN apt-get update && \
19
apt-get install -y --no-install-recommends ca-certificates curl unzip && \
20
rm -rf /var/lib/apt/lists/*
21
25
-# Install corepack (for pnpm) with npm cache mount
26
-RUN --mount=type=cache,target=/root/.npm \
27
- npm i -g corepack@latest && \
22
+# Install corepack (for pnpm)
23
+RUN npm i -g corepack@latest && \
24
corepack enable
25
26
# Install bun (version from .bun-version)
ts/packages/cli/scripts/_acp-adapters.ts
new
+297
@@ -0,0 +1,297 @@
1
+import { chmod, copyFile, mkdir, mkdtemp, readFile, rename, rm, writeFile } from 'node:fs/promises';
2
+import { createRequire } from 'node:module';
3
+import * as path from 'node:path';
4
+import process from 'node:process';
5
+import decompress from 'decompress';
6
+import { $ } from 'bun';
7
+import { RUN_CODEX_ACP_BINARY_TARGETS } from '../src/services/run-companion-modules';
8
+
9
+const GENERATED_ROOT_DIR = path.resolve('./.generated');
10
+const ACP_ADAPTERS_CACHE_DIR = path.join(GENERATED_ROOT_DIR, 'acp-adapters');
11
+const ACP_ADAPTERS_MANIFEST_PATH = path.join(GENERATED_ROOT_DIR, 'acp-adapters.manifest.json');
12
+const REGISTRY_BASE_URL = 'https://registry.npmjs.org';
13
+const USER_AGENT = 'composio-cli-acp-vendor/1';
14
+const ACP_ADAPTERS_PREFIX = 'acp-adapters/';
15
+
16
+type PackageJson = {
17
+ readonly bin?: Readonly<Record<string, string>>;
18
+ readonly optionalDependencies?: Readonly<Record<string, string>>;
19
+ readonly version?: string;
20
+};
21
+
22
+type RegistryVersionManifest = {
23
+ readonly dist?: {
24
+ readonly tarball?: string;
25
+ };
26
+};
27
+
28
+type AcpAdaptersManifest = {
29
+ readonly claude: {
30
+ readonly packageName: '@zed-industries/claude-code-acp';
31
+ readonly version: string;
32
+ readonly agentSdkVersion: string;
33
+ };
34
+ readonly codex: ReadonlyArray<{
35
+ readonly packageName: string;
36
+ readonly relativePath: string;
37
+ readonly version: string;
38
+ }>;
39
+};
40
+
41
+const require = createRequire(import.meta.url);
42
+
43
+const fileExists = async (filePath: string): Promise<boolean> => Bun.file(filePath).exists();
44
+
45
+const readJsonFile = async <T>(filePath: string): Promise<T> =>
46
+ JSON.parse(await readFile(filePath, 'utf8')) as T;
47
+
48
+const resolvePackageJsonPath = (specifier: string): string =>
49
+ require.resolve(`${specifier}/package.json`);
50
+
51
+const stripAcpAdaptersPrefix = (relativePath: string): string =>
52
+ relativePath.startsWith(ACP_ADAPTERS_PREFIX)
53
+ ? relativePath.slice(ACP_ADAPTERS_PREFIX.length)
54
+ : relativePath;
55
+
56
+const readInstalledPackageJson = async (specifier: string): Promise<PackageJson> =>
57
+ readJsonFile<PackageJson>(resolvePackageJsonPath(specifier));
58
+
59
+const resolveClaudeAdapterEntryPath = async (): Promise<string> => {
60
+ const manifest = await readInstalledPackageJson('@zed-industries/claude-code-acp');
61
+ const entryPath = manifest.bin?.['claude-code-acp'];
62
+ if (!entryPath) {
63
+ throw new Error('Missing claude-code-acp bin entry in installed package metadata.');
64
+ }
65
+
66
+ return path.join(
67
+ path.dirname(resolvePackageJsonPath('@zed-industries/claude-code-acp')),
68
+ entryPath
69
+ );
70
+};
71
+
72
+const resolveClaudeAgentSdkCliPath = (): string => {
73
+ const claudeCodeAcpPkg = require.resolve('@zed-industries/claude-code-acp/package.json');
74
+ const nestedRequire = createRequire(claudeCodeAcpPkg);
75
+ const agentSdkPkg = nestedRequire.resolve('@anthropic-ai/claude-agent-sdk/package.json');
76
+ return path.join(path.dirname(agentSdkPkg), 'cli.js');
77
+};
78
+
79
+const resolveClaudeAgentSdkPackageJsonPath = (): string => {
80
+ const claudeCodeAcpPkg = require.resolve('@zed-industries/claude-code-acp/package.json');
81
+ const nestedRequire = createRequire(claudeCodeAcpPkg);
82
+ return nestedRequire.resolve('@anthropic-ai/claude-agent-sdk/package.json');
83
+};
84
+
85
+const buildCacheManifest = async (): Promise<AcpAdaptersManifest> => {
86
+ const claudePackage = await readInstalledPackageJson('@zed-industries/claude-code-acp');
87
+ const agentSdkPackage = await readJsonFile<PackageJson>(resolveClaudeAgentSdkPackageJsonPath());
88
+ const codexLauncherPackage = await readInstalledPackageJson('@zed-industries/codex-acp');
89
+
90
+ const codexTargets = RUN_CODEX_ACP_BINARY_TARGETS.map(target => {
91
+ const version = codexLauncherPackage.optionalDependencies?.[target.packageName];
92
+ if (!version) {
93
+ throw new Error(
94
+ `Missing pinned optional dependency version for ${target.packageName} in @zed-industries/codex-acp.`
95
+ );
96
+ }
97
+
98
+ return {
99
+ packageName: target.packageName,
100
+ relativePath: target.relativePath,
101
+ version,
102
+ };
103
+ });
104
+
105
+ if (!claudePackage.version || !agentSdkPackage.version) {
106
+ throw new Error('Missing installed claude ACP package versions.');
107
+ }
108
+
109
+ return {
110
+ claude: {
111
+ packageName: '@zed-industries/claude-code-acp',
112
+ version: claudePackage.version,
113
+ agentSdkVersion: agentSdkPackage.version,
114
+ },
115
+ codex: codexTargets,
116
+ };
117
+};
118
+
119
+const readExistingManifest = async (): Promise<AcpAdaptersManifest | null> => {
120
+ if (!(await fileExists(ACP_ADAPTERS_MANIFEST_PATH))) {
121
+ return null;
122
+ }
123
+
124
+ return readJsonFile<AcpAdaptersManifest>(ACP_ADAPTERS_MANIFEST_PATH).catch(() => null);
125
+};
126
+
127
+const manifestPathsExist = async (manifest: AcpAdaptersManifest): Promise<boolean> => {
128
+ const requiredPaths = [
129
+ path.join(ACP_ADAPTERS_CACHE_DIR, 'claude-code-acp.mjs'),
130
+ path.join(ACP_ADAPTERS_CACHE_DIR, 'cli.js'),
131
+ ...manifest.codex.map(target =>
132
+ path.join(ACP_ADAPTERS_CACHE_DIR, stripAcpAdaptersPrefix(target.relativePath))
133
+ ),
134
+ ];
135
+
136
+ for (const requiredPath of requiredPaths) {
137
+ if (!(await fileExists(requiredPath))) {
138
+ return false;
139
+ }
140
+ }
141
+
142
+ return true;
143
+};
144
+
145
+const fetchRegistryJson = async (
146
+ packageName: string,
147
+ version: string
148
+): Promise<RegistryVersionManifest> => {
149
+ const url = `${REGISTRY_BASE_URL}/${encodeURIComponent(packageName)}/${version}`;
150
+ const response = await fetch(url, {
151
+ headers: {
152
+ accept: 'application/json',
153
+ 'user-agent': USER_AGENT,
154
+ },
155
+ });
156
+
157
+ if (!response.ok) {
158
+ throw new Error(
159
+ `Failed to fetch registry metadata for ${packageName}@${version}: ${response.status}`
160
+ );
161
+ }
162
+
163
+ return (await response.json()) as RegistryVersionManifest;
164
+};
165
+
166
+const downloadTarball = async (url: string, targetPath: string): Promise<void> => {
167
+ const response = await fetch(url, {
168
+ headers: {
169
+ 'user-agent': USER_AGENT,
170
+ },
171
+ });
172
+
173
+ if (!response.ok) {
174
+ throw new Error(`Failed to download ${url}: ${response.status}`);
175
+ }
176
+
177
+ await writeFile(targetPath, new Uint8Array(await response.arrayBuffer()));
178
+};
179
+
180
+const buildClaudeAdapterBundle = async (cacheDir: string): Promise<void> => {
181
+ const outputPath = path.join(cacheDir, 'claude-code-acp.mjs');
182
+ const entryPath = await resolveClaudeAdapterEntryPath();
183
+ const result =
184
+ await $`${process.execPath} build ${entryPath} --target node --outfile ${outputPath}`.quiet();
185
+ if (result.exitCode !== 0) {
186
+ throw new Error('Failed to bundle claude-code-acp.mjs.');
187
+ }
188
+
189
+ await chmod(outputPath, 0o755);
190
+
191
+ const cliOutputPath = path.join(cacheDir, 'cli.js');
192
+ await copyFile(resolveClaudeAgentSdkCliPath(), cliOutputPath);
193
+ await chmod(cliOutputPath, 0o755);
194
+};
195
+
196
+const extractCodexBinaryFromTarball = async ({
197
+ binaryFileName,
198
+ packageName,
199
+ relativePath,
200
+ stageCacheDir,
201
+ stageRootDir,
202
+ version,
203
+}: {
204
+ readonly binaryFileName: string;
205
+ readonly packageName: string;
206
+ readonly relativePath: string;
207
+ readonly stageCacheDir: string;
208
+ readonly stageRootDir: string;
209
+ readonly version: string;
210
+}): Promise<void> => {
211
+ const metadata = await fetchRegistryJson(packageName, version);
212
+ const tarballUrl = metadata.dist?.tarball;
213
+ if (!tarballUrl) {
214
+ throw new Error(
215
+ `Registry metadata for ${packageName}@${version} did not include a tarball URL.`
216
+ );
217
+ }
218
+
219
+ const tempArchivePath = path.join(
220
+ stageRootDir,
221
+ `${packageName.split('/')[1]?.replaceAll('/', '-') ?? 'package'}-${version}.tgz`
222
+ );
223
+ const tempExtractDir = path.join(
224
+ stageRootDir,
225
+ `${path.basename(tempArchivePath, '.tgz')}-extract`
226
+ );
227
+
228
+ await downloadTarball(tarballUrl, tempArchivePath);
229
+ await mkdir(tempExtractDir, { recursive: true });
230
+ await decompress(tempArchivePath, tempExtractDir);
231
+
232
+ const extractedBinaryPath = path.join(tempExtractDir, 'package', 'bin', binaryFileName);
233
+ if (!(await fileExists(extractedBinaryPath))) {
234
+ throw new Error(
235
+ `Codex ACP tarball for ${packageName}@${version} did not contain ${binaryFileName}.`
236
+ );
237
+ }
238
+
239
+ const outputPath = path.join(stageCacheDir, stripAcpAdaptersPrefix(relativePath));
240
+ await mkdir(path.dirname(outputPath), { recursive: true });
241
+ await copyFile(extractedBinaryPath, outputPath);
242
+ await chmod(outputPath, 0o755);
243
+};
244
+
245
+const materializeCodexAdapters = async (
246
+ manifest: AcpAdaptersManifest,
247
+ stageRootDir: string,
248
+ stageCacheDir: string
249
+): Promise<void> => {
250
+ await Promise.all(
251
+ manifest.codex.map(target =>
252
+ extractCodexBinaryFromTarball({
253
+ binaryFileName:
254
+ RUN_CODEX_ACP_BINARY_TARGETS.find(
255
+ candidate => candidate.packageName === target.packageName
256
+ )?.binaryFileName ?? 'codex-acp',
257
+ packageName: target.packageName,
258
+ relativePath: target.relativePath,
259
+ stageCacheDir,
260
+ stageRootDir,
261
+ version: target.version,
262
+ })
263
+ )
264
+ );
265
+};
266
+
267
+export const materializeAcpAdaptersCache = async (): Promise<string> => {
268
+ const manifest = await buildCacheManifest();
269
+ const existingManifest = await readExistingManifest();
270
+
271
+ if (
272
+ existingManifest &&
273
+ JSON.stringify(existingManifest) === JSON.stringify(manifest) &&
274
+ (await manifestPathsExist(manifest))
275
+ ) {
276
+ return ACP_ADAPTERS_CACHE_DIR;
277
+ }
278
+
279
+ await mkdir(GENERATED_ROOT_DIR, { recursive: true });
280
+
281
+ const stageRootDir = await mkdtemp(path.join(GENERATED_ROOT_DIR, '.acp-adapters-'));
282
+ const stageCacheDir = path.join(stageRootDir, 'acp-adapters');
283
+
284
+ try {
285
+ await mkdir(stageCacheDir, { recursive: true });
286
+ await buildClaudeAdapterBundle(stageCacheDir);
287
+ await materializeCodexAdapters(manifest, stageRootDir, stageCacheDir);
288
+
289
+ await rm(ACP_ADAPTERS_CACHE_DIR, { force: true, recursive: true });
290
+ await rename(stageCacheDir, ACP_ADAPTERS_CACHE_DIR);
291
+ await writeFile(ACP_ADAPTERS_MANIFEST_PATH, `${JSON.stringify(manifest, null, 2)}\n`, 'utf8');
292
+ } finally {
293
+ await rm(stageRootDir, { force: true, recursive: true });
294
+ }
295
+
296
+ return ACP_ADAPTERS_CACHE_DIR;
297
+};
ts/packages/cli/scripts/_shared.ts
+62
-46
@@ -1,9 +1,37 @@
1
-import { mkdir } from 'node:fs/promises';
1
+import { chmod, copyFile, mkdir, readdir, stat, writeFile } from 'node:fs/promises';
2
+import * as path from 'node:path';
3
import process from 'node:process';
3
-import { Command } from '@effect/platform';
4
-import { Cause, Console, Effect, Exit, Stream } from 'effect';
4
+import { Cause, Effect, Exit } from 'effect';
5
import type { Teardown } from '@effect/platform/Runtime';
6
-import { RUN_COMPANION_MODULE_BASENAMES } from '../src/services/run-companion-modules';
6
+import {
7
+ collectRunCompanionAssetRelativePaths,
8
+ RUN_COMPANION_MODULE_BASENAMES,
9
+} from '../src/services/run-companion-modules';
10
+import { materializeAcpAdaptersCache } from './_acp-adapters';
11
+
12
+const copyDirectoryRecursive = async (sourceDir: string, targetDir: string): Promise<void> => {
13
+ await mkdir(targetDir, { recursive: true });
14
+
15
+ for (const entry of await readdir(sourceDir, { withFileTypes: true })) {
16
+ const sourcePath = path.join(sourceDir, entry.name);
17
+ const targetPath = path.join(targetDir, entry.name);
18
+
19
+ if (entry.isDirectory()) {
20
+ await copyDirectoryRecursive(sourcePath, targetPath);
21
+ continue;
22
+ }
23
+
24
+ await copyFile(sourcePath, targetPath);
25
+ const mode = (await stat(sourcePath)).mode & 0o777;
26
+ await chmod(targetPath, mode || 0o755);
27
+ }
28
+};
29
+
30
+const copyBundledAcpAdapters = async (outputDir: string): Promise<void> => {
31
+ const acpAdaptersCacheDir = await materializeAcpAdaptersCache();
32
+ const acpOutputDir = path.join(outputDir, 'acp-adapters');
33
+ await copyDirectoryRecursive(acpAdaptersCacheDir, acpOutputDir);
34
+};
35
36
/**
37
* Shared teardown for all CLI scripts.
@@ -17,52 +45,40 @@ export const teardown: Teardown = <E, A>(exit: Exit.Exit<E, A>, onExit: (code: n
45
onExit(shouldFail ? errorCode : 0);
46
};
47
20
-type LoggedCommandArgs = readonly [string, ...string[]];
21
-
22
-const runLoggedCommand = (args: LoggedCommandArgs) =>
23
- Command.make(...args).pipe(
24
- Command.start,
25
- Effect.flatMap(process =>
26
- Effect.all(
27
- {
28
- exitCode: process.exitCode,
29
- output: Stream.merge(
30
- Stream.decodeText(process.stdout, 'utf-8'),
31
- Stream.decodeText(process.stderr, 'utf-8'),
32
- { haltStrategy: 'left' }
33
- ).pipe(
34
- Stream.tap(chunk => Console.log(chunk)),
35
- Stream.runDrain
36
- ),
37
- },
38
- {
39
- concurrency: 'unbounded',
40
- }
41
- )
42
- ),
43
- Effect.map(({ exitCode }) => exitCode)
44
- );
45
-
48
export const buildCompanionModules = (outputDir: string) =>
49
Effect.gen(function* () {
50
yield* Effect.tryPromise(() => mkdir(outputDir, { recursive: true }));
51
50
- for (const name of RUN_COMPANION_MODULE_BASENAMES) {
51
- const args = [
52
- 'bun',
53
- 'build',
54
- `./src/services/${name}.ts`,
55
- '--outfile',
56
- `${outputDir}/${name}.mjs`,
57
- '--format',
58
- 'esm',
59
- '--target',
60
- 'bun',
61
- ] as const satisfies LoggedCommandArgs;
52
+ const compiledRootDir = path.resolve('./dist');
53
+ const companionRelativePaths = collectRunCompanionAssetRelativePaths(compiledRootDir);
54
+ if (companionRelativePaths.length === 0) {
55
+ return yield* Effect.fail(
56
+ new Error('Missing compiled run companion modules. Run `pnpm build:packages` first.')
57
+ );
58
+ }
59
+
60
+ for (const relativePath of companionRelativePaths) {
61
+ const sourcePath = path.join(compiledRootDir, relativePath);
62
+ const targetPath = path.join(outputDir, relativePath);
63
+
64
+ yield* Effect.tryPromise(async () => {
65
+ if (!(await Bun.file(sourcePath).exists())) {
66
+ throw new Error(`Missing companion module: ${sourcePath}`);
67
+ }
68
+ if (path.resolve(sourcePath) === path.resolve(targetPath)) {
69
+ return;
70
+ }
71
63
- const exitCode = yield* runLoggedCommand(args);
64
- if (exitCode !== 0) {
65
- return yield* Effect.fail(new Error(`Failed to build companion module: ${name}`));
66
- }
72
+ await mkdir(path.dirname(targetPath), { recursive: true });
73
+ await copyFile(sourcePath, targetPath);
74
+ });
75
}
76
+
77
+ for (const name of RUN_COMPANION_MODULE_BASENAMES) {
78
+ const wrapperPath = path.join(outputDir, `${name}.mjs`);
79
+ const wrapperSource = `export * from "./services/${name}.mjs";\n`;
80
+ yield* Effect.tryPromise(() => writeFile(wrapperPath, wrapperSource, 'utf8'));
81
+ }
82
+
83
+ yield* Effect.tryPromise(() => copyBundledAcpAdapters(outputDir));
84
});
ts/packages/cli/scripts/install-binary.ts
+8
-4
@@ -6,7 +6,7 @@ import path from 'node:path';
6
import os from 'node:os';
7
import { mkdir } from 'node:fs/promises';
8
import { $ } from 'bun';
9
-import { RUN_COMPANION_MODULE_FILENAMES } from '../src/services/run-companion-modules';
9
+import { collectExpectedRunCompanionAssetRelativePaths } from '../src/services/run-companion-modules';
10
11
/**
12
* Usage: `COMPOSIO_INSTALL_DIR=<INSTALL_DIR> bun scripts/build-binary.ts <BINARY_PATH>`
@@ -30,13 +30,17 @@ export function installBinary() {
30
yield* Effect.tryPromise(() => $`cp ${binaryPath} ${installDir}/composio`.quiet());
31
32
const sourceDirectory = path.dirname(path.resolve(binaryPath));
33
- for (const fileName of RUN_COMPANION_MODULE_FILENAMES) {
34
- const sourcePath = path.join(sourceDirectory, fileName);
33
+ const companionRelativePaths = collectExpectedRunCompanionAssetRelativePaths(sourceDirectory);
34
+
35
+ for (const relativePath of companionRelativePaths) {
36
+ const sourcePath = path.join(sourceDirectory, relativePath);
37
+ const targetPath = path.join(installDir, relativePath);
38
yield* Effect.tryPromise(async () => {
39
if (!(await Bun.file(sourcePath).exists())) {
40
throw new Error(`Missing companion module: ${sourcePath}`);
41
}
39
- await $`cp ${sourcePath} ${installDir}/${fileName}`.quiet();
42
+ await $`mkdir -p ${path.dirname(targetPath)}`.quiet();
43
+ await $`cp ${sourcePath} ${targetPath}`.quiet();
44
});
45
}
46
ts/packages/cli/scripts/package-binaries.ts
+8
-5
@@ -21,7 +21,7 @@ import { teardown } from './_shared';
21
import { $ } from 'bun';
22
import { readdir, stat } from 'node:fs/promises';
23
import path from 'node:path';
24
-import { RUN_COMPANION_MODULE_FILENAMES } from '../src/services/run-companion-modules';
24
+import { collectExpectedRunCompanionAssetRelativePaths } from '../src/services/run-companion-modules';
25
26
const BINARIES_DIR = './dist/binaries';
27
const COMPANIONS_DIR = path.join(BINARIES_DIR, 'companions');
@@ -48,8 +48,9 @@ export function packageBinaries() {
48
return;
49
}
50
51
- for (const fileName of RUN_COMPANION_MODULE_FILENAMES) {
52
- const companionPath = path.join(COMPANIONS_DIR, fileName);
51
+ const companionRelativePaths = collectExpectedRunCompanionAssetRelativePaths(COMPANIONS_DIR);
52
+ for (const relativePath of companionRelativePaths) {
53
+ const companionPath = path.join(COMPANIONS_DIR, relativePath);
54
const exists = yield* Effect.tryPromise(() => Bun.file(companionPath).exists());
55
if (!exists) {
56
yield* Console.error(
@@ -74,8 +75,10 @@ export function packageBinaries() {
75
yield* Effect.tryPromise(async () => {
76
await $`mkdir -p ${nestedDir}`.quiet();
77
await $`cp ${binaryPath} ${nestedDir}/composio`.quiet();
77
- for (const fileName of RUN_COMPANION_MODULE_FILENAMES) {
78
- await $`cp ${path.join(COMPANIONS_DIR, fileName)} ${nestedDir}/${fileName}`.quiet();
78
+ for (const relativePath of companionRelativePaths) {
79
+ const targetDirectory = path.dirname(path.join(nestedDir, relativePath));
80
+ await $`mkdir -p ${targetDirectory}`.quiet();
81
+ await $`cp ${path.join(COMPANIONS_DIR, relativePath)} ${path.join(nestedDir, relativePath)}`.quiet();
82
}
83
const previousCwd = process.cwd();
84
process.chdir(tempDir);
ts/packages/cli/skills/composio-cli/references/troubleshooting.md
+1
-1
@@ -102,7 +102,7 @@ composio execute --parallel \
102
GITHUB_CREATE_AN_ISSUE -d '{ owner: "acme", repo: "app", title: "Bug" }'
103
```
104
105
-Escalate to `composio run` only when the user needs control flow, loops, `Promise.all`, `search()` inside a script, `proxy()`, or `subAgent()`.
105
+Escalate to `composio run` only when the user needs control flow, loops, `Promise.all`, `search()` inside a script, `proxy()`, or `experimental_subAgent()`.
106
107
## `tools info` And `tools list` Are Fallbacks
108
ts/packages/cli/src/services/run-companion-modules.ts
+189
-6
@@ -16,6 +16,185 @@ export const RUN_COMPANION_MODULE_FILENAMES = RUN_COMPANION_MODULE_BASENAMES.map
16
);
17
18
export const RUN_COMPANION_RELEASE_TAG_FILENAME = 'release-tag.txt';
19
+export const RUN_CODEX_ACP_BINARY_TARGETS = [
20
+ {
21
+ platform: 'darwin',
22
+ arch: 'arm64',
23
+ packageName: '@zed-industries/codex-acp-darwin-arm64',
24
+ binaryFileName: 'codex-acp',
25
+ relativePath: 'acp-adapters/codex/darwin-arm64/codex-acp',
26
+ },
27
+ {
28
+ platform: 'darwin',
29
+ arch: 'x64',
30
+ packageName: '@zed-industries/codex-acp-darwin-x64',
31
+ binaryFileName: 'codex-acp',
32
+ relativePath: 'acp-adapters/codex/darwin-x64/codex-acp',
33
+ },
34
+ {
35
+ platform: 'linux',
36
+ arch: 'arm64',
37
+ packageName: '@zed-industries/codex-acp-linux-arm64',
38
+ binaryFileName: 'codex-acp',
39
+ relativePath: 'acp-adapters/codex/linux-arm64/codex-acp',
40
+ },
41
+ {
42
+ platform: 'linux',
43
+ arch: 'x64',
44
+ packageName: '@zed-industries/codex-acp-linux-x64',
45
+ binaryFileName: 'codex-acp',
46
+ relativePath: 'acp-adapters/codex/linux-x64/codex-acp',
47
+ },
48
+] as const;
49
+export const RUN_COMPANION_STATIC_ASSET_RELATIVE_PATHS = [
50
+ 'acp-adapters/claude-code-acp.mjs',
51
+ // cli.js from @anthropic-ai/claude-agent-sdk must live next to claude-code-acp.mjs.
52
+ // The bundled adapter uses import.meta.url to locate it at runtime.
53
+ 'acp-adapters/cli.js',
54
+ ...RUN_CODEX_ACP_BINARY_TARGETS.map(target => target.relativePath),
55
+] as const;
56
+
57
+const relativeImportPattern =
58
+ /(?:import\s+(?:[^'"]+?\s+from\s+)?|export\s+(?:\*\s+from\s+|\{[^}]+\}\s+from\s+)|import\s*\()\s*["'](\.{1,2}\/[^"']+?\.mjs)["']/g;
59
+
60
+const isImportGraphFile = (relativePath: string) => /\.(?:m?js|ts)$/.test(relativePath);
61
+
62
+const collectRelativeImportPaths = ({
63
+ rootDir,
64
+ relativePath,
65
+ collected,
66
+ recordMissingPaths = false,
67
+}: {
68
+ rootDir: string;
69
+ relativePath: string;
70
+ collected: Set<string>;
71
+ recordMissingPaths?: boolean;
72
+}): void => {
73
+ const normalizedRelativePath = relativePath.replaceAll(path.sep, '/');
74
+ if (collected.has(normalizedRelativePath)) {
75
+ return;
76
+ }
77
+
78
+ const absolutePath = path.join(rootDir, normalizedRelativePath);
79
+ const exists = fs.existsSync(absolutePath);
80
+ if (!exists && !recordMissingPaths) {
81
+ return;
82
+ }
83
+
84
+ collected.add(normalizedRelativePath);
85
+ if (!exists) {
86
+ return;
87
+ }
88
+
89
+ if (!isImportGraphFile(normalizedRelativePath)) {
90
+ return;
91
+ }
92
+
93
+ const source = fs.readFileSync(absolutePath, 'utf8');
94
+ for (const match of source.matchAll(relativeImportPattern)) {
95
+ const specifier = match[1];
96
+ if (!specifier) {
97
+ continue;
98
+ }
99
+
100
+ const dependencyRelativePath = path
101
+ .relative(rootDir, path.resolve(path.dirname(absolutePath), specifier))
102
+ .replaceAll(path.sep, '/');
103
+
104
+ collectRelativeImportPaths({
105
+ rootDir,
106
+ relativePath: dependencyRelativePath,
107
+ collected,
108
+ recordMissingPaths,
109
+ });
110
+ }
111
+};
112
+
113
+export const collectRunCompanionAssetRelativePaths = (rootDir: string): ReadonlyArray<string> => {
114
+ const collected = new Set<string>();
115
+
116
+ for (const fileName of RUN_COMPANION_MODULE_FILENAMES) {
117
+ collectRelativeImportPaths({
118
+ rootDir,
119
+ relativePath: fileName,
120
+ collected,
121
+ });
122
+ }
123
+
124
+ if (collected.size === 0) {
125
+ for (const baseName of RUN_COMPANION_MODULE_BASENAMES) {
126
+ collectRelativeImportPaths({
127
+ rootDir,
128
+ relativePath: path.posix.join('services', `${baseName}.mjs`),
129
+ collected,
130
+ });
131
+ }
132
+ }
133
+
134
+ for (const relativePath of RUN_COMPANION_STATIC_ASSET_RELATIVE_PATHS) {
135
+ collectRelativeImportPaths({
136
+ rootDir,
137
+ relativePath,
138
+ collected,
139
+ });
140
+ }
141
+
142
+ return [...collected].sort();
143
+};
144
+
145
+export const resolveRunCompanionAssetPath = ({
146
+ callerImportMetaUrl,
147
+ execPath,
148
+ relativePathFromRoot,
149
+}: {
150
+ callerImportMetaUrl: string;
151
+ execPath: string;
152
+ relativePathFromRoot: string;
153
+}): string | null => {
154
+ const currentFilePath = fileURLToPath(callerImportMetaUrl);
155
+ const currentDirectory = path.dirname(currentFilePath);
156
+ const executableDirectory = path.dirname(execPath);
157
+
158
+ const candidates = [
159
+ path.resolve(currentDirectory, relativePathFromRoot),
160
+ path.resolve(currentDirectory, '..', relativePathFromRoot),
161
+ path.resolve(executableDirectory, relativePathFromRoot),
162
+ ];
163
+
164
+ for (const candidate of candidates) {
165
+ if (fs.existsSync(candidate)) {
166
+ return candidate;
167
+ }
168
+ }
169
+
170
+ return null;
171
+};
172
+
173
+export const collectExpectedRunCompanionAssetRelativePaths = (
174
+ rootDir: string
175
+): ReadonlyArray<string> => {
176
+ const collected = new Set<string>();
177
+
178
+ for (const fileName of RUN_COMPANION_MODULE_FILENAMES) {
179
+ collectRelativeImportPaths({
180
+ rootDir,
181
+ relativePath: fileName,
182
+ collected,
183
+ recordMissingPaths: true,
184
+ });
185
+ }
186
+
187
+ for (const relativePath of RUN_COMPANION_STATIC_ASSET_RELATIVE_PATHS) {
188
+ collectRelativeImportPaths({
189
+ rootDir,
190
+ relativePath,
191
+ collected,
192
+ recordMissingPaths: true,
193
+ });
194
+ }
195
+
196
+ return [...collected].sort();
197
+};
198
199
type GitHubReleaseAsset = {
200
name: string;
@@ -80,8 +259,8 @@ export const writeInstalledReleaseTag = (installDir: string, releaseTag: string)
259
260
export const listMissingInstalledRunCompanionModules = (execPath: string) => {
261
const installDirectory = resolveCompanionInstallDirectory(execPath);
83
- return RUN_COMPANION_MODULE_FILENAMES.filter(
84
- fileName => !fs.existsSync(path.join(installDirectory, fileName))
262
+ return collectExpectedRunCompanionAssetRelativePaths(installDirectory).filter(
263
+ relativePath => !fs.existsSync(path.join(installDirectory, relativePath))
264
);
265
};
266
@@ -264,15 +443,19 @@ export const repairMissingInstalledRunCompanionModules = async ({
443
await decompress(archivePath, extractDirectory);
444
445
const installDirectory = resolveCompanionInstallDirectory(execPath);
267
- for (const fileName of RUN_COMPANION_MODULE_FILENAMES) {
268
- const sourcePath = path.join(packageDirectory, fileName);
446
+ const companionRelativePaths = collectExpectedRunCompanionAssetRelativePaths(packageDirectory);
447
+
448
+ for (const relativePath of companionRelativePaths) {
449
+ const sourcePath = path.join(packageDirectory, relativePath);
450
if (!fs.existsSync(sourcePath)) {
451
throw new Error(
271
- `Release ${release.tag_name} is missing ${fileName}; cannot restore the files required by 'composio run'.`
452
+ `Release ${release.tag_name} is missing ${relativePath}; cannot restore the files required by 'composio run'.`
453
);
454
}
455
275
- fs.copyFileSync(sourcePath, path.join(installDirectory, fileName));
456
+ const targetPath = path.join(installDirectory, relativePath);
457
+ fs.mkdirSync(path.dirname(targetPath), { recursive: true });
458
+ fs.copyFileSync(sourcePath, targetPath);
459
}
460
461
writeInstalledReleaseTag(installDirectory, release.tag_name);
ts/packages/cli/src/services/run-subagent-acp.ts
+64
-9
@@ -6,7 +6,11 @@ import path from 'node:path';
6
import { Readable, Writable } from 'node:stream';
7
import * as acp from '@agentclientprotocol/sdk';
8
import type { MasterKind } from 'src/services/master-detector';
9
-import { resolveRunCompanionModulePath } from 'src/services/run-companion-modules';
9
+import {
10
+ resolveRunCompanionAssetPath,
11
+ resolveRunCompanionModulePath,
12
+ RUN_CODEX_ACP_BINARY_TARGETS,
13
+} from 'src/services/run-companion-modules';
14
import {
15
ACP_STRUCTURED_OUTPUT_TOOL_NAME,
16
AcpInvokeError,
@@ -23,7 +27,30 @@ import {
27
type InvokeAgentTarget,
28
} from 'src/services/run-subagent-shared';
29
26
-const resolveBundledAdapter = (target: InvokeAgentTarget): string | null => {
30
+const resolveShippedAdapterAsset = (target: InvokeAgentTarget): string | null => {
31
+ if (target === 'claude') {
32
+ return resolveRunCompanionAssetPath({
33
+ callerImportMetaUrl: import.meta.url,
34
+ execPath: process.execPath,
35
+ relativePathFromRoot: 'acp-adapters/claude-code-acp.mjs',
36
+ });
37
+ }
38
+
39
+ const binaryTarget = RUN_CODEX_ACP_BINARY_TARGETS.find(
40
+ candidate => candidate.platform === process.platform && candidate.arch === process.arch
41
+ );
42
+ if (!binaryTarget) {
43
+ return null;
44
+ }
45
+
46
+ return resolveRunCompanionAssetPath({
47
+ callerImportMetaUrl: import.meta.url,
48
+ execPath: process.execPath,
49
+ relativePathFromRoot: binaryTarget.relativePath,
50
+ });
51
+};
52
+
53
+const resolveInstalledAdapter = (target: InvokeAgentTarget): string | null => {
54
const specifier =
55
target === 'claude'
56
? '@zed-industries/claude-code-acp/dist/index.js'
@@ -40,22 +67,45 @@ export const resolveAcpAdapterCommand = (
67
target: InvokeAgentTarget
68
): {
69
readonly cmd: ReadonlyArray<string>;
43
- readonly source: 'bundled' | 'which' | 'npx';
70
+ readonly env?: Readonly<Record<string, string>>;
71
+ readonly source: 'shipped' | 'bundled' | 'which' | 'npx';
72
} => {
73
const binary = target === 'claude' ? 'claude-code-acp' : 'codex-acp';
74
const packageName =
75
target === 'claude' ? '@zed-industries/claude-code-acp' : '@zed-industries/codex-acp';
76
49
- // 1. Try the bundled dependency first (no npx overhead)
50
- const bundled = resolveBundledAdapter(target);
77
+ // 1. Prefer shipped companion assets next to the CLI binary / dist bundle.
78
+ const shipped = resolveShippedAdapterAsset(target);
79
+ if (shipped) {
80
+ if (target === 'codex') {
81
+ return {
82
+ cmd: [shipped],
83
+ source: 'shipped',
84
+ };
85
+ }
86
+
87
+ return {
88
+ cmd: [process.execPath, shipped],
89
+ env: {
90
+ BUN_BE_BUN: '1',
91
+ },
92
+ source: 'shipped',
93
+ };
94
+ }
95
+
96
+ // 2. Try the installed dependency bundle next (no npx overhead).
97
+ const bundled = resolveInstalledAdapter(target);
98
if (bundled) {
99
return {
100
cmd: [process.execPath, bundled],
101
+ env: {
102
+ BUN_BE_BUN: '1',
103
+ },
104
source: 'bundled',
105
};
106
}
107
58
- // 2. Check if the binary is on PATH
108
+ // 3. Check if the binary is on PATH.
109
if (typeof Bun !== 'undefined' && typeof Bun.which === 'function') {
110
const resolved = Bun.which(binary);
111
if (resolved) {
@@ -66,7 +116,7 @@ export const resolveAcpAdapterCommand = (
116
}
117
}
118
69
- // 3. Fall back to npx
119
+ // 4. Fall back to npx.
120
return {
121
cmd: [process.platform === 'win32' ? 'npx.cmd' : 'npx', '-y', packageName],
122
source: 'npx',
@@ -175,7 +225,7 @@ export const selectPermissionOutcome = (
225
params.options.find(option => option.kind === 'reject_once') ??
226
params.options.find(option => option.kind === 'reject_always');
227
178
- // Intentionally permissive for `composio run` subAgent sessions. The user is
228
+ // Intentionally permissive for `composio run` experimental_subAgent sessions. The user is
229
// explicitly opting into local tool access, so prefer broad ACP approval over
230
// heuristic rejections that strand the agent mid-task.
231
if (allowOnce) {
@@ -479,7 +529,12 @@ export const invokeAcpSubAgent = async ({
529
const { CLAUDECODE: _, ...childEnv } = process.env;
530
const child = spawn(resolved.cmd[0]!, resolved.cmd.slice(1), {
531
cwd: process.cwd(),
482
- env: childEnv,
532
+ env: resolved.env
533
+ ? {
534
+ ...childEnv,
535
+ ...resolved.env,
536
+ }
537
+ : childEnv,
538
stdio: ['pipe', 'pipe', 'pipe'],
539
});
540
ts/packages/cli/src/services/run-subagent-output-mcp.ts
+2
-47
@@ -1,9 +1,8 @@
1
-import path from 'node:path';
1
import * as fs from 'node:fs';
3
-import { createRequire } from 'node:module';
2
import process from 'node:process';
5
-import { pathToFileURL } from 'node:url';
3
import { jsonSchemaToZodSchema } from '@composio/core';
4
+import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
6
import {
7
ACP_STRUCTURED_OUTPUT_TOOL_NAME,
8
buildStructuredOutputToolSchema,
@@ -18,51 +17,7 @@ const readFlag = (name: string): string => {
17
return value;
18
};
19
21
-type McpServerInstance = {
22
- registerTool: (
23
- name: string,
24
- config: {
25
- title?: string;
26
- description?: string;
27
- inputSchema?: unknown;
28
- },
29
- cb: (payload: unknown) => Promise<{
30
- content: Array<{
31
- type: string;
32
- text: string;
33
- }>;
34
- }>
35
- ) => void;
36
- connect: (transport: unknown) => Promise<void>;
37
-};
38
-
39
-type McpServerConstructor = new (serverInfo: {
40
- name: string;
41
- version: string;
42
-}) => McpServerInstance;
43
-
44
-type StdioServerTransportConstructor = new () => unknown;
45
-
46
-const loadMcpSdk = async (): Promise<{
47
- McpServer: McpServerConstructor;
48
- StdioServerTransport: StdioServerTransportConstructor;
49
-}> => {
50
- const require = createRequire(import.meta.url);
51
- const sdkPackageJsonPath = require.resolve('@modelcontextprotocol/sdk/package.json');
52
- const sdkDirectory = path.dirname(sdkPackageJsonPath);
53
- const [mcpModule, stdioModule] = await Promise.all([
54
- import(pathToFileURL(path.join(sdkDirectory, 'dist/esm/server/mcp.js')).href),
55
- import(pathToFileURL(path.join(sdkDirectory, 'dist/esm/server/stdio.js')).href),
56
- ]);
57
-
58
- return {
59
- McpServer: mcpModule.McpServer as McpServerConstructor,
60
- StdioServerTransport: stdioModule.StdioServerTransport as StdioServerTransportConstructor,
61
- };
62
-};
63
-
20
const main = async (): Promise<void> => {
65
- const { McpServer, StdioServerTransport } = await loadMcpSdk();
21
const schemaFilePath = readFlag('--schema-file');
22
const resultFilePath = readFlag('--result-file');
23
const schemaText = fs.readFileSync(schemaFilePath, 'utf8');
ts/packages/cli/src/services/upgrade-binary.ts
+41
-33
@@ -12,7 +12,10 @@ import decompress from 'decompress';
12
import type { Predicate } from 'effect/Predicate';
13
import { renderPrettyError } from './utils/pretty-error';
14
import { TerminalUI } from './terminal-ui';
15
-import { RUN_COMPANION_MODULE_FILENAMES, writeInstalledReleaseTag } from './run-companion-modules';
15
+import {
16
+ collectExpectedRunCompanionAssetRelativePaths,
17
+ writeInstalledReleaseTag,
18
+} from './run-companion-modules';
19
20
export class UpgradeBinaryError extends Data.TaggedError('services/UpgradeBinaryError')<{
21
readonly cause?: unknown;
@@ -36,10 +39,10 @@ type GitHubRelease = {
39
40
const CLI_RELEASE_TAG_PATTERN = /^@composio\/cli@\d+\.\d+\.\d+.*$/;
41
39
-const getBinaryAssetName = (platformArch: PlatformArch): string =>
42
+const getBinaryAssetName = (platformArch: PlatformArch) =>
43
`${CLI_BINARY_NAME}-${platformArch.platform}-${platformArch.arch}.zip`;
44
42
-const hasBinaryAsset = (release: GitHubRelease, platformArch: PlatformArch): boolean =>
45
+const hasPlatformBinaryAsset = (release: GitHubRelease, platformArch: PlatformArch) =>
46
release.assets.some(asset => asset.name === getBinaryAssetName(platformArch));
47
48
// Service to manage CLI binary upgrades
@@ -106,7 +109,7 @@ export class UpgradeBinary extends Effect.Service<UpgradeBinary>()('services/Upg
109
110
const fetchLatestRelease = (
111
platformArch: PlatformArch
109
- ): Effect.Effect<Option.Option<GitHubRelease>, UpgradeBinaryError, never> =>
112
+ ): Effect.Effect<GitHubRelease, UpgradeBinaryError, never> =>
113
Effect.gen(function* () {
114
const release = yield* githubConfig.TAG.pipe(
115
Option.match({
@@ -151,19 +154,24 @@ export class UpgradeBinary extends Effect.Service<UpgradeBinary>()('services/Upg
154
);
155
}
156
154
- const releasesWithBinary = cliReleases.filter(release =>
155
- hasBinaryAsset(release, platformArch)
157
+ const cliReleasesWithBinary = cliReleases.filter(release =>
158
+ hasPlatformBinaryAsset(release, platformArch)
159
);
160
158
- if (releasesWithBinary.length === 0) {
159
- yield* Effect.logDebug(
160
- `No published CLI releases currently contain ${getBinaryAssetName(platformArch)}`
161
+ if (cliReleasesWithBinary.length === 0) {
162
+ return yield* Effect.fail(
163
+ new UpgradeBinaryError({
164
+ cause: new Error(
165
+ `No package-scoped CLI releases found with ${getBinaryAssetName(platformArch)}`
166
+ ),
167
+ message:
168
+ 'Failed to determine latest CLI release from @composio/cli tags on GitHub',
169
+ })
170
);
162
- return Option.none();
171
}
172
165
- let latest = releasesWithBinary[0];
166
- for (const release of releasesWithBinary.slice(1)) {
173
+ let latest = cliReleasesWithBinary[0];
174
+ for (const release of cliReleasesWithBinary.slice(1)) {
175
const comparison = yield* semverComparator(latest.tag_name, release.tag_name).pipe(
176
Effect.mapError(
177
error =>
@@ -180,7 +188,7 @@ export class UpgradeBinary extends Effect.Service<UpgradeBinary>()('services/Upg
188
}
189
190
yield* Effect.logDebug(`Resolved latest CLI release tag: ${latest.tag_name}`);
183
- return Option.some(latest);
191
+ return latest;
192
}),
193
onSome: Effect.fn(function* (tag) {
194
yield* Effect.logDebug(`Using tag: ${tag}`);
@@ -192,14 +200,7 @@ export class UpgradeBinary extends Effect.Service<UpgradeBinary>()('services/Upg
200
parseErrorMessage: 'Failed to parse GitHub release JSON response',
201
});
202
195
- if (!hasBinaryAsset(release, platformArch)) {
196
- yield* Effect.logDebug(
197
- `Release ${tag} does not yet contain ${getBinaryAssetName(platformArch)}`
198
- );
199
- return Option.none();
200
- }
201
-
202
- return Option.some(release as GitHubRelease);
203
+ return release as GitHubRelease;
204
}),
205
})
206
);
@@ -500,9 +501,10 @@ export class UpgradeBinary extends Effect.Service<UpgradeBinary>()('services/Upg
501
502
const sourceDirectory = path.dirname(sourcePath);
503
const targetDirectory = path.dirname(targetPath);
503
-
504
- for (const fileName of RUN_COMPANION_MODULE_FILENAMES) {
505
- const sourceCompanion = path.join(sourceDirectory, fileName);
504
+ const companionRelativePaths =
505
+ collectExpectedRunCompanionAssetRelativePaths(sourceDirectory);
506
+ for (const relativePath of companionRelativePaths) {
507
+ const sourceCompanion = path.join(sourceDirectory, relativePath);
508
const sourceExists = yield* fs
509
.exists(sourceCompanion)
510
.pipe(Effect.catchAll(() => Effect.succeed(false)));
@@ -516,8 +518,20 @@ export class UpgradeBinary extends Effect.Service<UpgradeBinary>()('services/Upg
518
);
519
}
520
521
+ const targetCompanion = path.join(targetDirectory, relativePath);
522
+ yield* fs.makeDirectory(path.dirname(targetCompanion), { recursive: true }).pipe(
523
+ Effect.catchAll(error =>
524
+ Effect.fail(
525
+ new UpgradeBinaryError({
526
+ cause: error as Error,
527
+ message: `Failed to create companion module directory: ${relativePath}`,
528
+ })
529
+ )
530
+ )
531
+ );
532
+
533
yield* fs
520
- .copy(sourceCompanion, path.join(targetDirectory, fileName), {
534
+ .copy(sourceCompanion, targetCompanion, {
535
overwrite: true,
536
})
537
.pipe(
@@ -525,7 +539,7 @@ export class UpgradeBinary extends Effect.Service<UpgradeBinary>()('services/Upg
539
Effect.fail(
540
new UpgradeBinaryError({
541
cause: error as Error,
528
- message: `Failed to replace companion module: ${fileName}`,
542
+ message: `Failed to replace companion module: ${relativePath}`,
543
})
544
)
545
)
@@ -567,13 +581,7 @@ export class UpgradeBinary extends Effect.Service<UpgradeBinary>()('services/Upg
581
const didUpgrade = yield* ui.useMakeSpinner('Checking for updates...', spinner =>
582
Effect.gen(function* () {
583
const platformArch = yield* detectPlatform;
570
- const releaseOption = yield* fetchLatestRelease(platformArch);
571
- if (Option.isNone(releaseOption)) {
572
- yield* spinner.stop('You are already running the latest version!');
573
- return false;
574
- }
575
-
576
- const release = releaseOption.value;
584
+ const release = yield* fetchLatestRelease(platformArch);
585
const updateAvailable = yield* isUpdateAvailable(release);
586
if (!updateAvailable) {
587
yield* spinner.stop('You are already running the latest version!');
ts/packages/cli/test/src/commands/run.cmd.test.ts
+157
-1
@@ -13,6 +13,7 @@ import {
13
} from 'src/commands/run.cmd';
14
import {
15
RUN_COMPANION_MODULE_FILENAMES,
16
+ RUN_COMPANION_STATIC_ASSET_RELATIVE_PATHS,
17
listMissingInstalledRunCompanionModules,
18
readInstalledReleaseTag,
19
resolveRunCompanionModulePath,
@@ -119,6 +120,53 @@ describe('CLI: composio run', () => {
120
);
121
});
122
123
+ layer(TestLive())(it => {
124
+ it.scoped(
125
+ '[Given] a multiline structured experimental_subAgent script [Then] run preserves the inline TypeScript source',
126
+ () =>
127
+ Effect.gen(function* () {
128
+ const script = `
129
+ const brief = await experimental_subAgent(
130
+ [
131
+ "Do not read files.",
132
+ "Do not run terminal commands.",
133
+ "Do not inspect the workspace.",
134
+ "Return exactly this structured value:",
135
+ "{\\"summary\\":\\"ok\\",\\"urgent\\":[\\"a\\",\\"b\\"]}",
136
+ ].join("\\n"),
137
+ {
138
+ target: "codex",
139
+ schema: z.object({ summary: z.string(), urgent: z.array(z.string()) }),
140
+ }
141
+ );
142
+ console.log(JSON.stringify(brief));
143
+ console.log(JSON.stringify(brief.structuredOutput));
144
+ `;
145
+ const spawn = vi.fn(() => ({ exited: Promise.resolve(0) }));
146
+ const exit = vi.spyOn(process, 'exit').mockImplementation((() => undefined) as never);
147
+ vi.stubGlobal('Bun', { spawn });
148
+
149
+ yield* cli(['run', '--logs-off', script]);
150
+
151
+ expect(spawn).toHaveBeenCalledTimes(1);
152
+ const spawnConfig = (spawn as any).mock.calls[0][0] as {
153
+ cmd: string[];
154
+ };
155
+ expect(spawnConfig.cmd[3]).toBe('--eval');
156
+ expect(spawnConfig.cmd[4]).toContain('const brief = await experimental_subAgent(');
157
+ expect(spawnConfig.cmd[4]).toContain('"Do not run terminal commands."');
158
+ expect(spawnConfig.cmd[4]).toContain('].join("\\n"),');
159
+ expect(spawnConfig.cmd[4]).toContain('target: "codex"');
160
+ expect(spawnConfig.cmd[4]).toContain('console.log(JSON.stringify(brief));');
161
+ expect(spawnConfig.cmd[4]).toContain(
162
+ 'return (console.log(JSON.stringify(brief.structuredOutput)));'
163
+ );
164
+ expect(spawnConfig.cmd[4]).not.toContain('"Do not run terminal\n');
165
+ expect(exit).toHaveBeenCalledWith(0);
166
+ })
167
+ );
168
+ });
169
+
170
layer(TestLive())(it => {
171
it.scoped('[Given] --file [Then] it forwards file execution to the embedded Bun runtime', () =>
172
Effect.gen(function* () {
@@ -471,7 +519,115 @@ describe('run companion install metadata', () => {
519
fs.writeFileSync(path.join(tempDir, RUN_COMPANION_MODULE_FILENAMES[0]!), '', 'utf8');
520
521
expect(listMissingInstalledRunCompanionModules(execPath)).toEqual(
474
- RUN_COMPANION_MODULE_FILENAMES.slice(1)
522
+ [...RUN_COMPANION_MODULE_FILENAMES.slice(1), ...RUN_COMPANION_STATIC_ASSET_RELATIVE_PATHS]
523
+ .slice()
524
+ .sort()
525
+ );
526
+ });
527
+
528
+ it('[Given] a nested companion dependency is missing [Then] it reports the missing helper asset', () => {
529
+ const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'composio-run-missing-nested-'));
530
+ const execPath = path.join(tempDir, 'composio');
531
+ const servicesDir = path.join(tempDir, 'services');
532
+ fs.mkdirSync(servicesDir, { recursive: true });
533
+
534
+ fs.writeFileSync(
535
+ path.join(tempDir, 'run-subagent-shared.mjs'),
536
+ 'export * from "./services/run-subagent-shared.mjs";\n',
537
+ 'utf8'
538
+ );
539
+ fs.writeFileSync(
540
+ path.join(tempDir, 'run-subagent-acp.mjs'),
541
+ 'export * from "./services/run-subagent-acp.mjs";\n',
542
+ 'utf8'
543
+ );
544
+ fs.writeFileSync(
545
+ path.join(tempDir, 'run-subagent-legacy.mjs'),
546
+ 'export * from "./services/run-subagent-legacy.mjs";\n',
547
+ 'utf8'
548
+ );
549
+ fs.writeFileSync(
550
+ path.join(tempDir, 'run-subagent-output-mcp.mjs'),
551
+ 'export * from "./services/run-subagent-output-mcp.mjs";\n',
552
+ 'utf8'
553
+ );
554
+
555
+ fs.writeFileSync(
556
+ path.join(servicesDir, 'run-subagent-shared.mjs'),
557
+ 'export const x = 1;\n',
558
+ 'utf8'
559
+ );
560
+ fs.writeFileSync(
561
+ path.join(servicesDir, 'run-subagent-acp.mjs'),
562
+ 'export * from "../run-companion-modules-abc123.mjs";\n',
563
+ 'utf8'
564
+ );
565
+ fs.writeFileSync(
566
+ path.join(servicesDir, 'run-subagent-legacy.mjs'),
567
+ 'export const y = 1;\n',
568
+ 'utf8'
569
+ );
570
+ fs.writeFileSync(
571
+ path.join(servicesDir, 'run-subagent-output-mcp.mjs'),
572
+ 'export const z = 1;\n',
573
+ 'utf8'
574
+ );
575
+
576
+ expect(listMissingInstalledRunCompanionModules(execPath)).toContain(
577
+ 'run-companion-modules-abc123.mjs'
578
+ );
579
+ });
580
+
581
+ it('[Given] a named re-export dependency is missing [Then] it reports the missing helper asset', () => {
582
+ const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'composio-run-missing-reexport-'));
583
+ const execPath = path.join(tempDir, 'composio');
584
+ const servicesDir = path.join(tempDir, 'services');
585
+ fs.mkdirSync(servicesDir, { recursive: true });
586
+
587
+ fs.writeFileSync(
588
+ path.join(tempDir, 'run-subagent-shared.mjs'),
589
+ 'export * from "./services/run-subagent-shared.mjs";\n',
590
+ 'utf8'
591
+ );
592
+ fs.writeFileSync(
593
+ path.join(tempDir, 'run-subagent-acp.mjs'),
594
+ 'export * from "./services/run-subagent-acp.mjs";\n',
595
+ 'utf8'
596
+ );
597
+ fs.writeFileSync(
598
+ path.join(tempDir, 'run-subagent-legacy.mjs'),
599
+ 'export * from "./services/run-subagent-legacy.mjs";\n',
600
+ 'utf8'
601
+ );
602
+ fs.writeFileSync(
603
+ path.join(tempDir, 'run-subagent-output-mcp.mjs'),
604
+ 'export * from "./services/run-subagent-output-mcp.mjs";\n',
605
+ 'utf8'
606
+ );
607
+
608
+ fs.writeFileSync(
609
+ path.join(servicesDir, 'run-subagent-shared.mjs'),
610
+ 'export const sharedValue = 1;\n',
611
+ 'utf8'
612
+ );
613
+ fs.writeFileSync(
614
+ path.join(servicesDir, 'run-subagent-acp.mjs'),
615
+ 'export { helperValue } from "../run-companion-modules-def456.mjs";\n',
616
+ 'utf8'
617
+ );
618
+ fs.writeFileSync(
619
+ path.join(servicesDir, 'run-subagent-legacy.mjs'),
620
+ 'export const legacyValue = 1;\n',
621
+ 'utf8'
622
+ );
623
+ fs.writeFileSync(
624
+ path.join(servicesDir, 'run-subagent-output-mcp.mjs'),
625
+ 'export const outputValue = 1;\n',
626
+ 'utf8'
627
+ );
628
+
629
+ expect(listMissingInstalledRunCompanionModules(execPath)).toContain(
630
+ 'run-companion-modules-def456.mjs'
631
);
632
});
633
});
ts/packages/cli/test/src/services/run-subagent-output-mcp.test.ts
new
+17
@@ -0,0 +1,17 @@
1
+import * as fs from 'node:fs';
2
+import { fileURLToPath } from 'node:url';
3
+import { describe, expect, it } from 'vitest';
4
+
5
+describe('run-subagent-output-mcp source', () => {
6
+ it('[Given] the structured output helper source [Then] it statically imports the MCP SDK', () => {
7
+ const sourcePath = fileURLToPath(
8
+ new URL('../../../src/services/run-subagent-output-mcp.ts', import.meta.url)
9
+ );
10
+ const source = fs.readFileSync(sourcePath, 'utf8');
11
+
12
+ expect(source).toContain("from '@modelcontextprotocol/sdk/server/mcp.js'");
13
+ expect(source).toContain("from '@modelcontextprotocol/sdk/server/stdio.js'");
14
+ expect(source).not.toContain('@modelcontextprotocol/sdk/package.json');
15
+ expect(source).not.toContain('createRequire(import.meta.url)');
16
+ });
17
+});
ts/packages/cli/test/src/services/upgrade-binary.test.ts
+34
-82
@@ -43,10 +43,10 @@ const NodeOsTest = Layer.succeed(
43
})
44
);
45
46
-const runUpgrade = (configEntries: ReadonlyArray<[string, string]>) =>
46
+const makeUpgradeEffect = (configEntries: ReadonlyArray<[string, string]>) =>
47
Effect.gen(function* () {
48
const service = yield* UpgradeBinary;
49
- return yield* Effect.flip(service.upgrade());
49
+ return yield* service.upgrade();
50
}).pipe(
51
Effect.provide(UpgradeBinary.Default),
52
Effect.provide(FetchHttpClient.layer),
@@ -54,24 +54,14 @@ const runUpgrade = (configEntries: ReadonlyArray<[string, string]>) =>
54
Effect.provide(TerminalUINoop),
55
Effect.provide(NodeOsTest),
56
Effect.withConfigProvider(ConfigProvider.fromMap(new Map(configEntries))),
57
- Effect.scoped,
58
- Effect.runPromise
57
+ Effect.scoped
58
);
59
60
+const runUpgrade = (configEntries: ReadonlyArray<[string, string]>) =>
61
+ makeUpgradeEffect(configEntries).pipe(Effect.flip, Effect.runPromise);
62
+
63
const runUpgradeSuccess = (configEntries: ReadonlyArray<[string, string]>) =>
62
- Effect.gen(function* () {
63
- const service = yield* UpgradeBinary;
64
- return yield* service.upgrade();
65
- }).pipe(
66
- Effect.provide(UpgradeBinary.Default),
67
- Effect.provide(FetchHttpClient.layer),
68
- Effect.provide(BunFileSystem.layer),
69
- Effect.provide(TerminalUINoop),
70
- Effect.provide(NodeOsTest),
71
- Effect.withConfigProvider(ConfigProvider.fromMap(new Map(configEntries))),
72
- Effect.scoped,
73
- Effect.runPromise
74
- );
64
+ makeUpgradeEffect(configEntries).pipe(Effect.runPromise);
65
66
describe('UpgradeBinary', () => {
67
it('wraps non-2xx releases fetch failures with fetch context (no tag branch)', async () => {
@@ -169,83 +159,45 @@ describe('UpgradeBinary', () => {
159
}
160
});
161
172
- it('skips newer releases that do not yet contain a binary for the current platform', async () => {
162
+ it('skips newer releases that do not contain a binary for the current platform', async () => {
163
vi.stubGlobal('Bun', { which: vi.fn(() => null) });
164
165
try {
166
await withHttpServer(
177
- (req, res) => {
178
- if (req.url === '/repos/test-owner/test-repo/releases?per_page=100') {
179
- res.writeHead(200, { 'content-type': 'application/json' });
180
- res.end(
181
- JSON.stringify([
182
- {
183
- tag_name: '@composio/cli@9.9.9',
184
- prerelease: false,
185
- draft: false,
186
- assets: [],
187
- },
188
- {
189
- tag_name: '@composio/cli@0.0.1',
190
- prerelease: false,
191
- draft: false,
192
- assets: [],
193
- },
194
- ])
195
- );
196
- return;
197
- }
198
-
199
- res.writeHead(404, { 'content-type': 'application/json' });
200
- res.end(JSON.stringify({ message: 'not found' }));
201
- },
202
- async apiBaseUrl => {
203
- const result = await runUpgradeSuccess([
204
- ['GITHUB_API_BASE_URL', apiBaseUrl],
205
- ['GITHUB_OWNER', 'test-owner'],
206
- ['GITHUB_REPO', 'test-repo'],
207
- ]);
208
-
209
- expect(result).toBeUndefined();
210
- }
211
- );
212
- } finally {
213
- vi.unstubAllGlobals();
214
- vi.restoreAllMocks();
215
- }
216
- });
217
-
218
- it('treats an explicitly requested release without binaries as no upgrade', async () => {
219
- vi.stubGlobal('Bun', { which: vi.fn(() => null) });
220
-
221
- try {
222
- await withHttpServer(
223
- (req, res) => {
224
- if (
225
- req.url ===
226
- `/repos/test-owner/test-repo/releases/tags/${encodeURIComponent('@composio/cli@9.9.9')}`
227
- ) {
228
- res.writeHead(200, { 'content-type': 'application/json' });
229
- res.end(
230
- JSON.stringify({
231
- tag_name: '@composio/cli@9.9.9',
167
+ (_req, res) => {
168
+ res.writeHead(200, { 'content-type': 'application/json' });
169
+ res.end(
170
+ JSON.stringify([
171
+ {
172
+ tag_name: '@composio/cli@0.2.15',
173
+ draft: false,
174
prerelease: false,
175
+ assets: [
176
+ {
177
+ name: 'composio-linux-x64.zip',
178
+ browser_download_url: 'http://127.0.0.1/unused-linux.zip',
179
+ },
180
+ ],
181
+ },
182
+ {
183
+ tag_name: '@composio/cli@0.2.14',
184
draft: false,
234
- assets: [],
235
- })
236
- );
237
- return;
238
- }
239
-
240
- res.writeHead(404, { 'content-type': 'application/json' });
241
- res.end(JSON.stringify({ message: 'not found' }));
185
+ prerelease: false,
186
+ assets: [
187
+ {
188
+ name: 'composio-darwin-aarch64.zip',
189
+ browser_download_url: 'http://127.0.0.1/current-darwin.zip',
190
+ },
191
+ ],
192
+ },
193
+ ])
194
+ );
195
},
196
async apiBaseUrl => {
197
const result = await runUpgradeSuccess([
198
['GITHUB_API_BASE_URL', apiBaseUrl],
199
['GITHUB_OWNER', 'test-owner'],
200
['GITHUB_REPO', 'test-repo'],
248
- ['GITHUB_TAG', '@composio/cli@9.9.9'],
201
]);
202
203
expect(result).toBeUndefined();
ts/packages/cli/tsdown.config.ts
+6
@@ -13,6 +13,12 @@ export default defineConfig({
13
format: ['esm'],
14
tsconfig: './tsconfig.src.json',
15
external: undefined,
16
+ noExternal: [
17
+ '@composio/core',
18
+ /^zod(?:\/.*)?$/,
19
+ /^@agentclientprotocol\/sdk(?:\/.*)?$/,
20
+ /^@modelcontextprotocol\/sdk(?:\/.*)?$/,
21
+ ],
22
publint: undefined,
23
attw: undefined,
24
});