From 3dfeb509634ea34b141b47eeb98d63ef499cf717 Mon Sep 17 00:00:00 2001 From: Vishal Anton Date: Mon, 16 Nov 2026 18:22:45 +0530 Subject: [PATCH 1/3] Refresh Bell workspace UI Build the phone conversation and browser workspace with ui-sdk and Tailwind. Support AI Gateway credentials alongside direct OpenAI access. --- .env.example | 2 + README.md | 2 +- agent/agent.ts | 9 +- app/chat.tsx | 211 ------ app/globals.css | 100 +++ app/layout.tsx | 5 +- app/page.tsx | 8 +- app/s/[sessionId]/page.tsx | 13 +- app/style.css | 187 ----- components/bell-workspace.tsx | 65 ++ components/phone/approval-request.tsx | 97 +++ components/phone/message-composer.tsx | 68 ++ components/phone/message-thread.tsx | 113 +++ components/phone/phone-clock.tsx | 29 + components/phone/phone-shell.tsx | 50 ++ components/phone/phone.css | 277 +++++++ components/ui/bell-mark.tsx | 19 + components/ui/icon.tsx | 40 + components/workspace/browser-preview.tsx | 94 +++ components/workspace/workspace-header.tsx | 33 + hooks/use-bell-conversation.ts | 112 +++ package.json | 4 + pnpm-lock.yaml | 867 +++++++++++++--------- postcss.config.mjs | 7 + public/bell.png | Bin 0 -> 2208 bytes 25 files changed, 1674 insertions(+), 738 deletions(-) delete mode 100644 app/chat.tsx create mode 100644 app/globals.css delete mode 100644 app/style.css create mode 100644 components/bell-workspace.tsx create mode 100644 components/phone/approval-request.tsx create mode 100644 components/phone/message-composer.tsx create mode 100644 components/phone/message-thread.tsx create mode 100644 components/phone/phone-clock.tsx create mode 100644 components/phone/phone-shell.tsx create mode 100644 components/phone/phone.css create mode 100644 components/ui/bell-mark.tsx create mode 100644 components/ui/icon.tsx create mode 100644 components/workspace/browser-preview.tsx create mode 100644 components/workspace/workspace-header.tsx create mode 100644 hooks/use-bell-conversation.ts create mode 100644 postcss.config.mjs create mode 100644 public/bell.png diff --git a/.env.example b/.env.example index cf777a8..0241b1e 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,7 @@ # Server-only credentials. Never commit .env. OPENAI_API_KEY= +# Optional alternative to direct OpenAI access. Takes precedence when set. +AI_GATEWAY_API_KEY= # Optional public-web search and extraction. PARALLEL_API_KEY= BROWSERBASE_API_KEY= diff --git a/README.md b/README.md index a2da433..0742af6 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ pnpm install --frozen-lockfile cp .env.example .env ``` -Set `OPENAI_API_KEY` and `BROWSERBASE_API_KEY` in `.env`. For ordinary browsing, set `BELL_DEMO_URL` to your target website. +Set `OPENAI_API_KEY` or `AI_GATEWAY_API_KEY`, plus `BROWSERBASE_API_KEY`, in `.env`. When a Gateway key is set, `BELL_MODEL` routes through AI Gateway. For ordinary browsing, set `BELL_DEMO_URL` to your target website. Set `PARALLEL_API_KEY` to enable public-web research. Keep research inputs public; use the browser for authenticated pages and actions. ```sh diff --git a/agent/agent.ts b/agent/agent.ts index 05bd7cc..050eb22 100644 --- a/agent/agent.ts +++ b/agent/agent.ts @@ -1,8 +1,15 @@ import { openai } from "@ai-sdk/openai"; import { defineAgent } from "eve"; +const model = process.env.BELL_MODEL ?? "gpt-6.1-sol"; +const apiGatewayKey = process.env.AI_GATEWAY_API_KEY?.trim(); + export default defineAgent({ - model: openai.responses(process.env.BELL_MODEL ?? "gpt-5.6-sol"), + model: apiGatewayKey + ? model.includes("/") + ? model + : `openai/${model}` + : openai.responses(model), build: { externalDependencies: [ "@1password/sdk", diff --git a/app/chat.tsx b/app/chat.tsx deleted file mode 100644 index 9f1869e..0000000 --- a/app/chat.tsx +++ /dev/null @@ -1,211 +0,0 @@ -"use client"; -import Image from "next/image"; -import { useRouter } from "next/navigation"; -import { useEveAgent } from "eve/react"; -import { Client } from "eve/client"; -import { useState } from "react"; -import { browserPreview } from "./projection"; - -export default function Chat({ sessionId, demoUrl }: { sessionId?: string; demoUrl: string }) { - const router = useRouter(); - const [input, setInput] = useState(""); - const [error, setError] = useState(""); - const [retiring, setRetiring] = useState(false); - const agent = useEveAgent({ - initialSession: sessionId ? { sessionId, streamIndex: 0 } : undefined, - resume: Boolean(sessionId), - onSessionChange(session) { - if (session && !sessionId) - window.history.replaceState(null, "", `/s/${encodeURIComponent(session.sessionId)}`); - }, - }); - const busy = agent.status === "submitted" || agent.status === "streaming"; - const waiting = busy || agent.status === "resuming" || retiring; - const preview = browserPreview(agent.events); - const pending = agent.data.messages - .flatMap((message) => message.parts) - .flatMap((part) => { - if (part.type !== "dynamic-tool" || part.state !== "approval-requested") return []; - const request = part.toolMetadata?.eve?.inputRequest; - return request ? [request] : []; - }); - async function send(text: string) { - if (!text.trim() || waiting) return; - setError(""); - setInput(""); - try { - await agent.send(text.trim()); - } catch { - setError("The request failed. Check the local server and retry."); - } - } - async function newConversation() { - if (waiting) return; - setRetiring(true); - setError(""); - try { - if (agent.session) - await new Client({ host: "" }).sessions.attach(agent.session.sessionId).reset(); - agent.reset(); - setInput(""); - router.push("/"); - } catch { - setError("Could not close this conversation. Please retry."); - } finally { - setRetiring(false); - } - } - return ( -
-
-
-

PERSONAL ASSISTANT STACK

-

- Bell. -

-
- -
-
-
-

Ask. Browse. Verify.

-

One conversation, one persistent browser.

- -
- {agent.data.messages - .filter((message) => message.role === "user" || message.role === "assistant") - .map((message) => ( -
- {message.role === "user" ? "You" : "Bell"} - {message.parts.map((part, index) => - part.type === "text" ?

{part.text}

: null, - )} -
- ))} -
-

- {waiting ? "Working…" : "Ready"} -

- {(error || agent.error) && ( -

- {error || "The agent request failed. Check server configuration and retry."} -

- )} - {pending.map((request) => ( -
- {request.prompt} - {request.options?.map((option) => ( - - ))} - {request.allowFreeform && ( -
{ - event.preventDefault(); - const text = String( - new FormData(event.currentTarget).get("reply") ?? "", - ).trim(); - if (text) - void agent - .respond([{ requestId: request.requestId, text }]) - .catch(() => setError("Reply failed. Please retry.")); - }} - > - - - -
- )} -
- ))} -
{ - event.preventDefault(); - void send(input); - }} - > - -