diff --git a/.gitignore b/.gitignore index 72fe58c420..f085a1aab5 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ yarn-error.log* # local env files .env*.local +.env* # vercel .vercel @@ -40,7 +41,3 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts - -# local generated benchmark artifacts -site/messages.json -site/tasks.json diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100755 index 0000000000..573d6dacd2 --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +./site/scripts/check-missing-trajectory-id.ts diff --git a/jobs/2026-03-08__16-54-33/jj_abandon_wip_revisions_revsets__cg3D8X7/agent/pochi/trajectory-id.txt b/jobs/2026-03-08__16-54-33/jj_abandon_wip_revisions_revsets__cg3D8X7/agent/pochi/trajectory-id.txt new file mode 100644 index 0000000000..179dffe68b --- /dev/null +++ b/jobs/2026-03-08__16-54-33/jj_abandon_wip_revisions_revsets__cg3D8X7/agent/pochi/trajectory-id.txt @@ -0,0 +1 @@ +1avj7FtT diff --git a/jobs/2026-03-08__16-54-33/jj_amend_working_copy__EcZoXvo/agent/pochi/trajectory-id.txt b/jobs/2026-03-08__16-54-33/jj_amend_working_copy__EcZoXvo/agent/pochi/trajectory-id.txt new file mode 100644 index 0000000000..467b4c660b --- /dev/null +++ b/jobs/2026-03-08__16-54-33/jj_amend_working_copy__EcZoXvo/agent/pochi/trajectory-id.txt @@ -0,0 +1 @@ +ZpkJoMPs diff --git a/jobs/2026-03-08__16-54-33/jj_bookmark_create_and_move__mCVNvnG/agent/pochi/trajectory-id.txt b/jobs/2026-03-08__16-54-33/jj_bookmark_create_and_move__mCVNvnG/agent/pochi/trajectory-id.txt new file mode 100644 index 0000000000..9664915925 --- /dev/null +++ b/jobs/2026-03-08__16-54-33/jj_bookmark_create_and_move__mCVNvnG/agent/pochi/trajectory-id.txt @@ -0,0 +1 @@ +ljyVNHyr diff --git a/jobs/2026-03-11__16-18-23/jj_git_export_patch_series__sRj4MQy/agent/pochi/trajectory-id.txt b/jobs/2026-03-11__16-18-23/jj_git_export_patch_series__sRj4MQy/agent/pochi/trajectory-id.txt new file mode 100644 index 0000000000..43e8a735aa --- /dev/null +++ b/jobs/2026-03-11__16-18-23/jj_git_export_patch_series__sRj4MQy/agent/pochi/trajectory-id.txt @@ -0,0 +1 @@ +GbY4G3Od diff --git a/jobs/2026-03-11__16-18-23/jj_template_changelog_and_releas__LzSiuCH/agent/pochi/trajectory-id.txt b/jobs/2026-03-11__16-18-23/jj_template_changelog_and_releas__LzSiuCH/agent/pochi/trajectory-id.txt new file mode 100644 index 0000000000..e877621d6c --- /dev/null +++ b/jobs/2026-03-11__16-18-23/jj_template_changelog_and_releas__LzSiuCH/agent/pochi/trajectory-id.txt @@ -0,0 +1 @@ +0vlY8QN5 diff --git a/jobs/2026-03-11__16-18-23/jj_template_ci_build_metadata__MBZLj8G/agent/pochi/trajectory-id.txt b/jobs/2026-03-11__16-18-23/jj_template_ci_build_metadata__MBZLj8G/agent/pochi/trajectory-id.txt new file mode 100644 index 0000000000..18c937e0da --- /dev/null +++ b/jobs/2026-03-11__16-18-23/jj_template_ci_build_metadata__MBZLj8G/agent/pochi/trajectory-id.txt @@ -0,0 +1 @@ +XrjDASVY diff --git a/jobs/2026-03-11__16-18-23/jj_template_patch_email_bundle__9Z6XUtH/agent/pochi/trajectory-id.txt b/jobs/2026-03-11__16-18-23/jj_template_patch_email_bundle__9Z6XUtH/agent/pochi/trajectory-id.txt new file mode 100644 index 0000000000..57d98938d9 --- /dev/null +++ b/jobs/2026-03-11__16-18-23/jj_template_patch_email_bundle__9Z6XUtH/agent/pochi/trajectory-id.txt @@ -0,0 +1 @@ +ZAyJoMPs diff --git a/site/app/tasks/[name]/[jobName]/trajectory/components/trajectory-page.tsx b/site/app/tasks/[name]/[jobName]/trajectory/components/trajectory-page.tsx index 8f73c89234..46a4c90a73 100644 --- a/site/app/tasks/[name]/[jobName]/trajectory/components/trajectory-page.tsx +++ b/site/app/tasks/[name]/[jobName]/trajectory/components/trajectory-page.tsx @@ -2,86 +2,25 @@ import { useEffect, useRef, useState } from "react"; import { Loader2 } from "lucide-react"; -import zealtConfig from "@/../zealt.json"; type TrajectoryPageProps = { - name: string; - jobName: string; + title: string; + trajectoryUrl: string | null; + fallbackUrl: string; }; -let messagesCachePromise: Promise> | null = null; - -async function loadMessages() { - if (!messagesCachePromise) { - messagesCachePromise = import("@/messages.json").then((module) => { - const data = module.default || module; - return data as Record; - }); - } - - return messagesCachePromise; -} - -function getServerBaseUrl() { - const isDev = process.env.NODE_ENV === "development"; - return isDev ? "http://localhost:4113" : "https://cc.getpochi.com"; -} - -export function TrajectoryPage({ name, jobName }: TrajectoryPageProps) { - const [error, setError] = useState(null); - const [redirectUrl, setRedirectUrl] = useState(null); +export function TrajectoryPage({ title, trajectoryUrl, fallbackUrl }: TrajectoryPageProps) { const [iframeLoading, setIframeLoading] = useState(false); - const [showIframe, setShowIframe] = useState(false); - const fallbackUrlRef = useRef(""); const iframeRef = useRef(null); useEffect(() => { - if (!name || !jobName) { - setError("Missing name or jobName parameters."); + if (!trajectoryUrl) { + window.location.replace(fallbackUrl); return; } - const fallback = `${zealtConfig.github_repo}/blob/main/jobs/${jobName}/${name}/result.json`; - fallbackUrlRef.current = fallback; - - const processRedirect = async () => { - try { - const messagesData = await loadMessages(); - const trialMessages = messagesData[name]; - - if (trialMessages) { - const baseUrl = getServerBaseUrl(); - const response = await fetch(`${baseUrl}/api/clips`, { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ data: { messages: trialMessages } }), - }); - - if (!response.ok) { - throw new Error(`Failed to post clip: ${response.statusText}`); - } - - const { id } = await response.json(); - if (id) { - const url = new URL(`/e/${id}`, baseUrl); - url.searchParams.set("embed", "true"); - url.searchParams.set("title", name); - url.searchParams.set("theme", "dark") - setRedirectUrl(url.toString()); - setIframeLoading(true); - setShowIframe(true); - return; - } - } - - window.location.replace(fallback); - } catch (_err) { - window.location.replace(fallback); - } - }; - - processRedirect(); - }, [name, jobName]); + setIframeLoading(true); + }, [trajectoryUrl, fallbackUrl]); const handleIframeLoad = () => { setIframeLoading(false); @@ -93,18 +32,10 @@ export function TrajectoryPage({ name, jobName }: TrajectoryPageProps) { }; const handleIframeError = () => { - window.location.replace(fallbackUrlRef.current); - }; - - if (error) { - return ( -
-
{error}
-
- ); + window.location.replace(fallbackUrl); } - if (redirectUrl) { + if (trajectoryUrl) { return (
{iframeLoading && ( @@ -117,16 +48,14 @@ export function TrajectoryPage({ name, jobName }: TrajectoryPageProps) {
)} - {showIframe && ( -