@vibelord/lanes 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/package.json +1 -1
  2. package/payload/lanes/README.md +4 -3
  3. package/payload/lanes/VERSION +1 -1
  4. package/payload/lanes/bin/lanes +301 -45
  5. package/payload/lanes/container/lane +42 -1
  6. package/payload/lanes/container/lane-mcp +65 -6
  7. package/payload/lanes/container/lane_core.py +178 -0
  8. package/payload/lanes/docs/ARCHITECTURE.md +192 -20
  9. package/payload/lanes/docs/DESIGN.md +6 -3
  10. package/payload/lanes/docs/INSTALL.md +25 -8
  11. package/payload/lanes/docs/RUNBOOK.md +369 -8
  12. package/payload/lanes/docs/USERGUIDE.md +201 -25
  13. package/payload/lanes/holders.lock +5 -0
  14. package/payload/lanes/install/enable-docs.sh +78 -0
  15. package/payload/lanes/install/host-install.sh +39 -5
  16. package/payload/lanes/libexec/docs_store.py +995 -0
  17. package/payload/lanes/libexec/docsd.py +2010 -0
  18. package/payload/lanes/libexec/mdlite.py +575 -0
  19. package/payload/lanes/libexec/members.py +5 -0
  20. package/payload/lanes/libexec/notify.py +65 -5
  21. package/payload/lanes/libexec/sidebar.py +106 -13
  22. package/payload/lanes/libexec/statusd.py +97 -5
  23. package/payload/lanes/libexec/tokens.py +31 -9
  24. package/payload/lanes/libexec/update.py +94 -22
  25. package/payload/lanes/libexec/uploads.py +538 -0
  26. package/payload/lanes/systemd/lanes-docsd.service +29 -0
  27. package/payload/lanes/web/Caddyfile +24 -1
  28. package/payload/lanes/web/README.md +86 -8
  29. package/payload/lanes/web/browser.js +2 -4
  30. package/payload/lanes/web/docs.css +52 -0
  31. package/payload/lanes/web/docs.js +36 -0
  32. package/payload/lanes/web/mobile.js +3 -2
  33. package/payload/lanes/web/upload.css +17 -0
  34. package/payload/lanes/web/upload.js +84 -0
  35. package/payload/manifest.json +4 -3
@@ -24,6 +24,7 @@ measurements; substitute your account, containers and paths in operational comma
24
24
  | Scroll a lane | mouse wheel / tmux copy-mode as before (history lives in the lane, not in the viewer) |
25
25
  | Edit a lane's AGENTS.md, CLAUDE.md or .env.local | `Ctrl-Alt-e`: a floating **Edit** pane runs `lanes edit --focused`, one key picks (`1`–`5`; `q`/`Esc` closes), then `docker exec -it -u coder -w <checkout> <container> ~/.lz/bin/lane-edit <file>` replaces it — the editor runs in the lane's container as uid 1000, the server only checks the paths through `/proc/<init>/root` and copies nothing out ([guide](USERGUIDE.md#quick-edit)). `lanes edit: lane-edit is not installed in <c>` → `lanes install-container <c>`; `lane-edit: no editor on PATH` (exit 127) → the container has none of micro, hx, nvim, vim, vi (Lanes installs none); `container <c> is not running` → nothing to edit until it runs; `no git checkout in or above <dir>` → the lane works outside a checkout. The editor is the device's `lanes attach <device> --editor E` choice |
26
26
  | Throttle monitor | its own full-size tab, `Throttle` (next to `Host`); it starts when you first open the tab and restarts itself if it exits. It is no longer an entry in every board's sidebar. |
27
+ | Open what an agent published, or upload from a phone | the Docs page, `https://<server>:8443/lanes-docs/`: phone **More → Docs**, the laptop bar's **Docs**, a ⌘/Ctrl-click on the sidebar's ` ↑ uploads · ▤ docs N` strip, or `d` on a lane for its own link; an agent publishes with `~/.lz/bin/lane publish <file>` or `lanes_publish` (section "Docs service"; the [user guide's Docs](USERGUIDE.md#docs)) |
27
28
  | Detach | `Ctrl-Alt-o` then `d` — or just close the window. Nothing on the server stops. |
28
29
 
29
30
  Sidebar glyphs: see the legend in [`docs/DESIGN.md`](DESIGN.md) (agent column `◆ ◇ ▸ ✓ ✗ _ ·`, terminal column
@@ -208,10 +209,13 @@ lanes studio-host re-key --yes after the owner revoked the Host: a new mac
208
209
  outcome; the full output is `~/.local/state/lanes/update/last.log`, the outcome `update/last.json`. Read it with
209
210
  `python3 -m json.tool ~/.local/state/lanes/update/last.json`: `result` `ok` (a step with `"warning": true` — `sync`
210
211
  exiting 1 for a board with an error, e.g. a removed container — needs the board fixed, not the update: `lanes sync`
211
- names it); `partial` (exit 4) — the release is installed and a step after the switch failed: each step with a
212
+ names it; `enable-docs` with `"outcome": "skipped"` or `"refused"` and its `reason` is the docs page's Mermaid, never
213
+ fatal — see "Mermaid pin" — and the summary line says `mermaid ok`, `mermaid skipped: <reason>` or `mermaid
214
+ refused: <reason>`); `partial` (exit 4) — the release is installed and a step after the switch failed: each step with a
212
215
  non-zero `rc` is the one to run by hand (`sync` → `lanes sync`, `restart lanes-statusd` →
213
216
  `systemctl --user restart lanes-statusd.service`, `install-container <c>` → `lanes install-container <c>`,
214
- `reload-views` → `lanes reload-views`, `ensure` → `lanes ensure --if-layout-changed`); `refused` (exit 3) — nothing changed: the last step names what said no
217
+ `reload-views` → `lanes reload-views`, `ensure` → `lanes ensure --if-layout-changed`, `enable-docs` with `"outcome":
218
+ "failed"` → `sh ~/.local/share/lanes/current/install/enable-docs.sh`); `refused` (exit 3) — nothing changed: the last step names what said no
215
219
  (`preflight`: a prerequisite, the user manager or Docker, or no installed release — `no release is installed here`:
216
220
  run the full `./install.sh --server` / `npx @vibelord/lanes@<release> --server` first; `commit`: another install
217
221
  holds `~/.local/share/lanes/.install.lock`, or a link is no symlink). A run that printed only
@@ -1086,6 +1090,10 @@ lands where, and how to take it back:
1086
1090
  lane's task line). The report stands until the agent's next tool call, prompt or permission prompt; the end of
1087
1091
  its turn keeps it unless it is `working` (DEF-1801). `cat ~/.lz/state/hooks/<lane id>.json` shows it: `event`
1088
1092
  stays `lanes_signal` while it stands.
1093
+ - `lanes_publish` (and `lane publish <file>` in a lane's shell) writes a publish request,
1094
+ `~/.lz/state/publish/<lane id>/<id>.json`, naming a file under `/home/coder`; the docs service takes it within
1095
+ about 5 s and answers in `<id>.receipt.json` beside it ("Docs service", "Publish pick-up"). `lanes_status` shows the
1096
+ newest receipt as `published`. The file is read by the host, never sent by the agent.
1089
1097
  - Nothing an agent does ends, interrupts or attaches a lane, uploads a file, runs `lanes sync`, `lanes gc` or
1090
1098
  `lanes ensure`, renames a tmux session, or touches a session added with `lanes register` (`registered-sessions.json`
1091
1099
  on the host).
@@ -1121,8 +1129,8 @@ printf '%s\n' \
1121
1129
  ```
1122
1130
 
1123
1131
  It prints two frames, one line each, exit 0 and nothing on stderr. Frame `id` 1 carries `protocolVersion`
1124
- `2025-06-18` and `serverInfo` `{"name": "lanes", "version": <~/.lz/VERSION>}`. Frame `id` 2 lists the ten tools in
1125
- wire order, the same tools `lanes/tests/unit/golden/lane-mcp-tools.json` pins. The list is deterministic: run the
1132
+ `2025-06-18` and `serverInfo` `{"name": "lanes", "version": <~/.lz/VERSION>}`. Frame `id` 2 lists the eleven tools in
1133
+ wire order (`lanes_publish`, W10 W4, last), the same tools `lanes/tests/unit/golden/lane-mcp-tools.json` pins. The list is deterministic: run the
1126
1134
  command twice through `sha256sum` and the two digests match. The log gains a `start lane-mcp <version> wire 1` line.
1127
1135
  No output at all means the server could not start, for example because `lane_core.py` is missing beside it; run
1128
1136
  `lanes install-container <container>` on the host. `test_docs.AgentApi` runs this block exactly as printed here.
@@ -1298,7 +1306,7 @@ that becomes readable switches the pushes on within one tick and a removed one s
1298
1306
  | `topic` | required | `[A-Za-z0-9_-]{1,64}`; on a public server the topic name is the only secret — pick a long random one |
1299
1307
  | `token_file` | unset | a file holding an ntfy access token (sent as a bearer). An unreadable file disables sending rather than sending unauthenticated (or with the token it held before). Keep the token in that file (`chmod 600`), never in `notify.conf` |
1300
1308
  | `quiet_when_device_active_s` | `120` | presence window above; `0` never suppresses — except for the one person present when their profile sets a `notify.quiet_s` of its own |
1301
- | `action_url` | unset | a URL template over `{lane}` (the lane id, URL-quoted), e.g. a page of yours that opens it; becomes the push's tap target and an **Open lane** button |
1309
+ | `action_url` | unset | a URL template over `{lane}` (the lane id, URL-quoted), e.g. a page of yours that opens it; becomes the push's tap target and an **Open lane** button. `{doc}` (plan W10 W7) is the docs page of the document a `published` push names, `/lanes-docs/d/<id>` (`https://<server>:8443{doc}` opens it), empty in a needs-you push. The `published` push (plan W10 W4) is sent by the docs service's publish pick-up, not by this unit: same config, same desk-presence rule, `{title: Published, message: <lane name> published a document (<kind>, <size>) + its page, priority 2}`, at most one per lane per minute, never the document's title or name |
1302
1310
 
1303
1311
  Without a valid `url` and `topic` the service only tracks transitions and sends nothing. Turn it on:
1304
1312
 
@@ -1374,12 +1382,27 @@ The Studio's design of record is `docs/design/throttle-studio.md` (§1.1 "The la
1374
1382
  ## Uploads (the Cursor `uploads/` folder, without Cursor)
1375
1383
 
1376
1384
  Files land in `<board folder>/uploads/` on the server — the same folder you drop into from Cursor. The folder is
1377
- created on first use and kept out of commits through the repo-local `.git/info/exclude` when the repo does not
1378
- already ignore it. Afterwards the in-container path is on your clipboard and in a notification.
1385
+ created on first use (0755) and kept out of commits through the repo-local `.git/info/exclude` when that file does not
1386
+ name it yet. Afterwards the in-container path is on your clipboard and in a notification. Every upload — these ways
1387
+ and the Docs page's drop area ("Docs service" below) — also becomes a docs-store document with a sha256 receipt (W10
1388
+ W5): one module, `libexec/uploads.py`, lands the file and hands the same bytes to `docs_store.intake` in one pass, so
1389
+ the receipt is of exactly what arrived; the store keeps a copy (never a hard link to the container's file, which an
1390
+ agent could rewrite under an unchanged receipt). `lanes upload` says each receipt on stderr (`# docs: <name> <bytes> B
1391
+ sha256 <hash> <id>`, in the helper's log) and records it for the login that owns the asking device, under the lane its
1392
+ view shows; a device nobody owns gets a `docs.log` line (`upload - - <lane> <bytes> <sha256> no-owner`) and no
1393
+ document; a file over 32 MiB lands without one (`intake … too-large`). stdout and the spool's `<request>.done` are what
1394
+ they always were.
1395
+
1396
+ The host never follows a symbolic link in the container's folder (an absolute link would resolve against the host's
1397
+ root: DEF-1891) and runs no git there (`git check-ignore` runs the repository's `core.fsmonitor`, a command the
1398
+ container chose: DEF-1890). A folder or `uploads/` reached through a link is refused (`lanes: uploads/ in the
1399
+ workspace folder is not a directory (a symbolic link is refused)`): replace the link with the real directory in the
1400
+ container. The tar stream is unpacked member by member: links that leave the upload, `..`, devices and FIFOs refuse
1401
+ the whole upload, as tar's data filter did.
1379
1402
 
1380
1403
  | Way | How |
1381
1404
  |---|---|
1382
- | Upload strip in the sidebar | The one row above the footer rule, ` ↑ uploads · click, then drop (U)`. Click it (or press `U` in the sidebar, `Ctrl-Alt-u` from anywhere in the tab) — it turns into ` ↓ DROP FILES NOW · anywhere · Esc` — then **drop the files anywhere on the window**. The file goes to the board of that tab and its path is typed into the lane, ready for the agent. `Esc` cancels. While it sends the strip says ` ↑ sending 2 files · 12.4 MiB` and repaints only when the helper reports progress (no spinner, no fast tick); the result stays 8 s as ` ✓ name, name` or ` ✗ reason`. |
1405
+ | Upload strip in the sidebar | The one row above the footer rule, ` ↑ uploads · click, then drop (U)` — ` ↑ uploads · ▤ docs 3 (U)` once the workspace's lanes have published documents, the whole row then a link to the docs page (plan W10 W7). Click it (or press `U` in the sidebar, `Ctrl-Alt-u` from anywhere in the tab) — it turns into ` ↓ DROP FILES NOW · anywhere · Esc` — then **drop the files anywhere on the window**. The file goes to the board of that tab and its path is typed into the lane, ready for the agent. `Esc` cancels. While it sends the strip says ` ↑ sending 2 files · 12.4 MiB` and repaints only when the helper reports progress (no spinner, no fast tick); the result stays 8 s as ` ✓ name, name` or ` ✗ reason`. |
1383
1406
  | Watch folder | `~/Lanes Uploads/` → the board your view shows; `~/Lanes Uploads/<board>/` → that board. Sent files move to `.sent/<date>/`. Point CleanShot's save folder here for instant screenshot upload. |
1384
1407
  | Command | `lanes-upload [-w <board>] [--paste] <files…>` · `lanes-upload --clipboard [--paste]` (clipboard image or copied files) |
1385
1408
  | macOS droplet | `~/Applications/Lanes Upload.app`: drop files on it (Dock); double-click uploads the clipboard screenshot |
@@ -1542,6 +1565,10 @@ Laptop and tablet browsers: see the [installation guide](INSTALL.md#laptop-and-t
1542
1565
  - **`lanes web` printed a `127.0.0.1` URL**: the host has no Tailscale name. Connect Tailscale on the host;
1543
1566
  there is no public fallback.
1544
1567
 
1568
+ The Docs page (`/lanes-docs/`: the phone's **More → Docs**, the laptop bar's **Docs**, the sidebar's ` ▤ docs N`) is
1569
+ a service of its own behind the same Serve and Caddy, with its own pinned Mermaid: section "Docs service" (its unit,
1570
+ pin gate, `docs.log`, routes, Mermaid pin, doctor lines and the operator's live checklist).
1571
+
1545
1572
  ### Tailscale Serve
1546
1573
 
1547
1574
  `lanes web` (not `--print-only`) makes Tailscale Serve forward `https:8443` to `http://127.0.0.1:8083` after it
@@ -1823,6 +1850,340 @@ signed out in step 3; their views are named, not ended — offboard each by name
1823
1850
  open with the key keeps running until it ends (step 1 says so). `enrol.log` gets one `offboard` line with the key's
1824
1851
  fingerprint and `ok` or `incomplete`.
1825
1852
 
1853
+ ## Docs service (`lanes-docsd`, W10 W3)
1854
+
1855
+ The docs cockpit's web half: what an agent publishes from a lane (W4, "Publish pick-up" below) and what a person
1856
+ uploads (W5: the Docs page's drop area and every `lanes upload`) is opened at
1857
+ `https://<host>.<tailnet>.ts.net:8443/lanes-docs/` from the phone or laptop shell, bound to the person's
1858
+ tailnet login. `lanes-docsd.service` runs `libexec/docsd.py` on **127.0.0.1:8185**; the `lanes-mobile` Caddy forwards
1859
+ `/lanes-docs/*` to it (`handle_path /lanes-docs/*` in `web/Caddyfile`, which strips the prefix and is the FIRST handle of
1860
+ the site, before the Zellij routes) and keeps Serve's `X-Forwarded-For` (`trusted_proxies 127.0.0.0/8`, as on
1861
+ `/enrol/*`). The site-wide Caddy header block is `header @notdocs` (`@notdocs not path /lanes-docs/*`), so a docs
1862
+ response carries docsd's headers only. Every server install enables and restarts it after `lanes-enrold`, then runs
1863
+ `install/enable-docs.sh` for the page's Mermaid ("Mermaid pin" below; never fatal); an update (`--update-only`)
1864
+ restarts it when it runs (`update.TRY_RESTART`), runs `enable-docs.sh` right after, and, like every update, enables
1865
+ nothing — a server set up before the docs service and only updated since has no `lanes-docsd` until one full `--server`
1866
+ install (or `systemctl --user enable --now lanes-docsd.service`); `lanes doctor` says so (DEF-1900, mitigated). In
1867
+ order below: the unit, the pin gate and who sees what, the routes, uploads, encryption, `docs.log`, the publish
1868
+ pick-up and the Caddy reload; then "Mermaid pin", "What `lanes doctor` says" and the operator's live checklist
1869
+ ("Operator verification"). `lanes docs push <id>` prints one document's receipt and exits 2 `not configured`: the
1870
+ hook for the data service's publication surface, not built (operator gate 3 of the plan).
1871
+
1872
+ The unit, `lanes-docsd.service` (rendered from `systemd/lanes-docsd.service` by `install/services.py`), runs
1873
+ `python3 -S -E libexec/docsd.py` in `lanes.slice` with `Restart=on-failure` (10 s), `NoNewPrivileges=true`,
1874
+ `UMask=0077`, `MemoryHigh=128M` and `MemoryMax=192M`, and `WantedBy=default.target`; no `ProtectHome` (it writes
1875
+ `~/.local/state/lanes/docs/` and `docs.log`, its publish pick-up reads each workspace container through
1876
+ `/proc/<pid>/root`, as `lanes-statusd` does, and an upload lands in the workspace's `uploads/` through the container's
1877
+ home volume). MEASURED 2026-10-08 on the development host (`/usr/bin/python3`
1878
+ 3.12.3 `-S -E`, load about 70; not the ceobox service): idle VmHWM 25 MB, one 32 MiB upload 56 MB, two at once (the
1879
+ most it parses: `UPLOAD_SLOTS`) 89 MB; the security review (2026-10-08) measured 94 MiB for two. A decryption now
1880
+ takes one of the same two slots (it holds up to 32 MiB of plaintext), so at most two 32 MiB buffers are held at once;
1881
+ the composed peak under `MemoryMax` (two buffers, two renders, the render cache, a pick-up survey) is not measured
1882
+ (DEF-1917, mitigated). `LANES_DOCS_PORT` (or `--port`) moves it off 8185 (the Caddyfile route must follow); `--bind`
1883
+ takes a loopback address only.
1884
+
1885
+ ```sh
1886
+ systemctl --user status lanes-docsd.service
1887
+ journalctl --user -u lanes-docsd.service -n 30 # "listening on 127.0.0.1:8185; pinned request (…); domains …"
1888
+ tail ~/.local/state/lanes/docs.log # one line per read, upload refusal, publish, intake and denial
1889
+ lanes doctor # the five docs lines below
1890
+ ```
1891
+
1892
+ **The pin gate.** docsd answers NOTHING until the operator has run the enrolment service's Serve header check (section
1893
+ "Enrolment service", Operator verification) and pinned its result with `lanes enrol mode request` (it reads
1894
+ `~/.local/state/lanes/enrol-mode` on every request: no restart). Unpinned (`auto`), pinned `invite`, or a pin that
1895
+ cannot be read: every request is `403 not-pinned`, and the start line says `NOT pinned`. `LANES_ENROL_REQUEST_MODE`
1896
+ in enrold's unit is enrold's alone and is not a pin here. After the pin, a request is answered only when ALL hold —
1897
+ else `403` with the word, a short page for a browser:
1898
+
1899
+ | Check | Refusal |
1900
+ |---|---|
1901
+ | it came through Tailscale Serve: its `X-Forwarded-For` (Serve sets it, Caddy keeps it) names a non-loopback address | `not-through-serve` (a probe of 127.0.0.1:8185 or of Caddy from this host) |
1902
+ | Serve's identity header set: `Tailscale-User-Login` and `Tailscale-User-Name` | `no-identity` (a tagged device) |
1903
+ | the login validates as a member login | `invalid-login` |
1904
+ | the pin above | `not-pinned` |
1905
+ | the login owns a valid `members/<device>.json` (casefolded) | `not-a-member` (`lanes keys owner <device> <login>`) |
1906
+ | its domain is in `LANES_DOCS_DOMAINS`, else `LANES_ENROL_DOMAINS` (default `beyondwork.ai`, `*` = any) — set it in this unit's drop-in | `domain-not-allowed` |
1907
+ | its `Sec-Fetch-Site` is `same-origin` (a page, script, stylesheet or image of the Docs pages, the phone/laptop shell's **Docs** link) or `none` (an address typed or bookmarked, a link opened from a terminal or a phone app); or it is a top-level navigation — a GET or HEAD with `Sec-Fetch-Mode: navigate` and `Sec-Fetch-Dest: document` — from any site (a link followed in ntfy's web app, a chat, a mail); `POST /up` only `same-origin` or `none` — every route, since the security review of 2026-10-08 | `cross-site` (anything else from another site — `cross-site`, `same-site` (`*.ts.net` is a public suffix, so another tailnet host's page is same-site) — that is not such a navigation: a `fetch()`, an image, a script, a frame, a form posted to `/up`; or no `Sec-Fetch-Site` on a request that is not a navigation: a browser too old to send it, or `curl`) |
1908
+
1909
+ No Zellij cookie is consulted. The `cross-site` check is why a sandboxed artifact (an opaque origin) cannot spend the
1910
+ viewer's login here: its `fetch()` and subresource loads are not navigations. A link to a docs page followed from
1911
+ another website (a web mail, a chat in a browser, ntfy's web app) is a top-level navigation and is served. The
1912
+ artifact's sandbox (`sandbox allow-scripts` only) cannot open a window, submit a form or navigate another browsing
1913
+ context; the one navigation its script can start is of its own page, which replaces it unless the answer is a download
1914
+ the sandbox blocks, so what it can request that way is bounded by the 300-a-minute limit (the HTML standard's rules,
1915
+ not measured in a browser).
1916
+ **Trust boundary:** as for enrold (DEF-1645, open), a process on this host that reaches loopback can send the headers
1917
+ itself and read any member's documents; the pin and the Serve-only check are the controls, and the same `docker ps
1918
+ --filter network=host` audit applies. And a member's device key carries `restrict,pty` but no `command=`
1919
+ (`libexec/keys.py` `OPTIONS`): a member who can SSH in has a shell as the lanes account and can read every store
1920
+ directly, so the per-login separation of the docs service holds between people who only use the web, not against a
1921
+ member with a device key (DEF-1919, open). Never expose 8443 through Tailscale Funnel (Funnel traffic carries no
1922
+ identity headers).
1923
+
1924
+ **Who sees what.** A person sees the documents in their own store (their uploads), the documents whose `for` names
1925
+ them, and a document that names nobody when a member record they own grants its workspace. A record's `workspaces`
1926
+ (the board ids an invite recorded with `lanes invite --workspaces`) grants those boards; a record that lists none —
1927
+ a key added with `lanes keys add|adopt`, a device enrolled by request, an invite minted without `--workspaces` —
1928
+ grants every workspace the server serves (the registry's), because nothing else in Lanes narrows by that list
1929
+ (DEF-1852, closed). The same grant decides the lanes the upload form offers and `POST /up` accepts. A document a
1930
+ person cannot see answers `404`, like one that does not exist.
1931
+
1932
+ | Route (after Caddy strips `/lanes-docs`) | Answer (wire contract v1, DM-LANES-DOCS-WIRE) |
1933
+ |---|---|
1934
+ | `GET /` · `GET /?ws=<ws>&lane=<lane>` | the index page: workspace → lane → newest first, counts, the upload form; the filter (either key optional) must name a workspace/lane the person knows, else `404` |
1935
+ | `GET /d/<id>` | the document page: Markdown rendered (mdlite; over 1 MiB not rendered; from the render cache when its sha256 was rendered before; `503 busy` + `Retry-After` when two renders run and none ends within 1 s), an HTML/SVG artifact linked (never embedded), a file's facts and download |
1936
+ | `GET /d/<id>/raw` | the bytes, `Content-Disposition: attachment; filename="<name>"`, `X-Lanes-Sha256` |
1937
+ | `GET /d/<id>/artifact` | kind html/svg only: the bytes as a top-level document under `Content-Security-Policy: sandbox allow-scripts` |
1938
+ | `GET /receipt/<id>.json` | `receipt.json` (`{v, id, sha256, bytes, url, at}`) |
1939
+ | `GET /docs.css`, `GET /docs.js` | `web/docs.css` / `web/docs.js` of the running tree (W6), else `404` |
1940
+ | `GET /upload.css`, `GET /upload.js` | `web/upload.css` / `web/upload.js` (W5, the index's drop area), else `404` |
1941
+ | `POST /up` | multipart form: `lane` (+ optional `ws`), files; each lands in the workspace's `uploads/` AND the store, both or neither; `200 {receipts: [{id, name, sha256, bytes, url, at, landed}]}` or a page; `429` (30 per login per 10 min) + `Retry-After`, `503 busy` (two big buffers at once — uploads and decryptions —, one per login, or the store lock), `415`, `411`, `413` (32 MiB), `408 request-timeout` (the body did not arrive within 30 s + its length at 64 KiB/s), `400 bad-request\|no-file\|no-lane\|unknown-lane\|unknown-workspace`, `503 registry-unavailable`, `503 uploads-unavailable` (the container's folder: home volume unknown, a link on the way), `500 encrypt-failed` |
1942
+ | every route but `POST /up` | `429 rate-limited` + `Retry-After` past 300 requests per login per minute (one `docs.log` line per minute) |
1943
+
1944
+ **Limits** (per `lanes-docsd` process; security review 2026-10-08 — each pinned by a test in `tests/unit/test_docsd.py`
1945
+ or `test_docs_store.py`, values in `libexec/docsd.py` / `docs_store.py`):
1946
+
1947
+ | Limit | Value | Past it |
1948
+ |---|---|---|
1949
+ | requests per login, every route but `POST /up` (`VIEWS` / `VIEW_WINDOW`) | 300 per 60 s, a fixed window | `429 rate-limited` + `Retry-After`; one `view … rate-limited` line per window |
1950
+ | Markdown renders at once (`RENDER_SLOTS`, `RENDER_WAIT_S`) | 2; a view waits 1 s for one | `503 busy` + `Retry-After: 5` |
1951
+ | render cache (`RENDER_CACHE_BYTES`, `RENDER_CACHE_ENTRY`) | 8 MiB in all, by the document's sha256, least recently used out; a render over 2 MiB is not kept | a second view of a cached document renders nothing and needs no slot |
1952
+ | big buffers at once (`UPLOAD_SLOTS`), shared by uploads and decryptions | 2, at most 1 per login; a decryption also one at a time and waits 5 s for a slot | `503 busy` + `Retry-After: 5` |
1953
+ | uploads per login (`UPLOADS` / `UPLOAD_WINDOW`) | 30 per 10 min, counted at the start | `429 rate-limited` |
1954
+ | upload body deadline (`BODY_GRACE_S`, `BODY_MIN_RATE`) | 30 s + length / 64 KiB/s (32 MiB: 542 s) for the whole body; each read still times out after 30 s without data | `408 request-timeout`, connection closed, the slot free again |
1955
+ | refused body read away (`DRAIN_LIMIT`, `LINGER_S`) | 64 MiB before the answer, then 5 s | the client may see a reset |
1956
+ | pick-up survey (`MAX_ENTRIES`) | 4,096 directory entries per container per cycle (its publish directory and lane directories together) | the container is refused for the cycle: nothing taken; the journal says `pick-up <container>: refused: more than 4096 entries …` once an hour (`OVER_CAP_SAY_S`) |
1957
+ | pick-up per container (`MAX_PICKUPS`, `PUBLISHES`) | 16 per cycle, 30 per 10 min | the rest wait; past 30 refused `rate-limited` |
1958
+ | `docs.log` refusal lines (`DENIED_REPEAT_S`, `MAX_DENIED_SOURCES`, `MAX_DENIED_LOGIN`) | one `denied` line per source (the tailnet address Serve forwarded, else the peer) and word, then one `denied-repeat` line per minute with the count; 1,024 sources remembered; a login logged at most 64 characters | — |
1959
+ | `docs.log` size (`docs_store.LOG_ROTATE_BYTES`) | 8 MiB, then `docs.log.1` (one generation) | the older generation is replaced |
1960
+
1961
+ Every response has `X-Content-Type-Options: nosniff`, `X-Frame-Options: DENY`, `Referrer-Policy: no-referrer` and a
1962
+ CSP: pages `default-src 'none'; style-src 'self' 'unsafe-inline'; script-src 'self'; img-src 'self' data:; connect-src
1963
+ 'self'; form-action 'self'; base-uri 'none'` (`connect-src` for the drop area's own `POST up`), an artifact exactly
1964
+ `sandbox allow-scripts`, everything else `default-src 'none'; sandbox`.
1965
+ Links and assets in a page are relative (`docs.css`, `d/<id>`), so the pages work under the stripped prefix; open the
1966
+ index as `/lanes-docs/` with the slash (`/lanes-docs` alone is the page route a device of that name would have, which
1967
+ is why `lanes-docs`, `lanes-assets` and `enrol` are not device names). An upload goes through `uploads.receive` (W5):
1968
+ it lands in the lane's workspace's `uploads/` (`<folder>/uploads/<name>`, `-1` on a collision, exactly as `lanes
1969
+ upload` lands one) and `docs_store.intake` (`source` `web`, kind by extension, `for` and `by` the uploader) takes the
1970
+ same bytes into the person's store; the receipt's `landed` is the in-container path to tell the agent. The drop area is
1971
+ a plain form that works without a script; `web/upload.js` (loaded by the index only) adds the drop onto the whole area,
1972
+ a size check before sending, progress and the receipt list.
1973
+ The multipart body is split by docsd's own bytes scan, each part's headers parsed by `email.parser`: parsing a 32 MiB
1974
+ body whole with `email.parser` MEASURED about 430 MB peak RSS and 3.8 s, the scan 0.05 s and no copy.
1975
+
1976
+ **A refused upload is answered, not reset (DEF-1854, closed by W5).** A browser sends its whole body before it reads
1977
+ the answer, and a server that answers and closes while the body is still arriving resets the connection under its own
1978
+ answer. docsd now reads a refused body away up to its `Content-Length` — at most 64 MiB (`DRAIN_LIMIT`, twice the cap) —
1979
+ before it answers (with `Connection: close`); past that it answers, shuts its write side and reads the rest for at
1980
+ most 5 s (`LINGER_S`). MEASURED 2026-10-08 against a real `python3 -S -E docsd.py` (development host, load ~15–20 on
1981
+ 64 cores), three concurrent 32 MiB uploads then a 48 MiB and a 100 MiB one: before (the W3 tree) 200, 200 and a
1982
+ `BrokenPipeError`, and both oversize uploads `BrokenPipeError`; after, three runs, 200, 200, `503 busy` and both `413`
1983
+ read by the client. Over a slow link a body past 64 MiB can still be reset; upload.js refuses a set over 32 MiB before
1984
+ it sends.
1985
+
1986
+ **Encryption at rest (`age`, W5; off by default).** `LANES_DOCS_AGE_RECIPIENT=<age recipient>` in lanes-docsd's
1987
+ drop-in makes the docs store keep each NEW document as `age -r <recipient>` output (`<name>.age`, meta.json `enc:
1988
+ {alg, file, bytes, recipient}`); the file in the workspace's `uploads/` stays plain (agents read it), and receipts stay
1989
+ the sha256 of the plaintext, computed before encryption (age output is randomised, so a hash of it would match nothing
1990
+ anyone holds). `lanes upload` runs over SSH, outside the unit, and reads the same drop-in files, so both paths follow
1991
+ one switch. For docsd to open encrypted documents, give it an identity file with `LANES_DOCS_AGE_IDENTITY=<path>`: raw
1992
+ downloads and artifacts are then decrypted on the fly (at most 32 MiB, one at a time) and checked against the receipt;
1993
+ without it they answer `409 encrypted` (a page that sends the person to `uploads/`) and a document page shows its facts
1994
+ only. Documents stored before the switch stay plain. Every server install refuses the setting where no `age` binary is
1995
+ on PATH (`host-install.sh` `check_docs_age` → `python3 libexec/docs_store.py check-age`, exit 1 with the reason; an
1996
+ update records it `refused`, nothing changed); install `age` first.
1997
+
1998
+ ```sh
1999
+ systemctl --user edit lanes-docsd.service # [Service]
2000
+ # Environment=LANES_DOCS_AGE_RECIPIENT=age1...
2001
+ # Environment=LANES_DOCS_AGE_IDENTITY=/home/<you>/.config/lanes/docs-age.key
2002
+ python3 ~/.local/share/lanes/current/libexec/docs_store.py check-age && systemctl --user restart lanes-docsd.service
2003
+ ```
2004
+
2005
+ **docs.log** (`~/.local/state/lanes/docs.log`, 0600, append-only, DM-LANES-DOCS-LOG): `<at> <login> <event> <id> <lane>
2006
+ <bytes> <sha256> <outcome>` — docsd adds `denied` (outcome = the refusal word; the first refusal of a source and word,
2007
+ the login cut to 64 characters) and `denied-repeat` (one a minute while that source keeps being refused: the `bytes`
2008
+ field is how many refusals the line folds, the login the latest), `view`/`raw`/`artifact`/`receipt` (`ok`,
2009
+ `not-found`, `encrypted`, `busy`, and `view … rate-limited` once a window), `upload` (a refusal before any file
2010
+ reaches intake, `request-timeout` included) and `publish` (one per request the pick-up takes: `ok` or the refusal
2011
+ reason — the precise word, also where the receipt says `not-delivered`); each stored file is intake's own `intake`
2012
+ line; `lanes upload` adds `upload … no-owner`/`no-lane`/`too-many` lines with a file's size and sha256 when it lands
2013
+ without a document. Never content, a title or a file name. At 8 MiB the file is renamed `docs.log.1` (replacing the
2014
+ one before) and a new one begun, by whichever writer finds it full first (an exclusive `flock`; the others append to
2015
+ the new file), so the two files never hold much more than 16 MiB. Before the security review (2026-10-08) refusals
2016
+ from any tailnet device appended 269 B each without bound (DEF-1913).
2017
+
2018
+ **Publish pick-up (W10 W4).** `lane publish <file>` and the agents' `lanes_publish` write a request in the container,
2019
+ `~/.lz/state/publish/<lane id>/<id>.json` (`{v: 1, path, title, kind, claimed_sha256, mime, bytes, for}`;
2020
+ DM-LANES-PUBLISH-REQUEST). A thread of `lanes-docsd` takes them every 5 s — for each container `containers.json` names
2021
+ whose init pid is alive (a pid whose `/proc/<pid>/root` is the host's own `/` is skipped, and so is one whose
2022
+ `/home/coder` is not the home volume `containers.json` records, when this account can see that volume), at most 16 per
2023
+ container per cycle and 30 per container per 10 minutes (more are refused `rate-limited`). It first surveys the
2024
+ container's publish directory and lane directories, at most 4,096 entries in all; a container that holds more is
2025
+ refused for the cycle (Limits above). It renames the request to `.<id>.taking` (a directory planted at that name is
2026
+ removed when empty, else moved aside to `.<name>.<random>.planted`; a request it still cannot rename is left alone, the
2027
+ next one is taken and the journal says why once), reads it, resolves the file inside
2028
+ the container to a regular file under `/home/coder` (never through a link, never a FIFO), streams it into the store and
2029
+ compares the sha256. The answer is written back beside the request as `<id>.receipt.json` (0644; DM-LANES-PUBLISH-RECEIPT):
2030
+
2031
+ ```json
2032
+ {"v": 1, "id": "<document id>", "request": "<id>", "sha256": "…", "bytes": 1234, "url": "/lanes-docs/d/<document id>", "at": "2026-10-08T12:00:00Z", "outcome": "ok"}
2033
+ {"v": 1, "id": null, "request": "<id>", "sha256": null, "bytes": null, "url": null, "at": "…", "outcome": "refused", "reason": "outside-home"}
2034
+ ```
2035
+
2036
+ then the claim is removed and the lane keeps its 16 newest receipts (a directory planted at the receipt's name is
2037
+ removed or moved aside first, so the answer is always written). A refused receipt carries the host's sha256 and size
2038
+ when it read the file (`sha256-mismatch`, `too-large`). Refusal reasons (the receipt's word):
2039
+
2040
+ | Reason | Meaning |
2041
+ |---|---|
2042
+ | `unreadable-request` | the request is not a regular JSON object file of at most 16 KiB (a link, a FIFO, a directory, not JSON) |
2043
+ | `bad-version` · `bad-request` · `bad-kind` · `bad-title` | `v` is not 1; a field of the wrong type (`path` not absolute, `claimed_sha256` not 64 hex, `bytes` not a count); `kind` not `md`/`html`/`svg`/`file`; a title that is not one printable line of at most 200 characters |
2044
+ | `too-large` | the claimed or the real size is over 32 MiB |
2045
+ | `unknown-lane` | the registry places no lane of that id in this container |
2046
+ | `rate-limited` | over 30 requests from this container in 10 minutes |
2047
+ | `not-delivered` | `for` names a login that owns no member record, or — no `for`, nobody opened the lane — no member record grants its workspace. One word for both (security review 2026-10-08, DEF-1915): the two words told a container whether a login it named is a member. `docs.log`'s `publish` line keeps the precise one, `for-not-a-member` or `no-recipient`; a `for` that names a member still answers `ok` |
2048
+ | `outside-home` | the path, every link resolved inside the container, is not under `/home/coder` |
2049
+ | `not-a-file` | missing, a directory, a FIFO or device, or a link appeared on the way after it was resolved |
2050
+ | `sha256-mismatch` | the file's bytes are not the ones the request hashed (it changed): nothing is stored |
2051
+ | `invalid` | the store refused it (a name or login it cannot hold) |
2052
+ | `error` | anything else went wrong after the claim (the journal names it): the request is answered and removed, never dropped silently |
2053
+
2054
+ Who it is for: `for` (stored in that member's store, for them alone); else the member whose profile last opened the lane
2055
+ (`users/<login>.json` `last_opened`); else every member whose record grants the lane's workspace (`for` empty). A busy
2056
+ store leaves the request for the next cycle, and without a `registry.json` nothing is taken (the requests wait). Each stored document sends one `published` push through notify (above;
2057
+ at most one per lane per minute). From inside a container the latest answer is `lanes_status`'s `published`, or:
2058
+
2059
+ ```sh
2060
+ ls -t ~/.lz/state/publish/<lane id>/ | head; cat ~/.lz/state/publish/<lane id>/<id>.receipt.json
2061
+ ```
2062
+
2063
+ A crash between the claim and the receipt leaves `.<id>.taking` without a receipt; publish again.
2064
+
2065
+ **Caddy picks up the route** as for `/enrol/*` (section "Enrolment service"): a server install restarts a running
2066
+ `lanes-mobile`; after editing the Caddyfile in place, `systemctl --user restart lanes-mobile.service`. If
2067
+ `/lanes-docs/` answers with the Zellij page, `lanes-mobile` runs an older Caddyfile. Settings go in a drop-in:
2068
+
2069
+ ```sh
2070
+ systemctl --user edit lanes-docsd.service # [Service] Environment=LANES_DOCS_DOMAINS=beyondwork.ai,example.com
2071
+ systemctl --user restart lanes-docsd.service
2072
+ ```
2073
+
2074
+ ### Mermaid pin
2075
+
2076
+ The docs page (plan W10, `docs/superpowers/plans/2026-10-08-lanes-docs-cockpit.md`) draws ```` ```mermaid ```` fences
2077
+ with Mermaid 11.17.2, pinned in `holders.lock` as an opt-in line: the npm tarball's sha256 and the sha256 of its member
2078
+ `package/dist/mermaid.min.js`, the classic-script build (3 572 661 B). The server installer's pinned-binaries loop
2079
+ skips it; `install/enable-docs.sh` installs it. As the workspace account, `sh
2080
+ ~/.local/share/lanes/current/install/enable-docs.sh` downloads the tarball into a
2081
+ temporary directory, refuses unless both digests match, and installs `~/.local/share/lanes/vendor/mermaid-11.17.2.min.js`
2082
+ (0644; `$LANES_SHARE/vendor`) and the link `mermaid.min.js`; run again, it finds the pinned digest and downloads
2083
+ nothing. Exit status: 0 installed or present, 1 a prerequisite or the download failed, 2 usage, 3 refused (no valid
2084
+ pin, a digest mismatch, the member missing or not a regular file) — a refusal installs nothing.
2085
+
2086
+ **The server install runs it (plan W8, LNS-109), never fatally.** The full `./install.sh --server` (or `npx
2087
+ @vibelord/lanes@<release> --server`) runs it right after `lanes-docsd`'s enable and restart, shows its own line, goes
2088
+ on whatever it exits, and ends its summary with one line: `Mermaid for the docs page: ok`, `… skipped (<its last
2089
+ line>) — diagrams show as source until sh <tree>/install/enable-docs.sh succeeds` (exit 1: a prerequisite or the
2090
+ network), `… refused (<its last line>) — nothing was installed; see RUNBOOK "Mermaid pin"` (exit 3), or `… failed (exit
2091
+ N: …)`; `--no-start` does not run it and says so. **An update (`--update-only`)** runs it as the post-commit step
2092
+ `enable-docs`, right after `try-restart lanes-docsd` (`libexec/update.py` `DOCS_STEP`; a release rolled back to that
2093
+ has no script gets no step): exit 0 is `ok`; exit 1, and a download stopped after the step's 300 s (`rc` 124), are
2094
+ recorded `"warning": true, "outcome": "skipped"`, exit 3 `"warning": true, "outcome": "refused"`, each with `reason`
2095
+ (the script's last line) — warnings, so the update stays `ok` and `lanes update` does not re-run the post-commit for
2096
+ them; any other status is a failed step (`"outcome": "failed"`, `partial`). The update's summary line names it:
2097
+ `…; every step ran; mermaid skipped: enable-docs: download failed: https://… — log …`. A re-run (every update, every
2098
+ install) finds the pinned file and downloads nothing. To install by hand after a skip, run the script; `lanes doctor`
2099
+ says which state the pin is in ("What `lanes doctor` says" below). Caddy serves the directory at `/lanes-assets/vendor/`
2100
+ (`lanes-mobile.service`; a new Caddyfile takes `systemctl --user try-restart lanes-mobile.service`, which the server
2101
+ installer does) as `immutable`, so `web/docs.js` names the versioned file and carries the member digest as its SRI
2102
+ (DEF-1870). Without the file, or on an integrity mismatch, every fence shows its source as a plain `<pre>`. Check:
2103
+ `curl -sI http://127.0.0.1:8083/lanes-assets/vendor/mermaid-11.17.2.min.js` answers 200 with `cache-control: public,
2104
+ max-age=31536000, immutable` (step 3 of "Operator verification" below; DEF-1871 stays open until that is seen on a
2105
+ server).
2106
+
2107
+ The pin needs no `'unsafe-eval'` (MEASURED 2026-10-08): the member has no `new Function(`; its four
2108
+ `Function("return this")` (lodash's global lookup) sit behind `self`, which every page has, and its one `(0,eval)`
2109
+ (chevrotain) follows a `return`. In headless Chromium 153 under `default-src 'none'; script-src 'self'; style-src
2110
+ 'self' 'unsafe-inline'`, docs.js drew a flowchart and a sequence diagram with no violation, while a control page's
2111
+ `eval` was refused and reported. Mermaid's SVG needs `style-src 'unsafe-inline'` (without it: unstyled, 88 violations).
2112
+
2113
+ To bump the pin (12.x — npm's latest, 12.1.0 on 2026-10-08 — is a separate decision): download the tarball once
2114
+ (`curl -fsSLO https://registry.npmjs.org/mermaid/-/mermaid-<v>.tgz`) and compare its sha512 with `npm view
2115
+ mermaid@<v> dist.integrity`; take `sha256sum mermaid-<v>.tgz` and `tar -xzOf mermaid-<v>.tgz
2116
+ package/dist/mermaid.min.js | sha256sum`; check that the member is still a classic script (no `import`/`export`, ends
2117
+ by assigning `globalThis["mermaid"]`) and repeat the `'unsafe-eval'` check above. Then change, in one commit, the
2118
+ `mermaid` line of `holders.lock` (and its comment) and `SRC`/`SRI` in `web/docs.js` — the SRI is `sha256-` plus the
2119
+ base64 of the raw member digest: `python3 -c 'import base64,sys; print("sha256-" +
2120
+ base64.b64encode(bytes.fromhex(sys.argv[1])).decode())' <member-sha256>`. `test_docs_assets` and
2121
+ `tests/web/docs.test.mjs` are red while the lock and docs.js disagree. The install or update of that release runs
2122
+ `enable-docs.sh`, which downloads the new pin (a skip says why: run it again by hand); older `vendor/mermaid-*.min.js`
2123
+ files stay (harmless; remove them by hand).
2124
+
2125
+ ### What `lanes doctor` says
2126
+
2127
+ Five lines (plan W8, LNS-109), after the browser/phone lines and before the release lines, read-only (one bounded
2128
+ `systemctl --user show`, one loopback connect that sends nothing — docsd answers nothing and writes no docs.log line
2129
+ for it — and file reads):
2130
+
2131
+ | Line | Marks |
2132
+ |---|---|
2133
+ | `lanes-docsd.service active, answering on 127.0.0.1:8185` | `✓` enabled, active and the port (its drop-in's `LANES_DOCS_PORT`, else 8185) accepts a connection; `✗` `enabled but failed` (or any state but active), `active, but 127.0.0.1:8185 does not answer`, a `LANES_DOCS_PORT` that is no port, or systemctl silent — each with `journalctl --user -u lanes-docsd.service; systemctl --user restart lanes-docsd.service`; `⚠` `not enabled, so there is no docs page` (the full server install enables it; `--update-only` never does) or active but not enabled (a reboot loses it) |
2134
+ | `docs: pinned — lanes-docsd answers members through Tailscale Serve` | `✓` `enrol-mode` pins `request`, read as docsd reads it on every request; `⚠ docs: refuses until the Serve header check is pinned (unpinned: auto \| pinned invite only \| <why the pin cannot be read>)` with the pointer to "Enrolment service" (Operator verification) and this section — an operator gate, never a `✗` |
2135
+ | `docs store: N documents in M lanes (counts.json), <size> under ~/.local/state/lanes/docs; docs.log <size>` | information: the documents and lanes `docs/counts.json` counts, the bytes of the regular files under `docs/` (never through a link), docs.log's size (`no docs.log yet`) |
2136
+ | `docs: Mermaid 11.17.2 pinned (~/.local/share/lanes/vendor/mermaid-11.17.2.min.js, sha256 581ed7d74bd9…)` | `✓` a regular file whose sha256 is `holders.lock`'s member digest; `⚠ … not installed …, so diagrams show as source — run sh …/install/enable-docs.sh`; `✗ … refused — … is not the pinned build (sha256 …, holders.lock …)` or `… is not a regular file` (a link or a FIFO, never followed or waited on) — browsers refuse it by its integrity; the script replaces it from a verified download; `✗ docs: Mermaid not checked — …/holders.lock: …` without a valid opt-in pin |
2137
+ | `docs: age encryption off (LANES_DOCS_AGE_RECIPIENT unset; age at /usr/bin/age)` | information while the switch is off (and whether an `age` is on PATH); `✓ … on — new store copies are age output (age at …); lanes-docsd opens them with LANES_DOCS_AGE_IDENTITY` (or `no LANES_DOCS_AGE_IDENTITY, so their downloads answer 409 encrypted`); `✗` set without an `age` binary (every upload and publish fails `encrypt-failed`) or a value that is no recipient. The recipient is never printed. The `age` looked for is the one on doctor's PATH, which may not be the unit's |
2138
+
2139
+ ### Operator verification (docs plan gate 1, not yet run on ceobox)
2140
+
2141
+ Unit-proven only so far: `tests/unit/test_docsd.py` runs a real docsd on a loopback port, `test_install.DocsRoute`
2142
+ models the shipped Caddyfile's routes and headers in front of it, `test_docs_assets.VendorRoute` models Caddy's route
2143
+ sort for the Mermaid route, and `tests/web/docs.test.mjs` and `tests/web/upload.test.mjs` drive the page scripts
2144
+ against fakes. Nothing below has been run on a server, a phone or a real browser. After the server install of the
2145
+ first release with the docs cockpit (1.3.0), run it once, in order, and record the date, the devices and each step's
2146
+ result here:
2147
+
2148
+ 1. **Install.** On the server, the full install: `npx @vibelord/lanes@1.3.0 --server` — it enables and restarts
2149
+ `lanes-docsd`, restarts `lanes-mobile` on the new Caddyfile and runs `enable-docs.sh`; its last lines say
2150
+ `Mermaid for the docs page: ok`. Then `lanes install-container <name>` for each container whose agents should
2151
+ publish (the `lane publish` verb and the `lanes_publish` tool; new agent sessions load the tool).
2152
+ 2. **Pin.** From another tailnet device signed in as yourself, run the Serve header check (section "Enrolment
2153
+ service", Operator verification); on the server, `lanes enrol mode request`. `lanes doctor` then shows
2154
+ `✓ lanes-docsd.service active, answering on 127.0.0.1:8185`, `✓ docs: pinned …` and
2155
+ `✓ docs: Mermaid 11.17.2 pinned …`.
2156
+ 3. **The Mermaid route (DEF-1871).** On the server, `curl -sI
2157
+ http://127.0.0.1:8083/lanes-assets/vendor/mermaid-11.17.2.min.js` answers `200` with `cache-control: public,
2158
+ max-age=31536000, immutable`. Seen once on the server, that closes DEF-1871 (the route proven on a running Caddy,
2159
+ not only on a model of its sort).
2160
+ 4. **Publish.** In a lane of a container from step 1, `~/.lz/bin/lane publish README.md` (a README with a
2161
+ ```` ```mermaid ```` fence; add a small flowchart if it has none). The JSON says `"picked_up_by": "lanes-docsd"`;
2162
+ within about 5 s `cat ~/.lz/state/publish/<lane id>/<id>.receipt.json` says `"outcome": "ok"` with a `url`.
2163
+ 5. **Sidebar.** Within a few seconds that workspace's upload strip reads ` ↑ uploads · ▤ docs 1 (U)`. With the
2164
+ cursor on the lane, `d` shows `https://<name>:8443/lanes-docs/?ws=<workspace>&lane=<lane id>` in the footer; a
2165
+ ⌘-click or Ctrl-click on it (or on the strip) opens the page.
2166
+ 6. **Phone.** **More → Docs** opens the index in a new tab, signed in as you; the README opens rendered and its
2167
+ ```` ```mermaid ```` fence is drawn as a diagram, not shown as source.
2168
+ 7. **Artifact sandbox (DEF-1853).** Publish an HTML file whose script tries to reach this site and writes what it
2169
+ got into its own page: `fetch('/lanes-docs/')`, `fetch('/')`, `document.cookie`, and a WebSocket to the same
2170
+ server's `/ws/` path that the terminal page itself opens (the browser's network panel on a view shows it). **Open
2171
+ the HTML artifact**: the script runs (the page shows its writing), every one of those attempts fails or comes back
2172
+ empty, and no lane receives a keystroke. Record the browser and what each attempt answered: that is DEF-1853's
2173
+ measurement.
2174
+ 8. **Upload.** On the Docs page pick a lane, drop a file on the dashed area, **Upload**: the receipt lists the name,
2175
+ size, sha256 and `/home/coder/<repo>/uploads/<name>`; in that lane's shell, `sha256sum
2176
+ /home/coder/<repo>/uploads/<name>` prints the receipt's sha256. The sidebar's count goes up by one.
2177
+ 9. **Not a member.** From a tailnet login that owns no member record, `https://<name>:8443/lanes-docs/` answers 403
2178
+ `not-a-member`; on the server, `curl -s http://127.0.0.1:8185/` answers `{"error": "not-through-serve"}`.
2179
+ 10. **Forged header: the known DEF-1645 case.** A process in the host's network namespace can send Serve's headers
2180
+ itself: list such containers with `docker ps --filter network=host` and record the answer. From one (or from the
2181
+ host as the workspace account), `curl -s -H 'Tailscale-User-Login: <a member login>' -H 'Tailscale-User-Name: x'
2182
+ -H 'X-Forwarded-For: 100.64.0.9' -H 'Sec-Fetch-Site: none' http://127.0.0.1:8083/lanes-docs/` is answered as that
2183
+ member. That is expected and stays DEF-1645 (open): the pin gate and the Serve-only check are the controls against
2184
+ every other client, not against a process on this host. If another account or a host-network container exists,
2185
+ weigh `lanes enrol mode invite` (which also stops the Docs page) against it.
2186
+
1826
2187
  ## Safety rules baked into the code (do not remove)
1827
2188
 
1828
2189
  - tmux is always called with `-N` (`attach-session`, `new-session` and `start-server` on a missing socket start