@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.
Files changed (57) hide show
  1. package/README.md +9 -0
  2. package/package.json +1 -1
  3. package/payload/lanes/VERSION +1 -1
  4. package/payload/lanes/bin/lanes +128 -24
  5. package/payload/lanes/bin/lanes-site-serve +15 -0
  6. package/payload/lanes/bin-rs/BINARIES.json +5 -0
  7. package/payload/lanes/container/lane-mcp +108 -5
  8. package/payload/lanes/container/lane_core.py +116 -0
  9. package/payload/lanes/container/throttle-pulse +159 -14
  10. package/payload/lanes/docs/ARCHITECTURE.md +132 -13
  11. package/payload/lanes/docs/DESIGN.md +10 -8
  12. package/payload/lanes/docs/INSTALL.md +1 -1
  13. package/payload/lanes/docs/RUNBOOK.md +436 -8
  14. package/payload/lanes/docs/USERGUIDE.md +82 -9
  15. package/payload/lanes/install/host-install.sh +35 -4
  16. package/payload/lanes/libexec/adopt.py +364 -0
  17. package/payload/lanes/libexec/attach.py +35 -5
  18. package/payload/lanes/libexec/cutover.py +656 -0
  19. package/payload/lanes/libexec/docsd.py +12 -8
  20. package/payload/lanes/libexec/doctor_lanes2.py +284 -0
  21. package/payload/lanes/libexec/economy_poll.py +87 -2
  22. package/payload/lanes/libexec/gc_unregistered.py +407 -0
  23. package/payload/lanes/libexec/lanes_lib.py +474 -2
  24. package/payload/lanes/libexec/native.sh +38 -0
  25. package/payload/lanes/libexec/native_bin.py +670 -0
  26. package/payload/lanes/libexec/session_actions.py +85 -7
  27. package/payload/lanes/libexec/shadow.py +1311 -0
  28. package/payload/lanes/libexec/sidebar.py +252 -30
  29. package/payload/lanes/libexec/sidebar_status.py +373 -25
  30. package/payload/lanes/libexec/statusd.py +67 -3
  31. package/payload/lanes/libexec/tokens.py +99 -131
  32. package/payload/lanes/libexec/tokens.sh +1 -1
  33. package/payload/lanes/libexec/update.py +78 -8
  34. package/payload/lanes/libexec/users.py +282 -0
  35. package/payload/lanes/site/README.md +9 -0
  36. package/payload/lanes/site/conformance.py +280 -0
  37. package/payload/lanes/site/protocol.py +368 -0
  38. package/payload/lanes/site/server.py +314 -0
  39. package/payload/lanes/systemd/lanes-gc.service +1 -1
  40. package/payload/lanes/systemd/lanes-gc.timer +14 -3
  41. package/payload/lanes/tokens/README.md +156 -0
  42. package/payload/lanes/tokens/generate.py +930 -0
  43. package/payload/lanes/tokens/generated/parity.v1.tsv +489 -0
  44. package/payload/lanes/tokens/generated/tokens.resolved.json +835 -0
  45. package/payload/lanes/tokens/tokens.v1.json +763 -0
  46. package/payload/lanes/tokens/tokens.v1.schema.json +143 -0
  47. package/payload/lanes/web/Caddyfile +11 -0
  48. package/payload/lanes/web/README.md +253 -4
  49. package/payload/lanes/web/directory.css +95 -0
  50. package/payload/lanes/web/directory.js +951 -0
  51. package/payload/lanes/web/generated/README.md +107 -0
  52. package/payload/lanes/web/generated/lanes2_protocol.d.mts +1162 -0
  53. package/payload/lanes/web/generated/lanes2_protocol.mjs +2333 -0
  54. package/payload/lanes/web/inbox.js +1140 -0
  55. package/payload/lanes/web/mobile.js +35 -45
  56. package/payload/lanes/web/tokens.css +137 -0
  57. package/payload/manifest.json +7 -4
package/README.md CHANGED
@@ -125,6 +125,15 @@ options of the last install (remembered in `~/.config/lanes/install-options`; a
125
125
  The package version equals `lanes/VERSION`; bump both together. `prepack` builds `payload/` from `git ls-files lanes`
126
126
  (tests excluded) and refuses uncommitted `lanes/` changes.
127
127
 
128
+ Lanes 2.0 native binaries (none yet): with `LANES_RS_ARTIFACTS=<dir>` — the fetched result of one buildctl job built
129
+ from the same commit, `<dir>/x86_64-unknown-linux-musl/lanes-<name>` plus `<dir>/THIRD-PARTY-NOTICES` — the build ships
130
+ each binary under `payload/lanes/bin-rs/` and lists `{name, target, sha256, size, commit}` in the staged
131
+ `bin-rs/BINARIES.json` and in `manifest.binaries`, all inside the payload digest. Each binary's `--version` must print
132
+ exactly one line `<name> <version> (commit <40-hex>)` naming itself and `HEAD`, with nothing after the hash; a dirty or
133
+ local build (`<HEAD>-dirty`, `<HEAD>+local`), a second commit, another commit or none is refused before anything is
134
+ written. Without the variable the list is empty and the build is today's. `--out DIR` (tests only; refused under
135
+ npm's pack and publish lifecycles) builds somewhere other than `payload/`.
136
+
128
137
  ```sh
129
138
  cd npm/lanes && npm test
130
139
  scripts/publish.sh --dry-run # then without --dry-run
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibelord/lanes",
3
- "version": "1.7.3",
3
+ "version": "1.7.5",
4
4
  "description": "Installer for Lanes: shared agent terminals over SSH with Zellij views, registry sync, uploads and a phone interface.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1 +1 @@
1
- 1.7.3
1
+ 1.7.5
@@ -275,10 +275,20 @@
275
275
  --write into a --container whose home the agent could not read from this account (uid
276
276
  not 1000, or a home volume not owned by 1000) is refused with the reason
277
277
  lanes invariant save|check snapshot / verify every live pane's pid and window size
278
- lanes gc truncate oversized zmx logs, drop stale dynamic resolve files, prune old staged trees:
278
+ lanes gc [--unregistered [--write] [--board B]]
279
+ truncate oversized zmx logs, drop stale dynamic resolve files, prune old staged trees:
279
280
  each pkg root keeps its 3 newest and every tree current, current.previous, this
280
281
  lanes, a view layout, a running daemon's run record or a process of this account
281
- uses (none pruned when /proc cannot be read); `pruned <tree>` / `kept <tree>: <why>`
282
+ uses (none pruned when /proc cannot be read); `pruned <tree>` / `kept <tree>: <why>`.
283
+ Then, only with site.conf LANES_GC_UNREGISTERED=1, the --unregistered sweep with
284
+ --write. --unregistered alone: one line per unregistered tmux session (statusd's
285
+ rows; never a registered lane), `reap: <why>` only on evidence that nothing runs —
286
+ agent status `shell`, or no agent and a bare shell, quiet for LANES_GC_IDLE_S (default
287
+ 21600 s), no client or viewer, observed, local, and a probe of every pane (each dead,
288
+ or a bare shell with no process under it) — and `keep: <why>` for every other one
289
+ (`runs vim`, `agent done`, …); --write ends each reap through the guarded idle close,
290
+ only if tmux still sees it detached, ungrouped and idle on every window
291
+ (libexec/gc_unregistered.py)
282
292
  lanes sockets [check|repair] lanes that run but cannot be reached: tmux servers whose socket file was deleted
283
293
  (someone emptied the container's /tmp); repair = tmux's SIGUSR1, nothing restarts
284
294
  lanes pressure host memory / io pressure, swap, per-container memory and /tmp use — plain files and
@@ -338,6 +348,10 @@
338
348
  lanes studio-host re-key [--yes] [--dry-run]
339
349
  after the owner revoked this machine: stop the Host, remove the machine key and its
340
350
  dead enrolment, publish a NEW public key for the next deploy. Nothing without --yes
351
+ lanes rs install --from PATH --sha256 HEX | uninstall NAME | verify [--tree] | status | apply
352
+ Lanes 2.0 native binaries and site.conf's LANES_RS_<COMPONENT> flags
353
+ (libexec/native_bin.py; every flag off): place or remove a locally built binary
354
+ (sha256-verified), check binaries against their digests, show or apply the flags
341
355
  lanes doctor full health check (every external call is bounded; includes the pressure summary), with
342
356
  the lanes per create-recipe class (idempotent / attach-only / null / external /
343
357
  retired-path), lane identity, numeric session names, crowded `default` sockets and
@@ -345,6 +359,9 @@
345
359
  the lane addresses (⚠ boards without a coordinator, ✗ two lanes on one address, ⚠ the
346
360
  fleet admin unset or naming no lane, ⚠ `addresses` keys naming no terminal, and per
347
361
  container how many Claude lanes' session names are their addresses),
362
+ the unregistered sweep (one line: site.conf's LANES_GC_UNREGISTERED and LANES_GC_IDLE_S,
363
+ the last write run of `lanes gc --unregistered`; ⚠ a floor it refuses, or a LANES_GC_
364
+ line with a comment, quote or space after its value, named),
348
365
  any record left in the retired legacy-sessions/ directory, the devices without an owner
349
366
  (each keeps its look to itself: `lanes device claim`), and the browser/phone half:
350
367
  lanes-web / lanes-mobile units (⚠ not enabled, ✗ enabled but not running), the login-token
@@ -870,9 +887,9 @@ def hold_sessions(stack, timeout, doing):
870
887
 
871
888
 
872
889
  # The web front's own path roots (web/Caddyfile): a view session is served at /<device>, so a device of one of these
873
- # names would sit on a route a service owns — the enrolment service (/enrol/*), the docs service (/lanes-docs/*) and
874
- # the shell's assets (/lanes-assets/*). Compared casefolded: Caddy's path matcher ignores case.
875
- RESERVED_DEVICES = ('enrol', 'lanes-assets', 'lanes-docs')
890
+ # names would sit on a route a service owns — the enrolment service (/enrol/*), the docs service (/lanes-docs/*), the
891
+ # shell's assets (/lanes-assets/*) and the connector webhooks (/lanes-hooks/*). Casefolded: Caddy's matcher ignores case.
892
+ RESERVED_DEVICES = ('enrol', 'lanes-assets', 'lanes-docs', 'lanes-hooks')
876
893
 
877
894
 
878
895
  def device_name(value):
@@ -2665,17 +2682,23 @@ def active_workspace(registry, device):
2665
2682
  raise L.LanesError(f"the active tab '{title}' is not a board; name one: lanes upload <workspace>")
2666
2683
 
2667
2684
 
2668
- def type_into_lane(registry, device, workspace, text):
2669
- """Type text into the lane shown in the device's first viewport (user-initiated input, like typing)."""
2685
+ def paste_into_lane(registry, device, workspace, text):
2686
+ """Type text into the lane shown in the device's first viewport (user-initiated input, like typing) through its
2687
+ container's transport (lanes_lib.lane_write, H1) -> (lane name, None, None) when typed, else (None, outcome, why):
2688
+ why starts `not typed:` (or says it is not known), outcome `no_transport` when the container has no write
2689
+ transport."""
2670
2690
  target = L.STATE / 'views' / device / f"{workspace['id']}.main.target"
2671
2691
  lane_id = (target.read_text().split('\n')[0] if target.exists() else '') or \
2672
2692
  (L.STATE / 'defaults' / workspace['id']).read_text().split('\n')[0]
2673
2693
  _ws, lane = L.find_lane(registry, lane_id)
2674
- info = (L.read_json(L.STATE / 'containers.json') or {}).get(lane['container'], {})
2675
- if lane['holder'] == 'tmux':
2676
- ok = L.tmux_query(info, lane['tmux']['socket'], ['send-keys', '-t', f"={lane['tmux']['session']}:", '-l', '--', text])
2677
- return lane['name'] if ok is not None else None
2678
- return None
2694
+ info = (L.read_json(L.STATE / 'containers.json') or {}).get(lane.get('container') or '', {})
2695
+ outcome, why = L.lane_write(lane, info, text)
2696
+ return (lane['name'], None, None) if outcome == 'typed' else (None, outcome, why)
2697
+
2698
+
2699
+ def type_into_lane(registry, device, workspace, text):
2700
+ """paste_into_lane's lane name, or None when nothing was typed."""
2701
+ return paste_into_lane(registry, device, workspace, text)[0]
2679
2702
 
2680
2703
 
2681
2704
  def paste_target(spool, request, fallback):
@@ -2751,13 +2774,16 @@ def cmd_upload(args):
2751
2774
  raise L.LanesError('nothing was uploaded (empty archive)')
2752
2775
  for path in landed:
2753
2776
  print(path)
2777
+ typed = True
2754
2778
  if '--paste' in args and paste_device:
2755
2779
  # The result files (.done / .err) stay in the base spool, where the asking sidebar looks for them.
2756
- shown = type_into_lane(registry, device_name(view_device), workspace, ' '.join(shlex.quote(p) for p in landed) + ' ')
2757
- print(f'# typed into lane: {shown}' if shown else '# could not type into the lane (not a tmux lane?)', file=sys.stderr)
2780
+ shown, outcome, why = paste_into_lane(registry, device_name(view_device), workspace,
2781
+ ' '.join(shlex.quote(p) for p in landed) + ' ')
2782
+ typed = outcome is None # paste_into_lane: (name, None, None) once typed
2783
+ print(f'# typed into lane: {shown}' if typed else f'# {why}', file=sys.stderr)
2758
2784
  if spool:
2759
2785
  L.atomic_write(spool / f'{request}.done', '\n'.join(landed) + '\n')
2760
- return 0
2786
+ return 0 if typed else 1 # the files landed either way; a paste that typed nothing is never an exit 0 (BEY-6899)
2761
2787
 
2762
2788
 
2763
2789
  DOCS_USAGE = 'usage: lanes docs push <id>'
@@ -3693,7 +3719,15 @@ def cmd_cursor_commit(args):
3693
3719
  return cursor_commit.run(args)
3694
3720
 
3695
3721
 
3696
- def cmd_gc(_args):
3722
+ def cmd_gc(args):
3723
+ """`lanes gc`: the daily housekeeping (lanes-gc.timer), then the unregistered sweep when site.conf enables it;
3724
+ `lanes gc --unregistered [--write] [--board B]`: that sweep alone (libexec/gc_unregistered.py)."""
3725
+ sweep = libexec_module('gc_unregistered')
3726
+ if args:
3727
+ given, values = flag_args(args, sweep.USAGE, flags=('--unregistered', '--write'), values=('--board',))
3728
+ if '--unregistered' not in given:
3729
+ raise L.LanesError(sweep.USAGE)
3730
+ return sweep.sweep('--write' in given, values.get('--board'))
3697
3731
  limit = 5 * 1024 * 1024
3698
3732
  for link in sorted((Path.home() / '.lz').glob('*')):
3699
3733
  for log in (link / 's' / 'logs').glob('*.log'):
@@ -3723,7 +3757,7 @@ def cmd_gc(_args):
3723
3757
  stale.unlink()
3724
3758
  print(f'removed stale {stale.name}')
3725
3759
  gc_trees()
3726
- return 0
3760
+ return sweep.daily() # silent and 0 unless site.conf LANES_GC_UNREGISTERED=1
3727
3761
 
3728
3762
 
3729
3763
  # ------------------------------------------------------------------ staged trees (plan W9 U4, LNS-92)
@@ -3955,6 +3989,10 @@ def cmd_studio_host(args):
3955
3989
  return libexec_module('studio_host').main(args) # verbs, refusals and exit codes are studio_host's
3956
3990
 
3957
3991
 
3992
+ def cmd_rs(args):
3993
+ return libexec_module('native_bin').main(args) # verbs, refusals and exit codes are native_bin's
3994
+
3995
+
3958
3996
  def cmd_keys(args):
3959
3997
  # verbs, refusals and exit codes are keys.py's; a verb that names an owner (adopt --login, owner) ends by folding
3960
3998
  # the views of the devices it named into that person's profile (cockpit v3 R2), and a dropped fold is its exit 1
@@ -5128,6 +5166,40 @@ def fleet_doctor(status, registry, home=None, now=None):
5128
5166
  dashboard_line(home)]
5129
5167
 
5130
5168
 
5169
+ def projection_doctor(status, state=None, now=None):
5170
+ """`lanes doctor`'s 1.7.4 line about the sidebar projections -> [(mark, text)] or []: the files under
5171
+ `sidebar-status/` (the 1.7.2 board files, the C7 directory) that carry no `throttle`/`fleet` or an older sample
5172
+ than status.json — the shape that hid the operator's mini dashboard on 1.7.3 (a site hook adopts a guest's pulse
5173
+ into status.json after the projection was written). Sidebars since 1.7.4 refresh the block from status.json
5174
+ themselves (sidebar.CANON_REFRESH_S), so the line is information, never a ✗. Read-only."""
5175
+ state = L.STATE if state is None else Path(state)
5176
+ status = status if isinstance(status, dict) else {}
5177
+ folder = state / 'sidebar-status'
5178
+ try:
5179
+ names = sorted(entry.name for entry in folder.iterdir() if entry.name.endswith('.json'))
5180
+ except OSError:
5181
+ return []
5182
+ behind = []
5183
+ for name in names:
5184
+ doc = L.read_json(folder / name)
5185
+ if not isinstance(doc, dict):
5186
+ continue
5187
+ for key in ('throttle', 'fleet'):
5188
+ theirs, ours = status.get(key), doc.get(key)
5189
+ if not isinstance(theirs, dict):
5190
+ continue
5191
+ if not isinstance(ours, dict) or (number(theirs.get('at')) or 0) > (number(ours.get('at')) or 0):
5192
+ behind.append(f'{name} ({key})')
5193
+ break
5194
+ if not names:
5195
+ return []
5196
+ if not behind:
5197
+ return [('', f'sidebar projections: {len(names)} carry the fleet block facts status.json has')]
5198
+ shown = ', '.join(behind[:3]) + (f' and {len(behind) - 3} more' if len(behind) > 3 else '')
5199
+ return [('⚠', f'sidebar projections behind status.json: {shown} — a site hook adopts the pulse after the '
5200
+ 'projection; sidebars read the block from status.json every ≤15 s since 1.7.4')]
5201
+
5202
+
5131
5203
  # ------------------------------------------------------------------ doctor: the harness mix (W12)
5132
5204
  # `agent.harness` is an observed fact since W12 (spec
5133
5205
  # docs/superpowers/specs/2026-10-15-lanes-harness-observers-design.md §2): statusd reads it from the pane's process
@@ -5411,13 +5483,16 @@ def release_doctor(table, home=None):
5411
5483
  """`lanes doctor`'s release lines -> [(mark, text)], mark ✓ | ✗ | ⚠ | '' (information) (W9 V3, LNS-85): `current`
5412
5484
  and its VERSION, the run records against the processes in `table` (`ps -eo pid=,comm=,args=`; None when ps did
5413
5485
  not answer), the device layouts, the units, then the updates (W9 U3: libexec/update.py doctor_line, with the unit
5414
- folders it looks for lanes-update.timer's enable link in; no line without an installed release). Read-only: files
5415
- and the one process table doctor already swept."""
5486
+ folders it looks for lanes-update.timer's enable link in; no line without an installed release), then the Lanes 2.0
5487
+ adoption (libexec/adopt.py doctor_lines: nothing before the first adoption, then one line per state domain).
5488
+ Read-only: files and the one process table doctor already swept."""
5416
5489
  report = version_report(home=home)
5417
5490
  reference = report['current'] or os.path.realpath(report['tree'])
5418
5491
  updates = libexec_module('update').doctor_line(L.STATE, home, units=unit_dirs(home))
5492
+ adopted = libexec_module('adopt').doctor_lines(L.STATE) # Lanes 2.0 adoption, one line per domain (lanes2 S12)
5419
5493
  return [current_doctor(report, home), *records_doctor(report, table, reference, home),
5420
- layouts_doctor(reference, home), units_doctor(reference, home), *([updates] if updates else [])]
5494
+ layouts_doctor(reference, home), units_doctor(reference, home), *([updates] if updates else []),
5495
+ *adopted]
5421
5496
 
5422
5497
 
5423
5498
  def cmd_doctor(_args):
@@ -5435,8 +5510,14 @@ def cmd_doctor(_args):
5435
5510
  errors = [(w['id'], e) for w in registry['workspaces'] for e in w['errors']]
5436
5511
  check(not errors, 'registry clean', '; '.join(f'{w}: {e}' for w, e in errors))
5437
5512
  hook = site_hook_old()
5438
- if hook:
5439
- print(f'⚠ {hook} (Linear BEY-6912)')
5513
+ if hook: # H1: a warning until the O-3 installed witness (W20), never by release count (RUNBOOK "Federation")
5514
+ if L.site_conf().get('LANES_SITE_HOOK') == 'refuse':
5515
+ check(False, f'{hook} (Linear BEY-6912)', 'refused: site.conf LANES_SITE_HOOK=refuse')
5516
+ else:
5517
+ print(f'⚠ {hook} (Linear BEY-6912) — becomes a refusal after the O-3 installed witness (W20); '
5518
+ 'site.conf LANES_SITE_HOOK=refuse refuses it now')
5519
+ for ok, label, detail in L.transport_report(registry, L.read_json(L.STATE / 'containers.json') or {}):
5520
+ check(ok, label, detail) # H1: no write transport, tmux_probe-only containers, the guests a board names
5440
5521
  # Stale registry check: any terminals.json newer than the last sync? A lane's `source` is the container's
5441
5522
  # spelling; doctor runs on the host, so it stats the file under the container's home volume.
5442
5523
  sys.path.insert(0, str(L.REPO / 'libexec'))
@@ -5498,6 +5579,9 @@ def cmd_doctor(_args):
5498
5579
  str(states) + (f'; {stale} shown with their last known state (tmux server did not answer)' if stale else ''))
5499
5580
  # The harness mix (W12): which agent each lane runs, as statusd observed it; information only.
5500
5581
  print(f' {harness_line(status)[1]}')
5582
+ # The unregistered sweep (`lanes gc --unregistered`): site.conf's switch and floor, the last write run.
5583
+ mark, text = libexec_module('gc_unregistered').doctor_line()
5584
+ print(f'{mark or " "} {text}')
5501
5585
  # One bounded process-table sweep serves both checks; the cgroup of the few tmux servers is a plain file read.
5502
5586
  rc, table, _err = L.run_bounded(['ps', '-eo', 'pid=,comm=,args='], 10)
5503
5587
  coexist = (L.STATE / 'flags/coexist').exists()
@@ -5561,6 +5645,8 @@ def cmd_doctor(_args):
5561
5645
  print(f'{mark or " "} {text}')
5562
5646
  else:
5563
5647
  check(mark == '✓', text)
5648
+ for mark, text in projection_doctor(status): # 1.7.4: the projections the sidebars read
5649
+ print(f'{mark or " "} {text}')
5564
5650
  # The release that runs (W9 V3): `current`, the run records against the one process-table sweep above, the
5565
5651
  # device layouts, the units.
5566
5652
  for mark, text in release_doctor(table if rc == 0 else None):
@@ -5568,6 +5654,13 @@ def cmd_doctor(_args):
5568
5654
  print(f'{mark or " "} {text}')
5569
5655
  else:
5570
5656
  check(mark == '✓', text)
5657
+ # Lanes 2.0 runtime signals (RT 16.3, lanes2 R2-DOCTOR): the snapshot a Lanes 2.0 host exports; nothing until one does.
5658
+ import doctor_lanes2
5659
+ for mark, text in doctor_lanes2.doctor_lines(L.STATE):
5660
+ if mark in ('⚠', ''):
5661
+ print(f'{mark or " "} {text}')
5662
+ else:
5663
+ check(mark == '✓', text)
5571
5664
  print('PRESSURE')
5572
5665
  health = L.compute_health()
5573
5666
  print('\n'.join(pressure_lines(health, L.read_json(L.STATE / 'containers.json') or {})))
@@ -5887,6 +5980,11 @@ def cmd_names(args):
5887
5980
  for _board, lane, row in todo:
5888
5981
  address = row.get('address') or lane.get('address') or L.address_of(lane['id'])
5889
5982
  current = (((row.get('agent') or {}).get('messaging')) or {}).get('name')
5983
+ refusal = None if write else L.names_refusal(lane, containers.get(lane['container']) or {})
5984
+ if refusal: # H1, BEY-6899: what --write could never type from here is said, and exit 1
5985
+ print(f"{'failed':<12} {lane['id']}: {refusal}")
5986
+ counts['failed'] = counts.get('failed', 0) + 1
5987
+ continue
5890
5988
  if not write:
5891
5989
  print(f"would rename {lane['id']} {current!r} -> {address}")
5892
5990
  counts['to rename'] = counts.get('to rename', 0) + 1
@@ -5894,9 +5992,15 @@ def cmd_names(args):
5894
5992
  outcome, detail = L.rename_claude(lane, address, containers.get(lane['container']) or {})
5895
5993
  print(f"{outcome:<12} {lane['id']}: {detail}")
5896
5994
  counts[outcome] = counts.get(outcome, 0) + 1
5995
+ counts['deferred'] = counts.get('deferred', 0) # always counted, as before (0 deferred is said)
5897
5996
  for _board, lane, why in deferred:
5997
+ refusal = L.names_refusal(lane, containers.get(lane.get('container')) or {})
5998
+ if refusal: # H1, BEY-6899: said, and exit 1
5999
+ print(f"{'failed':<12} {lane['id']}: {refusal}")
6000
+ counts['failed'] = counts.get('failed', 0) + 1
6001
+ continue
5898
6002
  print(f"deferred {lane['id']}: {why}")
5899
- counts['deferred'] = counts.get('deferred', 0) + len(deferred)
6003
+ counts['deferred'] = counts.get('deferred', 0) + 1
5900
6004
  print(', '.join(f'{n} {what}' for what, n in counts.items()) + f', {matched} already match'
5901
6005
  + ('' if write else ' — dry run: --write types /rename <address> + Enter into each lane to rename'))
5902
6006
  return 1 if counts.get('failed') else 0
@@ -6748,7 +6852,7 @@ COMMANDS = {'rebuilt': cmd_rebuilt, 'hello': cmd_hello, 'client-config': cmd_cli
6748
6852
  'guard': cmd_guard, 'rename': cmd_rename, 'register': cmd_register, 'unregister': cmd_unregister,
6749
6853
  'hooks': cmd_hooks, 'economy': cmd_economy, 'throttle': cmd_throttle,
6750
6854
  'preview': cmd_preview, 'edit': cmd_edit, 'device': cmd_device, 'next': cmd_next, 'prev': cmd_prev,
6751
- 'sidebar-key': cmd_sidebar_key, 'studio-host': cmd_studio_host,
6855
+ 'sidebar-key': cmd_sidebar_key, 'studio-host': cmd_studio_host, 'rs': cmd_rs,
6752
6856
  'keys': cmd_keys, 'invite': cmd_invite, 'enrol': cmd_enrol, 'offboard': cmd_offboard,
6753
6857
  'token': cmd_token, 'onboard': cmd_onboard, 'user': cmd_user, 'lane': cmd_lane, 'here': cmd_here,
6754
6858
  'version': cmd_version, 'update': cmd_update, 'docs': cmd_docs,
@@ -0,0 +1,15 @@
1
+ #!/bin/sh
2
+ # lanes-site/1 on a guest: the forced command of the aggregator's site key (Lanes2 architecture §3.32, plan row H1,
3
+ # DM-LANES-SITE-ADAPTER). Its authorized_keys line:
4
+ # command="<home>/.local/share/lanes/current/bin/lanes-site-serve",restrict ssh-ed25519 AAAA... lanes-site@<aggregator>
5
+ # SSH_ORIGINAL_COMMAND is ignored: this key reaches the protocol and nothing else. stdin/stdout are the protocol.
6
+ # $LANES_STATE/flags/rs-site names the native adapter (`lanesd site-serve`, W20); no lanesd is installed before W20,
7
+ # so the flag refuses with one typed frame (adapter_unavailable) instead of serving something else. Otherwise the
8
+ # Python reference server, without site-packages or PYTHON* environment (-S -E), writing no bytecode (-B).
9
+ here=$(dirname -- "$0")
10
+ state=${LANES_STATE:-$HOME/.local/state/lanes}
11
+ if [ -e "$state/flags/rs-site" ]; then
12
+ printf '%s\n' '{"id":null,"err":{"code":"adapter_unavailable","human":"flags/rs-site names lanesd site-serve, which is not installed on this guest (W20): remove the flag to serve the Python adapter"}}'
13
+ exit 69
14
+ fi
15
+ exec python3 -S -E -B "$here/../site/server.py"
@@ -0,0 +1,5 @@
1
+ {
2
+ "schema": "lanes.bin-rs/1",
3
+ "commit": "83f0e951ea5541f71d8ef9c639c1e258dd0471b2",
4
+ "binaries": []
5
+ }
@@ -56,6 +56,11 @@ terminal); `lanes sync` publishes the change (lanes-statusd starts one within ~1
56
56
  (lane_core.dispatch_lock, W15 part 2); an adapter whose answer was lost is `unknown`:
57
57
  held, never sent again by Lanes (a person: `lane inbox retry <id> --duplicate-risk`)
58
58
  lanes_message_ack <id> this agent's own lane has a message: its text leaves the inbox, the receipt stays
59
+ Project tools (Lanes 2.0 Round 2, R2-S10; listed only while ~/.lz/flags/projects exists, the container's
60
+ LANES_PROJECTS=on, so the frozen listing above keeps its bytes): lanes_work_list, lanes_work_claim,
61
+ lanes_work_release and lanes_checkpoint build the request the host's project store takes (lane_core.project_request)
62
+ and, until a transport carries it there (integration gate I1), answer `projects_unavailable` with that request:
63
+ nothing is claimed, released or recorded.
59
64
  Human-only by omission (no tool exists): ending or closing a lane, interrupting it (C-c or any key that is not
60
65
  printable text), opening or attaching one, uploads (a person's file into a lane: the Docs page or the desktop drop;
61
66
  an agent's own file goes the other way, lanes_publish), the host's sync/gc/ensure, renaming a tmux session, and any
@@ -161,8 +166,11 @@ TARGET_ARG = {'type': 'string', 'pattern': TARGET_PATTERN, 'maxLength': 129,
161
166
  '"@bw-tools.lanes-zellij" (a lane), "@bw-tools" (that board\'s coordinator) or "@fleet" '
162
167
  '(the fleet admin).'}
163
168
  MESSAGE_ID_PATTERN = '^[a-z0-9]{10,20}$' # lane_core.PUBLISH_ID: a message id (W15 L4)
169
+ PROJECT_ID_PATTERN = '^[A-Za-z0-9_][A-Za-z0-9_.:-]*$' # lane_core.PROJECT_ID_RE: a project-domain id (R2-S10)
170
+ WORK_CURSOR_PATTERN = '^[0-9]{10}:[0-9]{20}:[A-Za-z0-9_][A-Za-z0-9_.:-]*$' # lane_core.WORK_CURSOR_RE
164
171
  PATTERNS = {ID_PATTERN: C.LANE_RE, TARGET_PATTERN: C.TARGET_RE,
165
- MESSAGE_ID_PATTERN: C.PUBLISH_ID} # what validate() holds each `pattern` to
172
+ MESSAGE_ID_PATTERN: C.PUBLISH_ID, PROJECT_ID_PATTERN: C.PROJECT_ID_RE,
173
+ WORK_CURSOR_PATTERN: C.WORK_CURSOR_RE} # what validate() holds each `pattern` to
166
174
  READ_ONLY = {'readOnlyHint': True, 'destructiveHint': False, 'idempotentHint': True, 'openWorldHint': False}
167
175
 
168
176
 
@@ -355,6 +363,68 @@ TOOLS = (
355
363
  TOOL_BY_NAME = {tool['name']: tool for tool in TOOLS}
356
364
  WRITE_TOOLS = frozenset(tool['name'] for tool in TOOLS if not tool['annotations']['readOnlyHint'])
357
365
 
366
+ # Lanes 2.0 Round 2, R2-S10 (W28-D): the project tools, appended after the thirteen only while the container holds
367
+ # the projects switch (lane_core.projects_enabled), so the frozen listing keeps its bytes until that flag flips
368
+ # (lanes2 architecture section 7.2). Each answers one JSON object, a refusal included.
369
+ PROJECT_ARG = {'type': 'string', 'pattern': PROJECT_ID_PATTERN, 'maxLength': 128,
370
+ 'description': 'The project id, as lanes_work_list answers it.'}
371
+ ITEM_ARG = {'type': 'string', 'pattern': PROJECT_ID_PATTERN, 'maxLength': 128,
372
+ 'description': 'The work item id, as lanes_work_list answers it.'}
373
+ COUNTER_ARG = {'type': 'integer', 'minimum': 1, 'maximum': C.PROJECT_COUNTER_MAX}
374
+ REQUEST_ARG = {'type': 'string', 'pattern': PROJECT_ID_PATTERN, 'maxLength': 128,
375
+ 'description': 'An id of your choosing for this change, e.g. "req-2026-11-01-a"; send the same id '
376
+ 'again when you retry it, and a retry after a lost answer returns the original result '
377
+ 'instead of a conflict.'}
378
+ PROJECTS_NOTE = ('Until the host\'s project store is active this answers projects_unavailable with the request it '
379
+ 'would send: nothing is claimed, released or recorded.')
380
+ PROJECT_TOOLS = (
381
+ _tool('lanes_work_list', 'List ready project work',
382
+ 'The ready work of a project for the responsibility this agent\'s lane holds: every eligible item in '
383
+ 'ready order (priority, then age), one page at a time, each with its id, revision, work type, objective '
384
+ 'and how many items depend on it, and how many items are not ready, by reason. Readiness is not capacity. '
385
+ + PROJECTS_NOTE,
386
+ {'project': PROJECT_ARG,
387
+ 'after': {'type': 'string', 'pattern': WORK_CURSOR_PATTERN, 'maxLength': 160,
388
+ 'description': 'Where the next page starts: the `next` a previous answer gave.'},
389
+ 'limit': {'type': 'integer', 'minimum': 1, 'maximum': C.WORK_LIMIT_MAX,
390
+ 'default': C.WORK_LIMIT_DEFAULT,
391
+ 'description': f'Items per page, 1–{C.WORK_LIMIT_MAX} (default {C.WORK_LIMIT_DEFAULT}).'}},
392
+ required=('project',)),
393
+ _tool('lanes_work_claim', 'Claim project work',
394
+ 'Claim one ready work item for the responsibility this agent\'s lane holds, at the item revision '
395
+ 'lanes_work_list answered: one claimant wins and every other is refused; the answer is the claim\'s epoch, '
396
+ 'which every later change of the claim presents. ' + PROJECTS_NOTE,
397
+ {'project': PROJECT_ARG, 'request': REQUEST_ARG, 'item': ITEM_ARG,
398
+ 'revision': dict(COUNTER_ARG, description='The item revision you read (lanes_work_list `revision`).'),
399
+ 'lease_s': {'type': 'integer', 'minimum': C.LEASE_MIN_S, 'maximum': C.LEASE_MAX_S,
400
+ 'default': C.LEASE_DEFAULT_S,
401
+ 'description': f'The ownership lease in seconds, {C.LEASE_MIN_S}–{C.LEASE_MAX_S} '
402
+ f'(default {C.LEASE_DEFAULT_S}); renewing it is not progress.'}},
403
+ required=('project', 'request', 'item', 'revision'), hints=_writes(False, False)),
404
+ _tool('lanes_work_release', 'Release a claim',
405
+ 'Give up a claim this agent\'s responsibility holds, named by its epoch: the item reopens for others. A '
406
+ 'stale epoch releases nothing. ' + PROJECTS_NOTE,
407
+ {'project': PROJECT_ARG, 'request': REQUEST_ARG, 'item': ITEM_ARG,
408
+ 'epoch': dict(COUNTER_ARG, description='The claim epoch lanes_work_claim answered.')},
409
+ required=('project', 'request', 'item', 'epoch'), hints=_writes(False, False)),
410
+ _tool('lanes_checkpoint', 'Record a checkpoint',
411
+ 'Record a checkpoint for the responsibility this agent\'s lane holds: the host takes its live claims, the '
412
+ 'current mandate revision and the obligations still unresolved (effects in flight, role mail not yet '
413
+ 'delivered) from its own records, with your one-line note and next useful action, so a replacement session '
414
+ 'reconciles it before acting. A checkpoint never authorizes replaying a call. ' + PROJECTS_NOTE,
415
+ {'project': PROJECT_ARG, 'request': REQUEST_ARG,
416
+ 'checkpoint': {'type': 'string', 'pattern': PROJECT_ID_PATTERN, 'maxLength': 128,
417
+ 'description': 'A new checkpoint id of your choosing, e.g. "cp-2026-11-01-a".'},
418
+ 'note': {'type': 'string', 'maxLength': C.PROJECT_TEXT_MAX,
419
+ 'description': 'What holds now, in a sentence or two.'},
420
+ 'next_action': {'type': 'string', 'maxLength': C.PROJECT_TEXT_MAX,
421
+ 'description': 'The next useful action.'}},
422
+ required=('project', 'request', 'checkpoint'), hints=_writes(False, False)),
423
+ )
424
+ PROJECT_TOOL_BY_NAME = {tool['name']: tool for tool in PROJECT_TOOLS}
425
+ PROJECT_OPS = {'lanes_work_list': 'work_list', 'lanes_work_claim': 'work_claim',
426
+ 'lanes_work_release': 'work_release', 'lanes_checkpoint': 'checkpoint'}
427
+
358
428
 
359
429
  class RpcError(Exception):
360
430
  def __init__(self, code, message):
@@ -463,6 +533,9 @@ HUMAN = {
463
533
  'retried: `~/.lz/bin/lane inbox` shows each message\'s receipt.',
464
534
  'duplicate_risk': 'The message may have arrived already: a person who accepts that it may arrive twice runs '
465
535
  '`~/.lz/bin/lane inbox retry <id> --duplicate-risk`, or the recipient acknowledges it.',
536
+ # R2-S10: the project tools.
537
+ 'projects_unavailable': 'Coordinate with lanes_message meanwhile; a person turns projects on once the host runs the '
538
+ 'Lanes 2.0 project store (LANES_PROJECTS).',
466
539
  'refused': 'A person takes it from here.',
467
540
  }
468
541
 
@@ -545,6 +618,10 @@ def validate(schema, arguments):
545
618
  if spec['pattern'] == ID_PATTERN else
546
619
  f'"{key}" is not a message id (10–20 lower-case letters and digits)'
547
620
  if spec['pattern'] == MESSAGE_ID_PATTERN else
621
+ f'"{key}" is not a project id (letters, digits, _ . : -; at most {spec["maxLength"]})'
622
+ if spec['pattern'] == PROJECT_ID_PATTERN else
623
+ f'"{key}" is not a cursor lanes_work_list answered'
624
+ if spec['pattern'] == WORK_CURSOR_PATTERN else
548
625
  f'"{key}" is neither a lane id nor an address (an optional @, then letters, digits, '
549
626
  f'_ . -; at most {spec["maxLength"]})')
550
627
  elif len(value) < spec.get('minLength', 0):
@@ -697,7 +774,7 @@ class Server:
697
774
  if self.protocol is None:
698
775
  raise RpcError(NOT_INITIALIZED, 'Server not initialized: send initialize first')
699
776
  if method == 'tools/list':
700
- return {'tools': json.loads(json.dumps(TOOLS))}
777
+ return {'tools': json.loads(json.dumps(self.listed()))}
701
778
  if method == 'tools/call':
702
779
  return self.call(params)
703
780
  raise RpcError(METHOD_NOT_FOUND, f'Method not found: {method}')
@@ -713,12 +790,18 @@ class Server:
713
790
  'serverInfo': {'name': 'lanes', 'version': self.version}, 'instructions': INSTRUCTIONS}
714
791
 
715
792
  # ---------------------------------------------------------------------------------------------- tools
793
+ def listed(self):
794
+ """The tools this server lists: the frozen thirteen, then the project tools while the container holds the
795
+ projects switch (R2-S10)."""
796
+ return TOOLS + PROJECT_TOOLS if C.projects_enabled(self.root) else TOOLS
797
+
716
798
  def call(self, params):
717
799
  name, arguments = params.get('name'), params.get('arguments')
718
- if not isinstance(name, str) or name not in TOOL_BY_NAME:
800
+ table = {tool['name']: tool for tool in self.listed()}
801
+ if not isinstance(name, str) or name not in table:
719
802
  raise RpcError(INVALID_PARAMS, f'Unknown tool: {name!r} (tools/list names them)')
720
803
  started, lane, code = time.monotonic(), None, None
721
- writes = name in WRITE_TOOLS
804
+ writes = name in WRITE_TOOLS or name in PROJECT_TOOL_BY_NAME # a project tool always answers JSON
722
805
  self._peers = None # W15 L6: virtual_peers read afresh for each call (Server.peers)
723
806
  try:
724
807
  if arguments is None:
@@ -726,7 +809,7 @@ class Server:
726
809
  if not isinstance(arguments, dict):
727
810
  raise ToolError('arguments must be an object')
728
811
  lane = arguments.get('lane') if C.TARGET_RE.fullmatch(str(arguments.get('lane') or '')) else None
729
- problems = validate(TOOL_BY_NAME[name]['inputSchema'], arguments)
812
+ problems = validate(table[name]['inputSchema'], arguments)
730
813
  if problems:
731
814
  raise ToolError('; '.join(problems))
732
815
  payload, error = getattr(self, 'tool_' + name[len('lanes_'):])(arguments), False
@@ -1435,6 +1518,26 @@ class Server:
1435
1518
  out = C.message_ack(self.root, lane, arguments['id'])
1436
1519
  return {**out, 'picked_up_by': STATUS_PICKUP, 'expected_within_s': STATUS_LATENCY_S}
1437
1520
 
1521
+ # ------------------------------------------------------------------------------------------ project tools
1522
+ def project(self, name, arguments):
1523
+ """R2-S10: one project tool from this agent's own lane. The request is built and validated
1524
+ (lane_core.project_request) and, while no transport reaches the host's project store, answered
1525
+ `projects_unavailable` with it: nothing is claimed, released or recorded."""
1526
+ lane = self.own_lane(name)
1527
+ raise C.project_unavailable(C.project_request(PROJECT_OPS[name], lane, arguments))
1528
+
1529
+ def tool_work_list(self, arguments):
1530
+ return self.project('lanes_work_list', arguments)
1531
+
1532
+ def tool_work_claim(self, arguments):
1533
+ return self.project('lanes_work_claim', arguments)
1534
+
1535
+ def tool_work_release(self, arguments):
1536
+ return self.project('lanes_work_release', arguments)
1537
+
1538
+ def tool_checkpoint(self, arguments):
1539
+ return self.project('lanes_checkpoint', arguments)
1540
+
1438
1541
 
1439
1542
  def main(argv):
1440
1543
  if argv: