Skip to content

[feat](copilot,chat,guide): Interactive Copilot, Chat Advisor & modern Guide (Phase 3) - #57

Merged
programmerShinobi merged 2 commits into
mainfrom
feat/phase3-chat-advisor
Jul 19, 2026
Merged

[feat](copilot,chat,guide): Interactive Copilot, Chat Advisor & modern Guide (Phase 3)#57
programmerShinobi merged 2 commits into
mainfrom
feat/phase3-chat-advisor

Conversation

@programmerShinobi

@programmerShinobi programmerShinobi commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Phase 3 — Interactive Copilot, Chat Advisor & a modernized Guide

All 100% client-side, offline, dependency-free; nothing in the frozen model was touched.

Interactive Copilot (src/features/copilot/)

A "Guide me" launcher runs a bilingual, step-by-step walkthrough of the four-step Advisor journey, spotlighting each target with Do/Don't guidance.

  • Adapter Pattern, closed data-tour-id whitelist, typed leak-free event bus, React-portal overlay with live tracking; missing target → silent fallback.
  • Goes to the location, never covers it — scrolls the target below the pinned chrome and above the mobile bottom-sheet card. Fixed a desktop side-placement overlap, and a floating-target case so the final step (the fixed Chat Advisor FAB) is never covered by the sheet.

Chat Advisor (formerly "AI Advisor", Advisor-tab only)

Renamed so the name matches reality — a client-side, offline, rule-based assistant computed from the frozen engine, never a language model. Confined to the Advisor tab (that's where the scenario is).

  • Coverage mapped onto 5W1H across ~27 grounded intents (recommend/explain/compare/why/why-not, who/when an option fits, cost & ops, risk/anti-patterns, sensitivity, migration, dimensions, factors, quality attributes, and a full app-usage FAQ). Every answer reads only the frozen engine or real config — never invented.
  • Five real question/answer mismatches found by hand-testing were fixed and regression-tested (serverless⊂server, offline, "daftar", cost-efficiency QA, anti-pattern concept). Documented rule: most-specific intent first.

Modernized Guide / Manual ("Panduan")

  • Content fix: §7 "the feature map" now covers the Chat Advisor and the "Guide me" tour (previously omitted); all facts re-verified.
  • UI: glass shell, gradient header, sticky jump-to-section table of contents, numbered badges, card sub-sections (new .aa-manual-* classes; inline styles removed). The TOC uses scrollIntoView, not #hash anchors, so it never touches the share-state URL.

Cross-feature

  • Full mutual exclusion: opening any one of {Chat Advisor, Copilot tour, Guide/Manual, palette, shortcuts, Compare} closes every other — never two open/highlighted at once.
  • An n8n webhook integration was proposed and declined by the owner (would break the offline promise); recorded in DECISIONS.md.

Gates

tsc clean · lint 0 warnings · 184/184 unit · 14/14 E2E · 6/6 guards · bundle within budget (initial 120.5/121 · total 274.6/278 · CSS 27.6/29 kB gzip — total raised 268→278 for the added grounded content, still lazy-loaded, under the 300kB NFR cap).

README + DECISIONS updated throughout.

🤖 Generated with Claude Code

programmerShinobi and others added 2 commits July 19, 2026 05:09
A grounded, offline, rule-based assistant built on the Adapter Pattern.

Engine/state (decoupled, src/lib/chat/):
- ChatAdapter contract + getChatAdapter() single swap-point; localAdvisorAdapter
  answers from the FROZEN engine + config (answerText() pure, unit-tested) so it
  can never contradict the model or fabricate. Network LLM = drop-in later, zero
  UI change. Streams via AsyncIterable under an AbortSignal.
- buildChatContext(): structuredClone deep-clone + dependency-free validation;
  invalid/partial input → complete moderate baseline (no undefined/crash).
- useChat: throttled submits + ignore-while-streaming (no spam), stop/regenerate/
  abort, hydration-safe persistence, cross-tab reset via BroadcastChannel.

UI (lazy, src/components/chat/):
- ChatFab (lazy) → ChatMount → ChatPanel; memoized bubbles render via the
  existing dependency-free XSS-safe-by-construction markdown renderer, each in a
  per-bubble ErrorBoundary. Smart-scroll (IntersectionObserver, pauses on manual
  scroll-up), streaming caret, Stop/Regenerate, suggestions, full a11y
  (labelled dialog, polite live region, keyboard), EN/ID.

Wiring (anti-regression): FAB mounted GLOBALLY so tab-switch closes the Guide but
never unmounts chat / disrupts a stream; "Start Over" wipes chat + broadcasts.
Bundle: FAB + all chat lazy → INITIAL budget untouched (119.9/120); total 260→268
(documented). Browser-verified: grounded /100 reply, survives nav, reset wipes, EN/ID.

145 unit (+17) + 14 e2e, tsc, lint, all 6 guards green. README Phase 3 section +
Mermaid + adapter integration snippet; DECISIONS records the two reconciliations.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… (Phase 3)

Add a pluggable, 100% client-side Interactive Copilot (`src/features/copilot/`):
a "Guide me" launcher runs a bilingual, step-by-step walkthrough of the four-step
Advisor journey — spotlighting each target with Do/Don't guidance.

- Adapter Pattern (`getCopilotService()`), closed `data-tour-id` whitelist, typed
  leak-free event bus, React-portal overlay (spotlight + card) with live tracking
  (ResizeObserver + MutationObserver + scroll/resize/visualViewport). Missing target
  degrades to a silent fallback; every observer/listener/timer is cleaned up.
- Pre-Flight Check: navigate to the step's view, wait for paint, scroll the target
  BELOW the pinned chrome (app bar + step rail) so the spotlight is never hidden, and
  keep it ABOVE the mobile bottom-sheet card (pinned header/footer, scroll-only body)
  so a full step — title, body, Do/Don't — is never clipped. The app's sticky
  step-rail hides while the tour runs (the Copilot is the guide). Step 1 anchors the
  compact "Build custom system" card so the spotlight fits small screens.
- Dependency-free + XSS-safe-by-construction (reuses `lib/markdown`), lazy-loaded so
  the initial JS budget is untouched; engine is unit-tested, overlay verified in-browser.

Gate the AI Advisor chat OFF behind a single flag (`FEATURES.chat`,
`src/config/features.ts`) while its UX is finalized: App skips mounting the FAB and the
tour filters out its chat step, so nothing points at a control that isn't on screen.
Re-enabling is a one-line change. README + DECISIONS updated to reflect both.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@programmerShinobi
programmerShinobi merged commit 57ee52b into main Jul 19, 2026
4 checks passed
@programmerShinobi programmerShinobi changed the title [feat](chat): AI Advisor — context-aware, client-side chatbot (Phase 3) [feat](copilot,chat,guide): Interactive Copilot, Chat Advisor & modern Guide (Phase 3) Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant