Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
fix(docs): keep the Welcome auth diagram drawable at every pane width
Kshitij Jhunjhunwalaa80460b4da00
diff --git a/docs/components/home-auth-diagram.tsx b/docs/components/home-auth-diagram.tsxindex a735305c9..40297b807 100644--- a/docs/components/home-auth-diagram.tsx+++ b/docs/components/home-auth-diagram.tsx@@ -47,6 +47,16 @@ function elbowPath(sx: number, sy: number, ex: number, ey: number, r = 8): strin* wires meet the hub and cards precisely at every breakpoint. All surfaces* use bg-fd-card so nothing reads as recessed against the mock's own card,* and logos render inline without a white swatch behind them.+ *+ * Widths are proportional (`w-[36%]` / `w-[52%]`, capped) rather than fixed,+ * which reserves the remaining ~12% as horizontal run for the elbows at every+ * size. Fixed widths do not work here: this pane is *not* monotonic in the+ * viewport — it is ~404px at 1280px wide but only ~242px at 640px, where the+ * feature grid goes two-column. A fixed pair that fits phones overflows at+ * `sm`, and `ex === sx` collapses every wire into `elbowPath`'s straight-line+ * fallback (the middle one to a zero-length, invisible path). The account+ * label hides by container query for the same reason — viewport breakpoints+ * would gate on the wrong axis.*/export function AuthDiagram() {const rootRef = useRef<HTMLDivElement>(null);@@ -88,8 +98,14 @@ export function AuthDiagram() {const root = rootRef.current;const ro = root ? new ResizeObserver(() => calc()) : null;if (root && ro) ro.observe(root);+ // ResizeObserver covers layout changes, but keep the window listener too:+ // RO delivery is throttled in backgrounded documents, so a tab resized+ // while hidden can surface with stale paths. Matches+ // `connection-refresh-visual.tsx`.+ window.addEventListener('resize', calc);return () => {window.clearTimeout(t);+ window.removeEventListener('resize', calc);ro?.disconnect();};}, [calc]);@@ -97,7 +113,7 @@ export function AuthDiagram() {return (<divref={rootRef}- className="relative flex h-full w-full items-center justify-between overflow-hidden"+ className="@container relative flex h-full w-full items-center justify-between overflow-hidden"><svgaria-hidden="true"@@ -116,7 +132,7 @@ export function AuthDiagram() {<divref={hubRef}- className="relative z-10 flex w-36 items-center gap-2 rounded-[6px] border border-fd-border bg-fd-card px-2.5 py-2"+ className="relative z-10 flex w-[36%] max-w-36 shrink-0 items-center gap-2 rounded-[6px] border border-fd-border bg-fd-card px-2.5 py-2"><span className="flex size-6 shrink-0 items-center justify-center rounded-full bg-fd-muted"><User aria-hidden="true" className="size-3.5 text-fd-foreground/60" />@@ -131,10 +147,10 @@ export function AuthDiagram() {</div></div>- <div className="relative z-10 flex flex-col gap-2">+ <div className="relative z-10 flex w-[52%] max-w-56 shrink-0 flex-col gap-2">{ACCOUNTS.map((app, i) => (<div- className="flex w-44 items-center gap-2 rounded-[6px] border border-fd-border bg-fd-card px-2.5 py-2"+ className="flex w-full items-center gap-2 rounded-[6px] border border-fd-border bg-fd-card px-2.5 py-2"key={app.slug}ref={el => {cardRefs.current[i] = el;@@ -150,7 +166,7 @@ export function AuthDiagram() {<span className="truncate font-mono text-[11px] text-fd-foreground/85">{app.name}</span>- <span className="ml-auto truncate font-mono text-[9.5px] text-fd-foreground/45">+ <span className="ml-auto hidden truncate font-mono text-[9.5px] text-fd-foreground/45 @[340px]:inline">{app.account}</span></div>diff --git a/docs/components/home-features.tsx b/docs/components/home-features.tsxindex f06fa4474..61a961953 100644--- a/docs/components/home-features.tsx+++ b/docs/components/home-features.tsx@@ -2,11 +2,7 @@ import Link from 'next/link';import { ArrowUpRight } from 'lucide-react';import type { ReactNode } from 'react';import { AuthDiagram } from './home-auth-diagram';--const MOCK_FADE_STYLE = {- maskImage: 'linear-gradient(to bottom, black 55%, transparent 100%)',- WebkitMaskImage: 'linear-gradient(to bottom, black 55%, transparent 100%)',-};+import { MOCK_FADE_STYLE } from './home-shared';const LOGO_CDN = 'https://logos.composio.dev/api';// 10-col × 3-row grid: 29 recognizable toolkit logos plus a brand-tinted@@ -18,7 +14,7 @@ const TOOLKIT_LOGOS = ['linear', 'jira', 'asana', 'trello', 'clickup','github', 'gitlab', 'figma', 'canva', 'googledrive','dropbox', 'airtable', 'confluence', 'salesforce', 'hubspot',- 'stripe', 'shopify', 'twilio', 'sendgrid', 'mailchimp',+ 'stripe', 'shopify', 'zendesk', 'sendgrid', 'mailchimp','calendly', 'youtube', 'twitter', 'linkedin',];@@ -28,11 +24,14 @@ const TRIGGER_FEED: { app: string; event: string }[] = [{ app: 'linear', event: 'issue.opened' },];-const SANDBOX_CODE = `const result = await composio.sandbox.run(\`- const issues = await tools.LINEAR_LIST_ISSUES();- const summary = await ai.summarize(issues);- await tools.SLACK_POST({ text: summary });-\`);`;+// The sandbox is a persistent *Python* environment the agent drives through+// the COMPOSIO_REMOTE_WORKBENCH meta tool, with `run_composio_tool` /+// `invoke_llm` pre-initialized — see content/docs/sandbox/remote.mdx, which is+// where this card links. Keep the mock on that real surface so a reader who+// copies it lands on something that exists.+const SANDBOX_CODE = `issues, err = run_composio_tool("LINEAR_LIST_ISSUES", {})+summary = invoke_llm(f"Summarize: {issues}")+run_composio_tool("SLACK_SEND_MESSAGE", {"text": summary})`;export function HomeFeatures() {return (@@ -61,7 +60,7 @@ export function HomeFeatures() {title="Run arbitrary code, safely."description="A sandbox pre-wired with your user's connected accounts and 1000+ tools."href="/docs/sandbox"- visual={<WorkbenchVisual />}+ visual={<SandboxVisual />}/></div></section>@@ -108,7 +107,7 @@ function FeatureCard({}function ToolkitsVisual() {- // 8×2 tile grid stretched to fill the visual pane. Tiles paint their own+ // 10×3 tile grid stretched to fill the visual pane. Tiles paint their own// bg-fd-card so they read as elevated on the recessed pane; the container's// bg-fd-border bleeds through the 1px gaps to draw hairlines between them.return (@@ -162,13 +161,13 @@ function TriggersVisual() {);}-function WorkbenchVisual() {+function SandboxVisual() {return (<div className="flex h-full w-full flex-col overflow-hidden rounded-[8px] border border-fd-border bg-fd-card"><div className="flex shrink-0 items-center gap-2 border-b border-fd-border px-3.5 py-2"><span className="size-1.5 rounded-full bg-fd-foreground/25" /><span className="font-mono text-[10.5px] tracking-[0.02em] text-fd-foreground/50">- sandbox.ts+ sandbox.py</span></div><pre className="flex-1 overflow-hidden bg-fd-muted/30 px-3.5 py-2.5 font-mono text-[10.5px] leading-[1.7] text-fd-foreground/70">diff --git a/docs/components/home-shared.ts b/docs/components/home-shared.tsnew file mode 100644index 000000000..2c90a5f7a--- /dev/null+++ b/docs/components/home-shared.ts@@ -0,0 +1,10 @@+/**+ * Bottom fade applied to the Welcome page's product mocks, so each one bleeds+ * into its card edge instead of stopping at a hard line. Shared by the+ * "Two ways to start" hero cards (`home-surfaces.tsx`) and the feature grid+ * (`home-features.tsx`) so the two sections fade identically.+ */+export const MOCK_FADE_STYLE = {+ maskImage: 'linear-gradient(to bottom, black 55%, transparent 100%)',+ WebkitMaskImage: 'linear-gradient(to bottom, black 55%, transparent 100%)',+};diff --git a/docs/components/home-surfaces.tsx b/docs/components/home-surfaces.tsxindex f5148c1fc..cb555573b 100644--- a/docs/components/home-surfaces.tsx+++ b/docs/components/home-surfaces.tsx@@ -2,11 +2,7 @@ import Link from 'next/link';import { ArrowUp, ArrowUpRight, Mic, Plus } from 'lucide-react';import type { ComponentType } from 'react';import { HOME_INTENTS, homeIntentAnchor, type HomeIntent } from '@/lib/home-navigation';--const BOTTOM_FADE_STYLE = {- maskImage: 'linear-gradient(to bottom, black 55%, transparent 100%)',- WebkitMaskImage: 'linear-gradient(to bottom, black 55%, transparent 100%)',-};+import { MOCK_FADE_STYLE } from './home-shared';/*** Each product is described by the same mock the dashboard onboarding@@ -49,8 +45,7 @@ function IntentCard({ intent }: { intent: HomeIntent }) {src="/Composio Logo.svg"/><img- alt=""- aria-hidden="true"+ alt="Composio"className="hidden h-[22px] w-auto dark:block"src="/Composio Logo Dark.svg"/>@@ -157,39 +152,32 @@ const FOR_YOU_CLIENT_LOGOS = [function ForYouVisual() {return (- <>- <div className="absolute inset-x-5 -bottom-3 flex items-end gap-4 sm:inset-x-6">- <div- className="grid shrink-0 grid-cols-2 gap-2.5"- style={BOTTOM_FADE_STYLE}- >- {FOR_YOU_CLIENT_LOGOS.map(logo => (- <img- alt=""- className="size-8 object-contain"- draggable={false}- key={logo.label}- src={logo.src}- />- ))}- </div>- <div- className="min-w-0 flex-1 rounded-[18px] border border-fd-border bg-fd-card p-3"- style={BOTTOM_FADE_STYLE}- >- <div className="text-[12px] text-fd-foreground/50">- How can I help?- </div>- <div className="mt-4 flex items-center gap-2 text-fd-foreground/50">- <Plus className="size-3.5 shrink-0" />- <Mic className="ml-auto size-3.5 shrink-0" />- <span className="flex size-6 shrink-0 items-center justify-center rounded-[8px] bg-[var(--composio-brand)] text-white">- <ArrowUp className="size-3.5" />- </span>- </div>+ <div className="absolute inset-x-5 -bottom-3 flex items-end gap-4 sm:inset-x-6">+ <div className="grid shrink-0 grid-cols-2 gap-2.5" style={MOCK_FADE_STYLE}>+ {FOR_YOU_CLIENT_LOGOS.map(logo => (+ <img+ alt=""+ className="size-8 object-contain"+ draggable={false}+ key={logo.label}+ src={logo.src}+ />+ ))}+ </div>+ <div+ className="min-w-0 flex-1 rounded-[18px] border border-fd-border bg-fd-card p-3"+ style={MOCK_FADE_STYLE}+ >+ <div className="text-[12px] text-fd-foreground/50">How can I help?</div>+ <div className="mt-4 flex items-center gap-2 text-fd-foreground/50">+ <Plus className="size-3.5 shrink-0" />+ <Mic className="ml-auto size-3.5 shrink-0" />+ <span className="flex size-6 shrink-0 items-center justify-center rounded-[8px] bg-[var(--composio-brand)] text-white">+ <ArrowUp className="size-3.5" />+ </span></div></div>- </>+ </div>);}@@ -197,7 +185,7 @@ function PlatformVisual() {return (<divclassName="absolute inset-x-5 -bottom-3 rounded-[12px] border border-fd-border bg-fd-card p-3 font-mono text-[11.5px] leading-[1.75] text-fd-foreground/75 sm:inset-x-6"- style={BOTTOM_FADE_STYLE}+ style={MOCK_FADE_STYLE}><div className="mb-2 flex items-center gap-1.5"><span className="size-2 rounded-full bg-fd-foreground/15" />diff --git a/docs/lib/home-navigation.ts b/docs/lib/home-navigation.tsindex bbbe58a04..30e2c7f4e 100644--- a/docs/lib/home-navigation.ts+++ b/docs/lib/home-navigation.ts@@ -61,8 +61,12 @@ export const HOME_INTENTS: HomeIntent[] = [},];-export function homeIntentAnchor(title: string): string {- return title.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/(^-|-$)/g, '');+/**+ * Slugify an intent's heading label into an anchor id. Called with+ * `intent.product`, so the ids are `#platform` / `#for-you`.+ */+export function homeIntentAnchor(label: string): string {+ return label.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/(^-|-$)/g, '');}export function homeIntentsToMarkdown(): string {diff --git a/docs/tests/static/home-navigation.test.ts b/docs/tests/static/home-navigation.test.tsindex 8abe99f70..04ba09cea 100644--- a/docs/tests/static/home-navigation.test.ts+++ b/docs/tests/static/home-navigation.test.ts@@ -62,9 +62,16 @@ describe('Welcome navigation', () => {// window for Platform.expect(source).toContain('ProductBadge');expect(source).toContain('background: PLATFORM_BADGE_GRADIENT');+ expect(source).toContain("backgroundClip: 'text'");+ expect(source).toContain("WebkitTextFillColor: 'transparent'");+ expect(source).toContain("mask: 'linear-gradient(#fff 0 0) content-box");expect(source).toContain('text-[#0007cd] dark:text-[#4d6fff]');expect(source).toContain('product-badge-platform-border');expect(source).toContain('/Composio Logo.svg');+ // Both logo variants carry the same alt: `dark:hidden` / `hidden dark:block`+ // swap them in CSS, so an aria-hidden dark variant would drop "Composio"+ // from the heading's accessible name in dark mode only.+ expect(source.match(/alt="Composio"/g) ?? []).toHaveLength(2);expect(source).toContain('INTENT_VISUALS');expect(source).toContain('How can I help?');expect(source).toContain('composio.create');@@ -73,4 +80,61 @@ describe('Welcome navigation', () => {expect(await Bun.file(new URL(`../../public/images/clients/${logo}`, import.meta.url)).exists()).toBe(true);}});++ test('advertises only toolkits that exist in the catalog', async () => {+ const source = await Bun.file(+ new URL('../../components/home-features.tsx', import.meta.url)+ ).text();+ const block = source.match(/const TOOLKIT_LOGOS = \[([\s\S]*?)\]/)?.[1];+ expect(block).toBeTruthy();+ const slugs = [...block!.matchAll(/'([a-z0-9]+)'/g)].map(m => m[1]);+ expect(slugs.length).toBe(29);++ const catalog: { slug: string }[] = await Bun.file(+ new URL('../../public/data/toolkits.json', import.meta.url)+ ).json();+ const known = new Set(catalog.map(t => t.slug));+ // A tile that isn't in the catalog still renders (the logo CDN serves it)+ // but advertises an app with no /toolkits/<slug> page behind it.+ expect(slugs.filter(s => !known.has(s))).toEqual([]);+ });++ test('keeps the auth diagram wires drawable at every pane width', async () => {+ const source = await Bun.file(+ new URL('../../components/home-auth-diagram.tsx', import.meta.url)+ ).text();++ // The feature-grid pane is not monotonic in the viewport: ~404px at 1280px+ // but only ~242px at 640px, where the grid goes two-column. Fixed hub/card+ // widths that fit one end overflow the other, the horizontal run goes to+ // zero, and every elbow degenerates into elbowPath's straight-line+ // fallback — the middle wire to a zero-length, invisible path. Proportional+ // widths keep a gap at every size; container queries gate the account label+ // on the pane rather than the viewport.+ expect(source).toContain('w-[36%] max-w-36');+ expect(source).toContain('w-[52%] max-w-56');+ expect(source).toContain('@container');+ expect(source).toContain('@[340px]:inline');+ expect(source).not.toMatch(/className="[^"]*\bw-44\b/);++ // Stale paths outlive a resize when RO delivery is throttled, so the+ // window listener backs it up (as in connection-refresh-visual.tsx).+ expect(source).toContain("window.addEventListener('resize', calc)");+ expect(source).toContain("window.removeEventListener('resize', calc)");+ });++ test('shows the sandbox on its real Python surface', async () => {+ const source = await Bun.file(+ new URL('../../components/home-features.tsx', import.meta.url)+ ).text();++ // content/docs/sandbox/remote.mdx — where this card links — describes a+ // persistent Python environment with run_composio_tool / invoke_llm+ // pre-initialized. There is no composio.sandbox.run() SDK method.+ expect(source).toContain('run_composio_tool');+ expect(source).toContain('invoke_llm');+ expect(source).toContain('sandbox.py');+ expect(source).not.toContain('composio.sandbox.run');+ expect(source).not.toContain('composio.workbench.run');+ });});