Commit Graph
11 Commits
Author SHA1 Message Date
CatoandClaude Opus 5.5 3024426a65 fix: Voice says why studio voices are off, Watching says each thing once, Prompts in words (#1358)
* fix(prompts): one card per saved prompt, schedules in words, dialogs that say why

What the owner found on /prompts from an Android phone, item by item:

1. Saved prompts: saving the same name + words again no longer inserts a
   row — POST /api/prompts answers with the prompt already saved
   (existing: true); the form opens it, the default's save button says
   "Already in your prompts". A card that stands for identical copies says
   how many and offers "Remove N extra copies" — one explicit tap, the
   caller's own rows only, the same soft delete as Delete
   (DELETE /api/prompts/<id>/copies). Same name with different words says
   "2 versions with this name, worded differently".
2. Filters: the scope filter is a <Segmented> (All / Any project / One
   project) sitting with the category row on the list they both filter,
   under "Loki's prompts". Category counts follow the scope. Filter chip
   rows on a phone get a wider fade, snap to a chip's start and leave room
   after the last chip, so the edge reads as "more" rather than a cut word.
3. New prompt: Create stays disabled until there is a name and a prompt,
   and says what is missing beside it. Opening or closing the form never
   saved anything; the copy glyph on every default card did, in one tap
   with no label on a phone — it is now a labelled "save a copy" button.
4. Schedule: pick Every day / Weekdays / Every week / Every month, a day
   and a time; Loki writes the cron (lib/cron-words), with "Write it as a
   cron line instead" for experts. The schedule reads back in words with
   the time zone it runs in ("Every Monday at 10:00, Zurich time
   (Europe/Zurich)") and a link to change it; the zone is sent with the
   job. The API refuses a cron line the scheduler cannot read, in words.
   Create is the primary button and says why when it cannot be pressed.
5. Run: a prompt that names {{project_name}} asks for a project whatever
   its scope (a saved copy is global), defaulting to the project in use;
   the prompt is shown only once complete. Each action says in one line
   who does the work; Send to terminal works for any of your projects
   (tab-inject starts or queues the session) and says why when it cannot.
   Project pickers list projectTitle(), not folder keys.
6. Category chips are neutral (ui-tag-neutral); the ui-cat-* rainbow and
   the featured star's amber are gone. "control" was a second id for the
   fleet prompts — one category now, "Fleet control".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx

* fix(voice): spoken sentences start with a capital and name a repeated project once

The briefing read "one run is waiting for a builder: loki ... three runs
failed: loki, loki and loki". Sentences now open with a capital, and the
runs' projects are said once each: "Three runs failed on loki.", "Four runs
failed: loki three times and heidi once." The same for runs waiting for a
builder, agents working, and the announcements between turns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx

* fix(voice): say why the studio voice is off, with the link that fixes it

POST /api/voice/speak answered 502 with Groq's reason only in the server
console, and the phone fell back to its own voice in silence, so every voice
in the picker sounded the same. Groq's refusal is now classified
(lib/voice/tts-failure: terms gate, bad key, limit, model gone, vendor down,
no key) into one plain sentence and, where one exists, the link that fixes
it — for the Orpheus terms gate, Groq's voice page and "press Accept". The
route returns it in the 502/503 body and records it in debug_logs (once per
reason per half hour) so System shows it. The speaker reports the fallback
to the page; useStudioVoiceStatus keeps it for the tab's session and
StudioVoiceNotice shows it. The phone-voice fallback stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx

* feat(voice): change Loki's voice by saying so, and answer questions about voice mode truthfully

"I don't like your voice, can I change your voice" was answered like a
generic chatbot ("in most voice-enabled AI chat apps... look in settings").
Now "use Troy", "change your voice to Diana", "other voice" and
"switch voice" are a spoken command (config/no-screen.ts, lib/voice/commands)
that the phone answers itself; with no name it lists the voices. A question
that does reach Loki carries voiceModeContext (lib/voice/self.ts), built from
the SSOT: the voices by name, how to change one, the three switches with the
same one-line notes the screen shows (NO_SCREEN_OPTIONS), every command, the
current settings and why studio voices are off, if they are.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx

* fix(voice): a music bed a phone can actually play, and keep its sound awake

The bed sat at about -38 dBFS RMS alone and -50 under the voice, every note
98-370 Hz behind a 900 Hz low-pass: below what a phone speaker or many
earbuds reproduce, so "music bed on" was silence. It is now an octave
higher (196-740 Hz), about 12 dB louder, ducks by 10 dB instead of 11 more on
top, and earcons sit above it. The AudioContext is resumed inside the Start
tap, on every tap on the circle or headphone button, on return to the page,
and when the phone suspends it mid-session.

useSoundscape also returned a new object every render, so effects keyed on
it re-ran ~20 times a second while listening: the gain was re-ramped every
frame and the 20-second fleet poll was cleared before it could fire. It is
memoized now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx

* fix(voice): one h1 per screen, End clear of the feedback launcher, voices as an even grid

- Speaking screen: an h1 below md, where the app top bar steps aside; the
  start screen's big "Voice" is no longer a second h1 beside the top bar's.
- The speaking screen sets data-fc-place="tab", so the feedback launcher
  and its Watching pill become the slim edge handle instead of sitting on
  End; End is larger, with room below it, and the stage scrolls rather than
  pushing End off a short screen.
- The voice picker is a <Segmented> grid of four columns (seven voices as
  4 + 3, the last two cells wide) instead of a chip row cut off at the edge;
  the setting groups have real headings.
- The unclear note under the switches is one short line under each switch,
  shared with what Loki is told about itself.
- The page wires the studio-voice notice (under the picker and under the
  circle, said aloud once), the spoken voice change, the page's state sent
  with each question, and the sound resume on every tap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx

* fix(widget): one card per finding, settled page checks, honest fix status, a count that means what needs you

Watching on Loki's own /voice from an Android phone showed six problems in
one panel. Each is fixed where it starts:

- Notices no longer stack. A page's checks own ONE card (checksSlot), which
  each new reading replaces in place and a clean reading takes back
  (thread.ts pushNoticed / dropNoticed); a remark whose words are already on
  screen is not said again; a finding's signature ignores its count and its
  placeholder example (findingKind), and the card names its page.
- The heading miscount: the check counted headings inside aria-hidden and
  inert subtrees, and measured the page once, mid-swap — /voice's setup
  screen (top bar h1 + page h1) leaving for its speaking screen (immersive
  mode hides the top bar: no h1). Checks now count only rendered elements and
  run once the page has held still, twice, keeping only what both readings
  agree on (settledPageChecks / stableChecks). The Voice page itself now has
  one h1 on each screen.
- A fix Watch started that failed no longer promises it "goes live by
  itself": it says the fix did not finish, and "Open it in Loki to see why"
  is a real link to that run's Watch page (owner-view ownerTap; watch-fix
  now resolves a failed run's Watch page even without a live page).
- Self-watch: "I couldn't check on your changes just now" replaces the old
  sentence; a request that lived through the page being put away (a phone
  locking) is never a failure; background reads count only after three
  failures in a row; the changes route always answers with CORS headers and
  logs what failed.
- The header's one number is what waits on the owner's decision (failed
  attempts, saved notes, notes not started, changes said but not saved),
  counted by the server over ALL of the owner's rows, not inside the newest
  twelve; the open list shows every one of them first. Nothing waiting:
  just "Watching".
- The save receipt never quotes a cut sentence: several changes are listed
  one per line under it, clamped to whole lines with "Show all".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx

* docs(changelog): voice, Watching and Prompts fixes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-21 00:38:11 +02:00
CatoandClaude adfbdcfe07 fix(session): the builder updates, the sheet changes things, one box, a preview is the site (#1305)
The owner used Loki from a phone (2026-10-18) and could not tell whether
anything worked. Four separate faults, each passing every check:

The cloud builder ran code days behind the app. Its restart waits for
every agent to be idle, and autopilot refilled the queue the instant one
finished: ten consecutive deploys (23:38 → 09:12) found "2 agent(s)
working — deferring restart". Hence "Model: not known yet" of an answer
the screen was showing. Now, while the cloud runner's heartbeat version is
behind the deploy's, the commands route hands it no work-starting
commands (dispatch, launch_agent, auto_continue, browser_task) — a
person's own words into a session still go through — so the idle moment
comes, the restart lands, the queue resumes on the new code. Server-side
on purpose: a runner-side rule would have waited for the very restart it
was meant to allow. Control's builder line says "a newer version waits
for its agents to finish" meanwhile.

An agent renamed a preview site, committed, and reported "the work lives
only on this machine — tell Loki where this preview's remote should
live". The box contract says push or fail loudly; a preview folder is
served from disk and has no remote by design, so the change had been live
since the save and the owner read a failure and a chore. Every dispatch
to a preview folder now carries "Where this goes" (lib/previews/
delivery-note), and the contract has the same section.

The session sheet's Change and Set typed /model and /effort into the
terminal and closed; Claude Code drew its picker behind the conversation
and nothing on screen moved. Each row now lists its choices; a tap sends
the command with the choice named (/model sonnet, /effort high), the
sheet stays open and says what is changing, and settles when the log
names it. The sheet is built like the Settings sheet.

The session box had a 26px library button beside 44px round ones, a 36px
chip and a 34px Keys pill, the microphone second from the left in one
view and beside Send in the other, and "claude" on the tab beside
"Message Claude…". One row, one size, one order in both views; the
agent's name everywhere (terminal-strip-tabs badgeNames).

Widget: the owner's change list reads what needs them first (the line
counted nine, the list showed none); "9 needs you" → "9 need you"; a
failed call is named ("my call to Loki to save your note failed… Your
words are still here — press it again") instead of "one of my calls to
Loki failed — nothing for you to do".

Tests: runner-update-hold, preview-delivery-note, owner-changes-order,
session-sheet-browser (new); builder-presence, widget-changes,
widget-self-report, inject-context-boundaries extended.


Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-18 13:37:05 +02:00
CatoandClaude Opus 5.5 44def109a9 feat(widget): a spoken walk read as a list, whole sentences, talk from the launcher, per-page builds (#1302)
* feat(widget): one Talk bar, status header, read-back, per-page builds

- One Talk to Loki bar above a one-line message box; the box shows its
  tools only once used. The second Talk button in the thread is gone.
- The owner's header is the status (Watching / 2 to look at), Pause, close:
  no second logo, no page line. Opening on a phone no longer raises the
  keyboard.
- A spoken note is read back as a list per part of the page, with Read it
  back (speech) and Edit.
- Build all starts saved notes as one build per page (dispatchFeedbackBatch,
  shared with the project batch route).
- Regex literals use \u escapes; a test fails on non-ASCII in the bundle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E1qoQ9syUYXCRNbyrpqPGa

* feat(widget): a walk read as a list, whole sentences, talk from the launcher

- Loki's read of a spoken note is a list: one change or question per line,
  with where it applies, editable, ✕ to drop. The part on screen is
  background; a line names a part only when it was pointed at.
- Save files each change as its own note, with only the moments it came
  from, on the page it was said on. Questions stay on the card for Ask.
- Whisper's segments are joined into whole sentences before they are placed
  under a heading, so a sentence is never cut across two parts.
- The owner can start talking from a microphone beside the launcher without
  opening the panel (widget/quick-talk.ts).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E1qoQ9syUYXCRNbyrpqPGa

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-18 10:34:38 +02:00
CatoandClaude Opus 5.5 da75cbd356 fix(phone): one row of widget header, room to type, the tab not the pill, one menu (#1297)
* fix(phone): one row of widget header, room to type, the tab not the pill, one menu

The owner on a phone, on Loki's own Control (2026-10-18): "this looks
disgusting… why is it so crowded?"

Widget panel (owner):
- The status line IS the header: the brand row and the page name above it
  are gone for the owner (a visitor keeps them). Close sits at its end.
- The line carries one number of one named thing: "11 changes need you",
  "2 being built", "noticed 2 things" — not "4 to look at · 11 needs you".
  It wraps to a second line on a narrow phone instead of cutting the noun.
- Typing is one state however the keyboard is drawn. Loki's pages shrink
  for the keyboard (interactive-widget=resizes-content), so the inset check
  never fired, the sheet stayed at 68% of a halved viewport and the thread
  was a one-pixel sliver. A focused box now fills what is visible and steps
  the extras aside; the sheet resets on close.

Launcher: the phone bottom bar asks for the edge tab (data-fc-place="tab"),
so the "Watching" pill no longer floats over Control's cards. An open dialog
still wins over a later region's tab (resolvePlaceDirective).

One menu on a phone: the Profile/Chat/Control/Terminal strip no longer
renders below md (the bottom bar is the menu there), nor on /control, where
it named one remembered project above a page about all of them.

Control: "Default agent and model" moved into the Settings sheet the foot
already opens, and the foot is the page's last line (shown with no projects
too). The sort and Select row of the project list is desk-only.

Tests: new widget-owner-phone-browser (fails on the old header and on the
old sheet); nav-surfaces and phone-chrome guards updated to the new rules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx

* fix(widget): keep buildShadowCSS within the function-length limit

The owner-header rules took buildShadowCSS to 516 lines (limit 510); the
same rules, compacted onto two lines in the file's own one-line style.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx

* test(widget): wait for each state, not a clock, in the owner phone test

CI runs it beside every other unit test on two cores, where the owner's
changes arrive late; fixed half-second sleeps failed there (its own output
showed only a closing brace). It now waits for the status line, the typing
state and the edge tab, and prints a one-line reason last if it fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx

* fix(widget): the keyboard, not the focus, decides the typing layout

CI's fonts left the thread 44px at 320px with the keyboard up: the composer's
"This page / Point to area" row cost the room. It steps aside while the
keyboard is up, with the starters. And the typing layout now follows the
keyboard (the visible area well below its tallest), not focus alone:
Android's back key drops the keyboard but keeps focus in the box, and the
extras then come back. The phone test checks both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx

* test(widget): the thread must show what it holds, not be 60px tall

CI's thread held 44px of text and showed all 44px — content-sized, not
squeezed. The check is now what the bug was: a thread showing less than
min(60px, what it holds). The original sliver (1px of 64px) still fails it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-18 08:48:33 +02:00
CatoandClaude d079f972ab feat(widget): one widget everywhere, the state in every shape, record now and build later (#1295)
The owner (2026-10-18): the widget looked different on different pages
and sites, it should always be clear when Loki is watching, and they want
to record comments while it watches and implement them afterwards.

One widget, everywhere
- Loki's own site draws the same panel every customer site gets, not the
  chatkit view (data-fc-chat="kit" stays an opt-in).
- No Loki page hides the launcher any more: the project workspace, the
  agent conversation, inspection, the project loading state and an open
  /loki conversation were "hidden" — no launcher, or the watch top bar
  instead. They show the edge tab. feedback-widget-reach fails on any
  page that hides it, in either the literal or the expression form;
  only an open dialog and the sign-in wall may.

The state in every shape
- The owner's edge tab carries the same live dot and ring as the corner
  pill, at full weight.
- The owner's pill sits in a bottom corner or becomes the tab; it no
  longer climbs to the middle or top of the screen (Heidi at 390px).

Record now, build later
- After a voice note the owner's card leads with Save (then Fix it now,
  Ask). Saved notes lead the status line ("Watching · 3 notes saved"),
  and "Build all 3 saved notes" starts each as its own build, oldest
  first: POST /api/widget/owner/build, rule in lib/feedback/saved-notes.ts.
- The owner check for the widget's owner routes is one helper,
  lib/widget/owner-request.ts, used by owner/changes and owner/build.


Claude-Session: https://claude.ai/code/session_01E1qoQ9syUYXCRNbyrpqPGa

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-18 06:08:34 +02:00
CatoandClaude 8749efd100 feat(widget): say the state on screen, one button to open, a calmer panel (#1279)
The owner on their phone (2026-10-17): it should be clear on screen when
Loki is watching and when it is recording, opening it should be easy, and
the panel was too crowded and intimidating to use.

Watching
- The owner's launcher is ONE button that says its state in a word at
  every width: "● Watching" with a live dot and a ring, or "Paused". A
  tap opens Loki. Its second half, "Point", was the labelled, bigger part
  on a phone, so the obvious tap pointed instead of opening; pointing is
  "Point to area" in the composer.

Recording
- A red edge round the whole screen while Loki listens (it takes no
  taps; grey while it writes it down), a red-bordered dock that says
  "Recording 0:12", and a one-line hint instead of four.

The panel
- One status line instead of two rows: "Watching · 2 to look at · 4 live
  › Pause"; opening it shows what Loki noted and where each change is.
- One microphone: the header's "Voice note" and the composer's "Record"
  did nearly the same thing. "Talk" in the composer is talk-while-
  scrolling, which also covers plain dictation; in chatkit it takes the
  tool row in place of chatkit's own mic.
- "Fix it" and "Ask" instead of "Request a fix" and "Chat with Loki".
- "Continue in Loki" appears once something has been said.
- The visitor's phone launcher is 44px, the minimum tap target.

Docs (widget/README.md, docs/architecture/feedback-widget.md,
docs/development/contextual-voice-feedback.md) and the browser tests
follow the new controls; new pure helpers watchHeadline and
changesHeadline are unit-tested.


Claude-Session: https://claude.ai/code/session_01E1qoQ9syUYXCRNbyrpqPGa

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-17 20:44:42 +02:00
CatoandClaude Opus 5.5 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>
2026-10-15 10:40:11 -07:00
CatoandClaude aad44a5333 feat(widget): Loki remembers what it noticed — no second commissioning (#1132)
Watch mode forgot its own remarks the moment the tab closed: the next visit
noticed the same missing heading or the same tiny text, offered "Fix this"
again, and pressing it commissioned the same work twice. The content hash
could not catch it — every filing carries the watched steps with "(Ns ago)"
on each line, so no two filings of one finding ever hashed the same.

- A remark carries its signature as a key (widget/watch-trail.ts:
  checksSignature / noticeSignature / the read's `${path}|read`). "Fix
  this" files it with the note (`noticeKey`), and so does a failure Watch
  files itself. Ingest honours the key only with a valid owner pass and
  dedupes by it BEFORE the content hash (bumpDuplicateFeedbackByNotice):
  a second press lands on the open row and is counted, not built again.
- Migration 0090: site_feedback.notice_key + index.
- /api/widget/owner/changes answers `known`: every keyed row, open or
  settled, with the owner's own status words — beyond the twelve the
  strip shows.
- widget/known-fixes.ts (pure): the row that answers for a key (the open
  one, else the newest — an old closed row cannot silence a live fix);
  the verdict: in flight or closed → silent, live → "again", unknown →
  say; the card's chip ("Being fixed · Building", "Needs you", "Fixed 3
  Oct"). Watch looks before it speaks (awaits the first read of the
  owner's fixes, 4 s at most) and skips the model read for a page whose
  read-fix is in flight.
- The noticed card shows where its fix is instead of a second button; a
  live fix that is back reads "Loki noticed — again … It is back" with
  "Fix again". Cards follow the fix as it moves while the panel is open.
- Tests: scripts/test/known-fixes.ts (6), widget-thread (key survives a
  reload), widget-changes (route shape), and two browser cases in
  widget-watch-browser (a fix in flight is not noticed again; a live one
  that recurs says so and files its key). Changelog.


Claude-Session: https://claude.ai/code/session_01YKx4TPejLvFR9Uj4xrTf6Y

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-10 04:26:36 -07:00
CatoandClaude 8757d532b6 feat(widget): fixes go as one change, watch sees what taps do, ◎ shows Loki (#1112)
The owner, on loki.orangecat.ch from a phone (2026-10-09): "if it proposes
five fixes and I click fix, where is it going? … how do I keep track?",
"I don't know when it's noticing something", "it should be easy to draw
its attention", and the panel still had a lot going on.

- Suggested changes are ONE decision (widget/suggestions.ts): every row
  ticked, a tap unticks, "Build these 3 as one change →" files one note —
  one agent, one PR, one row in Your changes. It used to be a Build per
  row: N runs queued in the project's one lane with nothing saying so.
  The owner's builds start without a confirmation card ("Edit first"
  opens it); a visitor's still confirm.
- Your changes: one summary line that opens ("1 building · 1 in line ·
  1 live"); each row is its own link. A change waiting behind another
  reads "In line" (owner-view.ts), not "Starting".
- Watch sees what a tap DID: for 1.5 s after a tap on a button or link it
  waits for the page to change, ask the server or navigate, notes which
  ("↳ It asked the server"), and says at once — after one tap, not three
  — when nothing visibly happened.
- ◎ beside the launcher while watching: point at anything on the page,
  the panel opens with it attached.
- Phone sheet (widget/sheet.ts): drag the top up for full screen, down to
  peek at the page, further to put it away.
- Shorter greeting.
- Tests: widget-suggestions, widget-sheet, widget-changes (summary, In
  line), widget-thoughts (results); watch-browser covers the tap results
  and the one-change build. Unit 360/360; watch/embed/host-avoid browser
  suites pass locally.


Claude-Session: https://claude.ai/code/session_011L2dmcydDLYAiNQwK4XcF4

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-09 05:33:56 -07:00
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
CatoandClaude Fable 5.1 6c6380efb7 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 (#1107)
* 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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-09 04:12:00 -07:00