Phase 11: data-driven Assistant
- Deterministic advisors (src/lib/assistant): party resources (downed/bloodied/ spent slots/rest nudges), session prep (dangling [[wiki links]], active quests, empty journal), live combat hints (turn, downed combatants) — pure + tested - Data-driven encounter builder: greedily assembles level/CR-appropriate monsters to a target difficulty via the Phase-3 budget; one click builds + opens combat - Assistant page: suggestion cards with one-click actions (goto, long rest, create note); wired into routes, dashboard, command palette - 8 advisor/builder unit tests + assistant e2e Conversational LLM layer intentionally deferred (no provider/key in this env); the deterministic advisor is the offline default per the plan. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('/');
|
||||
await page.evaluate(async () => {
|
||||
indexedDB.deleteDatabase('ttrpg-manager');
|
||||
localStorage.clear();
|
||||
});
|
||||
await page.reload();
|
||||
});
|
||||
|
||||
test('assistant flags a bloodied PC and builds an encounter', async ({ page }) => {
|
||||
// Sample campaign gives us PCs + monsters
|
||||
await page.getByLabel('Settings').click();
|
||||
await page.getByRole('button', { name: 'Load sample campaign' }).click();
|
||||
await expect(page.getByRole('heading', { name: 'Sample: Lost Mine' })).toBeVisible();
|
||||
|
||||
// Wound a PC so the assistant has something to flag
|
||||
await page.getByLabel('Primary').getByRole('link', { name: 'Characters' }).click();
|
||||
await page.getByRole('link', { name: /Lia the Brave/ }).click();
|
||||
await page.getByLabel('Current HP').fill('3');
|
||||
await page.waitForTimeout(450); // let autosave flush
|
||||
|
||||
// Assistant shows a resource suggestion
|
||||
await page.getByLabel('Primary').getByRole('link', { name: 'Dashboard' }).click();
|
||||
await page.getByRole('link', { name: 'Assistant' }).click();
|
||||
await expect(page.getByRole('heading', { name: 'Assistant' })).toBeVisible();
|
||||
await expect(page.getByText(/Lia the Brave is bloodied/)).toBeVisible();
|
||||
|
||||
// Build a Medium encounter → lands in combat with monsters
|
||||
await page.getByRole('button', { name: 'Medium' }).click();
|
||||
await expect(page.getByRole('button', { name: 'Start combat' })).toBeVisible();
|
||||
});
|
||||
Reference in New Issue
Block a user