From f0eb4383bdf814706918a75500897c8d544c41f6 Mon Sep 17 00:00:00 2001 From: Dorian Date: Wed, 4 Mar 2026 10:54:03 +0000 Subject: [PATCH] feat(content): comprehensive extraction hardening, code mode UI, overnight plan - Relax isBookLikeResponse threshold (>=2 to >=1) - Widen book patterns: inline prose, verb-preceded, numbered bold, em-dash - Remove overly aggressive film/song gating on book extraction - Allow songs to coexist with film/book tags (explicit tags always returned) - Strengthen TV patterns: seasons, created by, standalone "tv" query match - Fix TV_EXT_RE to handle both Title|Year|Creator and Title|Creator|Year - Widen place patterns: type word search in descriptions, bold fallback - Add "pizza" to isPlaceQuery and preferredFirstTab - Add Code tab: isCodeQuery, isCodeLikeResponse, extractCodeBlocks, wiring - Fix image threshold: single image with meaningful alt text shown - Refactor filterTabsByContext: specialized paths now append remaining content - Add code mode UI: orange input styling, design system selection, file selection - DesignSystemGrid: selection toggle only on checkmark, card click opens detail - Add 64-test extraction quality test suite - Update overnight plan.md and prompt.md for hardening run Co-Authored-By: Claude Opus 4.6 --- loop/plan.md | 184 +---- loop/prompt.md | 40 +- .../src/__tests__/extractionQuality.test.ts | 702 ++++++++++++++++++ .../app/src/components/chat/ChatInput.vue | 25 +- .../app/src/components/chat/ChatWindow.vue | 3 +- .../app/src/components/chat/PromptIndex.vue | 1 + .../components/content/DesignSystemGrid.vue | 27 +- .../src/components/content/FileTreeNode.vue | 16 +- .../src/components/content/ProjectGrid.vue | 5 + .../app/src/composables/contentExtraction.ts | 147 +++- .../app/src/composables/contentFiltering.ts | 96 +-- .../app/src/composables/useCodeContext.ts | 40 + .../app/src/composables/useContentPanel.ts | 23 +- 13 files changed, 1049 insertions(+), 260 deletions(-) create mode 100644 packages/app/src/__tests__/extractionQuality.test.ts diff --git a/loop/plan.md b/loop/plan.md index 78fd24d7..206e58d8 100644 --- a/loop/plan.md +++ b/loop/plan.md @@ -1,184 +1,38 @@ -# AIUI Plan 2 — Automated Loop Task List +# Overnight Plan — Content Surfacing Hardening & Feature Completion > **Format**: `- [ ]` = pending, `- [x]` = done. -> Make at least 30 attempts on any difficult task before moving on. Loop reads this file. Specs are in `PLAN2.md`. Design rules are in `loop/prompt.md`. +> Make at least 30 attempts on any difficult task before moving on. Loop reads this file. -## M8: Chat UX Polish +## Phase 1: Critical ContentPanel Wiring Gaps -- [x] **M8.1** — Message editing & regeneration (pencil icon on hover, re-send clears subsequent messages) -- [x] **M8.2** — Conversation branching (fork from any message, branch switcher pill, each branch stored in IDB) -- [x] **M8.3** — Reply-to threading (quoted excerpt in input, thread line visual, prepend `> quote` to message) -- [x] **M8.4** — Conversation search (`Cmd+F` glass panel, real-time highlight, up/down to jump between matches) -- [x] **M8.5** — Auto-title generation (background AI call after first exchange, silently replaces "New Chat") -- [x] **M8.6** — Context window visualiser (slim progress bar, token estimate, orange → red > 80%) -- [x] **M8.7** — Conversation export (Markdown / JSON / plain text, File System Access API + `` fallback) -- [x] **M8.8** — Import conversations (drag-and-drop JSON, AIUI format + Claude.ai export format, merge into IDB) -- [x] **M8.9** — Long-press / right-click context menus (messages + content cards, `ContextMenu.vue` glass-card) -- [x] **M8.10** — Scroll position memory (restore per conversation ID, works with virtual scroller) -- [x] **TEST:M8** — Run `pnpm test` and `pnpm typecheck && pnpm lint`. Fix all failures before proceeding. +- [ ] **T1** — Wire ImageGrid + ImageDetail into ContentPanel.vue. Import components, destructure `panelImages`, `selectedImage`, `openImageDetail`, `closeImageDetail` from `useContentPanel()`. Add ImageGrid render block following BookGrid/TVSeriesGrid pattern. Add ImageDetail overlay following BookDetail pattern. Add `selectedImage` to `hasDetailOpen` computed. Reference ContentGridView.vue for how ImageGrid is already used there. -## M9: AI Experience +- [ ] **T2** — Wire PlaceGrid + PlaceDetail into ContentPanel.vue. Import components, destructure `panelPlaces`, `selectedPlace`, `openPlaceDetail`, `closePlaceDetail` from `useContentPanel()`. Add PlaceGrid render block + PlaceDetail overlay. Add `selectedPlace` to `hasDetailOpen` computed. Follow same patterns as T1. -- [x] **M9.1** — Multi-model comparison mode (split-screen same prompt → 2 models, swipeable on mobile) -- [x] **M9.2** — System prompt editor / personas (named personas, model preference, accent, per-conversation) -- [x] **M9.3** — Prompt template library (`/` command palette, `{{variable}}` substitution, IDB-persisted) -- [x] **M9.4** — Vision input (drag-and-drop image, base64 in message content, only when model supports vision) -- [x] **M9.5** — Response feedback (thumbs up/down per message, stored in IDB, exported with conversations) -- [x] **M9.6** — Token & cost estimator (badge per message, running total in context bar, model pricing table) -- [x] **M9.7** — AI memory panel (pinned facts injected into every system prompt, encrypted IDB, max 20 items) -- [x] **M9.8** — Model capabilities badge (Vision / Tools / Long context badges in model selector) -- [x] **M9.9** — Temperature & params sliders (temperature, max tokens, top-P, persisted per conversation) -- [x] **M9.10** — Stop sequence configuration (comma-separated stop sequences in advanced settings) -- [x] **TEST:M9** — Run `pnpm test` and `pnpm typecheck && pnpm lint`. Fix all failures before proceeding. +- [ ] **T3** — Verify code tab rendering in ContentPanel.vue. Ensure `panelCodeBlocks` is destructured and code content renders when the code tab is active. If missing, add a code block display component or inline rendering with syntax highlighting. The code tab should show extracted code blocks from AI responses. -## M10: Advanced Content Renderers +- [ ] **TEST:P1** — Run `cd packages/app && npx vitest run` and `pnpm typecheck && pnpm lint`. Fix all failures before proceeding. -- [x] **M10.1** — Full article renderer (TOC sidebar, reading time, font-size control, print mode, markdown-it) -- [x] **M10.2** — PDF viewer (`pdfjs-dist` lazy loaded, page nav, zoom, text selection, page 1 thumbnail preview) -- [x] **M10.3** — Map renderer (Leaflet + OpenStreetMap lazy loaded, pins for all places, cluster > 10, fullscreen) -- [x] **M10.4** — Recipe renderer (new `recipe` content type, ingredients checklist, numbered steps, scale slider) -- [x] **M10.5** — Event renderer (new `event` content type, countdown, ICS download, Google Calendar URL) -- [x] **M10.6** — Math renderer (KaTeX lazy loaded, `$...$` inline + `$$...$$` block, batch render on stream end) -- [x] **M10.7** — Mermaid diagram renderer (lazy loaded, dark theme, flowchart/sequence/gantt, pan/zoom mobile) -- [x] **M10.8** — Audio waveform player (WaveSurfer.js lazy loaded, orange waveform, click-to-seek) -- [x] **M10.9** — Table renderer (sortable columns, row filter, CSV export, virtualise > 500 rows) -- [x] **M10.10** — Timeline renderer (new `timeline` content type, vertical layout, animate in during streaming) -- [x] **M10.11** — Code runner (HTML/CSS/JS sandboxed iframe, `sandbox="allow-scripts"`, output console) -- [x] **M10.12** — Video renderer (native `