@devries-cameron20 / composio-1 / commits / a80460b4d
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.

fix(docs): keep the Welcome auth diagram drawable at every pane width

The new AuthDiagram sized its hub (`w-36`) and account cards (`w-44`) with fixed widths totalling 320px, but the feature-grid pane is not monotonic in the viewport: ~404px at 1280px, and only ~242px at 640px where the grid goes two-column. Below ~394px viewport the two blocks shrank until they touched, `ex === sx` collapsed every wire into `elbowPath`'s straight-line fallback, and the middle connector became a zero-length, invisible path. The card rendered as three stray tick marks on every iPhone below Pro Max, and the account cards overflowed the clip at 360px. Use proportional widths with caps (`w-[36%] max-w-36` / `w-[52%] max-w-56`) so ~12% of the pane is always reserved as horizontal run for the elbows. Measured after: 29px gap at the 242px worst case, 34px at 360px, 50px at 1280px, no overflow and no degenerate paths anywhere in the range. The account label now hides by container query rather than a viewport breakpoint, which would gate on the wrong axis. Also from review: - Sandbox mock showed `composio.sandbox.run()` in a file chromed `sandbox.ts`. Per content/docs/sandbox/remote.mdx — where the card links — the sandbox is a persistent Python environment driven through COMPOSIO_REMOTE_WORKBENCH with `run_composio_tool` / `invoke_llm`. Rewritten on that real surface and relabelled `sandbox.py`; `WorkbenchVisual` renamed to `SandboxVisual`. - `twilio` is not in public/data/toolkits.json, so the tile advertised an app with no /toolkits page behind it. Swapped for `zendesk`. - The dark logo was `aria-hidden`, so the heading's accessible name lost "Composio" in dark mode only. Both variants now carry the same alt. - Restored the badge style assertions the PR dropped, which still held, and added regression coverage for the diagram widths, the catalog check, and the sandbox surface. - Restored the window resize listener that connection-refresh-visual.tsx keeps alongside its ResizeObserver. - Nits: stale "8×2" comment, redundant fragment, shared the duplicated fade style, renamed the misleading `homeIntentAnchor(title)` parameter. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

Kshitij Jhunjhunwala committed Aug 17, 2026 at 14:56 UTC a80460b4da00742a4f54a43067338bd3a412ad59
6 files changed +142 -61
docs/components/home-auth-diagram.tsx
+21 -5
@@ -47,6 +47,16 @@ function elbowPath(sx: number, sy: number, ex: number, ey: number, r = 8): strin
47 * wires meet the hub and cards precisely at every breakpoint. All surfaces
48 * use bg-fd-card so nothing reads as recessed against the mock's own card,
49 * and logos render inline without a white swatch behind them.
50 + *
51 + * Widths are proportional (`w-[36%]` / `w-[52%]`, capped) rather than fixed,
52 + * which reserves the remaining ~12% as horizontal run for the elbows at every
53 + * size. Fixed widths do not work here: this pane is *not* monotonic in the
54 + * viewport — it is ~404px at 1280px wide but only ~242px at 640px, where the
55 + * feature grid goes two-column. A fixed pair that fits phones overflows at
56 + * `sm`, and `ex === sx` collapses every wire into `elbowPath`'s straight-line
57 + * fallback (the middle one to a zero-length, invisible path). The account
58 + * label hides by container query for the same reason — viewport breakpoints
59 + * would gate on the wrong axis.
60 */
61 export function AuthDiagram() {
62 const rootRef = useRef<HTMLDivElement>(null);
@@ -88,8 +98,14 @@ export function AuthDiagram() {
98 const root = rootRef.current;
99 const ro = root ? new ResizeObserver(() => calc()) : null;
100 if (root && ro) ro.observe(root);
101 + // ResizeObserver covers layout changes, but keep the window listener too:
102 + // RO delivery is throttled in backgrounded documents, so a tab resized
103 + // while hidden can surface with stale paths. Matches
104 + // `connection-refresh-visual.tsx`.
105 + window.addEventListener('resize', calc);
106 return () => {
107 window.clearTimeout(t);
108 + window.removeEventListener('resize', calc);
109 ro?.disconnect();
110 };
111 }, [calc]);
@@ -97,7 +113,7 @@ export function AuthDiagram() {
113 return (
114 <div
115 ref={rootRef}
100 - className="relative flex h-full w-full items-center justify-between overflow-hidden"
116 + className="@container relative flex h-full w-full items-center justify-between overflow-hidden"
117 >
118 <svg
119 aria-hidden="true"
@@ -116,7 +132,7 @@ export function AuthDiagram() {
132
133 <div
134 ref={hubRef}
119 - 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"
135 + 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"
136 >
137 <span className="flex size-6 shrink-0 items-center justify-center rounded-full bg-fd-muted">
138 <User aria-hidden="true" className="size-3.5 text-fd-foreground/60" />
@@ -131,10 +147,10 @@ export function AuthDiagram() {
147 </div>
148 </div>
149
134 - <div className="relative z-10 flex flex-col gap-2">
150 + <div className="relative z-10 flex w-[52%] max-w-56 shrink-0 flex-col gap-2">
151 {ACCOUNTS.map((app, i) => (
152 <div
137 - className="flex w-44 items-center gap-2 rounded-[6px] border border-fd-border bg-fd-card px-2.5 py-2"
153 + className="flex w-full items-center gap-2 rounded-[6px] border border-fd-border bg-fd-card px-2.5 py-2"
154 key={app.slug}
155 ref={el => {
156 cardRefs.current[i] = el;
@@ -150,7 +166,7 @@ export function AuthDiagram() {
166 <span className="truncate font-mono text-[11px] text-fd-foreground/85">
167 {app.name}
168 </span>
153 - <span className="ml-auto truncate font-mono text-[9.5px] text-fd-foreground/45">
169 + <span className="ml-auto hidden truncate font-mono text-[9.5px] text-fd-foreground/45 @[340px]:inline">
170 {app.account}
171 </span>
172 </div>
docs/components/home-features.tsx
+14 -15
@@ -2,11 +2,7 @@ import Link from 'next/link';
2 import { ArrowUpRight } from 'lucide-react';
3 import type { ReactNode } from 'react';
4 import { AuthDiagram } from './home-auth-diagram';
5 -
6 -const MOCK_FADE_STYLE = {
7 - maskImage: 'linear-gradient(to bottom, black 55%, transparent 100%)',
8 - WebkitMaskImage: 'linear-gradient(to bottom, black 55%, transparent 100%)',
9 -};
5 +import { MOCK_FADE_STYLE } from './home-shared';
6
7 const LOGO_CDN = 'https://logos.composio.dev/api';
8 // 10-col × 3-row grid: 29 recognizable toolkit logos plus a brand-tinted
@@ -18,7 +14,7 @@ const TOOLKIT_LOGOS = [
14 'linear', 'jira', 'asana', 'trello', 'clickup',
15 'github', 'gitlab', 'figma', 'canva', 'googledrive',
16 'dropbox', 'airtable', 'confluence', 'salesforce', 'hubspot',
21 - 'stripe', 'shopify', 'twilio', 'sendgrid', 'mailchimp',
17 + 'stripe', 'shopify', 'zendesk', 'sendgrid', 'mailchimp',
18 'calendly', 'youtube', 'twitter', 'linkedin',
19 ];
20
@@ -28,11 +24,14 @@ const TRIGGER_FEED: { app: string; event: string }[] = [
24 { app: 'linear', event: 'issue.opened' },
25 ];
26
31 -const SANDBOX_CODE = `const result = await composio.sandbox.run(\`
32 - const issues = await tools.LINEAR_LIST_ISSUES();
33 - const summary = await ai.summarize(issues);
34 - await tools.SLACK_POST({ text: summary });
35 -\`);`;
27 +// The sandbox is a persistent *Python* environment the agent drives through
28 +// the COMPOSIO_REMOTE_WORKBENCH meta tool, with `run_composio_tool` /
29 +// `invoke_llm` pre-initialized — see content/docs/sandbox/remote.mdx, which is
30 +// where this card links. Keep the mock on that real surface so a reader who
31 +// copies it lands on something that exists.
32 +const SANDBOX_CODE = `issues, err = run_composio_tool("LINEAR_LIST_ISSUES", {})
33 +summary = invoke_llm(f"Summarize: {issues}")
34 +run_composio_tool("SLACK_SEND_MESSAGE", {"text": summary})`;
35
36 export function HomeFeatures() {
37 return (
@@ -61,7 +60,7 @@ export function HomeFeatures() {
60 title="Run arbitrary code, safely."
61 description="A sandbox pre-wired with your user's connected accounts and 1000+ tools."
62 href="/docs/sandbox"
64 - visual={<WorkbenchVisual />}
63 + visual={<SandboxVisual />}
64 />
65 </div>
66 </section>
@@ -108,7 +107,7 @@ function FeatureCard({
107 }
108
109 function ToolkitsVisual() {
111 - // 8×2 tile grid stretched to fill the visual pane. Tiles paint their own
110 + // 10×3 tile grid stretched to fill the visual pane. Tiles paint their own
111 // bg-fd-card so they read as elevated on the recessed pane; the container's
112 // bg-fd-border bleeds through the 1px gaps to draw hairlines between them.
113 return (
@@ -162,13 +161,13 @@ function TriggersVisual() {
161 );
162 }
163
165 -function WorkbenchVisual() {
164 +function SandboxVisual() {
165 return (
166 <div className="flex h-full w-full flex-col overflow-hidden rounded-[8px] border border-fd-border bg-fd-card">
167 <div className="flex shrink-0 items-center gap-2 border-b border-fd-border px-3.5 py-2">
168 <span className="size-1.5 rounded-full bg-fd-foreground/25" />
169 <span className="font-mono text-[10.5px] tracking-[0.02em] text-fd-foreground/50">
171 - sandbox.ts
170 + sandbox.py
171 </span>
172 </div>
173 <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">
docs/components/home-shared.ts new
+10
@@ -0,0 +1,10 @@
1 +/**
2 + * Bottom fade applied to the Welcome page's product mocks, so each one bleeds
3 + * into its card edge instead of stopping at a hard line. Shared by the
4 + * "Two ways to start" hero cards (`home-surfaces.tsx`) and the feature grid
5 + * (`home-features.tsx`) so the two sections fade identically.
6 + */
7 +export const MOCK_FADE_STYLE = {
8 + maskImage: 'linear-gradient(to bottom, black 55%, transparent 100%)',
9 + WebkitMaskImage: 'linear-gradient(to bottom, black 55%, transparent 100%)',
10 +};
docs/components/home-surfaces.tsx
+27 -39
@@ -2,11 +2,7 @@ import Link from 'next/link';
2 import { ArrowUp, ArrowUpRight, Mic, Plus } from 'lucide-react';
3 import type { ComponentType } from 'react';
4 import { HOME_INTENTS, homeIntentAnchor, type HomeIntent } from '@/lib/home-navigation';
5 -
6 -const BOTTOM_FADE_STYLE = {
7 - maskImage: 'linear-gradient(to bottom, black 55%, transparent 100%)',
8 - WebkitMaskImage: 'linear-gradient(to bottom, black 55%, transparent 100%)',
9 -};
5 +import { MOCK_FADE_STYLE } from './home-shared';
6
7 /**
8 * Each product is described by the same mock the dashboard onboarding
@@ -49,8 +45,7 @@ function IntentCard({ intent }: { intent: HomeIntent }) {
45 src="/Composio Logo.svg"
46 />
47 <img
52 - alt=""
53 - aria-hidden="true"
48 + alt="Composio"
49 className="hidden h-[22px] w-auto dark:block"
50 src="/Composio Logo Dark.svg"
51 />
@@ -157,39 +152,32 @@ const FOR_YOU_CLIENT_LOGOS = [
152
153 function ForYouVisual() {
154 return (
160 - <>
161 - <div className="absolute inset-x-5 -bottom-3 flex items-end gap-4 sm:inset-x-6">
162 - <div
163 - className="grid shrink-0 grid-cols-2 gap-2.5"
164 - style={BOTTOM_FADE_STYLE}
165 - >
166 - {FOR_YOU_CLIENT_LOGOS.map(logo => (
167 - <img
168 - alt=""
169 - className="size-8 object-contain"
170 - draggable={false}
171 - key={logo.label}
172 - src={logo.src}
173 - />
174 - ))}
175 - </div>
176 - <div
177 - className="min-w-0 flex-1 rounded-[18px] border border-fd-border bg-fd-card p-3"
178 - style={BOTTOM_FADE_STYLE}
179 - >
180 - <div className="text-[12px] text-fd-foreground/50">
181 - How can I help?
182 - </div>
183 - <div className="mt-4 flex items-center gap-2 text-fd-foreground/50">
184 - <Plus className="size-3.5 shrink-0" />
185 - <Mic className="ml-auto size-3.5 shrink-0" />
186 - <span className="flex size-6 shrink-0 items-center justify-center rounded-[8px] bg-[var(--composio-brand)] text-white">
187 - <ArrowUp className="size-3.5" />
188 - </span>
189 - </div>
155 + <div className="absolute inset-x-5 -bottom-3 flex items-end gap-4 sm:inset-x-6">
156 + <div className="grid shrink-0 grid-cols-2 gap-2.5" style={MOCK_FADE_STYLE}>
157 + {FOR_YOU_CLIENT_LOGOS.map(logo => (
158 + <img
159 + alt=""
160 + className="size-8 object-contain"
161 + draggable={false}
162 + key={logo.label}
163 + src={logo.src}
164 + />
165 + ))}
166 + </div>
167 + <div
168 + className="min-w-0 flex-1 rounded-[18px] border border-fd-border bg-fd-card p-3"
169 + style={MOCK_FADE_STYLE}
170 + >
171 + <div className="text-[12px] text-fd-foreground/50">How can I help?</div>
172 + <div className="mt-4 flex items-center gap-2 text-fd-foreground/50">
173 + <Plus className="size-3.5 shrink-0" />
174 + <Mic className="ml-auto size-3.5 shrink-0" />
175 + <span className="flex size-6 shrink-0 items-center justify-center rounded-[8px] bg-[var(--composio-brand)] text-white">
176 + <ArrowUp className="size-3.5" />
177 + </span>
178 </div>
179 </div>
192 - </>
180 + </div>
181 );
182 }
183
@@ -197,7 +185,7 @@ function PlatformVisual() {
185 return (
186 <div
187 className="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"
200 - style={BOTTOM_FADE_STYLE}
188 + style={MOCK_FADE_STYLE}
189 >
190 <div className="mb-2 flex items-center gap-1.5">
191 <span className="size-2 rounded-full bg-fd-foreground/15" />
docs/lib/home-navigation.ts
+6 -2
@@ -61,8 +61,12 @@ export const HOME_INTENTS: HomeIntent[] = [
61 },
62 ];
63
64 -export function homeIntentAnchor(title: string): string {
65 - return title.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/(^-|-$)/g, '');
64 +/**
65 + * Slugify an intent's heading label into an anchor id. Called with
66 + * `intent.product`, so the ids are `#platform` / `#for-you`.
67 + */
68 +export function homeIntentAnchor(label: string): string {
69 + return label.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/(^-|-$)/g, '');
70 }
71
72 export function homeIntentsToMarkdown(): string {
docs/tests/static/home-navigation.test.ts
+64
@@ -62,9 +62,16 @@ describe('Welcome navigation', () => {
62 // window for Platform.
63 expect(source).toContain('ProductBadge');
64 expect(source).toContain('background: PLATFORM_BADGE_GRADIENT');
65 + expect(source).toContain("backgroundClip: 'text'");
66 + expect(source).toContain("WebkitTextFillColor: 'transparent'");
67 + expect(source).toContain("mask: 'linear-gradient(#fff 0 0) content-box");
68 expect(source).toContain('text-[#0007cd] dark:text-[#4d6fff]');
69 expect(source).toContain('product-badge-platform-border');
70 expect(source).toContain('/Composio Logo.svg');
71 + // Both logo variants carry the same alt: `dark:hidden` / `hidden dark:block`
72 + // swap them in CSS, so an aria-hidden dark variant would drop "Composio"
73 + // from the heading's accessible name in dark mode only.
74 + expect(source.match(/alt="Composio"/g) ?? []).toHaveLength(2);
75 expect(source).toContain('INTENT_VISUALS');
76 expect(source).toContain('How can I help?');
77 expect(source).toContain('composio.create');
@@ -73,4 +80,61 @@ describe('Welcome navigation', () => {
80 expect(await Bun.file(new URL(`../../public/images/clients/${logo}`, import.meta.url)).exists()).toBe(true);
81 }
82 });
83 +
84 + test('advertises only toolkits that exist in the catalog', async () => {
85 + const source = await Bun.file(
86 + new URL('../../components/home-features.tsx', import.meta.url)
87 + ).text();
88 + const block = source.match(/const TOOLKIT_LOGOS = \[([\s\S]*?)\]/)?.[1];
89 + expect(block).toBeTruthy();
90 + const slugs = [...block!.matchAll(/'([a-z0-9]+)'/g)].map(m => m[1]);
91 + expect(slugs.length).toBe(29);
92 +
93 + const catalog: { slug: string }[] = await Bun.file(
94 + new URL('../../public/data/toolkits.json', import.meta.url)
95 + ).json();
96 + const known = new Set(catalog.map(t => t.slug));
97 + // A tile that isn't in the catalog still renders (the logo CDN serves it)
98 + // but advertises an app with no /toolkits/<slug> page behind it.
99 + expect(slugs.filter(s => !known.has(s))).toEqual([]);
100 + });
101 +
102 + test('keeps the auth diagram wires drawable at every pane width', async () => {
103 + const source = await Bun.file(
104 + new URL('../../components/home-auth-diagram.tsx', import.meta.url)
105 + ).text();
106 +
107 + // The feature-grid pane is not monotonic in the viewport: ~404px at 1280px
108 + // but only ~242px at 640px, where the grid goes two-column. Fixed hub/card
109 + // widths that fit one end overflow the other, the horizontal run goes to
110 + // zero, and every elbow degenerates into elbowPath's straight-line
111 + // fallback — the middle wire to a zero-length, invisible path. Proportional
112 + // widths keep a gap at every size; container queries gate the account label
113 + // on the pane rather than the viewport.
114 + expect(source).toContain('w-[36%] max-w-36');
115 + expect(source).toContain('w-[52%] max-w-56');
116 + expect(source).toContain('@container');
117 + expect(source).toContain('@[340px]:inline');
118 + expect(source).not.toMatch(/className="[^"]*\bw-44\b/);
119 +
120 + // Stale paths outlive a resize when RO delivery is throttled, so the
121 + // window listener backs it up (as in connection-refresh-visual.tsx).
122 + expect(source).toContain("window.addEventListener('resize', calc)");
123 + expect(source).toContain("window.removeEventListener('resize', calc)");
124 + });
125 +
126 + test('shows the sandbox on its real Python surface', async () => {
127 + const source = await Bun.file(
128 + new URL('../../components/home-features.tsx', import.meta.url)
129 + ).text();
130 +
131 + // content/docs/sandbox/remote.mdx — where this card links — describes a
132 + // persistent Python environment with run_composio_tool / invoke_llm
133 + // pre-initialized. There is no composio.sandbox.run() SDK method.
134 + expect(source).toContain('run_composio_tool');
135 + expect(source).toContain('invoke_llm');
136 + expect(source).toContain('sandbox.py');
137 + expect(source).not.toContain('composio.sandbox.run');
138 + expect(source).not.toContain('composio.workbench.run');
139 + });
140 });