mirror of
https://github.com/ComposioHQ/composio.git
synced 2026-09-22 11:46:35 +08:00
20aaa95c96
This PR: - adds a clean consumer harness that packs core, its internal JSON Schema dependency, and all ten TypeScript providers - verifies tarball contents, npm installation, named public exports, consumer typechecking, provider construction, and a credential-free `wrapTool` conversion - covers the current workspace core, one verified minimum-core lane per provider, and the packed workspace core presented as `1.0.0-beta.0` - preserves existing 0.x minimum peer ranges while recording the verified floors separately for the future breaking release - additively accepts core 1.0 prereleases without claiming stable 1.x support yet - widens the Anthropic and OpenAI Agents peer ranges to include the upstream versions already used by this repository - runs the gate in TypeScript CI and immediately before Changesets publishing The release guard fails before publication and its regression test verifies build -> compatibility -> publish ordering plus failure propagation. ## Non-breaking scope No public API is removed or renamed, and the existing 0.x core peer floors remain unchanged. All peer-range changes are additive. The gate reports the nine floor corrections that should be made with the planned breaking release. ## Validation - `pnpm run check:provider-compatibility` (12 packed consumer lanes) - `pnpm run test:provider-compatibility` - `pnpm run test:release-workflow` - `pnpm run build:packages` (19 packages) - focused TypeScript compile and Oxlint checks - Prettier, Changesets validation, and `git diff --check`
@composio/cloudflare
The Cloudflare provider formats Composio tools for Cloudflare Workers AI function calling (AiTextGenerationToolInput).
Installation
npm install @composio/core @composio/cloudflare @cloudflare/workers-types
Set COMPOSIO_API_KEY with your API key from the dashboard. In a Worker, add it as a secret (wrangler secret put COMPOSIO_API_KEY) and bind Workers AI as AI in your wrangler.toml; no separate model API key is needed.
Quickstart
Create a session for your user, pass its tools to env.AI.run, and execute any tool calls the model returns:
import { Composio } from '@composio/core';
import { CloudflareProvider } from '@composio/cloudflare';
export default {
async fetch(request: Request, env: Env): Promise<Response> {
const composio = new Composio({
apiKey: env.COMPOSIO_API_KEY,
provider: new CloudflareProvider(),
});
// Create a session for your user
const session = await composio.create('user_123');
const tools = await session.tools();
const response = await env.AI.run('@cf/meta/llama-3.1-8b-instruct', {
messages: [
{ role: 'system', content: 'You are a helpful assistant.' },
{ role: 'user', content: 'Summarize my emails from today' },
],
// session.tools() returns a collection keyed by tool slug
tools: Object.values(tools),
});
const results = [];
for (const toolCall of response.tool_calls ?? []) {
results.push(await composio.provider.executeToolCall('user_123', toolCall, {}));
}
return Response.json({ response, results });
},
};
executeToolCall takes the { name, arguments } tool calls that Workers AI emits, runs the matching Composio tool for that user, and returns the result as a JSON string.