huskies: merge 563_story_build_agent_join_mechanism_agents_register_with_the_gateway_via_token

This commit is contained in:
dave
2026-04-14 12:02:17 +00:00
parent efe434ede3
commit d0d2b17484
6 changed files with 871 additions and 2 deletions
+18 -1
View File
@@ -2,11 +2,14 @@ import * as React from "react";
import type { OAuthStatus } from "./api/client";
import { api } from "./api/client";
import { Chat } from "./components/Chat";
import { GatewayPanel } from "./components/GatewayPanel";
import { SelectionScreen } from "./components/selection/SelectionScreen";
import { usePathCompletion } from "./components/selection/usePathCompletion";
import { gatewayApi } from "./api/gateway";
import "./App.css";
function App() {
const [isGateway, setIsGateway] = React.useState<boolean | null>(null);
const [projectPath, setProjectPath] = React.useState<string | null>(null);
const [_view, setView] = React.useState<"chat" | "token-usage">("chat");
const [isCheckingProject, setIsCheckingProject] = React.useState(true);
@@ -19,6 +22,14 @@ function App() {
null,
);
// Detect gateway mode on startup — if /gateway/mode returns 200, we're a gateway.
React.useEffect(() => {
gatewayApi
.getServerMode()
.then((result) => setIsGateway(result.mode === "gateway"))
.catch(() => setIsGateway(false));
}, []);
React.useEffect(() => {
let active = true;
function fetchOAuthStatus() {
@@ -188,10 +199,16 @@ function App() {
}
}
if (isCheckingProject) {
// Still probing server mode — wait before rendering.
if (isGateway === null || isCheckingProject) {
return null;
}
// Gateway mode: render the agent management UI instead of the normal chat.
if (isGateway) {
return <GatewayPanel />;
}
return (
<main
className="container"