page-agent-console 1.1.0, by qingnian108 (#569). QA fixes B1-B21, a reworked UI, a new logo, and self-heal after a plugin host restart. In this version: - Accent: a fixed neutral grey (charcoal in light mode, light grey in dark mode). Magpie's accent tokens are dropped on purpose. Surfaces, text, lines, fonts and semantic colours still follow magpie. - Every native <select> (composer effort/mode/Cursor fast, Settings, Debug) is now the page's own SelectMenu, a button plus a listbox. - The registry summary again discloses the 127.0.0.1 service and its lifecycle, that only its own page gets the token, the ~46 MB first install, and that Claude Code isn't bundled (en, zh). - session.js is written once at bind with beat:false, and beats every 4s only after the first /open. A new host deletes a dead host's session.js at startup (owner pid in session-owner.json, outside the page folder). - The daemon swallows console EPIPE after a hard host kill and handles a lifeline close once. Run at 930c6e2 on macOS (mote, Node 22), in a fresh copy: - npm ci, then npm run check (tsc daemon + web): ok - npx vitest run: 46 files, 288 passed, 17 skipped - npm run verify:build: app.js, app.css, index.html and daemon/dist/main.js(.map) rebuild byte-identical - bun scripts/check.mjs agent-console: ok - Playwright Chromium and WebKit, light and dark, sandbox HOME, page served under /_magpie/plugin/<id>/page with a stub bridge passing accent #ff0000: - accent: --accent and the primary button stay grey (rgb(38,38,38) light, rgb(229,229,229) dark); no <select> anywhere. - Settings menus: click opens the menu inside the window; ArrowDown+Enter picks, closes and refocuses the trigger; the pick persists through the daemon. - Esc closes the menu, not the dialog, and then closes the dialog. Clicking an option keeps the dialog open; a click outside closes the menu. - A host that was never opened writes beat:false and doesn't rewrite session.js. SIGKILL it, start a new host: the stale file is removed and the page reaches the new daemon. - After an open, session.js beats. SIGKILL the host: the page heals in ~5.3s and stays. A daemon-only crash heals in ~5.3s. - Daemon logs: no uncaughtException or EPIPE, one lifeline line per daemon exit. Not tried: the composer pickers in a browser (they need a thread with an installed agent; same SelectMenu component), magpie's real sandboxed frame, Windows and Linux.
74 lines
2.7 KiB
TypeScript
74 lines
2.7 KiB
TypeScript
// App shell: connection state → three-column layout. Each area is filled in by P2-2..P2-6.
|
|
import { useConnection } from "./stores/connection";
|
|
import { Layout } from "./components/Layout";
|
|
import { Sidebar } from "./components/Sidebar";
|
|
import { Topbar } from "./components/Topbar";
|
|
import { Chat } from "./components/Chat";
|
|
import { useTimeline } from "./stores/timeline";
|
|
import { useData } from "./stores/data";
|
|
import { useEffect, useState } from "react";
|
|
import { CommandPalette } from "./components/CommandPalette";
|
|
import { Panel } from "./components/Panel";
|
|
import { SettingsDialog } from "./components/Settings";
|
|
import { Toasts } from "./components/Toast";
|
|
import { t } from "./i18n/index.js";
|
|
import { goBackToMagpie } from "./api/backToMagpie.js";
|
|
|
|
export function App() {
|
|
const { state, version } = useConnection();
|
|
const pending = useTimeline((s) => s.pending);
|
|
const providers = useData((s) => s.providers);
|
|
const [palette, setPalette] = useState(false);
|
|
const [settingsOpen, setSettingsOpen] = useState(false);
|
|
|
|
// Ctrl+K command palette; open-settings custom event; Esc closes panels
|
|
useEffect(() => {
|
|
const onKey = (e: KeyboardEvent) => {
|
|
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "k") {
|
|
e.preventDefault();
|
|
setPalette((p) => !p);
|
|
}
|
|
};
|
|
const onSettings = () => setSettingsOpen(true);
|
|
window.addEventListener("keydown", onKey);
|
|
window.addEventListener("open-settings", onSettings);
|
|
return () => {
|
|
window.removeEventListener("keydown", onKey);
|
|
window.removeEventListener("open-settings", onSettings);
|
|
};
|
|
}, []);
|
|
|
|
if (state === "down") {
|
|
return (
|
|
<div className="boot-screen">
|
|
<div className="boot-wrap">
|
|
<span>{t("boot.serviceDown")}</span>
|
|
<button className="btn primary" onClick={() => { if (!goBackToMagpie()) location.reload(); }}>{t("boot.retry")}</button>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
if (state === "connecting" && !version) {
|
|
return (
|
|
<div className="boot-screen">
|
|
<div className="boot-dot" data-state={state} />
|
|
<span className="boot-label">{t("boot.connecting")}</span>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<Layout
|
|
sidebar={<Sidebar pendingByThread={new Set(pending.map((p) => useTimeline.getState().threadId!).filter(Boolean))} />}
|
|
topbar={<Topbar pendingCount={pending.length} />}
|
|
panel={<Panel />}
|
|
>
|
|
{state === "reconnecting" && <div className="connbar">{t("boot.reconnecting")}</div>}
|
|
<Chat />
|
|
{palette && <CommandPalette onClose={() => setPalette(false)} />}
|
|
{settingsOpen && <SettingsDialog onClose={() => setSettingsOpen(false)} providers={providers} />}
|
|
<Toasts />
|
|
</Layout>
|
|
);
|
|
}
|