Commit Graph
27 Commits
Author SHA1 Message Date
Cato fcd38cb463 fix(loki): clarify terminal and retire stale guidance (#866) 2026-09-23 07:58:21 -07:00
CatoandClaude Opus 5 04cedba195 Loki's public face belongs to the tenants who agreed to be on it (#798)
* fix(setup): the documented local setup produced a broken app

Followed README.md and .env.example exactly on a clean checkout and got an
app that renders but cannot read a session. Three separate gaps, each on the
documented path:

- AUTH_TRUST_HOST was undocumented. src/auth.ts gates trustHost on it, and
  scripts/hetzner/gen-env.sh writes it on the box — but .env.example, the
  README's "minimum local .env.local", docker-compose.yml and loki-app.sh all
  omitted it. Unset, Auth.js answers EVERY /api/auth/session with 500
  UntrustedHost. Verified: 500 before, 200 after, nothing else changed.
  The auth.ts comment claimed the local production server set it; it did not.

- The compose db image has no pgvector. knowledge-embeddings.ts declares
  vector(384), so `drizzle-kit push` dies on the first table with
  `type "vector" does not exist` and leaves an EMPTY database — which reads
  like a broken checkout rather than a missing extension. Switched to
  pgvector/pgvector:pg17 and added an initdb script that creates it before
  the migrate service runs.

- drizzle.config.ts never loaded .env.local, though a dozen scripts under
  scripts/db and scripts/test do. `pnpm run db:push` therefore threw
  "DATABASE_URL is required" at someone who had just set DATABASE_URL where
  the README told them to. An exported variable still wins, so CI and the box
  are unaffected.

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

* fix(projects): the empty state named a button that does not exist

A new account with no projects is told to "Register your first project with
'New project' above". There is no "New project" control on the page — the
button reads "Add", and the dialog it opens is titled "Add Project". The
component file is called NewProjectButton.tsx, which is most likely where the
copy came from.

Found by signing up as a new user and following the onboarding instruction
literally: the first thing the product asks you to do names a control you
cannot find. Now says "Add", matching what is rendered.

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

* feat(fleet): a project reaches Loki's public catalogue only by consent

/fleet is unauthenticated and speaks for the PRODUCT, not for a user. It
resolved a single account — getSelfImprovementTarget(), "whoever owns the
oldest entity named loki" — and published every project that account had.
Two things were wrong with that in a multi-tenant product:

  1. No decision was ever recorded. A project was on a public page because it
     existed. Every other public surface here already goes through
     getPublicProjects (the landing hero, /u/[username]); /fleet was the only
     one reading the unfiltered query.
  2. WHICH account got published was a side effect of the self-improvement
     loop's notion of "which product am I improving". Reseed that entity and
     the next-oldest match's whole project list becomes Loki's front page.

So consent is now a stored property of the project:

- user_projects.listed_publicly, DEFAULT FALSE. The default is the point —
  signing up must never enrol a tenant in the product's shop window.
- getPubliclyListedProjects() reads consent instead of ownership, across all
  accounts, which is also what makes the page meaningful with more than one
  user. /fleet no longer selects by owner at all.
- A per-project toggle on the project workspace, beside the existing
  "Publish to OrangeCat" opt-in and reversible from the same control.
- 0075 backfills the account publishing the catalogue today, so the live page
  is unchanged for it while everyone else starts at false.

Also: FleetRegisterNote told EVERY account "19 sites are hosted on the box
with no project here" — apps.conf describes one box and is a file in this
repo, so a brand-new user was being told about sites they do not own. It now
renders only for the account that operates that box.

A user's own profile (/u/[username]) is deliberately untouched: that page is
the user speaking about themselves, and it was already scoped.

scripts/test/public-catalogue-consent.ts pins all of it — swapping the query
back is a one-word change, and a comment cannot hold that line.

Verified against a real database: consent false -> absent from /fleet,
true -> present, toggled both ways through the UI.

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

* feat(public): what a signed-out visitor sees is a decision, not an accident

Answers "whose projects does a stranger see on Loki?" — with three tiers
instead of three different hardcoded owner lookups.

THE PROBLEM. Loki is multi-tenant and the founder is tenant #1, but every
public surface resolved an owner and published whatever that account held:

  - the landing hero  → getHeroFleetSnapshot(getDefaultUser())
  - /fleet            → getSelfImprovementTarget()  (fixed in the last commit)
  - the /projects note→ nothing at all

Three answers to one question is three chances to be wrong, and the landing
was the worst of them: it never consulted consent at all. Verified locally —
a project with listed_publicly = false was rendering in the hero console.
It also ordered by a hardcoded FLAGSHIPS = ["loki", "orangecat"], the ad-hoc
version of "featured", which could only ever name the founder's own projects.
The same list sat in /u/[username], where it reordered EVERY tenant's profile
by two names they will never have.

THE MODEL. src/db/queries/public-visibility.ts is now the one place that says
what a signed-out visitor may see:

  1. AGGREGATE  — fleet-wide counts. Identify nobody, need no consent, and
                  grow honestly as Loki gains users.
  2. CATALOGUE  — /fleet: projects whose OWNER opted in (listed_publicly).
  3. SHOWCASE   — landing hero: the catalogue narrowed to what the OPERATOR
                  featured (featured_at). Curated space cannot be first-come.

Two gates because they answer to different people: consent is the tenant's
and may be withdrawn; featuring is the operator's editorial act. The showcase
predicate is BUILT ON the catalogue predicate, so revoking consent drops a
project off the homepage immediately even while it is still featured —
verified all three ways against a real database.

This is the doctrine site_feedback.featured_at already had ("raw visitor text
NEVER auto-publishes"). Projects now work the way feedback already did.

Featuring is authorized by isSiteOperator (users.is_default — the account made
at /setup, so it means "runs this instance" for self-hosters too) and lives on
its own query rather than riding patchProject, because it is the one project
field a tenant must not set for themselves. It also refuses to feature a
project whose owner has not consented.

UI: two separate controls on the project workspace, deliberately not merged —
"List publicly" (owner) and "Feature" (operator, shown only to them, and
explaining itself when consent is missing).

ALSO, from auditing the public pages at 320/390/768/1440:

- /fleet had 19 sub-44px tap targets — every one the site address that is the
  whole point of the row, and the only sub-44px targets left on any public
  route. .ui-public-fleet-site was missing from the touch floor AND was an
  inline box, where min-height does nothing. Both fixed; now zero.
- The responsive auditor EXCLUDED public routes, deferring to `smoke` "which
  already covers them" — smoke asserts HTTP status, which says nothing about a
  layout. So the pages a stranger sees first were the only ones with no
  responsive coverage. They are in the auditor now and need no session, so a
  session is required only when authenticated pages are requested.

No horizontal overflow at any width, before or after.

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

* fix(fleet): a phone spent a screenful on filters before the catalogue

Measured at 390x844: the first project row sat at y=1020px. Four facet rows
(Where / Kind / For / Missing) took 366px of that, so you scrolled past more
than a screen of controls before seeing any of the thing they control — on a
page whose entire job is to show a catalogue.

The rows now live in a <details> that is collapsed below md and forced open
from md up, so desktop is unchanged and the phone leads with content:
first row y=1020 -> 699. The summary carries a count of active facets,
because a filter you cannot see is one you forget you set — and then an empty
result reads as a broken page rather than a narrowed one.

<details> rather than state, because this page deliberately ships no
JavaScript ("the address bar is the state") and a filter panel that needed a
bundle to open would be the one thing on it that did.

One trap worth recording: hiding the closed panel has to be EXPLICIT. The UA
sheet hides a closed <details>'s children with display:none, but author styles
outrank the UA sheet and .ui-fleet-facet-row is `@apply flex` — so the first
version rendered a toggle that changed nothing, with the element correctly
reporting open=false while all four rows stayed visible. Verified both states
at both widths after the fix.

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

* feat(public): credit the builder, ask before publishing, stop renting the box

Four things, all following from the same rule: Loki is multi-tenant, so its
public face belongs to the tenants who agreed to be on it.

1. ATTRIBUTION. A showcased project now carries a byline — @handle linked to
   /u/[handle], display name when there is no handle, and NOTHING when there is
   neither, because a stand-in label is a name we would be inventing for
   somebody. Showing a tenant's work unattributed reads as "our projects",
   which is untrue and is the opposite of why a showcase exists; being credited
   and linked is also most of what a tenant gets back for consenting. Joined in
   the query rather than fetched per row.

2. LOKI ASKS. Consent was reachable only from a toggle nobody knew about, and a
   control nobody finds collects exactly one answer. The empty catalogue that
   follows is what gets "fixed" by widening the query again — the bug 0075
   removed. So the project workspace now invites the owner once, and
   listing_prompt_dismissed_at takes no for an answer: per project (declining
   for a client build says nothing about the open-source one beside it) and in
   the database (a refusal that resets on a new device is a product that nags).
   The rule lives in src/lib/listing-invitation.ts, pure and unit-tested. The
   bar is repo + active, deliberately NOT a live URL: /fleet's own facets list
   "Being built" beside "Live", so requiring a deployment would ask only the
   projects that least need the exposure.

3. THE BOX IS NOT THE FLEET. apps.conf describes ONE box and is a file in this
   repo, and unmatched entries MINTED rows — so a Loki with one consented
   project still published 19 sites belonging to someone the viewer has never
   heard of. buildFleetRegister now takes includeUnlinkedSites, true only for
   the operator, for whom those rows are the entire point (the register read
   sideways is a to-do list). A hosted app still ENRICHES a project that
   exists, so a consented project keeps its real address either way; only row
   creation is gated, because only row creation publishes something nobody
   asked to publish. Verified: operator sees 20 projects / 19 sites, the public
   sees 1 / 0.

4. THE COPY. "This is the studio's whole catalogue" was true when one account
   was the whole fleet. It now says what the page is: projects their owners
   chose to show.

Also, from re-auditing: .ui-public-fleet-name (the row's PRIMARY link) measured
21px tall on a phone. It had been invisible to every previous audit because
while the page listed hosted sites alone, nothing in a row was a link at all —
the fix in 3 is what made a real project row render and the gap appear. Same
cause as .ui-public-fleet-site last time: the coarse-pointer floor sets
min-height, which does nothing to an inline box.

Every public page: zero horizontal overflow and zero sub-44px targets at
320/390/768/1440.

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

* fix(home): the hero console had an empty third column

Making the hero tenant-agnostic dropped "runs this week", because the old one
counted getRecentOrchestrationRuns(userId) — one account's week, which is not a
number a visitor should be shown. But the console's metric row is grid-cols-3,
so removing it left a visibly empty third of the panel. Caught by looking at
the rendered page rather than the diff.

Restored fleet-wide, counted the same way as the other two: it is the metric
that answers "is anything actually happening here", and an aggregate across
every tenant identifies nobody, so it needs no consent and grows with the
product instead of describing one account.

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

* fix(footer): the studio's sites were labelled as Loki's fleet

Every public page's footer lists 14 sites generated from apps.conf under
"Part of the fleet — 14 more sites". apps.conf describes ONE box, the
studio's, and several of those sites belong to clients — so on a multi-tenant
Loki the label told every visitor that one account's client work was what Loki
is. Same error as the /fleet lede, and the same fix: say whose they are.

"Built by the studio" now, and the link beside it points at the tenants'
catalogue by its real name rather than calling it "the whole register".

Deliberately a COPY change and nothing more. The links themselves stay, all
14 of them: they are real work, several had no inbound link from anywhere
before this block existed, and the cross-linking is the entire reason it is
here. Removing them would trade a genuine asset to fix a sentence. Only the
claim was wrong.

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

* fix(home): the hero console looked broken with nothing featured

0076 deliberately does not backfill a feature stamp — featuring is an
editorial act nobody has performed yet — so the live hero will really render
with zero project rows until someone features something. I had asserted that
was fine without looking at it. It was not.

The bar carries mb-4 + border-b and the metrics carry mt-4 + border-t, so with
no rows between them the panel drew TWO horizontal lines with 32px of nothing
in between: the shape of content that failed to load, on the first screen of
the product.

The metrics now sit flush under the bar's own border in that state, which is a
panel with nothing to list rather than a panel that broke. Verified in both
states: with rows the divider is back and the flush class is absent.

Not fixed by falling back to showing consented-but-unfeatured projects, which
was the tempting option: the invitation asks permission for the public fleet
page specifically, so putting those projects in the hero would take more than
the owner agreed to.

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

* fix(fleet): an empty catalogue told visitors to clear filters they never set

With nothing listed, /fleet rendered "Nothing matches that. Clear the filters →"
— to a visitor who had set no filters, offering a link that changes nothing.
That is the FIRST thing a freshly self-hosted Loki ever says on that page, and
it reads as a fault rather than an empty shelf.

Two states now, told apart by `rows` (the whole catalogue, before the query)
rather than `result.rows` (after it):

  nothing listed at all → says so, and says why: owners choose which of their
                          projects appear, and nothing is published without
                          them saying so. Links to what Loki does.
  filtered away        → unchanged: "Nothing matches that" + clear the filters.

Found by putting the local database into the state a new install starts in,
rather than only the state mine happened to be in.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-20 06:30:17 -07:00
CatoandClaude Fable 5.1 95c40a9cd8 refactor: rename the product from FleetCrown to Loki (#695)
The product, its assistant, the repo, the host and every unit on the box now
share one name. 638 files, ~3,000 mentions: UI copy, config, env keys
(FLEETCROWN_* -> LOKI_*), systemd units (fleetcrown-* -> loki-*), docs,
articles, the deploy workflow other repos reuse, and nine file names.

- Three article slugs carried the old name and had been shared; permanent
  redirects keep those links alive (next.config.ts).
- test-no-retired-name.sh now also forbids the old product name across the
  whole repo, so the rename cannot creep back through templates and examples.
- ASSISTANT_STACK collapses the product and the assistant into one entry,
  because they are now the same name.

Infra was cut over ahead of this merge: /opt/loki, loki-* units, the `loki`
database and role, loki.orangecat.ch (old host 308s to it; /api, /widget,
/embed keep proxying), GitHub repos bitbaum/loki and bitbaum/loki-releases.
The Resend sending domain stays fleetcrown.orangecat.ch until the new domain
is verified in DNS.


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

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-13 16:13:10 -07:00
CatoandClaude Fable 5.1 6e6ca0bc7a docs(cloud-primary): nothing left that describes the old substrate — docs, marketing, comments, focus_tab (#631)
* docs(cloud-primary): nothing left that describes the old substrate — docs, marketing, comments, focus_tab

The cloud-primary series (#615 routing, #618 OrangeCat auto-kickoff, #624
Fleet Runner 0.8.19, #630 web PTY-only) changed what the product IS. This
sweep makes every surface that describes it say so, so neither an agent
reading the repo nor a person reading the site is told about zellij tabs,
presence-based routing, a cold-start restore, or a handoff that "starts
nothing".

Inventory-driven (≈105 doc lines, ≈30 user-facing strings, ≈22 code
comments, 2 repo-level items), not a grep-and-replace:

User-facing
- /download prerequisites: the "Zellij — bundled" card is gone; copy says
  each agent runs in a terminal Fleet Runner owns.
- Quickstart, license page, executor copy (cloud is the default; "This
  computer" is a per-project choice under Runs on), marketing pillars,
  whitepaper (owned-PTY design, "where a project runs is a decision, not a
  guess", ZSH typing-guard section deleted), Control terminal panel strings
  (components renamed LiveTerminalPanel / LiveTerminalRows), peek drawer
  copy, GitHub release notes for 0.8.19, repo description + topics.

Agent-facing
- README, CLAUDE.md, AGENTS-adjacent SSOTs: cloud-local-workflows.md now
  states the stored routing rule; priority plan closes B6; multitenancy plan
  routes by builder_pref; HANDOFF.md staleness table + terminals section;
  the 2026-09-10 cold-start handoff gets a dated "superseded" section; the
  two shipped proposals (fleet-runner-pty-ownership, desktop-app) carry a
  status banner; home/README describes the eight modules that exist;
  desktop/README describes 0.8.19; roadmap seed marks the migration done;
  box-runner unit and log drop FLEETCROWN_RUNNER_PTY; 22 code comments.

Code (one coherent retirement)
- focus_tab is removed from the pending-command contract, the desktop
  validator and poller, enqueueTabCommand's type, the validator test and the
  failure classifier (START_SESSION | RETRY). The runner had rejected it
  since 0.8.19; now it cannot be enqueued at all.

Verified: tsc, eslint, 148/148 unit files, 130/130 home self-tests,
check:desktop (typecheck + build).

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

* chore(desktop): 0.8.20 — the focus_tab retirement touches desktop/, so it ships as a release

The release-drift gate is right: a desktop change without a bump goes red on
main once the next tag is minted. 0.8.19's changelog date is corrected to the
release's real publishedAt.

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

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-11 02:41:20 -07:00
CatoandClaude Fable 5.1 a1aed85daa fix(cold-start): a brief becomes a repo and a live site through the normal path (#569)
* fix(cold-start): the starter ships a lockfile, so its first Deploy can install

selfhost-deploy.yml refuses to install without a lockfile and installs with
--frozen-lockfile; the Next starter declared pnpm and shipped no lock, so every
fresh site failed before building. The lock is resolved once by
scripts/templates/refresh-starter-lock.ts into a generated asset and seeded
with the starter (one Git tree call, no pnpm on the app box).
scripts/test/starter-lock.ts fails on drift, missing standalone output, a
missing packageManager, or starter docs that point at npm.

Seeding failures are recoverable: provision on a linked but bare repo re-seeds
it instead of refusing with 409. The starter embeds the project-scoped
feedback widget from its first commit.

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

* fix(cold-start): liveUrl means a Deploy on the current commit and a public 200

Registration persisted liveUrl because register-site.sh exited 0 with
--no-deploy. Now: strict setup, then a workflow dispatch; GET reports
pending/failed/live and the UI polls it. describeSiteDeployment (pure, tested)
treats a queued run or a just-sent dispatch as starting, closing the race where
the first poll after dispatch read as "no deployment exists". A status the
client cannot read is shown as a failure, not swallowed.

The deploy workflow resolves a freshly registered slug from the box register
and proves the checkout belongs to the caller; deploy.sh builds with the same
package manager that installed; register-site.sh runs release siblings, locks
the register, fails without a deploy secret, and seeds a runtime env.

check:deploy-ready no longer reads a box-registered checkout as laptop drift.

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

* fix(feedback): Implement addresses the project id, never a same-named tab

Feedback and kickoff dispatch resolve user_projects by stable entity id; a
renamed project or a same-named sibling can no longer redirect a run, and the
hosted fallback is off for actions tied to a tracked run. Batch Implement only
advances when a run was accepted. Fix prompts require the normal ship path and
live evidence; Resolve stays with the operator.

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

* docs: FleetCrown builds independently; tab names are transport, not identity

Product copy and agent docs describe FleetCrown as an independent product with
optional OrangeCat linking that is not publication consent. Control drops the
Focus terminal chip (Open terminal stays). Adds the cold-start handoff.

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

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-10 12:51:11 -07:00
6b653c36d6 docs: sync docs with actual stack (#487)
The repo moved to pnpm 11.25.0 (packageManager, pnpm-lock.yaml, CI and
deploy all pnpm) but 17 docs still taught npm commands. Sync every
current-instruction command to pnpm (`npm run` → `pnpm run`,
`npm install` → `pnpm install`, `npx tsx` → `pnpm exec tsx`, and
`db:apply-box -- <file>` loses the `--` separator under pnpm).

Deliberately kept: npm inside desktop/ (own package-lock.json, installed
via `npm ci` in desktop-release.yml and check-desktop.sh — excluded from
the pnpm workspace); `npm i -g openclaw` (box-global install); dated
historical audit/log entries that record runs made under npm.

Also in docs/infrastructure/self-host-cd.md: the pipeline diagram said
`npm ci` where selfhost-deploy.yml detects npm/pnpm per lockfile, and the
`node-version` fallback is 24 (doc said default 20); documented the
`package-manager` override input.


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

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-09-04 14:47:12 +00:00
Cato 73a5f656ed docs: drop revenue/user-count disclosures from public README 2026-09-03 14:05:44 +00:00
G 977ba4713e docs: label monetization as planned/not billed; no paying users 2026-09-03 09:34:42 +00:00
GandMao Nakamoto c41c1809e2 feat(widget): speak your feedback — plus the signals, escaping and docs that were lying (#462)
* fix(email): escape visitor text before it reaches an email body

feedbackShippedTemplate interpolated `excerpt` and `page` raw. Both are
visitor-authored — excerpt is the free-prose suggestion typed into the
widget on a customer's site, page is location.pathname read off that
site — and the resulting HTML is mailed from our own domain to an
address the same visitor supplied.

operatorMailTemplate, four lines below, escaped correctly with an inline
replace-chain. That is the tell: escaping was something each template had
to remember separately, and this one forgot. rss.xml had a third copy of
the same chain.

So the escape is now a named helper both callers share, covering the five
XML predefined entities (the two extra quote forms make it safe in an
attribute as well as a text node, so no caller has to pick a variant).

Also makes the templates importable without a database. logSend's
debug-logs import opened a DB client at module load, which every pure
template in the file inherited — the reason none of them had tests. It is
deferred into the function now; sending logs exactly as before.

Proven by mutation: reverting the escape turns exactly the three
injection assertions red, not the whole file.

* fix(feedback): stop a failed request from answering "nothing needs you"

Three surfaces read an empty array as an empty queue. An empty array is
also what a failed fetch leaves behind, so a 500 or a timeout rendered as
the confident answer "there is nothing here" — on the exact screens an
operator checks to be sure nothing is waiting.

- ControlInbox returned null when total === 0, so both fetches failing
  produced total silence. It now stays quiet while requests are still in
  flight (a failure that resolves fast should not flash), and once they
  settle with nothing, says which of the two happened. When one list
  loads and the other does not, the count renders with a note that it
  may be low rather than presenting a partial total as complete.

- FeedbackInbox dropped `error` from useFetch entirely and fell through
  to "No feedback yet". The load error is now aliased `loadError` —
  `error` was already the mutation error from useFeedbackActions, and
  that collision is how the load error came to be dropped.

- ProjectFeedbackSection treated a failed token GET as "no token", which
  offered "Enable & install" for a widget that may already be live on the
  customer's site. Not knowing is now its own state.

Every new branch is reachable only when a request actually failed; the
genuine empty states are untouched.

* feat(widget): let visitors speak their feedback instead of typing it

Typing a bug report on a phone, on someone else's site, is where most
reports die. The widget now offers a mic: record, the clip is transcribed,
and the text lands in the same textarea appended to whatever was already
typed. The visitor still presses Send — speech-to-text mishears things,
and a mic that auto-sent would file those mistakes under their name.

FleetCrown already had working transcription (terminal, Loki composer,
command palette) but the widget never got it. Two things were missing:

- CORS. /api/beacon/transcribe is public but answers no preflight and
  sets no ACAO, so a cross-origin caller can never read the response.
- Authorization. That route takes no token — it is guarded only by a
  per-IP limiter. Opening it cross-origin would have made it an
  anonymous endpoint that spends our Groq quota for anyone with the URL.

So this adds /api/widget/transcribe rather than widening the beacon
route: same fcw_* token that already authorizes ingest, same per-token
origin allowlist, per-IP and per-token rate limits, and Groq only — the
local-Whisper fallback spawns ffmpeg + python3 on the host, which is not
something to expose to anonymous traffic. The Groq step itself moved to
lib/transcribe.ts so both routes share one implementation instead of
growing two copies of the error mapping.

Also in the widget, from the same audit:
- Recording stops and the mic is released when the panel closes, so the
  browser's recording indicator never outlives the panel on a host site.
- Sub-44px touch targets (the 18px remove-image dot, attach button) get
  a coarse-pointer hit area without changing how they look.
- The pulsing record dot honours prefers-reduced-motion.

Progressive enhancement throughout: no MediaRecorder, or an insecure
origin where getUserMedia is undefined, renders no button at all rather
than a control that cannot work. Bundle 16.3KB -> 20.8KB.

/api/widget is classified "spend" in the demo sandbox — the repo's own
gate caught that omission before this commit existed.

* docs(claude): correct the claims that were sending agents the wrong way

CLAUDE.md is loaded into every agent session, so a false line in it is not
a stale doc — it is an instruction. Each of these was verified against the
code in both directions before editing.

- Session helpers. It named `getCurrentUserId()` and `DEFAULT_USER_ID`;
  neither has existed since 98e88b65. Zero hits in src/. The real API is
  `getApiUserId()` (routes) and `requirePageUserId()` (pages), 64 files.

- The executor model. It said home/ runs on the user's machine "not the
  hosted box", and that Fleet Runner desktop is the "sole" local executor.
  scripts/box-runner.ts is a systemd service ON the box that imports the
  same startWatcher, added in b62e3aeb to delete the laptop dependency,
  and is the DEFAULT per this repo's own SSOT. A third executor,
  scripts/hosted-runner.ts, also exists. Neither was mentioned. An agent
  reading the old text would reason about the wrong machine.

- Husky hooks. Documented as pre-commit tsc+eslint / pre-push test:home.
  Actually pre-commit is eslint on staged files with no tsc, and pre-push
  runs the whole `npm run verify` bundle plus smoke and prod dogfood. The
  practical consequence — pre-push takes minutes — is now stated.

- Dark mode. "always dark mode (.dark on html)" is not true: ThemeProvider
  sets defaultTheme="dark" and a ThemeToggle ships in 8 places. Light is a
  real state, so the old advice to lean on text-white/* would break it.

- Six named components do not exist (ProjectTile, AutopilotCard, PromptRow,
  FeaturedCard, CategoryBar) or survive only as type names
  (ProjectGrid/ProjectDetail). Replaced with what is actually on disk.

- /feedback had no row in the Views table and widget/ had no entry at all,
  despite being a top-level nav surface and the only code strangers on
  other people's sites execute.

Also closes the gap that let widget/ drift unnoticed: `npm run lint` now
covers it alongside src/ and home/. It passes clean today, so this costs
nothing and stops the next regression rather than documenting it.

* docs: delete the agent CLI registry spec

Three independent reasons, any one sufficient:

1. It contains a slur — "A new engineer (or the 'retard' user)" — in a
   public repo. That alone is not something to leave sitting in docs/.

2. Every script it analyses is gone: scripts/cockpit-daemon.sh,
   agent-hook-lib.sh, agent-hook-bridge.sh, and the _agent_definitions.sh
   it proposes creating. Its "high duplication areas" list describes a
   codebase that no longer exists.

3. Its central decision is now false. It names src/lib/agent-registry.ts
   the "Primary SSOT"; that file's own header says it is a compatibility
   shim over src/lib/agents/, kept only for back-compat, and that new code
   should import from @/lib/agents directly. An agent following this spec
   would extend the shim it is supposed to be migrating off.

The refactor this document proposed did happen — differently and better
(per-agent adapter modules, ~300 lines removed). The plan that lost is
not worth keeping as a description of the system that won.

README's link to it goes too, so the docs index has no dead entry.

* docs(widget): stop the architecture note describing a system that moved on

Corrections, each verified against code:

- It said "No rate limiter exists in FleetCrown yet — port revampit's".
  src/lib/rate-limit.ts exists, is owned by the shared limitkit package,
  and is already imported by the ingest route the same document describes.
  Left alone, that bullet is an instruction to write a second one — the
  precise mechanism by which this fleet accumulated 14 rate limiters.

- The API table listed 5 routes and omitted GET /api/widget-boot, which is
  the render gate, the remote kill switch, and the heartbeat behind the
  "Live" badge — i.e. most of what the surrounding prose sells. Added,
  along with the new /api/widget/transcribe pair.

- It claimed /widget.js is "immutable-cached with a version query". There
  is no version query and no cache rule for it; next.config.ts sets those
  for /sw.js only. The "upgrades ship centrally" story rested on caching
  behaviour nobody configured.

- Screenshot capture, the submitter email loop and auto-triage drafts were
  all listed under "Later (not now, YAGNI)" and "not in v1" while being
  shipped and documented elsewhere in the same file.

---------

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
2026-09-02 09:27:19 -07:00
3671cef194 fix(staleness): stop shipping claims the product outgrew (#339)
Whole-repo staleness sweep. Every item below was verified against the live
system, not inferred:

- /download hid working installers. macOS and Windows were pinned
  status:'comingSoon' behind comments asserting 'the latest release has no
  mac asset' / 'No Windows asset yet'. Both false since v0.8.11 (2026-08-04);
  the hardcoded URLs already resolve — probed HTTP 206 for
  Fleet-Runner-mac-arm64.dmg and Fleet-Runner-win-x64.exe on the latest
  release. The repo contradicted itself: /releases has said the
  three-platform matrix was restored for three weeks.
- /investors claimed 'Signed multi-OS installers' while /download tells users
  to bypass Gatekeeper because we are not code-signed. Now says 'Multi-OS
  installers (Linux, macOS, Windows)'.
- SECURITY.md said 'This is a private repository' and built its disclosure
  flow on that. The repo is public (gh: visibility PUBLIC), so the
  instruction pointed reporters at the wrong channel — now private
  vulnerability reporting / email, and an explicit 'do not open a public
  issue'.
- /releases re-dated its own history on every deploy: the v0.7.5 entry
  computed `date: new Date()` at render time, showing a June release as
  today — against this file's own rule that date is the GitHub publishedAt
  (2026-06-08T05:31:25Z).
- APP_TAGLINE was still the pre-pivot 'your life operating system', shipping
  on OG images, public profiles, and email chrome long after the agent-fleet
  pivot.
- fleet-sites drifted from what the sites call themselves (verified by
  fetching each <title>): AOCH Wohnen -> WG Zuhause, SBB Lost & Found ->
  Nordbahn Lost & Found, VitaReBa -> Vita; evig now links its canonical host
  instead of the revampit 301.

And the class of bug behind several of these — docs restating a
machine-readable SSOT until they lie about it:

- AGENTS.md documented 5 steps of a 9-step verify gate, and still described a
  `migrate` script that no longer exists. README/CONTRIBUTING each listed a
  different ad-hoc subset of test scripts. All three now name
  `npm run verify` and point at package.json.
- New gate scripts/test/verify-gate-not-restated.ts fails if any of those
  docs re-enumerates the gate's steps. Proven by mutation: re-inlining five
  steps into README exits 1 naming the count; green once restored.

Co-authored-by: t <t@t.t>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-24 16:06:27 +00:00
GandClaude Fable 5 1590fba3fe feat(ecosystem): name Solon the third pillar — governance joins economy and engineering (#207)
* feat(ecosystem): name Solon the third pillar — governance joins economy and engineering

The stack has been three products for a while: OrangeCat (economy),
FleetCrown (engineering), Solon (governance). Loki is a registered voting
member in Solon and the decision webhook receiver exists — but the public
surfaces still narrated a two-product system and the Solon env contract
was undocumented. Now:

- src/config/ecosystem.ts gains a solon entry (NEXT_PUBLIC_SOLON_URL
  override) and an ECOSYSTEM_PILLARS constant naming the three roles
- public nav (src/config/auth.ts) gains a Solon external entry and the
  OrangeCat entry's description is reframed from 'two halves' to pillars
- public footer Ecosystem column links Solon with its role
- .env.example documents the previously-undocumented Solon contract:
  SOLON_WEBHOOK_SECRET (503 without it), SOLON_BASE_URL,
  NEXT_PUBLIC_SOLON_URL, LOKI_SOLON_PRIVKEY (box-only)
- README's mangled opening paragraph becomes the three-pillar table with
  the real, checkable ties

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

* chore: restore package-lock.json to main's state

npm install in the dev sandbox dropped platform-specific optional deps
from the lockfile; nothing about this change needs a lockfile edit.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-08-12 11:14:28 +00:00
7b9d0a37b8 chore(db): demote drizzle-kit push footgun — rename migrate → db:push (#111)
The `migrate` script aliased `drizzle-kit push`, training the habit of
diff-applying unreviewed schema to whatever DATABASE_URL points at — prod, if
misconfigured. Rename it to `db:push` so the name no longer reads as the normal
workflow, document it as local/scratch-only, and point every call-site at the
generate → review → forward-apply loop instead. No `db:migrate` alias added:
there is no local forward-only applier (the deploy owns forward-apply via
apply-schema.sh), so a hollow alias would just be a new landmine.

Call-sites updated: README, check-schema-drift, deploy-host, deploy-local,
postgres-portability. Implements docs/infrastructure/migration-strategy.md §3;
the optional CI guard is deferred there (it collides with the raw-SQL migration
path until the two paths are unified).

Co-authored-by: test <test@test>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-28 10:17:14 +02:00
Mao Nakamoto 4272b6a5a2 docs: bring changelog + README current through 2026-07-22
CHANGELOG.md: new 2026-07-22 section — /agents coordination cockpit +
agent_messages transport, Loki economy-awareness + query-scoped search,
OrangeCat funding events in Activity, revenue card + sustainability gates,
repo-doc RAG, feedback-widget hardening, drain-guarded CI-gated deploys.
README: add the economy-aware capability bullet (FC↔OrangeCat build↔find).
changelog.ts is the Fleet Runner desktop release log — untouched (no new
desktop release).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 11:40:17 +02:00
Mao NakamotoandCursor 023c513f88 fix(ui): make all app surfaces usable and polished on mobile
Mobile chrome tokens and viewport panes replace ad-hoc height math on Loki,
Terminal, and workspace routes; modals, drawers, composer, and Control rail
stack correctly on narrow screens. Docs and changelog updated.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-27 09:23:26 +02:00
Mao NakamotoandClaude Opus 4.8 c6bc058cb4 chore: purge Vercel / Neon / managed-Supabase across the codebase
Self-hosted on Hetzner is the only reality now; the leftover references were
stale at best and a security hole at worst. Thorough sweep across code, config,
scripts, docs, and comments (84+ files). Self-hosted supabase.orangecat.ch is
kept; historical migration records stay accurate.

Functional / security fixes:
- cron-auth: prod detection was process.env.VERCEL (unset on the box!), so the
  fail-closed 'CRON_SECRET unset -> 503' gate never fired in production. Now
  keys on NODE_ENV=production. (security)
- auth trustHost: dropped the dead process.env.VERCEL===1 branch.
- AppFooter: read the baked-in build SHA instead of VERCEL_GIT_COMMIT_SHA/ENV.
- project bootstrap: removed 'neon projects create' + the Vercel deploy brief;
  DB option is now self-hosted Postgres, deploy guidance is the self-hosted flow.
- db-url: removed the legacy NEON_DATABASE_URL* fallbacks (+ updated its test).

Infra / removals:
- deleted .github/workflows/vercel-deploy.yml and scripts/db/dump-from-{neon,supabase}.sh.
- stripped NEON_* env fallbacks from db dump/restore/sync scripts.

User-facing:
- desktop offline overlay no longer blames a 'Vercel hiccup'; privacy page +
  PRIVACY_POLICY subprocessors now say Hetzner self-hosted / self-hosted Postgres.

Plus ~50 comment/doc rewrites (Vercel -> the cloud host/the box; Neon -> Postgres).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 10:46:43 +02:00
Mao NakamotoandClaude Fable 5 4c8ab5425c feat(infra): exit Vercel — FleetCrown lives at fleetcrown.orangecat.ch
- swap dead fleetcrown.vercel.app for fleetcrown.orangecat.ch across src/,
  desktop/, README (Vercel team blocked for fair-use; serving 402s)
- scripts/deploy-hetzner.sh: build + rsync standalone + restart the
  fleetcrown-app unit on the bitbaum box (Caddy already vhosts the domain)
- brand.ts APP_DOMAIN remains the SSOT; historical thoughts essays keep the
  old domain as written

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 13:47:00 +02:00
Georgy Butaev c4aaa654a0 fix: correct naming - fleetcrown not fleetwave (user correction)
- Removed erroneous separate 'FleetWave' project/relations from DB.
- Updated all code, consts, docs, banners, CLAs, legal, READMEs to correctly present FleetCrown itself as the customer of OrangeCat (both as projects/profiles on the platform).
- Integration remains: shared wallet, customer stakeholder edge, live on orangecat.ch.
- Sessions updated.

No separate 'fleetwave' entity; the customer use case is FleetCrown.
2026-06-02 16:23:07 +02:00
Georgy Butaev 899b08ec56 feat(integration): FleetWave real customer setup with OrangeCat
- FleetCrown is customer of OrangeCat (stakeholder 'customer' edge, shared wallet).
- Both + FleetWave as projects/profiles on orangecat.ch for Mao Nakamoto.
- Added integration banner in /money page (visible UX for the customer relationship).
- Updated CLAUDE.md, README, legal/IP memo, marketing-content to reflect current names, FleetWave customer, rebrand.
- Legacy 'cockpit' paths kept per branding-design for transition.
- Data updated live in DB (rename, wallets, relations, new FleetWave project).
- Makes the full stack work for real customer FleetWave; scales to others.

Changes in both cockpit and orangecat for good UX and functioning product.
2026-06-02 16:09:46 +02:00
Georgy Butaev e30c842869 feat(desktop) + fix(design,lint): project selection + auto-sync + Sync to Web (ck_* token); canonical injectIntoTab + real appendEvent bridge.dispatch/worker.started in Fleet Runner runtime (replaces fake in-memory); hardened zellij.ts (session resolution + -- write-chars); ui-public-download-* + --public-accent (zero design violations); full cockpit->fleetcrown rebrand in desktop/scripts/docs/thoughts/marketing/home; update desktop README + docs/desktop-app.md with capabilities + gaps (in-memory vs real log)
- desktop build clean, tsc clean, lint 0, home/ 89/89
- advances desktop-2/3: dispatches now produce durable events in ~/.fleetcrown/events.jsonl with proper runId/sentinel so stop-hooks and web control plane treat them as first-class
- still no embedded watcher (idle via co-running home/watcher.ts for now)

Refs: desktop-app.md phases, Cockpit.roadmap T1/T2, prior landing 2d98638
2026-06-02 14:54:51 +02:00
Georgy Butaev b08ac4da14 feat(desktop): project selection + auto-sync on connect + Sync to Web (agent token to /runtime-state); switch to canonical injectIntoTab; ui-public-download-* classes (zero design violations); forward custom prompts as queueHead; clean lint; broad docs/marketing/scripts updates for FleetCrown desktop runtime 2026-06-02 12:17:12 +02:00
g-but f6dc058459 chore(repo): sharpen public repo surface 2026-05-28 12:47:41 +02:00
g-butandCursor ec6f423b0f feat(infra): Postgres portability, Oracle cutover scripts, and DB kill-switch essay
Vendor-neutral DATABASE_URL helpers, dump/restore/sync tooling, and one-command
Oracle migration after a single console VM step. Publishes the studio-stack
thoughts article and hardens build (dynamic layout, resilient sitemap).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-23 11:24:20 +02:00
g-butandCursor 6fb9c199b2 feat: harden cloud onboarding with agent CLI, private zone, and cron DB
Add @cockpit/agent init, server-side PIN enforcement for private APIs,
Postgres-backed cron jobs, daemon auto-continue sync, and cloud/local docs
so SaaS users get a clear path from browser signup to local dispatch.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-21 15:20:03 +02:00
g-butandClaude Sonnet 4.6 e90b5e323f refactor(core): consolidate agent-config SSOT, add Gemini/multi-agent support, expand shell
- Merge claude-config.ts into agent-config.ts (single SSOT for all state file paths,
  project conf, sessions dir, and prompt file resolution)
- Delete claude-config.ts; all importers updated to use agent-config
- Add Gemini to agent registry with availability detection; update agent-catalog to
  buildSwitchableAgentCatalog; add agent-preferences persistence
- Expand orchestration: add lifecycle state derivation, event persistence, and
  shouldPersistLifecycleEvent guard in orchestration/state.ts
- Add thoughts-content.ts (SSOT for article metadata read from content/thoughts/)
- Add MOBILE_NAV_ITEMS export to navigation.ts; integrate into MobileNav
- AppShell: use useState lazy initializer for sidebar collapse (fixes react-hooks/set-state-in-effect)
- Sidebar: collapse to icon rail on smaller screens; AppShell shows user avatar + name
- Control: SSE stream for real-time fast-state updates; ReadyBanner auto-inject countdown
- Shell, prompts, settings, today, goals, events, people: styling and UX consistency pass
- Update error/loading/not-found to use design system tokens
- Package.json dependency updates

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 16:21:10 +02:00
g-butandClaude Opus 4.7 d2b0cc5710 docs(readme): be honest about the seed dataset's external dependencies
The previous README implied `npx tsx scripts/seed.ts` was a
self-contained step. It isn't — the script reads from
~/.openclaw/knowledge.sqlite and ~/.openclaw/workspace/data/
contact-resolver.json, which are George's personal artefacts that
live outside the repo and aren't checked in.

A fresh clone hitting that command would ENOENT.

Update Setup so the contract is honest: schema push works for anyone,
seed works only if you bring those files yourself, and an empty
database is a fully-supported state because every page renders an
empty-state when the underlying table is empty (we wired up the
EmptyState primitive earlier exactly for this).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 20:58:53 +02:00
g-butandClaude Opus 4.7 40535dca58 docs(readme): replace boilerplate with actual project description
The README was still create-next-app's default ("This is a Next.js
project bootstrapped with create-next-app... edit app/page.tsx") even
though the codebase has grown into a 10-route life OS with custom
infrastructure, an Ivy AI integration, scheduled crons, and so on.
Misleading for anyone who lands on the GitHub repo.

Replace with a concrete description: stack, views table (mirroring
CLAUDE.md), architecture sketch, setup, dev commands, and a pointer
to CLAUDE.md as the deeper contract for substantive changes.

CLAUDE.md remains the canonical reference for working in the repo;
README is the human-facing one-pager that says what this thing is.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 20:49:40 +02:00
g-but 0e0852330a feat: initial commit 2026-04-04 22:47:22 +02:00