From 7af4055ddc2b2ff8d84c2b0abaa51955c5799f50 Mon Sep 17 00:00:00 2001 From: alt-glitch Date: Tue, 9 Jun 2026 10:41:13 +0000 Subject: [PATCH] =?UTF-8?q?opentui(bench):=20scripts/demo.tsx=20=E2=80=94?= =?UTF-8?q?=20view=20the=20fixture=20in=20a=20real=20attachable=20TUI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dev demo (not a test): seeds the bench fixture into the store via the resume path and renders under a real CliRenderer (no gateway) so you can attach over tmux, scroll, and eyeball the transcript + the rolling-cap truncation notice. Run: DEMO_TOTAL=240 HERMES_TUI_MAX_MESSAGES=80 bun scripts/demo.tsx --- ui-tui-opentui-v2/scripts/demo.tsx | 46 ++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 ui-tui-opentui-v2/scripts/demo.tsx diff --git a/ui-tui-opentui-v2/scripts/demo.tsx b/ui-tui-opentui-v2/scripts/demo.tsx new file mode 100644 index 00000000000..76af7c22f42 --- /dev/null +++ b/ui-tui-opentui-v2/scripts/demo.tsx @@ -0,0 +1,46 @@ +/** + * DEV DEMO โ€” NOT a test, NOT production. Renders the bench fixture (lorem-ipsum + + * fat tool-turns from ./fixture.ts) in a REAL CliRenderer so you can attach over + * tmux, scroll, and eyeball the transcript + the rolling-cap truncation notice. + * No gateway is spawned (purely the fixture seeded into the store via the resume + * path), so typing won't reach a backend โ€” it's for viewing/scrolling. + * + * Run: bun scripts/demo.tsx + * DEMO_TOTAL=200 fixture messages to seed (default 200) + * HERMES_TUI_MAX_MESSAGES=80 cap โ†’ the "โค’ N earlier messages" notice fires + * Quit: Ctrl+C. + */ +import { createCliRenderer } from '@opentui/core' +import { render } from '@opentui/solid' + +import { createSessionStore } from '../src/logic/store.ts' +import { App } from '../src/view/App.tsx' +import { ThemeProvider } from '../src/view/theme.tsx' +import { materialize } from './fixture.ts' + +const TOTAL = Number.parseInt(process.env.DEMO_TOTAL ?? '', 10) || 200 + +const store = createSessionStore() +store.apply({ type: 'gateway.ready' }) +store.setSessionId('demo-fixture-20260609') +// Seed via the resume path so the cap slices + the `dropped` counter is set +// (drives the truncation notice) exactly as a real `session.resume` would. +store.beginBuffer() +store.commitSnapshot(materialize(TOTAL)) + +const renderer = await createCliRenderer({ + externalOutputMode: 'passthrough', + targetFps: 60, + exitOnCtrlC: true, + useKittyKeyboard: {}, + useMouse: true +}) + +void render( + () => ( + store.state.theme}> + + + ), + renderer +)