Commit Graph
1044 Commits
Author SHA1 Message Date
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 656f643b4e chore(hetzner): drop surf-your-life embed-backfill timer (#1089)
It needs a paid OPENAI_API_KEY the box does not have, answered 503 every
night and paged as a failed unit. Background AI spend is off fleet-wide
(the ai-digest row above was dropped for the same reason). Already
disabled on the box; this stops a reinstall from bringing it back.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 07:26:11 -07:00
CatoandClaude Opus 5.5 f6b9dd701f fix(hetzner): a sleeping app naps cleanly; ivy-health checks what Loki runs (#1087)
* fix(hetzner): a sleeping app naps cleanly; ivy-health checks what Loki runs

Sleep-when-idle stops the app with SIGTERM when its proxy idles out, and
Node exits 143. Without SuccessExitStatus systemd recorded that as
Result=exit-code, so every nap read as `failed` and paged Telegram as
"DOWN" quoting the boot banner, then "RECOVERED" on the next visit — ~10
sites flapping all day, burying real alerts. The generated app unit now
counts 143/SIGTERM as a clean stop; the test pins it (mutation-checked).

ivy-health.sh was box-only and still checked fleetcrown-app/-bridge and
the retired OpenClaw gateway, paging "DEGRADED (restart failed)" every 4h
for units that no longer exist. Versioned here, now heals postgres and the
loki-* units and probes loki-app /api/health; installed on the box.

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

* docs(telegram): register ivy-health.sh as a sender

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

* chore(hetzner): ivy-health history without the retired name

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 07:14:22 -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
CatoandCato 2f9a13ebfa chore(register): add farmaciadelparco (#1075)
Co-authored-by: Cato <catomean@users.noreply.github.com>
2026-10-07 11:25:09 -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 c9044a8151 feat(sites): sites that are not live yet sleep when idle (#1066)
* wip(sites): sleep-when-idle building blocks (not wired in yet)

Adds the status list and idle time (_box-env.sh) and the pure generators
(lib.sh: sleeps_when_idle, wake_inner_port, sleep_app_unit, wake_socket_unit,
wake_proxy_unit). Nothing calls them yet: sync-infra.sh is unchanged, so no
site's units change. Wiring them in waits on the owner's go-ahead.

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

* feat(sites): sites that are not live yet sleep when idle

Every site ran around the clock with up to 1 GB, which capped the 16 GB box at
roughly 50 sites however rarely they were visited. A site whose register status
is prospect, demo, validating or unverified now sleeps: systemd listens on its
port, the first request starts it (a second or two), and it stops after 15
idle minutes. Live sites (clients, products, evig, the 4001-4004 services) are
untouched; a row that becomes live is switched back to always on on its next
sync.

- sync-infra.sh: for a sleeping row, the app listens on port+20000 and is bound
  to <name>-wake.service (systemd-socket-proxyd --exit-idle-time) behind
  <name>-wake.socket on the public port. Caddy and deploy.sh keep talking to
  127.0.0.1:$PORT, so neither changes; a deploy's restart pulls the proxy up.
  Falls back to always on, out loud, if the box's proxyd lacks idle exit.
- install-watchdog.sh: a sleeping site is checked by its socket, not by a
  request every 5 minutes (which would keep it awake forever).
- uptime-sweep.sh: sleeping sites are health-probed on the first sweep of
  00/06/12/18 UTC instead of every 15 minutes, so botsmann's kind of outage
  is still caught within hours; certificates are still checked daily.
- Sync sites workflow: re-applies sync-infra.sh to named sites and checks each
  one answers — the rollout for sites already on the box.

Tests: test-sleep-when-idle.sh runs sync-infra and the watchdog installer end
to end against a recording ssh; test-uptime-sweep.sh covers the 6-hourly probe.

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 07:01:59 -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
CatoandCato 446549564e chore(register): add orangecat-2 (4035) (#1064)
Co-authored-by: Cato <catomean@users.noreply.github.com>
2026-10-07 05:28:01 -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 0fd886de8d fix(schema): new tables in a PostgREST schema are not public by default; refuse a deploy that leaves one readable (#1054)
apply-schema default-granted ALL on every future table in an app schema to
anon and authenticated (copying printcraft's posture). A migration-created
table has RLS off, and the anon key ships in the browser bundle, so every
new table was readable and writable by anyone through PostgREST. Found live
2026-10-06: botsmann.consultations (visitors' names, emails, messages) —
closed by hand on the DB and in botsmann#221.

- Default privileges: tables and sequences to service_role only. A table the
  anon key should reach grants it (or RLS + policy) in its own migration;
  forgetting now fails with 'permission denied' instead of publishing data.
- refuse_public_exposure on both supabase exits: a table PostgREST serves
  that anon can SELECT with RLS off fails the deploy, with the fix printed.
  Checked live: botsmann and printcraft schemas return no open tables.
- Tests: 5 new checks (54/54); reverting the default grant fails 2.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-06 07:44:30 -07:00
CatoandClaude Opus 5.5 63f1ebf4fa ops(xhiva): xhiva.orangecat.ch is the preview's name; the long one stays as an alias (#1053)
The operator, through the site's feedback button: "why not just xhiva.orangecat.ch".
The agent traced it here (its audit D8): the hostname is this row's domains column,
applied to Caddy by sync-infra.sh. Wildcard DNS already resolves.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-06 07:40:38 -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
CatoandClaude Opus 5.5 615dd2e185 feat: "Take it" README + /change "Make my own, inspired by it" (#1038)
* docs: "Take it" — MIT, a one-line clean copy, and a systems-thinking invitation

Makes taking this project as easy as using it: what it needs to run,
where its branding lives, that the shared kits need no private registry,
and three questions for people who want to build it with us. Adds
"license": "MIT" to package.json so tooling sees the licence too.

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

* feat(change): "Make my own, inspired by it" — a website address as inspiration, not a source

/change could only build a new version OF a site, keeping its brand and
content. Now the same address can seed an independent site that takes
ideas only: layout, structure, interaction, mood. The brief forbids its
name, logo, text, media, unlicensed fonts and code, and requires a distinct
name, palette and type so the result cannot pass for the original.

- WEBSITE_MODES (config/commission.ts) is the SSOT for each mode's label,
  button, reassurance line, placeholder and repo-name suffix
- WebsiteBriefBody gains mode (default "refresh", so studio intake and old
  drafts keep their meaning); the same request in two modes is two projects
- /change shows the two modes as a toggle; the draft remembers the choice

scripts/test/website-brief.ts covers both briefs, including that the
brand-keeping line never reaches an inspired build.

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

* copy(change): heading fits both modes — "Start from a website you know."

The page said "What should your website do differently?" above a toggle
whose second option builds something new from someone else's site.
Checked in Chromium at 320/390/1440: inspired toggle, address extraction,
mode-specific label and button, mode kept across reload, no overflow.

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 03:41:41 -07:00
CatoandClaude e44504dd72 feat(today): urgent first, housekeeping out of the count, one Loki button (#1035)
Measured on the phone 2026-10-04, /today opened with three buttons
(Brief Loki, Plan my day, Log a conversation) and "17 things need you":
one security hole (evig: anyone can register as Staff), seven approvals,
eight feedback reports and a site without the feedback widget, at one
weight, with the hole cut at 90 characters and no action beside it.

Needs-you tiers (lib/needs-you):
- urgent: a security flag, a dead site, an urgent alert. Shown first and
  WHOLE (full sentence, not the 90-char cut), with "Fix with Loki" (opens
  Loki with the problem written out; starts nothing until sent) and Open;
- decide: approvals, feedback, other flags. One line each, as before;
- tidy: housekeeping (missing widget). Listed on one quiet "Also" line
  with the system alerts and NOT counted, since it is real but not need.
- Headline: "1 urgent · 15 waiting on you"; plain count when nothing is
  urgent; "Nothing needs you." stays. The total is still the sum of the
  counted rows' weights (one owner, no second count).

One Loki button: "Brief Loki" and "Plan my day" asked Loki the same thing
with different context. Plan my day / Wrap up day now carries today's
facts (todayBriefFacts, shared with the brief), and SummaryBar renders
counts + that button + Log a conversation as one row.

Removed: the dead .ui-verdict-system and .ui-quick-actions-row rules.

Checks: tsc clean; eslint clean; prettier clean; design check passes;
needs-you-one-owner (new tier + headline cases), today-answers-the-question,
one-meaning-of-needs-you, today-brief pass. Unit suite 327/329; the two
failing (one-composer, priority-actually-prioritises) fail identically
on main in this sandbox, where chatkit is linked locally without React.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-03 23:59:58 -07:00
CatoandClaude Opus 5.5 8bbd66a83d feat(terminal): AI summary with one-tap next steps; Loki panel chat on chatkit (#1034)
* feat(terminal): AI summary with one-tap next steps; rail chat on chatkit

The terminal's Loki rail showed fixed phase text and only the latest Ask
answer, through its own renderer. Now:

- Summarize: the session's rendered screen (logical lines, newest kept)
  plus the run status go to Loki's Ask as a text attachment; the reply is
  a short summary and up to three '→' next steps
- each step is a chip that puts it into Inject to check and send
- the conversation is chatkit's ChatThread (history, live streaming,
  copy/stop), owned by the rail through useSessionAsk, lifted out of
  TerminalComposer
- lib/terminal-screen: one reader of the xterm grid, shared with the
  link bar's URL extraction

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

* refactor(terminal): pane actions out of TerminalSurface; the panel is 'Loki' everywhere

Main gained the Claude conversation view (#1024) whose button is
'Conversation', and the phone header already calls the run panel 'Loki'.
The desktop pane button and the input switch still said 'Chat' — two
different things under near-identical names. Both now say Loki.

TerminalPaneActions takes the status-row buttons out of TerminalSurface,
which had crossed max-lines-per-function (511/510).

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 21:11:44 -07:00
CatoandClaude 9c52553581 fix(public): readable homepage quotes, one 'Free' on pricing, a demo panel that belongs (#1032)
Found by crawling every public page at 390px and 1440px in a real browser.

- Homepage 'Notes in, fixes out' quoted a featured note sliced at 140
  chars, measurements and all, ending mid-word ('permanently o…').
  publicFeedbackExcerpt drops bracketed asides and ends on a sentence or
  a word. Pinned by scripts/test/feedback-public-excerpt.ts.
- /pricing printed 'Free' as the plan name and again as its price. The
  price is now a number: CHF 0 / mo.
- /sign-in: the demo was a bare orange stripe above the page, louder than
  the sign-in itself, and the tall page pressed its heading against the
  header. The demo is now a panel in the card's own shape, and the auth
  page has top padding.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-03 17:30:42 -07:00