Commit Graph
2 Commits
Author SHA1 Message Date
CatoandClaude Opus 5.5 1d2523625c feat(widget): feedback back in front; Loki speaks up when something is wrong; Stop watching is one tap (#1099)
After #1092 feedback was hidden (Send to builder only appeared after asking
Loki), the page / whole site / element choice had become a toggle chip,
stopping Watch was only "Pause" on the top bar, and Loki only counted what
it saw.

- About: This page / Whole site / An element is one segmented control again,
  and the composer has Send as feedback (straight to the confirmation, no AI)
  beside Ask Loki.
- Watch speaks up: every notice (failed request, slow answer, the site's
  console error, slow load, a freeze after a tap, content jumping), every
  automatic fix, and the page checks after each page settles become a "Loki
  noticed" message in the conversation, in plain words naming the tap that
  led there, with Fix this (the request written out) and Why does it matter
  (asks the advisor with the session). Rule-based (explainNotice /
  explainChecks) - no background model call - and said once per visit.
- The bar says what Loki noticed, with Show (open the conversation) and
  Stop watching / Watch again; the header has Review + Stop watching, or
  Watch again. Stopped, nothing is recorded and nothing is said.

Tests: widget-watch 12 cases (explainers), widget-thread (noticed restore),
widget-watch-browser 50/50 (remark in words + Fix this, no repeat after
reload, header Stop watching records and says nothing - fails with the
guard removed), widget-embed-browser 47/47 (element feedback straight to
the builder, no AI call).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 09:35:00 -07:00
CatoandClaude Opus 5.5 6be6045295 feat(widget): one conversation with Loki; Watch in the header (#1092)
* feat(widget): one conversation with Loki; Watch is in the header for anyone who owns the site

The panel was three tools sharing a box: Request a change (a form), Ask Loki
(an advisor) and Chat, behind tabs and scope chips, each with a history that
vanished on close - and Watch could only be switched on by arriving through
one link on the project page in Loki, so an owner simply visiting their site
never saw it.

Now:
- One thread (widget/conversation.ts). Type, speak, paste a screenshot or
  point at an element; Loki answers about this page (one tap: whole site).
  Every suggested change, and your own message as written, has Send to
  builder / Build this, which opens a confirmation card in the thread; the
  receipt (building / track link) lands in the thread.
- The thread is kept per tab (widget/thread.ts, validated on restore), so it
  survives the site's own page loads.
- Watch in the header: Review for the owner; for anyone else an explainer
  with "This is my site - sign in with Loki", via GET /api/widget/owner,
  which checks ownership of the widget's project and returns to the same
  page with a pass. The return URL must be on the project's own site
  (ownerReturnUrl), so the route cannot hand a pass to someone else's page;
  a non-owner lands back with a plain explanation.
- data-fc-modes now only picks who answers: advisor (default), the studio
  concierge (chat), or none (report). The owner always gets the advisor.
- widget/loki-api.ts holds the two calls; advise.ts and chat.ts are gone.

Tests: widget-thread (new), owner-note-builds (return-URL guard),
widget-embed-browser 41/41, widget-watch-browser 40/40,
widget-host-avoid-browser 24/24.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(widget): style guard follows the panel's real controls; comment no longer reads as an import

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 08:02:54 -07:00