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

next
tsx 152 lines 5.04 KB
Raw
1 import { Bot, Boxes, Wrench } from 'lucide-react';
2 import type { ComponentType, ReactNode } from 'react';
3
4 /**
5 * LocalSandboxBoundary — the motivation diagram for the local sandbox page.
6 *
7 * Both setups use Composio for auth + tools. The only thing that moves is the
8 * sandbox that runs your code: outside your security boundary on remote, inside
9 * it on local. The boundary is the only framed box, so "inside vs outside" reads
10 * literally; the sandbox row is brand-tinted on both sides so the eye tracks it.
11 *
12 * Server component, no client JS. Both columns carry the same content weight, so
13 * they balance without forced heights. Stacks to one column on mobile.
14 */
15 export function LocalSandboxBoundary() {
16 return (
17 <div className="not-prose my-6 overflow-hidden rounded-md border border-fd-border bg-fd-background">
18 <div className="border-b border-fd-border px-5 py-2.5 font-mono text-[10px] uppercase tracking-[0.08em] text-fd-foreground/45">
19 where your code runs, relative to your security boundary
20 </div>
21
22 <div className="grid gap-px bg-fd-border md:grid-cols-2">
23 {/* Remote: the sandbox runs outside your boundary */}
24 <Column label="Remote sandbox">
25 <Boundary tone="neutral">
26 <Row icon={Bot} title="Your agent" />
27 </Boundary>
28 <Seam />
29 <Outside>
30 <Row icon={Boxes} title="Remote sandbox" sub="runs your code" emphasis />
31 <Row icon={Wrench} title="Composio" sub="auth + tools" />
32 </Outside>
33 </Column>
34
35 {/* Local: the sandbox runs inside your boundary */}
36 <Column label="Local sandbox" accent>
37 <Boundary tone="accent">
38 <Row icon={Bot} title="Your agent" />
39 <Row icon={Boxes} title="Local sandbox" sub="runs your code" emphasis />
40 </Boundary>
41 <Seam accent />
42 <Outside>
43 <Row icon={Wrench} title="Composio" sub="auth + tools" />
44 </Outside>
45 </Column>
46 </div>
47 </div>
48 );
49 }
50
51 function Column({ label, accent = false, children }: { label: string; accent?: boolean; children: ReactNode }) {
52 return (
53 <div className="flex flex-col gap-4 bg-fd-background p-5">
54 <div className="flex items-center gap-2">
55 <span
56 className={'size-1.5 rounded-full ' + (accent ? 'bg-[var(--composio-brand)]' : 'bg-fd-foreground/30')}
57 aria-hidden="true"
58 />
59 <span
60 className={
61 'font-mono text-[11px] font-medium uppercase tracking-[0.08em] ' +
62 (accent ? 'text-[var(--composio-brand)]' : 'text-fd-foreground/55')
63 }
64 >
65 {label}
66 </span>
67 </div>
68 {children}
69 </div>
70 );
71 }
72
73 function Boundary({ tone, children }: { tone: 'neutral' | 'accent'; children: ReactNode }) {
74 const border =
75 tone === 'accent' ? 'border-[var(--composio-brand)]/35' : 'border-dashed border-fd-foreground/20';
76 return (
77 <div className={'relative rounded-md border bg-fd-foreground/[0.02] px-3 pb-3 pt-8 ' + border}>
78 <span className="absolute left-3 top-2.5 font-mono text-[9px] uppercase tracking-[0.07em] text-fd-foreground/40">
79 your boundary
80 </span>
81 <div className="flex flex-col gap-2">{children}</div>
82 </div>
83 );
84 }
85
86 function Outside({ children }: { children: ReactNode }) {
87 return (
88 <div>
89 <span className="font-mono text-[9px] uppercase tracking-[0.07em] text-fd-foreground/40">
90 outside your boundary
91 </span>
92 <div className="mt-2 flex flex-col gap-2">{children}</div>
93 </div>
94 );
95 }
96
97 function Row({
98 icon: Icon,
99 title,
100 sub,
101 emphasis = false,
102 }: {
103 icon: ComponentType<{ className?: string; 'aria-hidden'?: boolean }>;
104 title: string;
105 sub?: string;
106 emphasis?: boolean;
107 }) {
108 return (
109 <div
110 className={
111 'flex items-center gap-3 rounded-md px-2.5 py-2 ' +
112 (emphasis ? 'bg-[var(--composio-brand)]/[0.06] ring-1 ring-inset ring-[var(--composio-brand)]/25' : '')
113 }
114 >
115 <span
116 className={
117 'flex size-8 shrink-0 items-center justify-center rounded-md ' +
118 (emphasis
119 ? 'bg-[var(--composio-brand)]/10 text-[var(--composio-brand)]'
120 : 'bg-fd-foreground/[0.06] text-fd-foreground/65')
121 }
122 >
123 <Icon aria-hidden className="size-4" />
124 </span>
125 <div className="min-w-0">
126 <div
127 className={
128 'truncate text-[13px] font-medium leading-tight ' +
129 (emphasis ? 'text-[var(--composio-brand)]' : 'text-fd-foreground')
130 }
131 >
132 {title}
133 </div>
134 {sub && <div className="mt-0.5 truncate font-mono text-[10px] text-fd-foreground/45">{sub}</div>}
135 </div>
136 </div>
137 );
138 }
139
140 function Seam({ accent = false }: { accent?: boolean }) {
141 return (
142 <div
143 className={
144 'flex items-center justify-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.06em] ' +
145 (accent ? 'text-[var(--composio-brand)]' : 'text-fd-foreground/40')
146 }
147 >
148 <span>auth + tools</span>
149 <span aria-hidden="true">↓</span>
150 </div>
151 );
152 }