@vibelord/lanes 1.7.3 → 1.7.4
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 +97 -17
- package/payload/lanes/bin/lanes-site-serve +15 -0
- package/payload/lanes/bin-rs/BINARIES.json +5 -0
- package/payload/lanes/container/lane-mcp +105 -5
- package/payload/lanes/container/lane_core.py +110 -0
- package/payload/lanes/container/throttle-pulse +159 -14
- package/payload/lanes/docs/ARCHITECTURE.md +108 -11
- package/payload/lanes/docs/DESIGN.md +10 -8
- package/payload/lanes/docs/INSTALL.md +1 -1
- package/payload/lanes/docs/RUNBOOK.md +297 -5
- package/payload/lanes/docs/USERGUIDE.md +11 -6
- package/payload/lanes/install/host-install.sh +14 -3
- package/payload/lanes/libexec/adopt.py +325 -0
- package/payload/lanes/libexec/cutover.py +656 -0
- package/payload/lanes/libexec/docsd.py +12 -8
- package/payload/lanes/libexec/doctor_lanes2.py +213 -0
- package/payload/lanes/libexec/economy_poll.py +87 -2
- package/payload/lanes/libexec/lanes_lib.py +465 -2
- package/payload/lanes/libexec/native.sh +38 -0
- package/payload/lanes/libexec/native_bin.py +668 -0
- 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 +48 -5
- 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/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/README.md +132 -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/mobile.js +17 -21
- package/payload/lanes/web/tokens.css +137 -0
- package/payload/manifest.json +7 -4
|
@@ -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
|
|
@@ -921,6 +962,14 @@ The refusal codes (`refused`), each with the `human` sentence `lane-mcp`'s `HUMA
|
|
|
921
962
|
through the installed server check a container without an agent: the
|
|
922
963
|
[protocol smoke](RUNBOOK.md#protocol-smoke).
|
|
923
964
|
|
|
965
|
+
Behind a flag, additive (Lanes 2.0 Round 2, R2-S10): while the container holds the projects switch
|
|
966
|
+
`~/.lz/flags/projects` the listing appends four project tools after the thirteen, pinned by
|
|
967
|
+
[`tests/unit/golden/lane-mcp-tools.projects.json`](../tests/unit/golden/lane-mcp-tools.projects.json) (see
|
|
968
|
+
"Project tools" below); without it the listing and the golden above keep their bytes and calling a project tool is
|
|
969
|
+
-32602. A project tool answers one JSON object; its refusals are `invalid_arguments`, `not_in_lane` and
|
|
970
|
+
`projects_unavailable` (the host's project store is not reachable: nothing was claimed, released or recorded, and the
|
|
971
|
+
answer carries the `request` it would have sent and its `owner`).
|
|
972
|
+
|
|
924
973
|
### Gateway adoption (documented, not registered)
|
|
925
974
|
|
|
926
975
|
Throttle's tool gateway ([its architecture](../../docs/architecture/throttle-tool-gateway.md)) launches reviewed MCP
|
|
@@ -991,6 +1040,27 @@ environment), a reviewed in-container launch, a harvest at a pinned commit (`sou
|
|
|
991
1040
|
surface the golden pins) and a Throttle catalog change with its own gates (DM-TOOL-CATALOG). Until then the catalog
|
|
992
1041
|
holds no `lanes` package and no `lanes_*` tool; `test_docs.AgentApi` checks both.
|
|
993
1042
|
|
|
1043
|
+
### Project tools (behind the projects switch)
|
|
1044
|
+
|
|
1045
|
+
**[BUILT, INERT]** (Lanes 2.0 Round 2, lane R2-S10; ultracode plan W28-D). The agent's half of the project, claim and
|
|
1046
|
+
checkpoint store the host runtime keeps (`crates/lanes-runtime/src/project`, not activated). Listed only while
|
|
1047
|
+
`~/.lz/flags/projects` exists as a regular file (no installer writes it yet); each tool resolves the agent's own lane
|
|
1048
|
+
(`not_in_lane` outside one), builds the `lanes.project-request.v1` request (`lane_core.project_request`, the same bytes
|
|
1049
|
+
`lanes-runtime`'s `project::requests` decodes: the shared fixture
|
|
1050
|
+
`crates/lanes-runtime/src/project/testdata/agent-requests.json`) and, until a transport carries it to the host
|
|
1051
|
+
(integration gate I1), answers `projects_unavailable` with that request. No request names a responsibility: the host
|
|
1052
|
+
derives it from the authenticated lane.
|
|
1053
|
+
|
|
1054
|
+
| Tool | Effect | Request (`op`) | Host operation once served |
|
|
1055
|
+
| --- | --- | --- | --- |
|
|
1056
|
+
| `lanes_work_list` | read | `work_list`: `project`, `after` (a cursor), `limit` 1–100 (default 20) | `ProjectService::ready_work`: eligible items in ready order, ineligible counts by reason |
|
|
1057
|
+
| `lanes_work_claim` | write | `work_claim`: `project`, `item`, `revision` (the one read), `lease_s` 60–604800 (default 1800) | `ProjectService::claim`: one winner, the next claim epoch |
|
|
1058
|
+
| `lanes_work_release` | write | `work_release`: `project`, `item`, `revision`, `epoch` | `ProjectService::release`: a stale epoch releases nothing |
|
|
1059
|
+
| `lanes_checkpoint` | write | `checkpoint`: `project`, `checkpoint`, `note`, `next_action` (2,048 bytes each) | `ProjectService::record_checkpoint`: claims and mandate from the host's own records |
|
|
1060
|
+
|
|
1061
|
+
`test_lane_mcp_project` holds the listing (frozen without the switch, exactly these four appended with it), the
|
|
1062
|
+
refusals and the requests to the fixture; `lanes-runtime`'s `project::tests::requests` decodes the same fixture.
|
|
1063
|
+
|
|
994
1064
|
## Desktop and uploads
|
|
995
1065
|
|
|
996
1066
|
The client installer creates an SSH alias and dedicated terminal configuration, using the selected profile's
|
|
@@ -1478,6 +1548,33 @@ the sidebar and `lanes doctor` read `status.json` only.
|
|
|
1478
1548
|
| `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
1549
|
| `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
1550
|
|
|
1551
|
+
## Federation seam (lanes-site/1)
|
|
1552
|
+
|
|
1553
|
+
Plan row H1 (Lanes2 architecture §3.32, §7.5; DM-LANES-SITE-ADAPTER; operator steps in the RUNBOOK's
|
|
1554
|
+
[federation section](RUNBOOK.md#federation-lanes-site1-guests-behind-a-forced-command-key)). A container is reached
|
|
1555
|
+
through one transport, named per board in `catalog.json`: `local` (its init runs on this docker host; reads and
|
|
1556
|
+
typing go through `/proc/<init>/root` and `docker exec`) or `guest:<ssh alias>` (it runs on a guest that serves
|
|
1557
|
+
`lanes-site/1`).
|
|
1558
|
+
|
|
1559
|
+
| Part | File | Role |
|
|
1560
|
+
| --- | --- | --- |
|
|
1561
|
+
| 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. |
|
|
1562
|
+
| 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). |
|
|
1563
|
+
| 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). |
|
|
1564
|
+
| 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. |
|
|
1565
|
+
| 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. |
|
|
1566
|
+
|
|
1567
|
+
Typed paths ask `write_route(container, info, socket)` first: `local`, `guest:<alias>`, `tmux_probe` (no init here and
|
|
1568
|
+
no guest transport, but `tmux_probe` — a runtime hook — answered on the lane's socket), or no route —
|
|
1569
|
+
`container <name> is not running` for a stopped local container, `no write transport for <name> (…)` once
|
|
1570
|
+
`tmux_probe` answered `noserver` (or the catalog gives the container no valid transport). The second is never an
|
|
1571
|
+
exit 0: the CLI verbs exit 1, statusd journals it once per change, `lanes doctor` prints a `✗`. Before the aggregator
|
|
1572
|
+
duty (W20) a guest board builds no lanes here (`aggregator_absent`, previous lanes kept stale), statusd never reads a
|
|
1573
|
+
guest-stamped container as down, and a guest's lanes are delivered into, renamed and re-armed by that guest's own
|
|
1574
|
+
statusd. The trust boundary is the guest's: a request names a lane, a socket or a container, which the server checks
|
|
1575
|
+
against its own registry — after the request's shape, verb and text bounds — before any key or spawn, and no argv,
|
|
1576
|
+
path or environment crosses the wire.
|
|
1577
|
+
|
|
1481
1578
|
## Access
|
|
1482
1579
|
|
|
1483
1580
|
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).
|
|
@@ -171,7 +171,7 @@ replaces only its own files, by rename, and never a `zmx-*` binary a running lan
|
|
|
171
171
|
| `bin/lane-mcp` | The Lanes MCP server for the agents (left out with `--no-mcp`) |
|
|
172
172
|
| `bin/zmx-*` | The pinned zmx holder (optional lanes only) |
|
|
173
173
|
| `VERSION`, `hooks/`, `env.sh` | The release that installed them, the hook definitions `lanes hooks install` merges, and the shell settings new shells source |
|
|
174
|
-
| `bin/throttle-pulse` | The Throttle pulse (1.4.0): reads the daemon's loopback control port every 10 s (GET only) and writes `state/throttle.json`, which the host's statusd reads for the sidebar's fleet block. Installed in every container, **started only in the daemon's container
|
|
174
|
+
| `bin/throttle-pulse` | The Throttle pulse (1.4.0): reads the daemon's loopback control port every 10 s (GET only) and writes `state/throttle.json`, which the host's statusd reads for the sidebar's fleet block. Installed in every container, **started only in the daemon's container**. `--projection FILE` (lanes2 E5, opt-in) reads the shared projection adapter's file instead of the daemon ([ARCHITECTURE](ARCHITECTURE.md)) |
|
|
175
175
|
|
|
176
176
|
It installs no agent hook (that is `lanes hooks install`, opt-in) and, unless `--no-mcp`, adds the agents' MCP entries
|
|
177
177
|
below. A re-run after a server update (the update does it itself for every container `lanes sync` knows) brings every
|