@devries-cameron20 / composio Mirror · read-only / commits / aa2b0d13c
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 22, 15:45 UTC

fix(fumadocs): add Twoslash setup for core docs

- toolkit-versioning.mdx: Remove non-existent toolkit.meta.version, add optional chaining for availableVersions - user-management.mdx: Add stubs for user, organization, req, app, storeConnectionRequest, userCanSendMessages - using-triggers.mdx: Add type stubs for NextApiRequest/Response, TriggerEvent, crypto import Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Sushmithamallesh committed Jan 12, 2026 at 19:36 UTC aa2b0d13c5fc83acb260eec7e5e27d0436285ffd
3 files changed +34 -2
fumadocs/content/docs/toolkit-versioning.mdx
+1 -2
@@ -150,9 +150,8 @@ const toolkit = await composio.toolkits.get("github");
150
151 // Extract and print version information
152 console.log("Toolkit:", toolkit.name);
153 -console.log("Current Version:", toolkit.meta.version);
153 console.log("Available Versions:", toolkit.meta.availableVersions);
155 -console.log("Latest Version:", toolkit.meta.availableVersions[0]); // First one is usually the latest
154 +console.log("Latest Version:", toolkit.meta.availableVersions?.[0]);
155 ```
156 </Tab>
157 </Tabs>
fumadocs/content/docs/user-management.mdx
+19
@@ -59,6 +59,10 @@ result = composio.tools.execute(
59 </Tab>
60 <Tab value="TypeScript">
61 ```typescript
62 +import { Composio } from '@composio/core';
63 +const composio = new Composio({ apiKey: 'your_api_key' });
64 +declare const user: { id: string };
65 +// ---cut---
66 // Use your database's user ID (UUID, primary key, etc.)
67 const userId = user.id; // e.g., "550e8400-e29b-41d4-a716-446655440000"
68
@@ -112,6 +116,10 @@ result = composio.tools.execute(
116 </Tab>
117 <Tab value="TypeScript">
118 ```typescript
119 +import { Composio } from '@composio/core';
120 +const composio = new Composio({ apiKey: 'your_api_key' });
121 +declare const organization: { id: string };
122 +// ---cut---
123 // Use the organization ID as userId
124 const userId = organization.id; // e.g., "org_550e8400"
125
@@ -157,6 +165,11 @@ In B2B applications, typically an admin connects accounts once and all team memb
165 - Permission checks ensure users can only access their organization's connections
166
167 ```typescript
168 +import { ConnectionRequest } from '@composio/core';
169 +declare function storeConnectionRequest(orgId: string, adminId: string, req: ConnectionRequest): Promise<void>;
170 +declare function userCanSendMessages(userId: string, orgId: string): Promise<boolean>;
171 +declare const app: { post: (path: string, handler: (req: any, res: any) => Promise<any>) => void };
172 +// ---cut---
173 import { Composio } from '@composio/core';
174 const composio = new Composio({
175 apiKey: process.env.COMPOSIO_API_KEY,
@@ -220,6 +233,8 @@ In B2C applications, each user connects and manages their own accounts. Every us
233 - No permission checks needed since users only access their own data
234
235 ```typescript
236 +declare const app: { get: (path: string, handler: (req: any, res: any) => Promise<any>) => void };
237 +// ---cut---
238 import { Composio } from '@composio/core';
239 const composio = new Composio({
240 apiKey: process.env.COMPOSIO_API_KEY,
@@ -294,6 +309,10 @@ org_shared_tools = composio.tools.get(
309 </Tab>
310 <Tab value="TypeScript">
311 ```typescript
312 +import { Composio } from '@composio/core';
313 +const composio = new Composio({ apiKey: 'your_api_key' });
314 +declare const req: { user: { id: string; organizationId: string } };
315 +// ---cut---
316 // Wrong: Using individual user ID for org-connected tool
317 const userTools = await composio.tools.get(req.user.id, {
318 toolkits: ['slack'], // Fails - Slack is connected at org level
fumadocs/content/docs/using-triggers.mdx
+14
@@ -136,6 +136,11 @@ async def webhook_handler(request: Request):
136 </Tab>
137 <Tab value="TypeScript">
138 ```typescript
139 +import { TriggerEvent } from '@composio/core';
140 +type NextApiRequest = { body: any };
141 +type NextApiResponse = { status: (code: number) => { json: (data: any) => void }; json: (data: any) => void };
142 +type GitHubStarEventData = { repository_name: string; starred_by: string };
143 +// ---cut---
144 export default async function webhookHandler(req: NextApiRequest, res: NextApiResponse) {
145 const payload = req.body;
146
@@ -203,6 +208,9 @@ def verify_webhook_signature(request: Request, body: bytes) -> bool:
208 </Tab>
209 <Tab value="TypeScript">
210 ```typescript
211 +import crypto from 'crypto';
212 +type NextApiRequest = { headers: Record<string, string | undefined> };
213 +// ---cut---
214 function verifyWebhookSignature(
215 req: NextApiRequest,
216 body: string
@@ -302,6 +310,9 @@ print(trigger.payload)
310 </Tab>
311 <Tab value="TypeScript">
312 ```typescript
313 +import { Composio } from '@composio/core';
314 +const composio = new Composio({ apiKey: 'your_api_key' });
315 +// ---cut---
316 // Get trigger type to inspect payload structure
317 const triggerType = await composio.triggers.getType('GITHUB_COMMIT_EVENT');
318 console.log(triggerType.payload);
@@ -357,6 +368,9 @@ composio.triggers.enable(trigger_id="ti_abcd123")
368 </Tab>
369 <Tab value="TypeScript">
370 ```typescript
371 +import { Composio } from '@composio/core';
372 +const composio = new Composio({ apiKey: 'your_api_key' });
373 +// ---cut---
374 // Disable a trigger
375 await composio.triggers.disable('ti_abcd123');
376