@devries-cameron20 / composio Mirror · read-only
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 21, 03:37 UTC

next
tsx 222 lines 9.39 KB
Raw
1 import { Cpu, Globe, MessageSquare, Terminal } from 'lucide-react';
2 import type { ReactNode } from 'react';
3
4 const LOGO_CDN = 'https://logos.composio.dev/api';
5
6 const TOOLS: { slug: string; name: string; where: string; local?: boolean }[] = [
7 { slug: 'imessage', name: 'iMessage', where: 'on your Mac', local: true },
8 { slug: 'gmail', name: 'Gmail', where: 'catalog' },
9 { slug: 'github', name: 'GitHub', where: 'catalog' },
10 ];
11
12 /**
13 * ImessageFlow — branded diagram for the iMessage example page.
14 *
15 * Reads left-to-right as one request: you type a prompt (or a trigger fires),
16 * the eve agent picks a tool and runs it through a single session, and that
17 * session carries both the local iMessage toolkit (running on your Mac) and the
18 * rest of the Composio catalog (running remote). The reply ends in a text.
19 *
20 * Server component, no client JS. Adapts to light/dark via fd-* tokens.
21 */
22 export function ImessageFlow() {
23 return (
24 <div className="not-prose my-6 overflow-hidden rounded-sm border border-fd-border bg-fd-background">
25 {/* header strip — mono, matches the other branded flow visuals */}
26 <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">
27 <span>imessage.runtime</span>
28 <span className="inline-flex items-center gap-1.5 text-fd-foreground/55">
29 <span className="relative inline-flex">
30 <span className="size-1.5 rounded-full bg-[var(--composio-brand)]" />
31 <span className="absolute inset-0 animate-ping rounded-full bg-[var(--composio-brand)] opacity-60" />
32 </span>
33 running on your Mac
34 </span>
35 </div>
36
37 <div className="grid items-stretch gap-px bg-fd-border md:grid-cols-[minmax(0,0.9fr)_minmax(0,0.95fr)_minmax(0,1.3fr)]">
38 {/* ── You ────────────────────────────────────────────────── */}
39 <Column>
40 <Lane label="You" />
41 <div className="flex flex-1 items-center">
42 <div className="w-full border border-fd-border bg-fd-card p-3">
43 <div className="flex items-center gap-2">
44 <span className="flex size-7 items-center justify-center rounded-sm bg-fd-foreground/[0.06] text-fd-foreground/70">
45 <Terminal aria-hidden="true" className="size-3.5" />
46 </span>
47 <div className="min-w-0">
48 <div className="truncate text-[12px] font-medium leading-tight text-fd-foreground">
49 Prompt or trigger
50 </div>
51 <div className="truncate font-mono text-[10px] text-fd-foreground/45">
52 text Shams a summary
53 </div>
54 </div>
55 </div>
56 <p className="mt-2.5 inline-flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.05em] text-[var(--composio-brand)]">
57 you <Arrow /> eve
58 </p>
59 </div>
60 </div>
61 <Connector />
62 </Column>
63
64 {/* ── eve agent ──────────────────────────────────────────── */}
65 <Column>
66 <Lane label="eve agent" />
67 <div className="flex flex-1 items-center">
68 <div className="w-full border border-fd-border bg-fd-card p-3">
69 <div className="flex items-center gap-2">
70 <span className="flex size-7 items-center justify-center rounded-sm bg-fd-foreground/[0.06] font-mono text-[13px] text-fd-foreground/70">
71 {'{ }'}
72 </span>
73 <div className="min-w-0">
74 <div className="truncate text-[12px] font-medium leading-tight text-fd-foreground">
75 eve agent
76 </div>
77 <div className="truncate font-mono text-[10px] text-fd-foreground/45">
78 searches + executes
79 </div>
80 </div>
81 </div>
82 <p className="mt-2.5 text-[11px] leading-snug text-fd-foreground/55">
83 Picks the tool it needs and runs it through the session.
84 </p>
85 </div>
86 </div>
87 <Connector accent />
88 </Column>
89
90 {/* ── Session (the hub) ──────────────────────────────────── */}
91 <Column>
92 <Lane label="Session" accent />
93 <div className="flex flex-1 flex-col">
94 <div className="relative flex-1 border border-[var(--composio-brand)]/30 bg-[var(--composio-brand)]/[0.04] p-3">
95 <span
96 aria-hidden="true"
97 className="pointer-events-none absolute inset-y-0 left-0 w-[2px] bg-[var(--composio-brand)]"
98 />
99 <div className="flex items-center justify-between">
100 <span className="font-mono text-[10px] uppercase tracking-[0.06em] text-[var(--composio-brand)]">
101 one session
102 </span>
103 <span className="font-mono text-[10px] text-fd-foreground/45">user_123</span>
104 </div>
105
106 {/* The local iMessage toolkit alongside the remote catalog */}
107 <ul className="mt-2.5 overflow-hidden rounded-sm border border-fd-border bg-fd-card">
108 {TOOLS.map((tool, i) => (
109 <li
110 key={tool.slug}
111 className={
112 'flex items-center gap-2 px-2.5 py-1.5' +
113 (i < TOOLS.length - 1 ? ' border-b border-fd-border' : '')
114 }
115 >
116 {tool.local ? (
117 <MessageSquare
118 aria-hidden="true"
119 className="size-3.5 text-[var(--composio-brand)]"
120 />
121 ) : (
122 <img
123 alt=""
124 aria-hidden="true"
125 className="size-3.5 object-contain"
126 draggable={false}
127 src={`${LOGO_CDN}/${tool.slug}`}
128 />
129 )}
130 <span className="text-[11px] text-fd-foreground/75">{tool.name}</span>
131 <span className="font-mono text-[9px] text-fd-foreground/40">{tool.where}</span>
132 <span
133 className={
134 'ml-auto inline-flex items-center gap-1 font-mono text-[9px] uppercase tracking-[0.05em] ' +
135 (tool.local ? 'text-[var(--composio-brand)]' : 'text-fd-foreground/45')
136 }
137 >
138 {tool.local ? (
139 <>
140 <Cpu aria-hidden="true" className="size-2.5" />
141 local
142 </>
143 ) : (
144 <>
145 <Globe aria-hidden="true" className="size-2.5" />
146 remote
147 </>
148 )}
149 </span>
150 </li>
151 ))}
152 </ul>
153
154 <p className="mt-2.5 text-[11px] leading-snug text-fd-foreground/60">
155 Local tools run in-process on your Mac; the rest of the catalog runs
156 remote, all from one session.
157 </p>
158 </div>
159 </div>
160 </Column>
161 </div>
162
163 {/* footer caption */}
164 <div className="border-t border-fd-border px-3 py-2 text-center font-mono text-[10px] text-fd-foreground/45">
165 prompt <Arrow /> eve <Arrow /> session (local mac tools + remote catalog){' '}
166 <Arrow /> text sent
167 </div>
168 </div>
169 );
170 }
171
172 function Column({ children }: { children: ReactNode }) {
173 return <div className="relative flex flex-col gap-2 bg-fd-background p-3">{children}</div>;
174 }
175
176 function Lane({ label, accent = false }: { label: string; accent?: boolean }) {
177 return (
178 <div className="flex items-center gap-1.5">
179 <span
180 className={'size-1.5 rounded-full ' + (accent ? 'bg-[var(--composio-brand)]' : 'bg-fd-foreground/30')}
181 aria-hidden="true"
182 />
183 <span
184 className={
185 'font-mono text-[10px] font-medium uppercase tracking-[0.07em] ' +
186 (accent ? 'text-[var(--composio-brand)]' : 'text-fd-foreground/55')
187 }
188 >
189 {label}
190 </span>
191 </div>
192 );
193 }
194
195 /**
196 * Desktop-only directional connector shown between columns. On mobile, the
197 * stacked columns read top-to-bottom without a connector.
198 */
199 function Connector({ accent = false }: { accent?: boolean }) {
200 const color = accent ? 'bg-[var(--composio-brand)]/40' : 'bg-fd-border';
201 const tip = accent ? 'border-l-[var(--composio-brand)]/50' : 'border-l-fd-border';
202 return (
203 <div
204 aria-hidden="true"
205 className="pointer-events-none absolute z-10 hidden md:block"
206 style={{ right: '-7px', top: '50%' }}
207 >
208 <div className="flex items-center">
209 <span className={'h-px w-3 ' + color} />
210 <span className={'size-0 border-y-[3px] border-l-[5px] border-y-transparent ' + tip} />
211 </div>
212 </div>
213 );
214 }
215
216 function Arrow() {
217 return (
218 <span aria-hidden="true" className="text-[var(--composio-brand)]">
219 {'→'}
220 </span>
221 );
222 }