Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions apps/web/app/(nova-app)/nova-app-internal/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { requireAuth } from "@/modules/components/utils/auth-utils"
import { NovaApp } from "@/modules/nova-web/nova-app"
import { listAgentSessions } from "@/modules/nova/sessions/service"

export const dynamic = "force-dynamic"

export default async function NovaHomePage() {
const session = await requireAuth()
const sessions = await listAgentSessions(session.user.id)

return (
<NovaApp
initialSessions={sessions}
initialView="home"
user={{
id: session.user.id,
name: session.user.name,
email: session.user.email,
image: session.user.image,
}}
/>
)
}
24 changes: 3 additions & 21 deletions apps/web/app/(nova-app)/nova-app-internal/page.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
import { requireAuth } from "@/modules/components/utils/auth-utils"
import { NovaApp } from "@/modules/nova-web/nova-app"
import { listAgentSessions } from "@/modules/nova/sessions/service"
import { NovaEntry } from "@/modules/nova-web/nova-entry"

export const dynamic = "force-dynamic"

export default async function NovaHomePage() {
const session = await requireAuth()
const sessions = await listAgentSessions(session.user.id)

return (
<NovaApp
initialSessions={sessions}
initialView="home"
user={{
id: session.user.id,
name: session.user.name,
email: session.user.email,
image: session.user.image,
}}
/>
)
export default function NovaEntryPage() {
return <NovaEntry />
}
11 changes: 8 additions & 3 deletions apps/web/modules/nova-web/components/ascii-background.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
"use client"

import { memo, useEffect, useRef, useState } from "react"
import { memo, useEffect, useRef, useState, useSyncExternalStore } from "react"
import { motion, useReducedMotion } from "framer-motion"
import { Pause, Play } from "lucide-react"

const GLYPHS = " .,:;~+=*#"
const FRAME_MS = 1000 / 30

const subscribeToHydration = () => () => {}
const clientSnapshot = () => true
const serverSnapshot = () => false

export const AsciiBackground = memo(function AsciiBackground({ color = "#a3aaa7" }: { color?: string }) {
const canvasRef = useRef<HTMLCanvasElement>(null)
const elapsedRef = useRef(0)
const reducedMotion = useReducedMotion()
const hydrated = useSyncExternalStore(subscribeToHydration, clientSnapshot, serverSnapshot)
const [paused, setPaused] = useState(false)

useEffect(() => {
Expand Down Expand Up @@ -119,11 +124,11 @@ export const AsciiBackground = memo(function AsciiBackground({ color = "#a3aaa7"
className="pointer-events-none absolute inset-0 overflow-hidden select-none"
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ duration: reducedMotion ? 0 : 1.4 }}
transition={{ duration: hydrated && reducedMotion ? 0 : 1.4 }}
>
<canvas ref={canvasRef} className="block h-full w-full" />
</motion.div>
{reducedMotion === false ? (
{hydrated && reducedMotion === false ? (
<button
type="button"
onClick={() => setPaused((value) => !value)}
Expand Down
32 changes: 32 additions & 0 deletions apps/web/modules/nova-web/nova-entry.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { describe, expect, test } from "bun:test"
import { NextRequest } from "next/server"
import { proxy } from "../../proxy"
import { metadata } from "../../app/(nova-app)/layout"

function route(path: string, host = "nova.supercodeai.tech") {
return proxy(new NextRequest(`https://${host}${path}`, { headers: { host } }))
}

describe("Nova link previews", () => {
test("rewrites public root separately from the authenticated app", () => {
expect(route("/").headers.get("x-middleware-rewrite")).toBe("https://nova.supercodeai.tech/nova-app-internal")
expect(route("/app").headers.get("x-middleware-rewrite")).toBe("https://nova.supercodeai.tech/nova-app-internal/app")
expect(route("/?ref=share").headers.get("x-middleware-rewrite")).toBe("https://nova.supercodeai.tech/nova-app-internal?ref=share")
})

test("does not change main site or login routing", () => {
expect(route("/", "supercodeai.tech").headers.get("x-middleware-rewrite")).toBeNull()
expect(route("/login").headers.get("x-middleware-rewrite")).toBeNull()
})

test("uses the Nova domain and image for both social preview formats", () => {
expect(metadata.metadataBase?.href).toBe("https://nova.supercodeai.tech/")
expect(metadata.openGraph?.images).toEqual([{
url: "/Nova-OG-image.jpg",
width: 1200,
height: 630,
alt: "Nova — your Supercode engineering agent",
}])
expect(metadata.twitter?.images).toEqual(["/Nova-OG-image.jpg"])
})
})
26 changes: 26 additions & 0 deletions apps/web/modules/nova-web/nova-entry.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"use client"

import { useEffect } from "react"

import { NovaIcon } from "@/modules/nova-web/components/nova-icon"

export function NovaEntry() {
useEffect(() => {
window.location.replace(`/app${window.location.search}${window.location.hash}`)
}, [])
Comment on lines +8 to +10

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 New threads lose their project

The existing New thread, home, and settings-back actions still navigate to /. They now mount NovaEntry, whose window.location.replace reloads the browser at /app and clears the selected project held in memoryState and virtualProject.

The fresh home does not restore that project, so the next normal prompt creates a session with localProjectId: null. Previously, client navigation kept the project in memory. Point in-app home actions at /app so they skip the public entry redirect.


return (
<main className="flex min-h-svh items-center justify-center bg-[#0c0c0c] text-[#e8e8e8]">
<a
href="/app"
aria-label="Open Nova"
className="rounded-2xl focus-visible:outline-2 focus-visible:outline-offset-8 focus-visible:outline-white"
>
<span className="block motion-safe:animate-pulse">
<NovaIcon size="lg" className="size-16" alt="" />
</span>
<span role="status" className="sr-only">Loading Nova…</span>
</a>
</main>
)
}
4 changes: 3 additions & 1 deletion apps/web/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ export function proxy(request: NextRequest) {
}

const url = request.nextUrl.clone()
if (path === "/" || path === "/app") {
if (path === "/") {
url.pathname = NOVA_INTERNAL_PATH
} else if (path === "/app") {
url.pathname = `${NOVA_INTERNAL_PATH}/app`
} else if (path.startsWith(NOVA_INTERNAL_PATH)) {
return NextResponse.next()
} else {
Expand Down
Loading