@vibelord/lanes 1.8.0 → 1.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/payload/lanes/README.md +29 -11
- package/payload/lanes/VERSION +1 -1
- package/payload/lanes/bin/lanes +159 -59
- package/payload/lanes/bin-rs/BINARIES.json +2 -17
- package/payload/lanes/client/lanes-launch +51 -2
- package/payload/lanes/container/lane +142 -19
- package/payload/lanes/container/lane-mcp +168 -55
- package/payload/lanes/container/lane-peerd +6 -6
- package/payload/lanes/container/lane-signal +48 -3
- package/payload/lanes/container/lane_core.py +1040 -164
- package/payload/lanes/container/throttle-pulse +13 -4
- package/payload/lanes/docs/AGENTS-lanes.md +15 -7
- package/payload/lanes/docs/ARCHITECTURE.md +478 -101
- package/payload/lanes/docs/DESIGN.md +7 -2
- package/payload/lanes/docs/INSTALL.md +20 -3
- package/payload/lanes/docs/PLAN-1.9.1-SIDEBAR-CODEX.md +128 -0
- package/payload/lanes/docs/RUNBOOK.md +1428 -107
- package/payload/lanes/docs/USERGUIDE.md +488 -86
- package/payload/lanes/holders/tmux.sh +3 -3
- package/payload/lanes/install/services.py +68 -11
- package/payload/lanes/libexec/agent_state.py +2 -5
- package/payload/lanes/libexec/attach.py +11 -3
- package/payload/lanes/libexec/cursor_sync.py +22 -2
- package/payload/lanes/libexec/docsd.py +38 -4
- package/payload/lanes/libexec/lanes_lib.py +377 -39
- package/payload/lanes/libexec/mdlite.py +43 -3
- package/payload/lanes/libexec/notify.py +69 -26
- package/payload/lanes/libexec/registrations.py +5 -0
- package/payload/lanes/libexec/session_actions.py +114 -27
- package/payload/lanes/libexec/sidebar.py +246 -64
- package/payload/lanes/libexec/site_hooks.py +65 -0
- package/payload/lanes/libexec/statusd.py +139 -189
- package/payload/lanes/libexec/studio_host.py +8 -2
- package/payload/lanes/libexec/tokens.py +6 -2
- package/payload/lanes/libexec/update.py +13 -5
- package/payload/lanes/libexec/view.sh +39 -4
- package/payload/lanes/libexec/workspace_keys.py +54 -0
- package/payload/lanes/site/protocol.py +15 -5
- package/payload/lanes/site/relay.py +5 -2
- package/payload/lanes/site/server.py +29 -18
- package/payload/lanes/systemd/lanes-economy.service +3 -1
- package/payload/lanes/tokens/README.md +10 -0
- package/payload/lanes/tokens/generate.py +1 -1
- package/payload/lanes/web/Caddyfile +9 -2
- package/payload/lanes/web/README.md +2410 -95
- package/payload/lanes/web/browser.css +2 -0
- package/payload/lanes/web/browser.js +18 -6
- package/payload/lanes/web/directory.js +1 -1
- package/payload/lanes/web/docs.js +23 -0
- package/payload/lanes/web/links.js +157 -0
- package/payload/lanes/web/manifest.webmanifest +0 -2
- package/payload/lanes/web/mobile.css +30 -32
- package/payload/lanes/web/mobile.js +286 -227
- package/payload/lanes/web/upload.js +65 -22
- package/payload/lanes/web/workspace-keys.js +65 -0
- package/payload/lanes/zellij/config.kdl +1 -1
- package/payload/manifest.json +5 -22
- package/payload/lanes/bin-rs/THIRD-PARTY-NOTICES +0 -18953
- package/payload/lanes/bin-rs/x86_64-unknown-linux-musl/lanes-hook +0 -0
- package/payload/lanes/bin-rs/x86_64-unknown-linux-musl/lanes-terminal +0 -0
|
@@ -58,7 +58,7 @@ fi
|
|
|
58
58
|
view_term=xterm-256color
|
|
59
59
|
if infocmp xterm-lanesview >/dev/null 2>&1; then view_term=xterm-lanesview; fi
|
|
60
60
|
lanes_tmux() {
|
|
61
|
-
env -i PATH
|
|
61
|
+
env -i PATH="$HOME/.local/share/lanes/compat/bin:/usr/bin:/bin" HOME="$HOME" TERM="$view_term" LANG=C.UTF-8 COLORTERM=truecolor \
|
|
62
62
|
tmux -N -u -2 -T RGB,hyperlinks -S "$path" "$@"
|
|
63
63
|
}
|
|
64
64
|
lanes_tmux has-session -t "$target" 2>/dev/null || fail 66 "lane $socket / $session is not provisioned (no such tmux session)"
|
|
@@ -104,8 +104,8 @@ fi
|
|
|
104
104
|
# exec: the supervisor's child pid must BE the tmux client, so a lane switch (SIGTERM) detaches it cleanly
|
|
105
105
|
# instead of orphaning a client on this pty.
|
|
106
106
|
if [ -n "$flags" ]; then
|
|
107
|
-
exec env -i PATH
|
|
107
|
+
exec env -i PATH="$HOME/.local/share/lanes/compat/bin:/usr/bin:/bin" HOME="$HOME" TERM="$view_term" LANG=C.UTF-8 COLORTERM=truecolor \
|
|
108
108
|
tmux -N -u -2 -T RGB,hyperlinks -S "$path" attach-session -f "$flags" -t "$target"
|
|
109
109
|
fi
|
|
110
|
-
exec env -i PATH
|
|
110
|
+
exec env -i PATH="$HOME/.local/share/lanes/compat/bin:/usr/bin:/bin" HOME="$HOME" TERM="$view_term" LANG=C.UTF-8 COLORTERM=truecolor \
|
|
111
111
|
tmux -N -u -2 -T RGB,hyperlinks -S "$path" attach-session -t "$target"
|
|
@@ -53,7 +53,8 @@ def unit_value(value, command=False):
|
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
# The opt-in economy poller's settings (libexec/economy_poll.py). Rendered into lanes-economy.service only, and only
|
|
56
|
-
# when set in the installer's environment
|
|
56
|
+
# when set in the installer's environment — LANES_THROTTLE_CONTROL also from site.conf (economy_settings, BEY-6845);
|
|
57
|
+
# the unit itself is never enabled by an install (operator gate).
|
|
57
58
|
ECONOMY_SETTINGS = ('LANES_THROTTLE_CONTROL', 'LANES_THROTTLE_TOKEN_FILE', 'LANES_THROTTLE_LOG_DIR',
|
|
58
59
|
'LANES_THROTTLE_CONTAINER')
|
|
59
60
|
ECONOMY_UNITS = ('lanes-economy.service',)
|
|
@@ -61,11 +62,61 @@ ECONOMY_UNITS = ('lanes-economy.service',)
|
|
|
61
62
|
# set in the installer's environment (a config FILE path; the ntfy token stays in the file its token_file names).
|
|
62
63
|
NOTIFY_SETTINGS = ('LANES_NOTIFY_CONF',)
|
|
63
64
|
NOTIFY_UNITS = ('lanes-notify.service',)
|
|
65
|
+
# lanes_lib's spellings (test_economy_poll pins them equal), read here so that a tree with nothing declared — no
|
|
66
|
+
# LANES_THROTTLE_CONTROL in the installer's environment and no site.conf — renders its units without importing the
|
|
67
|
+
# validator at all: services.py then runs as the one file the installer tests stage (install/ without libexec/).
|
|
68
|
+
THROTTLE_CONTROL_KEY = 'LANES_THROTTLE_CONTROL'
|
|
69
|
+
SITE_CONF = Path('.config/lanes/site.conf')
|
|
64
70
|
|
|
65
71
|
|
|
66
|
-
def
|
|
67
|
-
"""
|
|
68
|
-
|
|
72
|
+
def lanes_lib():
|
|
73
|
+
"""libexec/lanes_lib.py of this tree (install/ and libexec/ sit side by side in every tree, staged or checked
|
|
74
|
+
out), imported when a value is to be judged: the one validator of site.conf's LANES_THROTTLE_CONTROL
|
|
75
|
+
(throttle_control, site_problems), so the economy unit and the pulse's three start sites judge the line with one
|
|
76
|
+
table. Nothing declared, nothing imported (economy_settings)."""
|
|
77
|
+
libexec = str(Path(__file__).resolve().parent.parent / 'libexec')
|
|
78
|
+
if libexec not in sys.path:
|
|
79
|
+
sys.path.insert(0, libexec)
|
|
80
|
+
import lanes_lib
|
|
81
|
+
return lanes_lib
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def economy_settings(environ, home=None):
|
|
85
|
+
"""The non-empty LANES_THROTTLE_* settings of `environ` (a token FILE path, never a token). With `home`, site.conf's
|
|
86
|
+
`LANES_THROTTLE_CONTROL` (BEY-6845: the one declared place for the control URL — the Throttle pulse's `--control`
|
|
87
|
+
comes from the same line) stands in when the environment does not set it, so the economy unit names the URL the
|
|
88
|
+
pulse polls; the environment stays an override for this unit alone. No `home`: the environment only (tests).
|
|
89
|
+
|
|
90
|
+
Whichever source names the URL, it is judged with lanes_lib.throttle_control — the pulse's table, so what the
|
|
91
|
+
pulse refuses never reaches a unit file (a URL with a user part is a credential in ~/.config/systemd) — and
|
|
92
|
+
rendered normalised, byte for byte the pulse's `--control` value (the trailing `/` dropped); `none`/`off` reach
|
|
93
|
+
the unit as `none`, the spelling economy_poll documents. A refused value raises RefusedValue naming its source
|
|
94
|
+
and key (`site.conf LANES_THROTTLE_CONTROL: <why>`), a Refusal: the install, update or enable step stops with
|
|
95
|
+
`refused, nothing was changed`, exactly as `lanes sync` refuses the same line. site.conf is judged on its raw
|
|
96
|
+
last line naming the key (lanes_lib.site_problems), never read as unset when the site grammar drops it. The
|
|
97
|
+
validator is imported only when a source names the key: with nothing in the environment and no site.conf there is
|
|
98
|
+
nothing to judge, and the units render without libexec/ beside this file."""
|
|
99
|
+
settings = {name: environ[name] for name in ECONOMY_SETTINGS if environ.get(name)}
|
|
100
|
+
key = THROTTLE_CONTROL_KEY
|
|
101
|
+
value, source = settings.get(key), f"{key} (the installer's environment)"
|
|
102
|
+
if not value and home is not None and (Path(home) / SITE_CONF).is_file():
|
|
103
|
+
lib = lanes_lib()
|
|
104
|
+
problems = lib.site_problems(home)
|
|
105
|
+
if problems:
|
|
106
|
+
raise RefusedValue(f'site.conf {key}: {problems[0][1]}')
|
|
107
|
+
value, source = lib.site_conf(home).get(key), f'site.conf {key}'
|
|
108
|
+
if value is None:
|
|
109
|
+
return settings
|
|
110
|
+
url, why = lanes_lib().throttle_control(value)
|
|
111
|
+
if why:
|
|
112
|
+
raise RefusedValue(f'{source}: {why}')
|
|
113
|
+
if url:
|
|
114
|
+
settings[key] = url
|
|
115
|
+
elif value.strip():
|
|
116
|
+
settings[key] = 'none'
|
|
117
|
+
else:
|
|
118
|
+
settings.pop(key, None)
|
|
119
|
+
return settings
|
|
69
120
|
|
|
70
121
|
|
|
71
122
|
def notify_settings(environ):
|
|
@@ -122,15 +173,20 @@ def host_binary_path(share):
|
|
|
122
173
|
return installed if os.path.lexists(installed) else throttle_rc_path(share)
|
|
123
174
|
|
|
124
175
|
|
|
125
|
-
def
|
|
126
|
-
"""site.conf
|
|
127
|
-
|
|
176
|
+
def site_facts(home):
|
|
177
|
+
"""`<home>/.config/lanes/site.conf` as lanes_lib.site_conf reads it (SITE_LINE; the last valid line naming a key
|
|
178
|
+
wins) -> {key: value}; {} without a readable file."""
|
|
128
179
|
try:
|
|
129
180
|
text = (Path(home) / SITE_CONF).read_text()
|
|
130
181
|
except (OSError, UnicodeDecodeError):
|
|
131
|
-
return
|
|
132
|
-
|
|
133
|
-
|
|
182
|
+
return {}
|
|
183
|
+
return dict(match.groups() for match in map(SITE_LINE.match, text.splitlines()) if match)
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def host_role(home):
|
|
187
|
+
"""site.conf's LANES_HOST_ROLE as lanes_lib.site_conf reads it (SITE_LINE; the last valid line naming it wins), or
|
|
188
|
+
None: the same fact `lanes rs apply` and `throttle-rc lanes host` read."""
|
|
189
|
+
return site_facts(home).get('LANES_HOST_ROLE')
|
|
134
190
|
|
|
135
191
|
|
|
136
192
|
def host_unit_mode(home, state):
|
|
@@ -551,7 +607,8 @@ if __name__ == '__main__':
|
|
|
551
607
|
register(Path(__file__).resolve().parents[1], Path.home(),
|
|
552
608
|
os.environ.get('LANES_SHARE', Path.home() / '.local/share/lanes'),
|
|
553
609
|
os.environ.get('LANES_STATE', Path.home() / '.local/state/lanes'),
|
|
554
|
-
os.environ.get('LANES_WORKSPACES'), economy_settings(os.environ
|
|
610
|
+
os.environ.get('LANES_WORKSPACES'), economy_settings(os.environ, Path.home()),
|
|
611
|
+
notify_settings(os.environ),
|
|
555
612
|
units_dir=manager_unit_dir(Path.home()), install=sys.argv[1:] == ['--install'])
|
|
556
613
|
except Refusal as error:
|
|
557
614
|
print(f'services.py: refused, nothing was changed: {error}', file=sys.stderr)
|
|
@@ -398,11 +398,8 @@ def _same_process(proc_root, pid, proc_start):
|
|
|
398
398
|
"""The session file's `procStart` must equal the live pid's starttime (field 22 of /proc/<pid>/stat), else
|
|
399
399
|
the pid was recycled by an unrelated process. Claude writes procStart as a JSON string; str() normalises the
|
|
400
400
|
string and int forms alike. Unreadable stat -> treated as dead."""
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
return stat.rsplit(')', 1)[1].split()[19] == str(proc_start)
|
|
404
|
-
except (OSError, IndexError):
|
|
405
|
-
return False
|
|
401
|
+
from lanes_lib import lane_core
|
|
402
|
+
return lane_core().same_process(proc_root, pid, proc_start)
|
|
406
403
|
|
|
407
404
|
|
|
408
405
|
def parse_codex_title(title, harness=None):
|
|
@@ -6,7 +6,9 @@ sends Exit only after draining that queue. Input can wait for an unblock that
|
|
|
6
6
|
the removed client will never receive. SSH keepalives cannot detect this.
|
|
7
7
|
This relay therefore never stops reading the client. Output the terminal has
|
|
8
8
|
not taken yet is bounded at OUTPUT_LIMIT: beyond it the oldest part is dropped
|
|
9
|
-
and, once the terminal has caught up, the client is asked for a full repaint
|
|
9
|
+
and, once the terminal has caught up, the client is asked for a full repaint
|
|
10
|
+
(a cut the terminal refuses or takes in part postpones that repaint until the
|
|
11
|
+
cut has drained).
|
|
10
12
|
Only a terminal that accepts no byte at all for OUTPUT_AGE ends the display
|
|
11
13
|
(BEY-6844; the 1.5.1 guard of DEF-1965 also ended slow but healthy displays).
|
|
12
14
|
That is judged on the terminal's consumption as this relay records it
|
|
@@ -302,8 +304,14 @@ def relay(command, output_limit=OUTPUT_LIMIT, output_age=OUTPUT_AGE, record=Fals
|
|
|
302
304
|
def repaint():
|
|
303
305
|
"""The terminal holds everything kept: cancel what a cut may have left open, then ask for a full frame."""
|
|
304
306
|
nonlocal noticed, restore_at, last_repaint, redraw_pending
|
|
305
|
-
|
|
306
|
-
|
|
307
|
+
if not write_now(CUT):
|
|
308
|
+
# A refused or partial cut postpones the whole repaint (BEY-7309): the rest of the cut is queued ahead of
|
|
309
|
+
# everything, the repaint stays owed (no resize, the rate limit untouched) and is due again once the cut
|
|
310
|
+
# has drained; it then writes the cut whole and the notice follows it. It cannot spin (a repaint needs an
|
|
311
|
+
# empty queue; the leftover drains only when the terminal has room; a terminal that takes nothing meets
|
|
312
|
+
# the stall rule) and `behind` cannot double count (redraw_pending stays set).
|
|
313
|
+
return
|
|
314
|
+
if not noticed:
|
|
307
315
|
noticed = True
|
|
308
316
|
try: # stderr is this terminal over SSH: written right after CUT, before the repaint replaces it
|
|
309
317
|
os.write(2, f'\r\n{NOTICE}\r\n'.encode())
|
|
@@ -304,10 +304,30 @@ def run(args):
|
|
|
304
304
|
backup_dir = L.STATE / 'cursor-sync-backups' / time.strftime('%Y%m%dT%H%M%SZ', time.gmtime())
|
|
305
305
|
backup_dir.mkdir(parents=True, exist_ok=True)
|
|
306
306
|
(backup_dir / container_path.strip('/').replace('/', '__')).write_text(old)
|
|
307
|
-
|
|
308
|
-
L.atomic_write(host_file, new, mode=mode)
|
|
307
|
+
write_planned(host_file, container_path, old, new)
|
|
309
308
|
print(f' written (backup in {backup_dir})')
|
|
310
309
|
if not write and changed:
|
|
311
310
|
again = ''.join(f' {flag}' for flag in ('--canonicalize', '--identity') if flag in args)
|
|
312
311
|
print(f'\n{changed} file(s) would change. Apply with: lanes cursor-sync <workspace>{again} --write')
|
|
313
312
|
return 0
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
def write_planned(host_file, container_path, old, new):
|
|
316
|
+
"""Write `new` where the plan read `old`, through lane_core.update_terminals (BEY-7435): the file's lock, the file
|
|
317
|
+
re-read under it, and the rewrite only while it still holds exactly `old`. A terminals.json another writer changed
|
|
318
|
+
since the plan read it (an agent's lanes_new, the sidebar's `P`) is refused, never replaced by a normalization of
|
|
319
|
+
the bytes before that write, which would drop its row; so is a rewrite that would drop a row or a binding the
|
|
320
|
+
registry does not list (a binding left without its row: `lanes register` repairs it first). LanesError naming the
|
|
321
|
+
file; nothing written."""
|
|
322
|
+
core = L.lane_core()
|
|
323
|
+
|
|
324
|
+
def mutate(current):
|
|
325
|
+
if (current or '') != old:
|
|
326
|
+
raise L.LanesError(f'{container_path} changed since cursor-sync read it (another writer); nothing written '
|
|
327
|
+
'— run it again')
|
|
328
|
+
return new
|
|
329
|
+
Path(host_file).parent.mkdir(parents=True, exist_ok=True) # a Cursor projection may be the folder's first file
|
|
330
|
+
try:
|
|
331
|
+
core.update_terminals(host_file, mutate)
|
|
332
|
+
except core.LaneError as error:
|
|
333
|
+
raise L.LanesError(f'{container_path}: {error}') from error
|
|
@@ -248,6 +248,7 @@ STATIC = {'docs.css': 'text/css; charset=utf-8', 'docs.js': 'text/javascript; ch
|
|
|
248
248
|
'upload.css': 'text/css; charset=utf-8', 'upload.js': 'text/javascript; charset=utf-8'}
|
|
249
249
|
FETCH_SITES = ('same-origin', 'none') # Sec-Fetch-Site values the gate serves (every route, F2) …
|
|
250
250
|
NAVIGATION_METHODS = ('GET', 'HEAD') # … and a top-level navigation by these methods, from any site
|
|
251
|
+
_WORKSPACE_READS = threading.BoundedSemaphore(2)
|
|
251
252
|
_DECRYPTS = threading.BoundedSemaphore(1) # encrypted documents decrypted at once (each held in memory)
|
|
252
253
|
_ID = r'([a-z0-9]{10,20})' # docs_store.ID_RE; check_id runs again before any path is formed
|
|
253
254
|
ROUTES = (('index', re.compile(r'/', re.ASCII)),
|
|
@@ -255,6 +256,7 @@ ROUTES = (('index', re.compile(r'/', re.ASCII)),
|
|
|
255
256
|
('raw', re.compile(rf'/d/{_ID}/raw', re.ASCII)),
|
|
256
257
|
('artifact', re.compile(rf'/d/{_ID}/artifact', re.ASCII)),
|
|
257
258
|
('receipt', re.compile(rf'/receipt/{_ID}\.json', re.ASCII)),
|
|
259
|
+
('workspace-keys', re.compile(r'/workspace-keys/([A-Za-z0-9_][A-Za-z0-9_.-]{0,47})', re.ASCII)),
|
|
258
260
|
('up', re.compile(r'/up', re.ASCII)),
|
|
259
261
|
('static', re.compile(r'/(docs\.css|docs\.js|upload\.css|upload\.js)', re.ASCII)))
|
|
260
262
|
METHODS = {'up': ('POST',)} # every other route: GET
|
|
@@ -698,15 +700,26 @@ def index_page(login, docs, reg, targets, ws=None, lane=None):
|
|
|
698
700
|
names.get(lane, lane) if lane else None) if label)
|
|
699
701
|
parts.append(f'<p class="docs-filter">Showing {shown} · <a href="./">All docs</a></p>')
|
|
700
702
|
if targets:
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
703
|
+
# The destination (BEY-8609 slice 3b): only a filter lane the form offers is preselected; every other page
|
|
704
|
+
# starts on an empty choice, so `required` stops a form sent before a lane was chosen (and POST /up answers
|
|
705
|
+
# no-lane behind it). Each option names its workspace, `‹title› › ‹lane›`, with the id added when two titles in
|
|
706
|
+
# the list repeat (the words: design-systems.hypervibe's ruling of 20 November 2026).
|
|
707
|
+
repeats = {}
|
|
708
|
+
for _ws, title, _lanes in targets:
|
|
709
|
+
repeats[str(title)] = repeats.get(str(title), 0) + 1
|
|
710
|
+
chosen = lane if any(lane == lane_id for _ws, _title, lanes in targets for lane_id, _name in lanes) else None
|
|
711
|
+
options = ('' if chosen else '<option value="">Choose a lane</option>') + ''.join(
|
|
712
|
+
f'<optgroup label="{esc(title)}">' + ''.join(
|
|
713
|
+
f'<option value="{esc(lane_id)}"{" selected" if lane_id == chosen else ""}>{esc(title)}'
|
|
714
|
+
f'{f" ({esc(ws_id)})" if repeats[str(title)] > 1 else ""} › {esc(name)}</option>'
|
|
715
|
+
for lane_id, name in lanes) + '</optgroup>' for ws_id, title, lanes in targets)
|
|
704
716
|
# The drop area (W5): a plain form that works without a script — the label wraps a multi-file input, so a tap
|
|
705
717
|
# opens the picker and a drop onto the input takes the files —, and better with upload.js (drag and drop
|
|
706
718
|
# onto the whole area, a size check, progress, one receipt per file in .docs-sent).
|
|
707
719
|
parts.append(f'<form class="docs-upload" method="post" action="up" enctype="multipart/form-data" '
|
|
708
720
|
f'data-max="{MAX_BODY}">'
|
|
709
|
-
f'<label>
|
|
721
|
+
f'<label for="docs-lane">Upload to <select id="docs-lane" name="lane" required>{options}'
|
|
722
|
+
'</select></label>'
|
|
710
723
|
'<label class="docs-drop">Drop files here, or tap to choose'
|
|
711
724
|
'<input type="file" name="file" multiple required></label>'
|
|
712
725
|
'<button type="submit">Upload</button>'
|
|
@@ -1200,6 +1213,22 @@ class Handler(BaseHTTPRequestHandler):
|
|
|
1200
1213
|
if route == 'up':
|
|
1201
1214
|
return self._upload(service, caller)
|
|
1202
1215
|
workspaces = member_workspaces(caller.login)
|
|
1216
|
+
if route == 'workspace-keys':
|
|
1217
|
+
import workspace_keys
|
|
1218
|
+
meta = L.read_json(L.STATE / 'devices' / f'{name}.json')
|
|
1219
|
+
if (not isinstance(meta, dict) or meta.get('workspace_keys') != 'on' or
|
|
1220
|
+
(users.login_for(name, meta) or '').casefold() != caller.login.casefold()):
|
|
1221
|
+
return self._error(404, 'not-found')
|
|
1222
|
+
if not _WORKSPACE_READS.acquire(blocking=False):
|
|
1223
|
+
return self._error(503, 'busy')
|
|
1224
|
+
try:
|
|
1225
|
+
slots = workspace_keys.projection(name, meta, L.load_registry(), users.read(caller.login),
|
|
1226
|
+
allowed=workspaces)
|
|
1227
|
+
except (OSError, ValueError, KeyError, TypeError, L.LanesError):
|
|
1228
|
+
return self._error(503, 'busy')
|
|
1229
|
+
finally:
|
|
1230
|
+
_WORKSPACE_READS.release()
|
|
1231
|
+
return self._json(200, slots)
|
|
1203
1232
|
if route == 'index':
|
|
1204
1233
|
reg = registry()
|
|
1205
1234
|
docs, targets = visible_docs(caller.login, workspaces), upload_targets(workspaces, reg)
|
|
@@ -2010,5 +2039,10 @@ def main(argv=None):
|
|
|
2010
2039
|
return 0
|
|
2011
2040
|
|
|
2012
2041
|
|
|
2042
|
+
|
|
2043
|
+
# lanes site-hook loader (FLE-388)
|
|
2044
|
+
import site_hooks
|
|
2045
|
+
site_hooks.apply('docs', globals())
|
|
2046
|
+
|
|
2013
2047
|
if __name__ == '__main__':
|
|
2014
2048
|
sys.exit(main())
|