Skip to content

armgit / kwant

Public Imported from GitHub
0

Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.

24f: kwant on CasaOS, Umbrel, Coolify and Render (+ store sign-in hint) (#754)

Oleksandr Ivanchenko9a087fcd1ca0
diff --git a/README.md b/README.md
index 9ccbbe9c..66c4f3f2 100644
--- a/README.md
+++ b/README.md
@@ -267,6 +267,14 @@ echo KWNT_ALLOWED_ORIGINS=https://kwant.example.com >> .env && docker compose up
- **kwant's own `execute_shell` tool** runs in per-team Docker containers, so it isn't available inside this stack: that would need the host's Docker socket, which is root on the host. The CLIs' own shell tools work inside the kwnt container.
- **Upgrading from an older image:** kwnt now runs as uid 10001, not root. If it says `/data isn't writable`, run once: `docker compose run --rm -u root kwnt chown -R 10001:10001 /data`.
+### Render, CasaOS, Umbrel and Coolify
+
+[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/alexsergivan/kwant)
+
+The button reads [`render.yaml`](render.yaml): one web service from the released image with a 1 GB disk on `/data`. **Render keeps files only on a disk, and disks need a paid instance** (Starter or up), so the free plan won't work. Render makes the sign-in token: copy `KWNT_API_TOKEN` from the service's **Environment** page and paste it on the sign-in screen.
+
+For home servers, [`deploy/`](deploy) has a listing for each store, pinned to the release: [CasaOS](deploy/casaos/Kwnt/docker-compose.yml) (sign in with `kwnt token --raw` from the app's **Terminal**), [Umbrel](deploy/umbrel/kwant) (sign in with the password Umbrel shows for kwant) and [Coolify](deploy/coolify/kwnt.yaml) (sign in with `SERVICE_PASSWORD_64_KWNT` from the service's environment variables). Until a store lists kwant, CasaOS can import the file under **Custom Install** and Coolify can run it as a **Docker Compose** resource; Umbrel needs the listing. These run kwnt alone, without Laya or the bots' browser; see [docs/self-host-stores.md](docs/self-host-stores.md).
+
### Without Docker: `kwnt setup`
`kwnt setup` installs what kwant needs on this machine: Chromium or Chrome for the bots' browser, Laya (in kwant's data folder, with its own `uv` if you have no Python), and a CLI (`claude` unless you name others with `--clis`). It asks before each step (`--yes` skips the questions), never runs `sudo` itself (it prints the command for you instead), installs into your home folder where it can, skips Docker unless you pass `--docker`, and running it again changes nothing. `--dry-run` shows the plan. The app has the same checklist under **Setup**.
diff --git a/deploy/casaos/Kwnt/docker-compose.yml b/deploy/casaos/Kwnt/docker-compose.yml
new file mode 100644
index 00000000..c2b5117f
--- /dev/null
+++ b/deploy/casaos/Kwnt/docker-compose.yml
@@ -0,0 +1,98 @@
+name: kwnt
+services:
+ # Docker creates /DATA/AppData/kwnt/data as root; kwnt runs as uid 10001, so hand it the folder first.
+ kwnt-init:
+ image: ghcr.io/alexsergivan/kwnt:0.9.17@sha256:8ce673fe74fe309d408f0a93b3b55659d263a0aa5abbe17a202ffa07a7f62ae3
+ user: "0:0"
+ entrypoint:
+ - /bin/sh
+ - -c
+ command:
+ - chown -R 10001:10001 /data
+ volumes:
+ - type: bind
+ source: /DATA/AppData/$AppID/data
+ target: /data
+ network_mode: none
+ restart: "no"
+ kwnt:
+ image: ghcr.io/alexsergivan/kwnt:0.9.17@sha256:8ce673fe74fe309d408f0a93b3b55659d263a0aa5abbe17a202ffa07a7f62ae3
+ container_name: kwnt
+ depends_on:
+ kwnt-init:
+ condition: service_completed_successfully
+ environment:
+ TZ: $TZ
+ KWNT_SIGNIN_HINT: "On the CasaOS dashboard, open kwant's menu, choose Terminal and run kwnt token --raw. Paste what it prints below."
+ network_mode: bridge
+ ports:
+ - target: 8799
+ published: "8799"
+ protocol: tcp
+ restart: unless-stopped
+ security_opt:
+ - no-new-privileges:true
+ volumes:
+ - type: bind
+ source: /DATA/AppData/$AppID/data
+ target: /data
+ x-casaos:
+ envs:
+ - container: TZ
+ description:
+ en_US: Time zone
+ - container: KWNT_SIGNIN_HINT
+ description:
+ en_US: The line kwnt's sign-in screen shows before you sign in
+ ports:
+ - container: "8799"
+ description:
+ en_US: Web UI
+ volumes:
+ - container: /data
+ description:
+ en_US: Bots, chats, settings and the sign-in token. Back this up.
+x-casaos:
+ id: si.kwant.kwnt
+ architectures:
+ - amd64
+ - arm64
+ main: kwnt
+ index: /
+ port_map: "8799"
+ scheme: http
+ author: alexsergivan
+ developer: kwant
+ category: AI
+ icon: https://cdn.jsdelivr.net/gh/IceWhaleTech/CasaOS-AppStore@main/Apps/Kwnt/icon.svg
+ thumbnail: https://cdn.jsdelivr.net/gh/IceWhaleTech/CasaOS-AppStore@main/Apps/Kwnt/thumbnail.png
+ screenshot_link:
+ - https://cdn.jsdelivr.net/gh/IceWhaleTech/CasaOS-AppStore@main/Apps/Kwnt/screenshot-1.webp
+ - https://cdn.jsdelivr.net/gh/IceWhaleTech/CasaOS-AppStore@main/Apps/Kwnt/screenshot-2.webp
+ - https://cdn.jsdelivr.net/gh/IceWhaleTech/CasaOS-AppStore@main/Apps/Kwnt/screenshot-3.webp
+ title:
+ en_US: kwant
+ tagline:
+ en_US: Your own team of AI bots that check each other's work
+ description:
+ en_US: >-
+ kwant is an open-source, self-hosted team of AI bots. They share chats, hand work to each
+ other and run on a schedule, and a step only counts as done once kwant has seen the proof.
+ Add an AI account you already have (an API key, or a Claude, Codex or Grok sign-in) and ask
+ your first question. Everything stays in one folder on your CasaOS box.
+ tips:
+ before_install:
+ en_US: >-
+ kwant asks for a sign-in token the first time you open it. On the CasaOS dashboard, open
+ kwant's menu, choose Terminal, run `kwnt token --raw` and paste what it prints. The browser
+ then stays signed in for a year. Add an AI account in the app to start; this image has no
+ AI command-line tools inside.
+ version: "0.9.17"
+ update_at: "2026-11-16"
+ release_notes:
+ en_US: |-
+ - kwnt 0.9.17. What's new: https://github.com/alexsergivan/kwant/releases/tag/mac-v0.9.17
+ website: https://kwant.si
+ repo: https://github.com/alexsergivan/kwant
+ support: https://github.com/alexsergivan/kwant/issues
+ docs: https://kwant.si/docs/install
diff --git a/deploy/casaos/Kwnt/icon.svg b/deploy/casaos/Kwnt/icon.svg
new file mode 100644
index 00000000..be30972d
--- /dev/null
+++ b/deploy/casaos/Kwnt/icon.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 1 16 16" shape-rendering="crispEdges"><rect x="0" y="1" width="16" height="16" rx="3" fill="#4024a8"/><rect x="10" y="4" width="1" height="1" fill="#1d1147"/><rect x="10" y="1" width="2" height="2" fill="#ddd5ff"/><rect x="4" y="5" width="8" height="1" fill="#fff"/><rect x="3" y="6" width="10" height="1" fill="#fff"/><rect x="2" y="7" width="12" height="7" fill="#fff"/><rect x="3" y="14" width="10" height="1" fill="#fff"/><rect x="4" y="15" width="8" height="1" fill="#ddd5ff"/><rect x="13" y="7" width="1" height="7" fill="#ddd5ff"/><rect x="5" y="8" width="2" height="3" fill="#1d1147"/><rect x="9" y="8" width="2" height="3" fill="#1d1147"/><rect x="3" y="11" width="2" height="1" fill="#b8a9fb"/><rect x="11" y="11" width="2" height="1" fill="#b8a9fb"/><rect x="6" y="12" width="1" height="1" fill="#1d1147"/><rect x="9" y="12" width="1" height="1" fill="#1d1147"/><rect x="7" y="13" width="2" height="1" fill="#1d1147"/><rect x="4" y="16" width="2" height="1" fill="#ddd5ff"/><rect x="10" y="16" width="2" height="1" fill="#ddd5ff"/></svg>
diff --git a/deploy/casaos/Kwnt/screenshot-1.webp b/deploy/casaos/Kwnt/screenshot-1.webp
new file mode 100644
index 00000000..71019c35
Binary files /dev/null and b/deploy/casaos/Kwnt/screenshot-1.webp differ
diff --git a/deploy/casaos/Kwnt/screenshot-2.webp b/deploy/casaos/Kwnt/screenshot-2.webp
new file mode 100644
index 00000000..f0b8cb87
Binary files /dev/null and b/deploy/casaos/Kwnt/screenshot-2.webp differ
diff --git a/deploy/casaos/Kwnt/screenshot-3.webp b/deploy/casaos/Kwnt/screenshot-3.webp
new file mode 100644
index 00000000..0b1037fc
Binary files /dev/null and b/deploy/casaos/Kwnt/screenshot-3.webp differ
diff --git a/deploy/casaos/Kwnt/thumbnail.png b/deploy/casaos/Kwnt/thumbnail.png
new file mode 100644
index 00000000..26ef8ac2
Binary files /dev/null and b/deploy/casaos/Kwnt/thumbnail.png differ
diff --git a/deploy/coolify/kwnt.svg b/deploy/coolify/kwnt.svg
new file mode 100644
index 00000000..be30972d
--- /dev/null
+++ b/deploy/coolify/kwnt.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 1 16 16" shape-rendering="crispEdges"><rect x="0" y="1" width="16" height="16" rx="3" fill="#4024a8"/><rect x="10" y="4" width="1" height="1" fill="#1d1147"/><rect x="10" y="1" width="2" height="2" fill="#ddd5ff"/><rect x="4" y="5" width="8" height="1" fill="#fff"/><rect x="3" y="6" width="10" height="1" fill="#fff"/><rect x="2" y="7" width="12" height="7" fill="#fff"/><rect x="3" y="14" width="10" height="1" fill="#fff"/><rect x="4" y="15" width="8" height="1" fill="#ddd5ff"/><rect x="13" y="7" width="1" height="7" fill="#ddd5ff"/><rect x="5" y="8" width="2" height="3" fill="#1d1147"/><rect x="9" y="8" width="2" height="3" fill="#1d1147"/><rect x="3" y="11" width="2" height="1" fill="#b8a9fb"/><rect x="11" y="11" width="2" height="1" fill="#b8a9fb"/><rect x="6" y="12" width="1" height="1" fill="#1d1147"/><rect x="9" y="12" width="1" height="1" fill="#1d1147"/><rect x="7" y="13" width="2" height="1" fill="#1d1147"/><rect x="4" y="16" width="2" height="1" fill="#ddd5ff"/><rect x="10" y="16" width="2" height="1" fill="#ddd5ff"/></svg>
diff --git a/deploy/coolify/kwnt.yaml b/deploy/coolify/kwnt.yaml
new file mode 100644
index 00000000..40d87fff
--- /dev/null
+++ b/deploy/coolify/kwnt.yaml
@@ -0,0 +1,29 @@
+# documentation: https://kwant.si/docs/install
+# slogan: Your own team of AI bots that check each other's work before saying done.
+# category: ai
+# tags: ai,agents,bots,automation,llm,claude,codex,self-hosted
+# logo: svgs/kwnt.svg
+# port: 8799
+
+services:
+ kwnt:
+ image: "ghcr.io/alexsergivan/kwnt:0.9.17"
+ environment:
+ - SERVICE_URL_KWNT_8799
+ # The sign-in token: Coolify makes it, and shows it in this service's Environment Variables.
+ - KWNT_API_TOKEN=${SERVICE_PASSWORD_64_KWNT}
+ - KWNT_ALLOWED_ORIGINS=${SERVICE_URL_KWNT}
+ - "KWNT_SIGNIN_HINT=Use the password Coolify made for kwnt: open this service's Environment Variables in Coolify and copy SERVICE_PASSWORD_64_KWNT."
+ volumes:
+ - "kwnt-data:/data"
+ healthcheck:
+ test:
+ - CMD
+ - bash
+ - "-c"
+ - "exec 3<>/dev/tcp/127.0.0.1/8799 && printf 'GET /api/health HTTP/1.0\\r\\nHost: localhost\\r\\n\\r\\n' >&3 && head -n 1 <&3 | grep -q ' 200 '"
+ interval: 5s
+ timeout: 10s
+ retries: 10
+volumes:
+ kwnt-data: null
diff --git a/deploy/umbrel/kwant/data/.gitkeep b/deploy/umbrel/kwant/data/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/deploy/umbrel/kwant/docker-compose.yml b/deploy/umbrel/kwant/docker-compose.yml
new file mode 100644
index 00000000..a4da061f
--- /dev/null
+++ b/deploy/umbrel/kwant/docker-compose.yml
@@ -0,0 +1,20 @@
+version: "3.7"
+
+services:
+ app_proxy:
+ environment:
+ APP_HOST: kwant_web_1
+ APP_PORT: 8799
+
+ web:
+ image: ghcr.io/alexsergivan/kwnt:0.9.17@sha256:8ce673fe74fe309d408f0a93b3b55659d263a0aa5abbe17a202ffa07a7f62ae3
+ user: "1000:1000"
+ restart: on-failure
+ init: true
+ environment:
+ # The sign-in token is the password Umbrel shows for this app.
+ KWNT_API_TOKEN: ${APP_PASSWORD}
+ KWNT_SIGNIN_HINT: "Use the password Umbrel shows for kwant: right-click the app icon and choose Show default credentials."
+ HOME: /data/home
+ volumes:
+ - ${APP_DATA_DIR}/data:/data
diff --git a/deploy/umbrel/kwant/umbrel-app.yml b/deploy/umbrel/kwant/umbrel-app.yml
new file mode 100644
index 00000000..1959632b
--- /dev/null
+++ b/deploy/umbrel/kwant/umbrel-app.yml
@@ -0,0 +1,35 @@
+manifestVersion: 1
+id: kwant
+storage:
+ dataRoot: data
+category: ai
+name: kwant
+version: "0.9.17"
+tagline: Your own team of AI bots that check each other's work
+description: >-
+ kwant asks for a sign-in token the first time you open it: use the password Umbrel shows for
+ kwant (right-click the app icon and choose Show default credentials). The browser then stays
+ signed in for a year.
+
+
+ kwant is an open-source, self-hosted team of AI bots. They share chats, hand work to each other
+ and run on a schedule, and a step only counts as done once kwant has seen the proof, not when a
+ bot says so. Add an AI account you already have (an API key, or a Claude, Codex or Grok sign-in)
+ and ask your first question.
+
+
+ Your bots, chats, settings and files stay in kwant's own folder on your Umbrel. This image has
+ no AI command-line tools inside; add an account in the app to start.
+releaseNotes: ""
+developer: kwant
+website: https://kwant.si
+dependencies: []
+repo: https://github.com/alexsergivan/kwant
+support: https://github.com/alexsergivan/kwant/issues
+port: 8799
+gallery: []
+path: ""
+defaultUsername: ""
+deterministicPassword: true
+submitter: alexsergivan
+submission: https://github.com/getumbrel/umbrel-apps/pull/6380
diff --git a/docker/render-entrypoint.sh b/docker/render-entrypoint.sh
new file mode 100644
index 00000000..41925535
--- /dev/null
+++ b/docker/render-entrypoint.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+# Hand the disk to kwnt (uid 10001) once, then drop root for good and start as the image does.
+set -eu
+data="${KWNT_DATA_DIR:-/data}"
+if [ "$(id -u)" = 0 ]; then
+ mkdir -p "$data"
+ [ "$(stat -c %u "$data")" = 10001 ] || chown -R 10001:10001 "$data"
+ exec setpriv --reuid=10001 --regid=10001 --init-groups -- /usr/local/bin/kwnt-entrypoint "$@"
+fi
+exec /usr/local/bin/kwnt-entrypoint "$@"
diff --git a/docker/render.Dockerfile b/docker/render.Dockerfile
new file mode 100644
index 00000000..534ba394
--- /dev/null
+++ b/docker/render.Dockerfile
@@ -0,0 +1,9 @@
+# kwant on Render (render.yaml). Render mounts its persistent disk on /data, and a fresh disk
+# may belong to root, while kwnt runs as uid 10001. So this starts as root only long enough to
+# hand /data to kwnt, then runs kwnt as uid 10001. Nothing is compiled: it is the released image.
+FROM ghcr.io/alexsergivan/kwnt:0.9.17@sha256:8ce673fe74fe309d408f0a93b3b55659d263a0aa5abbe17a202ffa07a7f62ae3
+USER root
+COPY render-entrypoint.sh /usr/local/bin/kwnt-render-entrypoint
+RUN chmod 755 /usr/local/bin/kwnt-render-entrypoint
+ENTRYPOINT ["/usr/local/bin/kwnt-render-entrypoint"]
+CMD ["kwnt", "serve"]
diff --git a/docs/llm-profiles.md b/docs/llm-profiles.md
index 264f9213..ee4c5af2 100644
--- a/docs/llm-profiles.md
+++ b/docs/llm-profiles.md
@@ -100,6 +100,11 @@ as any other user it fails with an error, because it can't find or read the toke
systemd unit, `sudo cat /var/lib/kwnt/api-token`). Each
install has its own token, so a token from another computer won't work either. The
sign-in screen asks where kwant runs (a server, Docker, or this computer) and shows the matching steps.
+`KWNT_SIGNIN_HINT` puts one line of your own at the top of the sign-in screen, before anyone signs
+in, with the token box right under it. App-store listings use it to say where their generated
+password is, e.g. "Use the password Umbrel shows for kwant". It is shown as plain text (no HTML),
+cut to one line of at most 300 characters, and left out entirely if it contains the API token.
+`GET /api/auth/status` returns it as `signin_hint`.
Person-only routes (sign-in links, saved passwords and the vault, answering approval cards, the approvals switch,
deleting a bot or team, undo, Loose ends, Parallel Universe, letters) refuse a bot's turn token, or
diff --git a/docs/self-host-stores.md b/docs/self-host-stores.md
new file mode 100644
index 00000000..b690a70e
--- /dev/null
+++ b/docs/self-host-stores.md
@@ -0,0 +1,35 @@
+# kwant in self-hosted app stores and on Render
+
+Each listing runs the released kwnt image alone (no Laya, no bots' browser), pinned to the release
+version, with `/data` on the store's persistent storage. Bots are then picked by keyword, VM mode is
+off, and there are no AI CLIs inside the image, so you add an API key in the app.
+
+| Where | File | Data | Sign-in token | Store login in front |
+|---|---|---|---|---|
+| CasaOS / ZimaOS | [`deploy/casaos/Kwnt/docker-compose.yml`](../deploy/casaos/Kwnt/docker-compose.yml) | `/DATA/AppData/kwnt/data` | kwnt's own: run `kwnt token --raw` in the app's **Terminal** | none |
+| Umbrel | [`deploy/umbrel/kwant/`](../deploy/umbrel/kwant) | `${APP_DATA_DIR}/data` | the password Umbrel shows (`APP_PASSWORD`, `deterministicPassword: true`) | Umbrel login |
+| Coolify | [`deploy/coolify/kwnt.yaml`](../deploy/coolify/kwnt.yaml) | named volume `kwnt-data` | `SERVICE_PASSWORD_64_KWNT` from the service's environment variables | none (HTTPS from Coolify's proxy) |
+| Render | [`render.yaml`](../render.yaml) | 1 GB disk on `/data` (**paid instance only**) | `KWNT_API_TOKEN` (Render's `generateValue`) from the **Environment** page | none |
+
+Every listing sets `KWNT_SIGNIN_HINT`, one line the sign-in screen shows before anyone signs in, so
+the first sign-in needs nothing but the browser and the store's own page. Images before the release
+that added the hint ignore it; their token box is under **Other setups**.
+
+## Why each file looks the way it does
+
+- **kwnt runs as uid 10001.** A named volume inherits that from the image (Coolify). A bind mount the
+ store creates belongs to root, so CasaOS runs a one-shot `kwnt-init` service (the same image, as
+ root, no network) that hands the folder to 10001 before kwnt starts. Umbrel creates app folders as
+ uid 1000, so its listing runs kwnt as `1000:1000`. A fresh Render disk may belong to root, so
+ `render.yaml` builds [`docker/render.Dockerfile`](../docker/render.Dockerfile): the released image
+ plus a start step that hands `/data` to 10001 and then drops root with `setpriv` (nothing compiles).
+- **The token comes from the store** wherever the store can make a secret (Umbrel, Coolify, Render),
+ through `KWNT_API_TOKEN`. CasaOS has no secret generator, so kwnt makes its own in `/data/api-token`.
+- **Pinned images.** CasaOS and Umbrel pin `tag@sha256:<index digest>` (multi-arch: amd64 and arm64);
+ Coolify templates and Render use the tag, as their other entries do.
+
+## A new release
+
+`registry_bump.sh <version>` (in the release tools) bumps every listing here: the image tag and
+index digest, CasaOS `version`/`update_at`, and Umbrel `version`. The upstream store copies (CasaOS
+and Umbrel PRs from the alexsergivan forks) get the same edit as a new PR to each store.
diff --git a/frontend/src/auth.ts b/frontend/src/auth.ts
index e3c40099..67c46016 100644
--- a/frontend/src/auth.ts
+++ b/frontend/src/auth.ts
@@ -61,6 +61,14 @@ export interface AuthStatus {
person_authenticated?: boolean;
/** This server can let a new browser in from a signed-in device (newer servers). */
device_login?: boolean;
+ /** Where an app store or host shows this install's token (`KWNT_SIGNIN_HINT`), plain text; absent when unset. */
+ signin_hint?: string | null;
+}
+
+/** The store's or host's sign-in hint, or null: trimmed text only, whatever an older or odd server sent. */
+export function signinHintOf(s: Pick<AuthStatus, 'signin_hint'>): string | null {
+ const h = typeof s.signin_hint === 'string' ? s.signin_hint.trim() : '';
+ return h ? h : null;
}
/** Asks for the token for a person-only action, as if one had answered 401. */
diff --git a/frontend/src/components/AuthGate.tsx b/frontend/src/components/AuthGate.tsx
index efaa3c8d..5a227481 100644
--- a/frontend/src/components/AuthGate.tsx
+++ b/frontend/src/components/AuthGate.tsx
@@ -14,6 +14,7 @@ import {
fetchAuthStatus,
installUnauthorizedListener,
redeemSignIn,
+ signinHintOf,
} from '../auth';
import { fillTimeZone } from '../continuity';
import { AuthContext, useAuth } from '../authContext';
@@ -22,8 +23,8 @@ export { useAuth };
type GateState =
| { kind: 'checking' }
- | { kind: 'ready'; authRequired: boolean; deviceLogin: boolean }
- | { kind: 'locked'; notice: string | null; deviceLogin: boolean }
+ | { kind: 'ready'; authRequired: boolean; deviceLogin: boolean; signinHint: string | null }
+ | { kind: 'locked'; notice: string | null; deviceLogin: boolean; signinHint: string | null }
| { kind: 'offline'; message: string };
installUnauthorizedListener();
@@ -56,10 +57,11 @@ export const AuthGate: React.FC<{ children: React.ReactNode }> = ({ children })
try {
const s = await fetchAuthStatus();
const deviceLogin = s.device_login === true;
+ const signinHint = signinHintOf(s);
setState(
s.auth_required && !s.authenticated
- ? { kind: 'locked', notice, deviceLogin }
- : { kind: 'ready', authRequired: s.auth_required, deviceLogin },
+ ? { kind: 'locked', notice, deviceLogin, signinHint }
+ : { kind: 'ready', authRequired: s.auth_required, deviceLogin, signinHint },
);
} catch (e) {
setState({ kind: 'offline', message: offlineMessage(e, navigator.onLine) });
@@ -103,7 +105,12 @@ export const AuthGate: React.FC<{ children: React.ReactNode }> = ({ children })
try {
await endSession();
} finally {
- setState((prev) => ({ kind: 'locked', notice: 'Signed out.', deviceLogin: prev.kind === 'ready' && prev.deviceLogin }));
+ setState((prev) => ({
+ kind: 'locked',
+ notice: 'Signed out.',
+ deviceLogin: prev.kind === 'ready' && prev.deviceLogin,
+ signinHint: prev.kind === 'ready' ? prev.signinHint : null,
+ }));
}
}, []);
@@ -116,6 +123,7 @@ export const AuthGate: React.FC<{ children: React.ReactNode }> = ({ children })
{personPrompt && (
<PersonTokenDialog
deviceLogin={state.deviceLogin}
+ signinHint={state.signinHint}
onClose={() => {
setPersonPrompt(false);
window.dispatchEvent(new Event(PERSON_PROMPT_CLOSED_EVENT));
@@ -160,18 +168,19 @@ export const AuthGate: React.FC<{ children: React.ReactNode }> = ({ children })
</button>
</div>
)}
- {state.kind === 'locked' && <TokenForm notice={state.notice} deviceLogin={state.deviceLogin} onSignedIn={() => check()} />}
+ {state.kind === 'locked' && <TokenForm notice={state.notice} deviceLogin={state.deviceLogin} signinHint={state.signinHint} onSignedIn={() => check()} />}
</div>
</div>
);
};
/** The token screen as a dialog, for an action only the person may take. The app stays open under it. */
-export const PersonTokenDialog: React.FC<{ onClose: () => void; onSignedIn: () => void; deviceLogin?: boolean }> = ({
- onClose,
- onSignedIn,
- deviceLogin = false,
-}) => {
+export const PersonTokenDialog: React.FC<{
+ onClose: () => void;
+ onSignedIn: () => void;
+ deviceLogin?: boolean;
+ signinHint?: string | null;
+}> = ({ onClose, onSignedIn, deviceLogin = false, signinHint = null }) => {
useEffect(() => {
const onKey = (e: KeyboardEvent) => {
if (e.key === 'Escape') onClose();
@@ -196,7 +205,7 @@ export const PersonTokenDialog: React.FC<{ onClose: () => void; onSignedIn: () =
>
<X size={14} />
</button>
- <TokenForm notice={null} onSignedIn={onSignedIn} personOnly onCancel={onClose} deviceLogin={deviceLogin} />
+ <TokenForm notice={null} onSignedIn={onSignedIn} personOnly onCancel={onClose} deviceLogin={deviceLogin} signinHint={signinHint} />
</div>
</div>
);
@@ -325,6 +334,10 @@ export const selectForRetry = (el: Pick<HTMLInputElement, 'focus' | 'select'> |
export const WRONG_TOKEN = "That token isn't right. It has to come from the machine running kwant bots, as the user running it.";
/** Only shown with the wrong-token error, not up front. */
export const OWN_TOKEN_HINT = "Each install has its own token, so one copied from another computer won't work here.";
+/** With a store hint the person has no shell, so the wrong-token error points back to the hint instead. */
+export const HINT_WRONG_TOKEN = "That isn't this install's token. Copy it again from the place named above.";
+/** The error for a refused token: with a store hint, back to the hint; without, where it has to come from. */
+export const wrongTokenError = (signinHint: string | null) => (signinHint ? HINT_WRONG_TOKEN : WRONG_TOKEN);
export const TokenForm: React.FC<{
notice: string | null;
@@ -333,7 +346,12 @@ export const TokenForm: React.FC<{
onCancel?: () => void;
/** The server can let this browser in from a signed-in device: that comes first. */
deviceLogin?: boolean;
-}> = ({ notice, onSignedIn, personOnly = false, onCancel, deviceLogin = false }) => {
+ /**
+ * An app store or host set this install's token and says where it shows it (`KWNT_SIGNIN_HINT`):
+ * the hint and the token box then lead, open, since its users have no shell for the link commands.
+ */
+ signinHint?: string | null;
+}> = ({ notice, onSignedIn, personOnly = false, onCancel, deviceLogin = false, signinHint = null }) => {
const [token, setToken] = useState('');
const [busy, setBusy] = useState(false);
const [error, setError] = useState<string | null>(null);
@@ -345,10 +363,10 @@ export const TokenForm: React.FC<{
useEffect(() => {
if (error && !busy) {
- setOthersOpen(true);
+ if (!signinHint) setOthersOpen(true);
selectForRetry(inputRef.current);
}
- }, [error, busy]);
+ }, [error, busy, signinHint]);
const submit = async (e: React.FormEvent) => {
e.preventDefault();
@@ -363,7 +381,7 @@ export const TokenForm: React.FC<{
onSignedIn();
return;
}
- setError(result === 'link_used_or_expired' ? LINK_SPENT : WRONG_TOKEN);
+ setError(result === 'link_used_or_expired' ? LINK_SPENT : wrongTokenError(signinHint));
} catch (err) {
setError(err instanceof Error && err.message !== 'Failed to fetch' ? err.message : 'Could not reach the server.');
} finally {
@@ -371,6 +389,55 @@ export const TokenForm: React.FC<{
}
};
+ const tokenBox = (
+ <div className="space-y-1.5">
+ <label htmlFor="kwnt-token" className="block text-[11px] text-zinc-500 leading-snug">
+ Paste a sign-in link or the access token
+ </label>
+ <div className="flex gap-2">
+ <input
+ id="kwnt-token"
+ ref={inputRef}
+ type="password"
+ autoComplete="off"
+ spellCheck={false}
+ value={token}
+ onChange={(e) => setToken(e.target.value)}
+ aria-invalid={!!error}
+ aria-describedby={error ? 'kwnt-token-error' : undefined}
+ className="flex-1 min-w-0 min-h-[44px] sm:min-h-0 bg-zinc-950 border border-zinc-800 rounded-lg px-3 py-2 text-xs font-mono text-zinc-100 placeholder-zinc-600 focus:border-sky-500 focus:outline-none transition-colors"
+ placeholder="Link or token"
+ />
+ <button
+ type="submit"
+ disabled={busy || !token.trim()}
+ className="shrink-0 flex items-center justify-center gap-1.5 min-h-[44px] sm:min-h-0 px-4 py-2 rounded-lg text-xs font-medium text-white bg-sky-600 hover:bg-sky-500 transition-colors disabled:opacity-50"
+ >
+ {busy && <Loader2 size={13} className="animate-spin motion-reduce:animate-none" />} Continue
+ </button>
+ </div>
+ {error && (
+ <p id="kwnt-token-error" className="text-[11px] text-rose-400 leading-snug" role="alert">
+ {error}
+ {error === WRONG_TOKEN && ` ${OWN_TOKEN_HINT}`}
+ </p>
+ )}
+ </div>
+ );
+
+ const deviceWays = (open: string) => (
+ <>
+ {deviceLogin && <DeviceWait onSignedIn={onSignedIn} />}
+ <div className="space-y-1.5">
+ <p className="text-xs text-zinc-400 leading-relaxed">
+ {open} the one-time sign-in link kwant bots printed when it started, or scan its QR code with your phone. Used or lost
+ it? Make a new one on the machine running kwant bots:
+ </p>
+ <Command>{docker ? DOCKER_LINK_COMMAND : LINK_COMMAND}</Command>
+ </div>
+ </>
+ );
+
return (
<form onSubmit={submit} className="space-y-4">
<div className="space-y-1.5">
@@ -388,48 +455,20 @@ export const TokenForm: React.FC<{
{notice}
</p>
)}
- {deviceLogin && <DeviceWait onSignedIn={onSignedIn} />}
- <div className="space-y-1.5">
- <p className="text-xs text-zinc-400 leading-relaxed">
- {deviceLogin ? 'Or open' : 'Open'} the one-time sign-in link kwant bots printed when it started, or scan its QR code with your phone. Used or lost
- it? Make a new one on the machine running kwant bots:
- </p>
- <Command>{docker ? DOCKER_LINK_COMMAND : LINK_COMMAND}</Command>
- </div>
- <OtherSetups loc={loc} docker={docker} open={othersOpen} onToggle={setOthersOpen}>
- <div className="space-y-1.5">
- <label htmlFor="kwnt-token" className="block text-[11px] text-zinc-500 leading-snug">
- Paste a sign-in link or the access token
- </label>
- <div className="flex gap-2">
- <input
- id="kwnt-token"
- ref={inputRef}
- type="password"
- autoComplete="off"
- spellCheck={false}
- value={token}
- onChange={(e) => setToken(e.target.value)}
- aria-invalid={!!error}
- aria-describedby={error ? 'kwnt-token-error' : undefined}
- className="flex-1 min-w-0 bg-zinc-950 border border-zinc-800 rounded-lg px-3 py-2 text-xs font-mono text-zinc-100 placeholder-zinc-600 focus:border-sky-500 focus:outline-none transition-colors"
- placeholder="Link or token"
- />
- <button
- type="submit"
- disabled={busy || !token.trim()}
- className="shrink-0 flex items-center justify-center gap-1.5 px-4 py-2 rounded-lg text-xs font-medium text-white bg-sky-600 hover:bg-sky-500 transition-colors disabled:opacity-50"
- >
- {busy && <Loader2 size={13} className="animate-spin motion-reduce:animate-none" />} Continue
- </button>
- </div>
- {error && (
- <p id="kwnt-token-error" className="text-[11px] text-rose-400 leading-snug" role="alert">
- {error}
- {error === WRONG_TOKEN && ` ${OWN_TOKEN_HINT}`}
- </p>
- )}
+ {/* A store install has no other signed-in device yet, so its own way in comes first */}
+ {signinHint && (
+ <div className="space-y-2">
+ <p className="text-xs text-zinc-300 leading-relaxed" data-testid="kwnt-signin-hint">
+ {signinHint}
+ </p>
+ {tokenBox}
</div>
+ )}
+ {/* Without a hint: the device code and the link lead, the token box is the fallback. With one,
+ a fresh store install has no other device and no shell, so they move into the fold. */}
+ {!signinHint && deviceWays(deviceLogin ? 'Or open' : 'Open')}
+ <OtherSetups loc={loc} docker={docker} open={othersOpen} onToggle={setOthersOpen}>
+ {signinHint ? deviceWays('Open') : tokenBox}
</OtherSetups>
<p className="text-[11px] text-zinc-500">Stays signed in for a year. Anyone with a sign-in link or the token controls this server.</p>
{onCancel && (
diff --git a/frontend/tests/tokenSteps.test.mjs b/frontend/tests/tokenSteps.test.mjs
index b2c68c0a..73e6404a 100644
--- a/frontend/tests/tokenSteps.test.mjs
+++ b/frontend/tests/tokenSteps.test.mjs
@@ -7,10 +7,10 @@ import { loadBundled } from './bundle.mjs';
const m = await loadBundled(`
import React from 'react';
import { renderToStaticMarkup } from 'react-dom/server.browser';
- import { OWN_TOKEN_HINT, OtherSetups, TokenForm, WRONG_TOKEN, isLoopback, selectForRetry, tokenFromPaste, tunnelCommand } from './src/components/AuthGate';
- import { LINK_SPENT } from './src/auth';
- export { LINK_SPENT, OWN_TOKEN_HINT, WRONG_TOKEN, isLoopback, selectForRetry, tokenFromPaste, tunnelCommand };
- export const form = (notice = null) => renderToStaticMarkup(React.createElement(TokenForm, { notice, onSignedIn: () => {} }));
+ import { HINT_WRONG_TOKEN, OWN_TOKEN_HINT, OtherSetups, TokenForm, WRONG_TOKEN, isLoopback, selectForRetry, tokenFromPaste, tunnelCommand, wrongTokenError } from './src/components/AuthGate';
+ import { LINK_SPENT, signinHintOf } from './src/auth';
+ export { HINT_WRONG_TOKEN, LINK_SPENT, OWN_TOKEN_HINT, WRONG_TOKEN, isLoopback, selectForRetry, signinHintOf, tokenFromPaste, tunnelCommand, wrongTokenError };
+ export const form = (notice = null, extra = {}) => renderToStaticMarkup(React.createElement(TokenForm, { notice, onSignedIn: () => {}, ...extra }));
export const other = (loc, docker = false) => renderToStaticMarkup(React.createElement(OtherSetups, { loc, docker }));
`);
@@ -98,3 +98,77 @@ test('after a wrong token the box is focused and selected, so the next paste rep
assert.deepEqual(calls, ['focus', 'select']);
assert.doesNotThrow(() => m.selectForRetry(null));
});
+
+// 24f: an app store (Umbrel, CasaOS, Coolify, Render) sets the token and says where it shows it.
+const UMBREL = 'Use the password Umbrel shows on kwnt\'s app page. <b>not html</b>';
+
+test('a store hint leads: its words, then the token box open, before the device code and the link', () => {
+ const html = m.form(null, { signinHint: UMBREL, deviceLogin: true });
+ const t = text(html);
+ assert.match(html, /data-testid="kwnt-signin-hint"/);
+ assert.match(t, /Use the password Umbrel shows on kwnt's app page\. <b>not html<\/b>/, 'shown as text, never as markup');
+ assert.ok(!html.includes('<b>not html</b>'));
+ const fold = html.indexOf('<details');
+ const box = html.indexOf('id="kwnt-token"');
+ assert.ok(box > 0 && box < fold, 'the token box is outside the fold');
+ assert.equal(html.split('id="kwnt-token"').length, 2, 'one token box');
+ assert.ok(html.indexOf('kwnt-signin-hint') < box);
+ assert.ok(t.indexOf('Umbrel shows') < t.indexOf('kwnt signin-link'));
+ // The fold still has the shell ways in, for people who have one
+ assert.match(text(html.slice(fold)), /cat ~\/\.kwnt\/api-token|docker compose exec kwnt kwnt token --raw/);
+});
+
+test('with a hint, the device button and the link command are not above Other setups', () => {
+ for (const deviceLogin of [true, false]) {
+ const html = m.form(null, { signinHint: UMBREL, deviceLogin });
+ const fold = html.indexOf('<details');
+ const above = text(html.slice(0, fold));
+ const inside = text(html.slice(fold));
+ assert.ok(!/Sign in from another device|signin-link|one-time sign-in link/.test(above), `nothing above the fold (deviceLogin ${deviceLogin}): ${above}`);
+ // In the fold: the device code first, then the link starting with "Open", then the shell token commands
+ assert.match(inside, /Open the one-time sign-in link/);
+ assert.ok(!/Or open/.test(inside));
+ assert.match(inside, /kwnt signin-link/);
+ assert.ok(inside.indexOf('one-time sign-in link') < inside.indexOf('Get the access token'));
+ if (deviceLogin) assert.ok(inside.indexOf('Sign in from another device') < inside.indexOf('one-time sign-in link'));
+ else assert.ok(!inside.includes('Sign in from another device'));
+ // hint -> token box -> Other setups -> footer
+ const order = ['kwnt-signin-hint', 'id="kwnt-token"', '<details', 'Stays signed in for a year'].map((k) => html.indexOf(k));
+ assert.ok(order.every((i, n) => i >= 0 && (n === 0 || i > order[n - 1])), String(order));
+ }
+});
+
+test('with a hint, a wrong token points back to the hint; without one the error is unchanged', () => {
+ assert.equal(m.HINT_WRONG_TOKEN, "That isn't this install's token. Copy it again from the place named above.");
+ assert.equal(m.wrongTokenError(UMBREL), m.HINT_WRONG_TOKEN);
+ assert.equal(m.wrongTokenError(null), m.WRONG_TOKEN);
+});
+
+test('the token box and Continue are 44 px tall on a phone, unchanged from sm up', () => {
+ const html = m.form(null, { signinHint: UMBREL });
+ assert.match(html, /<input id="kwnt-token"[^>]*class="[^"]*min-h-\[44px\] sm:min-h-0/);
+ assert.match(html, /<button type="submit"[^>]*class="[^"]*min-h-\[44px\] sm:min-h-0/);
+});
+
+test('without a hint the screen is unchanged: the device code and the link lead, "Or open" after the button', () => {
+ const t = text(m.form(null, { deviceLogin: true }));
+ assert.ok(t.indexOf('Sign in from another device') < t.indexOf('Or open the one-time sign-in link'));
+ assert.ok(t.indexOf('kwnt signin-link') < t.indexOf('Other setups'));
+});
+
+test('without a hint the screen is unchanged: the box stays folded', () => {
+ for (const hint of [undefined, null, '']) {
+ const html = m.form(null, { signinHint: hint });
+ assert.ok(!html.includes('kwnt-signin-hint'), String(hint));
+ assert.ok(html.indexOf('id="kwnt-token"') > html.indexOf('<details'), String(hint));
+ }
+});
+
+test('the hint from the status answer: text only, trimmed, null when missing or odd', () => {
+ assert.equal(m.signinHintOf({ signin_hint: ' Copy KWNT_API_TOKEN from Render. ' }), 'Copy KWNT_API_TOKEN from Render.');
+ assert.equal(m.signinHintOf({ signin_hint: null }), null);
+ assert.equal(m.signinHintOf({}), null, 'a server without a hint leaves the field out');
+ assert.equal(m.signinHintOf({}), null);
+ assert.equal(m.signinHintOf({ signin_hint: ' ' }), null);
+ assert.equal(m.signinHintOf({ signin_hint: 42 }), null);
+});
diff --git a/render.yaml b/render.yaml
new file mode 100644
index 00000000..13977800
--- /dev/null
+++ b/render.yaml
@@ -0,0 +1,25 @@
+# Deploy kwant to Render: https://render.com/deploy?repo=https://github.com/alexsergivan/kwant
+# Render keeps files only on a persistent disk, and disks need a paid instance (Starter or up),
+# so this Blueprint asks for one. The sign-in token is made by Render: open the service's
+# Environment page and copy KWNT_API_TOKEN.
+# docker/render.Dockerfile is the released image plus a start step that hands the disk to kwnt
+# (a fresh disk may belong to root); Render builds it in seconds, nothing is compiled.
+services:
+ - type: web
+ name: kwnt
+ runtime: docker
+ dockerfilePath: ./docker/render.Dockerfile
+ dockerContext: ./docker
+ plan: starter
+ healthCheckPath: /api/health
+ envVars:
+ - key: PORT
+ value: "8799"
+ - key: KWNT_API_TOKEN
+ generateValue: true
+ - key: KWNT_SIGNIN_HINT
+ value: "Use the token Render made for kwnt: open this service's Environment page on Render and copy KWNT_API_TOKEN."
+ disk:
+ name: kwnt-data
+ mountPath: /data
+ sizeGB: 1
diff --git a/site-src/docs-install.html b/site-src/docs-install.html
index f4cc96b7..be1293cf 100644
--- a/site-src/docs-install.html
+++ b/site-src/docs-install.html
@@ -156,6 +156,17 @@ docker compose exec kwnt kwnt token --raw <span class="c"># the toke
<p>Instead of CLIs you can add an API key in the app under <strong>Settings → This space → Accounts</strong>. CLI sign-ins persist in the <code>kwnt-home</code> volume and data in <code>kwnt-data</code>. The UI is published on <code>127.0.0.1:8799</code> only: put HTTPS in front (below) and set <code>KWNT_ALLOWED_ORIGINS=https://your.domain</code> in <code>.env</code>. With Caddy that's a two-line <code>Caddyfile</code>: <code>your.domain { reverse_proxy 127.0.0.1:8799 }</code>.</p>
<p>Requests through Docker's published port count as remote, so sign in with a one-time link: <code>docker compose exec kwnt kwnt signin-link</code> prints a new one (and a QR code), or paste the token from <code>docker compose exec kwnt kwnt token --raw</code>. kwant's own <code>execute_shell</code> tool isn't available in this stack, because it would need the host's Docker socket; the CLIs' shell tools work. Upgrading from an older image, where kwnt ran as root? If it says <code>/data isn't writable</code>, run once: <code>docker compose run --rm -u root kwnt chown -R 10001:10001 /data</code>.</p>
+<h2 id="stores">Render, CasaOS, Umbrel and Coolify</h2>
+<p><a href="https://render.com/deploy?repo=https://github.com/alexsergivan/kwant"><img src="https://render.com/images/deploy-to-render-button.svg" alt="Deploy to Render" width="153" height="40"></a></p>
+<p>The button reads <a href="https://github.com/alexsergivan/kwant/blob/main/render.yaml"><code>render.yaml</code></a>: one web service from the released image, with a 1 GB disk on <code>/data</code>. <strong>Render keeps files only on a disk, and disks need a paid instance</strong> (Starter or up), so the free plan won't work. Render makes the sign-in token: copy <code>KWNT_API_TOKEN</code> from the service's <strong>Environment</strong> page and paste it on the sign-in screen.</p>
+<p>For a home server, the repo's <a href="https://github.com/alexsergivan/kwant/tree/main/deploy"><code>deploy/</code></a> folder has a listing for each store, pinned to the release:</p>
+<ul>
+<li><strong>CasaOS:</strong> sign in with the token that <code>kwnt token --raw</code> prints in the app's <strong>Terminal</strong> (kwant's menu on the dashboard). Until the store lists kwant, import the file under <strong>Custom Install</strong>.</li>
+<li><strong>Umbrel:</strong> sign in with the password Umbrel shows for kwant. Umbrel's own login stays in front of it.</li>
+<li><strong>Coolify:</strong> sign in with <code>SERVICE_PASSWORD_64_KWNT</code> from the service's environment variables. Until it is a Coolify template, run the file as a <strong>Docker Compose</strong> resource.</li>
+</ul>
+<p>These run kwnt alone, without Laya or the bots' private browser, so bots are picked by keyword and VM mode is off. The image has no AI CLIs inside: add an API key in the app.</p>
+
<h2 id="deps">Without Docker: <code>kwnt setup</code>, then <code>kwnt doctor</code></h2>
<p><code>kwnt setup</code> installs what kwant needs on this machine: Chromium or Chrome for the bots' browser, Laya (in kwant's data folder, with its own <code>uv</code> if there's no Python) and a CLI (<code>claude</code> unless you name others with <code>--clis</code>). It asks before each step (<code>--yes</code> skips the questions), never runs <code>sudo</code> itself (it prints the command for you), installs into your home folder where it can, skips Docker unless you pass <code>--docker</code>, and is safe to run again.</p>
<p><strong>No Node needed.</strong> Since 0.7.6, on a Mac or Linux computer without Node, kwant installs Codex from OpenAI's standalone release and checks its SHA-256 before unpacking anything. With no Chrome or Chromium on the computer, kwant downloads Chrome for Testing into its own folder the first time a bot needs the browser. If a download fails, Settings says why.</p>
diff --git a/site/docs/install.html b/site/docs/install.html
index 573314d6..369f69a9 100644
--- a/site/docs/install.html
+++ b/site/docs/install.html
@@ -20,7 +20,7 @@
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="Install &amp; run: On your own computer, on a VPS with systemd, or with Docker Compose.">
<meta property="article:published_time" content="2026-10-22">
-<meta property="article:modified_time" content="2026-11-15">
+<meta property="article:modified_time" content="2026-11-16">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@kwantbot">
<meta name="twitter:title" content="Install kwnt: self-host AI agents on a VPS or Docker · kwant">
@@ -216,6 +216,17 @@ docker compose exec kwnt kwnt token --raw <span class="c"># the toke
<p>Instead of CLIs you can add an API key in the app under <strong>Settings → This space → Accounts</strong>. CLI sign-ins persist in the <code>kwnt-home</code> volume and data in <code>kwnt-data</code>. The UI is published on <code>127.0.0.1:8799</code> only: put HTTPS in front (below) and set <code>KWNT_ALLOWED_ORIGINS=https://your.domain</code> in <code>.env</code>. With Caddy that's a two-line <code>Caddyfile</code>: <code>your.domain { reverse_proxy 127.0.0.1:8799 }</code>.</p>
<p>Requests through Docker's published port count as remote, so sign in with a one-time link: <code>docker compose exec kwnt kwnt signin-link</code> prints a new one (and a QR code), or paste the token from <code>docker compose exec kwnt kwnt token --raw</code>. kwant's own <code>execute_shell</code> tool isn't available in this stack, because it would need the host's Docker socket; the CLIs' shell tools work. Upgrading from an older image, where kwnt ran as root? If it says <code>/data isn't writable</code>, run once: <code>docker compose run --rm -u root kwnt chown -R 10001:10001 /data</code>.</p>
+<h2 id="stores">Render, CasaOS, Umbrel and Coolify</h2>
+<p><a href="https://render.com/deploy?repo=https://github.com/alexsergivan/kwant"><img src="https://render.com/images/deploy-to-render-button.svg" alt="Deploy to Render" width="153" height="40"></a></p>
+<p>The button reads <a href="https://github.com/alexsergivan/kwant/blob/main/render.yaml"><code>render.yaml</code></a>: one web service from the released image, with a 1 GB disk on <code>/data</code>. <strong>Render keeps files only on a disk, and disks need a paid instance</strong> (Starter or up), so the free plan won't work. Render makes the sign-in token: copy <code>KWNT_API_TOKEN</code> from the service's <strong>Environment</strong> page and paste it on the sign-in screen.</p>
+<p>For a home server, the repo's <a href="https://github.com/alexsergivan/kwant/tree/main/deploy"><code>deploy/</code></a> folder has a listing for each store, pinned to the release:</p>
+<ul>
+<li><strong>CasaOS:</strong> sign in with the token that <code>kwnt token --raw</code> prints in the app's <strong>Terminal</strong> (kwant's menu on the dashboard). Until the store lists kwant, import the file under <strong>Custom Install</strong>.</li>
+<li><strong>Umbrel:</strong> sign in with the password Umbrel shows for kwant. Umbrel's own login stays in front of it.</li>
+<li><strong>Coolify:</strong> sign in with <code>SERVICE_PASSWORD_64_KWNT</code> from the service's environment variables. Until it is a Coolify template, run the file as a <strong>Docker Compose</strong> resource.</li>
+</ul>
+<p>These run kwnt alone, without Laya or the bots' private browser, so bots are picked by keyword and VM mode is off. The image has no AI CLIs inside: add an API key in the app.</p>
+
<h2 id="deps">Without Docker: <code>kwnt setup</code>, then <code>kwnt doctor</code></h2>
<p><code>kwnt setup</code> installs what kwant needs on this machine: Chromium or Chrome for the bots' browser, Laya (in kwant's data folder, with its own <code>uv</code> if there's no Python) and a CLI (<code>claude</code> unless you name others with <code>--clis</code>). It asks before each step (<code>--yes</code> skips the questions), never runs <code>sudo</code> itself (it prints the command for you), installs into your home folder where it can, skips Docker unless you pass <code>--docker</code>, and is safe to run again.</p>
<p><strong>No Node needed.</strong> Since 0.7.6, on a Mac or Linux computer without Node, kwant installs Codex from OpenAI's standalone release and checks its SHA-256 before unpacking anything. With no Chrome or Chromium on the computer, kwant downloads Chrome for Testing into its own folder the first time a bot needs the browser. If a download fails, Settings says why.</p>
@@ -311,7 +322,7 @@ docker compose exec kwnt kwnt doctor</code></pre>
</footer>
<script src="../assets/js/site.js?v=02a491b838" defer></script>
<script src="../assets/js/pixel.js?v=0a1a3bf1e2" defer></script>
-<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"TechArticle","@id":"https://kwant.si/docs/install#article","headline":"Install kwnt: self-host AI agents on a VPS or Docker","description":"Build the kwnt binary and run your AI bots on your laptop, on a VPS with systemd, or with Docker Compose behind an HTTPS reverse proxy.","url":"https://kwant.si/docs/install","mainEntityOfPage":"https://kwant.si/docs/install","image":"https://kwant.si/assets/og/docs-install.png?v=8675f78476","inLanguage":"en","datePublished":"2026-10-22","dateModified":"2026-11-15","author":{"@id":"https://kwant.si/#org"},"publisher":{"@id":"https://kwant.si/#org"},"about":{"@id":"https://kwant.si/#app"},"isPartOf":{"@id":"https://kwant.si/#website"}},{"@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"kwant","item":"https://kwant.si/"},{"@type":"ListItem","position":2,"name":"Docs","item":"https://kwant.si/docs/quickstart"},{"@type":"ListItem","position":3,"name":"Install & run","item":"https://kwant.si/docs/install"}]},{"@type":"Organization","@id":"https://kwant.si/#org","name":"kwant","alternateName":"kwnt","url":"https://kwant.si/","logo":"https://kwant.si/apple-touch-icon.png","sameAs":["https://github.com/alexsergivan/kwant"]}]}</script>
+<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"TechArticle","@id":"https://kwant.si/docs/install#article","headline":"Install kwnt: self-host AI agents on a VPS or Docker","description":"Build the kwnt binary and run your AI bots on your laptop, on a VPS with systemd, or with Docker Compose behind an HTTPS reverse proxy.","url":"https://kwant.si/docs/install","mainEntityOfPage":"https://kwant.si/docs/install","image":"https://kwant.si/assets/og/docs-install.png?v=8675f78476","inLanguage":"en","datePublished":"2026-10-22","dateModified":"2026-11-16","author":{"@id":"https://kwant.si/#org"},"publisher":{"@id":"https://kwant.si/#org"},"about":{"@id":"https://kwant.si/#app"},"isPartOf":{"@id":"https://kwant.si/#website"}},{"@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"kwant","item":"https://kwant.si/"},{"@type":"ListItem","position":2,"name":"Docs","item":"https://kwant.si/docs/quickstart"},{"@type":"ListItem","position":3,"name":"Install & run","item":"https://kwant.si/docs/install"}]},{"@type":"Organization","@id":"https://kwant.si/#org","name":"kwant","alternateName":"kwnt","url":"https://kwant.si/","logo":"https://kwant.si/apple-touch-icon.png","sameAs":["https://github.com/alexsergivan/kwant"]}]}</script>
<script type="application/json" id="cf-beacon">{"token": "7f6ed395033a43eea3885ad0943890c2"}</script>
</body>
</html>
diff --git a/site/sitemap.xml b/site/sitemap.xml
index d4793aa6..c8c85946 100644
--- a/site/sitemap.xml
+++ b/site/sitemap.xml
@@ -15,7 +15,7 @@
<url><loc>https://kwant.si/docs/flight-school</loc><lastmod>2026-11-06</lastmod></url>
<url><loc>https://kwant.si/docs/goals</loc><lastmod>2026-11-05</lastmod></url>
<url><loc>https://kwant.si/docs/idea-jar</loc><lastmod>2026-11-06</lastmod></url>
- <url><loc>https://kwant.si/docs/install</loc><lastmod>2026-11-15</lastmod></url>
+ <url><loc>https://kwant.si/docs/install</loc><lastmod>2026-11-16</lastmod></url>
<url><loc>https://kwant.si/docs/lessons</loc><lastmod>2026-11-03</lastmod></url>
<url><loc>https://kwant.si/docs/loose-ends</loc><lastmod>2026-11-07</lastmod></url>
<url><loc>https://kwant.si/docs/mcp</loc><lastmod>2026-11-13</lastmod></url>
diff --git a/src/server/auth.rs b/src/server/auth.rs
index 89bd6a4a..2ea95cae 100644
--- a/src/server/auth.rs
+++ b/src/server/auth.rs
@@ -42,6 +42,8 @@ pub struct ApiToken {
port: u16,
/// Sessions and one-time sign-in links.
pub signin: signin::SignIn,
+ /// `KWNT_SIGNIN_HINT`: where this install's token is, as an app store or host words it.
+ signin_hint: Option<String>,
}
impl std::fmt::Debug for ApiToken {
@@ -71,12 +73,18 @@ impl ApiToken {
.filter(|o| !o.is_empty())
.collect();
let token = env_token().unwrap_or_else(|| load_or_create(&config.data_dir));
+ let raw_hint = std::env::var("KWNT_SIGNIN_HINT").ok();
+ let signin_hint = signin_hint_from(raw_hint.as_deref(), &token);
+ if raw_hint.is_some_and(|h| !h.trim().is_empty()) && signin_hint.is_none() {
+ tracing::warn!("KWNT_SIGNIN_HINT contains the API token, so the sign-in screen leaves it out");
+ }
Self {
token,
require,
extra_origins,
port: config.port,
signin: signin::SignIn::load(&config.data_dir),
+ signin_hint,
}
}
@@ -87,9 +95,22 @@ impl ApiToken {
extra_origins: Vec::new(),
port,
signin: signin::SignIn::in_memory(),
+ signin_hint: None,
}
}
+ /// A test server whose sign-in screen shows `hint` (as `KWNT_SIGNIN_HINT` would).
+ pub fn with_signin_hint(mut self, hint: &str) -> Self {
+ self.signin_hint = signin_hint_from(Some(hint), &self.token);
+ self
+ }
+
+ /// The store's or host's words for where the token is, for the sign-in screen. Public: it is
+ /// shown before anyone signs in.
+ pub fn signin_hint(&self) -> Option<&str> {
+ self.signin_hint.as_deref()
+ }
+
/// kwnt's public address: the first `KWNT_ALLOWED_ORIGINS` entry (the HTTPS address in front
/// of it), for sign-in links that open as they are.
pub fn public_base(&self) -> Option<&str> {
@@ -131,6 +152,24 @@ pub fn env_token() -> Option<String> {
.filter(|t| t.len() >= 16)
}
+/// Longest `KWNT_SIGNIN_HINT` the sign-in screen shows, in characters.
+pub const SIGNIN_HINT_MAX: usize = 300;
+
+/// `KWNT_SIGNIN_HINT` as the sign-in screen shows it: one line of plain text (line breaks and other
+/// control characters become spaces, runs of spaces one), at most [`SIGNIN_HINT_MAX`] characters.
+/// None when it is empty, or when it holds the API token itself: the hint is public, so a store
+/// that pasted the token into it would show the token to anyone who opens the page.
+pub fn signin_hint_from(raw: Option<&str>, token: &str) -> Option<String> {
+ let raw = raw?;
+ if !token.is_empty() && raw.contains(token) {
+ return None;
+ }
+ let spaced: String = raw.chars().map(|c| if c.is_control() { ' ' } else { c }).collect();
+ let line = spaced.split_whitespace().collect::<Vec<_>>().join(" ");
+ let hint: String = line.chars().take(SIGNIN_HINT_MAX).collect();
+ (!hint.is_empty()).then_some(hint)
+}
+
/// Why the token file could not be read. `kwnt token` reports these instead of writing a new
/// token: one made by another user or for another data dir is a token the server rejects.
#[derive(Debug)]
@@ -631,15 +670,20 @@ pub async fn status(State(state): State<AppState>, req: Request) -> Response {
let authenticated = !required || has_token;
// Person-only actions (passwords, approvals) need it from another machine, or with `always`
let person_required = person_token_needed(&state.api_token, headers, peer);
- Json(json!({
+ let mut status = json!({
"auth_required": required,
"authenticated": authenticated,
"person_auth_required": person_required,
"person_authenticated": !person_required || has_token,
// This server can let a new browser in from a signed-in device (`/api/auth/device`)
"device_login": true,
- }))
- .into_response()
+ });
+ // Where an app store or host shows this install's token (`KWNT_SIGNIN_HINT`). Left out
+ // when unset, so the reply keeps the shape existing clients already know.
+ if let Some(hint) = state.api_token.signin_hint() {
+ status["signin_hint"] = json!(hint);
+ }
+ Json(status).into_response()
}
#[derive(Deserialize)]
@@ -906,6 +950,32 @@ mod tests {
));
}
+ #[test]
+ fn signin_hint_is_one_short_line_and_never_the_token() {
+ let token = "abcdefghijklmnopqrstuvwxyz012345";
+ assert_eq!(signin_hint_from(None, token), None);
+ assert_eq!(signin_hint_from(Some(" \n\t "), token), None);
+ assert_eq!(
+ signin_hint_from(Some(" Use the password\r\nUmbrel shows\tfor kwnt. "), token).as_deref(),
+ Some("Use the password Umbrel shows for kwnt.")
+ );
+ // Plain text stays as typed: the UI renders it as text, not HTML
+ assert_eq!(
+ signin_hint_from(Some("Files → AppData/kwnt/data/api-token <b>"), token).as_deref(),
+ Some("Files → AppData/kwnt/data/api-token <b>")
+ );
+ let long = "é".repeat(SIGNIN_HINT_MAX + 50);
+ let cut = signin_hint_from(Some(&long), token).unwrap();
+ assert_eq!(cut.chars().count(), SIGNIN_HINT_MAX);
+ // A hint holding the token would publish it
+ assert_eq!(signin_hint_from(Some(&format!("Your token is {token}")), token), None);
+ let api = ApiToken::for_tests(token, Require::Auto, 3000);
+ assert_eq!(api.signin_hint(), None);
+ let api = api.with_signin_hint(" Copy the KWNT_API_TOKEN value from Render. ");
+ assert_eq!(api.signin_hint(), Some("Copy the KWNT_API_TOKEN value from Render."));
+ assert!(!format!("{api:?}").contains("Render"), "Debug stays short");
+ }
+
#[test]
fn origins() {
let api = ApiToken::for_tests("t".repeat(32).as_str(), Require::Auto, 3000);
diff --git a/tests/local_person_test.rs b/tests/local_person_test.rs
index baccfae9..5366ce56 100644
--- a/tests/local_person_test.rs
+++ b/tests/local_person_test.rs
@@ -125,3 +125,44 @@ async fn require_always_asks_for_the_token_locally_too() {
let (s, v) = get(&app, "127.0.0.1:50000", "127.0.0.1:8799", &pw, Some(TOKEN)).await;
assert_eq!(s, StatusCode::OK, "with the API token: {v}");
}
+
+/// 24f: an app store sets the token (`KWNT_API_TOKEN`) and says where it shows it
+/// (`KWNT_SIGNIN_HINT`). A fresh server tells a browser on another machine that hint before
+/// anyone signs in, and the store's token typed into the box starts a session.
+#[tokio::test]
+async fn a_store_hint_shows_before_sign_in_and_its_token_signs_in() {
+ let (app, mut state, _tmp) = setup(Require::Auto).await;
+ let remote = "203.0.113.9:50000";
+ let (_, v) = get(&app, remote, "kwnt.example.com", "/api/auth/status", None).await;
+ assert!(v.get("signin_hint").is_none(), "no hint field unless the host sets one: {v}");
+
+ state.api_token = Arc::new(
+ ApiToken::for_tests(TOKEN, Require::Auto, 8799).with_signin_hint("Use the password Umbrel shows for kwnt.\n"),
+ );
+ let app = create_router(state);
+ let (s, v) = get(&app, remote, "kwnt.example.com", "/api/auth/status", None).await;
+ assert_eq!(s, StatusCode::OK, "{v}");
+ assert_eq!(v["auth_required"], true, "{v}");
+ assert_eq!(v["authenticated"], false, "{v}");
+ assert_eq!(v["signin_hint"], "Use the password Umbrel shows for kwnt.", "{v}");
+
+ let post = |token: &str| {
+ let mut req = Request::builder()
+ .method("POST")
+ .uri("/api/auth/session")
+ .header("host", "kwnt.example.com")
+ .header("origin", "http://kwnt.example.com")
+ .header("content-type", "application/json")
+ .body(Body::from(serde_json::json!({ "token": token }).to_string()))
+ .unwrap();
+ req.extensions_mut().insert(ConnectInfo(remote.parse::<SocketAddr>().unwrap()));
+ app.clone().oneshot(req)
+ };
+ let wrong = post("not-the-store-password").await.unwrap();
+ assert_eq!(wrong.status(), StatusCode::UNAUTHORIZED);
+ let ok = post(TOKEN).await.unwrap();
+ assert_eq!(ok.status(), StatusCode::NO_CONTENT);
+ let cookie = ok.headers().get("set-cookie").and_then(|c| c.to_str().ok()).unwrap_or_default().to_string();
+ assert!(cookie.starts_with("kwnt_token=") && cookie.contains("HttpOnly"), "{cookie}");
+ assert!(!cookie.contains(TOKEN), "the cookie holds a session, never the token");
+}