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 192 lines 8.45 KB
Raw
1 import { FileCode2, Boxes, Wrench } from 'lucide-react';
2 import type { ReactNode } from 'react';
3
4 const LOGO_CDN = 'https://logos.composio.dev/api';
5
6 /**
7 * LocalWorkbenchFlow: branded replacement for the plain `host → sandbox → tools`
8 * mermaid diagram on the local-workbench PR reviewer page.
9 *
10 * Reads left-to-right as the split that defines a local workbench: the Host
11 * creates a session with code execution turned off and starts a
12 * sandbox you own; the Sandbox runs the reviewer, calling run_composio_tool
13 * back out for each GitHub action; Composio resolves and executes those tool
14 * calls under the user's connection and returns results. Tool execution lives
15 * in your box; discovery and auth stay managed.
16 *
17 * Server component, no client JS. Adapts to light/dark via fd-* tokens.
18 */
19 export function LocalWorkbenchFlow() {
20 return (
21 <div className="not-prose my-6 overflow-hidden rounded-sm border border-fd-border bg-fd-background">
22 {/* header strip: mono, matches the other branded flow visuals */}
23 <div className="flex items-center justify-between border-b border-fd-border px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.06em] text-fd-foreground/45">
24 <span>local-sandbox.runtime</span>
25 <span className="inline-flex items-center gap-1.5 text-fd-foreground/55">
26 <span className="relative inline-flex">
27 <span className="size-1.5 rounded-full bg-[var(--composio-brand)]" />
28 <span className="absolute inset-0 animate-ping rounded-full bg-[var(--composio-brand)] opacity-60" />
29 </span>
30 code runs in your box
31 </span>
32 </div>
33
34 <div className="grid items-stretch gap-px bg-fd-border md:grid-cols-[minmax(0,1fr)_minmax(0,1.05fr)_minmax(0,1.05fr)]">
35 {/* ── Host ───────────────────────────────────────────────── */}
36 <Column>
37 <Lane label="Host" />
38 <div className="flex flex-1 items-center">
39 <div className="w-full border border-fd-border bg-fd-card p-3">
40 <div className="flex items-center gap-2">
41 <span className="flex size-7 items-center justify-center rounded-sm bg-fd-foreground/[0.06] text-fd-foreground/70">
42 <FileCode2 aria-hidden="true" className="size-4" />
43 </span>
44 <div className="min-w-0">
45 <div className="truncate text-[12px] font-medium leading-tight text-fd-foreground">
46 Your orchestrator
47 </div>
48 <div className="truncate font-mono text-[10px] text-fd-foreground/45">
49 src/runner.ts
50 </div>
51 </div>
52 </div>
53 <p className="mt-2.5 text-[11px] leading-snug text-fd-foreground/55">
54 Creates the session with{' '}
55 <code className="font-mono text-[10px] text-fd-foreground/70">workbench.enable: false</code>, then
56 starts a sandbox you own.
57 </p>
58 <p className="mt-2.5 inline-flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.05em] text-[var(--composio-brand)]">
59 helper + env <Arrow /> sandbox
60 </p>
61 </div>
62 </div>
63 <Connector />
64 </Column>
65
66 {/* ── Sandbox (yours) ────────────────────────────────────── */}
67 <Column>
68 <Lane label="Sandbox · yours" />
69 <div className="flex flex-1 items-center">
70 <div className="w-full border border-fd-border bg-fd-card p-3">
71 <div className="flex items-center gap-2">
72 <span className="flex size-7 items-center justify-center rounded-sm bg-fd-foreground/[0.06] text-fd-foreground/70">
73 <Boxes aria-hidden="true" className="size-4" />
74 </span>
75 <div className="min-w-0">
76 <div className="truncate text-[12px] font-medium leading-tight text-fd-foreground">
77 Reviewer agent
78 </div>
79 <div className="truncate font-mono text-[10px] text-fd-foreground/45">
80 your filesystem + shell
81 </div>
82 </div>
83 </div>
84 <p className="mt-2.5 text-[11px] leading-snug text-fd-foreground/55">
85 Clones the PR, installs deps, runs the repo&apos;s real checks, all inside your boundary.
86 </p>
87 <p className="mt-2.5 inline-flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.05em] text-[var(--composio-brand)]">
88 run_composio_tool <Arrow /> Composio
89 </p>
90 </div>
91 </div>
92 <Connector accent />
93 </Column>
94
95 {/* ── Composio (the managed side) ────────────────────────── */}
96 <Column>
97 <Lane label="Composio" accent />
98 <div className="flex flex-1 flex-col">
99 <div className="relative flex-1 border border-[var(--composio-brand)]/30 bg-[var(--composio-brand)]/[0.04] p-3">
100 <span
101 aria-hidden="true"
102 className="pointer-events-none absolute inset-y-0 left-0 w-[2px] bg-[var(--composio-brand)]"
103 />
104 <div className="flex items-center justify-between">
105 <span className="inline-flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.06em] text-[var(--composio-brand)]">
106 <Wrench aria-hidden="true" className="size-2.5" />
107 Session
108 </span>
109 <img
110 alt=""
111 aria-hidden="true"
112 className="size-4 rounded-sm object-contain"
113 draggable={false}
114 src={`${LOGO_CDN}/github`}
115 />
116 </div>
117
118 <p className="mt-2.5 text-[11px] leading-snug text-fd-foreground/60">
119 Resolves the right GitHub action, runs it under the user&apos;s connection, and returns the result
120 to the sandbox.
121 </p>
122
123 <ul className="mt-2.5 space-y-1 font-mono text-[10px] text-fd-foreground/55">
124 <li>· search + schema discovery</li>
125 <li>· managed GitHub auth</li>
126 <li>· tool execution + result</li>
127 </ul>
128 </div>
129 </div>
130 </Column>
131 </div>
132
133 {/* footer caption */}
134 <div className="border-t border-fd-border px-3 py-2 text-center font-mono text-[10px] text-fd-foreground/45">
135 host (session, execution off) <Arrow /> your sandbox (runs checks) <Arrow /> run_composio_tool{' '}
136 <Arrow /> Composio (resolve + execute) <Arrow /> grounded PR comment
137 </div>
138 </div>
139 );
140 }
141
142 function Column({ children }: { children: ReactNode }) {
143 return <div className="relative flex flex-col gap-2 bg-fd-background p-3">{children}</div>;
144 }
145
146 function Lane({ label, accent = false }: { label: string; accent?: boolean }) {
147 return (
148 <div className="flex items-center gap-1.5">
149 <span
150 className={'size-1.5 rounded-full ' + (accent ? 'bg-[var(--composio-brand)]' : 'bg-fd-foreground/30')}
151 aria-hidden="true"
152 />
153 <span
154 className={
155 'font-mono text-[10px] font-medium uppercase tracking-[0.07em] ' +
156 (accent ? 'text-[var(--composio-brand)]' : 'text-fd-foreground/55')
157 }
158 >
159 {label}
160 </span>
161 </div>
162 );
163 }
164
165 /**
166 * Directional connector shown between columns. Horizontal arrow on desktop,
167 * hidden on stacked mobile so the flow still reads top-to-bottom.
168 */
169 function Connector({ accent = false }: { accent?: boolean }) {
170 const color = accent ? 'bg-[var(--composio-brand)]/40' : 'bg-fd-border';
171 const tip = accent ? 'border-l-[var(--composio-brand)]/50' : 'border-l-fd-border';
172 return (
173 <div
174 aria-hidden="true"
175 className="pointer-events-none absolute z-10 hidden md:block"
176 style={{ right: '-7px', top: '50%' }}
177 >
178 <div className="flex items-center">
179 <span className={'h-px w-3 ' + color} />
180 <span className={'size-0 border-y-[3px] border-l-[5px] border-y-transparent ' + tip} />
181 </div>
182 </div>
183 );
184 }
185
186 function Arrow() {
187 return (
188 <span aria-hidden="true" className="text-[var(--composio-brand)]">
189 {'→'}
190 </span>
191 );
192 }