-
Notifications
You must be signed in to change notification settings - Fork 69
Feat/prototype agents; feature flagged #432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
181cf3f
Add prototype agents launcher
matthewlouisbrockman 1746cfa
Make terminal launch command editable
matthewlouisbrockman c3f4da6
Clean up agent naming
matthewlouisbrockman 96116bb
Merge remote-tracking branch 'origin/main' into feat/prototype-agents
matthewlouisbrockman 164b1ba
Remove alternate agent names
matthewlouisbrockman 1720fce
Stabilize sandbox terminal launch target
matthewlouisbrockman b3d28e0
Add agents page layout config
matthewlouisbrockman 8e469c1
refactor: migrate feature flags to LaunchDarkly
ben-fornefeld 0e26b79
chore: remove PostHog build vars from app env schema
ben-fornefeld 49437d5
chore: keep PostHog build vars in env schema
ben-fornefeld f9197d8
fix: cache failed LaunchDarkly initialization
ben-fornefeld 6ae9ccd
Merge remote-tracking branch 'origin/pr-434' into feat/prototype-agents
matthewlouisbrockman dcf6d2d
Gate agents page behind feature flag
matthewlouisbrockman b284782
Use underscored agents feature flag key
matthewlouisbrockman 1c387c8
Merge main into prototype agents
matthewlouisbrockman a8a81dd
Disable prefetch for agent start links
matthewlouisbrockman af1f19f
Merge remote-tracking branch 'origin/main' into feat/prototype-agents
matthewlouisbrockman 88533f0
Merge remote-tracking branch 'origin/main' into feat/prototype-agents
matthewlouisbrockman 225fd43
Use sandbox template identity for terminal launch
matthewlouisbrockman 119c72d
Use sandbox template for terminal sandbox links
matthewlouisbrockman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| import type { Metadata } from 'next' | ||
| import { notFound, redirect } from 'next/navigation' | ||
| import { AUTH_URLS } from '@/configs/urls' | ||
| import { featureFlags } from '@/core/modules/feature-flags/feature-flags.server' | ||
| import { getAuthContext } from '@/core/server/auth' | ||
| import { getTeamIdFromSlug } from '@/core/server/functions/team/get-team-id-from-slug' | ||
| import { AgentsList } from '@/features/dashboard/agents/agents-list' | ||
| import { AGENT_TEMPLATES } from '@/features/dashboard/agents/config' | ||
| import { Page } from '@/features/dashboard/layouts/page' | ||
|
|
||
| export const metadata: Metadata = { | ||
| title: 'Agents - E2B', | ||
| } | ||
|
|
||
| type AgentsPageProps = { | ||
| params: Promise<{ | ||
| teamSlug: string | ||
| }> | ||
| } | ||
|
|
||
| export default async function AgentsPage({ params }: AgentsPageProps) { | ||
| const [{ teamSlug }, authContext] = await Promise.all([ | ||
| params, | ||
| getAuthContext(), | ||
| ]) | ||
|
|
||
| if (!authContext) { | ||
| redirect(AUTH_URLS.SIGN_IN) | ||
| } | ||
|
|
||
| const teamId = await getTeamIdFromSlug(teamSlug, authContext.accessToken) | ||
|
|
||
| if (!teamId.ok || !teamId.data) { | ||
| notFound() | ||
| } | ||
|
|
||
| const agentsEnabled = await featureFlags.isEnabled('agentsEnabled', { | ||
| user: { | ||
| id: authContext.user.id, | ||
| email: authContext.user.email ?? undefined, | ||
| }, | ||
| team: { | ||
| id: teamId.data, | ||
| slug: teamSlug, | ||
| }, | ||
| }) | ||
|
|
||
| if (!agentsEnabled) { | ||
| notFound() | ||
| } | ||
|
|
||
| return ( | ||
| <Page className="flex flex-col gap-4"> | ||
| <div className="flex flex-col gap-1"> | ||
| <h2 className="prose-title text-fg">Agents</h2> | ||
| <p className="prose-body text-fg-tertiary max-w-2xl"> | ||
| Start a coding-agent sandbox and open it in the dashboard terminal. | ||
| </p> | ||
| </div> | ||
|
|
||
| <AgentsList agents={AGENT_TEMPLATES} /> | ||
| </Page> | ||
| ) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| 'use client' | ||
|
|
||
| import Link from 'next/link' | ||
| import type { ComponentType } from 'react' | ||
| import { SiClaude, SiOpenai } from 'react-icons/si' | ||
| import { cn } from '@/lib/utils' | ||
| import { Button } from '@/ui/primitives/button' | ||
| import { ExternalLinkIcon, UnpackIcon } from '@/ui/primitives/icons' | ||
| import type { AgentTemplateConfig } from './config' | ||
|
|
||
| const AGENT_ICONS = { | ||
| claude: SiClaude, | ||
| open: UnpackIcon, | ||
| openai: SiOpenai, | ||
| } satisfies Record< | ||
| AgentTemplateConfig['icon'], | ||
| ComponentType<{ className?: string }> | ||
| > | ||
|
|
||
| function getLaunchHref(agent: AgentTemplateConfig) { | ||
| const params = new URLSearchParams({ | ||
| command: agent.command, | ||
| template: agent.template, | ||
| }) | ||
|
|
||
| return `/sbx/new?${params.toString()}` | ||
| } | ||
|
|
||
| export function AgentsList({ | ||
| agents, | ||
| className, | ||
| }: { | ||
| agents: AgentTemplateConfig[] | ||
| className?: string | ||
| }) { | ||
| return ( | ||
| <div className={cn('grid gap-3 sm:grid-cols-2 xl:grid-cols-3', className)}> | ||
| {agents.map((agent) => ( | ||
| <AgentCard agent={agent} key={agent.id} /> | ||
| ))} | ||
| </div> | ||
| ) | ||
| } | ||
|
|
||
| function AgentCard({ agent }: { agent: AgentTemplateConfig }) { | ||
| const AgentIcon = AGENT_ICONS[agent.icon] | ||
|
|
||
| return ( | ||
| <section className="border-stroke bg-bg-1 flex min-h-44 flex-col rounded-lg border p-4"> | ||
| <div className="flex min-w-0 items-start gap-3"> | ||
| <div className="border-stroke bg-bg flex size-9 shrink-0 items-center justify-center rounded-md border"> | ||
| <AgentIcon className="size-4" /> | ||
| </div> | ||
| <div className="min-w-0"> | ||
| <h3 className="prose-body-highlight text-fg truncate"> | ||
| {agent.name} | ||
| </h3> | ||
| <p className="prose-body text-fg-tertiary mt-1 line-clamp-2"> | ||
| {agent.description} | ||
| </p> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className="prose-label text-fg-tertiary mt-auto pt-4 uppercase"> | ||
| {agent.template} | ||
| </div> | ||
|
|
||
| <Button asChild className="mt-3 w-full" variant="primary"> | ||
| <Link href={getLaunchHref(agent)} prefetch={false}> | ||
| Start | ||
| <ExternalLinkIcon /> | ||
| </Link> | ||
|
cursor[bot] marked this conversation as resolved.
|
||
| </Button> | ||
| </section> | ||
| ) | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.