clavarium 0.2.78-next.1 → 0.2.82-next.1

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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.78-next.1",
3
+ "version": "0.2.82-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.78-next.1",
9
+ "version": "0.2.82-next.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
@@ -14,7 +14,7 @@
14
14
  "clavarium-binder": "0.1.8-next.1",
15
15
  "clavarium-docket": "0.1.1",
16
16
  "clavarium-parley": "0.17.11-next.1",
17
- "clavarium-tether": "0.1.0-next.12",
17
+ "clavarium-tether": "0.1.0-next.13",
18
18
  "mermaid": "11.17.2",
19
19
  "node-pty": "^1.1.0",
20
20
  "pdfjs-dist": "6.4.299",
@@ -755,9 +755,9 @@
755
755
  }
756
756
  },
757
757
  "node_modules/clavarium-tether": {
758
- "version": "0.1.0-next.12",
759
- "resolved": "https://registry.npmjs.org/clavarium-tether/-/clavarium-tether-0.1.0-next.12.tgz",
760
- "integrity": "sha512-3lbTV27WEyVLEHze8xbsTzA9iBGv6VxPMIGY20zzpeCb9JGZ2rU7cq8sk7VcWyPpoqSnBh3SyvXqA3LoM0zYmA==",
758
+ "version": "0.1.0-next.13",
759
+ "resolved": "https://registry.npmjs.org/clavarium-tether/-/clavarium-tether-0.1.0-next.13.tgz",
760
+ "integrity": "sha512-2H4OcE43KcXnDo44Ptlzu3LM9upLYKEck4u5AWsYQcgvwrkSdG5D7aN4/jMuJALSf1/mJVrD6jvxgUCjb6n+GA==",
761
761
  "license": "MIT",
762
762
  "bin": {
763
763
  "tether": "bin/cli.mjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.78-next.1",
3
+ "version": "0.2.82-next.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "A conversation is a VM with a terminal in it. Everything else is a folder.",
@@ -47,7 +47,7 @@
47
47
  "clavarium-binder": "0.1.8-next.1",
48
48
  "clavarium-docket": "0.1.1",
49
49
  "clavarium-parley": "0.17.11-next.1",
50
- "clavarium-tether": "0.1.0-next.12",
50
+ "clavarium-tether": "0.1.0-next.13",
51
51
  "mermaid": "11.17.2",
52
52
  "node-pty": "^1.1.0",
53
53
  "pdfjs-dist": "6.4.299",
@@ -28,13 +28,13 @@ import { consentUrl, exchangeCode, extractCode, thunderbird, scopeFor, pkcePair,
28
28
  /* The loopback the provider sends the code back to; nothing listens there. The
29
29
  person's browser lands on a page that will not load, and they copy the whole
30
30
  address -- which carries the code -- back into Clavarium. The same address
31
- trades the code, so it only has to stay constant. Google's desktop client
32
- accepts any 127.0.0.1 port; Microsoft (Azure) rejects a 127.0.0.1 whose exact
33
- port is not registered but accepts http://localhost with ANY port for a public
34
- client, so Microsoft uses localhost. */
31
+ trades the code, so it must match what the borrowed client registered. Google's
32
+ desktop client takes any 127.0.0.1 port. Microsoft's (GNOME Online Accounts')
33
+ registered one exact redirect, a custom scheme goa-oauth2://localhost/<id>, so
34
+ that is the one to send: after allowing, the browser shows that goa-oauth2://
35
+ address (it cannot open it -- that is expected) and the person copies it. */
35
36
  const REDIRECT = 'http://127.0.0.1:47813/';
36
- const REDIRECT_LOCALHOST = 'http://localhost:47813/';
37
- const redirectFor = (provider) => (provider === 'microsoft' ? REDIRECT_LOCALHOST : REDIRECT);
37
+ const redirectFor = (provider) => (provider === 'microsoft' ? `goa-oauth2://localhost/${thunderbird('microsoft').clientId}` : REDIRECT);
38
38
  const PENDING_MS = 10 * 60_000;
39
39
  const PENDING_MAX = 20;
40
40
 
package/server/main.mjs CHANGED
@@ -507,7 +507,7 @@ export async function startHome({ port, host, dataDir, mntDir = dataDir, gitRese
507
507
  /* Settings, Updates: what the updater (deploy/updater.mjs, as root) wrote, and how to ask it. */
508
508
  const updates = new Updates({ host: asHost, version: platform.version, store: new Store(`${dataDir}/updates.json`), alerts, ...(updateState ? { stateFile: updateState } : {}), ...(updateConf ? { confFile: updateConf } : {}) });
509
509
  const stopUpdates = updates.watch();
510
- const setup = new Setup({ store: new Store(`${dataDir}/flows.json`), version: platform.version, conversations: all, resources: folders, secrets, devices, shortcuts, wakeups, answerer, talk, gitKeeper, gitAccess, mailboxes, signin, network, guide, tethers, ...(setupPollMs ? { pollMs: setupPollMs } : {}) });
510
+ const setup = new Setup({ store: new Store(`${dataDir}/flows.json`), version: platform.version, conversations: all, resources: folders, secrets, devices, shortcuts, wakeups, answerer, talk, gitKeeper, gitAccess, mailboxes, signin, network, guide, tethers, groups, ...(setupPollMs ? { pollMs: setupPollMs } : {}) });
511
511
  /* This server's disk and memory, and the reserve no machine may eat into: see capacity.mjs. */
512
512
  const capacity = new Capacity({ run: asHost, store: new Store(`${dataDir}/server.json`), conversations: all, shelf, ...(serverRoomMs === undefined ? {} : { roomMs: serverRoomMs }),
513
513
  /* Under the reserve: the machine that takes the most put to sleep, the owner told, and its chat. */
package/server/setup.mjs CHANGED
@@ -338,6 +338,18 @@ export class Setup {
338
338
  if (!links.some((x) => x.from === l.from && x.to === to)) links.push({ from: l.from, to, rights: l.rights, pending: true, ...(l.autoSend ? { autoSend: l.autoSend } : {}) });
339
339
  }
340
340
  }
341
+ /* The owner's asset groups: one node per group, and each grouped asset
342
+ tagged with its group. The page can then FOLD a group to a single node
343
+ whose links are the union of its members' -- here we give the parts
344
+ (the members, their real links, the group nodes); the page does the
345
+ folding so the map declutters without losing the truth. */
346
+ const nodeById = new Map(nodes.map((n) => [n.id, n]));
347
+ for (const g of p.groups?.list?.() ?? []) {
348
+ const members = (g.members ?? []).filter((m) => nodeById.has(m));
349
+ if (members.length === 0) continue;
350
+ for (const m of members) nodeById.get(m).group = `group:${g.id}`;
351
+ nodes.push({ id: `group:${g.id}`, kind: 'group', name: g.label, sub: `${members.length} asset${members.length === 1 ? '' : 's'}`, members });
352
+ }
341
353
  const known = new Set(nodes.map((n) => n.id));
342
354
  return { nodes, links: links.filter((l) => known.has(l.from) && known.has(l.to)) };
343
355
  }
package/web/app.js CHANGED
@@ -2007,7 +2007,7 @@
2007
2007
  }
2008
2008
  /* A chapter that holds something asking for the person -- a callout, or a state said as a warning or a
2009
2009
  fault -- wears a dot on its title, folded or not: one look at Settings says where to go. */
2010
- const asksForYou = (el2) => [...el2.querySelectorAll('.callout, .status-line[data-tone="warn"], .status-line[data-tone="bad"]')]
2010
+ const asksForYou = (el2) => [...el2.querySelectorAll('.callout:not([data-tone="ok"]), .status-line[data-tone="warn"], .status-line[data-tone="bad"]')]
2011
2011
  .some((x) => !x.closest('[hidden]') && x.textContent.trim());
2012
2012
  let marking;
2013
2013
  const markAttention = () => { clearTimeout(marking); marking = setTimeout(() => {
@@ -5039,7 +5039,7 @@
5039
5039
  const backFailed = /did not come back either/.test(last?.why ?? '');
5040
5040
  const news = !running && last && last.result !== 'done' ? (last.result === 'rolled-back' ? (backFailed ? `${last.to} did not start on this server, and putting ${last.from} back did not work either: ${last.why}` : `${last.to} did not start on this server, so ${last.from} was put back. ${last.from} runs normally.`) : `${last.action === 'back' ? 'Going back to' : 'The update to'} ${last.to} failed: ${last.why ?? ''}`)
5041
5041
  : !running && u.refused && (!last || u.refused.at > last.at) && !/is not newer than/.test(u.refused.why ?? '') ? `Not done: ${u.refused.why}` : '';
5042
- $('updates-news').textContent = news.trim(); $('updates-news').hidden = !news;
5042
+ $('updates-news').textContent = news.trim(); $('updates-news').hidden = !news; $('updates-news').dataset.tone = news ? 'warn' : 'ok';
5043
5043
  if (![$('updates-mode'), $('updates-from'), $('updates-to'), $('updates-channel')].includes(document.activeElement)) {
5044
5044
  $('updates-mode').value = u.mode; $('updates-channel').value = u.channel;
5045
5045
  [$('updates-from').value, $('updates-to').value] = u.window.split('-');
@@ -5086,7 +5086,7 @@
5086
5086
  await paintUpdates();
5087
5087
  /* The answer to the click, said next to it. */
5088
5088
  const u = lastUpdates;
5089
- if (!failed && u && !u.checkError) { $('updates-news').textContent = u.available ? `${u.available} is out.` : `No new version: ${u.version} is the latest.`; $('updates-news').hidden = false; }
5089
+ if (!failed && u && !u.checkError) { $('updates-news').textContent = u.available ? `${u.available} is out.` : `No new version: ${u.version} is the latest.`; $('updates-news').hidden = false; $('updates-news').dataset.tone = u.available ? 'warn' : 'ok'; }
5090
5090
  });
5091
5091
  async function applyUpdate() {
5092
5092
  updatesError();
@@ -6193,7 +6193,7 @@
6193
6193
  const all = kinds.includes('calendar') && kinds.includes('contacts');
6194
6194
  $('connexion-notice').textContent = provider === 'google'
6195
6195
  ? `Clavarium signs in with GNOME Online Accounts' app — that is what Google sees.${all ? ' Mail, calendar and contacts can be connected together.' : ''}`
6196
- : `Clavarium signs in with GNOME Online Accounts' app — that is what Microsoft sees.${all ? ' Mail, calendar and contacts together, over Microsoft Graph.' : ''}`;
6196
+ : `Clavarium signs in with GNOME Online Accounts' app — that is what Microsoft sees.${all ? ' Mail, calendar and contacts together, over Microsoft Graph.' : ''} After you allow, the browser shows a goa-oauth2://… address it cannot open — copy that one and paste it below.`;
6197
6197
  $('connexion-open').textContent = `Open the ${who} sign-in page`;
6198
6198
  };
6199
6199
  for (const b of $('connexion-provider').querySelectorAll('button')) b.addEventListener('click', () => setConnexionProvider(b.dataset.provider));
package/web/index.html CHANGED
@@ -548,7 +548,7 @@
548
548
  <div class="row"><button type="button" id="connexion-open" class="primary">Open the sign-in page</button></div>
549
549
  <div id="connexion-paste" hidden>
550
550
  <label for="connexion-code">After you allow, the page will not load — copy its full address and paste it here</label>
551
- <div class="row"><input id="connexion-code" spellcheck="false" autocapitalize="off" placeholder="http://localhost... or http://127.0.0.1..."><button type="button" id="connexion-connect" class="primary">Connect</button></div>
551
+ <div class="row"><input id="connexion-code" spellcheck="false" autocapitalize="off" placeholder="Paste the whole address from the bar"><button type="button" id="connexion-connect" class="primary">Connect</button></div>
552
552
  </div>
553
553
  <p id="connexion-error" class="error" role="alert" hidden></p>
554
554
  </form>
package/web/links.js CHANGED
@@ -24,12 +24,12 @@
24
24
  (() => {
25
25
  const SVG = 'http://www.w3.org/2000/svg';
26
26
  /* Each kind's icon, from the set of the chat (Lucide, see icons.js): the same drawing on every screen, whatever its fonts. */
27
- const KIND_ICON = { device: 'smartphone', conversation: 'square-terminal', folder: 'folder', git: 'git-branch', mailbox: 'mail', agenda: 'calendar', contacts: 'users', secret: 'key-round' };
27
+ const KIND_ICON = { device: 'smartphone', conversation: 'square-terminal', folder: 'folder', git: 'git-branch', mailbox: 'mail', agenda: 'calendar', contacts: 'users', secret: 'key-round', group: 'layers' };
28
28
  /* An icon of that set, or, until it is there, nothing in its place. */
29
29
  const ic = (name, cls = 'lk-svg') => window.clavariumIcons?.icon(name, cls) ?? null;
30
30
  const kindIcon = (kind) => h('span', { class: 'lk-ic', 'aria-hidden': 'true' }, ic(KIND_ICON[kind]));
31
- const KIND_WORD = { device: 'device', conversation: 'conversation', folder: 'folder', git: 'repository', mailbox: 'mailbox', agenda: 'calendar', contacts: 'address book', secret: 'secret' };
32
- const COLUMN = { device: 'device', conversation: 'conversation', folder: 'asset', git: 'asset', mailbox: 'asset', agenda: 'asset', contacts: 'asset', secret: 'asset' };
31
+ const KIND_WORD = { device: 'device', conversation: 'conversation', folder: 'folder', git: 'repository', mailbox: 'mailbox', agenda: 'calendar', contacts: 'address book', secret: 'secret', group: 'group' };
32
+ const COLUMN = { device: 'device', conversation: 'conversation', folder: 'asset', git: 'asset', mailbox: 'asset', agenda: 'asset', contacts: 'asset', secret: 'asset', group: 'asset' };
33
33
  const TITLES = { device: 'Devices', conversation: 'Conversations', asset: 'Assets' };
34
34
  const VIEWS = {
35
35
  devices: { cols: [['device'], ['conversation', 'asset']], sources: ['device'] },
@@ -69,6 +69,12 @@
69
69
  let allLines = true;
70
70
  try { allLines = localStorage.getItem('clavarium-links-all') !== '0'; } catch { /* none kept */ }
71
71
  let picked = null; let pinned = null; let focus = null; let drag = null; let pop = null; let popLink = null; let drawnMany = false;
72
+ /* The graph as the server sends it; `graph` below is the folded view of it.
73
+ A group folds to one node by default; the owner opens the ones they want.
74
+ Which are open is kept per device. */
75
+ let rawGraph = { nodes: [], links: [], flows: [] };
76
+ const expanded = new Set((() => { try { const v = JSON.parse(localStorage.getItem('clavarium-links-open') ?? '[]'); return Array.isArray(v) ? v : []; } catch { return []; } })());
77
+ const keepExpanded = () => { try { localStorage.setItem('clavarium-links-open', JSON.stringify([...expanded])); } catch { /* none kept */ } };
72
78
  /* A box is shown only if its column's filter is empty or its name holds what was typed: so a
73
79
  crowded map (many assets) is narrowed to a few boxes, their links with them. The layout is
74
80
  kept while typing (no reorder), and a filter cleared brings everything back. */
@@ -95,13 +101,37 @@
95
101
  const inView = (n) => VIEWS[view].cols.flat().includes(COLUMN[n.kind]);
96
102
  const shown = (l) => VIEWS[view].sources.includes(node(l.from)?.kind) && inView(node(l.to));
97
103
 
98
- async function load() {
99
- const r = await fetch(`${env.API()}/flows`);
100
- graph = r.ok ? await r.json() : { nodes: [], links: [], flows: [] };
104
+ /* The graph as drawn: a folded group becomes a single node, and its members'
105
+ links move onto it (deduped, rights merged); an opened group shows its
106
+ members as before. The server gives the parts; the folding is here. */
107
+ const mergeRights = (a = '', b = '') => [...'rwx'].filter((c) => a.includes(c) || b.includes(c)).join('') || a || b;
108
+ function foldedGraph(raw) {
109
+ const toGroup = new Map();
110
+ for (const n of raw.nodes) if (n.kind === 'group' && !expanded.has(n.id)) for (const m of n.members ?? []) toGroup.set(m, n.id);
111
+ const nodes = raw.nodes.filter((n) => !toGroup.has(n.id));
112
+ const at = (id) => toGroup.get(id) ?? id;
113
+ const merged = new Map();
114
+ for (const l of raw.links) {
115
+ const from = at(l.from); const to = at(l.to);
116
+ if (from === to) continue;
117
+ const key = `${from}\u0000${to}`;
118
+ const prev = merged.get(key);
119
+ merged.set(key, prev ? { ...prev, rights: mergeRights(prev.rights, l.rights), pending: Boolean(prev.pending && l.pending) } : { ...l, from, to });
120
+ }
121
+ return { nodes, links: [...merged.values()], flows: raw.flows ?? [] };
122
+ }
123
+ function applyFold() {
124
+ graph = foldedGraph(rawGraph);
101
125
  byId = new Map(graph.nodes.map((n) => [n.id, n]));
102
126
  if (pinned && !byId.has(pinned)) pinned = null;
103
127
  if (picked && !byId.has(picked.id)) picked = null; else if (picked) picked = byId.get(picked.id);
104
128
  }
129
+ function toggleGroup(id) { if (expanded.has(id)) expanded.delete(id); else expanded.add(id); keepExpanded(); laidOut = null; applyFold(); paint(); }
130
+ async function load() {
131
+ const r = await fetch(`${env.API()}/flows`);
132
+ rawGraph = r.ok ? await r.json() : { nodes: [], links: [], flows: [] };
133
+ applyFold();
134
+ }
105
135
  const err = (text) => { const e = $('links-error'); e.textContent = text ?? ''; e.hidden = !text; };
106
136
 
107
137
  /* ---------- the requests: those of the other screens ---------- */
@@ -161,7 +191,7 @@
161
191
  times, puts each box at the average place of what it is linked to; the order
162
192
  that crossed least is kept. What is linked to nothing goes last, by name. */
163
193
  function layout() {
164
- const ASSETS = ['folder', 'git', 'mailbox', 'agenda', 'contacts', 'secret'];
194
+ const ASSETS = ['group', 'folder', 'git', 'mailbox', 'agenda', 'contacts', 'secret'];
165
195
  const base = (k) => graph.nodes.filter((n) => COLUMN[n.kind] === k).sort((a, b) => (ASSETS.indexOf(a.kind) - ASSETS.indexOf(b.kind)) || a.name.localeCompare(b.name));
166
196
  let cols = VIEWS[view].cols.map((ks) => ks.map(base));
167
197
  const colOf = new Map(); cols.forEach((gs, ci) => gs.flat().forEach((n) => colOf.set(n.id, ci)));
@@ -242,8 +272,9 @@
242
272
  const e = h('div', { class: `lk-node lk-c-${COLUMN[n.kind]}${n.pending ? ' pending' : ''}`, 'data-id': n.id, 'data-kind': n.kind, tabindex: 0, role: 'button', title: `${n.name} · ${n.sub}`, 'aria-label': `${n.name}, ${n.sub}, ${cnt} link${cnt === 1 ? '' : 's'}` },
243
273
  kindIcon(n.kind),
244
274
  h('span', { class: 'lk-tx' }, h('span', { class: 'lk-nm', text: n.name })),
275
+ n.kind === 'group' && h('span', { class: 'lk-fold', text: expanded.has(n.id) ? '▾' : '▸', 'aria-hidden': 'true' }),
245
276
  state && h('span', { class: 'lk-st', 'data-state': state, 'aria-hidden': 'true' }),
246
- h('span', { class: 'lk-cnt', text: String(cnt), title: `${cnt} link${cnt === 1 ? '' : 's'}` }));
277
+ n.kind !== 'group' && h('span', { class: 'lk-cnt', text: String(cnt), title: `${cnt} link${cnt === 1 ? '' : 's'}` }));
247
278
  if (VIEWS[view].sources.includes(n.kind) && !n.pending) {
248
279
  const dot = h('span', { class: 'lk-handle', title: 'Drag to what it gets', 'aria-hidden': 'true' });
249
280
  dot.addEventListener('pointerdown', (ev) => startDrag(ev, n));
@@ -372,6 +403,8 @@
372
403
  /* A tap shows only what concerns that box; tapped again, everything comes back.
373
404
  A box that gives is also ready to be linked: tap a dashed box to link it. */
374
405
  function tap(n) {
406
+ /* A group folds/unfolds on a tap -- it is not something to give or pair. */
407
+ if (n.kind === 'group') { toggleGroup(n.id); return; }
375
408
  if (picked && picked.id !== n.id && allowed(picked, n)) { void link(picked, n); return; }
376
409
  const again = pinned === n.id;
377
410
  pinned = again ? null : n.id;
package/web/style.css CHANGED
@@ -604,6 +604,10 @@ footer button[data-keys="backspace"] { display: none; }
604
604
  .lk-node { position: relative; flex: none; display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); border-radius: 10px; padding: 5px 10px 5px 6px; background: var(--panel); cursor: pointer; user-select: none; min-width: 0; }
605
605
  .lk-node .lk-tx { flex: 1; }
606
606
  .lk-node .lk-nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
607
+ /* A group folds to one node: a brass accent and a chevron say it opens. */
608
+ .lk-node[data-kind="group"] { border-color: color-mix(in srgb, var(--brass) 55%, var(--line)); border-style: solid; }
609
+ .lk-node[data-kind="group"] .lk-ic { background: rgba(210, 169, 78, .18); color: var(--brass-ink); }
610
+ .lk-node[data-kind="group"] .lk-fold { color: var(--ink2); font-size: .72rem; margin-left: 2px; flex: none; }
607
611
  /* What the icon cannot say: a conversation's chat on, or one not ready. */
608
612
  .lk-st { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-right: 6px; }
609
613
  .lk-st[data-state="chat"] { background: var(--k-chat); }
@@ -1043,7 +1047,10 @@ button.inline:hover { color: var(--brass-ink); }
1043
1047
  #updates { display: grid; gap: 10px; outline: none; }
1044
1048
  .updates-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
1045
1049
  #updates-state { color: var(--ink2); font-size: .8125rem; flex: 1 1 10rem; min-width: 0; overflow-wrap: anywhere; }
1046
- .updates-news { margin: 0; font-size: .8125rem; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--warn); background: var(--bar); overflow-wrap: anywhere; }
1050
+ .updates-news { margin: 0; font-size: .8125rem; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bar); overflow-wrap: anywhere; }
1051
+ /* Amber only when something asks for a look (an update is out, one failed); up to date is neutral. */
1052
+ .updates-news[data-tone="warn"] { border-color: var(--warn); }
1053
+ .updates-news[data-tone="bad"] { border-color: var(--danger); }
1047
1054
  .updates-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px 14px; max-width: 30rem; }
1048
1055
  .updates-grid select, .updates-window input { min-height: 40px; font: .875rem var(--sans); color: var(--ink); background-color: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; max-width: 100%; }
1049
1056
  .updates-window { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--ink2); font-size: .8125rem; }