Skip to content

ui: a skill to demo, test and document Llama Chat and Llama UI changes - #77

Draft
allozaur wants to merge 3 commits into
allozaur/perf/ui-pele-diagramsfrom
allozaur/docs/ui-demo-skill
Draft

allozaur wants to merge 3 commits into
allozaur/perf/ui-pele-diagramsfrom
allozaur/docs/ui-demo-skill

Conversation

@allozaur

@allozaur allozaur commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Overview

A skill, skills/ui-demo, that lets any agent demo, test and document a change in Llama Chat or Llama UI: a demo video in the PR, a Playwright check from the same flow, and docs videos and screenshots. Demos can now show a reply without a model or a real llama-server, and record Llama UI components from their Storybook stories.

Demo

Search finds a chat by its title A reply from a mocked server, no model loaded
Search finds a chat by its title A reply from a mocked server, no model loaded
A Llama UI story: Switch
A Llama UI story: Switch

Recorded at 2e91bce; click a preview for its full video.

Additional information

Part 13 of 13 of the work-in-progress stack on the fork, on top of Pele (#75), based on allozaur/perf/ui-pele-diagrams (#75). It only needs the Storybook layer (#67), for story demos of Llama UI.

What an agent can do with it
  • Demo: write a ts demo script for a change, try it with npm run demo:record, then npm run demo:pr -- <n> records it at the PR head and writes the ## Demo section. Fixtures cover the setup: the two MCP fixture servers, built-in conversations (traces), and now models and replies (mockServer), so nothing loads a model.
  • Llama UI: record any component from its Storybook story with test.use({ story }) and DEMO_STORYBOOK=ui (or chat for Llama Chat's Storybook), in the same script as Chat demos.
  • Test: port the same flow to tests/e2e/<feature>.e2e.ts, which CI runs against the build with mockLlamaServer(page) standing in for the server; or a play function on a story for a component on its own.
  • Document: npm run demo:docs for docs videos from the storage target, and page.screenshot / locator.screenshot for 2x screenshots.
  • Pitfalls it spells out: the harness's ports and server reuse, the Chrome sandbox, waiting on state instead of time, ambiguous accessible names.
What changed
  • skills/ui-demo/SKILL.md: when to use it, the target per kind of change, the exact commands, a worked example and the pitfalls. ui/apps/chat/AGENTS.md and demo/README.md point to it.
  • demo/fixtures/llama-server.ts: mockLlamaServer(page | context, { models, reply }) routes llama-server's endpoints in the browser (model list, props, load/unload, tools, stream lookup) and streams the reply as completion chunks.
  • demo/helpers.ts: two options, mockServer (the mock above) and story (opens iframe.html?id=<story> instead of the app, skipping Chat's settings, traces and readiness wait). The Chat setup moved into openChat(), unchanged; importTraces is exported for e2e checks.
  • demo/playwright.config.ts: DEMO_STORYBOOK=ui|chat adds that Storybook to the web servers, on DEMO_STORYBOOK_PORT (default 6007).
  • demo/cli.ts: demo:pr gives the Storybook a free port, and links ui/lib/ui/node_modules into the PR worktree too.
  • tests/e2e/search-chats.e2e.ts: the worked example's search flow as a check, on the build, with the mocked server.
Testing
  • Recorded the three-part script below locally (DEMO_STORYBOOK=ui npm run demo:record): chat search over imported traces, a reply from the mocked server, and Llama UI's Switch story. All three pass, and demo:pr recorded the Demo section above from this PR's head.
  • npm run demo:docs with DEMO_STORAGE=file://...: read the docs script from storage, recorded it, wrote the mp4 and GIF back.
  • npx playwright test tests/e2e/search-chats.e2e.ts passes in the installed Chrome, against a fresh build with no llama-server.
  • eslint and prettier pass on demo/ and tests/e2e; svelte-check reports nothing in the changed files (the errors it reports are already in the stack below).
  • Nothing reached the llama-server at :9931 beyond the model list: the reply demo is fully mocked.
Demo script
test.describe(() => {
	test.use({ traces: ['long-chat', 'agentic-debugging'] });

	test('Search finds a chat by its title', async ({ demo, page }) => {
		await demo.click(page.getByLabel('Expand navigation'));
		await demo.click(page.getByRole('button', { name: /^Search/ }));

		const search = page.getByRole('dialog', { name: 'Search' });

		await demo.type(search.getByRole('combobox', { name: 'Search' }), 'flaky');

		const result = search.getByRole('option', { name: /Fix the flaky cache tests/ });

		await expect(result).toBeVisible();
		await demo.click(result, 1200);
		await expect(page.getByRole('main')).toContainText('All 48 cache tests pass now');
	});
});

test.describe(() => {
	test.use({
		mockServer: { reply: 'Rust is a systems language focused on **safety** and *speed*.' }
	});

	test('A reply from a mocked server, no model loaded', async ({ demo, page }) => {
		await demo.caption('Mocked llama-server: a canned model and reply');
		await demo.type(page.getByRole('textbox', { name: 'Type a message...' }), 'What is Rust?');
		await demo.press('Enter', 1500);
		await expect(page.getByRole('main')).toContainText('focused on safety');
	});
});

test.describe(() => {
	// a small viewport frames a small component, recorded at the same scale
	test.use({ story: 'ui-forms-switch--default', viewport: { height: 450, width: 720 } });

	test('A Llama UI story: Switch', async ({ demo, page }) => {
		const off = page.getByRole('switch').first();

		await demo.click(off, 900);
		await expect(off).toBeChecked();
		await demo.click(off, 900);
		await expect(off).not.toBeChecked();
	});
});

Requirements

@allozaur
allozaur force-pushed the allozaur/docs/ui-demo-skill branch from bbcbb44 to 2e91bce Compare November 17, 2026 13:32
@allozaur
allozaur changed the base branch from allozaur/docs/llama-ui-storybook to allozaur/perf/ui-pele-diagrams November 17, 2026 13:33
@allozaur
allozaur added this pull request to stack #76 November 17, 2026 13:33
@allozaur
allozaur force-pushed the allozaur/docs/ui-demo-skill branch from 2e91bce to 8657f25 Compare November 17, 2026 13:44
@allozaur
allozaur removed this pull request from stack #76 November 17, 2026 13:44
@allozaur
allozaur added this pull request to stack #78 November 17, 2026 13:44
@github-actions github-actions Bot added documentation Improvements or additions to documentation server/ui labels Nov 17, 2026
allozaur added a commit that referenced this pull request Nov 17, 2026
The tree is the integration's: develop is the stack's top plus the side branches.
@allozaur
allozaur force-pushed the allozaur/docs/ui-demo-skill branch from 8657f25 to 1a6c4fc Compare November 17, 2026 15:28
allozaur added a commit that referenced this pull request Nov 17, 2026
@allozaur
allozaur removed this pull request from stack #78 November 17, 2026 16:25
@allozaur
allozaur force-pushed the allozaur/docs/ui-demo-skill branch from 1a6c4fc to 17250d0 Compare November 17, 2026 16:26
@allozaur
allozaur added this pull request to stack #79 November 17, 2026 16:26
@allozaur
allozaur force-pushed the allozaur/docs/ui-demo-skill branch from 17250d0 to 8779071 Compare November 17, 2026 16:42
@allozaur
allozaur force-pushed the allozaur/docs/ui-demo-skill branch from 8779071 to fda86a1 Compare November 17, 2026 17:16
@allozaur
allozaur force-pushed the allozaur/docs/ui-demo-skill branch from fda86a1 to 3633c87 Compare November 17, 2026 17:20
@allozaur
allozaur force-pushed the allozaur/docs/ui-demo-skill branch 2 times, most recently from 70b95e1 to da08303 Compare November 17, 2026 22:00
@allozaur
allozaur force-pushed the allozaur/docs/ui-demo-skill branch from da08303 to 152a633 Compare November 17, 2026 22:06
@allozaur
allozaur force-pushed the allozaur/docs/ui-demo-skill branch from 152a633 to 1427897 Compare November 17, 2026 22:21
@allozaur
allozaur force-pushed the allozaur/docs/ui-demo-skill branch from 1427897 to 95969cc Compare November 17, 2026 22:35

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation server/ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant