mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 12:27:28 +01:00
main
10
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
6d40764c8a |
fix(widget): Send stays reachable on the real sites, not only the fixture (#1256)
#1251 went live and I re-measured production instead of trusting the tests. Fixed on Substrata 390×760 and Loki's own site; still broken on orangecat.ch at 390×667 and Solon at 360×640, where a tap on Send still hit "Made with Loki" — and the footer I said would share one line still took two. Two causes the test fixture could not show: - The phone rule that makes the starters one swipe row lost to the base `.starters { flex-wrap: wrap }` rule, which comes later in the file with the same specificity. On the real sites the starters were still a 129px stack. Now `.convo > .starters`, which wins. - "Made with Loki — build something of your own →" alone is wider than a phone, so the footer wrapped to two 39px rows. On a phone it reads "Made with Loki →"; the rest of the sentence stays on wider screens. And a priority, so content can never again push the composer out: the thread gives way first (flex-shrink 9999), then the starters (now allowed to shrink, clipped), never the composer. Verified by serving this build into the REAL production pages (orangecat, Solon, Substrata at 390×667 / 360×640 / 390×760 / 320×568 / 390×844 / 1280×720): every tap on Send reaches Send. widget-embed-browser now also asserts the causes on phones (starters one row, footer one line) and adds 320×568; it fails 4 times without this change and passes 78/78 with it. Claude-Session: https://claude.ai/code/session_01E1qoQ9syUYXCRNbyrpqPGa Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
f309b23ae0 |
fix(widget): a tap on Send reaches Send, at every height (#1251)
Found in production on 2026-10-17 by driving the live widget the way a phone
visitor does, and filed through the widget itself ("Loki itself", feedback
ddf6e248):
- substrata.orangecat.ch at 390×760: the composer scrolled with the
conversation and opened half below the fold, so a tap where Send is drawn
hit "Made with Loki — build something of your own" — a new tab, the note
unsent. After sending, the composer was gone below the footer entirely.
- loki.orangecat.ch at 1280×720/860 (the chatkit composer): Send sat below
the panel's scroll box, under the footer.
Cause: .convo was itself a scroll box holding the thread (96px floor), the
starters and the composer; whenever they did not fit, the whole column
scrolled. In chatkit mode two plain block wrappers (.kit-host > .fc-kit-root)
took their content's height, so the thread never shrank at all.
- Only the thread scrolls; it may shrink to nothing, the composer may not.
- The chatkit wrappers pass the room down.
- On phones the starter chips are one row to swipe (they were a 140px stack
on a 517px sheet), and the two footer links share one line.
- Self-watch now checks Send by what a tap HITS when the panel opens. It
only checked sideways overflow, which passed while production was broken.
- Both browser suites check Send's reachability at 390×667, 360×640 and
1280×720 (plus 390×760); every test used to open the panel 800px tall,
which is how this hid. Reproduced first: classic failed at 390×667 and
360×640 (hit: made-with), chatkit at 1280×720.
Also: CLAUDE.md said to attach the fleet kits with read access. For a public
repo that attaches nothing and codeload stays 403; the push attach is what
opens it (whenkit 403 → 200).
Claude-Session: https://claude.ai/code/session_01E1qoQ9syUYXCRNbyrpqPGa
Co-authored-by: Claude <noreply@anthropic.com>
|
||
|
|
25ae3de0e5 |
Make the Loki site widget one clear conversation (#1229)
* Improve widget conversation and mobile feedback flow * Update widget layout assertion for simplified header |
||
|
|
9d5d0c4694 |
feat(widget): Loki's own look, in Loki's light or dark mode, with one scroll (#1227)
* feat(widget): Loki's own look, in Loki's light or dark mode, with one scroll The site widget took its colours from the fleet's shared tokens, whose accent is OrangeCat's warm orange, and was dark only: on a client's light site the owner saw an orange-ringed black panel and asked why Loki's widget looked like OrangeCat. - Themes are generated from Loki's own globals.css, light and dark. The accent is the ink; the warm colour is only the focus ring and a picked element's outline on the host page. - Every widget stylesheet reads var(--lk-*), defined for both modes on the shadow host; widget/theme-mode.ts picks one. The owner gets the mode they chose in Loki (user_preferences.theme, saved by ThemeSync via PUT /api/me/theme, returned with their changes and remembered per site); everyone else gets their device's setting, followed live. - The panel is one column with one scroll area (the thread) between a fixed header and composer. The whole card used to scroll too, which hid the composer below a laptop's fold and nested scrolls on phones. - The desktop card no longer greys out the site it invites you to use; the phone sheet opens at two thirds of the screen with a lighter scrim. - About is a segmented control that fits a 320px phone on one line. - The walkthrough card follows the same mode; its ring uses the highlight so it reads on light and dark sites. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018LMe5Uv6mfWJibAiCaNbbk * fix(widget): the launcher is findable — Loki's mark at full strength On the owner's phone, signed out of the owner pass, AOZ showed a grey pencil at 38% opacity and 85% size, and the owner said the widget was gone. Without the launcher there is no way to the sign-in that brings owner mode back. The resting launcher is now Loki's spiral at full strength with a hairline and a soft lift off the page, on phones and desktop; it still fades while the page scrolls. Also: the user_theme migration is renumbered 0107 after main's 0106. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018LMe5Uv6mfWJibAiCaNbbk * fix(widget): keep the shared chat's thread bounded however chatkit nests it CI's widget-kit-browser (needs @bitbaum/chatkit, so it only runs there) failed one check: the chat thread no longer had a max-height once the panel became a flex column. The flex layout bounds it only when the wrap is a direct child, so the cap is back as a backstop, and the test now pins the outcome — the thread scrolls and ends inside a card that fits the screen — instead of the mechanism. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018LMe5Uv6mfWJibAiCaNbbk --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
3ff287e215 |
refactor(widget): the conversation's rules live in a model the next view can share (#1160)
* refactor(widget): the conversation's rules live in a model the next view can share Step one of moving the widget's chat onto chatkit, the chat Loki itself uses. - widget/conversation-model.ts: thread, pending, error, confirmation card, and every call (ask, build, deliver, self-report) — no DOM, snapshot() + subscribe(). conversation.ts now draws it, same markup and classes, so nothing on any site changes. - main.ts: while the panel is open, keys stop at the shadow root on their way out instead of on document in the capture phase. The old stop kept every key from controls inside the panel that listen for themselves — fine for today's composer, which main.ts fed by hand; fatal for any real component (a composer's Enter, a dialog's Escape). Escape with focus behind the panel still closes it. Tests: widget-conversation-model (new, 25), widget-embed-browser +4 (host hotkeys never see panel typing; a control inside still gets its keys — fails on the old handler; Enter asks; Escape closes), watch-browser 81/81, host-avoid 24/24. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BWXjqiHm8jFta4FXuc7Tck * test: source checks follow the conversation's calls into the model Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BWXjqiHm8jFta4FXuc7Tck --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
fca81031b0 |
feat(widget): the widget reports on itself, to Loki (#1142)
* feat(widget): the widget reports on itself, to Loki Watch mode reads the host page and is careful never to blame the site for Loki's own work: the widget's own requests, errors and layout were left out of what it says — which meant dropped. Nobody heard about a panel that did not fit a phone unless the operator was the one holding it. - A fourth "About" chip, "Loki itself": a note about the panel goes to Loki's own project (FEEDBACK_WIDGET_TOKEN's), never to the site's builder, with the same screenshot attach. About bar extracted to widget/about-bar.ts. - Self-watch (owner, while watching): the widget's own errors, its calls to Loki failing or over 20s, and a panel wider than the screen are filed to the same place automatically — once per kind per tab, said in one line in the conversation, and never looping through the report call itself. A 4xx is Loki answering on purpose, not a defect. Watch now hands own-requests over instead of discarding them. - New public route /api/widget/self-report: host fcw_ token + origin allowlist, owner pass required for anything the widget noticed unasked, one row per kind per site via noticeKey. - The owner's top bar steps aside while the site has a modal open: it sat on top of "Choose a model" on the operator's phone. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E1qoQ9syUYXCRNbyrpqPGa * feat(widget): Loki's own owner's self-reports start the fix on the spot A self-report filed by Loki's OWN owner — using Loki's widget on one of their sites — is the owner's word on their own product, and the owner's word is the decision (api/feedback): a note, a crash or a panel that did not fit starts a build into Loki there and then, and the receipt reads "On it … built into Loki itself" with Follow the build →. A slow or failed call to Loki only files; its duplicate count is the signal. Anyone else's waits in the inbox. The receipt wording moves to widget/receipt.ts (pure, tested) — the thread renderer was over the lint's line cap. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E1qoQ9syUYXCRNbyrpqPGa * test(widget): the About row has four chips now Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E1qoQ9syUYXCRNbyrpqPGa --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
17e63d1396 |
feat(widget): one designed piece — the launcher is the status, Loki stops crying wolf, the panel fits (#1106)
Found by using the live widget on loki.orangecat.ch as owner, not by tests: - The composer overflowed in every real browser: with a mic present, Record + Screenshots + Send as feedback pushed Ask Loki out of the 372px panel (the test browser has no mic, so nothing caught it). Tools are icons at rest, the row wraps; widget-embed-browser now fakes a mic and fails at 1200/390/320 if the panel scrolls sideways or any button sits outside it (proven against the #1099 CSS: 6 failures). - The top bar covered the site's own navigation. For the owner the LAUNCHER is now the status: "Loki · watching", an unread count of what Loki said while the panel was closed, the newest remark in a bubble beside it. The bar is the fallback, shown only when neither launcher nor panel can be seen. - Loki cried wolf on Loki's own page: "15 links have no name" (innerText is "" under content-visibility:auto, and ?? never fell back) and "25 tap targets too small" (WCAG 2.5.8's spacing exception ignored). Now 0 and 1 (a really crowded 154x16 link); examples name a link's address instead of "a". Pinned by fixtures that fail with the old code. - A remark arriving mid-tap moved the button away (it happened live): the thread follows new messages only if you were at the bottom or acted yourself; opening the panel lands on the newest message. - "On it" was a dead end: owner builds now return followUrl (Loki's Watch the fix page for that item) and the receipt says "Follow the build →". widget/README.md now opens with the design model and the rules that resolve its trade-offs. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
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> |
||
|
|
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> |
||
|
|
63d8f84d33 |
feat(widget): Ask Loki for a second opinion; hiding is visible and reversible (#950)
* feat(widget): Ask Loki for a second opinion; hiding is visible and reversible Tested the embed in a real browser and found three install/hide defects: - a `type="module"` tag rendered nothing (document.currentScript is null); - two copies of the tag rendered two launchers; - hiding lived only behind a long-press/right-click and was one-way: after a reload nothing, not even the host's own Loki.report(), brought it back. Fixes: find the tag by its attribute when currentScript is null; a boot-in- flight guard keeps one widget per page; "Hide this button on this site" sits at the foot of the panel with an Undo toast, and #loki, Loki.show(), report() and ask() all restore it. New Ask Loki mode (on by default next to "Request a change"): the person the site was built for asks whether an element, the page or the whole site should change and why it is the way it is. The widget builds a text outline in the visitor's browser (a few same-origin pages for "Whole site") and POSTs it to /api/widget/advise — same token, origin allowlist, rate limits and owner AI budget as widget chat. The answer may say "leave it"; each recommended change has "Request this", which prefills Report so advice becomes ordinary Implement work. data-fc-modes="report" opts a site out. Tests: scripts/test/widget-embed-browser.ts (real Chromium; fails on the old bundle) and scripts/test/widget-advise.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EsT2PtLuBKwgaaBU5pheG8 * refactor(widget): move panel pieces out of main.ts to meet the function-length ratchet CI lint failed: the main IIFE grew to 597 lines (max-lines-per-function 510). The success views, scope chips, mode tabs and hide toast move to widget/panel-views.ts; the counter/Send sync is one helper. No behaviour change — widget-embed-browser (31) and widget-host-avoid-browser (17) pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EsT2PtLuBKwgaaBU5pheG8 --------- Co-authored-by: Claude <noreply@anthropic.com> |