caelum0x 994f2d1a31 feat(relay): drop upstream marketing, Relay UI naming, pinned docs links, Autopilot off
README rewritten with engine features, not-available list and Apache-2.0
attribution (forked from TensorZero 2026.6.0). UI status indicator, logger
prefix and warnings renamed to Relay (RELAY_UI_LOG_LEVEL with legacy alias).
Help links resolve via docs-url.ts to pinned engine docs (VITE_RELAY_DOCS_URL
override); fixed SFT link. /autopilot always shows the unavailable page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 00:23:22 +03:00

45 lines
1.4 KiB
TypeScript

import {
data,
isRouteErrorResponse,
Outlet,
type RouteHandle,
} from "react-router";
import type { Route } from "./+types/layout";
import { AutopilotUnavailableState } from "~/components/ui/error/AutopilotUnavailableState";
import { LayoutErrorBoundary } from "~/components/ui/error";
import { isAutopilotUnavailableError } from "~/utils/tensorzero/errors";
export const handle: RouteHandle = {
crumb: () => [{ label: "Autopilot", noLink: true }],
};
const AUTOPILOT_UNAVAILABLE_ERROR = "Autopilot Unavailable";
// Autopilot needs TensorZero's hosted Autopilot service, which Relay does not
// offer. Every Autopilot route answers with the "not available" state, even if
// a gateway still carries an upstream Autopilot key.
// eslint-disable-next-line @typescript-eslint/require-await
export async function loader() {
throw data({ errorType: AUTOPILOT_UNAVAILABLE_ERROR }, { status: 501 });
}
export default function AutopilotLayout() {
return <Outlet />;
}
export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
// Autopilot unavailable gets special treatment
if (
isRouteErrorResponse(error) &&
error.data?.errorType === AUTOPILOT_UNAVAILABLE_ERROR
) {
return <AutopilotUnavailableState />;
}
if (isAutopilotUnavailableError(error)) {
return <AutopilotUnavailableState />;
}
// All other errors (including infra) handled by LayoutErrorBoundary
return <LayoutErrorBoundary error={error} />;
}