@vibelord/lanes 1.7.3 → 1.7.5
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/README.md +9 -0
- package/package.json +1 -1
- package/payload/lanes/VERSION +1 -1
- package/payload/lanes/bin/lanes +128 -24
- package/payload/lanes/bin/lanes-site-serve +15 -0
- package/payload/lanes/bin-rs/BINARIES.json +5 -0
- package/payload/lanes/container/lane-mcp +108 -5
- package/payload/lanes/container/lane_core.py +116 -0
- package/payload/lanes/container/throttle-pulse +159 -14
- package/payload/lanes/docs/ARCHITECTURE.md +132 -13
- package/payload/lanes/docs/DESIGN.md +10 -8
- package/payload/lanes/docs/INSTALL.md +1 -1
- package/payload/lanes/docs/RUNBOOK.md +436 -8
- package/payload/lanes/docs/USERGUIDE.md +82 -9
- package/payload/lanes/install/host-install.sh +35 -4
- package/payload/lanes/libexec/adopt.py +364 -0
- package/payload/lanes/libexec/attach.py +35 -5
- package/payload/lanes/libexec/cutover.py +656 -0
- package/payload/lanes/libexec/docsd.py +12 -8
- package/payload/lanes/libexec/doctor_lanes2.py +284 -0
- package/payload/lanes/libexec/economy_poll.py +87 -2
- package/payload/lanes/libexec/gc_unregistered.py +407 -0
- package/payload/lanes/libexec/lanes_lib.py +474 -2
- package/payload/lanes/libexec/native.sh +38 -0
- package/payload/lanes/libexec/native_bin.py +670 -0
- package/payload/lanes/libexec/session_actions.py +85 -7
- package/payload/lanes/libexec/shadow.py +1311 -0
- package/payload/lanes/libexec/sidebar.py +252 -30
- package/payload/lanes/libexec/sidebar_status.py +373 -25
- package/payload/lanes/libexec/statusd.py +67 -3
- package/payload/lanes/libexec/tokens.py +99 -131
- package/payload/lanes/libexec/tokens.sh +1 -1
- package/payload/lanes/libexec/update.py +78 -8
- package/payload/lanes/libexec/users.py +282 -0
- package/payload/lanes/site/README.md +9 -0
- package/payload/lanes/site/conformance.py +280 -0
- package/payload/lanes/site/protocol.py +368 -0
- package/payload/lanes/site/server.py +314 -0
- package/payload/lanes/systemd/lanes-gc.service +1 -1
- package/payload/lanes/systemd/lanes-gc.timer +14 -3
- package/payload/lanes/tokens/README.md +156 -0
- package/payload/lanes/tokens/generate.py +930 -0
- package/payload/lanes/tokens/generated/parity.v1.tsv +489 -0
- package/payload/lanes/tokens/generated/tokens.resolved.json +835 -0
- package/payload/lanes/tokens/tokens.v1.json +763 -0
- package/payload/lanes/tokens/tokens.v1.schema.json +143 -0
- package/payload/lanes/web/Caddyfile +11 -0
- package/payload/lanes/web/README.md +253 -4
- package/payload/lanes/web/directory.css +95 -0
- package/payload/lanes/web/directory.js +951 -0
- package/payload/lanes/web/generated/README.md +107 -0
- package/payload/lanes/web/generated/lanes2_protocol.d.mts +1162 -0
- package/payload/lanes/web/generated/lanes2_protocol.mjs +2333 -0
- package/payload/lanes/web/inbox.js +1140 -0
- package/payload/lanes/web/mobile.js +35 -45
- package/payload/lanes/web/tokens.css +137 -0
- package/payload/manifest.json +7 -4
|
@@ -3829,3 +3829,119 @@ def _unlink_at(dir_fd, name):
|
|
|
3829
3829
|
os.unlink(name, dir_fd=dir_fd)
|
|
3830
3830
|
except OSError:
|
|
3831
3831
|
pass
|
|
3832
|
+
|
|
3833
|
+
|
|
3834
|
+
# ------------------------------------------------------------------------------------------------ project tools
|
|
3835
|
+
# Lanes 2.0 Round 2, lane R2-S10 (W28-D; CW sections 5 and 6.3). The agent's half of the project, claim and
|
|
3836
|
+
# checkpoint store that lives in the host runtime (crates/lanes-runtime/src/project, built and NOT activated): the
|
|
3837
|
+
# request a project tool would send, built and validated here, and the refusal every tool answers until the host
|
|
3838
|
+
# serves it. The project tools are listed only while the container holds the projects switch (PROJECTS_FLAG, the
|
|
3839
|
+
# container's LANES_PROJECTS=on; no installer writes it yet), so the frozen wire v1 listing keeps its bytes; and
|
|
3840
|
+
# even then no transport carries the request to the host before integration gate I1, so the answer is
|
|
3841
|
+
# `projects_unavailable` with the request it would have sent — never a simulated claim. The request's bytes are
|
|
3842
|
+
# the ones lanes-runtime's `project::requests` decodes: both sides are held to the shared fixture
|
|
3843
|
+
# crates/lanes-runtime/src/project/testdata/agent-requests.json.
|
|
3844
|
+
PROJECTS_FLAG = ('flags', 'projects') # ~/.lz/flags/projects: a regular file, no link
|
|
3845
|
+
PROJECT_REQUEST = 'lanes.project-request.v1'
|
|
3846
|
+
PROJECT_ID_RE = re.compile(r'[A-Za-z0-9_][A-Za-z0-9_.:-]{0,127}') # lanes-core's project-domain id grammar
|
|
3847
|
+
WORK_CURSOR_RE = re.compile(r'[0-9]{10}:[0-9]{20}:[A-Za-z0-9_][A-Za-z0-9_.:-]{0,127}') # the ready view's cursor
|
|
3848
|
+
PROJECT_COUNTER_MAX = (1 << 53) - 1 # lanes-core COUNTER_MAX: revisions and epochs
|
|
3849
|
+
WORK_LIMIT_MAX, WORK_LIMIT_DEFAULT = 500, 100 # one page of the ready view (the store's page bounds)
|
|
3850
|
+
LEASE_MIN_S, LEASE_MAX_S, LEASE_DEFAULT_S = 60, 7 * 24 * 3600, 1800 # lanes-runtime LEASE_MAX_MS is 7 days
|
|
3851
|
+
PROJECT_TEXT_MAX = 2048 # lanes-runtime TEXT_MAX (bytes, UTF-8)
|
|
3852
|
+
# Every key a request may carry, in its one order (lanes-runtime's AgentRequest field order). Every write carries
|
|
3853
|
+
# `request`, the agent's idempotency key for that change (the operation-id grammar): a retry after a lost answer sends
|
|
3854
|
+
# the same id and gets the original result, never a conflict. A release names its claim by the epoch alone.
|
|
3855
|
+
PROJECT_KEYS = ('schema', 'op', 'lane', 'request', 'project', 'item', 'revision', 'epoch', 'lease_s', 'after',
|
|
3856
|
+
'limit', 'checkpoint', 'note', 'next_action')
|
|
3857
|
+
PROJECT_OPS = { # op -> (required arguments, optional arguments)
|
|
3858
|
+
'work_list': (('project',), ('after', 'limit')),
|
|
3859
|
+
'work_claim': (('project', 'request', 'item', 'revision'), ('lease_s',)),
|
|
3860
|
+
'work_release': (('project', 'request', 'item', 'epoch'), ()),
|
|
3861
|
+
'checkpoint': (('project', 'request', 'checkpoint'), ('note', 'next_action')),
|
|
3862
|
+
}
|
|
3863
|
+
PROJECTS_PICKUP = 'lanes-runtime project store' # who would take the request (named in the refusal)
|
|
3864
|
+
|
|
3865
|
+
|
|
3866
|
+
def projects_enabled(root):
|
|
3867
|
+
"""Whether the container holds the projects switch: ~/.lz/flags/projects as a regular file reached without a
|
|
3868
|
+
symbolic link (a link planted in the volume is never followed)."""
|
|
3869
|
+
path = Path(root).joinpath(*PROJECTS_FLAG)
|
|
3870
|
+
try:
|
|
3871
|
+
no_links(root, path)
|
|
3872
|
+
return stat.S_ISREG(os.lstat(str(path)).st_mode)
|
|
3873
|
+
except (OSError, LaneError):
|
|
3874
|
+
return False
|
|
3875
|
+
|
|
3876
|
+
|
|
3877
|
+
def _project_value(key, value):
|
|
3878
|
+
"""One argument checked against its rule -> the value the request carries, else a LaneError."""
|
|
3879
|
+
def bad(why):
|
|
3880
|
+
return _refusal(f'"{key}" {why}', 'invalid_arguments', argument=key)
|
|
3881
|
+
if key in ('project', 'item', 'checkpoint'):
|
|
3882
|
+
if not isinstance(value, str) or not PROJECT_ID_RE.fullmatch(value):
|
|
3883
|
+
raise bad('is not a project id (letters, digits, _ . : -; at most 128, not starting with . : -)')
|
|
3884
|
+
return value
|
|
3885
|
+
if key == 'request':
|
|
3886
|
+
if not isinstance(value, str) or not PROJECT_ID_RE.fullmatch(value):
|
|
3887
|
+
raise bad('is not a request id (letters, digits, _ . : -; at most 128, not starting with . : -)')
|
|
3888
|
+
return value
|
|
3889
|
+
if key == 'after':
|
|
3890
|
+
if not isinstance(value, str) or not WORK_CURSOR_RE.fullmatch(value):
|
|
3891
|
+
raise bad('is not a cursor lanes_work_list answered')
|
|
3892
|
+
return value
|
|
3893
|
+
if key in ('revision', 'epoch'):
|
|
3894
|
+
if isinstance(value, bool) or not isinstance(value, int) or not 1 <= value <= PROJECT_COUNTER_MAX:
|
|
3895
|
+
raise bad(f'must be an integer between 1 and {PROJECT_COUNTER_MAX}')
|
|
3896
|
+
return value
|
|
3897
|
+
if key == 'lease_s':
|
|
3898
|
+
if isinstance(value, bool) or not isinstance(value, int) or not LEASE_MIN_S <= value <= LEASE_MAX_S:
|
|
3899
|
+
raise bad(f'must be an integer between {LEASE_MIN_S} and {LEASE_MAX_S}')
|
|
3900
|
+
return value
|
|
3901
|
+
if key == 'limit':
|
|
3902
|
+
if isinstance(value, bool) or not isinstance(value, int) or not 1 <= value <= WORK_LIMIT_MAX:
|
|
3903
|
+
raise bad(f'must be an integer between 1 and {WORK_LIMIT_MAX}')
|
|
3904
|
+
return value
|
|
3905
|
+
if key in ('note', 'next_action'):
|
|
3906
|
+
if not isinstance(value, str) or len(value.encode('utf-8', 'surrogatepass')) > PROJECT_TEXT_MAX:
|
|
3907
|
+
raise bad(f'must be text of at most {PROJECT_TEXT_MAX} bytes')
|
|
3908
|
+
if any(unicodedata.category(ch) == 'Cc' and ch != '\n' for ch in value):
|
|
3909
|
+
raise bad('holds a control character')
|
|
3910
|
+
return value
|
|
3911
|
+
raise bad('is not an argument of a project request')
|
|
3912
|
+
|
|
3913
|
+
|
|
3914
|
+
def project_request(op, lane, arguments):
|
|
3915
|
+
"""The canonical request of project tool `op` from the agent in `lane` -> a dict in PROJECT_KEYS order:
|
|
3916
|
+
{schema, op, lane, …the op's arguments that are present}, the defaults (`limit`, `lease_s`) filled in. Refused
|
|
3917
|
+
(LaneError `invalid_arguments`) for an unknown op, a missing or unknown argument, or a value outside its rule."""
|
|
3918
|
+
if op not in PROJECT_OPS:
|
|
3919
|
+
raise _refusal(f'{op!r} is not a project request', 'invalid_arguments')
|
|
3920
|
+
if not isinstance(lane, str) or not LANE_RE.fullmatch(lane):
|
|
3921
|
+
raise _refusal(f'{lane!r} is not a lane id', 'invalid_arguments', argument='lane')
|
|
3922
|
+
required, optional = PROJECT_OPS[op]
|
|
3923
|
+
unknown = sorted(set(arguments) - set(required) - set(optional))
|
|
3924
|
+
if unknown:
|
|
3925
|
+
raise _refusal(f'"{unknown[0]}" is not an argument of {op}', 'invalid_arguments', argument=unknown[0])
|
|
3926
|
+
for key in required:
|
|
3927
|
+
if key not in arguments:
|
|
3928
|
+
raise _refusal(f'missing required argument "{key}"', 'invalid_arguments', argument=key)
|
|
3929
|
+
values = dict(arguments)
|
|
3930
|
+
if op == 'work_list':
|
|
3931
|
+
values.setdefault('limit', WORK_LIMIT_DEFAULT)
|
|
3932
|
+
if op == 'work_claim':
|
|
3933
|
+
values.setdefault('lease_s', LEASE_DEFAULT_S)
|
|
3934
|
+
request = {'schema': PROJECT_REQUEST, 'op': op, 'lane': lane}
|
|
3935
|
+
for key in PROJECT_KEYS[3:]:
|
|
3936
|
+
if key in values:
|
|
3937
|
+
request[key] = _project_value(key, values[key])
|
|
3938
|
+
return request
|
|
3939
|
+
|
|
3940
|
+
|
|
3941
|
+
def project_unavailable(request):
|
|
3942
|
+
"""The refusal every project tool answers while the host's project store is not reachable from this container
|
|
3943
|
+
(LANES_PROJECTS off on the host, or no agent transport before integration gate I1): nothing was sent and nothing
|
|
3944
|
+
changed; the answer carries the request that would have been sent."""
|
|
3945
|
+
return _refusal(f'{request["op"]}: the host\'s project store is not active, so nothing was claimed, released or '
|
|
3946
|
+
f'recorded (the request was not sent)', 'projects_unavailable', request=request,
|
|
3947
|
+
owner=PROJECTS_PICKUP)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
"""throttle-pulse --once|--loop [--control URL] [--state-dir DIR] [--token-file FILE] — the Throttle
|
|
3
|
-
read where the daemon runs (W11, spec docs/superpowers/specs/2026-10-11-lanes-fleet-dashboard-design.md
|
|
2
|
+
"""throttle-pulse --once|--loop [--control URL | --projection FILE] [--state-dir DIR] [--token-file FILE] — the Throttle
|
|
3
|
+
daemon's live facts, read where the daemon runs (W11, spec docs/superpowers/specs/2026-10-11-lanes-fleet-dashboard-design.md
|
|
4
|
+
§2.1).
|
|
4
5
|
|
|
5
6
|
The daemon binds its own container's 127.0.0.1 (DEF-1525): a host poller cannot reach it. This script is shipped by
|
|
6
7
|
`lanes install-container` into ~/.lz/bin/ of every workspace container and runs, as a loop, only in the daemon's
|
|
@@ -44,6 +45,18 @@ providers are `muse-code` and `zai` (Throttle's Provider names).
|
|
|
44
45
|
GET only, 3 s timeout, 1 MiB body cap, no redirect followed (one would carry the bearer elsewhere), no proxy from the
|
|
45
46
|
environment. Stdlib only. Exit: --once 0 when the daemon answered, 1 when not, 2 on a usage error; --loop runs until
|
|
46
47
|
SIGTERM/SIGINT.
|
|
48
|
+
|
|
49
|
+
Reader mode (lanes2 E5, TI INT-12, BEY-6845): `--projection FILE` makes the pulse a compatibility READER of the shared
|
|
50
|
+
projection adapter (`throttle-rc` `studio_host::readers::projection`, `throttle.source-projection.v1`) instead of a
|
|
51
|
+
poller: the daemon is never contacted and no token file is read (the adapter holds the explicitly selected instance's
|
|
52
|
+
credential). Every route above is answered from the adapter's own entry for it, and the document written is the SAME
|
|
53
|
+
throttle.json. A route the adapter did not read fresh in its last cycle fails here exactly as an unanswered GET does
|
|
54
|
+
(that pool keeps its previous facts), and a projection that is absent, not a v1 document, over PROJECTION_MAX, unbound
|
|
55
|
+
to its instance, written more than PROJECTION_STALE seconds ago or more than PROJECTION_SKEW seconds in the future
|
|
56
|
+
fails every route (`up: false`, `error` says why). `throttle-rc studio project --product P --control URL --scope pulse
|
|
57
|
+
--out FILE --loop` is the writer; `bound` is true only when its credential proved the product.
|
|
58
|
+
`tokened` follows the adapter: true when it read the guarded pool routes. The default stays the polling mode until the
|
|
59
|
+
W19 agent daemon runs the adapter; `lanes install-container` and statusd's re-arm start the pulse without the flag.
|
|
47
60
|
"""
|
|
48
61
|
import argparse
|
|
49
62
|
import json
|
|
@@ -79,6 +92,10 @@ POOL_KEYS = ('configured', 'usable', 'cooling', 'exhausted', 'benched', 'auth_fa
|
|
|
79
92
|
OVERFLOW_KEYS = ('spend_today_usd', 'budget_usd', 'fraction', 'alert_level_pct')
|
|
80
93
|
TOKENED_POOL_KEYS = ('worst_7d', 'worst_5h', 'soonest_reset')
|
|
81
94
|
STATE_FILE = 'throttle.json'
|
|
95
|
+
PROJECTION_SCHEMA = 'throttle.source-projection.v1' # the shared adapter's document (reader mode)
|
|
96
|
+
PROJECTION_MAX = 96 << 20 # bytes: the adapter's MAX_PROJECTION_BYTES; a bigger file is not its document
|
|
97
|
+
PROJECTION_STALE = 30 # seconds: an older projection is not read (three of this pulse's cycles)
|
|
98
|
+
PROJECTION_SKEW = 5 # seconds: a projection written further in the future is not read (a clock step)
|
|
82
99
|
METRIC_LINE = re.compile(r'^([a-zA-Z_:][a-zA-Z0-9_:]*)\{([^}]*)\}\s+(\S+)')
|
|
83
100
|
LABEL = re.compile(r'([a-zA-Z_][a-zA-Z0-9_]*)="((?:[^"\\]|\\.)*)"')
|
|
84
101
|
|
|
@@ -169,6 +186,118 @@ def get_json(control, path, token=None, opener=None, accept_status=()):
|
|
|
169
186
|
return doc
|
|
170
187
|
|
|
171
188
|
|
|
189
|
+
class HttpSource:
|
|
190
|
+
"""The daemon's control port itself: the pulse's own polling (the default mode)."""
|
|
191
|
+
|
|
192
|
+
def __init__(self, control, opener, token_file):
|
|
193
|
+
self.control, self.opener, self.token_file = control, opener, token_file
|
|
194
|
+
|
|
195
|
+
def json(self, path, token=None, accept_status=()):
|
|
196
|
+
return get_json(self.control, path, token, self.opener, accept_status)
|
|
197
|
+
|
|
198
|
+
def text(self, path):
|
|
199
|
+
return get(self.control, path, opener=self.opener).decode('utf-8', 'replace')
|
|
200
|
+
|
|
201
|
+
def token(self):
|
|
202
|
+
return read_token(self.token_file)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
# ------------------------------------------------------------------ reader mode (lanes2 E5, INT-12)
|
|
206
|
+
|
|
207
|
+
def read_projection(path, now):
|
|
208
|
+
"""(the shared adapter's projection, None) or (None, why): a regular file (a link is not followed) of at most
|
|
209
|
+
PROJECTION_MAX bytes holding a throttle.source-projection.v1 document whose instance is bound and whose
|
|
210
|
+
`written_ms` is at most PROJECTION_STALE seconds before `now` (epoch s) and at most PROJECTION_SKEW after it: a
|
|
211
|
+
file stamped in the future (a clock step back, a skewed writer) would otherwise pass as fresh until the clock
|
|
212
|
+
caught up."""
|
|
213
|
+
try:
|
|
214
|
+
fd = os.open(str(path), os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK | getattr(os, 'O_CLOEXEC', 0))
|
|
215
|
+
except FileNotFoundError:
|
|
216
|
+
return None, 'projection absent'
|
|
217
|
+
except OSError as error:
|
|
218
|
+
return None, f'projection unreadable ({error.strerror or type(error).__name__})'
|
|
219
|
+
try:
|
|
220
|
+
if not stat.S_ISREG(os.fstat(fd).st_mode):
|
|
221
|
+
return None, 'projection is not a regular file'
|
|
222
|
+
chunks, size = [], 0
|
|
223
|
+
while size <= PROJECTION_MAX:
|
|
224
|
+
chunk = os.read(fd, min(1 << 20, PROJECTION_MAX + 1 - size))
|
|
225
|
+
if not chunk:
|
|
226
|
+
break
|
|
227
|
+
chunks.append(chunk)
|
|
228
|
+
size += len(chunk)
|
|
229
|
+
except OSError as error:
|
|
230
|
+
return None, f'projection unreadable ({error.strerror or type(error).__name__})'
|
|
231
|
+
finally:
|
|
232
|
+
os.close(fd)
|
|
233
|
+
if size > PROJECTION_MAX:
|
|
234
|
+
return None, f'projection over {PROJECTION_MAX} bytes'
|
|
235
|
+
try:
|
|
236
|
+
doc = json.loads(b''.join(chunks))
|
|
237
|
+
except ValueError:
|
|
238
|
+
return None, 'projection is not JSON'
|
|
239
|
+
if not isinstance(doc, dict) or doc.get('schema') != PROJECTION_SCHEMA or doc.get('version') != 1:
|
|
240
|
+
return None, f'projection is not a {PROJECTION_SCHEMA} document'
|
|
241
|
+
instance = doc.get('instance') if isinstance(doc.get('instance'), dict) else {}
|
|
242
|
+
if instance.get('bound') is not True:
|
|
243
|
+
return None, 'projection instance not bound'
|
|
244
|
+
written = doc.get('written_ms')
|
|
245
|
+
if not isinstance(written, int) or isinstance(written, bool):
|
|
246
|
+
return None, 'projection names no written_ms'
|
|
247
|
+
age = now - written / 1000
|
|
248
|
+
if age > PROJECTION_STALE:
|
|
249
|
+
return None, f'projection stale ({int(age)} s old)'
|
|
250
|
+
if age < -PROJECTION_SKEW:
|
|
251
|
+
return None, f'projection written in the future ({int(-age)} s)'
|
|
252
|
+
return doc, None
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
class ProjectionSource:
|
|
256
|
+
"""The shared adapter's projection as the pulse's daemon: each route answered from the adapter's entry for that
|
|
257
|
+
route, never from the daemon. An entry the adapter did not read fresh in its last cycle is a failure, so the pulse
|
|
258
|
+
keeps that route's previous facts exactly as when a GET goes unanswered; its stale value is never applied."""
|
|
259
|
+
|
|
260
|
+
def __init__(self, doc, why):
|
|
261
|
+
self.why = why
|
|
262
|
+
sources = doc.get('sources') if isinstance(doc, dict) else None
|
|
263
|
+
self.routes = ({entry.get('route'): entry for entry in sources.values() if isinstance(entry, dict)}
|
|
264
|
+
if isinstance(sources, dict) else {})
|
|
265
|
+
|
|
266
|
+
def _entry(self, path):
|
|
267
|
+
if self.why:
|
|
268
|
+
raise Failed(self.why)
|
|
269
|
+
entry = self.routes.get(path)
|
|
270
|
+
if entry is None:
|
|
271
|
+
raise Failed('not in the projection')
|
|
272
|
+
if entry.get('fresh') is not True:
|
|
273
|
+
raise Failed(f"projection: {str(entry.get('error') or 'not fresh')[:160]}")
|
|
274
|
+
return entry
|
|
275
|
+
|
|
276
|
+
def json(self, path, token=None, accept_status=()):
|
|
277
|
+
entry = self._entry(path)
|
|
278
|
+
status = entry.get('http_status')
|
|
279
|
+
if status != 200 and status not in accept_status:
|
|
280
|
+
raise Failed(f'HTTP {status}')
|
|
281
|
+
doc = entry.get('document')
|
|
282
|
+
if not isinstance(doc, dict):
|
|
283
|
+
raise Failed('not a JSON object')
|
|
284
|
+
return doc
|
|
285
|
+
|
|
286
|
+
def text(self, path):
|
|
287
|
+
text = self._entry(path).get('text')
|
|
288
|
+
if not isinstance(text, str):
|
|
289
|
+
raise Failed('not text')
|
|
290
|
+
return text
|
|
291
|
+
|
|
292
|
+
def token(self):
|
|
293
|
+
"""The adapter holds the credential: the projection is tokened when it carries the guarded pool routes. An
|
|
294
|
+
unreadable projection is the daemon not answering, never an opt-out: like a down daemon with the token file
|
|
295
|
+
present, the previous burn, money and `tokened` are kept."""
|
|
296
|
+
if not self.why and not any(f'/pools/{pool}/status' in self.routes for pool in POOLS):
|
|
297
|
+
return None, None
|
|
298
|
+
return 'projection', None
|
|
299
|
+
|
|
300
|
+
|
|
172
301
|
# ------------------------------------------------------------------ parsing
|
|
173
302
|
|
|
174
303
|
def _count(value):
|
|
@@ -321,18 +450,26 @@ def _without_at(document):
|
|
|
321
450
|
class Pulse:
|
|
322
451
|
"""One pulse: its last document (seeded from the file, so a restart keeps the pools) and its last journal line."""
|
|
323
452
|
|
|
324
|
-
def __init__(self, control, state_dir, token_file, opener=None, clock=time.time, journal=None):
|
|
453
|
+
def __init__(self, control, state_dir, token_file, opener=None, clock=time.time, journal=None, projection=None):
|
|
325
454
|
self.control, self.path, self.token_file = control.rstrip('/'), Path(state_dir) / STATE_FILE, token_file
|
|
326
455
|
self.opener, self.clock = opener, clock
|
|
456
|
+
self.projection = projection # reader mode: the shared adapter's projection file, never the daemon
|
|
327
457
|
self.journal = journal or (lambda line: print(f'throttle-pulse: {line}', file=sys.stderr, flush=True))
|
|
328
458
|
previous = read_previous(self.path)
|
|
329
459
|
self.document = previous if previous else empty_document()
|
|
330
460
|
self.said = None
|
|
331
461
|
|
|
462
|
+
def source(self, now):
|
|
463
|
+
"""Where this cycle's routes are answered: the shared adapter's projection in reader mode, else the daemon."""
|
|
464
|
+
if self.projection is not None:
|
|
465
|
+
return ProjectionSource(*read_projection(self.projection, now))
|
|
466
|
+
return HttpSource(self.control, self.opener, self.token_file)
|
|
467
|
+
|
|
332
468
|
def observe(self):
|
|
333
469
|
"""GET every source once -> (document without `at`, [problems]). A pool whose source did not answer keeps its
|
|
334
470
|
previous facts (the file's age tells a reader how old they are)."""
|
|
335
471
|
now = int(self.clock())
|
|
472
|
+
source = self.source(now)
|
|
336
473
|
old_pools, old_overflow = self.document.get('pools') or {}, self.document.get('overflow') or {}
|
|
337
474
|
pools = {pool: dict(empty_pool(), **{k: v for k, v in (old_pools.get(pool) or {}).items() if k in POOL_KEYS})
|
|
338
475
|
for pool in POOLS}
|
|
@@ -342,13 +479,13 @@ class Pulse:
|
|
|
342
479
|
for pool in POOLS:
|
|
343
480
|
path = f'/pools/{pool}/ready'
|
|
344
481
|
try:
|
|
345
|
-
pools[pool].update(from_ready(
|
|
482
|
+
pools[pool].update(from_ready(source.json(path, accept_status=(503,))))
|
|
346
483
|
answered = True
|
|
347
484
|
except Failed as error:
|
|
348
485
|
first_failure = first_failure or str(error)
|
|
349
486
|
problems.append(f'{path}: {error}')
|
|
350
487
|
try:
|
|
351
|
-
series = parse_metrics(
|
|
488
|
+
series = parse_metrics(source.text('/metrics'))
|
|
352
489
|
answered = True
|
|
353
490
|
for pool in POOLS:
|
|
354
491
|
for key in SERIES.values():
|
|
@@ -358,7 +495,7 @@ class Pulse:
|
|
|
358
495
|
except Failed as error:
|
|
359
496
|
first_failure = first_failure or str(error)
|
|
360
497
|
problems.append(f'/metrics: {error}')
|
|
361
|
-
token, why =
|
|
498
|
+
token, why = source.token()
|
|
362
499
|
if why:
|
|
363
500
|
problems.append(why)
|
|
364
501
|
tokened = False
|
|
@@ -369,7 +506,7 @@ class Pulse:
|
|
|
369
506
|
elif answered:
|
|
370
507
|
path = f'/pools/{pool}/status'
|
|
371
508
|
try:
|
|
372
|
-
facts, money = from_status(
|
|
509
|
+
facts, money = from_status(source.json(path, token), now)
|
|
373
510
|
except Failed as error: # the last burn and money of this pool are kept
|
|
374
511
|
problems.append(f'{path}: {error}')
|
|
375
512
|
continue
|
|
@@ -435,16 +572,24 @@ def main(argv=None, env=None):
|
|
|
435
572
|
mode.add_argument('--loop', action='store_true', help=f'a cycle every {PULSE_INTERVAL} s until SIGTERM')
|
|
436
573
|
parser.add_argument('--control', help='control base URL (default http://127.0.0.1:$LANES_THROTTLE_CONTROL_PORT, '
|
|
437
574
|
f'else :{DEFAULT_PORT})')
|
|
575
|
+
parser.add_argument('--projection', help='reader mode: read the shared projection adapter\'s file instead of the '
|
|
576
|
+
'daemon (no --control, no token file)')
|
|
438
577
|
parser.add_argument('--state-dir', default='~/.lz/state')
|
|
439
578
|
parser.add_argument('--token-file', default='~/.lz/throttle-token')
|
|
440
579
|
args = parser.parse_args(argv)
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
580
|
+
if args.projection is not None:
|
|
581
|
+
if args.control:
|
|
582
|
+
parser.error('--projection reads the shared adapter instead of the daemon: it takes no --control')
|
|
583
|
+
pulse = Pulse('', os.path.expanduser(args.state_dir), os.path.expanduser(args.token_file),
|
|
584
|
+
projection=os.path.expanduser(args.projection))
|
|
585
|
+
else:
|
|
586
|
+
try:
|
|
587
|
+
control = args.control or default_control(env)
|
|
588
|
+
except ValueError as error:
|
|
589
|
+
parser.error(str(error))
|
|
590
|
+
if not re.match(r'^https?://[^/?#\s]+$', control.rstrip('/')):
|
|
591
|
+
parser.error(f'--control must be an http(s) base URL, not {control!r}')
|
|
592
|
+
pulse = Pulse(control, os.path.expanduser(args.state_dir), os.path.expanduser(args.token_file))
|
|
448
593
|
if args.once:
|
|
449
594
|
pulse.cycle()
|
|
450
595
|
print(json.dumps(pulse.document, indent=1))
|
|
@@ -33,11 +33,33 @@ for operations, the [runbook](RUNBOOK.md).
|
|
|
33
33
|
4. The status daemon observes tmux sessions and publishes status/health snapshots. Failed or timed-out
|
|
34
34
|
probes mean unknown; they do not prove a missing session. A bad terminal registry retains the last good board.
|
|
35
35
|
|
|
36
|
-
Sidebars
|
|
37
|
-
`statusd.cycle
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
Sidebars read one shared directory projection, `sidebar-status/@directory.json` (Lanes 2.0 C7,
|
|
37
|
+
DM-LANES2-C7-DIRECTORY-TWIN), which `statusd.cycle` publishes through `sidebar_status.projections`: the
|
|
38
|
+
Day-0 `LaneDirectoryProjection` v1 (every board's lanes and live sessions once, by authority-qualified
|
|
39
|
+
identity, in the sidebar's default section order with the identity as tie-breaker; one page of at most 500
|
|
40
|
+
rows, `incomplete` above that, no continuation page yet) plus the compatibility body a sidebar renders from
|
|
41
|
+
(board-owned rows restricted to the fields a sidebar draws, other rows' attention and fleet-admin facts, every
|
|
42
|
+
board's unregistered/zmx listings, the fleet facts). A sidebar derives its board's view with
|
|
43
|
+
`sidebar_status.board_view`, so it paints what the board file paints. It is rewritten only when its content
|
|
44
|
+
changes: never for `fleet.at`/`throttle.at` alone and never for process metadata; its revision only grows,
|
|
45
|
+
also across a statusd restart, which starts from the file on disk. A rewrite carries the sample times current
|
|
46
|
+
at that moment, so a sidebar compares its view without them: another board's news costs one read, the newer
|
|
47
|
+
fleet facts are kept, and nothing is repainted. Freshness comes from the health file: on this source the
|
|
48
|
+
fleet block's own-clock floor starts at the health line's `status_at` (when statusd last published a
|
|
49
|
+
payload), never its `at`, and the clock repaints what time alone changes (the lane ages by the painted
|
|
50
|
+
surface's rule, the block's `429 +N` window and its `reset` countdowns), compared at most every 10 s and
|
|
51
|
+
repainted only when one of them changed. Since 1.7.4 a sidebar on either projection also re-reads the fleet
|
|
52
|
+
block's two objects from the canonical `status.json` when its mtime moved, stat()ed once every 15 reloads
|
|
53
|
+
(`sidebar.CANON_REFRESH_TICKS`, about 15 s; the other ticks stat nothing for it, so the C7 tick budget holds):
|
|
54
|
+
facts a site hook adopts there after the projection was written reach a quiet
|
|
55
|
+
board whose projection never changes (the shape that hid the operator's mini dashboard on 1.7.3); `lanes
|
|
56
|
+
doctor` names projections behind `status.json`. The 1.7.2 per-board files `sidebar-status/<board>.json` (v1) stay
|
|
57
|
+
published unchanged as the compatibility stage: a sidebar starts on its board file when no directory is
|
|
58
|
+
published, and on `status.json` when neither is. The 30 s version tick looks for the directory only (one
|
|
59
|
+
stat): a board-file sidebar goes to `status.json` once reload() finds the board file gone, and a directory
|
|
60
|
+
that vanished falls back to the board file. `status.json` remains canonical. The 1 s select tick and the
|
|
61
|
+
10 s clock refresh are the Python compatibility stage's coalescing; the directory document names no refresh
|
|
62
|
+
interval.
|
|
41
63
|
|
|
42
64
|
Each workspace container that has the lane contract (`~/.lz/bin/lane`) also gets its own slice of the
|
|
43
65
|
observation as `~/.lz/status.json` (LNS-32, `statusd.write_container_status`), because nothing in a container
|
|
@@ -242,6 +264,23 @@ for operations, the [runbook](RUNBOOK.md).
|
|
|
242
264
|
/home/coder/.lz/bin/throttle-pulse --loop` (byte for byte the argv `lanes install-container` starts it with,
|
|
243
265
|
DEF-1940), journalled with its outcome — and nothing when `~/.lz/bin/throttle-pulse` is not installed there.
|
|
244
266
|
|
|
267
|
+
*Reader mode* (lanes2 E5, TI INT-12, BEY-6845; opt-in, nothing starts it yet). `throttle-pulse --projection FILE`
|
|
268
|
+
and the economy poller's `LANES_THROTTLE_PROJECTION=<file>` are compatibility READERS of the shared projection
|
|
269
|
+
adapter (`throttle-rc` `studio_host::readers::projection`, DM-LANES2-SOURCE-PROJECTION): one persistent adapter,
|
|
270
|
+
bound to an explicitly selected Throttle instance (product, control origin, credential reference — never a port
|
|
271
|
+
guess or a derived classic token), reads each route once per cycle and writes `throttle.source-projection.v1`;
|
|
272
|
+
the readers turn it into the unchanged `throttle.json` and `economy.json` without contacting the daemon or holding a
|
|
273
|
+
bearer. The writer is `throttle-rc studio project --product throttle --control http://127.0.0.1:<port> --scope
|
|
274
|
+
pulse,economy --out FILE --loop`; like the pulse it runs where the daemon runs (loopback only). A projection is
|
|
275
|
+
`bound` only when the credential proved the product — the selected product's own managed local token; a
|
|
276
|
+
`--token-file` bearer (such as the `~/.lz/throttle-token` copy `lanes throttle adopt-token` makes) proves only the
|
|
277
|
+
install, so that projection stays unbound and both readers fail every route, and the classic bearer is refused
|
|
278
|
+
outright for an RC selection. Each route keeps its own freshness (a route the adapter did not read fresh fails like
|
|
279
|
+
an unanswered GET and its stale value is never applied), a projection more than 30 s old, more than 5 s in the
|
|
280
|
+
future, or unbound fails every route, and capacity rows are never summed. The polling modes above stay the defaults
|
|
281
|
+
(and statusd's re-arm argv and `lanes install-container` are unchanged): which unit starts the runner, where its
|
|
282
|
+
binary comes from in the daemon's container, and the AR O-11 profile of the live pulse are open (BEY-6845).
|
|
283
|
+
|
|
245
284
|
*`fleet`.* Every `FLEET_INTERVAL` (10 s) the cycle asks `lanes_lib.compute_health(sample=True)`, which reads —
|
|
246
285
|
from plain files, no subprocess, and nothing at all on a `critical` host — the aggregate `cpu` line of
|
|
247
286
|
`/proc/stat`, `MemTotal`/`MemAvailable` from the `/proc/meminfo` it reads anyway, the inotify watch CEILING
|
|
@@ -461,15 +500,17 @@ Regression coverage is in `test_connection.py`, `test_lanes_latency.py` and the
|
|
|
461
500
|
a lane sidebar, and one to three viewports. The mobile layout uses separate picker and full-width view tabs.
|
|
462
501
|
Its hidden viewports do not attach at placeholder dimensions; they wait until a real client displays them.
|
|
463
502
|
|
|
464
|
-
**Visual system:** one token
|
|
465
|
-
|
|
466
|
-
palette
|
|
503
|
+
**Visual system:** one token source (`tokens/tokens.v1.json`) is resolved by `tokens/generate.py` into the table
|
|
504
|
+
`libexec/tokens.py` reads, and rendered into the sidebar's escapes, the Zellij themes, the phone CSS (and its xterm.js
|
|
505
|
+
palette in `mobile.js`), the viewer's shell (`libexec/tokens.sh`), the optional Ghostty palette files, the docs table
|
|
506
|
+
and the Lanes 2.0 browser (`web/tokens.css`), Rust and Swift projections; `generate.py --write` regenerates them and
|
|
507
|
+
`generate.py --check` / `tokens.py --check` fail on drift in any of them. `docs/DESIGN.md` is the legend:
|
|
467
508
|
glyphs with their ASCII twins, modes (`LANES_COLOR`, `LANES_THEME`, `LANES_GLYPHS`, `LANES_DIM`, `LANES_NOTIFY`), row
|
|
468
509
|
anatomy, mockups and budgets; `tests/unit/test_docs.py` keeps the README legend complete against the glyph tables.
|
|
469
510
|
|
|
470
|
-
Frames and bars take their colours from the `lanes-dark`/`lanes-light` themes
|
|
471
|
-
compact bar is the only plugin; the mobile picker's sidebar pane has no layout name so its own
|
|
472
|
-
counts) reaches the phone. `zellij/config.kdl` adds, after the generated token block, one `ui` block whose
|
|
511
|
+
Frames and bars take their colours from the `lanes-dark`/`lanes-light` themes `libexec/tokens.py` renders from the
|
|
512
|
+
generated table; the compact bar is the only plugin; the mobile picker's sidebar pane has no layout name so its own
|
|
513
|
+
title (attention counts) reaches the phone. `zellij/config.kdl` adds, after the generated token block, one `ui` block whose
|
|
473
514
|
`pane_frames` set `rounded_corners false` and `hide_session_name true` (straight frames to match the sidebar's `─`
|
|
474
515
|
rules, no session name in the bar) and `simplified_ui true` (no Private-Use-Area chevrons, so no Nerd Font is needed);
|
|
475
516
|
`load_plugins` stays empty. The desktop sidebar keeps `pane size=36 borderless=true name="Lanes"` (Throttle Studio's view rule reads
|
|
@@ -521,7 +562,17 @@ file in operator backups; deleting derived state does not delete registrations.
|
|
|
521
562
|
|
|
522
563
|
Explicit **New +** starts a detached tmux shell inside the workspace container on its dedicated
|
|
523
564
|
`lanes-shells-<workspace>` socket. Reopening only attaches. Explicit **×** closes an unregistered session after
|
|
524
|
-
rechecking its session ID and creation time and refusing registered lanes; affected viewers become empty.
|
|
565
|
+
rechecking its session ID and creation time and refusing registered lanes; affected viewers become empty. The opt-in
|
|
566
|
+
daily sweep (`lanes gc --unregistered`, `libexec/gc_unregistered.py`) ends sessions through this same close in its
|
|
567
|
+
guarded idle mode (`close_idle_session`, BEY-7156), only on positive evidence that nothing runs:
|
|
568
|
+
agent status `shell`, or no agent and a bare shell (`agent_state.SHELL_COMMANDS`), or a dead pane — quiet for
|
|
569
|
+
`LANES_GC_IDLE_S`, no client or view, observed, local route — each judged again from a fresh `status.json` and a live
|
|
570
|
+
probe of every pane (`list-panes -s`: each dead, or a bare shell with no process under it) just before. Every other
|
|
571
|
+
agent status (errored, done, needs_input, needs_approval, working, idle, unknown) keeps the session. The unattended
|
|
572
|
+
close refuses while a `view-…` member shows the session, kills no view, and folds `#{==:#{session_attached},0}` into the
|
|
573
|
+
same in-tmux condition as the creation time. The GC wrapper also rechecks cached policy and pane evidence under
|
|
574
|
+
the registry lock, and the final tmux predicate requires no session group and positive, old activity on every
|
|
575
|
+
window. New clients, groups or output after the last probe refuse the close. The explicit human close is unchanged.
|
|
525
576
|
The tmux close condition is checked inside the server, protecting a replacement created between observation
|
|
526
577
|
and the action. `user-sessions/` stores display metadata (and `handback/` the board and id of a session unregistered
|
|
527
578
|
while it ran); `status.json` and `resolve.dynamic/` are projections.
|
|
@@ -811,6 +862,14 @@ No tool exists for these. An agent that needs one asks a person; a refusal's `hu
|
|
|
811
862
|
|
|
812
863
|
- **Ending or closing a lane**, its session or its jobs (`x` in the sidebar for an unregistered session,
|
|
813
864
|
`lane kill <id> --yes` in the container). `lanes_unregister` removes a declaration and leaves the session running.
|
|
865
|
+
Ending stays a person's call; the one standing instruction is the operator's, opt-in per site: with site.conf
|
|
866
|
+
`LANES_GC_UNREGISTERED=1` the host's daily `lanes gc` (midnight) ends unregistered sessions (including a lane a
|
|
867
|
+
person unregistered while it ran) only on positive evidence that nothing runs in them — agent status `shell`, or no
|
|
868
|
+
agent and a bare shell, confirmed just before the close by a probe of every pane (each dead, or a bare shell with no
|
|
869
|
+
process under it); quiet with no output for `LANES_GC_IDLE_S` (default 6 h), no client or viewer, observed and
|
|
870
|
+
reached through a local route — through the sidebar's own close in its unattended mode (no view, and the kill
|
|
871
|
+
refused inside tmux while a client is attached), and keeps every other one, every harness prompt included (RUNBOOK
|
|
872
|
+
"Daily cleanup of unregistered terminals"). A registered lane is never one, and no agent tool starts it.
|
|
814
873
|
- **Interrupting** an agent. `lanes_send` types printable text only (no Ctrl-C, Esc, newline or tab) and refuses a
|
|
815
874
|
lane whose agent is working (`agent_working`) unless forced.
|
|
816
875
|
- **Answering an approval** prompt. `lanes_send` refuses a lane whose agent waits for an approval
|
|
@@ -921,6 +980,14 @@ The refusal codes (`refused`), each with the `human` sentence `lane-mcp`'s `HUMA
|
|
|
921
980
|
through the installed server check a container without an agent: the
|
|
922
981
|
[protocol smoke](RUNBOOK.md#protocol-smoke).
|
|
923
982
|
|
|
983
|
+
Behind a flag, additive (Lanes 2.0 Round 2, R2-S10): while the container holds the projects switch
|
|
984
|
+
`~/.lz/flags/projects` the listing appends four project tools after the thirteen, pinned by
|
|
985
|
+
[`tests/unit/golden/lane-mcp-tools.projects.json`](../tests/unit/golden/lane-mcp-tools.projects.json) (see
|
|
986
|
+
"Project tools" below); without it the listing and the golden above keep their bytes and calling a project tool is
|
|
987
|
+
-32602. A project tool answers one JSON object; its refusals are `invalid_arguments`, `not_in_lane` and
|
|
988
|
+
`projects_unavailable` (the host's project store is not reachable: nothing was claimed, released or recorded, and the
|
|
989
|
+
answer carries the `request` it would have sent and its `owner`).
|
|
990
|
+
|
|
924
991
|
### Gateway adoption (documented, not registered)
|
|
925
992
|
|
|
926
993
|
Throttle's tool gateway ([its architecture](../../docs/architecture/throttle-tool-gateway.md)) launches reviewed MCP
|
|
@@ -991,6 +1058,31 @@ environment), a reviewed in-container launch, a harvest at a pinned commit (`sou
|
|
|
991
1058
|
surface the golden pins) and a Throttle catalog change with its own gates (DM-TOOL-CATALOG). Until then the catalog
|
|
992
1059
|
holds no `lanes` package and no `lanes_*` tool; `test_docs.AgentApi` checks both.
|
|
993
1060
|
|
|
1061
|
+
### Project tools (behind the projects switch)
|
|
1062
|
+
|
|
1063
|
+
**[BUILT, INERT]** (Lanes 2.0 Round 2, lane R2-S10; ultracode plan W28-D). The agent's half of the project, claim and
|
|
1064
|
+
checkpoint store the host runtime keeps (`crates/lanes-runtime/src/project`, not activated). Listed only while
|
|
1065
|
+
`~/.lz/flags/projects` exists as a regular file (no installer writes it yet); each tool resolves the agent's own lane
|
|
1066
|
+
(`not_in_lane` outside one), builds the `lanes.project-request.v1` request (`lane_core.project_request`, the same bytes
|
|
1067
|
+
`lanes-runtime`'s `project::requests` decodes: the shared fixture
|
|
1068
|
+
`crates/lanes-runtime/src/project/testdata/agent-requests.json`) and, until a transport carries it to the host
|
|
1069
|
+
(integration gate I1), answers `projects_unavailable` with that request. No request names a responsibility: the host
|
|
1070
|
+
derives it from the authenticated lane. Every write carries `request`, the agent's idempotency key for that change
|
|
1071
|
+
(the operation-id grammar, at most 128 bytes): a retry after a lost answer sends the same id and gets the original
|
|
1072
|
+
result (a claim's token, marked replayed), never a conflict; the host scopes the id to the lane. A release names its
|
|
1073
|
+
claim by the epoch alone (the live epoch is the fence; no tool answers an item revision after a claim). Pages follow
|
|
1074
|
+
the store's bounds (100 by default, at most 500).
|
|
1075
|
+
|
|
1076
|
+
| Tool | Effect | Request (`op`) | Host operation once served |
|
|
1077
|
+
| --- | --- | --- | --- |
|
|
1078
|
+
| `lanes_work_list` | read | `work_list`: `project`, `after` (a cursor), `limit` 1–500 (default 100) | `ProjectService::ready_work`: eligible items in ready order, ineligible counts by reason |
|
|
1079
|
+
| `lanes_work_claim` | write | `work_claim`: `request`, `project`, `item`, `revision` (the one read), `lease_s` 60–604800 (default 1800) | `ProjectService::claim`: one winner, the next claim epoch; the same `request` again answers its token |
|
|
1080
|
+
| `lanes_work_release` | write | `work_release`: `request`, `project`, `item`, `epoch` | `ProjectService::release` at the stored revision: a stale epoch releases nothing |
|
|
1081
|
+
| `lanes_checkpoint` | write | `checkpoint`: `request`, `project`, `checkpoint`, `note`, `next_action` (2,048 bytes each) | `ProjectService::record_checkpoint`: claims, mandate and the unresolved obligations (in-flight effects, undelivered role mail) from the host's own records |
|
|
1082
|
+
|
|
1083
|
+
`test_lane_mcp_project` holds the listing (frozen without the switch, exactly these four appended with it), the
|
|
1084
|
+
refusals and the requests to the fixture; `lanes-runtime`'s `project::tests::requests` decodes the same fixture.
|
|
1085
|
+
|
|
994
1086
|
## Desktop and uploads
|
|
995
1087
|
|
|
996
1088
|
The client installer creates an SSH alias and dedicated terminal configuration, using the selected profile's
|
|
@@ -1143,7 +1235,7 @@ routes go to services of their own, each bound to the tailnet login Serve inject
|
|
|
1143
1235
|
| anything else | Zellij web 127.0.0.1:8082 | site-wide |
|
|
1144
1236
|
|
|
1145
1237
|
A view session is served at `/<device>`, so `bin/lanes` `device_name` refuses the service roots as device names
|
|
1146
|
-
(`enrol`, `lanes-docs`, `lanes-assets`, casefolded). Caddy sorts the routes before it runs them: a single-path `handle`
|
|
1238
|
+
(`enrol`, `lanes-docs`, `lanes-assets`, `lanes-hooks`, casefolded). Caddy sorts the routes before it runs them: a single-path `handle`
|
|
1147
1239
|
goes ahead of another only when that one has a single path too (DEF-1872), so the vendor route stays with the
|
|
1148
1240
|
single-path routes above the named-matcher ones; its order is proven on a model of that sort
|
|
1149
1241
|
(`test_docs_assets.VendorRoute`), not on a running Caddy (DEF-1871, open until the RUNBOOK's operator check).
|
|
@@ -1478,6 +1570,33 @@ the sidebar and `lanes doctor` read `status.json` only.
|
|
|
1478
1570
|
| `LANES_FLEET_DASHBOARD_URL` | the server's `~/.config/lanes/site.conf` | the operator only, once an authenticated Grafana exists; https only (`bin/lanes` `fleet_dashboard_url`); no code path writes it; `lanes doctor` shows it, unset, or why it is ignored |
|
|
1479
1571
|
| `lanes doctor`'s `throttle pulse:`, `throttle pools:` (1.5.0), `fleet:`, `fleet dashboard:` lines, and its harness mix `lanes: claude N · codex N · …` (1.5.0) | — | `bin/lanes` `fleet_doctor` and `harness_line`, from `status.json`, the registry's Throttle tab and site.conf (it never asks the daemon, starts the pulse or runs docker); a `⚠` at worst — a pulse that is absent, down or more than 90 s old by `at` (statusd's bound, DEF-1941), a configured pool with no usable account, a `fleet` that is stale or absent, a dashboard URL that is refused — never a `✗` |
|
|
1480
1572
|
|
|
1573
|
+
## Federation seam (lanes-site/1)
|
|
1574
|
+
|
|
1575
|
+
Plan row H1 (Lanes2 architecture §3.32, §7.5; DM-LANES-SITE-ADAPTER; operator steps in the RUNBOOK's
|
|
1576
|
+
[federation section](RUNBOOK.md#federation-lanes-site1-guests-behind-a-forced-command-key)). A container is reached
|
|
1577
|
+
through one transport, named per board in `catalog.json`: `local` (its init runs on this docker host; reads and
|
|
1578
|
+
typing go through `/proc/<init>/root` and `docker exec`) or `guest:<ssh alias>` (it runs on a guest that serves
|
|
1579
|
+
`lanes-site/1`).
|
|
1580
|
+
|
|
1581
|
+
| Part | File | Role |
|
|
1582
|
+
| --- | --- | --- |
|
|
1583
|
+
| Protocol | `site/protocol.py` | Framing (one compact JSON object per line, at most 1 MiB), the six v1 ops (plan row H1's interim ops; transport, framing, hello and versioning are AR §3.32's), the typed error codes and the reserved owner-fence codes, the normative check order (shape, verb and text bounds, then the recipient), the tmux read allowlist, the text bound, the read reply's byte budget, the two exec template ids, the optional `intent`/`epoch` of the mutating ops, the secret-key detector. Stdlib only; shared by the parts below. |
|
|
1584
|
+
| Forced command | `bin/lanes-site-serve` | AR §3.32's keyed path (`command="<home>/.local/share/lanes/current/bin/lanes-site-serve",restrict`). POSIX sh: the Python server, or — with `$LANES_STATE/flags/rs-site` — one `adapter_unavailable` frame until `lanesd site-serve` exists (W20). |
|
|
1585
|
+
| Reference server | `site/server.py` | One process per ssh connection. Answers from the guest's own `registry.json` and `containers.json`, read per request; holds no store and no lock between requests. Its one write types into a registered lane's active pane under the recipient's dispatch lock; `exec` builds a fixed argv from the template id and a registered container name, and only when the guest's own statusd checks find the re-arm due (never on a critical guest). |
|
|
1586
|
+
| Host client | `libexec/lanes_lib.py` transport section | `catalog_transports` (per board: a bad board costs that board only), `board_refusal` (build_registry: an invalid board, and `aggregator_absent` for a guest board before W20), `refresh_containers` (a guest's containers stamped, never inspected), `SiteClient` (one `ssh -T` per guest and process, hello first, deadlines, an intent id per mutating request, never a resend), `guest_probe` (tmux_probe's guest arm), `write_route`, `lane_write`, `names_refusal`, `transport_report` (doctor). The hooked functions (`build_registry`, `tmux_probe`, `tmux_query`, `tmux_socket`, `host_path`, `containers_info`, `container_info`, `refresh_containers`) keep their signatures, and every typed path calls `tmux_probe` by its module attribute, so the rd-control runtime hook keeps working until the aggregator replaces it. |
|
|
1587
|
+
| Conformance kit | `site/conformance.py` | The protocol suite against any adapter's stdio; later also against `lanesd site-serve`. Every refused request names an unregistered target. |
|
|
1588
|
+
|
|
1589
|
+
Typed paths ask `write_route(container, info, socket)` first: `local`, `guest:<alias>`, `tmux_probe` (no init here and
|
|
1590
|
+
no guest transport, but `tmux_probe` — a runtime hook — answered on the lane's socket), or no route —
|
|
1591
|
+
`container <name> is not running` for a stopped local container, `no write transport for <name> (…)` once
|
|
1592
|
+
`tmux_probe` answered `noserver` (or the catalog gives the container no valid transport). The second is never an
|
|
1593
|
+
exit 0: the CLI verbs exit 1, statusd journals it once per change, `lanes doctor` prints a `✗`. Before the aggregator
|
|
1594
|
+
duty (W20) a guest board builds no lanes here (`aggregator_absent`, previous lanes kept stale), statusd never reads a
|
|
1595
|
+
guest-stamped container as down, and a guest's lanes are delivered into, renamed and re-armed by that guest's own
|
|
1596
|
+
statusd. The trust boundary is the guest's: a request names a lane, a socket or a container, which the server checks
|
|
1597
|
+
against its own registry — after the request's shape, verb and text bounds — before any key or spawn, and no argv,
|
|
1598
|
+
path or environment crosses the wire.
|
|
1599
|
+
|
|
1481
1600
|
## Access
|
|
1482
1601
|
|
|
1483
1602
|
Clients log in to one Unix account over SSH (tailnet, or the `lanes-public` fallback). Who may do so is the
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
The operator-facing legend for the Lanes cockpit: what every glyph, colour and switch means, how a sidebar row is
|
|
4
4
|
laid out, and the budgets each surface is held to. The token and glyph tables below are generated from
|
|
5
|
-
`
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
`tokens/tokens.v1.json` (`python3 tokens/generate.py --write`; `--check` fails on drift, and in an installed tree
|
|
6
|
+
compares the files inside `lanes/` only, as `python3 libexec/tokens.py --check` does), the one source the sidebar's
|
|
7
|
+
escapes (through `libexec/tokens.py`, which reads the generated table), the Zellij themes, the phone CSS, the viewer's
|
|
8
|
+
shell (`libexec/tokens.sh`), the optional Ghostty palette, this page and the Lanes 2.0 Rust, browser and Swift
|
|
9
|
+
projections ([`tokens/README.md`](../tokens/README.md)) are derived from. The design of record is
|
|
8
10
|
[`docs/superpowers/specs/2026-10-03-lanes-cockpit-design.md`](../../docs/superpowers/specs/2026-10-03-lanes-cockpit-design.md)
|
|
9
11
|
at the repository root; this page condenses it for daily use and never overrides it.
|
|
10
12
|
|
|
@@ -14,11 +16,11 @@ at the repository root; this page condenses it for daily use and never overrides
|
|
|
14
16
|
29–34 how long and doing what.
|
|
15
17
|
2. **Never colour alone:** every state has a glyph, a tone and an ASCII twin, and a fixed column; `LANES_COLOR=none`
|
|
16
18
|
leaves a fully readable sidebar.
|
|
17
|
-
3. **One token set, many renderers:** `
|
|
18
|
-
other surface is a generated projection pinned by a drift test, and no
|
|
19
|
-
block (`test_tokens.GeneratedSurfaces`, cockpit v3 P5). The phone
|
|
20
|
-
are hand-written copies of the `surface` tokens, held to them by
|
|
21
|
-
([`web/README.md`](../web/README.md)).
|
|
19
|
+
3. **One token set, many renderers:** `tokens/tokens.v1.json` is the only place a colour or glyph is defined; every
|
|
20
|
+
other surface — `libexec/tokens.py`'s tables included — is a generated projection pinned by a drift test, and no
|
|
21
|
+
colour sits outside a surface's generated block (`test_tokens.GeneratedSurfaces`, cockpit v3 P5). The phone
|
|
22
|
+
shell's `theme-color` metas and manifest colours are hand-written copies of the `surface` tokens, held to them by
|
|
23
|
+
the same test; the app icon is a brand asset ([`web/README.md`](../web/README.md)).
|
|
22
24
|
4. **Theme-agnostic by construction:** every painted role is a foreground but one. `selected`, the cursor row, is a
|
|
23
25
|
foreground-and-background role: the `accent-wash` value under the row's own foregrounds, in truecolor and 256
|
|
24
26
|
colours only and closed before column 36, so the terminal's own background shows everywhere else (cockpit v3 P2).
|