Files
loki/desktop
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
..

Fleet Runner Desktop (for Loki)

This is the native desktop application — the local runtime for Loki on the user's own machine (the "local fleet runner"). It is optional: cloud is the default builder, and a project runs here only when its stored routing decision says so ("Runs on" in Control → project profile, or a laptop-only checkout).

The shipped design is documented in docs/architecture/box-owned-pty-executor.md and docs/development/cloud-local-workflows.md. docs/desktop-app.md and docs/fleet-runner-pty-ownership.md are the historical decision records.

Current status

  • Packaged native app (AppImage + .deb produced via electron-builder; macOS/Windows builds via .github/workflows/desktop-release.yml).
  • Ships in web-shell mode: the main window loads https://loki.orangecat.ch directly and the user gets the exact same React tree the browser serves, plus native bits (tray, OS notifications on agent idle, persistent NextAuth cookies). One UI, two surfaces.
  • Native IPC remains available via the preload-injected window.fleetRunner bridge — the web app detects Fleet Runner via the FleetRunner/<version> UA suffix and calls into the local runtime where it makes sense.
  • Owns every agent PTY. A dispatch claimed from pending_commands spawns the agent CLI in a node-pty PTY inside the runner's own process tree (src/main/pty-runtime.ts, the same core the headless box runner uses) and writes the prompt there. An inject for a project with no live owned PTY fails loudly ("no running agent for … — dispatch to start one") and the cloud enqueues a dispatch instead. There is no multiplexer: no zellij binary is bundled, no LOKI_RUNNER_PTY switch exists.
  • No tab focus, no restore. focus_tab is retired (the runner rejects it; watch the agent in the web terminal). There is no cold-start restore on boot and no Settings "Restoration" section — an agent runs while its PTY runs.
  • Agent installers ("Install X" on Control) run in an owned PTY watchable in the web terminal. Peek reads the owned PTY buffer; the "This computer" terminal streams it live and accepts keystrokes.
  • Real home/ integration in the main process: loads your projects config from agent-projects.conf, uses decide(), renders prompts via the orchestration layer (renderTaskForAdapter) on every dispatch.
  • The embedded home/watcher reacts to ~/.loki/sessions/*.md changes and fires a native OS notification on every worker.idle event — fire-and-walk-away UX.

Overriding the shell URL

# Point the desktop at the hosted production app (default)
LOKI_WEB_URL=https://loki.orangecat.ch ./Fleet-Runner-*.AppImage

# Or against a local dev server
LOKI_WEB_URL=http://localhost:3000 ./Fleet-Runner-*.AppImage

Get the runnable app

End users should grab a signed installer from the download page. For a local build from source:

git clone https://github.com/bitbaum/loki.git
cd loki/desktop
npm install
npm run dist:linux    # or dist:mac / dist:win on those platforms

Then run:

chmod +x dist/Fleet-Runner-*.AppImage
./dist/Fleet-Runner-*.AppImage

(Or install the .deb / .dmg / .exe.)

On launch, the app loads the Loki control plane directly. Sign in with the same account you use on the web; native APIs are injected via window.fleetRunner, and the embedded watcher fires native notifications when local agents go idle.

Dev (for contributors)

cd desktop
npm install
npm run dev

Packaging

npm run dist          # current platform
npm run dist:linux    # AppImage + deb
# etc.

Cutting a release

.github/workflows/desktop-release.yml builds Fleet Runner for macOS, Windows, and Linux from one tag push and uploads the signed installers to a GitHub Release. To cut a release:

cd desktop
npm version patch     # or minor/major — bumps package.json + creates a commit
git tag fleet-runner-v$(node -p "require('./package.json').version")
git push --follow-tags

The workflow takes ~10 minutes. Once it's green, the binaries are at:

  • https://github.com/bitbaum/loki-releases/releases/latest/download/Fleet-Runner-linux-x86_64.AppImage
  • https://github.com/bitbaum/loki-releases/releases/latest/download/Fleet-Runner-linux-amd64.deb
  • https://github.com/bitbaum/loki-releases/releases/latest/download/Fleet-Runner-mac-x64.dmg
  • https://github.com/bitbaum/loki-releases/releases/latest/download/Fleet-Runner-mac-arm64.dmg
  • https://github.com/bitbaum/loki-releases/releases/latest/download/Fleet-Runner-win-x64.exe

To test the workflow without minting a real release, dispatch it manually from the Actions tab with dry_run: true — it builds on all three runners but skips the publish step.

Relation to existing code

  • Builds on the home/ pure pieces (state, decide, render, watcher) and the shared executor in src/lib/agent-execution/.
  • The headless box runner (scripts/box-runner.ts, loki-box-runner.service on Hetzner) reuses this runner core without Electron; it is the default builder.

See the root content/thoughts/the-local-fleet-runner-and-remote-control-plane-architecture.md for the strategic "why".