@vibelord/lanes 1.2.0 → 1.5.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 (46) hide show
  1. package/package.json +1 -1
  2. package/payload/lanes/README.md +7 -5
  3. package/payload/lanes/VERSION +1 -1
  4. package/payload/lanes/bin/lanes +1091 -76
  5. package/payload/lanes/container/hooks/grok-cli-hooks.json +8 -0
  6. package/payload/lanes/container/hooks/grok-hooks.json +12 -0
  7. package/payload/lanes/container/hooks/kimi-hooks.toml +49 -0
  8. package/payload/lanes/container/lane +55 -8
  9. package/payload/lanes/container/lane-mcp +120 -22
  10. package/payload/lanes/container/lane-signal +86 -23
  11. package/payload/lanes/container/lane_core.py +524 -36
  12. package/payload/lanes/container/throttle-pulse +456 -0
  13. package/payload/lanes/docs/ARCHITECTURE.md +357 -34
  14. package/payload/lanes/docs/DESIGN.md +13 -3
  15. package/payload/lanes/docs/INSTALL.md +47 -10
  16. package/payload/lanes/docs/RUNBOOK.md +761 -12
  17. package/payload/lanes/docs/USERGUIDE.md +421 -46
  18. package/payload/lanes/holders.lock +5 -0
  19. package/payload/lanes/install/enable-docs.sh +78 -0
  20. package/payload/lanes/install/host-install.sh +39 -5
  21. package/payload/lanes/libexec/agent_state.py +604 -12
  22. package/payload/lanes/libexec/docs_store.py +995 -0
  23. package/payload/lanes/libexec/docsd.py +2010 -0
  24. package/payload/lanes/libexec/economy_poll.py +6 -2
  25. package/payload/lanes/libexec/harness_grok.py +742 -0
  26. package/payload/lanes/libexec/lanes_lib.py +143 -20
  27. package/payload/lanes/libexec/mdlite.py +575 -0
  28. package/payload/lanes/libexec/members.py +5 -0
  29. package/payload/lanes/libexec/notify.py +65 -5
  30. package/payload/lanes/libexec/sidebar.py +626 -25
  31. package/payload/lanes/libexec/statusd.py +530 -32
  32. package/payload/lanes/libexec/tokens.py +42 -9
  33. package/payload/lanes/libexec/update.py +171 -26
  34. package/payload/lanes/libexec/uploads.py +538 -0
  35. package/payload/lanes/libexec/users.py +31 -3
  36. package/payload/lanes/site/site.example.conf +4 -0
  37. package/payload/lanes/systemd/lanes-docsd.service +29 -0
  38. package/payload/lanes/web/Caddyfile +24 -1
  39. package/payload/lanes/web/README.md +86 -8
  40. package/payload/lanes/web/browser.js +2 -4
  41. package/payload/lanes/web/docs.css +52 -0
  42. package/payload/lanes/web/docs.js +36 -0
  43. package/payload/lanes/web/mobile.js +3 -2
  44. package/payload/lanes/web/upload.css +17 -0
  45. package/payload/lanes/web/upload.js +84 -0
  46. package/payload/manifest.json +5 -3
@@ -16,3 +16,8 @@ glow 3.0.0 13e05e4b2acc18d2aee44291aefe6325b077ec321b631a0cfa780e8e3bc33f78 http
16
16
  # a locally built binary with `lanes studio-host install --from PATH [--sha256 HEX]` (also sha256-verified).
17
17
  # Template (fill from the release's two .sha256 sidecars, then uncomment):
18
18
  # throttle-rc node-<sha12> <tarball-sha256> https://github.com/bwllaming/bw-tools/releases/download/node/<sha12>/throttle-rc-x86_64-unknown-linux-gnu.tar.gz opt-in throttle-rc-x86_64-unknown-linux-gnu/throttle-rc <binary-sha256>
19
+ # mermaid 11.17.2 (the docs page's diagrams, plan W10 W6, LNS-107): the npm tarball, 17,796,365 B, whose sha512 is the
20
+ # registry's dist.integrity; the member is the classic-script (IIFE) build, 3,572,661 B, that web/docs.js loads with
21
+ # this digest as its SRI. Both sha256s measured 2026-10-08. install/enable-docs.sh installs it into
22
+ # ~/.local/share/lanes/vendor/; to bump it see docs/RUNBOOK.md "Mermaid pin".
23
+ mermaid 11.17.2 6ad2f42c3fc26bbf9e45cbb6d11898972573ea52b33a5f4ff51952899f950ffd https://registry.npmjs.org/mermaid/-/mermaid-11.17.2.tgz opt-in package/dist/mermaid.min.js 581ed7d74bd9048d0e3a91363927d72ef22942d7722546b27f7cc29e35390eb8
@@ -0,0 +1,78 @@
1
+ #!/bin/sh
2
+ # The docs page's pinned Mermaid (plan W10 W6, LNS-107; docs/RUNBOOK.md "Mermaid pin"). Every server install runs it
3
+ # right after lanes-docsd's restart and every update (--update-only) as the post-commit step `enable-docs` (W8, LNS-109:
4
+ # host-install.sh, libexec/update.py DOCS_STEP), never fatally; it runs by hand as well. As the workspace account, never
5
+ # root. Reads holders.lock's `mermaid` opt-in pin, downloads its npm tarball into a temporary
6
+ # directory, checks the tarball's sha256, extracts ONLY the pinned member (never a link), checks the member's sha256,
7
+ # and installs it as $LANES_SHARE/vendor/mermaid-<version>.min.js (0644, by rename) with the relative link
8
+ # mermaid.min.js -> that file. Caddy serves the directory at /lanes-assets/vendor/ (web/Caddyfile); web/docs.js
9
+ # loads the versioned name with the member digest as its SRI. Idempotent: an installed file whose digest is the pin's
10
+ # is kept and nothing is downloaded; one that differs is replaced from a verified download. Older versions stay.
11
+ # Exit status: 0 installed, or already present; 1 a prerequisite is missing or the download failed; 2 usage;
12
+ # 3 refused — holders.lock has no valid mermaid pin, a digest differs, or the member is missing or not a regular file.
13
+ # A refusal or failure installs nothing.
14
+ set -eu
15
+ repo=$(cd "$(dirname "$0")/.." && pwd)
16
+ usage='usage: enable-docs.sh [--help]'
17
+ case "$#:${1:-}" in
18
+ 0:) ;;
19
+ 1:-h|1:--help)
20
+ echo "$usage"
21
+ echo 'Installs the Mermaid that holders.lock pins (opt-in line `mermaid`) into ~/.local/share/lanes/vendor/'
22
+ echo '($LANES_SHARE/vendor), after checking the sha256 of the npm tarball and of its member.'
23
+ echo 'Exit status: 0 installed or already present; 1 a prerequisite is missing or the download failed;'
24
+ echo '2 usage; 3 refused (no valid pin, a sha256 mismatch, the member missing or not a regular file).'
25
+ exit 0 ;;
26
+ *) echo "$usage" >&2; exit 2 ;;
27
+ esac
28
+ [ "$(id -u)" != 0 ] || { echo 'Run as the workspace account, not root.' >&2; exit 1; }
29
+ for command in curl tar sha256sum install mktemp; do
30
+ command -v "$command" >/dev/null 2>&1 || { echo "Missing prerequisite: $command (see docs/INSTALL.md)" >&2; exit 1; }
31
+ done
32
+ share=${LANES_SHARE:-$HOME/.local/share/lanes}
33
+ lock=$repo/holders.lock
34
+ refuse() { echo "enable-docs: refused, nothing was installed: $*" >&2; exit 3; }
35
+ hex64() { [ "${#1}" -eq 64 ] && case $1 in *[!0-9a-f]*) false ;; esac; }
36
+
37
+ # The pin: exactly one `mermaid` line of the 7-field opt-in grammar (holders.lock's header; studio_host.parse_lock).
38
+ pins=$(grep -v '^[[:space:]]*#' "$lock" | awk '$1 == "mermaid"') || :
39
+ [ -n "$pins" ] || refuse "$lock has no mermaid line"
40
+ [ "$(printf '%s\n' "$pins" | wc -l)" -eq 1 ] || refuse "$lock pins mermaid more than once"
41
+ # shellcheck disable=SC2086 # the line's words are the fields; no pathname expansion of them
42
+ set -f
43
+ set -- $pins
44
+ set +f
45
+ [ "$#" -eq 7 ] && [ "$5" = opt-in ] || refuse "$lock: the mermaid line is not 'name version sha256 url opt-in member sha256'"
46
+ version=$2 sha=$3 url=$4 member=$6 member_sha=$7
47
+ case $version in ''|*[!A-Za-z0-9._-]*) refuse "$lock: mermaid version '$version' is not a plain word" ;; esac
48
+ hex64 "$sha" || refuse "$lock: the mermaid tarball digest is not 64 lowercase hex"
49
+ hex64 "$member_sha" || refuse "$lock: the mermaid member digest is not 64 lowercase hex"
50
+ case $url in https://*) ;; *) refuse "$lock: the mermaid url is not https" ;; esac
51
+ case /$member/ in //*|*/../*|*/./*|*//*) refuse "$lock: member '$member' is not a plain relative path" ;; esac
52
+
53
+ vendor=$share/vendor
54
+ target=$vendor/mermaid-$version.min.js
55
+ if [ -f "$target" ] && [ ! -L "$target" ] && [ "$(sha256sum "$target" | cut -d' ' -f1)" = "$member_sha" ]; then
56
+ ln -sfn "mermaid-$version.min.js" "$vendor/mermaid.min.js"
57
+ echo "ok mermaid $version ($target)"
58
+ exit 0
59
+ fi
60
+
61
+ temporary=$(mktemp -d)
62
+ trap 'rm -rf "$temporary"' EXIT
63
+ trap 'exit 130' INT
64
+ trap 'exit 143' TERM HUP
65
+ curl -fsSL --retry 3 -o "$temporary/mermaid.tgz" "$url" || { echo "enable-docs: download failed: $url" >&2; exit 1; }
66
+ actual=$(sha256sum "$temporary/mermaid.tgz" | cut -d' ' -f1)
67
+ [ "$actual" = "$sha" ] || refuse "sha256 mismatch for the mermaid $version tarball: $actual, pinned $sha"
68
+ mkdir "$temporary/x"
69
+ tar -xzf "$temporary/mermaid.tgz" -C "$temporary/x" "$member" 2>/dev/null || refuse "the tarball has no $member"
70
+ file=$temporary/x/$member
71
+ [ -f "$file" ] && [ ! -L "$file" ] || refuse "$member in the tarball is not a regular file"
72
+ actual=$(sha256sum "$file" | cut -d' ' -f1)
73
+ [ "$actual" = "$member_sha" ] || refuse "sha256 mismatch for $member: $actual, pinned $member_sha"
74
+ mkdir -p "$vendor"
75
+ install -m 0644 "$file" "$vendor/.mermaid-$version.min.js.$$"
76
+ mv -f "$vendor/.mermaid-$version.min.js.$$" "$target"
77
+ ln -sfn "mermaid-$version.min.js" "$vendor/mermaid.min.js"
78
+ echo "installed $target (sha256 $member_sha)"
@@ -8,13 +8,15 @@
8
8
  # (sha256), terminfo, the catalog: a failure here leaves the installed release running exactly as it was;
9
9
  # commit install/services.py --install: every unit, then current.previous, then the flip of `current` (W9 U1);
10
10
  # post-commit libexec/update.py post-commit, from the tree just installed: daemon-reload, `lanes sync`, restart
11
- # lanes-statusd, try-restart each optional service, `lanes install-container` per container,
12
- # `lanes reload-views`, `lanes ensure --if-layout-changed` — each step runs whatever the one before it
13
- # returned (`lanes sync` exiting 1 — a board with an error — is a warning in the record, which leaves
14
- # the result `ok`; never the end of the update).
11
+ # lanes-statusd, try-restart each optional service (right after lanes-docsd's, install/enable-docs.sh:
12
+ # the docs page's pinned Mermaid, a warning when it is skipped or refused, W10 W8), `lanes
13
+ # install-container` per container, `lanes reload-views`, `lanes ensure --if-layout-changed` — each step
14
+ # runs whatever the one before it returned (`lanes sync` exiting 1 — a board with an error — is a warning
15
+ # in the record, which leaves the result `ok`; never the end of the update).
15
16
  # Every run is recorded in $LANES_STATE/update/last.json (DM-LANES-UPDATE-RECORD: result ok | partial | refused |
16
17
  # failed, each phase and step with its exit status) and logged in full to update/last.log; the terminal or the journal
17
- # gets one line per phase and step. A full install (no --update-only) prints as before and records nothing.
18
+ # gets one line per phase and step. A full install (no --update-only) records nothing; it runs enable-docs.sh right
19
+ # after lanes-docsd's restart, never fatally, and its summary names the Mermaid outcome.
18
20
  # One install or update at a time: every run but --check first takes the run lock $LANES_STATE/update/.lock and holds
19
21
  # it to its end (fd 9); a run that finds it held writes nothing — no log, no record — and exits 3.
20
22
  # A full install enables lanes-update.timer with the other timers (plan W9 U3, LNS-91): `lanes update --timer`, 15 min
@@ -154,6 +156,15 @@ for command in python3 curl tar sha256sum infocmp tic install systemctl docker t
154
156
  command -v "$command" >/dev/null 2>&1 || { echo "Missing prerequisite: $command (see docs/INSTALL.md)" >&2; exit 1; }
155
157
  done
156
158
  python3 -c 'import sys; sys.exit(0 if sys.version_info >= (3, 9) else "Python 3.9+ is required")'
159
+ # --- docs store encryption at rest (W10 W5, LNS-106) ------------------------------------------------------------
160
+ # LANES_DOCS_AGE_RECIPIENT in lanes-docsd.service's drop-in encrypts each document's docs-store copy with `age -r`
161
+ # (default off; RUNBOOK "Docs service", encryption at rest). Set where no `age` binary is on PATH, every upload and
162
+ # publish would fail: refused here, before anything is installed, with libexec/docs_store.py's reason.
163
+ check_docs_age() {
164
+ python3 "$repo/libexec/docs_store.py" check-age || exit 1
165
+ }
166
+ check_docs_age
167
+ # --- end docs store encryption at rest -------------------------------------------------------------------------
157
168
  export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}"
158
169
  if [ "$start" = 1 ]; then
159
170
  systemctl --user show-environment >/dev/null
@@ -224,6 +235,7 @@ if [ "$update_only" = 1 ]; then
224
235
  *) printf 'partial: the post-commit ended with exit %s (log %s)\n' "$status" "$log" >&3; exit 4 ;;
225
236
  esac
226
237
  fi
238
+ mermaid="not installed (--no-start) — sh $repo/install/enable-docs.sh installs it"
227
239
  if [ "$start" = 1 ]; then
228
240
  systemctl --user daemon-reload
229
241
  # A failing sync (a board's container down, a registry it cannot read) is reported; the services still start.
@@ -236,11 +248,33 @@ if [ "$start" = 1 ]; then
236
248
  # The enrolment service (libexec/enrold.py) runs the code of THIS install: enable, then (re)start it.
237
249
  systemctl --user enable lanes-enrold.service
238
250
  systemctl --user restart lanes-enrold.service
251
+ # The docs service (libexec/docsd.py, W10 W3) likewise; it refuses every request until `lanes enrol mode request`
252
+ # pins the Serve header check.
253
+ systemctl --user enable lanes-docsd.service
254
+ systemctl --user restart lanes-docsd.service
255
+ # --- the docs page's pinned Mermaid (W10 W8, LNS-109) ---------------------------------------------------------
256
+ # install/enable-docs.sh (RUNBOOK "Mermaid pin"), never fatal: the install goes on whatever it exits, and the
257
+ # summary below names the outcome — 0 ok (installed, or already present with the pinned digest: no download),
258
+ # 1 skipped (a prerequisite or the download), 3 refused (no valid pin, a digest mismatch: nothing installed), any
259
+ # other status failed. An update (--update-only) runs it as a post-commit step (libexec/update.py DOCS_STEP).
260
+ mermaid_rc=0
261
+ mermaid_said=$(sh "$repo/install/enable-docs.sh" 2>&1 9>&-) || mermaid_rc=$?
262
+ [ -z "$mermaid_said" ] || printf '%s\n' "$mermaid_said"
263
+ mermaid_reason=$(printf '%s\n' "$mermaid_said" | awk 'NF { line = $0 } END { print line }')
264
+ [ -n "$mermaid_reason" ] || mermaid_reason="exit $mermaid_rc, no output"
265
+ case $mermaid_rc in
266
+ 0) mermaid='ok' ;;
267
+ 1) mermaid="skipped ($mermaid_reason) — diagrams show as source until sh $repo/install/enable-docs.sh succeeds" ;;
268
+ 3) mermaid="refused ($mermaid_reason) — nothing was installed; see RUNBOOK \"Mermaid pin\"" ;;
269
+ *) mermaid="failed (exit $mermaid_rc: $mermaid_reason) — sh $repo/install/enable-docs.sh" ;;
270
+ esac
271
+ # --- end the docs page's pinned Mermaid -----------------------------------------------------------------------
239
272
  # A running web frontend reads the Caddyfile of the tree it was started from; an npm update stages a new tree,
240
273
  # so a reload would keep the old routes (/enrol/ included): restart it, only when it runs. Clients reconnect.
241
274
  systemctl --user try-restart lanes-mobile.service
242
275
  fi
243
276
  printf '\nServer installed from %s\n' "$repo"
277
+ echo "Mermaid for the docs page: $mermaid"
244
278
  echo 'Configure boards in ~/.config/lanes/workspaces/; see workspaces.example/README.md.'
245
279
  echo 'Next: lanes install-container CONTAINER; lanes sync; lanes doctor'
246
280
  echo 'Web access and host cleanup/guard timers remain opt-in; see docs/INSTALL.md.'