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
5 changes: 4 additions & 1 deletion src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ import { BrowserRouter } from "react-router-dom";
import App from "./App";
import "./shared/appMeta";
import { initTauriRegistryBridge } from "./shared/mcpEvents";
import { isTauriApp } from "./shared/runtimeTarget";
import "./index.css";

initTauriRegistryBridge();
if (isTauriApp()) {
initTauriRegistryBridge();
}

ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
<StrictMode>
Expand Down
24 changes: 21 additions & 3 deletions src/modules/bot/components/TerminalPreview.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useCallback, useEffect, useRef, useState } from "react";
import { isMarketingWebsite } from "../../../shared/runtimeTarget";
import { PENGINE } from "../api";
import { logLineKindClass } from "./logLineKindClass";

Expand All @@ -8,17 +9,34 @@ const fallbackLines: LogLine[] = [
{ timestamp: "00:00:00", kind: "ok", message: "Waiting for Pengine service…" },
];

/** Static copy only — never opens loopback (avoids browser local-network prompts on the public site). */
const marketingDemoLines: LogLine[] = [
{
timestamp: "—",
kind: "info",
message: "Demo preview — the desktop app streams a live log from your machine.",
},
{ timestamp: "—", kind: "ok", message: "Tool policy loaded from local settings." },
{ timestamp: "—", kind: "info", message: "MCP registry idle — add servers in the dashboard." },
{ timestamp: "—", kind: "ok", message: "Agent loop ready (connect Telegram in Setup)." },
];

const SCROLL_NEAR_BOTTOM_PX = 64;

export function TerminalPreview() {
const [lines, setLines] = useState<LogLine[]>(fallbackLines);
const marketingSite = isMarketingWebsite();
const [lines, setLines] = useState<LogLine[]>(() =>
marketingSite ? marketingDemoLines : fallbackLines,
);
const scrollRef = useRef<HTMLDivElement>(null);

const addLine = useCallback((line: LogLine) => {
setLines((prev) => [...prev.slice(-49), line]);
}, []);

useEffect(() => {
if (marketingSite) return;

let cancelled = false;
let retryTimer: ReturnType<typeof setTimeout> | null = null;
let reconnectAttempt = 0;
Expand Down Expand Up @@ -91,7 +109,7 @@ export function TerminalPreview() {
es?.close();
unlistenTauri?.();
};
}, [addLine]);
}, [addLine, marketingSite]);

useEffect(() => {
const el = scrollRef.current;
Expand All @@ -111,7 +129,7 @@ export function TerminalPreview() {
<span className="h-3 w-3 rounded-full bg-[#28c840]" />
<p className="ml-2">pengine runtime</p>
<span className="ml-auto hidden text-[10px] uppercase tracking-[0.14em] text-white/35 sm:inline">
live
{marketingSite ? "demo" : "live"}
</span>
</div>
<div
Expand Down