Files
loki/scripts/test
CatoandClaude Fable 5.1 5bc05bbef4 feat: the first day is the whole product — three ways in, /build, your website in onboarding, Loki on it, help when a build stalls, and the owner's phone fixes (#1110)
* feat(widget): the owner's way into Loki — Continue in Loki, an advisor that knows whose site it is, a header that fits a phone

On 2026-10-09 the owner of heidi.orangecat.ch opened the widget on their
phone and asked for one new page. The widget treated them as a stranger:
it told them which heading to insert and to "keep the structure in a data
file (JSON/YAML)", wrote five invented sentences in the site's own language,
and answered "switch to Loki so I can develop it there with either chat or
terminal" with the same advice a third time. The owner's sign-in lived only
behind "Watch". Once signed in, Review + Stop watching pushed ✕ off the
right edge of the screen.

- widget/continue.ts + src/lib/widget/continue.ts: the thread as one
  message (newest kept, ≤1800 chars) and where it lands in Loki.
- GET /api/widget/continue: signs the person in if needed, checks
  getProjectAccess on the widget's project, resolves the project key and
  redirects into /loki?project=&q= or /terminal?project=&view=terminal;
  a stranger goes back to the site with #loki-owner-denied.
- widget/conversation.ts: "Continue in Loki · Chat → · Terminal →" under
  the composer for the owner; one sign-in link for anyone else after their
  first message; "This is my site — sign in with Loki →" under Loki's
  greeting, on the first screen. The owner pass travels with each question.
- /api/widget/advise + advisor.ts: the pass is verified as ingest verifies
  it; with it the advisor knows the person OWNS the site and Build this
  builds. For everyone, four hands-off rules: never explain how to edit the
  site, never write its content, a build request becomes the one change to
  tap, and "take this into Loki" is answered with where that control is.
- widget/theme.ts: the header's text column shrinks before the actions do;
  Stop watching stays on one line; the continue row wraps on a phone.
- widget/main.ts: the owner is not offered to hide their own tool.
- scripts/test/widget-continue.ts (new), widget-advise.ts: pinned.
- docs/architecture/feedback-widget.md: the row and the route.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N1Yw4cCwXWRP2S5Hj62u2Z

* feat(widget): the loop closes on the site — Your changes, a live announcement, an honest Follow link

"On it — Loki tells you when" was the end of the widget's story, and on the
site Loki never told anyone: the telling went to push and Telegram, the page
the owner came back to said nothing, and "Follow the build" toured the
unchanged page with "let me show you what changed".

- widget/changes.ts: "Your changes" above the thread for the owner — the
  project's recent changes with one word each (Building · On its way · Live ·
  Needs you …), See it → once live, Open in Loki → when something needs them,
  asked for on arrival and every 30 s while something moves. A change this
  browser saw building that is now live is announced once: in the thread when
  the panel is open, beside the launcher (bubble + unread) when it is not.
- POST /api/widget/owner/changes: the one read with the owner pass. Same
  attachFeedbackWork the inbox uses, then src/lib/feedback/owner-view.ts
  writes the owner's words; the work view never leaves the server. No valid
  pass → no rows.
- /feedback/<id>/watch-fix lands on the inbox row while the change is still
  being built; the walkthrough only once it is live.
- The owner's repeated note keeps its follow link.
- widget/continue-row.ts, widget/greeting.ts: split out of createConversation
  (the lint rule caps it at 510 lines; CI caught it at 543).
- scripts/test/widget-changes.ts (new); widget-continue.ts updated.
- docs/architecture/feedback-widget.md.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N1Yw4cCwXWRP2S5Hj62u2Z

* fix(widget): the owner's door is not an .act — the embed test counts those

widget-embed-browser asserts exactly one "as written" link (.act) under the
visitor's last message; the sign-in door under the greeting shared the class
and made it two. Its own class, same look.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N1Yw4cCwXWRP2S5Hj62u2Z

* feat(public): three ways in — build it yourself, with a partner, or let the studio — and every stranger's door ends at /build

The ways to get something built were scattered: the landing page offered
only "Start a project", hiring the studio was a word in the nav, the partner
directory was reachable from OrangeCat's careers page and nowhere here, and
a stranger who watched a fix land on someone else's site was sent to a bare
homepage. "Start a project" at the bottom of six marketing pages went to
sign-IN, and so did a stranger arriving with a brief.

- src/config/build-paths.ts: the one list — yourself (sign-up), with a
  partner (bitbaum.orangecat.ch/partners/), the studio (the commission
  config's hire address) — plus buildPageHref/fromHost.
- /build (public, allowlisted): the invitation, naming the site the person
  came from (validated host only) and the three doors (BuildPaths cards).
- Landing: the "Three ways in" section after "Who it is for"; the closing
  line and FinalCta name the other two ways; FinalCta → sign-up.
- /change and /take send a signed-out person to sign-up with the brief kept.
- Widget: "Made with Loki — build something of your own →" as the last line
  for anyone who is not the owner (/build?from=<host>); the tour's "Get this
  for your site" lands on /build naming the site; the concierge gets the
  same door (appended last — the test addresses the others by index).
- scripts/test/build-paths.ts pins all of it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N1Yw4cCwXWRP2S5Hj62u2Z

* fix(widget): /api/widget/continue is public — it signs the person in itself

Live, the merged route answered a bare 401: the session middleware caught it
before the route could send the person to sign-in. Same list entry as
/api/widget/owner, pinned by widget-continue.ts.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N1Yw4cCwXWRP2S5Hj62u2Z

* test(audit): /build is measured by the responsive audit

A new page has to be a decision — measured, or excluded with a reason.
Measured: it is a public page a stranger lands on from a phone.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N1Yw4cCwXWRP2S5Hj62u2Z

* fix(widget): yours means yours, a review that picks three, the composer above the keyboard

From the owner's phone on 2026-10-09:
- "Your changes" listed a stranger's "so nice picture!" as the owner's own
  request. The strip now shows what the owner asked for and what Loki filed
  itself; visitors' notes are counted ("3 notes from visitors, in Loki →").
- Review answered with five nits (alt text, a renamed button, a table) and
  five identical buttons. The rubric now asks for at most three changes a
  visitor would notice or that fix something broken, and says none is fine.
- With the keyboard open the box being typed into sat half behind it; it
  scrolls into view once the keyboard has settled.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N1Yw4cCwXWRP2S5Hj62u2Z

* feat: the first day is the whole product — your website in onboarding, Loki on it, help doors when a build stalls, the terminal hand-off with its text, a launcher that stays in the corner

From the owner's phone on 2026-10-09, and the three follow-ups named then:

- Onboarding asks for the website (optional). A project created with one
  (`liveUrl` on POST /api/user-projects) gets its widget token at once, so
  the token's origin is the site's; the new step "Put Loki on your site"
  shows the one line to paste, lets an agent add it when there is a repo,
  and opens the site with the owner pass (`openSiteUrl` on the token
  route). Finishing lands on the project, not Control. A refused project
  no longer advances the step in silence.
- A stalled build and a failed kickoff offer the other two ways to get it
  built — find a partner, hire the studio — from the same list as the
  landing page (GetHelpLine), the studio with the brief.
- "Continue in Loki → Terminal" carries the thread: /terminal?q= prefills
  the rail's composer as an unsent draft, and opens the rail sheet on a
  phone (the same path ?explain=1 takes).
- The launcher stays in the corner: a near slot over plain text beats a
  free slot mid-page (heidi.orangecat.ch: the site's own bar took one
  corner and the launcher floated beside a heading). A near sheet still
  sends it climbing.
- Page checks: a small-caps label by design is not a defect, 11.84px is
  not under 12, and one kind of finding is one card (the signature drops
  counts and examples; "30 pieces" then "6 pieces" were two cards).

Tests: onboarding-site-step.ts (new), widget-placement.ts, widget-watch.ts,
widget-continue.ts, build-paths.ts; all widget browser suites pass locally.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N1Yw4cCwXWRP2S5Hj62u2Z

* refactor(widget): keepInViewOnFocus lives in dom.ts — createConversation back under the 510-line cap after the merge

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N1Yw4cCwXWRP2S5Hj62u2Z

* fix(widget): import keepInViewOnFocus — the panel threw at mount and boot swallowed it

An unimported identifier compiles fine with esbuild and fails at run time;
boot's catch hid it, so the launcher rendered and the panel never opened.
Caught by widget-embed-browser.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N1Yw4cCwXWRP2S5Hj62u2Z

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-09 05:10:30 -07:00
..
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00