@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
|
@@ -41,14 +41,19 @@ ever hidden), until `o` shows the hidden ones again, faint; a pinned lane leads
|
|
|
41
41
|
never lets it fall below `⋮ N more`. `p` pins / unpins, `h` hides (Enter confirms; on a hidden lane `o` shows, `h`
|
|
42
42
|
shows it again at once), `H` hides this workspace (Enter confirms: `lanes upgrade-session` closes its tab on every
|
|
43
43
|
device of the person), `o` toggles the hidden lanes. While the owner hides lanes of this workspace the list ends with
|
|
44
|
-
one row, `── hidden (n) · o shows them` (counts only, no names), so a hidden lane is never invisible (BEY-7248).
|
|
44
|
+
one row, `── hidden (n) · o shows them` (counts only, no names), so a hidden lane is never invisible (BEY-7248). On a
|
|
45
|
+
phone (E2) the row says `tap shows them`, a tap on it shows them, and it stays while they show (`tap hides them`).
|
|
45
46
|
A typed sentence is no command (BEY-7248, 1.7.7): printable keys faster than a person navigates — BURST_KEYS inside
|
|
46
47
|
BURST_WINDOW_S — put the sidebar in a `typing` state that swallows the rest of the burst (until BURST_QUIET_S of
|
|
47
48
|
silence, Enter or Esc) and says ` Typing? ⏎ opens the lane · Esc`; `h`, `H` and `R` ask first and only Enter answers
|
|
48
49
|
yes, and no stage a letter opened takes its Enter (or, for a field, its letters) within BURST_WINDOW_S of that letter.
|
|
50
|
+
On a phone's picker with no prompt open (E2, BEY-8667) the FIRST printable key types (`j`, `k` and `/` stay keys), the
|
|
51
|
+
state lasts until PHONE_QUIET_S of silence, Enter or a tap, and the footer says ` Typing? Tap a lane to type in it`
|
|
52
|
+
(at Add to workspace ` Typing? Tap Cancel to stop adding`).
|
|
49
53
|
Which lanes (cockpit v3 V2): the `?` sheet's first row is ` lanes <installed> · view <this tree>`; while an update has
|
|
50
54
|
flipped `current` to another tree than the one this sidebar runs, the footer's rung below the health banner says
|
|
51
|
-
` server 1.2.0 · view 1.1.0 — press
|
|
55
|
+
` server 1.2.0 · view 1.1.0 — press ?` (a phone: the versions only). `current/VERSION` is read at start and every 30 s
|
|
56
|
+
inside reload(), never per tick.
|
|
52
57
|
Self-swap (cockpit v3 U5): a sidebar started through `current` that finds the installed version changed swaps onto it
|
|
53
58
|
as soon as it is idle — it saves views/<device>/<ws>.<slot>.sidebar.state {cursor_id, top, seen, filter} and exits 75;
|
|
54
59
|
the wrapper re-executes itself from `current` at once and the new sidebar takes the state (a ~100 ms repaint).
|
|
@@ -112,10 +117,11 @@ STATE = os.environ.get('LANES_STATE') or os.path.expanduser('~/.local/state/lane
|
|
|
112
117
|
# tone)` from the one token source, drawn in column 2 (spec §3). A SEPARATE dict: GLYPHS' keys stay statusd's words.
|
|
113
118
|
AGENT_GLYPHS = tokens.AGENT_GLYPHS
|
|
114
119
|
# The attention queue (spec §4.4): (section key, title, the agent status whose glyph heads the section, members in
|
|
115
|
-
# their order of urgency). Needs you = a blocking prompt, a failure, a finished turn waiting for a prompt.
|
|
120
|
+
# their order of urgency). Needs you = a blocking prompt, a failure, a finished turn waiting for a prompt. The titles
|
|
121
|
+
# are the Hypervibe design-system vocabulary's directory sections (`Done, not seen`: a finished turn not yet opened).
|
|
116
122
|
ATTENTION = (('needs', 'Needs you', 'needs_approval', ('needs_approval', 'errored', 'needs_input')),
|
|
117
123
|
('working', 'Working', 'working', ('working',)),
|
|
118
|
-
('done', 'Done', 'done', ('done',)))
|
|
124
|
+
('done', 'Done, not seen', 'done', ('done',)))
|
|
119
125
|
# The section headers drawn even while empty (`── ▸ Working (0)`), once the workspace has an agent (cockpit v3 S2): a
|
|
120
126
|
# lane entering or leaving one of them then never adds or removes a header row above the lanes below it. Done is drawn
|
|
121
127
|
# only with a member — it sits below both, so its header coming and going moves no attention row.
|
|
@@ -218,11 +224,20 @@ PROMPT_WORDS = {'close': 'close', 'promote': 'register', 'hide': 'hide', 'rename
|
|
|
218
224
|
# key — the Enter cancels, so a second Enter opens the lane instead of confirming — and a field a letter opened
|
|
219
225
|
# (`m`, `P`) takes no letter in that time either: `h⏎`, `xy⏎` or `make it so⏎` typed at speed act on nothing.
|
|
220
226
|
# Esc cancels at any time.
|
|
227
|
+
# * The phone (E2, BEY-8667): Type here sends the picker one letter per read, about 0.3 s apart, so on a phone with
|
|
228
|
+
# no prompt open (Add to workspace has none) the FIRST printable key outside PHONE_BURST_FREE (j k /: Space is
|
|
229
|
+
# counted) starts the state; PHONE_QUIET_S of silence, Enter or a tap (a button-0 press) ends it; an Enter within
|
|
230
|
+
# PHONE_QUIET_S of the Enter that ended it is swallowed too (a blank line opens nothing); the footer says
|
|
231
|
+
# ` Typing? Tap a lane to type in it`. While Add to workspace is open `y` is free, so its quick row's y, then Enter,
|
|
232
|
+
# still registers, and the footer says ` Typing? Tap Cancel to stop adding` (its rows register on a tap). `r` types like any letter, an update offered or not. A confirmation keeps the desktop's count.
|
|
221
233
|
BURST_WINDOW_S = 0.3
|
|
222
234
|
BURST_KEYS = 3
|
|
223
235
|
BURST_QUIET_S = 0.5
|
|
224
236
|
BURST_FREE = 'jk /'
|
|
225
237
|
INTENT_VERBS = ('hide', 'rename')
|
|
238
|
+
# The phone's quiet time and free keys (E2): a sentence's Enter may follow a pause; Space is counted.
|
|
239
|
+
PHONE_QUIET_S = 2.0
|
|
240
|
+
PHONE_BURST_FREE = 'jk/'
|
|
226
241
|
# The owner's profile (cockpit v3 R3, LNS-76): users/<login>.json (libexec/users.py) of the person this device belongs
|
|
227
242
|
# to. Opening a lane writes its mark there through users.update, which holds the profile's lock; the CLI waits up to
|
|
228
243
|
# users.LOCK_S (1 s) for it, a sidebar only PROFILE_LOCK_S — every writer holds it for milliseconds (read, merge, one
|
|
@@ -660,6 +675,9 @@ def resolve_modes(env, meta):
|
|
|
660
675
|
return color, theme, glyphs
|
|
661
676
|
|
|
662
677
|
|
|
678
|
+
SIDEBAR_ORDERS = ('attention', 'coordinator', 'pinned')
|
|
679
|
+
|
|
680
|
+
|
|
663
681
|
def layered_look(profile_look, meta):
|
|
664
682
|
"""devices/<device>.json as resolve_modes and resolve_dim_notify read it on a device with an owner (cockpit v3 R3,
|
|
665
683
|
LNS-76): the person's profile look over the device file's, except where the device keeps a key for itself. Per key
|
|
@@ -739,7 +757,8 @@ def file_stamp(path):
|
|
|
739
757
|
"""(st_ino, st_mtime_ns, st_size) of `path`, or 0 when it cannot be stat()ed. For a file replaced by rename
|
|
740
758
|
(users.update -> atomic_write: a new temp file, created while the old one still exists, then renamed over it) every
|
|
741
759
|
write has a new inode, so two writes inside one timestamp tick of the file system still differ — an mtime alone
|
|
742
|
-
reads them as one (DEF-1972).
|
|
760
|
+
reads them as one (DEF-1972). reload() keys the profile, the device file and its status source on it: statusd
|
|
761
|
+
publishes the projections the same way, and its mtime alone missed a republish inside one tick (BEY-7606)."""
|
|
743
762
|
try:
|
|
744
763
|
info = os.stat(path)
|
|
745
764
|
except OSError:
|
|
@@ -823,7 +842,7 @@ KEY_SHEET = (('↑ ↓ j k', 'Up Dn j k', 'move'), ('⏎ → Space', 'Enter Spc'
|
|
|
823
842
|
('J K', 'J K', 'open next / prev lane'), ('Tab S-Tab', 'Tab S-Tab', 'next / prev needing you'),
|
|
824
843
|
('2 3', '2 3', 'show in viewport 2 / 3'), ('/ @', '/ @', 'find / addresses'),
|
|
825
844
|
('Esc', 'Esc', 'cancel, back to lane'), ('g G', 'g G', 'first / last'),
|
|
826
|
-
('+ U d', '+ U d', 'shell / upload / docs'), ('a', 'a', 'add
|
|
845
|
+
('+ U d', '+ U d', 'shell / upload / docs'), ('a ,', 'a ,', 'add / sidebar order'),
|
|
827
846
|
('x', 'x', 'close (y, then Enter)'), ('u z', 'u z', 'unregister / undo 10 s'),
|
|
828
847
|
('R m', 'R m', 'rename ⏎ / message', 'rename Enter / message'), ('P', 'P', 'register a session'),
|
|
829
848
|
('p o', 'p o', 'pin / show hidden lanes'), ('h H', 'h H', 'hide lane / tab ⏎', 'hide lane / tab Enter'),
|
|
@@ -971,12 +990,13 @@ def promote_job(promote, spawn, workspace, entry, registry_path, name):
|
|
|
971
990
|
return (new_id if isinstance(new_id, str) else None), sync
|
|
972
991
|
|
|
973
992
|
|
|
974
|
-
MESSAGE_TIMEOUT_S = 30 # `lanes message` on the worker: resolve, write the inbox
|
|
993
|
+
MESSAGE_TIMEOUT_S = 30 # `lanes message` on the worker: resolve, write the inbox (never typed: BEY-7538)
|
|
975
994
|
|
|
976
995
|
|
|
977
996
|
def message_job(run, lane_id, text, login, state):
|
|
978
997
|
"""`m`'s send, on the worker (W15 L4): `lanes message [--from <login>] <lane id> <text>` -> its answer line (what the
|
|
979
|
-
footer says:
|
|
998
|
+
footer says: queued in the lane's inbox until its agent reads it — a message never types into a terminal,
|
|
999
|
+
BEY-7538). A refusal raises LanesError with the verb's own words.
|
|
980
1000
|
The verb reads the state directory this sidebar reads (LANES_STATE = `state`)."""
|
|
981
1001
|
argv = [LANES_BIN, 'message'] + (['--from', login] if login else []) + ['--', lane_id, text]
|
|
982
1002
|
try:
|
|
@@ -1034,10 +1054,11 @@ class Sidebar:
|
|
|
1034
1054
|
# reading for the keys being handled, `key_typed` whether the key being dispatched is a printable one;
|
|
1035
1055
|
# `stage_typed_at` the `key_now` of the printable key that opened the prompt's current stage (None: Enter, a click
|
|
1036
1056
|
# or no key at all opened it); `burst` the stamps of the counted keys inside BURST_WINDOW_S; `typing` the typing
|
|
1037
|
-
# state and `typing_at` the stamp of its last key
|
|
1057
|
+
# state and `typing_at` the stamp of its last key; `typing_ended_at` the stamp of the Enter that ended it, kept
|
|
1058
|
+
# through a blank line's Enter and cleared by any other key (E2: a phone's blank line).
|
|
1038
1059
|
key_clock = staticmethod(time.monotonic)
|
|
1039
1060
|
key_now, key_typed, stage_typed_at = 0.0, False, None
|
|
1040
|
-
burst, typing, typing_at = (), False, 0.0
|
|
1061
|
+
burst, typing, typing_at, typing_ended_at = (), False, 0.0, None
|
|
1041
1062
|
economy = {} # read-only default; reload() assigns the loaded economy.json (load_economy)
|
|
1042
1063
|
economy_tiers = '' # this workspace's tier mix from economy.json, `F2 S1` (reload)
|
|
1043
1064
|
more_row = 0 # the 1-based screen row of `⋮ N more` (render), 0 = the list fits
|
|
@@ -1062,6 +1083,9 @@ class Sidebar:
|
|
|
1062
1083
|
# taken yet (its lock was busy), written again by poll_profile at `profile_retry_at` (time.monotonic()).
|
|
1063
1084
|
login, profile_path = None, None
|
|
1064
1085
|
profile_look, device_meta = {}, {}
|
|
1086
|
+
sidebar_order = 'attention'
|
|
1087
|
+
extended_keys = False
|
|
1088
|
+
remembered_workspace_tab = None
|
|
1065
1089
|
profile_workspaces = {} # the profile's `workspaces{order, hidden}` (R4, LNS-77): the phone's owner board
|
|
1066
1090
|
# The profile's `lanes{pins, hidden}` (cockpit v3 R5, LNS-78; read-only defaults, take_arrangement assigns fresh
|
|
1067
1091
|
# sets) and `o`'s toggle: hidden lanes shown again, faint.
|
|
@@ -1139,6 +1163,7 @@ class Sidebar:
|
|
|
1139
1163
|
self.workspaces, self.registration, self.registration_choices = [], None, []
|
|
1140
1164
|
self.status, self.unregistered, self.zmx = {}, [], []
|
|
1141
1165
|
self.cursor, self.top = 0, 0
|
|
1166
|
+
self.mobile_body = 0 # E11a: the phone's lanes per screen, set by render_mobile (0: no frame drawn yet)
|
|
1142
1167
|
self.filter, self.filtering = '', False
|
|
1143
1168
|
self.prompt = None
|
|
1144
1169
|
self.undo = None
|
|
@@ -1278,8 +1303,12 @@ class Sidebar:
|
|
|
1278
1303
|
self.self_swap()
|
|
1279
1304
|
# The device file's field is file_stamp, like the profile's: `lanes attach` replaces it by rename, and two
|
|
1280
1305
|
# writes inside one timestamp tick (a --device-only key, then the same flag without it) differ only by inode
|
|
1281
|
-
# and size; an mtime alone kept the first look (DEF-1972's mechanism on the device file).
|
|
1282
|
-
|
|
1306
|
+
# and size; an mtime alone kept the first look (DEF-1972's mechanism on the device file). The status source's
|
|
1307
|
+
# field is file_stamp too (BEY-7606): statusd replaces the directory, the board file and status.json by
|
|
1308
|
+
# rename, and an mtime alone read a directory republished inside one tick as the one shown, so the board never
|
|
1309
|
+
# repainted. statusd also stamps each projection's mtime with its publish stamp, max(now_ns, last + 1)
|
|
1310
|
+
# (lanes_lib.atomic_write_stamped), so this one stat per tick sees every publish.
|
|
1311
|
+
stamp = (mtime(self.registry_path), file_stamp(self.status_path),
|
|
1283
1312
|
sum(mtime(self.slot_file(slot, 'target')) for slot in SLOTS[:self.viewports]),
|
|
1284
1313
|
file_stamp(self.look_path), mtime(self.economy_path), mtime(self.command_path), self.profile_stamp(),
|
|
1285
1314
|
self.canonical_stamp())
|
|
@@ -1498,16 +1527,20 @@ class Sidebar:
|
|
|
1498
1527
|
|
|
1499
1528
|
def version_note(self, cols):
|
|
1500
1529
|
"""The footer's version rung (cockpit v3 V2), '' while this sidebar runs the installed tree (or either version
|
|
1501
|
-
is unknown, or an update is ready — footer_text's `update ready · reload (r)`
|
|
1502
|
-
|
|
1530
|
+
is unknown, or an update is ready — footer_text's `update ready · reload (r)` on the desktop, ` update ready` on
|
|
1531
|
+
a phone, whose `r` types since E2, says it then): ` server 1.2.0 · view 1.1.0 — press ?`; at the sidebar's 36
|
|
1532
|
+
columns `press` gives way (` — ?`), then the hint; a longer pair is clipped by footer_text. A phone says the
|
|
1533
|
+
versions only (E2: its `?` types and it draws no key sheet). Every separator is a mark: seven-bit in ASCII."""
|
|
1503
1534
|
current, tree = self.current_version, self.tree_version
|
|
1504
1535
|
# A pending rebuild (W9 U6's update ready, poll_update) is the rung that says what to do: `r` brings this view
|
|
1505
|
-
# onto the installed release, so the note gives way to it rather
|
|
1536
|
+
# onto the installed release (the desktop's `r`; a phone's types since E2), so the note gives way to it rather
|
|
1537
|
+
# than hiding it above the message.
|
|
1506
1538
|
if not current or not tree or current == tree or self.update_ready:
|
|
1507
1539
|
return ''
|
|
1508
1540
|
g = self.glyphs['marks']
|
|
1509
1541
|
head = f' server {current} {g["sep"]} view {tree}'
|
|
1510
|
-
|
|
1542
|
+
tails = ('',) if self.mobile else (f' {g["dash"]} press ?', f' {g["dash"]} ?', '')
|
|
1543
|
+
for tail in tails:
|
|
1511
1544
|
if cell_width(head + tail) <= cols - 1:
|
|
1512
1545
|
return head + tail
|
|
1513
1546
|
return head
|
|
@@ -1576,6 +1609,8 @@ class Sidebar:
|
|
|
1576
1609
|
On a device with an owner `meta` is layered_look's (cockpit v3 R3): the owner's profile beneath the device
|
|
1577
1610
|
file's --device-only keys, and this runs when either changes — a look recorded on another of the person's
|
|
1578
1611
|
devices included."""
|
|
1612
|
+
order = (meta or {}).get('sidebar_order')
|
|
1613
|
+
self.sidebar_order = order if order in SIDEBAR_ORDERS else 'attention'
|
|
1579
1614
|
color, theme, glyphs = resolve_modes(os.environ, meta)
|
|
1580
1615
|
dim, notify = resolve_dim_notify(os.environ, meta)
|
|
1581
1616
|
handles = resolve_handles(os.environ, meta) # W15 L2: where the rows draw the lane's handle
|
|
@@ -1684,6 +1719,13 @@ class Sidebar:
|
|
|
1684
1719
|
observed = visibility.snapshot(json.loads(out), self.mobile_titles, self.mobile)
|
|
1685
1720
|
except (ValueError, KeyError, TypeError):
|
|
1686
1721
|
return
|
|
1722
|
+
if self.mobile and self.device_meta.get('workspace_keys') == 'on':
|
|
1723
|
+
active = [(board, role) for kind, role in (('sidebars', 'picker'), ('viewports', 'view'))
|
|
1724
|
+
for board in observed[kind] if board in self.board_titles]
|
|
1725
|
+
if len(active) == 1 and active[0] != self.remembered_workspace_tab:
|
|
1726
|
+
board, role = active[0]
|
|
1727
|
+
L.atomic_write_if_changed(Path(self.view_dir) / f'{board}.last-tab', role)
|
|
1728
|
+
self.remembered_workspace_tab = active[0]
|
|
1687
1729
|
L.atomic_write(Path(self.view_dir) / 'visibility.json', json.dumps(observed))
|
|
1688
1730
|
for workspace in observed['viewports']:
|
|
1689
1731
|
shown = Path(self.view_dir) / f'{workspace}.main.shown'
|
|
@@ -2184,11 +2226,21 @@ class Sidebar:
|
|
|
2184
2226
|
|
|
2185
2227
|
def throttle_spec(self, now):
|
|
2186
2228
|
"""The Throttle row: (head after the lead mark, parts, worst role). Tokened: `$8.5k/16k 53% · 429 +4 · spill
|
|
2187
|
-
76%`; else `up · spill 76% · 429 +4`; `
|
|
2188
|
-
|
|
2229
|
+
76%`; else `up · spill 76% · 429 +4`; `cannot reach · <host:port>` in the attention tone when the pulse's GET
|
|
2230
|
+
never reached a daemon (L.pulse_unreached: connection refused, timed out, unreachable — the daemon is not known
|
|
2231
|
+
to be down, the pulse's control URL is not forwarded to it; BEY-6845), the host:port its `control_url` names
|
|
2232
|
+
(a pulse from before the key: the word alone); `down · <error>` in the urgent tone when a daemon answered and
|
|
2233
|
+
refused (`HTTP 503`); `no pulse` before statusd has published one. Spill is the most-spilling pool's, shown
|
|
2234
|
+
above 0 %."""
|
|
2189
2235
|
facts = self.throttle_facts
|
|
2190
2236
|
if not facts:
|
|
2191
2237
|
return 'throttle', [[('no pulse', 'ink-dim')]], 'ink-dim'
|
|
2238
|
+
if facts.get('up') is False and L.pulse_unreached(facts.get('error')):
|
|
2239
|
+
parts = [[('cannot reach', 'tone-attention')]]
|
|
2240
|
+
where = short_name(L.pulse_control_host(facts.get('control_url')), 24)
|
|
2241
|
+
if where:
|
|
2242
|
+
parts.append([(where, 'ink-dim')])
|
|
2243
|
+
return 'throttle', parts, 'tone-attention'
|
|
2192
2244
|
if facts.get('up') is False:
|
|
2193
2245
|
parts = [[('down', 'tone-urgent')]]
|
|
2194
2246
|
error = short_name(facts.get('error'), 24)
|
|
@@ -2210,7 +2262,11 @@ class Sidebar:
|
|
|
2210
2262
|
"""A provider's row: (head, parts, worst). The availability bar — usable/configured over BAR_CELLS cells, usable
|
|
2211
2263
|
▰ cooling ▱ benched ▪ dead · each in its tone (bar_segments, bar_cells) — and, after one blank, `12/19` (the
|
|
2212
2264
|
attention tone while none of a configured pool is usable; a pool with nothing configured is no alarm), then the
|
|
2213
|
-
tokened pulse's worst `wk N%` / `5h N%` utilization and the soonest reset. `no data` without the pool.
|
|
2265
|
+
tokened pulse's worst `wk N%` / `5h N%` utilization and the soonest reset. `no data` without the pool. `?`, the
|
|
2266
|
+
unknown mark, while the pulse's last document says the daemon did not answer (`up: false`): the pool's kept
|
|
2267
|
+
facts are the last measured ones, not this cycle's, so no bar is drawn from them (BEY-6845)."""
|
|
2268
|
+
if self.throttle_facts.get('up') is False:
|
|
2269
|
+
return word, [[('?', 'ink-dim')]], 'ink-dim'
|
|
2214
2270
|
pools = self.throttle_facts.get('pools')
|
|
2215
2271
|
pool = pools.get(key) if isinstance(pools, dict) else None
|
|
2216
2272
|
segments = bar_segments(pool)
|
|
@@ -2624,9 +2680,50 @@ class Sidebar:
|
|
|
2624
2680
|
text = text.removesuffix(reset)
|
|
2625
2681
|
return f'{band}{text.replace(reset, reset + band)}{reset}'
|
|
2626
2682
|
|
|
2627
|
-
def
|
|
2683
|
+
def numbered_workspace(self, number):
|
|
2684
|
+
import workspace_keys
|
|
2685
|
+
try:
|
|
2686
|
+
slots = workspace_keys.projection(self.device, self.device_meta, {'workspaces': self.workspaces},
|
|
2687
|
+
{'workspaces': self.profile_workspaces})
|
|
2688
|
+
tabs = slots[number - 1]['tabs'] if number <= len(slots) else {}
|
|
2689
|
+
remembered = None
|
|
2690
|
+
if self.mobile and tabs:
|
|
2691
|
+
try:
|
|
2692
|
+
remembered = (Path(self.view_dir) / (slots[number - 1]['board'] + '.last-tab')).read_text()
|
|
2693
|
+
except OSError:
|
|
2694
|
+
pass
|
|
2695
|
+
selected = tabs.get(remembered) or tabs.get('picker') or tabs.get('view')
|
|
2696
|
+
if not selected:
|
|
2697
|
+
self.message = f'Workspace {number} unavailable'
|
|
2698
|
+
return
|
|
2699
|
+
cmd = [os.environ.get('LANES_ZELLIJ') or 'zellij', '-s', self.device, 'action', 'go-to-tab-by-id']
|
|
2700
|
+
code, _, _ = L.run_bounded(cmd + [str(selected['id'])], 2)
|
|
2701
|
+
if code != 0:
|
|
2702
|
+
self.message = 'Workspace unavailable'
|
|
2703
|
+
except (L.LanesError, OSError, ValueError, TypeError, KeyError):
|
|
2704
|
+
self.message = 'Workspace list unavailable'
|
|
2705
|
+
self.dirty = True
|
|
2706
|
+
|
|
2707
|
+
def cycle_order(self):
|
|
2708
|
+
try:
|
|
2709
|
+
with L.sessions_lock(PROFILE_LOCK_S, 'sidebar order'):
|
|
2710
|
+
meta = read_json(self.look_path)
|
|
2711
|
+
if not isinstance(meta, dict):
|
|
2712
|
+
raise L.LanesError('unknown device')
|
|
2713
|
+
current = meta.get('sidebar_order')
|
|
2714
|
+
index = SIDEBAR_ORDERS.index(current) if current in SIDEBAR_ORDERS else 0
|
|
2715
|
+
order = SIDEBAR_ORDERS[(index + 1) % len(SIDEBAR_ORDERS)]
|
|
2716
|
+
L.atomic_write(Path(self.look_path), json.dumps(dict(meta, sidebar_order=order)) + '\n')
|
|
2717
|
+
except (ValueError, OSError, L.LanesError) as error:
|
|
2718
|
+
self.message = str(error)
|
|
2719
|
+
else:
|
|
2720
|
+
self.sidebar_order = order
|
|
2721
|
+
self.message = f'{order.capitalize()} first'
|
|
2722
|
+
self.dirty = True
|
|
2723
|
+
|
|
2724
|
+
def sectioned(self, lanes, order=None):
|
|
2628
2725
|
"""Registry lanes in attention order (spec §4.4, cockpit v3 S2): Needs you (by urgency, then in the order the
|
|
2629
|
-
lanes ENTERED the section), Working (entry order), Done (newest entry first
|
|
2726
|
+
lanes ENTERED the section), Working (entry order), Done, not seen (newest entry first), then the rest in
|
|
2630
2727
|
registry order under a workspace header. Shared by the desktop and the phone (render_mobile draws this list).
|
|
2631
2728
|
|
|
2632
2729
|
The entry stamp is statusd's `agent.stable_since` (agent_rows; `since` from a statusd older than S1). It moves
|
|
@@ -2641,8 +2738,19 @@ class Sidebar:
|
|
|
2641
2738
|
A lane the owner pinned (cockpit v3 R5) leads its section — the pinned ones in registry order, then the others
|
|
2642
2739
|
in the order above — in the remainder and the single list alike."""
|
|
2643
2740
|
buckets, rest, agents, pins = {key: [] for key, *_ in ATTENTION}, [], False, self.lane_pins
|
|
2741
|
+
mode = order or self.sidebar_order
|
|
2742
|
+
promoted = {'Coordinator': [], 'Pinned': []}
|
|
2743
|
+
lead = 'coordinator'
|
|
2744
|
+
if mode == 'coordinator' and not any(lane_role(self.status.get(e['id'])) == lead for e in lanes):
|
|
2745
|
+
lead = 'fleet_admin'
|
|
2644
2746
|
for index, (entry, status, entered, key) in enumerate(self.agent_rows(lanes)):
|
|
2645
2747
|
agents = agents or status not in (None, 'shell')
|
|
2748
|
+
if mode == 'coordinator' and lane_role(self.status.get(entry['id'])) == lead:
|
|
2749
|
+
promoted['Coordinator'].append(entry)
|
|
2750
|
+
continue
|
|
2751
|
+
if mode != 'attention' and entry['id'] in pins:
|
|
2752
|
+
promoted['Pinned'].append(entry)
|
|
2753
|
+
continue
|
|
2646
2754
|
if key is None:
|
|
2647
2755
|
rest.append(entry)
|
|
2648
2756
|
continue
|
|
@@ -2658,9 +2766,13 @@ class Sidebar:
|
|
|
2658
2766
|
buckets[key].append((order, status, entry))
|
|
2659
2767
|
if pins:
|
|
2660
2768
|
rest = [e for e in rest if e.get('id') in pins] + [e for e in rest if e.get('id') not in pins]
|
|
2661
|
-
if not agents:
|
|
2662
|
-
return rest
|
|
2663
2769
|
out = []
|
|
2770
|
+
for label, group in promoted.items():
|
|
2771
|
+
if group:
|
|
2772
|
+
out.append({'id': '', 'divider': True, 'section': label.lower(), 'name': f'{label} ({len(group)})'})
|
|
2773
|
+
out.extend(group)
|
|
2774
|
+
if not agents:
|
|
2775
|
+
return out + rest
|
|
2664
2776
|
for key, title, _glyph, _members in ATTENTION:
|
|
2665
2777
|
bucket = sorted(buckets[key], key=itemgetter(0))
|
|
2666
2778
|
if bucket or key in ALWAYS_DRAWN:
|
|
@@ -2716,7 +2828,10 @@ class Sidebar:
|
|
|
2716
2828
|
def needs_you(self):
|
|
2717
2829
|
"""The visible lanes whose agent needs you, in section order (approval, errored, input; oldest first)."""
|
|
2718
2830
|
out = []
|
|
2719
|
-
|
|
2831
|
+
visible = self.visible()
|
|
2832
|
+
if self.sidebar_order != 'attention' and not self.filter and not self.registration:
|
|
2833
|
+
visible = self.sectioned(self.shown_lanes(), 'attention') + list(self.zmx or ()) + list(self.unregistered or ())
|
|
2834
|
+
for entry in visible:
|
|
2720
2835
|
agent = None if entry.get('divider') else (self.status.get(entry.get('id', '')) or {}).get('agent')
|
|
2721
2836
|
if isinstance(agent, dict) and agent.get('status') in NEEDS_YOU:
|
|
2722
2837
|
out.append(entry)
|
|
@@ -2790,13 +2905,16 @@ class Sidebar:
|
|
|
2790
2905
|
# lead a section, never the matches).
|
|
2791
2906
|
lanes = self.shown_lanes()
|
|
2792
2907
|
entries = list(lanes) if self.filter else self.sectioned(lanes)
|
|
2793
|
-
hidden
|
|
2908
|
+
# E2 (R7): a phone keeps the row while the hidden lanes show, so a second tap on it hides them again.
|
|
2909
|
+
hidden = 0 if self.filter or (self.show_hidden and not self.mobile) else self.hidden_count()
|
|
2794
2910
|
if hidden:
|
|
2795
2911
|
# BEY-7248: a hidden lane is never invisible — one row at the bottom of the lanes says how many (no names)
|
|
2796
|
-
# and how to see them; a divider: no cursor mark, a click on it opens nothing (Rust: Entry::Hidden).
|
|
2797
|
-
|
|
2912
|
+
# and how to see them; a divider: no cursor mark, a click on it opens nothing (Rust: Entry::Hidden). On a
|
|
2913
|
+
# phone a tap on it shows them, or hides them again (E2: the phone's picker takes no `o`).
|
|
2914
|
+
sep, them = f' {self.glyphs["marks"]["sep"]} ', 'it' if hidden == 1 else 'them'
|
|
2915
|
+
hint = f'tap {"hides" if self.show_hidden else "shows"}' if self.mobile else 'o shows'
|
|
2798
2916
|
entries.append({'id': '', 'divider': True, 'hidden_row': True,
|
|
2799
|
-
'name': f'hidden ({hidden}){sep}
|
|
2917
|
+
'name': f'hidden ({hidden}){sep}{hint} {them}'})
|
|
2800
2918
|
if self.zmx:
|
|
2801
2919
|
entries.append({'id': '', 'divider': True, 'name': f'zmx lanes ({len(self.zmx)})'})
|
|
2802
2920
|
entries += self.zmx
|
|
@@ -3211,8 +3329,8 @@ class Sidebar:
|
|
|
3211
3329
|
|
|
3212
3330
|
def commit_message(self):
|
|
3213
3331
|
"""Enter on the message field: `lanes message` from this device's owner (`host:<login>`) to the lane, on the
|
|
3214
|
-
worker (message_job) —
|
|
3215
|
-
The footer says
|
|
3332
|
+
worker (message_job) — queued in its inbox until its agent reads it, never typed into the lane (BEY-7538).
|
|
3333
|
+
The footer says so once the verb answers; the keyboard goes back to the lane now."""
|
|
3216
3334
|
prompt = self.close_prompt()
|
|
3217
3335
|
entry, text = prompt.get('entry'), prompt.get('value', '').strip()
|
|
3218
3336
|
if not entry or not text:
|
|
@@ -3227,7 +3345,7 @@ class Sidebar:
|
|
|
3227
3345
|
self.release_focus()
|
|
3228
3346
|
|
|
3229
3347
|
def messaged(self, action, ok, value):
|
|
3230
|
-
"""`m`'s answer: the verb's own line (` message …
|
|
3348
|
+
"""`m`'s answer: the verb's own line (` message … queued — …`), or why it refused."""
|
|
3231
3349
|
self.message = (value if isinstance(value, str) and value else 'sent') if ok else failure_text(value)
|
|
3232
3350
|
|
|
3233
3351
|
def start_promote(self, entry):
|
|
@@ -3743,18 +3861,20 @@ class Sidebar:
|
|
|
3743
3861
|
return (lines + lanes + [''] * body)[:body]
|
|
3744
3862
|
|
|
3745
3863
|
def toggle_hidden(self):
|
|
3746
|
-
"""`o
|
|
3747
|
-
The footer says how many; then the keyboard goes back to the lane.
|
|
3864
|
+
"""`o`, or a tap on a phone's hidden row (E2): show the lanes the owner hid (faint, in their places; `h` there
|
|
3865
|
+
shows one for good) or hide them again. The footer says how many; then the keyboard goes back to the lane. A
|
|
3866
|
+
phone names the tap, not `o`; while they show it names nothing: the row it keeps says `tap hides them`."""
|
|
3748
3867
|
self.begin_action()
|
|
3749
3868
|
self.show_hidden, self.dirty = not self.show_hidden, True
|
|
3750
3869
|
count = self.hidden_count()
|
|
3751
3870
|
g = self.glyphs['marks']
|
|
3871
|
+
them = 'it' if count == 1 else 'them'
|
|
3752
3872
|
if not count:
|
|
3753
3873
|
self.message = 'no hidden lanes'
|
|
3754
3874
|
elif self.show_hidden:
|
|
3755
|
-
self.message = f'showing {count} hidden {g["sep"]} o hides {
|
|
3875
|
+
self.message = f'showing {count} hidden' + ('' if self.mobile else f' {g["sep"]} o hides {them}')
|
|
3756
3876
|
else:
|
|
3757
|
-
self.message = f'{count} hidden {g["sep"]}
|
|
3877
|
+
self.message = f'{count} hidden {g["sep"]} {"tap" if self.mobile else "o"} shows {them}'
|
|
3758
3878
|
self.release_focus()
|
|
3759
3879
|
|
|
3760
3880
|
def hidden_count(self):
|
|
@@ -3811,7 +3931,7 @@ class Sidebar:
|
|
|
3811
3931
|
put back under Unregistered with the SAME id (keep_moved_row), so the cursor that was on the lane follows it
|
|
3812
3932
|
there, and statusd's next cycle lists the session under that id. A session that no longer runs leaves the list
|
|
3813
3933
|
(nothing will be listed) and the cursor keeps its row. Then the keyboard goes back to the lane, as after every
|
|
3814
|
-
action that ends (S3) — `z` is pressed on the sidebar (Ctrl-Alt-l;
|
|
3934
|
+
action that ends (S3) — `z` is pressed on the sidebar (Ctrl-Alt-l; a phone's picker types `u` and `z` since E2).
|
|
3815
3935
|
A lane a repository's terminals.json declares is taken out of that file (session_actions.unregister_lane, the
|
|
3816
3936
|
Agent API's minimal-text editor, M4 — wired at the fan-in): its terminal goes, the session keeps running and
|
|
3817
3937
|
`lanes sync`, started here, lists it under Unregistered; there is no `z` for it (the file's
|
|
@@ -4134,9 +4254,10 @@ class Sidebar:
|
|
|
4134
4254
|
first: the prompt (prompt_text) › the Add to workspace picker › the filter › the health banner (a frozen
|
|
4135
4255
|
picture must never look live) › the version note (version_note, cockpit v3 V2; not while an update is ready)
|
|
4136
4256
|
› a registry error › the last message › the undo offer (undo_text, cockpit v3 S7) › `update ready · reload
|
|
4137
|
-
(r)` (W9 U6: the installed release lays this view out differently; `r` rebuilds it — the
|
|
4138
|
-
|
|
4139
|
-
|
|
4257
|
+
(r)` (W9 U6: the installed release lays this view out differently; `r` rebuilds it — in the accent; a phone
|
|
4258
|
+
says ` update ready` alone, its `r` types since E2) › the focus legend (desktop) › the idle hint. Only the
|
|
4259
|
+
picker's way out, the legend, the idle hint and, since E2, the update rung's key, the version note's `?` and the
|
|
4260
|
+
typing notice are a device's own. Every glyph, separator and quote is a mark, so the ASCII footer
|
|
4140
4261
|
is seven-bit. `footer_link` says which link footer_row draws this frame: the message's (`d`, plan W10 W7) while
|
|
4141
4262
|
the message is the rung shown, else none."""
|
|
4142
4263
|
tone, g = self.tone, self.glyphs['marks']
|
|
@@ -4163,7 +4284,8 @@ class Sidebar:
|
|
|
4163
4284
|
elif self.undo: # cockpit v3 S7: the `u` it undoes, until `z` or UNDO_S
|
|
4164
4285
|
text, style = self.undo_text(cols), tone['ink-dim']
|
|
4165
4286
|
elif self.update_ready: # W9 U6: the installed release lays this view out differently; `r` rebuilds it
|
|
4166
|
-
text
|
|
4287
|
+
text = ' update ready' if self.mobile else f' update ready{sep}reload (r)' # E2: a phone's `r` types
|
|
4288
|
+
style = tone['accent']
|
|
4167
4289
|
elif self.mobile:
|
|
4168
4290
|
text, style = f' Swipe to scroll{sep}Tap to open', tone['ink-dim']
|
|
4169
4291
|
elif legend: # 34 cells (35 in ASCII): the plan's ` ▌ keys go to the sidebar · …` is 38
|
|
@@ -4345,6 +4467,10 @@ class Sidebar:
|
|
|
4345
4467
|
except OSError:
|
|
4346
4468
|
cols, rows = 36, 24
|
|
4347
4469
|
self.size = (cols, rows)
|
|
4470
|
+
enable_keys = self.device_meta.get('workspace_keys') == 'on'
|
|
4471
|
+
if enable_keys != self.extended_keys:
|
|
4472
|
+
sys.stdout.write('\033[>1u' if enable_keys else '\033[<u')
|
|
4473
|
+
self.extended_keys = enable_keys
|
|
4348
4474
|
if self.mobile:
|
|
4349
4475
|
self.render_mobile(cols, rows)
|
|
4350
4476
|
return
|
|
@@ -4469,6 +4595,7 @@ class Sidebar:
|
|
|
4469
4595
|
# W11: the fleet block above the footer, as on the desktop (fleet_block: the same rows, the phone's width)
|
|
4470
4596
|
block = self.fleet_block(cols, rows, time.time())
|
|
4471
4597
|
body = max(1, (rows - 3 - len(block)) // self.entry_height)
|
|
4598
|
+
self.mobile_body = body # E11a: a wheel report scrolls the view against this
|
|
4472
4599
|
self.box_top = self.entry_top + body * self.entry_height
|
|
4473
4600
|
self.top = max(0, min(self.top, self.cursor, len(entries) - body)) # bounded by the list, as in render()
|
|
4474
4601
|
if self.cursor >= self.top + body:
|
|
@@ -4490,7 +4617,7 @@ class Sidebar:
|
|
|
4490
4617
|
line(' ADD TO WORKSPACE', tone['bold'])
|
|
4491
4618
|
else:
|
|
4492
4619
|
line(counts or f' {len(self.shown_lanes())} lanes', tone['ink-dim'] if self.banner or not counts else tone['bold'])
|
|
4493
|
-
line()
|
|
4620
|
+
line(' Order: ' + self.sidebar_order.capitalize() + ' first' if not self.registration else '', tone['ink-dim'])
|
|
4494
4621
|
now, sep = time.time(), f' {marks["sep"]} ' # every ` · ` is the sep mark: the ASCII frame stays seven-bit
|
|
4495
4622
|
self.clock_sig = self.clock_signature(entries, now) # C7: what time changes in this frame (poll_clock)
|
|
4496
4623
|
for index in range(self.top, self.top + body):
|
|
@@ -4517,11 +4644,12 @@ class Sidebar:
|
|
|
4517
4644
|
else:
|
|
4518
4645
|
# Row A: column 2 the viewing mark (accent), column 3 the agent glyph in its tone (ink-dim while the
|
|
4519
4646
|
# status is stale), the name bold in its identity colour. The `›` touch cursor is gone (the cursor
|
|
4520
|
-
# still moves with J
|
|
4521
|
-
# is the one surface where the operator cannot also see the Studio tab
|
|
4522
|
-
# the desktop row's columns, `cols − 8` and `cols − 1` (cockpit v3 S5;
|
|
4523
|
-
# then), inside the hit boxes handle() shares with it; the name still
|
|
4524
|
-
# is registering (cockpit v3 S8) has the dim `pending` mark in column 2
|
|
4647
|
+
# still moves with j / k; J and K type since E2). The viewer dots are the sidebar's rule, not the
|
|
4648
|
+
# desktop render's: the phone is the one surface where the operator cannot also see the Studio tab
|
|
4649
|
+
# (DEF-983). `+` and `×` sit at the desktop row's columns, `cols − 8` and `cols − 1` (cockpit v3 S5;
|
|
4650
|
+
# `cols − 6` / `cols − 2` until then), inside the hit boxes handle() shares with it; the name still
|
|
4651
|
+
# ends left of the `+`. A row `P` is registering (cockpit v3 S8) has the dim `pending` mark in column 2
|
|
4652
|
+
# and neither control.
|
|
4525
4653
|
pending = bool(entry.get('pending'))
|
|
4526
4654
|
closable = bool(entry.get('closable')) and not pending
|
|
4527
4655
|
can_register = closable and R.eligible(entry)
|
|
@@ -4545,7 +4673,7 @@ class Sidebar:
|
|
|
4545
4673
|
name, _ = clip(entry.get('name', entry['id']), width)
|
|
4546
4674
|
color = entry.get('color')
|
|
4547
4675
|
fg = f'\033[38;5;{color}m' if isinstance(color, int) and self.color != 'none' else ''
|
|
4548
|
-
if entry['id'] in self.lane_hidden: # shown by `o
|
|
4676
|
+
if entry['id'] in self.lane_hidden: # shown by `o`, on a phone a tap on the hidden row (R5, E2): faint
|
|
4549
4677
|
fg = tone['ink-faint']
|
|
4550
4678
|
close = f'\033[{max(1, cols - 1)}G{tone["tone-urgent"]}{marks["close"]}{reset}' if closable else ''
|
|
4551
4679
|
add = f'\033[{max(1, cols - 8)}G{tone["tone-done"]}{marks["new"]}{reset}' if can_register else ''
|
|
@@ -4581,8 +4709,10 @@ class Sidebar:
|
|
|
4581
4709
|
line()
|
|
4582
4710
|
self.block_top, self.block_rows = (rows - len(block) if block else 0), len(block)
|
|
4583
4711
|
out.extend(f'{row}\033[K\r\n' for row in block)
|
|
4584
|
-
# The footer the desktop draws (footer_text, cockpit v3 S6):
|
|
4585
|
-
# only the picker's way out (`Tap Cancel`) and
|
|
4712
|
+
# The footer the desktop draws (footer_text, cockpit v3 S6): the prompt (since E2 a phone opens only the close
|
|
4713
|
+
# question), Add to workspace, the filter, the banner, the message; only the picker's way out (`Tap Cancel`) and
|
|
4714
|
+
# the idle hint (`Swipe to scroll · Tap to open`) are the phone's, and since E2 the update rung and the version
|
|
4715
|
+
# note without their keys and the typing notice (footer_text).
|
|
4586
4716
|
out.append(self.footer_row(cols, entries) + '\033[K\033[J')
|
|
4587
4717
|
out.append(self.osc_bytes(target)) # the phone reads the counts from this pane's title; no OSC 9 here
|
|
4588
4718
|
sys.stdout.write(''.join(out))
|
|
@@ -4749,6 +4879,8 @@ class Sidebar:
|
|
|
4749
4879
|
"""The keys and mouse reports of one read, or of the part of it before / after a paste (handle())."""
|
|
4750
4880
|
if not data:
|
|
4751
4881
|
return
|
|
4882
|
+
if self.extended_keys:
|
|
4883
|
+
data = data.replace('\033[27u', '\033')
|
|
4752
4884
|
self.key_now, self.key_typed = self.key_clock(), False # BEY-7248: one reading for the keys of this read
|
|
4753
4885
|
entries = self.follow()
|
|
4754
4886
|
i = 0
|
|
@@ -4777,6 +4909,13 @@ class Sidebar:
|
|
|
4777
4909
|
if self.typed_burst(ch): # BEY-7248: a key of a typed sentence is no command
|
|
4778
4910
|
i += 1
|
|
4779
4911
|
continue
|
|
4912
|
+
if ch == '\033' and self.device_meta.get('workspace_keys') == 'on':
|
|
4913
|
+
chord = re.match(r'\x1b\[(49|5[0-7]);9u', data[i:])
|
|
4914
|
+
if chord:
|
|
4915
|
+
if not (self.prompt or self.filtering or self.armed or self.registration or self.typing):
|
|
4916
|
+
self.numbered_workspace(int(chord[1]) - 48)
|
|
4917
|
+
i += len(chord[0])
|
|
4918
|
+
continue
|
|
4780
4919
|
if self.prompt and ch == '\033':
|
|
4781
4920
|
# ONE escape sequence under the prompt, a name field or a confirmation (cockpit v3 S6 fix cycle 1,
|
|
4782
4921
|
# DEF-1824): consumed while the prompt stays, or handled as usual below — with the prompt cancelled
|
|
@@ -4805,11 +4944,27 @@ class Sidebar:
|
|
|
4805
4944
|
except ValueError:
|
|
4806
4945
|
button, y = -1, 0
|
|
4807
4946
|
pressed = rest[end] == 'M'
|
|
4947
|
+
if pressed and button == 0 and self.mobile:
|
|
4948
|
+
# E2 (BEY-8667): a tap ends the phone's typing state, and its blank line; then it acts
|
|
4949
|
+
self.typing, self.burst, self.typing_ended_at = False, [], None
|
|
4808
4950
|
# The wheel moves the cursor and never the focus (moves_focus); a release answers nothing.
|
|
4809
|
-
if button
|
|
4951
|
+
if self.mobile and button in (64, 65):
|
|
4952
|
+
# E11a (BEY-8667, the lane lead's ruling of 21 November 2026): the phone's client sends one
|
|
4953
|
+
# report per 24 px of a swipe (app.js:1340); each scrolls the view by ONE lane, clamped at both
|
|
4954
|
+
# ends (`max(0, …)` also when the list is shorter than the view), and the undrawn cursor is
|
|
4955
|
+
# kept inside it, so render_mobile does not drag the view back. Before the first frame nothing
|
|
4956
|
+
# moves. The desktop keeps its cursor moves of 3, below.
|
|
4957
|
+
if self.mobile_body:
|
|
4958
|
+
step = 1 if button == 65 else -1
|
|
4959
|
+
self.top = max(0, min(self.top + step, len(entries) - self.mobile_body))
|
|
4960
|
+
self.cursor = min(max(self.cursor, self.top), self.top + self.mobile_body - 1)
|
|
4961
|
+
elif button == 64:
|
|
4810
4962
|
self.cursor -= 3
|
|
4811
4963
|
elif button == 65:
|
|
4812
4964
|
self.cursor += 3
|
|
4965
|
+
elif (button == 0 and pressed and self.mobile and y == 2 and not
|
|
4966
|
+
(self.prompt or self.registration or self.filtering or self.armed)):
|
|
4967
|
+
self.cycle_order()
|
|
4813
4968
|
elif button == 0 and pressed and self.box and y >= self.box_top:
|
|
4814
4969
|
self.begin_action()
|
|
4815
4970
|
self.armed = True # the click also gave this pane the focus: the next drop lands here
|
|
@@ -4819,7 +4974,8 @@ class Sidebar:
|
|
|
4819
4974
|
elif button == 0 and pressed:
|
|
4820
4975
|
# A click that opens nothing — a section header, `⋮ N more`, the header row, an empty row —
|
|
4821
4976
|
# ends there: the keyboard goes back to the lane (cockpit v3 S3). `×` and `+` open a prompt,
|
|
4822
|
-
# which keeps it; a lane row opens the lane, which hands it off itself.
|
|
4977
|
+
# which keeps it; a lane row opens the lane, which hands it off itself. On a phone a tap on
|
|
4978
|
+
# the hidden row shows the hidden lanes or hides them again (E2: its picker takes no `o`).
|
|
4823
4979
|
row = (y - self.entry_top) // self.entry_height
|
|
4824
4980
|
index = self.top + row
|
|
4825
4981
|
if self.body_map is not None and 0 <= row < len(self.body_map):
|
|
@@ -4834,6 +4990,8 @@ class Sidebar:
|
|
|
4834
4990
|
elif (entries[index].get('closable') and R.eligible(entries[index])
|
|
4835
4991
|
and _x >= max(1, self.size[0] - 8)):
|
|
4836
4992
|
self.start_registration(entries[index])
|
|
4993
|
+
elif entries[index].get('hidden_row') and self.mobile:
|
|
4994
|
+
self.toggle_hidden()
|
|
4837
4995
|
elif entries[index].get('divider'):
|
|
4838
4996
|
self.release_focus()
|
|
4839
4997
|
else:
|
|
@@ -4935,6 +5093,8 @@ class Sidebar:
|
|
|
4935
5093
|
self.armed = True
|
|
4936
5094
|
elif ch == '+' and not self.registration and not self.attach_only:
|
|
4937
5095
|
self.new_shell()
|
|
5096
|
+
elif ch == ',' and not self.registration:
|
|
5097
|
+
self.cycle_order()
|
|
4938
5098
|
elif ch == 'a' and entries:
|
|
4939
5099
|
self.start_registration(entries[self.cursor])
|
|
4940
5100
|
elif ch == 'x' and entries:
|
|
@@ -4981,19 +5141,29 @@ class Sidebar:
|
|
|
4981
5141
|
def typed_burst(self, ch):
|
|
4982
5142
|
"""BEY-7248's typed-burst rule for ONE key of a read (`ch`, its first character), at `key_now` -> True when the
|
|
4983
5143
|
key is swallowed: part of a sentence typed into the sidebar, never a command. See BURST_* for the rule.
|
|
4984
|
-
* Silence: a typing state whose last key is BURST_QUIET_S old has ended; this key
|
|
5144
|
+
* Silence: a typing state whose last key is BURST_QUIET_S old (PHONE_QUIET_S on a phone) has ended; this key
|
|
5145
|
+
is a key again.
|
|
4985
5146
|
* Never typing: an escape sequence (Esc, an arrow, a mouse report — handle_keys reads it, and a bare Esc ends
|
|
4986
|
-
the state), the filter's text, a name field's text — save a letter within
|
|
4987
|
-
opened that field (`m`, `P`: the sentence went on into it).
|
|
5147
|
+
the state, as a phone's tap does), the filter's text, a name field's text — save a letter within
|
|
5148
|
+
BURST_WINDOW_S of the letter that opened that field (`m`, `P`: the sentence went on into it).
|
|
4988
5149
|
* While typing: every key is swallowed and keeps the state alive (and is still counted, so a sentence typed
|
|
4989
5150
|
right after the Enter is typing from its first letter); Enter ends it (the sentence's own Enter opens
|
|
4990
|
-
nothing).
|
|
5151
|
+
nothing). On a phone with no prompt open, an Enter within PHONE_QUIET_S of that Enter, no other key
|
|
5152
|
+
between, is swallowed too: a blank line opens nothing (E2).
|
|
4991
5153
|
* Otherwise a printable key outside BURST_FREE is counted; the BURST_KEYS-th inside BURST_WINDOW_S starts the
|
|
4992
|
-
state.
|
|
4993
|
-
|
|
5154
|
+
state. On a phone with no prompt open (E2, BEY-8667: Type here sends one letter per read, about 0.3 s apart)
|
|
5155
|
+
the first one starts it, outside PHONE_BURST_FREE (Space is counted; `y` is free while Add to workspace is
|
|
5156
|
+
open, for its quick row's y, then Enter); `r` counts like any letter there, an update offered or not. An
|
|
5157
|
+
open prompt ends first, as any other key would end it there: cancelled, the keyboard handed back to the
|
|
5158
|
+
lane (cockpit v3 S3) — no question survives a typed burst.
|
|
4994
5159
|
The footer says typing_text() for MESSAGE_S after the burst's last key."""
|
|
4995
5160
|
now, prompt = self.key_now, self.prompt
|
|
4996
|
-
|
|
5161
|
+
phone = self.mobile and not self.prompt
|
|
5162
|
+
quiet, free = (PHONE_QUIET_S, PHONE_BURST_FREE) if self.mobile else (BURST_QUIET_S, BURST_FREE)
|
|
5163
|
+
if phone and self.registration:
|
|
5164
|
+
free += 'y'
|
|
5165
|
+
ended, self.typing_ended_at = self.typing_ended_at, None
|
|
5166
|
+
if self.typing and now - self.typing_at >= quiet:
|
|
4997
5167
|
self.typing = False
|
|
4998
5168
|
if ch == '\033' or self.filtering:
|
|
4999
5169
|
return False
|
|
@@ -5003,16 +5173,21 @@ class Sidebar:
|
|
|
5003
5173
|
elif self.typing:
|
|
5004
5174
|
self.typing_at, self.dirty = now, True
|
|
5005
5175
|
if ch in '\r\n':
|
|
5006
|
-
self.typing = False
|
|
5007
|
-
elif ch.isprintable() and ch not in
|
|
5176
|
+
self.typing, self.typing_ended_at = False, now
|
|
5177
|
+
elif ch.isprintable() and ch not in free: # still counted: a next sentence at once is typing too
|
|
5008
5178
|
self.burst = [at for at in self.burst if now - at < BURST_WINDOW_S] + [now]
|
|
5009
5179
|
self.message = self.typing_text()
|
|
5010
5180
|
return True
|
|
5011
|
-
elif
|
|
5181
|
+
elif phone and ch in '\r\n' and ended is not None and now - ended < quiet:
|
|
5182
|
+
# The window stays the sentence's Enter's: a blank Enter does not start a new one.
|
|
5183
|
+
self.typing_ended_at, self.dirty = ended, True
|
|
5184
|
+
self.message = self.typing_text()
|
|
5185
|
+
return True
|
|
5186
|
+
elif not ch.isprintable() or ch in free:
|
|
5012
5187
|
return False
|
|
5013
5188
|
else:
|
|
5014
5189
|
self.burst = [at for at in self.burst if now - at < BURST_WINDOW_S] + [now]
|
|
5015
|
-
if len(self.burst) < BURST_KEYS:
|
|
5190
|
+
if len(self.burst) < (1 if phone else BURST_KEYS):
|
|
5016
5191
|
return False
|
|
5017
5192
|
if prompt:
|
|
5018
5193
|
self.cancel_prompt()
|
|
@@ -5024,7 +5199,14 @@ class Sidebar:
|
|
|
5024
5199
|
def typing_text(self):
|
|
5025
5200
|
"""The typed-burst notice (BEY-7248): ` Typing? ⏎ opens the lane · Esc` — the keys went to the sidebar, not the
|
|
5026
5201
|
lane; Enter (once the burst is over) opens the cursor lane and gives it the keyboard, Esc gives the keyboard
|
|
5027
|
-
back to the lane on view. 31 cells, 35 under ASCII glyphs (`Enter`): the 36-cell pane's whole footer row.
|
|
5202
|
+
back to the lane on view. 31 cells, 35 under ASCII glyphs (`Enter`): the 36-cell pane's whole footer row. A
|
|
5203
|
+
phone (E2, ruling R3) says ` Typing? Tap a lane to type in it`, 33 cells, seven-bit: its picker has no Esc
|
|
5204
|
+
key. While Add to workspace is open a phone says ` Typing? Tap Cancel to stop adding` (the lane lead's word of
|
|
5205
|
+
19 November 2026): its rows are workspaces, and a tap on one registers the session."""
|
|
5206
|
+
if self.mobile:
|
|
5207
|
+
if self.registration:
|
|
5208
|
+
return 'Typing? Tap Cancel to stop adding'
|
|
5209
|
+
return 'Typing? Tap a lane to type in it'
|
|
5028
5210
|
g = self.glyphs['marks']
|
|
5029
5211
|
return f'Typing? {g["enter"]} opens the lane {g["sep"]} Esc'
|
|
5030
5212
|
|
|
@@ -5127,7 +5309,7 @@ class Sidebar:
|
|
|
5127
5309
|
elif self.expire_carry(): # no read came: a held lone Esc is the Esc key (BEY-6842)
|
|
5128
5310
|
self.dirty = True
|
|
5129
5311
|
finally:
|
|
5130
|
-
sys.stdout.write(self.stop_bytes())
|
|
5312
|
+
sys.stdout.write(('\033[<u' if self.extended_keys else '') + self.stop_bytes())
|
|
5131
5313
|
sys.stdout.flush()
|
|
5132
5314
|
termios.tcsetattr(fd, termios.TCSADRAIN, saved)
|
|
5133
5315
|
|