Commit Graph
611 Commits
Author SHA1 Message Date
CatoandClaude e52c65af80 feat(loki): suggested replies on every Loki chat — one tap sends the likely next message (#1115)
Adopts @bitbaum/chatkit 0.6.0 (bitbaum/chatkit#13, merged as 163c879).

- askLoki/runLokiTurn take `replies`: the model is asked for chatkit's
  quick_replies block, and it is taken out of every model reply as it
  arrives (loop rounds, retries, gateway and Groq fallbacks), so it never
  reaches a work note, the grounding verifier, or the stored answer.
  Replies return separately as body.replies.
- /loki: the messages route asks for replies and stores them in
  meta.replies; the thread shows them under the latest answer with
  chatkit's ChatReplies (the separate follow-ups call is now only the
  fallback for an answer that came without them).
- Terminal Loki rail: ChatThread gets onReply; replies hidden under a
  summary that already carries its own "→" steps.
- Floating assistant: /api/loki takes `replies`; buttons under the last
  answer.
- The live preview is stripped once, in useLokiStream, for every surface;
  plainTextForSpeech drops the block so it is never read aloud. MCP, voice
  and prompt runs do not ask for replies, and a stray block is still
  removed from their text.

Fixes found on the way:
- Floating assistant printed answers as raw text (asterisks, bare [F1]
  handles): now rendered as markdown with resolved citations; multi-line
  user turns keep their line breaks.
- /loki follow-up taps were sent on "Auto" instead of the model the
  operator last chose; the terminal rail's replies reuse its last choice.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-09 06:18:35 -07:00
CatoandClaude 07b1fdee80 feat(loki-chat): a site conversation arrives as context, one primary control, a thread keeps its project (#1114)
From the owner's phone on /loki (2026-10-09): "Continue in Loki" from the
widget pasted the whole site conversation into the composer as raw "Me: … /
Loki: …" text, the model chip read "A…" and the project "kes…", a white
Talk pill outshone the send arrow beside it, and an unexplained dot sat in
the row.

- Site hand-off (lib/loki/site-handoff.ts, use-site-handoff.ts,
  SiteHandoffCard): ?q= in the widget's format is parsed into turns and
  shown where a thread would be — your words a pill, Loki's prose, a
  remark with its rule — above an EMPTY composer ("What should Loki do
  with this?"). "Take it from here" sends it on in one tap; whatever is
  typed is sent with the conversation attached once as a text file.
  The chats list steps aside while it is shown.
- One primary control: with an empty box, Talk takes the send slot (the
  same filled circle, a waveform) and the dead send arrow hides; typing
  brings Send back.
- The builder-honesty chip became a dot on the project pill (its words in
  the title); the pill's × is desktop-only (change scope by tapping it).
  The model chip has room to say "Auto".
- A thread opened by its link (?c=, Back) keeps its project — it read
  "No project — answers only" unless tapped in the list
  (initialLokiSelection).
- Tests: loki-site-handoff (agrees with widget/continue.ts byte for
  byte), loki-thread-scope. Seen on a local stack at 390×844.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-09 05:54:03 -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 c40abffc50 feat(voice): make no-screen mode pleasant to leave on — studio voice, music bed, earcons, talk-over (#1113)
A voice is a serial channel at ~150 words a minute, and an AI voice that
talks too much is the fastest way to make someone take the headphones out.
This round is the art and science of that channel:

- Studio voice. /api/voice/speak reads short pieces through Groq's Orpheus
  endpoint (lib/voice/tts.ts); lib/voice/speaker.ts cuts a briefing at
  sentence ends (speak-chunks, ≤200 chars), fetches one piece ahead of the
  one playing, decodes into the soundscape, and hands the rest to the
  phone's own voice on any failure (then stops asking for two minutes).
  Six voices + "phone" in config/no-screen.ts.
- Music the phone composes (hooks/use-soundscape.ts, numbers in
  lib/voice/soundscape.ts): six chords in D on detuned sine+triangle pairs
  through a drifting low-pass and a feedback delay, nothing above F#4, level
  0.09 at rest and 0.025 under the voice. No file, no licence, no stream.
- Earcons: rising for finished, falling for failed, a knock for something
  that needs you, a blip when a take is sent, low falling/rising for the
  line dropping and returning. Each under 0.6 s; a test pins that.
- One output: the whole graph leaves through one MediaStream that the
  media-session <audio> plays, so lock-screen controls and screen-off
  playback follow the platform's rules for a track; direct output is the
  fallback (and the public demo's mode). Never both.
- Talk-over: while Loki speaks the analyser keeps running; a burst above
  2.5× the room's bar for 350 ms cancels the voice and hands over the mic.
- Fewer, better sentences (lib/voice/announce.ts, pure, tested):
  coalesced by kind, urgency first, two or three phrasings rotated by a
  counter, "details" on request, and an "only what needs me" mode that
  holds finished runs for one sentence every five minutes. A dropped line
  is said once, and once when it is back.
- Settings on the start screen, kept per device (voice, music, talk-over,
  mode).
- /no-screen: a "Hear twenty seconds of it" demo on the visitor's own phone
  and a section on why it is pleasant.
- Essays, anyone first: a ```deep fence renders as a closed <details>
  (components/thoughts/DeepBlock.tsx); the fleet-in-your-ear essay is
  rewritten that way, style guide updated. ROADMAP + CHANGELOG.


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

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-09 05:30:30 -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 Opus 5.5 be5752994c feat(widget): one integrated panel — watch says what it sees, in Loki's own spiral (#1111)
* feat(widget): watch says what it sees, in Loki's own spiral

From the owner's phone on heidi.orangecat.ch (2026-10-09): "It's not clear
what it thinks when it watches", and the logo is barely used.

- What Loki sees: one row under the panel header ("Watching · 2 pages,
  1 tap · nothing wrong so far") that opens into the trail worded as notes
  — pages opened, taps, what the page sent, what it noticed. Each settled
  page now records a `look` step even when clean, so "looked, all fine"
  is visible instead of silent. widget/thoughts.ts (pure) +
  thoughts-view.ts.
- The status light is the logo's spiral, generated from
  src/config/brand-mark.ts into widget/brand-mark.generated.ts (the widget
  may not import src/). It turns slowly while watching, spins while Loki
  thinks (header and the pending answer), and goes still and grey when
  paused — in the launcher, the panel header and the walkthrough card.
- Loki's answers render paragraphs, bullets, headings and bold
  (widget/rich-text.ts) from text nodes — "* The headline …" no longer
  shows its asterisks.
- Tests: widget-thoughts, widget-rich-text, widget-brand-mark (drift);
  watch/embed/host-avoid browser suites pass locally.

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

* feat(widget): one surface, not a stack of boxes and buttons

"No Frankenstein elements. Integrated experience. Not a bunch of big
unaligned buttons" (owner, 2026-10-09). The panel had grown one bordered
control at a time; this is a layout pass over all of it, with one rule:
at most one filled accent button per region, every other action is
quiet text aligned in its row.

- Header: who and where, and ✕. Review and Stop watching are gone from
  it — Review is the conversation's first suggestion, and watching is
  shown AND paused from the notes row (Pause / Resume), status and its
  control together. A visitor keeps one quiet "Watch".
- Notes and Your changes are hairline strips, not nested cards.
- Thread: Loki's words are prose on the panel; yours are a pill.
  Noticed/sent remarks carry a left rule instead of a box.
- Suggested changes: a hairline list, "Build this →" as accent text at
  each row's end (was five filled buttons down the right edge). "Fix
  this →" and "Why does it matter?" sit on one baseline.
- Composer: ONE card — About tabs (underlined when chosen), the words,
  screenshots, then tools left and Build it / Ask Loki right, compact.
- Starters and links share one pill style; buttons are compact; the
  ghost button has no frame.
- Tests follow the moved controls (watch-browser: Review via the
  starter, Pause/Resume via the notes row; theme test checks the new
  rules). watch/embed/host-avoid browser suites pass locally.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-09 04:49:19 -07:00
CatoandClaude Fable 5.1 d5c6153b5c feat(voice): no-screen mode — run the fleet by ear (#1109)
One tap at /voice opens the microphone and reads the briefing; from
then on the loop is listen → transcribe → act → speak → listen, with
the phone in a pocket. Twelve spoken commands (status, what's
waiting, approve/reject by number, tell <project> to …, what failed,
pause/resume, say that again, quiet, help, end) go through the seams
the screen already uses — decideAction, injectPrompt, fleet-pause,
askLoki — so the page and the headphones cannot disagree. Between
turns the phone polls /api/voice/snapshot every 20 s and announces
the diff: a run finished or failed, a new approval, the builder
offline or back, a project starting work. Bounded to five per poll.

- config/no-screen.ts: the vocabulary SSOT, read by the parser, the
  spoken help and the public page; the test feeds every example
  phrase through the parser.
- lib/voice/commands.ts: an explicit grammar (pure, 35 checks). A bare
  "yes" is not an approval, a bare "stop" is "be quiet", a sentence
  naming no project is a question.
- lib/voice/briefing.ts: the fleet as sentences, and the snapshot
  diff (pure, 12 checks). lib/voice/fleet-snapshot.ts reads the same
  tables as Control; approvals ride only with the private zone open.
- hooks/use-voice-conversation.ts: say() for unasked lines (now while
  listening, queued while busy, held for one listen after an
  interruption) and idle: "listen" so silence re-arms instead of
  pausing. The Loki page's Talk button is unchanged.
- hooks/use-media-session.ts: a generated silent loop holds the media
  session so the headphone button is the orb tap; next = briefing.
- lib/fleet-pause.ts: resumeFleetProjects, the mirror of pause.
- /no-screen public page (nav, matcher, audit lists, copy-truth), the
  sidebar entry under Command, the demo-sandbox classification.
- content/thoughts/the-fleet-in-your-ear.md with a committed SVG, a
  sequence diagram and the seam table; ROADMAP + CHANGELOG entries.

Not yet verified on a locked iPhone in a pocket; the page, the essay
and the roadmap say so.


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

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-09 04:26:26 -07:00
CatoandClaude 6af0b11f5f fix(control,loki): an agent waiting on you says so, and Loki stops answering in fragments (#1108)
From a phone session on Skif (2026-10-09), where every surface told a
different story about one idle agent:

- Control: a live session whose agent wrote `status: blocked /
  awaiting_user` fell through to "Agent idle" and was counted idle, so
  the hero read "0 awaiting input". New `awaiting_you` state ("Waiting
  for you"), counted as awaiting input, selected first.
- Terminal sheet: the same session read "Agent went quiet · Open
  Terminal — or Retry". When the agent's own handoff (written during
  this run) says it is blocked on you, the sheet now says "Your turn",
  shows its `next:` line, and drops Retry.
- Loki answers ended mid-clause (~230 chars each): llm.ts reported
  `cutOff` from finish_reason and the loop ignored it. A cut-off answer
  now gets one retry with a larger budget; if it is still cut off, it
  says so.
- Citations: the sheet dropped answer sources, so each [F1] vanished and
  left "pickup ." — sources now travel with the message.
- The sheet shows "12s · Running list projects" instead of a bare
  "Working on it".
- Hero copy pointed to a "Needs you" panel "below"; the queue is "To
  review", above.
- Project rows: bulk checkboxes only after "Select"; the bare "On" chip
  reads "Autopilot".


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-09 04:17:24 -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
CatoandClaude Opus 5.5 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>
2026-10-08 10:17:56 -07:00
CatoandClaude Opus 5.5 6f63fd2516 fix(calendar): a booking that keeps failing stops and says so (#1102)
One approved event had its date only in the action's description. The
date rescue never read the description, and a failed booking went
straight back into a queue the drain polls every 15 s: 38,851 failures
between 2026-09-21 and 2026-10-08, a model call on every pass against
the shared free tier, and no word to the operator that it was never
booked.

- The rescue now receives the row's description (drain + in-process
  executor), so a date written there books.
- After MAX_BOOKING_ATTEMPTS (3) failures the row goes approved ->
  expired and the operator gets ONE Telegram "⚠️ Not booked" with the
  details and the reason (registered in telegram-notifications.md).
- scripts/test/booking-attempts.ts pins both halves (mutation-checked).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 10:03:40 -07:00
CatoandClaude Sonnet 5.5 fa8dbfe140 fix(terminal): tab layout and names survive reload; rename keeps spaces; launcher closes on its card (#1101)
Found by driving the live page in a browser after #1093:

- useLocalStorageState hydrated once but kept writing the CURRENT value to the
  CURRENT key. The terminal keys tab layout and names per builder and first
  renders as "cloud" before the saved source resolves to "local", so every load
  reset loki:terminal-tab-layout:local and copied the cloud alias under the
  local key. Persisting is now allowed only for a key whose own stored value has
  been read, and hydration re-runs when the key changes (canPersist/readStored,
  tested, mutation-checked).
- Renaming a tab swallowed spaces ("main loki" -> "mainloki"): a key typed into
  the rename input bubbled to the tab's own Space-to-select handler. Only the
  tab itself handles it now.
- Leaving the rename box untouched stored the (capped) label as a permanent alias.
- The "Start an agent" panel's Cancel floated detached to the right of its card;
  the close control now sits on the card.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-08 09:51:47 -07:00
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 375af60b56 fix(widget): "This is my site" signs a signed-out owner in and brings them back (#1094)
Shipped in #1092 and found on the live probe: a signed-out owner got a bare
401 (the proxy gates /api/*), and even past it the route sent redirect_url
while sign-in reads callbackUrl, so they would have landed on Loki's home
page instead of their site. The route is now on the proxy's public list (it
requires a session itself before minting anything) and uses sign-in's own
parameter. owner-note-builds pins both; it fails against the #1092 route.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 08:28:45 -07:00
CatoandClaude Fable 5.1 8ca728a649 feat(studio): the private link comes back — mailed at intake, on a later address, and on request (#1091)
* feat(studio): the private link comes back — mailed at intake, on a later address, and on request

A studio request's only credential is its private link; a closed tab was a
lost request. Now the link is mailed to the address given at intake, or
added later through a `set_contact` guest action; and `/api/studio-recover`
hands the address fresh links to every open request under it (the old
links die), answering identically whether or not the address is known.
Keys are never stored or logged — email.ts records recipient and subject.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(demo): classify /api/studio-recover for the demo sandbox; the rotation rejects a demo owner

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-08 08:18:35 -07:00
CatoandClaude Sonnet 5.5 a25cba7451 feat(terminal): drag, pin and group tabs; readable names; the miss screen stops repeating the strip (#1093)
Tabs can be arranged: drag one onto another, or Alt+Shift+Left/Right; a pin
sends a tab to the front; "Group by project" keeps one project's lanes together
with a divider between groups. The arrangement is a view preference kept per
builder in the browser; the runner still owns which sessions exist.

Names read as names: the 32-hex run suffix some dispatches append no longer hides
the part that tells tabs apart (the full name stays in the tooltip), long names
truncate, and parallel lanes carry a short run id so two of them differ.

The "No session named X" screen listed every running session a second time under
the tab strip it sat beneath, with raw ids and a paragraph of explanation. The
strip is the one place to choose; the screen now says what is true in one line
and offers the two things to do.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-08 08:11:26 -07:00
CatoandClaude Opus 5.5 6bf344efb6 feat(watch): "Not quite" and "Show me" on the walkthrough; done fixes keep Watch + Share (#1090)
* feat(watch): "Not quite" and "Show me" on the walkthrough; done fixes keep Watch + Share

Operator, 2026-10-08: "do 1 and 2" — say a fix is not quite right from the
walkthrough itself, and see an idea on the live page before it is built.

- Not quite (owner + reporter, never a shared link): typed or spoken (the
  widget's mic), filed as a follow-up on the same page. The owner's starts
  the fix at once via startOwnerBuild, now shared with Report's owner-pass
  path (lib/feedback/owner-build.ts); the reporter's goes to the inbox.
- Show me: /api/widget/preview turns the words into a few edits from a
  closed vocabulary (style, text, hide, insert, css) against the page
  outline; widget/preview.ts sanitizes them (tag/attribute allow-list, no
  url()/@import/expression, no handlers or javascript: links), applies them
  in the owner's browser only and undoes them exactly. "Build this" sends
  the words plus what the preview showed. Charged to the owner's AI budget,
  rate-limited, never available to a viewer ticket.
- Done fixes keep "Watch the fix" + Share on the row; the last card gets
  "Copy page link" for sharing the site without a walkthrough.

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

* test(owner-build): read the shared owner-build module, and pin that 'Not quite' uses it

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 08:05:18 -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
CatoandClaude Opus 5.5 9cf0711167 fix(widget): a site's widget works on every address apps.conf lists for it (#1088)
A token's origins list is written at install time; apps.conf (the hosting
SSOT) can gain addresses later. Any address added outside Loki's attach
flow was missing from the token, so /api/widget-boot answered
{active:false} there while the site's other address rendered the widget:
xhiva.orangecat.ch (apps.conf) vs the long preview host (token).

One rule, src/lib/widget/origin.ts, now used by boot, ingest, chat, advise
and transcribe (it was copied into five routes): an origin passes when the
token lists it, or when it is another apps.conf address of a site the token
already lists. Never another site's. Empty list still means any origin;
a missing Origin still passes only on boot.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 06:58:27 -07:00
CatoandClaude Opus 5.5 83199d1c68 fix(watch): a shared walkthrough never quotes the reporter's words (#1086)
The first live share (farmaciadelparco) opened by quoting the request
verbatim to whoever got the link: its typos and the owner's private
ambition ('...if we are to become the biggest pharma retailer in
switzerland'). A request is often a stranger's, sometimes rough, sometimes
private. A viewer now gets a neutral opening, the live change and the
note's plain sentence; the test pins that the request never reaches them.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 06:52:05 -07:00
CatoandClaude Sonnet 5.5 3e4bc7ff38 feat(terminal): the switcher names the agent that is running; tabs can be started, renamed and closed (#1085)
The agent switcher, the Claude | Terminal toggle and the chat view all keyed off
the project's saved preference, not the CLI running in the tab. A Claude-
preferring project with Cursor live labelled the switcher "Claude", offered a
chat view Cursor never writes a transcript for, and treated picking Claude as
"already active" - a no-op. The live CLI now decides; preference only answers
when nothing is running. A failed switch or close is shown instead of swallowed.

The agent tab strip gets what the shell workspace's already had: + starts a
session in place (the existing launcher), double-click or F2 renames (a display
name per builder; the session id never changes), and x closes with an armed
"Close?" second press because it ends a running agent. /api/control/close-tab
now honours the builder being viewed instead of always routing to cloud.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-08 06:45:08 -07:00
CatoandClaude Opus 5.5 c48ffba2ae feat(watch): share a fix's walkthrough with anyone; a cleaner last card (#1083)
* feat(watch): share a fix's walkthrough with anyone; a cleaner last card

"How can I share these?" (operator, 2026-10-08). A walkthrough is not a
video: it is a signed ticket in the live page's fragment that the widget
plays on the real site. Owner tickets last a day and carry the maintainer's
reasoning, so there was nothing safe to hand on.

- Share: a long-lived share token (own HMAC domain, 90 days) behind the
  public /w/<token>, which mints a fresh VIEWER ticket on every open and
  redirects to the live page. The viewer's story is the request and the
  live demonstration in plain words: no reasoning, PR or reporter
  screenshot. Share buttons in Loki's inbox (next to Watch the fix) and on
  the walkthrough's last card (share sheet, else clipboard, else the link).
- Same walkthrough for everyone: planned steps are kept per fix, audience
  and page outline, so a link passed around doesn't re-plan per viewer
  (or spend the owner's AI budget per viewer).
- The last card: one short question and one decision with Share beside it,
  Replay and the code change as quiet links, close as an x in the corner.
  It no longer repeats the agent's change log, and firstSentence no longer
  cuts at an abbreviation ("...115/115 browser checks incl.").

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

* style(docs): format the share sentence

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 06:19:06 -07:00
CatoandClaude Opus 5.5 edb1249552 feat(watch): Review: Loki judges what you just did on your site (#1081)
* feat(watch): Review — Loki judges what you just did on your site and suggests what to improve

Watch mode only acted when something broke. It now also notices what a
demanding reviewer would (4xx, slow requests, console errors, slow loads,
main-thread freezes, layout shift, pauses between steps) plus measured page
checks (unnamed controls, unlabeled fields, tiny tap targets, missing alt,
broken images, sideways scroll, h1/lang). The pill counts them; Review sends
the session to Ask, which judges it through errors, design, engineering,
process and product - every point cited from the session - and each change
is one tap from a request that carries the watched steps. The trail now
survives page loads within a tab, so a multi-page site reads as one visit.

No model runs until Review is pressed. The report POST is now one helper
(widget/send-report.ts) shared by Send and the automatic fix.

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

* fix(watch): Review never blames the site for Loki's own work; plain-text answers

Found by looking at the 390px render, not by the tests:
- opening Loki's own Review panel scored a 0.27 layout shift against the
  site (Chrome reports shadow-DOM sources with a null node) - only shifts
  pinned on a site node count now;
- the widget's own boot registered as 'the page froze 369ms' - a freeze now
  counts only when it overlaps the second after a tap on the site;
- the review asked for **bold** lenses and the widget shows text, so clients
  saw literal asterisks - plain-text rubric + plainAnswer() on every reply;
- '404 in 0.0s' - duration only when slow.

The browser test now proves the detectors fire on real jank (a Load more
that freezes and pushes content down) AND stay quiet for Loki's own panel.
The 'typed values never leave the page' checks were vacuous (fill() never
taps the field) - they tap the filled field now and fail under mutation.
Docs: the architecture table described Watch as 'still a seam'.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 05:46:34 -07:00
CatoandClaude 57cf15e6ba fix(deploy, projects): a hung page check no longer holds a deploy for 45 minutes; a closed run no longer reads "Building now" (#1079)
Deploy (every fleet site, via selfhost-deploy.yml):
- page-check.mjs gets one 90s deadline for the whole look. On a host that
  accepts and never answers, goto gave up at 45s and the next call waited
  on the pending navigation forever; farmaciadelparco's deploys #3 and #4
  sat in "Look at the live page before the deploy" until the job's 45m
  limit. Verified against a never-answering socket: records "did not load"
  at 90s and exits 0; a normal page still checks in ~3s.
- timeout-minutes on both page-check steps as the backstop.

Project page:
- deriveBuildStatus: agent_running=t is a live process, not a live build.
  After a run closes Claude Code idles at its prompt, so the page said
  "Building now · An agent is working" beside "Finished · PR #1 merged".
  Building now needs an open run, or a prompt given after the last close.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 13:15:24 -07:00
CatoandClaude cfadec06b5 fix(watch): keep the model-JSON reader out of the browser bundle — main failed to build (#1080)
#1077's narration hook imported lib/watch-narration, which imported
lib/ai/model-json → lib/agent/llm → db → postgres. Turbopack then tried to
bundle `fs`, `net`, `tls` and `perf_hooks` for the browser and the
production build failed, so Deploy has been red on main since af1463e.

The answer reader moves to lib/watch-narration-parse.ts (imported by the
route and the test only); lib/watch-narration keeps the browser-safe half
and now imports nothing.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 13:06:46 -07:00
CatoandClaude Opus 5.5 af1463e5a5 feat(watch): Loki narrates the build live, steer or autopilot from one card; readable screen; no false "Session ended" (#1077)
* fix(watch, terminal): readable live screen, a "What's going on?" button, no false "Session ended"

What the operator saw on a phone, 2026-10-07:

- Watch's "screen" was every spinner frame glued together ("Actioning…●✢4*✶75✻
  ✻Actioning…5✻…"). A peek is the PTY's byte buffer; deleting the escape codes
  kept every redraw. renderTerminalText now replays CR / cursor moves / erase
  sequences into the lines the terminal actually shows, and the live line names
  the real step ("Running 1 shell command…", "Writing src/app/page.tsx")
  instead of Claude Code's decorative spinner word.
- "Open the full terminal" opened a blurred page under a sheet saying "Session
  ended — its agent terminal is gone" while it was still connecting to a
  healthy session. Connecting no longer reads as gone (presentTerminalRun takes
  the real state), the sheet no longer opens by itself over the session, and
  the genuinely-lost case names a way forward with a button.
- New: "What's going on?" — under the terminal on phones, in the Loki panel
  header, and as the primary button on Watch (opens Terminal with ?explain=1).
  Loki answers for a non-programmer: anything waiting on you first, what is
  being built and how far along, an honest "Autopilot:" line saying whether it
  carries on without you, and up to three one-tap things to tell it next.
- Watch said "Working · 1 min" three times with two spinners; the activity
  fold now says when the run started. The kickoff card's four-line "Working"
  paragraph with its own spinner is one aligned line, and the pending step's
  dot lines up with the icons.

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

* refactor(terminal): "What's going on?" state, button and Loki sheet in their own module

TerminalSurface crossed the 510-line function ratchet (533). The explain
request, the sheet that carries its answer and the button now live in
TerminalExplain.tsx; the rail takes them as one `explain` prop.

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

* feat(watch): Loki narrates the build live; steer it or let autopilot drive, from one card

"Not enough magic" (operator, 2026-10-07). Watch showed a terminal's worth
of facts; a person watching wants to know what is being made for them and
whether they need to do anything.

- While an agent works, Loki reads its screen every ~30s (only when it has
  moved) and writes one plain headline in the owner's terms — "Adding the
  Team page in three languages" — with a line on what it means. Earlier
  headlines stack under it as the story so far. lib/watch-narration (pure,
  tested) + POST /api/projects/[id]/watch/narrate (AI-budget gated,
  rate-limited, degrades to the agent's own step line, never an error).
- "It needs you" appears only when the screen shows a question or a stop
  the agent cannot fix, with one tap to answer.
- The two ways to drive it, on the same card: a "Tell it something" box that
  steers the running session (tab-inject), and the project's real autopilot
  switch with one line saying what each state does.
- The old live message (typing dots, raw-screen fold, two links) is replaced
  by the card; "Look closer" opens the terminal with the explanation asked.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 12:39:02 -07:00
CatoandClaude 33eec2a538 feat(change): a free consultation before your site is rebuilt (#1076)
Naming your own website on /change used to go straight from an address to
"Build a new version". Now the address alone opens a consultation first:
Loki reads the live page the way a new visitor and Google do and says, in
plain words, what is costing the owner visitors, what is worth fixing and
what is already right, with the proof it saw and how Google shows them today.
Every finding is a fix they keep or drop, and the build can be nothing more
than "fix these" (plus their own words, now optional).

- config/site-consult.ts: SSOT for the 19 checks: area, severity, owner copy,
  business reason, and the agent instruction a chosen fix becomes
- lib/site-consult: SSRF-guarded single-page fetch (every redirect hop
  re-validated, DNS must be public; private-address guard ported from
  OrangeCat), a regex page reader, and pure rules. No model: the page is
  anonymous and must not spend the shared AI quota
- POST /api/site-consult: public, rate-limited, cached, findings only
- the build brief carries the chosen fixes as check ids, so the instruction
  an agent reads comes from config, never from the browser
- typing just an address no longer lands in "what should change"


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 12:33:43 -07:00
CatoandClaude 6bf6142b63 feat: live-fix messages open "Watch the fix"; late at night Control says go to sleep, autopilot has it (#1078)
Fix walkthroughs:
- New /feedback/<id>/watch-fix mints a fresh owner tour ticket on every
  open and lands on the live page's walkthrough (inbox when there is no
  live page or no access). A ticket lasts a day; a Telegram message lasts
  forever, so messages carry this address, not a ticket.
- notifyFixShipped: push, Telegram and the in-app alert for a live fix now
  link the walkthrough ("▶ Watch the fix") instead of the bare page.
- getFeedbackWithProject returns the project's liveUrl.

Late night:
- lib/late-night: 23:00–05:00 local, one "night" key per evening, copy.
- LateNightAutopilot on Control: autopilot off → "Hand it to autopilot and
  go to sleep" with one tap to turn it on; on → "Autopilot is on — go to
  sleep". "Not tonight" hides it until the next evening.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 11:40:54 -07:00
CatoandClaude c65ead0f6b feat(feedback): Watch the fix tells the story; the reporter gets their own (#1074)
The walkthrough could only show WHERE a change was: it had the report, the
handoff's one line and a PR title. The owner asked for how it was solved,
why so, what the alternatives were and who it helps.

- Design note: every fix prompt asks the agent for a `## Walkthrough`
  section in the PR description (problem, change, why, considered,
  helps, where, a plain line for the reporter). fix-note.ts holds the
  field list once, rendering both the instruction and the parser; the
  fix ledger keeps the parsed note on FixShipping.pr.note.
- Chapters: buildTourBeats turns report + screenshot + note + live steps
  into a ~60s story. The widget plays it with Back / Pause / Next,
  reading time scaled to each caption, the reporter's own screenshot as
  the before picture, and no second click when going back.
- Reporter audience: tour tokens carry an audience inside the signed
  payload (owner tokens unchanged, so old links still work; reporter
  tokens last 7 days). /my-feedback offers "Watch your fix" on a live
  fix. The reporter's story keeps their words, the live demo and the
  plain line — no reasoning, PR or repository.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 09:23:57 -07:00
CatoandClaude Opus 5.5 227c7529f6 fix(watch): "Chat" and "Watch it" open the agent's conversation, one tap from its terminal (#1073)
* fix(watch): "Chat" and "Watch it" open the agent's conversation, one tap from its terminal

The Watch panel's Chat button opened the general Loki chat, which knows
nothing about the run, and "Watch it" landed on whichever terminal view
localStorage remembered. The terminal page already shows the same session
as the agent's conversation or its raw PTY behind one switch; nothing
deep-linked to it.

- /terminal accepts ?view=chat|terminal; the link wins over the remembered
  view without overwriting it until the reader flips the switch.
- withTerminalView() in lib/fleet-context builds those links.
- Feedback Watch: Chat -> the run's conversation, Terminal -> the raw PTY.
- Loki dispatch card "Watch it" opens the conversation.
- Watch it work: "Follow <agent> live" beside "Open the full terminal".

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

* fix(terminal): read ?view= in useTerminalView so TerminalSurface stays under max-lines-per-function

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 09:17:32 -07:00
CatoandClaude 033edfee8b feat(terminal): one input switch on the phone; the session stays visible; suggestions read whole (#1072)
From the operator's phone screenshots of /terminal (Brave, Android):

- Two switches for one choice. Keys | Write sat on the bar and Write opened a
  second Type | Prompt switch: four combinations for "how am I talking to this
  session". The bar is now ONE switch — Type · Prompt · Keys — and tapping the
  open one closes it back to watching. That also gives the terminal back the
  row the inner switch took.
- The prompt library covered the whole session. It opens upward over the
  terminal at a flat 20rem; on a phone with the keyboard or browser toolbars
  that is every visible line. Named `.ui-picker-panel` caps it at
  min(20rem, 45dvh) wherever the picker is used.
- Suggestions that did not make sense out of context. "next best steps:**"
  was a markdown heading the bullet-strip half-unwrapped, so the preamble
  filter missed it; emphasis is now stripped before that check (Loki's
  follow-ups share the parser). Chips show two lines instead of cutting a
  sentence mid-word, and the model is asked for steps under 50 characters.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 09:12:04 -07:00
CatoandClaude f7ba763c62 fix(widget): keep the Watch-the-fix caption above host chrome (#1071)
The caption card had no z-index (only the cursor layer did), so any
positioned host element painted over it: Substrata's floating ASK button
and phone tab bar covered the card and its "Looks right" button at 390px.
The card now takes the top z-index and lifts above a full-width bottom bar,
measured from what is painted at the bottom edge.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 08:56:48 -07:00
CatoandClaude c363fb83e1 fix(mobile): hide the tab bar while typing on Android; feedback in the Menu sheet (#1069)
Two things reported from the phone on /terminal:

- The bottom tab bar floated over the Prompt box, right above the keys.
  The root viewport sets interactive-widget=resizes-content, which Chrome and
  Brave on Android honour, so innerHeight and visualViewport shrink together and
  useKeyboardInset is always 0 there — the "hide while the keyboard is up" rule
  never fired. New useKeyboardOpen also treats "a text field is focused and the
  window is much shorter than its tallest at this width" as open. Padding still
  uses useKeyboardInset, which is correct under resizes-content.

- "Why is there no Loki widget to give feedback?" There is — the unlabeled icon
  in the terminal header, and "Report a problem" behind the avatar. Neither
  reads as feedback. The Menu sheet now leads with "Feedback on this page",
  which closes the sheet first so the screenshot and point-at see the page.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 08:43:36 -07:00
CatoandClaude c58c601541 feat(records): roadmap and changelog link both ways; fleet profiles stop printing link tokens; wrapped steps read whole (#1068)
- record-links.ts wraps bip-kit 0.6.0 linkDevelopment for Loki's map types:
  /roadmap steps link to the changelog days that delivered them, /changelog
  lines name the step they delivered, each entry has an anchor.
- recordText strips {#id} tokens wherever record text is printed:
  /fleet/orangecat was showing 'Events, end to end {#events}'.
- parseRoadmapMarkdown joins a wrapped milestone's indented lines into it;
  the continuation was dropped, or taken as the goal's one-liner.
- bip-kit ^0.6.0.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 08:26:58 -07:00
CatoandClaude Fable 5.1 fb25ac6734 feat: say who you're talking to, and whether the change is live (#1067)
* fix(terminal): name the conversation after the agent in the session; "Loki" is the supervisor only

The view switch read "Loki | Terminal" (#1041). That named the coding agent's
own conversation after a different AI: Loki runs on whichever model is first
in its chain, and the thing in the session is Claude Code today, Codex
tomorrow. The operator reported the result on 2026-10-07: "there can be one
model powering the chat, and another model is open in the terminal".

- TerminalViewSwitch takes the running agent's label: "Claude | Terminal",
  "Codex | Terminal", "Chat | Terminal" when unnamed.
- "Loki" goes back to the supervisor panel: the desktop pane button and the
  session-sheet section, whose row now says it answers on Loki's own model.

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

* feat(projects): the Build strip ends on the outcome — live at skif.ch, or waiting on you

The project page knew whether an agent was working, how the last run was
graded, and (in the run's fix ledger) whether the change had merged and
deployed. It read the first two and said "work reached the repo" — true, and
not what the person who asked for the change wanted to know.

- lib/project-state-sentence: one sentence per project (headline, detail,
  tone, waitingOnYou), from the build status plus the shipping ledger. Ends on
  the outcome ("Live at skif.ch", "In review — goes live by itself", "Merged,
  but not live"), never on the mechanism; no PR numbers, CI or auto-merge in
  the words. `waitingOnYou` is true only when nothing moves until the
  operator acts — a change in review is not waiting on anyone.
- LastAttempt carries `shipping` (normalized payload.fix), and `landed`
  honours a deployed ledger, so a timed-out run that shipped is not "nothing".
- ProjectBuildStatus renders the sentence; its kicker follows the tone, and a
  link to the live site or the change sits in the text — the action slot
  stays the one button that starts work.

Control's card already shows the ledger line; Today lists only flagged
projects. Both unchanged here.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 07:12:11 -07:00
CatoandClaude Opus 5.5 5aa521e08d feat(sites): give a site its own domain — evig.orangecat.ch → evig.ch (#1065)
* feat(sites): give a site its own domain — evig.orangecat.ch → evig.ch

A site starts on <slug>.orangecat.ch. When its owner buys a domain, Loki can
now make that domain the site's address: the domain (and www. when it points
here) is served, the free address answers with a 308 to it, and the project's
live URL, production URL and widget origin list follow. Nothing the visitor
sees says where the site is hosted, and the site stays one repo, one Loki
project, on the same box.

- lib.sh caddy_vhost: the one rule for what a row's domains field means. A
  row mixing an own domain with its free host serves the own domain and 308s
  the free one. sync-infra now calls it; every existing row's vhost is
  byte-identical (pinned against the real register in test-custom-domain.sh).
- attach-domain.sh <slug> <domain> | --detach: checks DNS first (A to the box,
  no stray AAAA) and refuses with the exact records when it is not set —
  Caddy would otherwise retry a failing certificate for hours while the free
  address already redirects there. Edits the row, publishes it to main via
  the shared publish_register_row (moved out of register-site.sh), syncs,
  waits for HTTPS. Refuses the handcrafted 4001-4004 services (evig among
  them) whose Caddy blocks are hand-written.
- GET/POST/DELETE /api/projects/[id]/domain + an "Own domain" panel next to
  the live link: type the domain, see the records and whether they are set,
  connect, or go back to the free address. Studio-box gating is the same as
  site registration; everyone else gets the command.

Docs: docs/infrastructure/custom-domains.md, including why sites are not
hosted inside OrangeCat (removed 2026-08-27) and the two things a site's own
code may still need after a move (metadataBase, OrangeCat OAuth redirect URIs).

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

* fix(env): document LOKI_SITES_IP / LOKI_SITES_IPV6 in .env.example

env-example-covers-src requires every variable src/ reads to be named there.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 05:53:32 -07:00
CatoandClaude Opus 5.5 291f98adad chore(copy): bring public copy and the fleet register up to date (#1050)
- /fleet no longer says "no site yet" for loki, orangecat and bitbaum:
  a project's own live URL counts as a site when apps.conf has no row
  (they are served from the main Caddyfile), as the fleet map already did.
- An owner the register marks with "?" is never shown as a partner:
  /fleet printed "with Stadt Zürich?" for the Reparaturbonus concept, and
  the website concierge would have said "a pilot built with Stadt Zürich?".
- Loki's chat is not open-weight only: the chain is Groq (gpt-oss, qwen),
  then Google (Gemini), then OpenRouter, and llama left it in 2026-08.
  /why, /roadmap and /how-it-works now say that.
- /download: the Linux step described the AppImage chmod while showing
  the .deb install line; the update note now says .deb updates need the
  one command the banner shows.
- README: Next.js 16 (was a stale 16.2.6 pin; package.json is 16.3.8).
- packages/agent licence UNLICENSED -> MIT, matching the repo.
- CHANGELOG 2026-10-05 entry and a ROADMAP Shipped item for Make it yours.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-07 04:52:46 -07:00
CatoandClaude 9b3141ddce feat(home): "What it solves" — concrete problems for one person and for everyone (#1060)
The homepage said how Loki works but not what it is for. A new section after
"How it works" answers that in two groups: six situations one person or a
small team runs into (no code, an orphaned website, slow small changes, too
many AI tools, work that needs a human, unknown monthly costs) and six that
small organisations and the public share (sites nobody can change, open
source only coders can set up, sites broken on phones, reports that never
get an answer, AI without oversight, vendor lock-in). Each card is the
problem, what happens in Loki today, and one link to a public page where it
happens.

Copy is SSOT in src/config/problems-we-solve.ts, with the code behind each
claim cited next to it. scripts/test/problems-we-solve.ts pins unique ids,
links that resolve to public pages or real /how-it-works sections, and no
roadmap, media or local-model claims; public-copy-truth now covers both files.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 04:27:48 -07:00
CatoandClaude Opus 5.5 1632405b27 feat(projects): a project started from a brief is named after its site — xhiva, not xhiva-art-refresh-<32 hex> (#1055)
The name becomes the repo and the <name>.orangecat.ch preview, and it used to carry
the request id because it doubled as the duplicate-submit guard. The operator, on the
xhiva preview: "why not just xhiva.orangecat.ch".

- siteName(): the registrable name (no www, no TLD, two-part suffixes like co.uk off,
  accents off); "inspired" projects say so; "Make it yours" stays my-<repo>.
- firstFreeName(): -2, -3 only when the name is taken anywhere in the fleet (repo and
  subdomain are global).
- The request id moves to the project's metadata (briefRequestId): a repeat finds its
  project by id; a per-request lock covers two tabs at once.
- briefKind is recorded too, because "this is a repo copy" was ALSO read from the
  name — and it is load-bearing (empty starter, the imported repo's Actions off).
  Projects started before keep being recognised by their old name.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-06 08:00:36 -07:00
CatoandClaude Opus 5.5 e09b6fb2f6 feat(auth): OrangeCat sign-in through @bitbaum/accountkit — resolve by sub, never by email; a real error page (#1051)
Loki's OrangeCat provider kept Auth.js's default profile, which carries the
email. For an OrangeCat identity Loki had not seen, that meant: the signIn
callback looked the address up in users, PATCHED that account (image, name)
and stamped its email as verified — on the strength of an address
OrangeCat does not verify — and then the adapter refused the sign-in with
OAuthAccountNotLinked. The provider is now accountkit's (v0.2.1): same
client_secret_post, PKCE and capability scopes, and a profile with no email.

An OrangeCat sign-in resolves its user through accountkit's
withOrangecatIdentity wrapped around the Drizzle adapter, by sub alone
(users.orangecatActorId, else the accounts row of an older link). keepTokens
keeps writing the accounts row, which powers publish/promote/wallet. A new
OrangeCat user keeps its address only when no Loki account holds it; else
email stays null (never a made-up address).

forgot-password keeps Loki's rule (a GitHub/Google account without a
password may set one) but never mails an account only OrangeCat created
(lib/auth/reset-eligibility.ts + test).

pages.error: Auth.js's bare "Error" page is replaced by /sign-in/error,
accountkit's SignInError; Try again goes back to /sign-in, which starts
whichever method the person picks. Added to the responsive audit.

Password, PIN, X and demo accounts are untouched.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 07:51:16 -07:00
CatoandClaude Opus 5.5 7d3559909d fix(runner): an agent in the project's own dispatch worktree is the project's agent (#1052)
The xhiva agent ran in ~/.loki/worktrees/<project>-2ba3ac62/<runId> while 'is an
agent running?' matched only the primary checkout. A working agent read as absent
everywhere: the build card said 'no agent has picked it up, starting again is safe',
Terminal said 'session ended', Ask left it out, and the run never closed.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-06 07:36:42 -07:00
CatoandClaude Opus 5.5 9b17358aa8 feat(terminal): the feedback tool on the Terminal page — no floating button over the PTY (#1048)
* feat(terminal): the feedback tool on the Terminal page — no floating button over the PTY

From the operator, on a phone: "I don't see the button that allows me to
give feedback on elements and on the site" on the Terminal (loki#1037).
/terminal was excluded from the widget because a floating button over live
terminal output covers what you are reading — and nothing replaced it, so
the page used most on a phone had no way to report anything.

- /terminal is no longer excluded (config/feedback-widget.ts). The page
  carries data-fc-place="hidden", so the widget loads with no launcher.
- A Feedback button in the terminal header opens the panel (report a
  problem, point at an element, attach a screenshot) via Loki.report().
- lib/open-feedback: one helper for opening the panel from a control,
  shared with the account menu's "Report a problem". It now checks
  Loki.ready — the widget publishes a report() stub even when it will
  never render, so a bare "is a function" check could click into nothing;
  not ready → /support.
- Tests: feedback-widget-reach asserts the new contract; the widget's
  browser test gains the Terminal fixture — hidden launcher, report()
  opens the panel, closing it keeps the launcher hidden.

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

* test(phone-chrome): Report a problem opens through lib/open-feedback

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 10:23:27 -07:00
CatoandClaude 9faf88960a fix(take): switch GitHub Actions off on every copy before anything is imported (#1047)
A "Make it yours" copy is created in the bitbaum org and imports one of the
fleet's own repos. Those repos' workflows deploy to the fleet's box —
solon's deploy.yml on every push to main, loki's deploy.yml after CI,
orangecat's auto-merge dispatching cd.yml — and FLEET_PAT is an org-wide
secret. In the same org they would run with those secrets, so the import
push alone could ship a stranger's copy over a live product. The brief only
told the agent to remove them afterwards, which is after the push.

- provision switches Actions off (PUT /repos/{o}/{r}/actions/permissions,
  enabled:false) right after creating a copy's repo and before dispatch;
  if GitHub refuses, the step fails closed and nothing is imported
- a retry on an already-linked copy re-applies the switch-off instead of
  answering "already provisioned", so a failed attempt heals
- the brief now drops .github/workflows from the import commit and tells the
  agent never to turn Actions back on

Found by a dry run of the import against orangecat, loki and solon.
scripts/test/repo-brief.ts covers the request shape and both fail-closed
paths (403, no answer).


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-05 08:37:34 -07:00
CatoandClaude Opus 5.5 2011f31d64 feat(loki, terminal): AI next steps, one-action dispatch card, chat view's clock and mode (#1046)
* feat(loki, terminal): AI next steps, a dispatch card with one next step, the chat view's clock

From the operator, on a phone (2026-10-05): smarter suggestions, a less
confusing dispatch card, a phone layout pass, and a chat view more like the
Claude app.

- AI next steps. Once a session's screen or Claude's reply stops changing,
  the fast model reads it (POST /api/terminal/next-steps, one call per
  distinct context) and its three steps lead the suggestion row in both the
  Prompt box and the chat view. The rule-based chips show at once and stay
  as the fallback when the model is slow or fails.
- Dispatch card. "Queued · waiting for a builder · Target: loki" over
  Control state / Cloud terminal / This computer is now a headline that
  names where the work is ("Waiting for this computer"), one line on what
  happens next, and ONE primary action chosen by state: Connect Fleet Runner
  while it waits on this computer, Watch it while it runs (on the terminal
  it actually runs on), Open in Control when it failed, See the result when
  it finished. lib/dispatch-card.ts, tested.
- Chat view. The live line carries the turn's age ("2 min 5 s"), the way
  the Claude app shows it; a single tool step names itself ("Ran" + the
  command in mono) instead of "Ran a command".
- Status dots. dispatchToneDotClass returned a colour class without the
  ui-dot size, so every dispatch status line (Loki card, terminal composer,
  prompt run modal, activity retry) began with a 0×0 dot.
- Suggestion chips ellipsize instead of cutting a step mid-word.

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

* feat(terminal): Claude Code's mode beside the message box, one tap to the next

The Claude app shows Auto / Accept edits / Plan beside its composer. Loki's
conversation view now does too.

- Claude Code writes `permissionMode` on every message you send. The shared
  log reader (lib/claude-transcript, also Fleet Runner's) keeps it on user
  items; the frame route accepts it; sessionMode() reads the newest.
- SessionModeChip in the composer row: the mode as of your last message,
  and a tap sends Shift+Tab, the TUI's next-mode key. It says "Switched…"
  until your next message records the new mode. No pick-a-mode list on
  purpose: the cycle order varies by Claude Code version and settings, so a
  picker could land on the wrong mode and claim otherwise.
- Fleet Runner 0.8.40 (the runner reduces the log), with its changelog
  entry. Older runners send no mode and the chip simply does not show.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-05 07:30:27 -07:00
CatoandClaude Opus 5.5 d5719be7f9 feat(terminal): screenshots reach the agent as images — the runner writes them, Claude opens them (#1045)
* feat(terminal): screenshots reach the agent as images — the runner writes them, Claude opens them

From the operator: a screenshot attached in the Terminal's composer should
actually reach the agent working in it. It never did — it was "described"
by a free vision model first, and when those were rate-limited the agent got
"Could not analyze attached image(s): all vision models failed — HTTP 429"
(2026-10-05). Even when they answered, the agent read a paraphrase.

Claude Code reads an image file when the prompt names its path. So:

- lib/agent-attachments: an image gets a placeholder line in the prompt and
  travels with the command (pending_commands payload `attachments`);
  parseAgentImages is the runner's boundary check (uuid ids, png/jpeg/gif/
  webp, size and count caps — refused whole).
- lib/agent-attachments-fs: where the agent runs (box runner, Fleet Runner,
  or a local Loki), write each image to ~/.loki/attachments/<id>.<ext>
  (0600, outside any checkout) and swap the placeholder for its absolute
  path; a file that cannot be written becomes a sentence, never a token.
- tab-inject (Terminal composer): stageAttachmentsForAgent instead of the
  vision fold; dispatch/inject carry the images.
- Runner (poller inject + dispatch, command-validator): accept and
  materialize them before typing.
- Chat view: a message with a screenshot goes through the new
  /api/control/chat-send (verbatim inject; the keystroke lane has no room for
  a picture), replacing /api/control/fold-attachments.

Other dispatch paths (Control's orchestration run, /api/inject, feedback)
still describe images; they are not typed into a live terminal.

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

* chore(desktop): Fleet Runner 0.8.39 — screenshots reach the agent as image files

The runner now materializes attached screenshots (poller inject/dispatch),
so this change must reach machines, not only the box.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 07:16:37 -07:00
CatoandClaude Opus 5.5 5c17ad9a12 feat(terminal): one-tap next steps in the chat view too, and no fix-it chip for prose (#1044)
From the operator, on a phone: suggestions should fit what is going on and
start the work in one tap, in the readable chat view, not only under the raw
terminal.

- A tap on a suggestion now SENDS it (SuggestionChips, shared by the
  terminal Prompt box and the chat view); your own prompt is still the box.
- The chat view shows them: read from Claude's last reply while it waits
  for you (suggestFromReply), so "PR #44 open, CI pending" offers to watch
  it and "Want me to start on 1?" offers "Yes, go ahead." first.
- The error rule matched the words anywhere: an agent's finished report
  about errors it had fixed ("returned an error", "the one failure") showed
  "Fix the error on screen", and tapped, it sent a fix-it task to a session
  with nothing broken (2026-10-05). It now matches error output only —
  Error:/TypeError:, error TS…, npm ERR!, ✗, FAIL, "N failed", Traceback,
  a non-zero exit.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 06:30:56 -07:00
CatoandClaude 1138940bc2 fix(terminal): Chat in the switch, prompts that fit the screen, nav off the keyboard; questions stay questions (#1040)
From a phone report on /terminal and /loki (2026-10-05):

- The input switch ended in a "Loki" chip that opened the same panel as the
  header's Loki button; tapping it was expected to show the session as a
  conversation. Chat is now the switch's first position (Chat · Type ·
  Prompt · Voice) on phone and desktop, the chat view carries the same switch
  back, and the duplicate header chat icon and desktop "Conversation" button
  are gone. Picking an input mode also shows the terminal.
- The Prompt box offers up to three prompts read off the screen
  (lib/terminal-suggestions.ts): the PR whose CI is pending or red, an error
  on screen, a y/n question, "continue" after Completed. A tap fills, never
  sends.
- With the soft keyboard up the bottom nav floated over the Prompt box and the
  terminal was squeezed out. The nav now hides while the keyboard is up
  (fc-keyboard-open, every page), and in Prompt the key deck folds away until
  the keyboard closes.
- "Are you able to work on improving Loki in this field." was queued as agent
  work: no question word the resolver knew, no question mark, and " on " hit
  the last-resort task rule. Auxiliary-led yes/no questions are now chat, and
  the no-LLM fallback keeps questions as chat too.
- The queued-offline reply named the builder and then said "starts when a
  builder is online (cloud or this computer)". It now names only that builder.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-05 05:49:55 -07:00
CatoandClaude Opus 5.5 77ad544875 feat(terminal): attach from a phone, swipe to scroll, one bar, no dead ends (#1042)
* feat(terminal): attach from a phone, swipe to scroll, and a full screen that is full

Attaching. The paperclip on a phone opened a chooser of capture apps (Camera,
Camera, Recorder, "Photos & Videos") with no way to the screenshot: one file
input with a mixed accept. The composer is chatkit's, so the fix is there
(bitbaum/chatkit: Camera / Photos / Files sheet, one input per source) and
this bumps the pin. Control's own paperclip (attachment-strip) now renders
chatkit's AttachMenu instead of its own mixed input, and a picked PDF gets a
sentence instead of being read as text.

Attaching in the conversation view. It had attach={false}. A message with a
screenshot is folded by the same lib/composer-attachments every dispatch
uses (new /api/control/fold-attachments: the fold and nothing else) and
pasted into the session like any message. sendKey is now one serialized
chain, so Enter can never overtake a long chunked paste.

Scrolling. xterm 6 scrolls on the wheel only, so on a phone a swipe moved
nothing. lib/terminal-touch-scroll.ts turns a vertical swipe into
scrollLines, carries sub-row movement, glides after a flick, and leaves taps
alone. Verified with real xterm in Chromium under touch emulation: 0 lines
before, ~1 line per row of finger travel after. A "Live" button returns to
the newest output while scrolled back.

Full screen. Expanded kept the whole dock (two key rows, mode chips,
composer: more than half the phone), so it bought a few rows and read as
four toolbars stacked under the session. Expanded now collapses the dock to
one bar: Keys and Write open their panel on demand, Esc and Enter stay on
the bar. The phone switch drops Voice (the composer's mic dictates) and its
Loki chip (the header's Loki button is the one entry point).

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

* feat(ux): one composer per screen, one bar on the phone, no dead ends

Verified on the real app (production build, local Postgres, demo tenant,
a stubbed live session) at 320/390/768/1440: responsive audit green on
every page; screenshots of each changed surface.

Terminal, phone. Both layouts are now one bar (Keys / Write; Esc / Enter
while watching) with one panel open. The normal page opens on Write, full
screen on nothing. The stacked dock (two key rows + chips + composer) is
gone from both.

Conversation view. A builder that never sends the transcript used to show
"The conversation isn't coming through … Fleet Runner 0.8.38" — now the
surface shows the terminal for that session and drops the toggle, without
touching the saved preference.

Loki panel. A working run said it three times ("Working · 2 min" /
"Agent is working" / "Agent is generating. Inject to steer…");
railStatusLines prints only lines that add something. In the conversation
view the panel is Ask-only, so the page never shows two composers for one
session. Plain empty copy; the "Full chat" text link is an icon button.

Sheets. On a phone a bottom panel is a real sheet on the bottom edge — it
floated ~90px up, clearing a bottom nav that is hidden while it is open.

Floating clutter. The Ask Loki bubble is gone from /terminal (it sat on
the Loki panel's Send); on phones the feedback launcher hides behind the
bottom nav and "Report a problem" lives in the account menu.

Dead ends. An offline/gated terminal offers "Use this computer" and "Get
Fleet Runner" as buttons. Control's never-connected banner is one
sentence and one button: the duplicate "Start a new project" card goes,
and the five CLI installers — which queued commands no builder would pick
up — only show where a builder can act on them.

Also: no-op input-mode chips hidden in the conversation view; memory
descriptions wrap instead of a hover-only ellipsis; the responsive audit
honours CHROMIUM_PATH. Tests: phone-chrome.ts, railStatusLines cases.

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

* fix(shell): Report a problem falls back through the router, not location.assign

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

* chore(deps): pin chatkit to the merged commit of bitbaum/chatkit#7

Same tree as the branch head it replaces (5c2cdd6), which was deleted
after the squash-merge; pinning main's commit keeps the install
fetchable.

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>
2026-10-05 05:27:53 -07:00
CatoandClaude Opus 5.5 0b2dc9e96d feat(take): "Make it yours" — your own copy of an open-source project, imported and personalised by agents (#1043)
* feat(take): "Make it yours" — your own copy of an open-source project, imported and personalised by agents

/take lists the fleet's MIT projects (SSOT: config/open-source-starters.ts,
an allowlist because the brief has an agent clone the source). Pick one, say
what your copy is for, and the usual project + kickoff pipeline runs with a
brief whose first task is importing it: shallow clone, keep LICENSE, credit
the original, rename it (the original name and logo are not licensed), and
run it only on the person's own infrastructure. The imported repo's own
CLAUDE.md / AGENTS.md are written for OUR box, so the brief names them as
source material, not instructions, and has their deploy workflows removed.

- startBriefProject (lib/kickoff) is the create-or-resume + kickoff that
  /change already did, now shared by both intakes
- KickoffInput.template lets an intake that brings its own code seed "bare";
  the kickoff retry route recognises copy projects by name so a retry cannot
  seed a starter over imported code
- /take is public (proxy), in the public nav and therefore the sitemap;
  /api/projects/from-repo needs a session and is denied to the demo account

Checked in Chromium at 320/390/1440 (?repo preselects, button gated on
text, draft saved, signed-out goes to sign-in and back to /take?repo=…,
no overflow, no page errors). scripts/test/repo-brief.ts, website-brief
and project-kickoff pass; tsc, eslint and check:design clean.

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

* test(take): measure /take in the responsive audit

audit-covers-every-page requires every page to be measured or excluded
with a reason. /take is public, so it joins PUBLIC_PAGES next to /change.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-05 05:16:02 -07:00
CatoandClaude Opus 5.5 4abd1664c0 feat(terminal): one Loki | Terminal switch, drawn in both views at every width (#1041)
* feat(terminal): the dock's Loki switch shows the session as a conversation

Beside Type / Prompt / Voice, "Loki" read as a fourth way of working and then
opened a side panel about the session instead. It now switches the screen to
the session as a conversation — the chat-app view (ClaudeChatView) that was
only reachable through an unlabeled icon in the header. Where the agent writes
no conversation log (not Claude), the chip still opens the Loki panel; the
header's Loki button keeps opening the panel everywhere.

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

* feat(terminal): one Loki | Terminal switch, drawn in both views at every width

The terminal screen named two different things "Loki" and hid a third behind
an icon: a speech-bubble icon in the phone header (the conversation view), a
"Loki" header button (the run summary panel), and since the last commit a
"Loki" chip in the dock that disappeared with the dock the moment you used it.
On desktop the conversation view had no way back at all — its only entry was
a "Conversation" button inside the terminal pane.

- TerminalViewSwitch: one labelled Loki | Terminal control, current view
  marked, in the phone header and the desktop session bar.
- "Loki" now names only the conversation view. The run summary panel moves to
  the session sheet on phones and is "Summary" on the desktop pane.
- Input modes (Type / Prompt / Voice) show only in the terminal view, where
  they do something.
- Under 375px the switch drops its icons so the session name keeps its width.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-05 04:55:48 -07:00