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
1,256 changes: 1,256 additions & 0 deletions app/client/AgentReachView.tsx

Large diffs are not rendered by default.

32 changes: 19 additions & 13 deletions app/client/mount.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import { createRoot, hydrateRoot, type Root } from "react-dom/client";
import App, { parseOverviewAppPayload } from "./App.tsx";
import React from "react";
import { createRoot, hydrateRoot, type Root } from "react-dom/client";
import AgentReachView, { parseAgentReachViewPayload } from "./AgentReachView.tsx";
import App, { parseOverviewAppPayload } from "./App.tsx";
import ObserverView, { parseObserverViewPayload } from "./ObserverView.tsx";
import RunHealthView, { parseRunHealthViewPayload } from "./RunHealth.tsx";
import WeeklyView, { parseWeeklyViewPayload } from "./WeeklyView.tsx";
Expand All @@ -18,11 +19,12 @@ type ClientPayloadConfig = {

declare global {
interface Window {
__mountVisualConsoleApps?: () => void;
__visualConsoleMountedRoots?: {
overview?: MountedRoot;
observer?: MountedRoot;
runHealth?: MountedRoot;
__mountVisualConsoleApps?: () => void;
__visualConsoleMountedRoots?: {
overview?: MountedRoot;
agentreach?: MountedRoot;
observer?: MountedRoot;
runHealth?: MountedRoot;
weekly?: MountedRoot;
};
}
Expand Down Expand Up @@ -60,8 +62,8 @@ async function ensureClientPayload(container: Element, payloadConfig: ClientPayl
}
}

function mountIntoRoot(
key: "overview" | "observer" | "runHealth" | "weekly",
function mountIntoRoot(
key: "overview" | "agentreach" | "observer" | "runHealth" | "weekly",
containerId: string,
elementFactory: () => React.ReactElement,
payloadConfig?: ClientPayloadConfig,
Expand Down Expand Up @@ -109,9 +111,13 @@ function mountIntoRoot(
}
}

export function mountVisualConsoleApps(): void {
mountIntoRoot("overview", "overview-react-root", () => <App {...parseOverviewAppPayload()} />);
mountIntoRoot("observer", "observer-react-root", () => <ObserverView {...parseObserverViewPayload()} />, {
export function mountVisualConsoleApps(): void {
mountIntoRoot("overview", "overview-react-root", () => <App {...parseOverviewAppPayload()} />);
mountIntoRoot("agentreach", "agentreach-react-root", () => <AgentReachView {...parseAgentReachViewPayload()} />, {
scriptId: "agentreach-react-payload",
windowKey: "__AGENTREACH_INITIAL_DATA__",
});
mountIntoRoot("observer", "observer-react-root", () => <ObserverView {...parseObserverViewPayload()} />, {
scriptId: "observer-react-payload",
windowKey: "__OBSERVER_INITIAL_DATA__",
});
Expand Down
34 changes: 21 additions & 13 deletions app/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import { FUZZY_SEARCH_RESPONSE_SCHEMA_VERSION } from "../src/search/fuzzyQueryTy
import { buildProjectsView } from "../src/visualConsole/build.ts";
import { renderDocument } from "./visualConsole/ossDocument.ts";
import { buildProjectsLocalDetailPayload } from "./visualConsole/ossProjectsPage.ts";
import {
buildObserverReactProps,
import {
buildAgentReachReactProps,
buildObserverReactProps,
buildOverviewReactProps,
buildRunHealthReactProps,
buildWeeklyReactProps,
Expand All @@ -28,6 +29,7 @@ const APP_DIR = path.dirname(fileURLToPath(import.meta.url));
const CLIENT_DIR = path.join(APP_DIR, "client");
const APP_ASSET_DIR = path.join(APP_DIR, "assets");
const STYLE_PATH = path.join(APP_DIR, "styles.css");
const AGENTREACH_STYLE_PATH = path.join(APP_DIR, "styles", "agentreach.css");
const STYLE_CACHE_CONTROL = "public, max-age=300";
const APP_ASSET_ROUTE_PREFIX = "/app-assets/";
const CLIENT_ROUTE_PREFIX = "/app-client/";
Expand All @@ -53,9 +55,11 @@ const defaultServerOptions: Required<VisualConsoleServerOptions> = {
const cachedClientModules = new Map<string, CachedClientModule>();
const fuzzySearchCache: FuzzySearchCache = new Map();

function renderStyleAsset(): string {
return fs.readFileSync(STYLE_PATH, "utf-8");
}
function renderStyleAsset(): string {
return [STYLE_PATH, AGENTREACH_STYLE_PATH]
.map((stylePath) => fs.readFileSync(stylePath, "utf-8"))
.join("\n");
}

function serializeJsonForHtml(value: unknown): string {
return JSON.stringify(value)
Expand All @@ -66,9 +70,9 @@ function serializeJsonForHtml(value: unknown): string {
.replace(/\u2029/g, "\\u2029");
}

function routeRequiresClientReactRuntime(route: RenderedRoute["route"]): boolean {
return route === "overview" || route === "observer" || route === "weekly" || route === "run-health";
}
function routeRequiresClientReactRuntime(route: RenderedRoute["route"]): boolean {
return route === "overview" || route === "observer" || route === "agentreach" || route === "weekly" || route === "run-health";
}

function renderReactImportMap(): string {
return [
Expand Down Expand Up @@ -198,11 +202,15 @@ function resolveHydrationPayloadScripts(rendered: RenderedRoute, requestUrl: URL
id: "run-health-react-payload",
value: rendered.route === "run-health" ? buildRunHealthReactProps(rendered.model, lang) : null,
},
{
id: "observer-react-payload",
value: rendered.route === "observer" ? buildObserverReactProps(rendered.model, requestUrl, lang, theme) : null,
},
];
{
id: "observer-react-payload",
value: rendered.route === "observer" ? buildObserverReactProps(rendered.model, requestUrl, lang, theme) : null,
},
{
id: "agentreach-react-payload",
value: rendered.route === "agentreach" ? buildAgentReachReactProps(rendered.model, requestUrl, lang, theme) : null,
},
];

return payloads
.filter((entry) => entry.value !== null)
Expand Down
14 changes: 11 additions & 3 deletions app/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -4807,7 +4807,7 @@ body.theme-dark[data-route="kb"]::after {
justify-content: space-between;
gap: 28px;
position: relative;
width: min(100%, 1040px);
width: min(100%, 1240px);
max-width: calc(100vw - 32px);
min-height: 58px;
margin: 0 auto;
Expand Down Expand Up @@ -4868,7 +4868,7 @@ body.theme-dark[data-route="kb"]::after {
.homepage-nav-main {
display: flex;
align-items: center;
gap: 26px;
gap: 18px;
flex: 1 1 auto;
min-width: 0;
}
Expand Down Expand Up @@ -4943,9 +4943,16 @@ body.theme-dark[data-route="kb"]::after {
align-items: center;
justify-content: flex-start;
gap: 6px;
flex: 0 1 auto;
flex: 1 1 auto;
min-width: 0;
align-self: center;
overflow-x: auto;
overflow-y: hidden;
scrollbar-width: none;
}

.homepage-primary-nav::-webkit-scrollbar {
display: none;
}

.homepage-nav-tools {
Expand Down Expand Up @@ -5000,6 +5007,7 @@ body.theme-dark[data-route="kb"]::after {
line-height: 1;
color: var(--text-muted);
transform: none;
white-space: nowrap;
transition: color 0.3s ease, font-weight 0.2s ease, background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

Expand Down
Loading
Loading