From fe3eb44d6115efe36edb6a8dcc28dd02d1b8d4ed Mon Sep 17 00:00:00 2001 From: Kyle Jeong <77771518+Kylejeong2@users.noreply.github.com> Date: Sat, 4 Oct 2025 00:20:30 -0700 Subject: [PATCH 1/9] update urls, ts ignore fix (#8) --- app/api/session/route.ts | 2 +- app/components/NavBar.tsx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/api/session/route.ts b/app/api/session/route.ts index 41f11c6..0965b60 100644 --- a/app/api/session/route.ts +++ b/app/api/session/route.ts @@ -86,7 +86,7 @@ async function createSession(timezone?: string) { width: 2560, height: 1440, }, - // @ts-ignore + // @ts-expect-error - os is not a valid property os: "windows", blockAds: true, advancedStealth: true diff --git a/app/components/NavBar.tsx b/app/components/NavBar.tsx index 2e94247..a170cb8 100644 --- a/app/components/NavBar.tsx +++ b/app/components/NavBar.tsx @@ -31,7 +31,7 @@ export default function NavBar({ >
@@ -69,7 +69,7 @@ export default function NavBar({ {showGitHubButton && ( From 112981fe4cc7cffff0a2027a825a65217dc3fd8a Mon Sep 17 00:00:00 2001 From: Kyle Jeong <77771518+Kylejeong2@users.noreply.github.com> Date: Sat, 4 Oct 2025 18:29:46 -0700 Subject: [PATCH 2/9] feat: add query param parsing (#9) * update urls, ts ignore fix * added query param parsing to instatiate chatfeed with query params --- app/page.tsx | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index 5a0059c..32a7660 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -2,6 +2,7 @@ import { useState, useEffect, useCallback, useRef } from "react"; import { AnimatePresence, motion } from "framer-motion"; +import { useSearchParams } from "next/navigation"; import AnimatedButton from "./components/ui/AnimatedButton"; import posthog from "posthog-js"; import ChatFeed from "./components/ChatFeed"; @@ -47,10 +48,30 @@ const Tooltip = ({ }; export default function Home() { - const [isChatVisible, setIsChatVisible] = useState(false); - const [initialMessage, setInitialMessage] = useState(null); + const searchParams = useSearchParams(); + const rawChatParam = searchParams.get("chat"); + const chatParam = rawChatParam?.replace(/^["']|["']$/g, '') || null; + + const [isChatVisible, setIsChatVisible] = useState(() => !!chatParam); + const [initialMessage, setInitialMessage] = useState(() => chatParam); const inputRef = useRef(null); + const startChat = useCallback( + (finalMessage: string) => { + setInitialMessage(finalMessage); + setIsChatVisible(true); + + try { + posthog.capture("google_cua_submit_message", { + message: finalMessage, + }); + } catch (e) { + console.error(e); + } + }, + [] + ); + useEffect(() => { const handleKeyDown = (e: KeyboardEvent) => { // Handle CMD+Enter to submit the form when chat is not visible @@ -84,22 +105,6 @@ export default function Home() { return () => window.removeEventListener("keydown", handleKeyDown); }, [isChatVisible]); - const startChat = useCallback( - (finalMessage: string) => { - setInitialMessage(finalMessage); - setIsChatVisible(true); - - try { - posthog.capture("google_cua_submit_message", { - message: finalMessage, - }); - } catch (e) { - console.error(e); - } - }, - [setInitialMessage, setIsChatVisible] - ); - return ( {!isChatVisible ? ( From 2f906d3b1ddfde27ce4e28efa03e6a32487a4efc Mon Sep 17 00:00:00 2001 From: Kyle Jeong <77771518+Kylejeong2@users.noreply.github.com> Date: Sun, 5 Oct 2025 14:55:48 -0700 Subject: [PATCH 3/9] disable captcha solving if query params are passed in (#10) --- app/api/agent/stream/route.ts | 7 ++++++- app/components/BrowserSessionContainer.tsx | 4 +++- app/components/ChatFeed.tsx | 3 +++ app/hooks/useAgentStream.ts | 4 +++- app/page.tsx | 1 + app/types/Agent.ts | 1 + app/types/ChatFeed.ts | 1 + 7 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/api/agent/stream/route.ts b/app/api/agent/stream/route.ts index 22e2079..63a8080 100644 --- a/app/api/agent/stream/route.ts +++ b/app/api/agent/stream/route.ts @@ -18,7 +18,11 @@ function sseComment(comment: string): Uint8Array { export async function GET(request: Request) { const { searchParams } = new URL(request.url); - const [sessionId, goal] = [searchParams.get("sessionId"), searchParams.get("goal")]; + const [sessionId, goal, fromChat] = [ + searchParams.get("sessionId"), + searchParams.get("goal"), + searchParams.get("fromChat") === "true" + ]; if (!sessionId || !goal) { return new Response( @@ -118,6 +122,7 @@ export async function GET(request: Request) { width: 1288, height: 711, }, + solveCaptchas: !fromChat, // false if session is from a search param, true otherwise }, }, useAPI: false, diff --git a/app/components/BrowserSessionContainer.tsx b/app/components/BrowserSessionContainer.tsx index 072d2c7..68eaba2 100644 --- a/app/components/BrowserSessionContainer.tsx +++ b/app/components/BrowserSessionContainer.tsx @@ -11,6 +11,7 @@ interface BrowserSessionContainerProps { isCompleted: boolean; initialMessage: string | undefined; sessionTime?: number; + isFromSearchParam?: boolean; onStop?: () => void; onRestart?: () => void; } @@ -104,6 +105,7 @@ const BrowserSessionContainer: React.FC = ({ isCompleted, initialMessage, sessionTime = 0, + isFromSearchParam = false, onStop = () => {}, onRestart = () => {}, }) => { @@ -192,7 +194,7 @@ const BrowserSessionContainer: React.FC = ({ sessionUrl ? (