@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.
Files changed (61) hide show
  1. package/package.json +1 -1
  2. package/payload/lanes/README.md +29 -11
  3. package/payload/lanes/VERSION +1 -1
  4. package/payload/lanes/bin/lanes +159 -59
  5. package/payload/lanes/bin-rs/BINARIES.json +2 -17
  6. package/payload/lanes/client/lanes-launch +51 -2
  7. package/payload/lanes/container/lane +142 -19
  8. package/payload/lanes/container/lane-mcp +168 -55
  9. package/payload/lanes/container/lane-peerd +6 -6
  10. package/payload/lanes/container/lane-signal +48 -3
  11. package/payload/lanes/container/lane_core.py +1040 -164
  12. package/payload/lanes/container/throttle-pulse +13 -4
  13. package/payload/lanes/docs/AGENTS-lanes.md +15 -7
  14. package/payload/lanes/docs/ARCHITECTURE.md +478 -101
  15. package/payload/lanes/docs/DESIGN.md +7 -2
  16. package/payload/lanes/docs/INSTALL.md +20 -3
  17. package/payload/lanes/docs/PLAN-1.9.1-SIDEBAR-CODEX.md +128 -0
  18. package/payload/lanes/docs/RUNBOOK.md +1428 -107
  19. package/payload/lanes/docs/USERGUIDE.md +488 -86
  20. package/payload/lanes/holders/tmux.sh +3 -3
  21. package/payload/lanes/install/services.py +68 -11
  22. package/payload/lanes/libexec/agent_state.py +2 -5
  23. package/payload/lanes/libexec/attach.py +11 -3
  24. package/payload/lanes/libexec/cursor_sync.py +22 -2
  25. package/payload/lanes/libexec/docsd.py +38 -4
  26. package/payload/lanes/libexec/lanes_lib.py +377 -39
  27. package/payload/lanes/libexec/mdlite.py +43 -3
  28. package/payload/lanes/libexec/notify.py +69 -26
  29. package/payload/lanes/libexec/registrations.py +5 -0
  30. package/payload/lanes/libexec/session_actions.py +114 -27
  31. package/payload/lanes/libexec/sidebar.py +246 -64
  32. package/payload/lanes/libexec/site_hooks.py +65 -0
  33. package/payload/lanes/libexec/statusd.py +139 -189
  34. package/payload/lanes/libexec/studio_host.py +8 -2
  35. package/payload/lanes/libexec/tokens.py +6 -2
  36. package/payload/lanes/libexec/update.py +13 -5
  37. package/payload/lanes/libexec/view.sh +39 -4
  38. package/payload/lanes/libexec/workspace_keys.py +54 -0
  39. package/payload/lanes/site/protocol.py +15 -5
  40. package/payload/lanes/site/relay.py +5 -2
  41. package/payload/lanes/site/server.py +29 -18
  42. package/payload/lanes/systemd/lanes-economy.service +3 -1
  43. package/payload/lanes/tokens/README.md +10 -0
  44. package/payload/lanes/tokens/generate.py +1 -1
  45. package/payload/lanes/web/Caddyfile +9 -2
  46. package/payload/lanes/web/README.md +2410 -95
  47. package/payload/lanes/web/browser.css +2 -0
  48. package/payload/lanes/web/browser.js +18 -6
  49. package/payload/lanes/web/directory.js +1 -1
  50. package/payload/lanes/web/docs.js +23 -0
  51. package/payload/lanes/web/links.js +157 -0
  52. package/payload/lanes/web/manifest.webmanifest +0 -2
  53. package/payload/lanes/web/mobile.css +30 -32
  54. package/payload/lanes/web/mobile.js +286 -227
  55. package/payload/lanes/web/upload.js +65 -22
  56. package/payload/lanes/web/workspace-keys.js +65 -0
  57. package/payload/lanes/zellij/config.kdl +1 -1
  58. package/payload/manifest.json +5 -22
  59. package/payload/lanes/bin-rs/THIRD-PARTY-NOTICES +0 -18953
  60. package/payload/lanes/bin-rs/x86_64-unknown-linux-musl/lanes-hook +0 -0
  61. package/payload/lanes/bin-rs/x86_64-unknown-linux-musl/lanes-terminal +0 -0
@@ -1,12 +1,10 @@
1
- // Lanes docs page: the drop area (plan W10 W5, LNS-106). The form works without this; here a drop lands anywhere on
2
- // the area, the size is checked before sending, progress shows and each file's receipt is listed. web/README.md.
3
1
  (function () {
4
2
  'use strict';
5
3
  var form = document.querySelector('form.docs-upload');
6
4
  if (!form) return;
7
5
  var area = form.querySelector('.docs-drop'), input = form.querySelector('input[type=file]'),
8
6
  list = form.querySelector('.docs-sent'), button = form.querySelector('button'),
9
- max = +form.getAttribute('data-max') || 0;
7
+ max = +form.getAttribute('data-max') || 0, kept = [], doubt = '';
10
8
 
11
9
  function add(text, href, name) {
12
10
  var li = document.createElement('li'), a;
@@ -20,7 +18,14 @@
20
18
  }
21
19
 
22
20
  function count() {
23
- area.setAttribute('data-count', input.files.length ? input.files.length + ' chosen' : '');
21
+ var n = kept.length || input.files.length;
22
+ area.setAttribute('data-count', n ? n + (kept.length ? ' not uploaded yet' : ' chosen') : '');
23
+ }
24
+
25
+ function chosen() {
26
+ kept = [];
27
+ doubt = '';
28
+ count();
24
29
  }
25
30
 
26
31
  function over(on) {
@@ -30,32 +35,73 @@
30
35
  };
31
36
  }
32
37
 
38
+ function good(t, f) {
39
+ return t && typeof t.name === 'string' && typeof t.landed === 'string' && /^[a-z0-9]{10,20}$/.test(t.id) &&
40
+ /^[0-9a-f]{64}$/.test(t.sha256) && t.bytes === f.size;
41
+ }
42
+
33
43
  area.addEventListener('dragenter', over(true));
34
44
  area.addEventListener('dragover', over(true));
35
45
  area.addEventListener('dragleave', over(false));
36
46
  area.addEventListener('drop', function (e) {
37
47
  over(false)(e);
38
48
  input.files = e.dataTransfer.files;
39
- count();
49
+ chosen();
40
50
  });
41
- input.addEventListener('change', count);
51
+ input.addEventListener('change', chosen);
42
52
 
43
53
  form.addEventListener('submit', function (e) {
44
- var files = input.files, total = 0, i, x, row, bar;
54
+ var files = kept.length ? kept : [].slice.call(input.files), was = doubt,
55
+ lane = form.querySelector('select').value, total = 0, i, x, row, bar, body;
45
56
  e.preventDefault();
46
- if (!files.length) return;
57
+ if (!files.length || button.disabled) return;
58
+ if (files.length > 63) {
59
+ add('Too many files: ' + files.length + '; an upload may hold 63.');
60
+ return;
61
+ }
47
62
  for (i = 0; i < files.length; i++) total += files[i].size + 1024;
48
63
  if (max && total > max) {
49
64
  add('Too large: ' + Math.ceil(total / 1048576) + ' MiB; an upload may be ' + max / 1048576 + ' MiB.');
50
65
  return;
51
66
  }
67
+ body = new FormData(form);
68
+ body.delete('file');
69
+ files.forEach(function (f) { body.append('file', f); });
52
70
  x = new XMLHttpRequest();
53
71
  row = add('');
54
72
  bar = row.appendChild(document.createElement('progress'));
55
- function done(said) {
73
+ function done(got, word, said) {
74
+ var n = 0, left = [], t, m;
56
75
  list.removeChild(row);
57
76
  button.disabled = false;
58
- if (said) add(said);
77
+ for (i = 0; i < files.length; i++) if (good(got[i], files[i])) n++;
78
+ if (n < got.length) word = '';
79
+ m = word ? was : lane;
80
+ for (i = 0; i < files.length; i++) {
81
+ if (good(t = got[i], files[i])) {
82
+ add(' · uploaded · ' + t.bytes + ' B · sha256 ' + t.sha256 + ' · ' + t.landed, 'd/' + t.id, t.name);
83
+ continue;
84
+ }
85
+ add(files[i].name + ' · ' + files[i].size + ' B · ' + (!word ? 'not confirmed' :
86
+ (n && i > n ? 'not tried' : 'refused: ' + word) + (m ? '; an earlier try was not confirmed' : '')));
87
+ left.push(files[i]);
88
+ }
89
+ kept = left;
90
+ if (left.length) {
91
+ doubt = m;
92
+ add(n + ' of ' + files.length + ' uploaded. ' + (!word ? said || 'The answer did not confirm the upload.' :
93
+ /^(408|429|50[03])$/.test(x.status) ? 'Upload sends the rest again.' :
94
+ 'This would be refused again.' + (n ? ' Choose the files again without the refused one.' : '')) +
95
+ (m ? ' The files may still be arriving. Look for them in this lane before you send again: ' +
96
+ 'Upload sends them a second time.' : ''));
97
+ if (m) add('', './?lane=' + m, "Open this lane's files").children[0].target = '_blank';
98
+ try {
99
+ var move = new DataTransfer();
100
+ left.forEach(function (f) { move.items.add(f); });
101
+ input.files = move.files;
102
+ } catch (err) {}
103
+ } else input.value = doubt = '';
104
+ count();
59
105
  }
60
106
  x.upload.onprogress = function (p) {
61
107
  if (p.lengthComputable) bar.value = p.loaded / p.total;
@@ -63,22 +109,19 @@
63
109
  x.onload = function () {
64
110
  var r = {};
65
111
  try {
66
- r = JSON.parse(x.responseText);
67
- } catch (err) { /* not JSON: said below */ }
68
- done('');
69
- (r.receipts || []).forEach(function (t) {
70
- add(' · ' + t.bytes + ' B · sha256 ' + t.sha256 + ' · ' + t.landed, 'd/' + t.id, t.name);
71
- });
72
- if (x.status !== 200) add('Refused: ' + (r.error || x.status));
73
- input.value = '';
74
- count();
112
+ r = JSON.parse(x.responseText) || r;
113
+ } catch (err) {}
114
+ done(Array.isArray(r.receipts) ? r.receipts : [], x.status !== 200 && typeof r.error === 'string' &&
115
+ /^[a-z-]{1,40}$/.test(r.error) && r.error !== 'server-error' && r.error);
75
116
  };
76
- x.onerror = function () {
77
- done('The upload did not reach the server; try again.');
117
+ x.onerror = x.onabort = function () {
118
+ done([], '', 'The connection ended before we could confirm the upload.');
78
119
  };
79
120
  x.open('POST', form.getAttribute('action'));
80
121
  x.setRequestHeader('Accept', 'application/json');
122
+ x.ontimeout = x.onerror;
123
+ x.timeout = 150000 + total / 65.536;
81
124
  button.disabled = true;
82
- x.send(new FormData(form));
125
+ x.send(body);
83
126
  });
84
127
  }());
@@ -0,0 +1,65 @@
1
+ // Loaded only by a view opened with ?keys. The host resolves the device's
2
+ // profile and managed tabs. The browser can only focus a pane in its own view.
3
+ function shortcutNumber(event, doc) {
4
+ if (!event.metaKey || event.altKey || event.ctrlKey || event.shiftKey || event.repeat ||
5
+ event.defaultPrevented || event.isComposing || event.keyCode === 229 || !/^[1-9]$/.test(event.key)) return 0;
6
+ const ownsInput = 'input,textarea,select,form,[contenteditable]:not([contenteditable="false"]),[role="textbox"],#terminal';
7
+ if (event.target?.closest?.(ownsInput) || doc.activeElement?.closest?.(ownsInput) ||
8
+ doc.querySelector('dialog[open],[aria-modal="true"]:not([hidden]),.security-modal:not([hidden])')) return 0;
9
+ return Number(event.key);
10
+ }
11
+
12
+ function workspacePane(slot, data, memory) {
13
+ if (!slot || !data) return null;
14
+ const {picker, view} = slot.tabs;
15
+ const remembered = memory?.ws?.[slot.workspace];
16
+ const targets = [view, picker].filter(Boolean);
17
+ const ordered = [targets.find(t => t.tab === remembered), picker, view].filter(Boolean);
18
+ for (const target of ordered) {
19
+ const matches = data.panes.filter(p => !p.is_plugin && p.pane_id === target.pane);
20
+ if (matches.length === 1 && data.tabs.some(t => t.position === matches[0].tab_position && t.name === target.tab))
21
+ return target.pane;
22
+ }
23
+ return null;
24
+ }
25
+
26
+ function installWorkspaceKeys(win, doc) {
27
+ let generation = 0, hint;
28
+ const invalidate = () => ++generation;
29
+ for (const type of ['pointerdown', 'focusin', 'pagehide', 'compositionstart']) win.addEventListener(type, invalidate, true);
30
+ win.addEventListener('keydown', async event => {
31
+ if (event.repeat) return;
32
+ const request = invalidate(), number = shortcutNumber(event, doc);
33
+ const api = win.__zjMobileUi, data = () => api?.getState()?.data;
34
+ const path = win.location.pathname, source = data()?.active_pane;
35
+ if (!number || !source || !/^\/[A-Za-z0-9_][\w.-]{0,47}$/.test(path)) return;
36
+ event.preventDefault();
37
+ event.stopImmediatePropagation();
38
+ let pane = null;
39
+ try {
40
+ const reply = await win.fetch('/lanes-docs/workspace-keys' + path, {cache: 'no-store', signal: AbortSignal.timeout(5500)});
41
+ const slots = reply.ok && await reply.json();
42
+ let memory;
43
+ try { memory = JSON.parse(win.localStorage.getItem('lanes:tab:' + path)); } catch {}
44
+ if (Array.isArray(slots)) pane = workspacePane(slots[number - 1], data(), memory);
45
+ } catch {}
46
+ if (request !== generation || win.location.pathname !== path || doc.hidden ||
47
+ source.tab_position !== data()?.active_pane?.tab_position || source.pane_id !== data()?.active_pane?.pane_id) return;
48
+ if (pane !== null) {
49
+ if (hint) hint.hidden = true;
50
+ if (pane !== source.pane_id) win.__zjSendControl?.({type: 'FocusPane', pane_id: pane, is_plugin: false});
51
+ } else {
52
+ if (!hint) {
53
+ hint = doc.createElement('output');
54
+ hint.setAttribute('aria-live', 'polite');
55
+ hint.style.cssText = 'position:fixed;bottom:15%;left:1rem;padding:.4rem;background:Canvas;color:CanvasText;z-index:10';
56
+ doc.body.append(hint);
57
+ }
58
+ hint.hidden = false;
59
+ hint.textContent = 'Workspace ' + number + ' unavailable';
60
+ win.setTimeout(() => { if (hint.textContent === 'Workspace ' + number + ' unavailable') hint.hidden = true; }, 2000);
61
+ }
62
+ }, true);
63
+ }
64
+ if (typeof module === 'object') module.exports = {installWorkspaceKeys, shortcutNumber, workspacePane};
65
+ if (typeof window === 'object') installWorkspaceKeys(window, document);
@@ -461,7 +461,7 @@ themes {
461
461
  theme_dark "lanes-dark"
462
462
  theme_light "lanes-light"
463
463
  web_client {
464
- font "monospace"
464
+ font "ui-monospace, monospace"
465
465
  theme {
466
466
  background "#101318"
467
467
  foreground "#f2f5f8"
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@vibelord/lanes",
3
- "version": "1.8.0",
4
- "commit": "e5bc8704b389d515dd283e0e393cb37694c19a5d",
5
- "digest": "sha256:37ddfe65b76bfca946e4cbf7c2b9353e164031f32d5c9e32fe661b39946e3c07",
3
+ "version": "1.9.2",
4
+ "commit": "5c99782f6def52af26fe1e2bcc88360b80686cb8",
5
+ "digest": "sha256:6f0da956770af1cff6de3c9d48455344d3579b37a3941757fafc60acb019feaf",
6
6
  "executables": [
7
7
  "bin/lanes",
8
8
  "bin/lanes-site-serve",
@@ -36,9 +36,7 @@
36
36
  "libexec/tokens.py",
37
37
  "libexec/view.sh",
38
38
  "sudo/host-guard.sh",
39
- "sudo/one-time-root.sh",
40
- "bin-rs/x86_64-unknown-linux-musl/lanes-hook",
41
- "bin-rs/x86_64-unknown-linux-musl/lanes-terminal"
39
+ "sudo/one-time-root.sh"
42
40
  ],
43
41
  "sites": [
44
42
  "beyondwork"
@@ -46,20 +44,5 @@
46
44
  "site_codes": {
47
45
  "LN": "beyondwork"
48
46
  },
49
- "binaries": [
50
- {
51
- "name": "lanes-hook",
52
- "target": "x86_64-unknown-linux-musl",
53
- "sha256": "6259018bf2495e0add3298ac96f9ffb5da69dab9d9878a3b43e217f96d2a7823",
54
- "size": 1250024,
55
- "commit": "e5bc8704b389d515dd283e0e393cb37694c19a5d"
56
- },
57
- {
58
- "name": "lanes-terminal",
59
- "target": "x86_64-unknown-linux-musl",
60
- "sha256": "4f7a3ba8514658531a0cf6dd7fe19fb3972372e7d743518a38a9fa693093d159",
61
- "size": 17161512,
62
- "commit": "e5bc8704b389d515dd283e0e393cb37694c19a5d"
63
- }
64
- ]
47
+ "binaries": []
65
48
  }