Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
perf(cli): cut 221ms and 44MB RSS off every CLI invocation
A compiled Bun binary parses its whole embedded module graph before the first line of JS runs, so bundled-but-unused code is paid for on every invocation. Verified: a binary that bundles everything but evaluates only console.log still costs ~235ms, against 15ms for a hello-world build. Most of this bundle was code `composio execute` never reaches. Measured on the pinned toolchain (Bun 1.4.1+4661e494f, linux-x64, best of 7, analytics disabled): composio --version 970ms -> 749ms (-221ms) peak RSS 175.8MB -> 132.2MB (-43.6MB) compiled binary 96MB -> 86MB bundle 31.24MB -> 15.84MB Four changes. run.cmd.ts imported `ts` from ts-morph, which vendors its own copy of the TypeScript compiler, so the binary carried two of them. The file uses only createSourceFile, forEachChild, ScriptTarget, ScriptKind and five isX guards, all available in the typescript copy that src/generation/typescript/* already pulls in. Sharing one compiler also means commands/generate and commands/run.cmd no longer evaluate a compiler each. js-tiktoken's main entry statically inlines all six BPE rank tables (gpt2, r50k, p50k, p50k_edit, cl100k, o200k) as string literals; the CLI only ever uses o200k, via encodingForModel('gpt-4o'). The lite build with that single table produces identical token-id streams. prepareExecuteOutput built the o200k rank table on every successful execute, purely to compare the response against a 10k-token threshold. Constructing it measured ~390ms in a compiled binary on the pinned toolchain (390.1, 367.1, 418.6ms across three runs), against ~4ms to encode a 7.5KB payload once the table exists. A BPE token always covers at least one UTF-8 byte, so a payload of at most THRESHOLD bytes can never exceed THRESHOLD tokens; checking byte length first reaches the same decision without the tokenizer. That ~390ms is construction cost measured in isolation, not an end-to-end delta on a real `composio execute`. No credentialed run was available to measure the whole command before and after, so treat it as the size of the work removed from the success path rather than a verified wall-clock saving. `COMPOSIO_PERF_DEBUG=1` reports the gap between `execute.tool_call.end` and exit for anyone able to run it for real. ToolsExecutorLive resolved a client through clientSingleton.get() unconditionally, walking the project context off disk, then discarded it because every caller on the remote-execute path passes one in. Three behavioral deltas, none of them the tokenization result or the inline/file decision: 1. Tiktoken.encode() throws on the literals <|endoftext|> and <|endofprompt|> appearing anywhere in the response, at any size (a 66-byte payload reproduces it). That throw landed after "Execution successful" had printed, so the tool ran and the CLI still exited 1 with nothing on stdout. Responses at or under 10KB no longer reach encode(), so they now succeed. Larger responses still hit it; the real fix is passing allowedSpecial 'all' and is not in this commit. 2. TypeScript 6.0.2 (ts-morph's vendored copy) to 6.0.3. Differential tested: the three real parse helpers over 20 sources covering TSX, decorators, `using`, `satisfies`, import attributes, optional-chained calls and unicode gave identical output on all 60 comparisons. 3. Under COMPOSIO_LOG_LEVEL=Debug, ProjectContext's "resolved from ..." debug lines no longer appear on the remote-execute path. The local-tool path still calls get() and is unchanged. Verified with typecheck:src, oxlint, validate:boundaries, the tools.execute and run command suites (89 tests), and differential tests of both tokenizers and both TypeScript versions. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EzaE7oGVgziJ5nRvBhcci2