32 Commits
Author SHA1 Message Date
CatoandClaude Opus 5.5 29bfe8012a feat(browser): Terminal → Browser — watch a bot's browser live and take it over (#1772)
The browser Loki's agents and Cat Bot already drive (lib/bot-browser) gets
a screen: a third view of a session beside Chat and Terminal, beside the
conversation on a wide screen and in its place on a phone, with the agent
box under it.

- CDP screencast while someone watches (6 fps, newest wins), drawn by the
  existing RobotBrowser, which gains onTap
- one wheel: a person's step takes it; every bot step (a look too) answers
  TAKEN_OVER until hand-back, and the bot's next look carries handedBack
- the password/code/card refusal shows as "<bot> needs you" with Take over
- caption, pointer on the bot's target, "What happened" timeline (never
  typed text); native <select> offered as a picker; dialogs said in words
- memory: every browser's process tree measured (PSS), closed over 700 MB
- doors: /api/browser/live + /input (a signed-in person, own browsers only),
  /api/browser/step (the account's ck_ token, for Terminal agents),
  /api/browser/sessions; cloud-builder accounts only; demo denied
- /screen redirects to /terminal?view=browser
- scripts/test/screen-browser.ts: end to end at 390px and wide

Measured on the laptop: one live browser 229–236 MB PSS.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 22:11:03 +01:00
CatoandClaude Opus 5.5 afb337007c docs(agents): fold CLAUDE.md into AGENTS.md, leave the pointer (#1465)
* docs(agents): fold CLAUDE.md into AGENTS.md, leave the pointer

CLAUDE.md now only points at AGENTS.md, the fleet's one agent-file shape
(bitbaum/fleet scripts/ci/agent-rules.mjs). The rules move into AGENTS.md:
the four-layer design system, choice rows, AI form assist, SSOT rules,
data flow, security, cloud vs local, how to ask George, which token the
sweep holds, the box-runner update hold, package installs and "create
website for <Name>". The component map and the views table, which are
reference rather than rules, move to docs/development/surfaces.md so
AGENTS.md stays readable.

Checked against the tree:
- Only @bitbaum/accountkit still installs from GitHub; chatkit, searchkit
  and whenkit come from the registry. The install section says so.
- Dropped restatements of fleet rules (no dead ends, the merge chain) and
  the duplicate Database section.

globals.css excluded CLAUDE.md from Tailwind's source scan because its
"never write" examples are bracket classes; AGENTS.md and the surfaces doc
now carry them, so they are excluded too.

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

* docs(surfaces): name the model chip by family, not a version

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-29 10:43:25 +01:00
CatoandClaude Sonnet 5.5 59cd3e7b10 feat(terminal): a plain shell on the builder, operator-only behind the PIN (#1449)
* feat(terminal): a plain shell on the builder, operator-only behind the PIN

Sessions -> Plain shell opens a real bash login shell in a PTY the builder
owns: no project, no agent, no inject wrapper. It is one more kind of session
on the existing transport (open_shell command, peek-stream, the rawkey lane,
tab-memory), not a second terminal.

Security: operator account only (browser session, never a bearer token); a PIN
must be set and the shell's own unlock (10 min idle, 60 max) entered; opens
rate-limited and capped at 3 per builder; no queued command except
open/close/peek may name a shell tab (queue, validator and injectPty); tenant
and sealed builders never offer one; shell environment carries no engine keys.
Every open/close/denied/unlock is on an append-only audit trail with no
content. Threat model: docs/architecture/plain-shell.md.

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

* test(terminal): keep the repo's gates true for the plain shell

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

* docs(plain-shell): name where provision-service.py lives

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-27 20:14:13 +01:00
CatoandClaude Fable 5.1 944ed15747 feat(cloud): private builders — an allowlisted agent environment, a runner without the database, one sealed unit per account (#1346)
* feat(runner): agents get an allowlisted environment; the cloud builder asks Loki what to clone

Track 1, PRs 2 and 3 of docs/architecture/private-builders.md, together.

- src/lib/agent-execution/agent-env.ts: with LOKI_AGENT_ENV=allowlist (set
  by the box units) an agent PTY is born with a shell's environment, the
  engine keys the unit holds and what its own spec passes — never
  DATABASE_URL, never the org GITHUB_TOKEN. Off the box nothing changes.
- GET /api/control/workspace-source?tab=: a runner asks with its own token
  and gets its own account's repository and a token that account may write
  with (github-org-token.ts). box-workspace.ts reads no database any more;
  the runner passes the run's token to the one agent that needs it
  (GITHUB_TOKEN/GH_TOKEN in the spec env).
- mint-box-runner-token.ts --user <id>: a token per tenant.
- Records: changelog {#agent-env} {#runner-no-db}; roadmap milestone ticked.

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

* feat(cloud): a private builder per account — the flag, the sealed unit, reconciled on the box

Track 1, PRs 4 and 5 of docs/architecture/private-builders.md.

- users.private_builder (migration 0122) is the one switch, set from
  System → Plans (/api/system/private-builder). It grants cloud BUILDING
  only: isCloudBuilderAllowed (founder or flag) for routing, Sessions and
  the kickoff path; isFleetInfrastructureAllowed is the founder alone and
  gates the org GitHub token, studio CD, own domains and the server's own
  PTYs. LOKI_CLOUD_BUILDER_USER_IDS is retired.
- scripts/hetzner/loki-box-runner@.service: one unit per tenant as
  lk-<short>, ProtectSystem=strict, ProtectHome=tmpfs with its own home
  bound, the app and the runner env invisible, MemoryMax/CPUQuota/TasksMax,
  its own dev root, the agent env allowlist, no database password.
- scripts/hetzner/new-tenant.sh: user, clean shell, dev root, a runner
  token minted for THAT user, the agent contract, claude in its own home,
  an env file for its engine keys, the unit. reconcile-tenants.sh runs
  every minute from loki-tenants.timer (install-tenant-reconcile.sh, run by
  the deploy) and brings units into step with the flag. The deploy ships
  the scripts and template and drains and restarts every unit, each in its
  own transient unit.
- A tenant's project path is written under its own root
  (tenantDevRoot), which counts as box-rooted for routing.
- Records: changelog {#new-tenant} {#private-builder-flag}; roadmap.

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

* chore(runner): Fleet Runner 0.8.50 — the allowlisted environment and the API-backed clone

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-20 12:05:27 +02:00
CatoandClaude Opus 5.5 925ab930be feat(ai-budget): newcomer reserve in the free pool + fix(billing): payments stay off until switched on (#1294)
* feat(ai-budget): keep a fifth of each day's free pool for people on their first week

Pacing keeps the day from being spent before lunch, but not by evening:
there is no clawback, so whoever signs up at 21:00 can meet a pool the
vendors have already refused — a first answer that never comes, which is
the moment a person decides Loki is broken.

lib/ai-budget/newcomer-reserve.ts: returning accounts together stop at 80%
of the day's capacity; an account under seven days old may draw on the
rest, still under its own fair share. getDayUsage now also returns the
day's total (same query as the active count). The gate reads the
account's age only once the total reaches the held part, and fails open
if it cannot; a paid plan with allowance left is not held back. The
refusal says what the held part is for, when the day starts over, and the
ways past it; the budget screen reads the same rule, so it never shows
"12 left" to someone the gate will refuse.

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

* fix(billing): payments stay off until switched on, whatever pay URLs are set

Live after #1293: every paid plan's button on /pricing read "Pay in
Bitcoin" and went to an OrangeCat product page that answers 404. The
three ORANGECAT_PAY_URL_* were set on the box before the passes existed;
while the tiers had no price that was invisible, and setting the prices
turned the dead links on — skipping the reservation flow they were meant
to fall back to, and showing "Buy" in Settings → Billing too.

orangeCatPayUrl now also requires LOKI_PAYMENTS_OPEN=1. Opening payments
is a decision (the company registered, the passes live), so it is a
switch, not an inference from a URL. Until then every paid plan's button
reserves, as designed.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-18 01:35:23 +02:00
CatoandClaude Opus 5.5 a1b9d212b2 fix: no silent standing approvals for Loki's own ideas, and no dead-end stalls (#1168)
* fix(approvals): standing approvals cover what you ask for, never Loki's own ideas

The owner saw "✅ Done — Check in with Rajif Rao" on Telegram and feared Loki
had contacted someone without permission. Nothing was sent: a commitment is a
row in the operator's own list. But the path was still wrong. The check-in
producer writes its suggestions as create_commitment rows, so the "Record
commitments I mention" standing approval silently approved one nobody
mentioned, and the confirmation read as if the check-in had happened.

- standing-approval: RAIL 0. Every proposal now carries a required origin
  ("operator" | "loki"); only operator proposals may ride a standing rule.
- enqueueAction takes the origin from every caller and stamps it on the
  payload so the calendar drain's confirmation can say the same thing.
- Check-ins, the night plan and propose calls marked "not asked for" are
  origin "loki"; chat, the agent's propose tool and MCP are "operator".
- A commitment's confirmation now reads "📌 Added to your commitments —
  “Reach out to …”. A reminder for you. Nothing was sent to anyone."
- The Approvals setting says Loki's own suggestions still wait for a yes.

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

* fix(control): a stalled queue always has a button, and names who holds it

On a phone the owner tapped "Run it in the cloud" under "Waiting for this
computer". The next refresh said "Stalled — 2 dispatches queued for 118m, the
builder is connected but not executing them. Restart the desktop app or check
the cloud builder if this persists", with no button, under a foot line that
read "This computer offline". Three things were wrong:

- The stall clock ran from created_at, so work the cloud had held for seconds
  was reported as 118 minutes stuck. A reroute now stamps reroutedAt and the
  detector measures from it.
- The sentence blamed a desktop app for work the cloud was holding. The stall
  query now counts cloud-held rows too, and the headline names the builder
  that actually has the work and whether it is connected.
- A genuine stall had no way forward. It now offers "Stop waiting"
  (POST /api/control/stop-waiting): the stuck rows close as failed dispatches,
  where Retry sends them again verbatim and Dismiss clears them, and their
  runs close so the project's lane is free. The consequence is stated in the
  headline before the tap.

Both hero queue buttons now report what they did ("Handed 2 dispatches to the
cloud builder.", or why a project stayed put) instead of firing and forgetting.

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

* fix(loki): a screenshot sent with "fix this" finds the project it shows

On a phone the owner opened a new chat, attached a screenshot of Loki's own
Control page and wrote "Fix this so it works properly". The thread read
"No project — answers only": the text named no project, so the screenshot
fast path could not dispatch, and the picture was only ever described,
never used to decide where the fix should go.

- The vision preflight now opens with one line, "Shown: <app or site, and
  any URL visible>".
- projectShownInScreenshot picks a project only when the evidence points at
  exactly one: a project's live host visible in the analysis (compared whole,
  so loki.orangecat.ch is Loki and not OrangeCat), else a single project
  named on the Shown line. Projects merely listed on the screen do not count,
  and two candidates stay a question for the person.
- When Loki chose the project this way the reply says so and how to pick a
  different one, so a guess never reads as the person's own choice.

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

* fix(notify): a failed run's Telegram message links to where Retry is

"❌ loki: run error … choose another AI provider and Retry" arrived with
nothing to tap. Failed, partial and timed-out runs now carry one button,
"Open <project> in Control", which lands on the project card where Retry and
the provider switch live. Successes stay buttonless.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-12 06:40:51 -07:00
CatoandClaude Fable 5.1 696ce72e21 feat(builder): Loki from another computer offers the cloud, never a download (#1157)
* feat(builder): Loki from another computer offers the cloud, never a download

The owner opened Loki on a second Mac (2026-10-12). Every builder surface
named "this computer", said Fleet Runner was not connected there, and
offered one fix: download the desktop app. "This computer" is per account
— presence is one row per user — so from any other device that offer is a
trap, and the account's cloud builder was online the whole time. The
download it got is unsigned, so macOS called it "damaged".

- lib/builder-way-forward.ts: the one answer to "nothing is running this
  work" per account — run it in the cloud / wait for the cloud / connect
  Fleet Runner / unknown — from cloudBuilderAllowed + presence. The
  download is honest only while the cloud is private for the account.
- Dispatch card (Loki chat): a dispatch waiting for "this computer" gets
  "Run it in the cloud" (POST /api/control/reroute, same command id) when
  the account has the cloud; the download only when it does not.
- Control setup banner: an account with the cloud reads that there is
  nothing to install; the offline variant no longer says "re-install".
- Empty terminal: "Use the cloud builder" leads before "Get Fleet Runner";
  the machine source's "not connected here" line names the cloud instead.
- /api/builder/presence and /api/control carry cloudBuilderAllowed;
  useBuilderPresence is one shared poller for every reader (it was one
  interval per component, so a card per dispatch could not have it).
- /download (macOS): the "damaged" dialog is Gatekeeper on an unsigned
  build, not a bad file; right-click → Open does not clear it. The page
  leads with the .zip and one Terminal line (ditto, xattr -cr, open).
  Signed builds need an Apple Developer account — docs say what it costs.

Tests: builder-way-forward (new), dispatch-card (+5), phone-chrome
updated to the moved wiring; execution-access, control-presenter,
auto-reroute, dispatch-status, fleet-context pass.

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

* fix(terminal): no "start it, and it opens here" while the builder is offline

A deep link to a project with no session rendered the session-miss screen
("sink isn't running on Cloud builder — Nothing is attached. Start it, and
it opens here") while the chip beside it read "Cloud builder offline". The
owner, on a second computer: "classic dead end" (2026-10-12).

The miss is only a miss when the builder could have a session. Offline or
gated, the empty state renders instead: it says the builder is down, what
happens to the work, and offers the way forward for this account.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-12 03:12:40 -07:00
CatoandClaude 3ce95843d3 feat(control): work waits for nobody — an offline computer hands off to the cloud (#1119)
A phone tap ("Fix this" in the widget, "move forward" in chat) on a project
that prefers this computer sat "Queued for this computer" for 106 minutes
beside a cloud builder reading "online · not executing", and the hero told
the operator to restart a desktop app that was simply shut.

Routing
- A project that merely PREFERS this computer (no locus lock, cloneable
  repo) falls through to the cloud builder when this computer is offline at
  dispatch time and the cloud is online: `offlineFallbackChannel` +
  `decideQueuedExecution({ offlineFallback })`. The chat says so
  ("… this computer is offline, so the cloud builder took it. Nothing to
  do.") and the stored preference is untouched. A lock never falls
  through; a cloud preference never falls to a laptop that cannot clone.
- The executor swaps in the cloud clone dir for a rerouted dispatch.

Already stuck
- `POST /api/control/reroute` (lib/reroute-queue.ts) moves unclaimed rows
  waiting for this computer to the cloud — one row or all — on projects
  the same rule allows; an `inject` row becomes a `dispatch` so it lands.
- Control hero: "Waiting for this computer · N queued 106m (loki), which is
  offline. The cloud builder is online and can take it now." with ONE
  button, "Run it in the cloud". The stall query reports `localQueued`.
- Feedback card: "This computer is offline — the cloud builder can take it
  now" with the same button in place of "Open Fleet Runner … then Retry".

Control page, from the widget's own findings
- "N awaiting input" / "N working" now narrow the roster to that bucket,
  with a chip to clear it (on a phone the tap changed nothing on screen).
- The page title is the shell's h1 at every width (md:sr-only), the Find
  project and new-project fields carry labels, and the roster's 10px
  evidence line and sort chips are 12px.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-09 09:32:59 -07:00
Cato fcd38cb463 fix(loki): clarify terminal and retire stale guidance (#866) 2026-09-23 07:58:21 -07:00
CatoandClaude Fable 5.1 f7c4e35fdc feat(builder): a project can pin its work to the hosted runner — no Claude credential needed (#718)
builder_pref gains a third value, 'hosted'. A project pinned to it never
touches a runner PTY: the dispatch goes straight to the hosted runner
(Hermes in its own clone on the box, on the providers the box already holds
keys for — Copilot, Gemini, Groq), and the hosted runner closes the tracked
run with the pull request as evidence, so the outcome reaches the thread
that asked, like any other run.

Why now: the box's Claude Code credential died silently and every
self-dispatch hung, while Hermes on the same box answered fine. The
unattended path should not depend on a person's Claude subscription at all.

- statuses.ts: HOSTED_BUILDER_PREF / BUILDER_PREFS (channels stay what they
  were — nothing claims 'hosted' from a queue); API enum widened.
- inject-core: hosted branch before the channel pin; run id travels in the
  hosted_dispatch payload.
- hosted-runner: closeHostedRun() through updateOrchestrationRun (outcome
  turn, ledger, escalation bookkeeping all fire); delivered stamp at claim.
- Control → project profile → Runs on: third choice with its explanation.
- docs/development/cloud-local-workflows.md: the tier in the SSOT table.


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

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-14 22:43:29 -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
CatoandCato 03141d39c1 fix(cold-start): close GPT audit gaps for kickoff, feedback, OC, docs (#550)
Stop kickoff after a failed repo step; keep the operator's exact brief;
mark feedback Queued only with a real run id; link Check live to the
reported page; never backfill OC wall history from before publish
consent; document eligible-only cloud builder and the new-site vs
provision starter split.

Co-authored-by: Cato <catomean@users.noreply.github.com>
2026-09-10 01:43:17 -07:00
CatoandClaude Opus 5 a48e7c52dd docs(billing): the docs still described a rail that was deleted yesterday (#514)
#508 removed the Stripe rail. Four living docs kept describing it, and one of
them is named in CLAUDE.md as an SSOT — so the wrong answer was the documented
answer.

- `development/cloud-local-workflows.md` listed `Stripe billing | STRIPE_*` in
  the env-gated feature table. Replaced with the rail that exists:
  `ORANGECAT_PAY_URL_{PERSONAL,PRO,TEAM}`, names checked against lib/oc-pay.ts.
- `sustainability-gates.md` Gate 3 argued from a `quantity: 1` hardcode in
  `src/app/api/stripe/checkout/route.ts`. The gate did not go stale, it
  HARDENED: that route is gone and the BTC rail is a static per-plan URL with no
  quantity concept, so there is no seat number left in the purchase path to
  correct. Per-seat Team is now a build, not a config change.
- `oc-rail-monetization-scope.md` claimed the Stripe webhook "already calls"
  updateUserBilling and that /pricing has an isStripeReady() seam to reuse. The
  write survives (via /api/orangecat/entitlement, plus scripts/grant-plan.ts);
  the seam does not — the BTC CTA is the default case now, not one to add.
- `development/user-flow-audit.md` asserted `/api/stripe/portal` returns 503. It
  returns 404. CH01-CH04 and the CH04 runbook tested four deleted endpoints;
  retired with a pointer to what replaced them.

`scripts/grant-plan.ts` said it performs "the SAME write the Stripe webhook
does" — updated to name the entitlement route instead.

Two findings that were not about Stripe:

`docs/self-improvement-plan.md` enumerated three `insertPromptHistory` call
sites. There are four — `api/control/tab-inject` was missing — and all three
line numbers had drifted (270→397, 452→514, 80→138). Following that list would
have shipped the runId linking with one dispatch path still unlinked. Line
numbers dropped in favour of "grep the symbol"; same for `src/auth.ts:234` in
the OC scope doc, which now points at line 268's unrelated code.

`src/config/demo.ts` still denied `/api/checkout` under its "money" heading long
after #508 deleted that route — a deny rule for a route on no disk, which made
the billing section of the sandbox policy look staffed.

demo-sandbox.ts already had the reverse check for DEMO_SAFE_FAMILIES ("a family
listed as safe that no longer exists is dead reassurance"); the denied lists had
no equivalent, which is why that entry survived. Added the mirror check — it
caught `/api/checkout` on its first run — and mutation-proved it with a fake
prefix. 262 assertions.

Also measured and did NOT gate: doc path references (314) and `pnpm run`
commands (77) both came back clean once false positives were removed, and the
dominant pattern is prose naming a file precisely to record its REMOVAL, which
grep cannot tell from rot. A gate there would fire on the correct docs and stay
silent on the wrong ones. CLAUDE.md's own four flagged paths were all correct,
and all 22 routes in its Views table exist.

verify green (13 steps, exit 0).


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

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-07 05:05:54 +00:00
Mao NakamotoandCursor f887f220b6 feat(qa): flow audit SSOT, honesty labels, and prod smoke harness
Add user-flow-audit checklist, authenticated smoke with PIN unlock, builder
presence API, executor honesty chips on Control/Loki/Terminal, setup auto
sign-in, workspace gate on hosted, and fleetcrown brand-storage migration.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-04 19:35:25 +02:00
Mao Nakamoto 033b780326 feat(control): complete terminal and orchestration trust pass 2026-06-30 14:53:06 +02:00
Mao NakamotoandCursor a491e9e487 feat(loki,control): unified builder UX and move-forward dispatch
Browser-first onboarding and executor-copy SSOT; Loki imperatives and move-forward
route to the same builder queue as Control with cloud-first Terminal links; fleet-kick
queues when offline; deploy script syncs box-runner.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 22:58:32 +02:00
Mao NakamotoandCursor 5ac16ea023 feat(loki): consolidate on /loki as single command surface
Route shell FAB and loki:open to /loki with composer prefill; retire the
chat-only modal. Add fleet list/create NL fast paths, project picker chips
for ambiguous dispatches, and a db helper to inspect recent conversations.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 14:45:06 +02:00
Mao NakamotoandCursor 6dd74f2c2b feat(terminal,loki): mobile full-screen terminal and develop handoff
Expand/collapse on phones gives xterm usable height; Loki dispatches route
"let's develop" through next_best and link to watch the agent. Profile drawer
follows action-first hierarchy with filtered activity noise.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-27 16:22:30 +02:00
Mao NakamotoandCursor e83d8179aa fix(runner): v0.8.5 — reliable live terminal peek on My machine
Root cause of blank /terminal live view: dual runner instances racing
(stale Singleton lock cleared while old process lived), peek_start blocking
on zellij execSync for non-PTY tabs, and streams stuck on zellij after PTY launch.

- peek-streamer: defer zellij first tick so peek_start acks immediately; remove v0.8.4 diagnostics
- poller: stopPeek before startPeek so PTY streams upgrade when agent launches
- index: terminate stale runner PIDs on lock acquire; process.exit(0) on lock failure
- zellij: execSync timeouts on focus/dump-screen (prevents poller hang)
- docs: /terminal My machine workflow and version requirements

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-18 00:08:34 +02:00
Mao NakamotoandClaude Opus 4.8 4485b5e882 fix(control): kill launch friction, dedupe offline banner, finish daemon retirement
Phase 1 of the reliability/UX cleanup:
- Launch modal: model choice is no longer mandatory. Launch enables as soon as a
  CLI/agent is picked; model field is optional (defaults to the agent's default,
  labeled as such). Choosing the CLI is enough. (control-panel-modals.tsx)
- Offline banner: one source of truth. RunnerStatusBanner owns the full "offline
  — commands queue until it reconnects" alert; ControlFleetStatus is now a
  compact status indicator and project-intent-panel a short inline hint — no more
  triple-rendered banner. (ControlFleetStatus.tsx, project-intent-panel.tsx)
- Daemon retirement finished: purged stale user systemd units
  (fleetcrown-daemon, beacon-window, an obsolete cockpit-* dir) and rewrote
  misleading docs/comments (cloud-local-workflows.md, home/watcher.ts,
  home/emit.ts) that still described the deleted bash daemon as live. Kept the
  intentional 410 route + historical essays.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 23:32:51 +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 NakamotoandCursor b1c4a3eb74 fix(control): stabilize autopilot injection and fleet observability
Align stop-hook, beacon, and UI dispatch gates so autopilot respects per-project pause, choice wire format, and typing blocks; add control audit trail, Fleet Doctor, and updated cloud-local docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-09 02:28:06 +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-butandCursor ee5314a5b4 fix(autopilot): keep loop running after agent stop without hooks
Session-handoff watchdog fires when status:ready is fresh; Stop hook runs
autopilot first and queues inject via /api/inject with bearer fallback.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-30 21:01:38 +02:00
g-but 31dd2690ef feat(control): Phase 0 polish - compact Live Zellij + Launch defaults with inline Install buttons, registry-driven models, functional New from picker, better offline language. Plus grok full parity in registry + daemon reflection paths.
This is the UI the user is asking to see live + the reflection fixes for direct terminal use (Cockpit tab showing correct agent).

Part of the approved zellij-control + terminal-reflection plan.
2026-05-26 18:03:41 +02:00
g-but 94d50da677 fix(agent): advertise hosted installer command 2026-05-26 13:26:21 +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 d1db4e292e feat(control): add live Zellij workspace panel with full tab sync
Control buried fleet state behind config metrics and only showed an open-tab count on cloud. Push the full Zellij tab list from the daemon, store it in runtime_snapshots, and lead the page with a workspace table showing agent, state, and current activity per tab.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-21 19:10:09 +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