@vibelord/lanes 1.8.0 → 1.9.3
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.
- package/package.json +1 -1
- package/payload/lanes/README.md +29 -11
- package/payload/lanes/VERSION +1 -1
- package/payload/lanes/bin/lanes +159 -59
- package/payload/lanes/bin-rs/BINARIES.json +2 -17
- package/payload/lanes/client/lanes-launch +51 -2
- package/payload/lanes/container/lane +142 -19
- package/payload/lanes/container/lane-mcp +168 -55
- package/payload/lanes/container/lane-peerd +6 -6
- package/payload/lanes/container/lane-signal +48 -3
- package/payload/lanes/container/lane_core.py +1040 -164
- package/payload/lanes/container/throttle-pulse +13 -4
- package/payload/lanes/docs/AGENTS-lanes.md +15 -7
- package/payload/lanes/docs/ARCHITECTURE.md +478 -101
- package/payload/lanes/docs/DESIGN.md +7 -2
- package/payload/lanes/docs/INSTALL.md +20 -3
- package/payload/lanes/docs/PLAN-1.9.1-SIDEBAR-CODEX.md +128 -0
- package/payload/lanes/docs/RUNBOOK.md +1428 -107
- package/payload/lanes/docs/USERGUIDE.md +488 -86
- package/payload/lanes/holders/tmux.sh +3 -3
- package/payload/lanes/install/services.py +68 -11
- package/payload/lanes/libexec/agent_state.py +2 -5
- package/payload/lanes/libexec/attach.py +11 -3
- package/payload/lanes/libexec/cursor_sync.py +22 -2
- package/payload/lanes/libexec/docsd.py +38 -4
- package/payload/lanes/libexec/lanes_lib.py +377 -39
- package/payload/lanes/libexec/mdlite.py +43 -3
- package/payload/lanes/libexec/notify.py +69 -26
- package/payload/lanes/libexec/registrations.py +5 -0
- package/payload/lanes/libexec/session_actions.py +114 -27
- package/payload/lanes/libexec/sidebar.py +246 -64
- package/payload/lanes/libexec/site_hooks.py +65 -0
- package/payload/lanes/libexec/statusd.py +139 -189
- package/payload/lanes/libexec/studio_host.py +8 -2
- package/payload/lanes/libexec/tokens.py +6 -2
- package/payload/lanes/libexec/update.py +13 -5
- package/payload/lanes/libexec/view.sh +39 -4
- package/payload/lanes/libexec/workspace_keys.py +54 -0
- package/payload/lanes/site/protocol.py +15 -5
- package/payload/lanes/site/relay.py +5 -2
- package/payload/lanes/site/server.py +29 -18
- package/payload/lanes/systemd/lanes-economy.service +3 -1
- package/payload/lanes/tokens/README.md +10 -0
- package/payload/lanes/tokens/generate.py +1 -1
- package/payload/lanes/web/Caddyfile +9 -2
- package/payload/lanes/web/README.md +2410 -95
- package/payload/lanes/web/browser.css +2 -0
- package/payload/lanes/web/browser.js +18 -6
- package/payload/lanes/web/directory.js +1 -1
- package/payload/lanes/web/docs.js +23 -0
- package/payload/lanes/web/links.js +157 -0
- package/payload/lanes/web/manifest.webmanifest +0 -2
- package/payload/lanes/web/mobile.css +30 -32
- package/payload/lanes/web/mobile.js +286 -227
- package/payload/lanes/web/upload.js +65 -22
- package/payload/lanes/web/workspace-keys.js +65 -0
- package/payload/lanes/zellij/config.kdl +1 -1
- package/payload/manifest.json +5 -22
- package/payload/lanes/bin-rs/THIRD-PARTY-NOTICES +0 -18953
- package/payload/lanes/bin-rs/x86_64-unknown-linux-musl/lanes-hook +0 -0
- package/payload/lanes/bin-rs/x86_64-unknown-linux-musl/lanes-terminal +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"""External site-hook loader (FLE-388, BEY-6912 durable federation).
|
|
2
|
+
|
|
3
|
+
A host declares `LANES_SITE_HOOK=<dir>` in site.conf (or the env). Each `.py`
|
|
4
|
+
module in that dir may define any of install_library / install_status /
|
|
5
|
+
install_cli / install_docs / install_actions. At each entrypoint the matching
|
|
6
|
+
one is called, so a host's federation hook lives OUTSIDE the package tree and
|
|
7
|
+
survives every update. No declaration (or `=refuse`) -> a no-op. Values are read
|
|
8
|
+
from site.conf, never executed.
|
|
9
|
+
"""
|
|
10
|
+
import importlib.util
|
|
11
|
+
import os
|
|
12
|
+
import sys
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
|
|
15
|
+
_STAGES = ('library', 'status', 'cli', 'docs', 'actions')
|
|
16
|
+
_modules = None
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _hook_dir():
|
|
20
|
+
val = os.environ.get('LANES_SITE_HOOK')
|
|
21
|
+
if val is None:
|
|
22
|
+
conf = Path(os.environ.get('HOME', '')) / '.config' / 'lanes' / 'site.conf'
|
|
23
|
+
try:
|
|
24
|
+
for line in conf.read_text().splitlines():
|
|
25
|
+
s = line.strip()
|
|
26
|
+
if s.startswith('LANES_SITE_HOOK='):
|
|
27
|
+
val = s.split('=', 1)[1].strip()
|
|
28
|
+
except OSError:
|
|
29
|
+
return None
|
|
30
|
+
if not val or val == 'refuse':
|
|
31
|
+
return None
|
|
32
|
+
d = Path(val).expanduser()
|
|
33
|
+
return d if d.is_dir() else None
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _load():
|
|
37
|
+
global _modules
|
|
38
|
+
if _modules is not None:
|
|
39
|
+
return _modules
|
|
40
|
+
_modules = []
|
|
41
|
+
d = _hook_dir()
|
|
42
|
+
if d is None:
|
|
43
|
+
return _modules
|
|
44
|
+
for path in sorted(d.glob('*.py')):
|
|
45
|
+
if path.name.startswith('_'):
|
|
46
|
+
continue
|
|
47
|
+
spec = importlib.util.spec_from_file_location(path.stem, str(path))
|
|
48
|
+
if spec is None or spec.loader is None:
|
|
49
|
+
continue
|
|
50
|
+
mod = importlib.util.module_from_spec(spec)
|
|
51
|
+
sys.modules.setdefault(path.stem, mod)
|
|
52
|
+
spec.loader.exec_module(mod)
|
|
53
|
+
_modules.append(mod)
|
|
54
|
+
return _modules
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def apply(stage, *args):
|
|
58
|
+
"""Call install_<stage>(*args) on every declared site-hook module that defines it."""
|
|
59
|
+
if stage not in _STAGES:
|
|
60
|
+
raise ValueError('unknown site-hook stage: %r' % stage)
|
|
61
|
+
fn = 'install_' + stage
|
|
62
|
+
for mod in _load():
|
|
63
|
+
f = getattr(mod, fn, None)
|
|
64
|
+
if f is not None:
|
|
65
|
+
f(*args)
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""lanes status daemon: observes lanes, and touches them in two bounded ways only — the name parity retry
|
|
3
|
-
(`names_auto`, below; LANES_NAMES_AUTO=0 turns it off) and the
|
|
4
|
-
(`
|
|
3
|
+
(`names_auto`, below; LANES_NAMES_AUTO=0 turns it off) and the ttl purge of messages waiting in a lane's inbox
|
|
4
|
+
(`purge_inbox`, W15 L4). It never types a message into a lane (BEY-7538, 2026-11-08: a message never types into a
|
|
5
|
+
terminal; a waiting one stays in the inbox until the lane's agent reads it).
|
|
5
6
|
|
|
6
7
|
Every few seconds: find LIVE tmux servers in each workspace container's own cgroup (`guard`, plain /proc reads;
|
|
7
8
|
dead sockets are never probed), run one read-only `list-panes -a` per live server that the registry references —
|
|
@@ -31,23 +32,26 @@ lane's agent{} `messaging` ({socket_present, name}: whether the messaging socket
|
|
|
31
32
|
opened, and its session name) and `name_match` (that name == the address). Between two cycles, never inside one, and
|
|
32
33
|
only while site.conf leaves LANES_NAMES_AUTO on and the host is `ok`, `names_auto` types `/rename <address>` into at
|
|
33
34
|
most NAMES_PER_PASS mismatched Claude lanes at their prompt with no terminal attached, each at most once per
|
|
34
|
-
NAMES_RETRY_S —
|
|
35
|
-
file first), logged as lane id, address and outcome only.
|
|
35
|
+
NAMES_RETRY_S — the one thing this daemon ever types into a lane, a command and never a message (`lanes_lib.rename_claude`
|
|
36
|
+
re-checks the session file first), logged as lane id, address and outcome only.
|
|
36
37
|
|
|
37
38
|
Messages (W15 L4): a lane row carries `inbox: {pending}` while messages wait in the container's
|
|
38
39
|
`~/.lz/state/inbox/<lane>/` (`inbox_scan`: one bounded scandir per container per cycle, a lane's files read only when
|
|
39
|
-
its directory changed)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
its directory changed); the sidebar draws it as ✉. A waiting message stays there until the lane's agent reads and
|
|
41
|
+
acknowledges it — this daemon never types one (BEY-7538). Between two cycles, never inside one and only on an `ok` host,
|
|
42
|
+
`purge_inbox` empties the text of at most INBOX_PURGE_PER_PASS messages whose ttl passed (receipt `expired`) and
|
|
43
|
+
finishes a cleanup that stopped between its two writes (`cleared`) — the journal names lane, message id and outcome
|
|
44
|
+
only.
|
|
43
45
|
|
|
44
46
|
Claude peers (W15 L6, BEY-6843): each workspace container with the lane contract runs one `lane-peerd` loop, which
|
|
45
47
|
registers that container's non-Claude lanes as virtual Claude peers. Between two cycles, never inside one and never on
|
|
46
48
|
a `critical` host, `rearm_peerd` looks (at most every PEERD_CHECK_S per container: three stats through
|
|
47
49
|
/proc/<init>/root) at its `~/.lz/state/peers/peers.json`, and where that file is older than PEERD_REARM_S or absent
|
|
48
|
-
while `~/.lz/bin/lane-peerd` is installed starts the loop with ONE bounded `docker exec -d … tmux -L lanes-peers
|
|
49
|
-
-d -s peerd
|
|
50
|
-
|
|
50
|
+
while `~/.lz/bin/lane-peerd` is installed starts the loop with ONE bounded `docker exec -d … tmux -L lanes-peers -f
|
|
51
|
+
/dev/null new -d -s peerd-next ; kill-session -a -t =peerd-next ; rename-session -t =peerd-next peerd ;
|
|
52
|
+
respawn-pane -k -t =peerd: ~/.lz/bin/lane-peerd --loop` (BEY-8660: any leftover session of that server is ended) — at
|
|
53
|
+
most once per PEERD_REARM_EVERY per container and PEERD_PER_PASS per pass; site.conf LANES_PEERS=0 turns the start
|
|
54
|
+
off. The `~/.claude/sessions` entries lane-peerd writes are never read as
|
|
51
55
|
Claude sessions (`agent_state.claude_sessions` skips them by their socket's directory).
|
|
52
56
|
"""
|
|
53
57
|
import concurrent.futures
|
|
@@ -121,6 +125,7 @@ PULSE_COUNTS = ('configured', 'usable', 'cooling', 'exhausted', 'benched', 'auth
|
|
|
121
125
|
PULSE_OVERFLOW = ('spend_today_usd', 'budget_usd', 'fraction', 'alert_level_pct')
|
|
122
126
|
PULSE_PHASE = re.compile(r'[a-z][a-z0-9_-]{0,31}\Z', re.ASCII)
|
|
123
127
|
PULSE_ERROR_MAX = 160
|
|
128
|
+
PULSE_CONTROL = re.compile(r'^https?://[A-Za-z0-9_.:-]{1,253}\Z') # the pulse's `control_url` as copied: a bare http(s) origin
|
|
124
129
|
|
|
125
130
|
|
|
126
131
|
def log(where, error):
|
|
@@ -1278,6 +1283,10 @@ def build_payload(ctx, level, reconcile=True):
|
|
|
1278
1283
|
kept = [entry for entry in entries if entry.get('holder') == 'tmux']
|
|
1279
1284
|
if kept:
|
|
1280
1285
|
unregistered[workspace] = kept
|
|
1286
|
+
try: # BEY-7435: a session a terminals.json still binds without its board row is named as such
|
|
1287
|
+
unregistered = with_dangling(unregistered, dangling_sessions(ctx, registry, containers))
|
|
1288
|
+
except Exception as error:
|
|
1289
|
+
log('dangling bindings', error)
|
|
1281
1290
|
ctx['cut'] = report.get('cut', 0)
|
|
1282
1291
|
# Half of all our spawns, and only cosmetics (who dictates a window size): not on a host under pressure.
|
|
1283
1292
|
if reconcile and level == 'ok':
|
|
@@ -1544,7 +1553,8 @@ def _flag(value):
|
|
|
1544
1553
|
|
|
1545
1554
|
|
|
1546
1555
|
def pulse_projection(data):
|
|
1547
|
-
"""The pulse's bytes as status.json carries them, or None when they are no v1 pulse document (spec W11 §2.1
|
|
1556
|
+
"""The pulse's bytes as status.json carries them, or None when they are no v1 pulse document (spec W11 §2.1;
|
|
1557
|
+
`control_url` additive since BEY-6845).
|
|
1548
1558
|
|
|
1549
1559
|
The daemon's container writes that file, and the sidebar draws what is in it into terminals: nothing is copied as
|
|
1550
1560
|
such. Only the spec's keys are, each of its own type — counts non-negative integers; fractions, dollars and
|
|
@@ -1577,8 +1587,15 @@ def pulse_projection(data):
|
|
|
1577
1587
|
overflow[pool] = {key: _number(money.get(key)) for key in PULSE_OVERFLOW}
|
|
1578
1588
|
error = document.get('error')
|
|
1579
1589
|
error = ''.join(c for c in error if c.isprintable())[:PULSE_ERROR_MAX] if isinstance(error, str) else ''
|
|
1580
|
-
|
|
1581
|
-
|
|
1590
|
+
projected = {'v': 1, 'at': int(document['at']), 'up': _flag(document.get('up')), 'tokened': _flag(document.get('tokened')),
|
|
1591
|
+
'pools': pools, 'overflow': overflow, 'error': error or None}
|
|
1592
|
+
# BEY-6845 (additive): where the pulse asked, so the block and doctor can say where the daemon was not reached —
|
|
1593
|
+
# only a bare http(s) origin (scheme, host, port: no user part, path, query or escape), and only when the pulse
|
|
1594
|
+
# wrote one (a pulse from before it writes none: the key stays absent).
|
|
1595
|
+
control = document.get('control_url')
|
|
1596
|
+
if isinstance(control, str) and PULSE_CONTROL.match(control):
|
|
1597
|
+
projected['control_url'] = control
|
|
1598
|
+
return projected
|
|
1582
1599
|
|
|
1583
1600
|
|
|
1584
1601
|
def throttle_snapshot(ctx, now):
|
|
@@ -1683,14 +1700,26 @@ def typed_routes(ctx):
|
|
|
1683
1700
|
return routes
|
|
1684
1701
|
|
|
1685
1702
|
|
|
1686
|
-
def pulse_rearm_argv(container):
|
|
1703
|
+
def pulse_rearm_argv(container, control=None):
|
|
1687
1704
|
"""The one spawn of the fleet feature: the pulse loop started detached in its own tmux server in the container,
|
|
1688
1705
|
as the container user (CONTAINER_UID, like every other exec Lanes makes into a container: the loop must write
|
|
1689
1706
|
/home/coder/.lz/state, and a later re-arm must find its tmux server) with HOME=CONTAINER_HOME whatever the image
|
|
1690
1707
|
sets (the pulse's `~/.lz/state` and `~/.lz/throttle-token` defaults expand against it) — byte for byte the argv
|
|
1691
|
-
`lanes install-container` starts it with (bin/lanes `pulse_argv`)
|
|
1708
|
+
`lanes install-container` starts it with (bin/lanes `pulse_argv`), `--control <url>` appended for a declared
|
|
1709
|
+
site.conf LANES_THROTTLE_CONTROL (pulse_control, BEY-6845; L.pulse_control_args). argv only, no shell."""
|
|
1692
1710
|
return ['docker', 'exec', '-d', '-u', str(L.CONTAINER_UID), '-e', f'HOME={L.CONTAINER_HOME}', container, 'tmux',
|
|
1693
|
-
'-L', 'lanes-pulse', 'new', '-d', '-s', 'pulse', f'{L.CONTAINER_HOME}/.lz/bin/{PULSE_PROGRAM}', '--loop'
|
|
1711
|
+
'-L', 'lanes-pulse', 'new', '-d', '-s', 'pulse', f'{L.CONTAINER_HOME}/.lz/bin/{PULSE_PROGRAM}', '--loop',
|
|
1712
|
+
*L.pulse_control_args(control)]
|
|
1713
|
+
|
|
1714
|
+
|
|
1715
|
+
def pulse_control():
|
|
1716
|
+
"""The control URL the re-armed pulse polls -> (url, None); (None, None) when site.conf declares none; (None, why)
|
|
1717
|
+
when its LANES_THROTTLE_CONTROL line is refused. Read as bin/lanes start_pulse reads it (lanes_lib.pulse_control:
|
|
1718
|
+
site_problems on the RAW last line naming the key, then site_conf), NOT through site_settings: the site grammar
|
|
1719
|
+
drops a line with a `?` or a space, so that reading would see no key at all and start the pulse on its loopback
|
|
1720
|
+
default while `lanes sync` and `lanes install-container` refuse the very same line (DEF-1940). The re-arm then
|
|
1721
|
+
starts nothing and says so, rather than a pulse on a guessed URL."""
|
|
1722
|
+
return L.pulse_control()
|
|
1694
1723
|
|
|
1695
1724
|
|
|
1696
1725
|
def pulse_installed(pid):
|
|
@@ -1734,7 +1763,12 @@ def rearm_pulse(ctx, level, now=None):
|
|
|
1734
1763
|
note('throttle pulse', f'{name}: quiet, and ~/.lz/bin/{PULSE_PROGRAM} is not installed there '
|
|
1735
1764
|
f'(lanes install-container {name}): not started')
|
|
1736
1765
|
return False
|
|
1737
|
-
|
|
1766
|
+
control, problem = pulse_control()
|
|
1767
|
+
if problem:
|
|
1768
|
+
note('throttle pulse', f'{name}: quiet, and site.conf {L.THROTTLE_CONTROL_KEY} is refused ({problem}): not '
|
|
1769
|
+
'started (fix the line, then lanes sync)')
|
|
1770
|
+
return False
|
|
1771
|
+
argv = pulse_rearm_argv(name, control)
|
|
1738
1772
|
rc, _out, err = L.run_bounded(argv, PULSE_REARM_TIMEOUT)
|
|
1739
1773
|
age = 'not seen' if mtime is None else f'{int(now - mtime)} s old'
|
|
1740
1774
|
if rc is None:
|
|
@@ -1767,9 +1801,17 @@ def peerd_policy(settings):
|
|
|
1767
1801
|
|
|
1768
1802
|
def peerd_rearm_argv(container, lanes='agents'):
|
|
1769
1803
|
"""The loop started detached in its own tmux server in the container, as the container user with
|
|
1770
|
-
HOME=CONTAINER_HOME (pulse_rearm_argv's form; tmux -L lanes-peers, session peerd). argv only, no shell
|
|
1804
|
+
HOME=CONTAINER_HOME (pulse_rearm_argv's form; tmux -L lanes-peers, session peerd). argv only, no shell: one tmux
|
|
1805
|
+
command sequence (BEY-8660) that opens a placeholder session `peerd-next`, ends every other session of the
|
|
1806
|
+
lanes-peers server, names the placeholder `peerd` and respawns its pane with the loop. A rearm runs only when
|
|
1807
|
+
peers.json is stale, so no session there holds a working loop. The home's ~/.tmux.conf keeps panes alive
|
|
1808
|
+
(remain-on-exit and a pane-died hook that respawns `bash -l`): a stopped loop left its `peerd` session holding a bash,
|
|
1809
|
+
and the earlier `new -s peerd` was refused from then on. A server this starts loads no configuration
|
|
1810
|
+
(`-f /dev/null`), so there the session ends with its loop."""
|
|
1771
1811
|
return ['docker', 'exec', '-d', '-u', str(L.CONTAINER_UID), '-e', f'HOME={L.CONTAINER_HOME}', container, 'tmux',
|
|
1772
|
-
'-L', 'lanes-peers', 'new', '-d', '-s', 'peerd',
|
|
1812
|
+
'-L', 'lanes-peers', '-f', '/dev/null', 'new', '-d', '-s', 'peerd-next', ';',
|
|
1813
|
+
'kill-session', '-a', '-t', '=peerd-next', ';', 'rename-session', '-t', '=peerd-next', 'peerd', ';',
|
|
1814
|
+
'respawn-pane', '-k', '-t', '=peerd:', f'{L.CONTAINER_HOME}/.lz/bin/{PEERD_PROGRAM}', '--loop',
|
|
1773
1815
|
'--lanes', lanes]
|
|
1774
1816
|
|
|
1775
1817
|
|
|
@@ -1883,36 +1925,26 @@ def names_auto(ctx, level, now=None):
|
|
|
1883
1925
|
return done
|
|
1884
1926
|
|
|
1885
1927
|
|
|
1886
|
-
# ------------------------------------------ messages: the inbox count and the
|
|
1928
|
+
# ------------------------------------------ messages: the inbox count and the ttl purge (W15 L4, BEY-6842; BEY-7538)
|
|
1887
1929
|
# Each container's `~/.lz/state/inbox/<lane>/` (DM-LANES-MESSAGE, -RECEIPT, -LOG; lane_core's store) holds the messages
|
|
1888
1930
|
# sent to its lanes. Every cycle, through /proc/<init>/root (walked without following a link, like the pulse file and
|
|
1889
1931
|
# the status projection): one open and one bounded scandir of the inbox per container, one stat per lane directory,
|
|
1890
1932
|
# and the lane's files read only when that directory changed (a rename-only store: every write moves the directory's
|
|
1891
1933
|
# mtime; a directory changed within INBOX_RACY_S of the last read is read again — the timestamp granularity). A lane
|
|
1892
|
-
# row carries `inbox: {pending}` while messages wait (absent otherwise, like `docs`).
|
|
1893
|
-
#
|
|
1894
|
-
#
|
|
1895
|
-
#
|
|
1896
|
-
# a shell prompt, as a comment line), and empties the text of at most INBOX_PURGE_PER_PASS messages whose ttl passed.
|
|
1934
|
+
# row carries `inbox: {pending}` while messages wait (absent otherwise, like `docs`). A waiting message stays in the
|
|
1935
|
+
# inbox until the lane's agent reads and acknowledges it: since BEY-7538 (2026-11-08: a message never types into a
|
|
1936
|
+
# terminal) nothing here types one, `lanes message` included. Between two cycles, never inside one and only on an `ok`
|
|
1937
|
+
# host, `purge_inbox` empties the text of at most INBOX_PURGE_PER_PASS messages whose ttl passed (receipt `expired`).
|
|
1897
1938
|
# W15 part 2 (the PR #544 review): every message that is not settled is read, however much acknowledged history the
|
|
1898
|
-
# inbox holds (lane_core.inbox_entries); a message is
|
|
1899
|
-
#
|
|
1900
|
-
# the container takes too), after a recheck there (still waiting, the oldest of its lane, the lane's hook sidecar not
|
|
1901
|
-
# busy, a Claude lane's own word read again), its receipt settled before the lock is let go; a held message
|
|
1902
|
-
# (receipt `unknown`) is never typed; a cleanup that stopped between its two writes is finished (`cleared`).
|
|
1939
|
+
# inbox holds (lane_core.inbox_entries); a held message (receipt `unknown`) is never touched but by its ttl; a cleanup
|
|
1940
|
+
# that stopped between its two writes is finished (`cleared`).
|
|
1903
1941
|
# Its journal lines name the lane, the message id and the outcome, never a text.
|
|
1904
1942
|
INBOX_PATH = tuple(L.CONTAINER_HOME.strip('/').split('/')) + ('.lz', 'state', 'inbox')
|
|
1905
1943
|
INBOX_PREFIX = tuple(L.CONTAINER_HOME.strip('/').split('/')) + ('.lz',)
|
|
1906
1944
|
INBOX_LANES_MAX = 1024 # lane directories of one container's inbox looked at per cycle
|
|
1907
1945
|
INBOX_RACY_S = 2 # a directory changed this recently is read again (mtime granularity)
|
|
1908
|
-
INBOX_PER_PASS = 2 # messages one deliver_inbox pass types at most
|
|
1909
|
-
INBOX_RETRY_S = 60 # one message is tried at most this often
|
|
1910
1946
|
INBOX_PURGE_PER_PASS = 16 # expired texts one pass removes at most
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
def inbox_pause(seconds):
|
|
1914
|
-
"""time.sleep between a typed message and its Enter, named so a test records it instead of waiting."""
|
|
1915
|
-
time.sleep(seconds)
|
|
1947
|
+
NEVER_TYPES = 'messages never type into a terminal' # BEY-7538: what `lanes message` says of a queued message
|
|
1916
1948
|
|
|
1917
1949
|
|
|
1918
1950
|
def inbox_scan(ctx, now=None):
|
|
@@ -1989,7 +2021,7 @@ def with_inbox(lanes, waiting):
|
|
|
1989
2021
|
|
|
1990
2022
|
def lane_places(registry, payload):
|
|
1991
2023
|
"""{lane id: {'container', 'tmux', 'ws', 'holder'}} of every registry lane and every unregistered session the last
|
|
1992
|
-
payload lists — where a message to it is
|
|
2024
|
+
payload lists — where a message to it is written (its container's inbox; `lanes message`)."""
|
|
1993
2025
|
places = {}
|
|
1994
2026
|
for workspace in (registry or {}).get('workspaces') or []:
|
|
1995
2027
|
for lane in workspace.get('lanes') or []:
|
|
@@ -2034,75 +2066,6 @@ def resolve_lane(registry, payload, text):
|
|
|
2034
2066
|
raise L.LanesError(f'no lane, address or workspace {text!r} (lanes address list shows every address)')
|
|
2035
2067
|
|
|
2036
2068
|
|
|
2037
|
-
def claude_word_now(place, info, sessions=None):
|
|
2038
|
-
"""Claude's own word (`idle`, `busy`, `waiting`, …) in the one live Claude session file naming a pane of the lane's
|
|
2039
|
-
session, read now through /proc/<init>/root (lanes_lib.rename_claude's rule) — None when no file or several do.
|
|
2040
|
-
`sessions` ({init pid: (claude, work)}) keeps one read of a container's session files for a whole pass."""
|
|
2041
|
-
sessions = {} if sessions is None else sessions
|
|
2042
|
-
if info['pid'] not in sessions:
|
|
2043
|
-
root = Path(L.proc_root()) / str(info['pid']) / 'root'
|
|
2044
|
-
work = {}
|
|
2045
|
-
claude = AS.claude_sessions(root / L.CONTAINER_HOME.lstrip('/') / Path(*L.CLAUDE_SESSIONS), root / 'proc',
|
|
2046
|
-
work=work)
|
|
2047
|
-
sessions[info['pid']] = (claude, work)
|
|
2048
|
-
claude, work = sessions[info['pid']]
|
|
2049
|
-
session = (place.get('tmux') or {}).get('session') or ''
|
|
2050
|
-
keys = [key for key in claude if key.startswith(session + ':')]
|
|
2051
|
-
return work.get(keys[0], (None, None))[1] if len(keys) == 1 else None
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
def ready_for_text(place, row, info, unattached=True, sessions=None):
|
|
2055
|
-
"""(ready, why not) for typing a message into the lane NOW (`deliver_inbox`; `lanes message`, which a person asked
|
|
2056
|
-
for, without `unattached`). Only a tmux lane in a running container whose row was observed this cycle — not
|
|
2057
|
-
stale, its pane there and quiet (no output within ACTIVE_WINDOW: a person may be typing), with `unattached` no
|
|
2058
|
-
terminal attached — and: no agent (or a shell) whose pane's foreground command is a shell (lane_core.TYPED_SHELLS:
|
|
2059
|
-
at its prompt); else an agent whose word is one of lanes_lib.NAMES_IDLE and not delegating, and for Claude its own
|
|
2060
|
-
session file's word `idle` (never `waiting`: a dialog a typed line would answer)."""
|
|
2061
|
-
C = L.lane_core()
|
|
2062
|
-
tmux = place.get('tmux') if isinstance(place.get('tmux'), dict) else {}
|
|
2063
|
-
if place.get('holder') != 'tmux' or not tmux.get('socket') or not tmux.get('session'):
|
|
2064
|
-
return False, 'not a tmux lane'
|
|
2065
|
-
if not info.get('pid') or not info.get('running'):
|
|
2066
|
-
return False, 'its container is not running'
|
|
2067
|
-
if not isinstance(row, dict) or row.get('stale') or row.get('state') != 'quiet':
|
|
2068
|
-
return False, f"its pane is {(row or {}).get('state') or 'not observed'}" + (' (stale)' if (row or {}).get('stale') else '')
|
|
2069
|
-
if unattached and (row.get('attached') or 0) > 0:
|
|
2070
|
-
return False, 'a terminal is attached (a person may be typing)'
|
|
2071
|
-
agent = row.get('agent') if isinstance(row.get('agent'), dict) else {}
|
|
2072
|
-
if not agent.get('status') or agent.get('status') == 'shell' or str(agent.get('harness') or '') in C.NO_AGENT:
|
|
2073
|
-
command = row.get('command')
|
|
2074
|
-
return (True, None) if command in C.TYPED_SHELLS else (False, f'its pane runs {command or "nothing known"}')
|
|
2075
|
-
if agent.get('activity') == 'delegating':
|
|
2076
|
-
return False, 'delegating to background work'
|
|
2077
|
-
if agent.get('status') not in L.NAMES_IDLE:
|
|
2078
|
-
return False, f"its agent is {agent.get('status')}"
|
|
2079
|
-
if agent.get('harness') == 'claude':
|
|
2080
|
-
word = claude_word_now(place, info, sessions)
|
|
2081
|
-
if word != 'idle':
|
|
2082
|
-
return False, f'Claude says {word!r} (not idle at its prompt)'
|
|
2083
|
-
return True, None
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
def type_message(place, row, info, record):
|
|
2087
|
-
"""Type one message's envelope (lane_core.envelope; behind lane_core.SHELL_COMMENT into a pane without an agent)
|
|
2088
|
-
into the lane's active pane, the Enter as a second client lane_core.ENTER_DELAY s later (DEF-1803) -> (outcome,
|
|
2089
|
-
detail): 'typed', 'typed-no-enter' or 'failed'."""
|
|
2090
|
-
C = L.lane_core()
|
|
2091
|
-
agent = row.get('agent') if isinstance(row.get('agent'), dict) else {}
|
|
2092
|
-
body = C.envelope(record.get('from'), record.get('from_handle'), record['text'], C.epoch(record.get('at')) or time.time())
|
|
2093
|
-
if not agent.get('status') or agent.get('status') == 'shell' or str(agent.get('harness') or '') in C.NO_AGENT:
|
|
2094
|
-
body = C.SHELL_COMMENT + body
|
|
2095
|
-
socket, target = place['tmux']['socket'], C.target(place['tmux']['session'])
|
|
2096
|
-
outcome, text = L.tmux_probe(info, socket, ['send-keys', '-t', target, '-l', '--', C.tmux_text(body)])
|
|
2097
|
-
if outcome != 'ok':
|
|
2098
|
-
return 'failed', f'tmux did not take it ({outcome}{": " + text if text else ""}): not typed'
|
|
2099
|
-
inbox_pause(C.ENTER_DELAY)
|
|
2100
|
-
outcome, text = L.tmux_probe(info, socket, ['send-keys', '-t', target, 'Enter'])
|
|
2101
|
-
if outcome != 'ok':
|
|
2102
|
-
return 'typed-no-enter', f'typed without its Enter (tmux {outcome})'
|
|
2103
|
-
return 'typed', 'typed'
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
2069
|
def settle_message(root, prefix, lane_id, message_id, state, now, drop_text=False, outcome=None):
|
|
2107
2070
|
"""Write a message's receipt `state` (lane_core.receipt_record) or, with `drop_text`, its record without the text
|
|
2108
2071
|
FIRST and then its receipt stamped `cleared` (lane_core.cleared_receipt: a waiting one `expired`; written only
|
|
@@ -2131,47 +2094,13 @@ def settle_message(root, prefix, lane_id, message_id, state, now, drop_text=Fals
|
|
|
2131
2094
|
return record
|
|
2132
2095
|
|
|
2133
2096
|
|
|
2134
|
-
def deliver_one(place, row, info, lane_id, message_id, now, unattached=True, sessions=None):
|
|
2135
|
-
"""Type one waiting message into its lane when ready_for_text says so, then settle its receipt `typed` -> (outcome,
|
|
2136
|
-
detail): 'deferred' (not now: nothing typed — not ready, another writer holds the lane's dispatch lock, an older
|
|
2137
|
-
message of the lane goes first, its hook sidecar says busy), 'gone' (acked, expired, held or settled meanwhile:
|
|
2138
|
-
read again at send time), 'typed', 'typed-no-enter' or 'failed' (tmux did not take it: still waiting). W15 part 2:
|
|
2139
|
-
the read, the recheck, the text, its Enter and the settled receipt all happen under the lane's dispatch lock
|
|
2140
|
-
(lane_core.dispatch_lock through /proc/<init>/root), the one every writer in the container takes."""
|
|
2141
|
-
C = L.lane_core()
|
|
2142
|
-
ready, why = ready_for_text(place, row, info, unattached, sessions)
|
|
2143
|
-
if not ready:
|
|
2144
|
-
return 'deferred', why
|
|
2145
|
-
root = Path(L.proc_root()) / str(info['pid']) / 'root'
|
|
2146
|
-
try:
|
|
2147
|
-
with C.dispatch_lock(root, lane_id, prefix=INBOX_PREFIX):
|
|
2148
|
-
waiting = sorted((e for e in C.inbox_entries(root, lane_id, prefix=INBOX_PREFIX, history=0)
|
|
2149
|
-
if C.pending(e, now)), key=lambda e: ((e['record'] or {}).get('at') or '', e['id']))
|
|
2150
|
-
entry = next((e for e in waiting if e['id'] == message_id), None)
|
|
2151
|
-
if entry is None:
|
|
2152
|
-
return 'gone', 'no longer waiting'
|
|
2153
|
-
if waiting[0]['id'] != message_id:
|
|
2154
|
-
return 'deferred', f"an older message of the lane goes first ({waiting[0]['id']})"
|
|
2155
|
-
hook = sidecar_for(info, lane_id) or {} # the agent's own word now, not the cycle's
|
|
2156
|
-
if hook.get('status') in C.BUSY_WORDS:
|
|
2157
|
-
return 'deferred', f"its lane-signal hook says {hook['status']}"
|
|
2158
|
-
ready, why = ready_for_text(place, row, info, unattached, {}) # a Claude lane's own word, read again
|
|
2159
|
-
if not ready:
|
|
2160
|
-
return 'deferred', why
|
|
2161
|
-
outcome, detail = type_message(place, row, info, entry['record'])
|
|
2162
|
-
if outcome != 'failed':
|
|
2163
|
-
settle_message(root, INBOX_PREFIX, lane_id, message_id, 'typed', now)
|
|
2164
|
-
return outcome, detail
|
|
2165
|
-
except C.DispatchBusy as error:
|
|
2166
|
-
return 'deferred', str(error)
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
2097
|
def host_message(place, row, info, lane_id, to, sender, text, ttl_s, now=None):
|
|
2170
2098
|
"""`lanes message` (W15 L4): a person's message (`sender` = `host:<login>`) to a lane of any container -> (message
|
|
2171
|
-
id,
|
|
2172
|
-
lane's inbox through the container's home volume (`info['home']`/.lz, walked without following a link; no
|
|
2173
|
-
`~/.lz` there is no lane contract: refused), one log line;
|
|
2174
|
-
|
|
2099
|
+
id, 'queued', NEVER_TYPES). The record (DM-LANES-MESSAGE, its text, 0600) and its `queued` receipt are written into
|
|
2100
|
+
the lane's inbox through the container's home volume (`info['home']`/.lz, walked without following a link; no
|
|
2101
|
+
`~/.lz` there is no lane contract: refused), one log line; there it waits until the lane's agent reads it. Nothing
|
|
2102
|
+
is typed into the lane, whatever its state (BEY-7538: a message never types into a terminal; `row` is not read).
|
|
2103
|
+
LanesError on a refusal — a lane whose inbox this host cannot write keeps H1's words, `not typed: …`."""
|
|
2175
2104
|
now = time.time() if now is None else now
|
|
2176
2105
|
C = L.lane_core()
|
|
2177
2106
|
C.check_message(text)
|
|
@@ -2204,51 +2133,21 @@ def host_message(place, row, info, lane_id, to, sender, text, ttl_s, now=None):
|
|
|
2204
2133
|
finally:
|
|
2205
2134
|
os.close(fd)
|
|
2206
2135
|
C.append_log(base, C.log_line(now, sender, to, message_id, len(text.encode('utf-8')), 'queued'), prefix=prefix)
|
|
2207
|
-
|
|
2208
|
-
return message_id, outcome, detail
|
|
2136
|
+
return message_id, 'queued', NEVER_TYPES
|
|
2209
2137
|
|
|
2210
2138
|
|
|
2211
|
-
def
|
|
2212
|
-
"""main()'s
|
|
2213
|
-
message id, outcome)] of what it did. Only on an `ok` host with a payload:
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2139
|
+
def purge_inbox(ctx, level, now=None):
|
|
2140
|
+
"""main()'s inbox upkeep (W15 L4; BEY-7538 took its typed delivery away), between two cycles and never inside one
|
|
2141
|
+
-> [(lane id, message id, outcome)] of what it did. Only on an `ok` host with a payload: at most
|
|
2142
|
+
INBOX_PURGE_PER_PASS messages whose ttl passed lose their text (receipt `expired` for one still waiting), and a
|
|
2143
|
+
cleanup that stopped between its two writes is finished (`cleared`). A waiting message is never typed: it stays in
|
|
2144
|
+
the inbox until the lane's agent reads it. The journal gets the lane, the id and the outcome only."""
|
|
2217
2145
|
now = time.time() if now is None else now
|
|
2218
2146
|
registry, payload = ctx.get('registry'), ctx.get('payload')
|
|
2219
2147
|
if level != 'ok' or not registry or not isinstance(payload, dict):
|
|
2220
2148
|
return []
|
|
2221
2149
|
C = L.lane_core()
|
|
2222
|
-
|
|
2223
|
-
for message_id in [m for m, at in tried.items() if now - at >= INBOX_RETRY_S]:
|
|
2224
|
-
del tried[message_id]
|
|
2225
|
-
places, rows = lane_places(registry, payload), payload.get('lanes') or {}
|
|
2226
|
-
containers, sessions = ctx.get('containers') or {}, {}
|
|
2227
|
-
routes = typed_routes(ctx) # H1: a guest delivers into its own lanes; no transport is journalled there
|
|
2228
|
-
waiting = sorted((rows_[0][0] or '', lane_id, rows_) for lane_id, rows_ in (ctx.get('inbox_waiting') or {}).items())
|
|
2229
|
-
done, typed = [], 0
|
|
2230
|
-
for _oldest, lane_id, messages in waiting:
|
|
2231
|
-
if typed >= INBOX_PER_PASS:
|
|
2232
|
-
break
|
|
2233
|
-
message_id = next((m for _at, m, _c in messages if m not in tried), None)
|
|
2234
|
-
place = places.get(lane_id)
|
|
2235
|
-
if message_id is None or place is None or place.get('container') != messages[0][2] \
|
|
2236
|
-
or routes.get(messages[0][2], (L.TRANSPORT_LOCAL,))[0] != L.TRANSPORT_LOCAL:
|
|
2237
|
-
continue
|
|
2238
|
-
info = containers.get(messages[0][2]) or {}
|
|
2239
|
-
try:
|
|
2240
|
-
outcome, _detail = deliver_one(place, rows.get(lane_id), info, lane_id, message_id, now, sessions=sessions)
|
|
2241
|
-
except Exception as error:
|
|
2242
|
-
log(f'inbox {lane_id}', error)
|
|
2243
|
-
tried[message_id] = now
|
|
2244
|
-
continue
|
|
2245
|
-
if outcome == 'deferred': # not idle now: no attempt, nothing typed
|
|
2246
|
-
continue
|
|
2247
|
-
tried[message_id] = now
|
|
2248
|
-
typed += 1
|
|
2249
|
-
done.append((lane_id, message_id, outcome))
|
|
2250
|
-
note('inbox', f'{lane_id} {message_id}: {outcome}')
|
|
2251
|
-
purged = 0
|
|
2150
|
+
containers, done, purged = ctx.get('containers') or {}, [], 0
|
|
2252
2151
|
for (container, lane_id), cached in sorted((ctx.get('inbox') or {}).items()):
|
|
2253
2152
|
info = containers.get(container) or {}
|
|
2254
2153
|
for entry in cached['entries']:
|
|
@@ -2336,9 +2235,13 @@ def cycle(ctx, reconcile=True):
|
|
|
2336
2235
|
try:
|
|
2337
2236
|
# Derived files omit global heartbeat and unrelated boards' process metadata.
|
|
2338
2237
|
# One publisher, independent of the number of devices viewing a board.
|
|
2339
|
-
|
|
2238
|
+
# Each write carries its publish stamp as the file's mtime, so a sidebar's one stat per tick sees every
|
|
2239
|
+
# publish (BEY-7606). The stamps live in the projections' process memo under `@stamps` (outside the board
|
|
2240
|
+
# ids, like `@directory`): a restart starts them from the files on disk.
|
|
2241
|
+
from sidebar_status import PUBLISHED, projections
|
|
2242
|
+
stamps = PUBLISHED.setdefault('@stamps', {})
|
|
2340
2243
|
for board, text in projections(ctx.get('registry'), payload):
|
|
2341
|
-
L.
|
|
2244
|
+
L.atomic_write_stamped(L.STATE / 'sidebar-status' / (board + '.json'), text, stamps)
|
|
2342
2245
|
except Exception as error:
|
|
2343
2246
|
log('sidebar status', error)
|
|
2344
2247
|
# Rewrite only on change (plus a heartbeat) so sidebars do not repaint for nothing. `health` changes every
|
|
@@ -2406,6 +2309,48 @@ def registry_source_paths(registry, containers):
|
|
|
2406
2309
|
return out
|
|
2407
2310
|
|
|
2408
2311
|
|
|
2312
|
+
def dangling_sessions(ctx, registry, containers):
|
|
2313
|
+
"""BEY-7435: {(container, socket, session): {'name', 'source', 'board', 'lane_id'}} for every tmux session a
|
|
2314
|
+
terminals.json of the registry still binds in `lanes.terminals` although no `terminals[]` row declares it (its row
|
|
2315
|
+
was lost; `lanes sync` builds no lane of it). Read through lanes_lib.registry_bindings without the boards'
|
|
2316
|
+
manifests, each file re-read only when it changed (`ctx['dangling_cache']`)."""
|
|
2317
|
+
cache = ctx.setdefault('dangling_cache', {})
|
|
2318
|
+
out = {}
|
|
2319
|
+
for fact in L.registry_bindings(registry, containers, manifests=False, cache=cache):
|
|
2320
|
+
for item in fact['dangling']:
|
|
2321
|
+
tmux = item['tmux']
|
|
2322
|
+
if tmux.get('socket') and tmux.get('session'):
|
|
2323
|
+
out.setdefault((fact['container'], tmux['socket'], tmux['session']),
|
|
2324
|
+
{'name': item['name'], 'source': fact['source'], 'board': fact['board'],
|
|
2325
|
+
'lane_id': item['lane_id']})
|
|
2326
|
+
return out
|
|
2327
|
+
|
|
2328
|
+
|
|
2329
|
+
def with_dangling(unregistered, dangling):
|
|
2330
|
+
"""status.json's unregistered rows with `dangling_binding` on each session `dangling` names (dangling_sessions):
|
|
2331
|
+
{name: the declared name its binding keeps, source: the container's terminals.json, board, lane_id: the id the
|
|
2332
|
+
binding records or None, repair: `lanes register <the row's id>`} — the session is a declared lane that lost its
|
|
2333
|
+
board row, not merely an unregistered one, and the repair verb puts the row back. Additive, present only on such
|
|
2334
|
+
a row (the `note`/`shared` precedent); a row whose binding has its row again loses it. Rows are copied, never
|
|
2335
|
+
changed in place (DEF-1538: they may be the published payload's)."""
|
|
2336
|
+
out = {}
|
|
2337
|
+
for board, rows in unregistered.items():
|
|
2338
|
+
listed = []
|
|
2339
|
+
for row in rows:
|
|
2340
|
+
tmux = row.get('tmux') if isinstance(row, dict) and isinstance(row.get('tmux'), dict) else {}
|
|
2341
|
+
found = dangling.get((row.get('container'), tmux.get('socket'), tmux.get('session'))) \
|
|
2342
|
+
if isinstance(row, dict) else None
|
|
2343
|
+
if found is None and not (isinstance(row, dict) and 'dangling_binding' in row):
|
|
2344
|
+
listed.append(row)
|
|
2345
|
+
continue
|
|
2346
|
+
row = {key: value for key, value in row.items() if key != 'dangling_binding'}
|
|
2347
|
+
if found is not None:
|
|
2348
|
+
row['dangling_binding'] = dict(found, repair=f"lanes register {row.get('id')}")
|
|
2349
|
+
listed.append(row)
|
|
2350
|
+
out[board] = listed
|
|
2351
|
+
return out
|
|
2352
|
+
|
|
2353
|
+
|
|
2409
2354
|
def hot_sync(ctx, source_mtimes):
|
|
2410
2355
|
"""One hot-reload check: start ONE `lanes sync` when a referenced terminals.json changed since the last
|
|
2411
2356
|
check (read through the host volume). Returns True when a sync was started. The new mtime is recorded
|
|
@@ -2453,8 +2398,8 @@ def main():
|
|
|
2453
2398
|
names_auto(ctx, level)
|
|
2454
2399
|
except Exception as error:
|
|
2455
2400
|
log('names', error)
|
|
2456
|
-
try: # W15 L4:
|
|
2457
|
-
|
|
2401
|
+
try: # W15 L4: expired inbox texts purged, INBOX_PURGE_PER_PASS at most, never while not `ok`; never typed
|
|
2402
|
+
purge_inbox(ctx, level)
|
|
2458
2403
|
except Exception as error:
|
|
2459
2404
|
log('inbox', error)
|
|
2460
2405
|
# Hot-reload: check if any terminals.json changed since we last synced.
|
|
@@ -2466,6 +2411,11 @@ def main():
|
|
|
2466
2411
|
time.sleep(pause(level, time.time() - started, ctx.get('cut', 0)))
|
|
2467
2412
|
|
|
2468
2413
|
|
|
2414
|
+
|
|
2415
|
+
# lanes site-hook loader (FLE-388)
|
|
2416
|
+
import site_hooks
|
|
2417
|
+
site_hooks.apply('status', globals())
|
|
2418
|
+
|
|
2469
2419
|
if __name__ == '__main__':
|
|
2470
2420
|
if len(sys.argv) > 1 and sys.argv[1] == '--once':
|
|
2471
2421
|
# The same builder as the daemon, minus the one phase that is not an observation (client size flags).
|
|
@@ -1058,9 +1058,15 @@ def _units(layout, plan):
|
|
|
1058
1058
|
services.record_xdg(layout.state, xdg)
|
|
1059
1059
|
# Every lanes unit is re-rendered here, so the opt-in economy poller's and push notifier's settings come from
|
|
1060
1060
|
# this shell exactly as `./install.sh --server` takes them (install/services.py __main__): without them the
|
|
1061
|
-
# enable step would strip an operator's LANES_THROTTLE_*/LANES_NOTIFY_CONF from those two units.
|
|
1061
|
+
# enable step would strip an operator's LANES_THROTTLE_*/LANES_NOTIFY_CONF from those two units. A refused
|
|
1062
|
+
# economy setting (site.conf LANES_THROTTLE_CONTROL a URL with a user part, BEY-6845) is said as a refusal
|
|
1063
|
+
# before anything is rendered, as services.py's own command line says it (exit 3), never a traceback.
|
|
1064
|
+
try:
|
|
1065
|
+
economy = services.economy_settings(os.environ, layout.home)
|
|
1066
|
+
except services.Refusal as error:
|
|
1067
|
+
raise Refusal('site-conf', f'refused, nothing was changed: {error}') from error
|
|
1062
1068
|
services.register(repo, layout.home, layout.share, layout.state, os.environ.get('LANES_WORKSPACES'),
|
|
1063
|
-
economy=
|
|
1069
|
+
economy=economy, notify=services.notify_settings(os.environ),
|
|
1064
1070
|
xdg=xdg, units_dir=manager_units_dir(layout))
|
|
1065
1071
|
_check_systemctl(*systemctl('daemon-reload'), 'daemon-reload')
|
|
1066
1072
|
_check_systemctl(*systemctl('enable', UNIT, ENROL_TIMER), f'enable {UNIT} {ENROL_TIMER}')
|
|
@@ -157,10 +157,14 @@ def _web_client():
|
|
|
157
157
|
xterm.js `Terminal` constructor) and in a `SetConfig` on every config-file reload, which the client assigns
|
|
158
158
|
wholesale before repainting `<body>`/`#terminal` inline, so the phone's light toggle needs a client-side
|
|
159
159
|
`term.options.theme` override applied on attach and re-applied after each `SetConfig`, plus a CSS background rule,
|
|
160
|
-
not set once (spec §6.3, Task 28; DEF-1413).
|
|
160
|
+
not set once (spec §6.3, Task 28; DEF-1413). The font is the client's xterm.js `fontFamily` (`app.js`
|
|
161
|
+
`options.fontFamily = config.font`): since E8 (BEY-8667, the lane lead's ruling of 21 November 2026) the generic
|
|
162
|
+
`ui-monospace, monospace`, never a named family: Safari draws `ui-monospace` in the system monospace (SF Mono)
|
|
163
|
+
instead of the bare `monospace`, INFERRED to be Courier on iOS, and a browser without `ui-monospace` falls back to
|
|
164
|
+
`monospace` as before. Zellij validates every colour here (an unparseable one fails
|
|
161
165
|
`setup --check`), so `test_tokens` can prove the block is read."""
|
|
162
166
|
t, p = TOKENS['dark'], PALETTE16['dark']
|
|
163
|
-
lines = ['web_client {', ' font "monospace"', ' theme {',
|
|
167
|
+
lines = ['web_client {', ' font "ui-monospace, monospace"', ' theme {',
|
|
164
168
|
f' background "{t["surface"]}"', f' foreground "{t["ink"]}"']
|
|
165
169
|
lines += [f' {n} "{p[i]}"' for i, n in enumerate(ANSI_NAMES)]
|
|
166
170
|
lines += [f' bright_{n} "{p[i + 8]}"' for i, n in enumerate(ANSI_NAMES)]
|