clavarium 0.2.72-next.1 → 0.2.76-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.
package/deploy/install.sh CHANGED
@@ -605,7 +605,7 @@ $BIND
605
605
  @api path /api/* /c/api/*
606
606
  handle @api {
607
607
  header Content-Type "application/json; charset=utf-8"
608
- respond "{\"error\":\"Clavarium is being updated or restarted: it comes back by itself in a moment.\",\"down\":true}" 503
608
+ respond "{\"error\":\"Clavarium did not answer just now -- it may be busy or restarting. It comes back by itself; try again in a moment.\",\"down\":true}" 503
609
609
  }
610
610
  handle {
611
611
  root * /var/lib/clavarium/maintenance
@@ -140,7 +140,7 @@ export const MAINTENANCE_BLOCK = [
140
140
  '\t\t\t\t@api path /api/* /c/api/*',
141
141
  '\t\t\t\thandle @api {',
142
142
  '\t\t\t\t\theader Content-Type "application/json; charset=utf-8"',
143
- '\t\t\t\t\trespond "{\\"error\\":\\"Clavarium is being updated or restarted: it comes back by itself in a moment.\\",\\"down\\":true}" 503',
143
+ '\t\t\t\t\trespond "{\\"error\\":\\"Clavarium did not answer just now -- it may be busy or restarting. It comes back by itself; try again in a moment.\\",\\"down\\":true}" 503',
144
144
  '\t\t\t\t}',
145
145
  '\t\t\t\thandle {',
146
146
  `\t\t\t\t\troot * ${MAINTENANCE_DIR}`,
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.72-next.1",
3
+ "version": "0.2.76-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.72-next.1",
9
+ "version": "0.2.76-next.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
13
13
  "@xterm/xterm": "^6.0.0",
14
14
  "clavarium-binder": "0.1.8-next.1",
15
15
  "clavarium-docket": "0.1.1",
16
- "clavarium-parley": "0.17.10-next.1",
17
- "clavarium-tether": "0.1.0-next.11",
16
+ "clavarium-parley": "0.17.11-next.1",
17
+ "clavarium-tether": "0.1.0-next.12",
18
18
  "mermaid": "11.17.2",
19
19
  "node-pty": "^1.1.0",
20
20
  "pdfjs-dist": "6.4.299",
@@ -742,9 +742,9 @@
742
742
  }
743
743
  },
744
744
  "node_modules/clavarium-parley": {
745
- "version": "0.17.10-next.1",
746
- "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.10-next.1.tgz",
747
- "integrity": "sha512-a4mZ29EFeBV6P+cumehzJ3VmVWcswklv2L5XAC0Oo+kJQ6k09komHlz2uZZVRRQZFhgC0I6G+avFAYq5zsophA==",
745
+ "version": "0.17.11-next.1",
746
+ "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.11-next.1.tgz",
747
+ "integrity": "sha512-IHGgFbDzHjrNVRcSR/KudWPUfvKxCeu03bNXE8+84lLMGHL7LyaiIg+iuw/cXMq4etz5BVXddVA/DGDoTUFO3A==",
748
748
  "license": "MIT",
749
749
  "bin": {
750
750
  "parley": "bin/parley.mjs",
@@ -755,9 +755,9 @@
755
755
  }
756
756
  },
757
757
  "node_modules/clavarium-tether": {
758
- "version": "0.1.0-next.11",
759
- "resolved": "https://registry.npmjs.org/clavarium-tether/-/clavarium-tether-0.1.0-next.11.tgz",
760
- "integrity": "sha512-GiLaCXmANy8OsiTacZIe5n+UUK+Lw33QzonZkU+vTVSx8X5g4fF4hzUkfRmpXWMDVWMuvTvptL/qIrJNbXJ9+Q==",
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==",
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.72-next.1",
3
+ "version": "0.2.76-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.",
@@ -46,8 +46,8 @@
46
46
  "@xterm/xterm": "^6.0.0",
47
47
  "clavarium-binder": "0.1.8-next.1",
48
48
  "clavarium-docket": "0.1.1",
49
- "clavarium-parley": "0.17.10-next.1",
50
- "clavarium-tether": "0.1.0-next.11",
49
+ "clavarium-parley": "0.17.11-next.1",
50
+ "clavarium-tether": "0.1.0-next.12",
51
51
  "mermaid": "11.17.2",
52
52
  "node-pty": "^1.1.0",
53
53
  "pdfjs-dist": "6.4.299",
@@ -10,12 +10,12 @@
10
10
  * instead the keeper reveals it to the connector alone, host-side, and acts on
11
11
  * the agent's behalf within the level and rules the person set.
12
12
  *
13
- * ONE ACCOUNT, ONE TOKEN, SEVERAL TARGETS. A Google consent for mail+calendar+
14
- * contacts yields a single refresh token; this makes one host-only secret and a
15
- * Tether target per kind, each naming that secret. Microsoft's Thunderbird client
16
- * carries only the mail scope here, so a Microsoft consent makes the mail target
17
- * alone (calendar and files over Graph need a deployment's own OAuth app, added
18
- * later as config.clientId + an own client secret).
13
+ * ONE ACCOUNT, ONE TOKEN, SEVERAL TARGETS. A consent for mail+calendar+contacts
14
+ * yields a single refresh token; this makes one host-only secret and a Tether
15
+ * target per kind, each naming that secret. Both providers borrow an open-source
16
+ * desktop client verified for all three: Google uses GNOME Online Accounts' over
17
+ * IMAP + CalDAV/CardDAV, Microsoft uses its Graph client (mail, calendar and
18
+ * contacts all over Microsoft Graph).
19
19
  *
20
20
  * A CREATED TARGET IS GIVEN TO NO ONE. The person grants it per conversation, at
21
21
  * its own level, from the page (Assets > Access) -- like git: one mailbox, many
@@ -42,7 +42,7 @@ const KIND = {
42
42
  contacts: { connector: 'contacts', kind: 'contacts', title: 'Contacts', needsUser: true },
43
43
  };
44
44
  /* What each provider's built-in (Thunderbird) client grants a refresh token for. */
45
- const SUPPORTED = { google: ['mail', 'calendar', 'contacts'], microsoft: ['mail'] };
45
+ const SUPPORTED = { google: ['mail', 'calendar', 'contacts'], microsoft: ['mail', 'calendar', 'contacts'] };
46
46
 
47
47
  const emailOk = (s) => /^[^\s@]{1,64}@[^\s@]{1,190}\.[^\s@]{2,}$/.test(s);
48
48
  /* A deterministic, valid secret name for an account's token: a short slug of the
package/server/oauth.mjs CHANGED
@@ -73,15 +73,17 @@ export const PROVIDERS = {
73
73
  pkce: true,
74
74
  consentExtra: {},
75
75
  offlineScope: 'offline_access',
76
- /* Mail (and SMTP) are outlook.office.com resources; calendar/files over
77
- Graph are a different resource and a separate token -- added when those
78
- connectors arrive, not mixed into one mail request. */
76
+ /* Microsoft over Graph: GNOME Online Accounts' client is a Graph client,
77
+ so mail, calendar and contacts all go through graph.microsoft.com (the
78
+ mail connector uses its Graph path for Microsoft). mail.send is needed
79
+ to send. GOA's client is verified for all of these. */
79
80
  scopes: {
80
- mail: 'https://outlook.office.com/IMAP.AccessAsUser.All',
81
- smtp: 'https://outlook.office.com/SMTP.Send',
81
+ mail: 'mail.readwrite mail.send',
82
+ calendar: 'calendars.readwrite',
83
+ contacts: 'contacts.readwrite',
82
84
  },
83
85
  thunderbird: {
84
- clientId: '9e5f94bc-e8a4-4e73-b8be-63364c29d753',
86
+ clientId: 'b155a604-3c31-4079-93b0-6bb6aa9d5464',
85
87
  clientSecret: null,
86
88
  },
87
89
  },
package/web/app.js CHANGED
@@ -3269,15 +3269,16 @@
3269
3269
  const members = (g.members ?? []).map((k) => byKey.get(k)).filter(Boolean);
3270
3270
  const folded = groupsFolded.has(g.id);
3271
3271
  const head = el('div', 'as-kind-head as-group-head'); if (folded) head.dataset.folded = 'true';
3272
- const chev = el('button', 'as-chev'); chev.type = 'button'; chev.setAttribute('aria-label', folded ? 'Unfold' : 'Fold'); chev.setAttribute('aria-expanded', String(!folded));
3273
- chev.append(el('span', '', folded ? '▸' : '▾'));
3274
- chev.addEventListener('click', () => { if (folded) groupsFolded.delete(g.id); else groupsFolded.add(g.id); keepGroupsFolded(); void paintAssets(); });
3275
- const label = el('button', 'as-group-name'); label.type = 'button';
3276
- if (`group:${g.id}` === chosen) label.setAttribute('aria-current', 'true');
3277
- label.append(el('h3', '', g.label), el('span', 'as-badge count', String(members.length)));
3278
- label.title = 'Open the group (give it, rename it)';
3279
- label.addEventListener('click', () => choose(`group:${g.id}`));
3280
- head.append(chev, label);
3272
+ /* The whole header folds/unfolds the group; a gear opens its settings. */
3273
+ const toggle = el('button', 'as-group-name'); toggle.type = 'button';
3274
+ if (`group:${g.id}` === chosen) toggle.setAttribute('aria-current', 'true');
3275
+ toggle.setAttribute('aria-expanded', String(!folded));
3276
+ toggle.append(el('span', 'as-chev', folded ? '▸' : '▾'), el('h3', '', g.label), el('span', 'as-badge count', String(members.length)));
3277
+ toggle.title = folded ? 'Unfold' : 'Fold';
3278
+ toggle.addEventListener('click', () => { if (folded) groupsFolded.delete(g.id); else groupsFolded.add(g.id); keepGroupsFolded(); void paintAssets(); });
3279
+ const gear = el('button', 'as-gear', '⚙'); gear.type = 'button'; gear.setAttribute('aria-label', `Settings for ${g.label}`); gear.title = 'Give, rename, remove';
3280
+ gear.addEventListener('click', (e) => { e.stopPropagation(); choose(`group:${g.id}`); });
3281
+ head.append(toggle, gear);
3281
3282
  section(head, members, 'Empty. Open an asset to put it here.', { foldable: true });
3282
3283
  }
3283
3284
  const grouped = new Set(groups.flatMap((g) => g.members ?? []));
@@ -3286,33 +3287,20 @@
3286
3287
  section(looseHead, loose, groups.length ? 'Every asset is in a group.' : 'Make a group above, then open an asset to put it in it.');
3287
3288
  if (items.length === 0 && empty) holder.append(el('p', 'hint', empty));
3288
3289
  }
3289
- /* Give the whole group to a conversation: none / read / write, turned into
3290
- the right default FOR EACH member's type. A shortcut over the per-asset
3291
- grants -- those stay the truth, and each asset keeps its own right after. */
3292
- const GROUP_LEVELS = [['none', 'None'], ['read', 'Read'], ['write', 'Write']];
3293
- function memberGrantValue(item, level) {
3294
- if (item.target) return { none: 'none', read: 'watch', write: 'frame' }[level];
3295
- if (item.kind === 'secret') return level === 'none' ? 'off' : 'use';
3296
- if (item.kind === 'mailbox') return level === 'none' ? 'none' : 'read'; // a mailbox has only read
3297
- return level; // folder, git, list: none/read/write line up
3298
- }
3290
+ /* The level buttons an asset takes, by its type (same sets as its own detail). */
3291
+ const levelOptionsFor = (item) => (item.target ? [['none', 'Off'], ['watch', 'Watch'], ['propose', 'Propose'], ['frame', 'Frame'], ['free', 'Free']]
3292
+ : item.kind === 'secret' ? [['off', 'Off'], ['use', 'Use']]
3293
+ : item.kind === 'mailbox' ? [['none', 'Off'], ['read', 'Read']]
3294
+ : [['none', 'Off'], ['read', 'Read'], ['write', 'Write']]);
3295
+ /* The shortcut "give all": each member at the lightest real level for its type. */
3296
+ const giveValue = (item, on) => (!on ? (item.target || item.kind !== 'secret' ? 'none' : 'off')
3297
+ : item.target ? 'watch' : item.kind === 'secret' ? 'use' : 'read');
3299
3298
  async function applyMemberGrant(item, conversationName, value) {
3300
3299
  if (item.target) return grantTarget(item.target.id, conversationName, value);
3301
3300
  if (item.kind === 'secret') return handTo(conversationName, item.name, value === 'use', 'assets-error');
3302
3301
  if (item.kind === 'list') return grantList(item.list.id, conversationName, value);
3303
3302
  return attachTo(conversationName, item.name, value, 'assets-error');
3304
3303
  }
3305
- /* The group's single level for a conversation, read back from its members:
3306
- none if all are off, write if any member is given write, else read. */
3307
- function groupLevelFor(members, conversationName) {
3308
- let any = false; let write = false;
3309
- for (const item of members) {
3310
- const v = memberCurrent(item, conversationName);
3311
- if (!['none', 'off'].includes(v)) any = true;
3312
- if (['write', 'rw', 'frame', 'free'].includes(v)) write = true;
3313
- }
3314
- return write ? 'write' : any ? 'read' : 'none';
3315
- }
3316
3304
  function memberCurrent(item, conversationName) {
3317
3305
  const id = `conversation:${conversationName}`;
3318
3306
  if (item.target) return item.target.grants?.[id]?.level ?? 'none';
@@ -3359,57 +3347,78 @@
3359
3347
  const h = el('h2'); h.append(el('span', '', group.label), el('span', 'as-badge count', String(members.length)));
3360
3348
  top.append(all, h);
3361
3349
  detail.append(top);
3362
- /* Rename and remove. Removing a group drops the grouping only; every asset,
3363
- and every right it was given, stays exactly as it was. */
3364
- const form = el('form', 'set-row'); form.autocomplete = 'off';
3350
+ const repaint = () => void paintAssets();
3351
+ const openAsset = (key) => { placeAssetStep(); if (key !== assetOpen) groupGiveShow.clear(); assetOpen = key; remember(); void paintAssets(); };
3352
+
3353
+ /* GIVE THE GROUP: a block per conversation, a row per asset AT ITS OWN
3354
+ level. Two shortcuts set or clear all at once (not a sticky state).
3355
+ Rights stay stored per asset -- this is just a handy place to set them. */
3356
+ const ready = conversations.filter((c) => c.phase === 'ready');
3357
+ const isGiven = (c) => members.some((m) => !['none', 'off'].includes(memberCurrent(m, c.name)));
3358
+ const shownConvs = ready.filter((c) => isGiven(c) || groupGiveShow.has(c.name));
3359
+ const setAll = async (c, on) => { for (const m of members) { try { await applyMemberGrant(m, c.name, giveValue(m, on)); } catch { /* shown by the grant */ } } repaint(); };
3360
+ const convBlock = (c) => {
3361
+ const block = el('div', 'as-give-conv');
3362
+ const head = el('div', 'as-give-head');
3363
+ const giveAll = el('button', 'as-mini', 'Give all'); giveAll.type = 'button'; giveAll.addEventListener('click', () => setAll(c, true));
3364
+ const clearAll = el('button', 'as-mini', 'Remove all'); clearAll.type = 'button'; clearAll.addEventListener('click', () => setAll(c, false));
3365
+ head.append(el('b', '', shownName(c)), el('span', 'as-give-acts', ''));
3366
+ head.lastChild.append(giveAll, clearAll);
3367
+ block.append(head);
3368
+ for (const m of members) {
3369
+ const line = el('div', 'as-give-row');
3370
+ const nm = el('span', 'as-give-name'); nm.append(kindIcon(m.kind), el('span', '', m.name));
3371
+ line.append(nm, modes(levelOptionsFor(m), memberCurrent(m, c.name), async (v) => { await applyMemberGrant(m, c.name, v); repaint(); }, `${m.name} for ${shownName(c)}`));
3372
+ block.append(line);
3373
+ }
3374
+ if (members.length === 0) block.append(el('p', 'hint', 'The group is empty.'));
3375
+ return block;
3376
+ };
3377
+ detail.append(chapter('Give the group to a conversation'));
3378
+ const giveBox = el('div', 'as-give');
3379
+ for (const c of shownConvs) giveBox.append(convBlock(c));
3380
+ if (shownConvs.length === 0) giveBox.append(el('p', 'hint', members.length ? 'Not given to any conversation yet.' : 'Add assets to the group first (open an asset, pick this group).'));
3381
+ detail.append(giveBox);
3382
+ /* Add a conversation to set up, even before any asset is given to it. */
3383
+ const others = ready.filter((c) => !shownConvs.includes(c));
3384
+ const addConv = el('button', 'as-link as-add-conv', '+ a conversation'); addConv.type = 'button';
3385
+ const picker = el('div', 'as-pick'); picker.hidden = true;
3386
+ for (const c of others) { const b = el('button', 'as-pick-conv', shownName(c)); b.type = 'button'; b.addEventListener('click', () => { groupGiveShow.add(c.name); repaint(); }); picker.append(b); }
3387
+ if (others.length === 0) picker.append(el('p', 'hint', ready.length ? 'Every conversation is shown.' : 'No conversation is ready.'));
3388
+ addConv.addEventListener('click', () => { picker.hidden = !picker.hidden; });
3389
+ if (members.length) detail.append(addConv, picker);
3390
+ const note = el('p', 'as-assoc hint');
3391
+ note.append(el('b', '', 'Per asset'), document.createTextNode(': each keeps the levels of its own type (a mailbox reads, a secret is used, a connexion watches…). The two shortcuts just set or clear all at once; each row stays editable, and the right is stored per asset.'));
3392
+ detail.append(note);
3393
+
3394
+ /* The assets in the group, each opens its own detail. */
3395
+ detail.append(chapter('Assets in the group'));
3396
+ const rowsBox = el('div', 'as-group-members');
3397
+ for (const m of members) rowsBox.append(assetRow(m, { chosen: '', choose: openAsset }));
3398
+ if (members.length === 0) rowsBox.append(el('p', 'hint', 'Open an asset and pick this group to put it here.'));
3399
+ detail.append(rowsBox);
3400
+
3401
+ /* Rename, then remove (a plain link -- it only drops the grouping). */
3402
+ detail.append(chapter('Name'));
3403
+ const form = el('form', 'as-group-rename'); form.autocomplete = 'off';
3365
3404
  const name = el('input'); name.value = group.label; name.maxLength = 40; name.setAttribute('aria-label', 'Group name');
3366
- const go = el('button', '', 'Rename'); go.type = 'submit';
3367
- const what = el('div', 'set-what'); what.append(el('span', '', 'Name'));
3368
- const control = el('div', 'set-control'); control.append(name, go);
3369
- form.append(what, control);
3405
+ const go = el('button', 'btn', 'Rename'); go.type = 'submit';
3406
+ form.append(name, go);
3370
3407
  form.addEventListener('submit', async (event) => {
3371
3408
  event.preventDefault(); $('assets-error').hidden = true;
3372
- try { await post(`${API}/asset-groups/${group.id}/rename`, { label: name.value.trim() }); }
3373
- catch (error) { $('assets-error').textContent = error.message; $('assets-error').hidden = false; }
3374
- void paintAssets();
3409
+ try { await post(`${API}/asset-groups/${group.id}/rename`, { label: name.value.trim() }); } catch (error) { $('assets-error').textContent = error.message; $('assets-error').hidden = false; }
3410
+ repaint();
3375
3411
  });
3376
- const del = el('button', 'as-danger', 'Remove the group'); del.type = 'button'; del.title = 'The assets stay; only the group is removed.';
3412
+ detail.append(form);
3413
+ const remove = el('div', 'as-group-remove');
3414
+ const del = el('button', 'as-remove-link', 'Remove the group'); del.type = 'button';
3377
3415
  del.addEventListener('click', async () => {
3378
3416
  $('assets-error').hidden = true;
3379
- try { await post(`${API}/asset-groups/${group.id}/remove`, {}); assetOpen = ''; remember(); }
3380
- catch (error) { $('assets-error').textContent = error.message; $('assets-error').hidden = false; }
3381
- void paintAssets();
3417
+ try { await post(`${API}/asset-groups/${group.id}/remove`, {}); groupGiveShow.clear(); assetOpen = ''; remember(); } catch (error) { $('assets-error').textContent = error.message; $('assets-error').hidden = false; }
3418
+ repaint();
3382
3419
  });
3383
- const box = el('div', 'set-rows as-block'); box.append(form, del);
3384
- detail.append(box);
3385
- /* Give the whole group. none / read / write turned into each type's own
3386
- default; each asset keeps its own right after (set one by one above). */
3387
- const ready = conversations.filter((c) => c.phase === 'ready');
3388
- const give = async (c, level) => {
3389
- for (const item of members) { try { await applyMemberGrant(item, c.name, memberGrantValue(item, level)); } catch { /* error shown by the grant; keep going */ } }
3390
- await paintAssets();
3391
- };
3392
- const row = (c) => {
3393
- const line = el('div', 'given-row'); line.dataset.conversation = c.name;
3394
- line.append(el('span', '', shownName(c)), modes(GROUP_LEVELS, groupLevelFor(members, c.name), (v) => give(c, v), `Give ${group.label} to ${c.name}`));
3395
- return line;
3396
- };
3397
- const using = ready.filter((c) => groupLevelFor(members, c.name) !== 'none');
3398
- const others = ready.filter((c) => groupLevelFor(members, c.name) === 'none');
3399
- const givenBox = el('div', 'as-users'); const picker = el('div', 'as-users as-picker'); picker.hidden = true;
3400
- for (const c of using) givenBox.append(row(c));
3401
- if (using.length === 0) givenBox.append(el('p', 'hint', members.length ? 'No conversation has the group.' : 'The group is empty.'));
3402
- for (const c of others) picker.append(row(c));
3403
- if (others.length === 0) picker.append(el('p', 'hint', ready.length ? 'Every conversation has it.' : 'No conversation is ready.'));
3404
- detail.append(chapter('Give the group to a conversation', roundPlus('Give the group to a conversation', () => { picker.hidden = !picker.hidden; })), givenBox, picker);
3405
- const note = el('p', 'as-assoc hint');
3406
- note.append(el('b', '', 'Per type'), document.createTextNode(': repositories and folders read or write, a mailbox reads, a secret is used, a connexion is given at the matching level. Each asset keeps its own right, set one by one.'));
3407
- detail.append(note);
3408
- /* The members, each opens its own detail. */
3409
- const rowsBox = el('div', 'as-group-members');
3410
- for (const item of members) rowsBox.append(assetRow(item, { chosen: '', choose: (key) => { placeAssetStep(); assetOpen = key; remember(); void paintAssets(); } }));
3411
- if (members.length === 0) rowsBox.append(el('p', 'hint', 'Open an asset and pick this group to put it here.'));
3412
- detail.append(chapter('Assets in the group'), rowsBox);
3420
+ remove.append(del, el('p', 'hint', 'The assets stay; only the group is removed.'));
3421
+ detail.append(remove);
3413
3422
  }
3414
3423
  /* The top of a detail: "All assets" (a phone), the icon, the name, a badge. */
3415
3424
  function asTitle(item, back) {
@@ -4011,6 +4020,10 @@
4011
4020
  const keepAssetsBy = () => { try { localStorage.setItem('clavarium-assets-by', assetsBy); } catch { /* as above */ } };
4012
4021
  /* The "+ New group" inline form being shown in the by-group view. */
4013
4022
  let groupAdding = false;
4023
+ /* Conversations shown in a group's "give" settings although none of its
4024
+ assets is given to them yet (the owner just added them to set levels).
4025
+ Cleared when the open group changes. */
4026
+ const groupGiveShow = new Set();
4014
4027
  /* A binder opened in Assets: its screen, the card of the address (a reload); a card, a step (binderSteps). */
4015
4028
  let assetsView = null; let assetsAt = null;
4016
4029
  const assetsSteps = binderSteps(() => assetsView, { address: () => remember() });
@@ -4086,7 +4099,7 @@
4086
4099
  $('assets-as').dataset.open = chosen || chosenGroup || assetsAdding ? 'detail' : 'list';
4087
4100
  /* The "by type / by group" toggle sits above the rows (built once, kept). */
4088
4101
  paintAssetsView();
4089
- const choose = (key) => { placeAssetStep(); assetOpen = key; assetsAdding = ''; remoteEditing = false; remember(); void paintAssets(); };
4102
+ const choose = (key) => { placeAssetStep(); if (key !== assetOpen) groupGiveShow.clear(); assetOpen = key; assetsAdding = ''; remoteEditing = false; remember(); void paintAssets(); };
4090
4103
  if (assetsBy === 'group') {
4091
4104
  paintAsGroups($('assets-rows'), shown, assetGroups, { chosen: chosen?.key ?? (chosenGroup ? `group:${chosenGroup.id}` : ''), choose, empty: assetsQuery ? 'Nothing by that name.' : '' });
4092
4105
  } else {
@@ -6153,6 +6166,8 @@
6153
6166
  a live Connexion (dynamic connector, token kept on the server): this jumps
6154
6167
  straight to adding one. */
6155
6168
  const MAILBOX_PROVIDER = { google: 'Google', microsoft: 'Microsoft' };
6169
+ /* Which kinds each provider can be connected for (from the server). */
6170
+ let accountSupported = { google: ['mail', 'calendar', 'contacts'], microsoft: ['mail'] };
6156
6171
  $('mailbox-to-connexion').addEventListener('click', () => { assetsAdding = 'connexion'; void paintAssets(); });
6157
6172
  /* CONNECT AN ACCOUNT (Connexions): a live link through Tether. The person signs
6158
6173
  in in their own browser; the token is kept on the server, never in a machine.
@@ -6161,16 +6176,15 @@
6161
6176
  const form = $('connexion-new');
6162
6177
  form.dataset.provider = provider;
6163
6178
  for (const b of $('connexion-provider').querySelectorAll('button')) b.setAttribute('aria-pressed', String(b.dataset.provider === provider));
6164
- const google = provider === 'google';
6165
- for (const id of ['connexion-calendar', 'connexion-contacts']) { const c = $(id); if (!google) c.checked = false; c.disabled = !google; }
6166
- $('connexion-calendar-label').classList.toggle('off', !google);
6167
- $('connexion-contacts-label').classList.toggle('off', !google);
6179
+ const kinds = accountSupported[provider] ?? ['mail'];
6180
+ for (const [id, k] of [['connexion-calendar', 'calendar'], ['connexion-contacts', 'contacts']]) { const c = $(id); const ok = kinds.includes(k); if (!ok) c.checked = false; c.disabled = !ok; $(`${id}-label`).classList.toggle('off', !ok); }
6168
6181
  $('connexion-paste').hidden = true;
6169
6182
  $('connexion-error').hidden = true;
6170
6183
  const who = MAILBOX_PROVIDER[provider];
6171
- $('connexion-notice').textContent = google
6172
- ? 'Clavarium signs in as Thunderbird — that is what Google sees. Mail, calendar and contacts can be connected together.'
6173
- : 'Clavarium signs in as Thunderbird — that is what Microsoft sees. Mail here; calendar and files need a Microsoft app, added later.';
6184
+ const all = kinds.includes('calendar') && kinds.includes('contacts');
6185
+ $('connexion-notice').textContent = provider === 'google'
6186
+ ? `Clavarium signs in with GNOME Online Accounts' app — that is what Google sees.${all ? ' Mail, calendar and contacts can be connected together.' : ''}`
6187
+ : `Clavarium signs in with GNOME Online Accounts' app — that is what Microsoft sees.${all ? ' Mail, calendar and contacts together, over Microsoft Graph.' : ''}`;
6174
6188
  $('connexion-open').textContent = `Open the ${who} sign-in page`;
6175
6189
  };
6176
6190
  for (const b of $('connexion-provider').querySelectorAll('button')) b.addEventListener('click', () => setConnexionProvider(b.dataset.provider));
@@ -6201,6 +6215,7 @@
6201
6215
  await paintAssets();
6202
6216
  });
6203
6217
  setConnexionProvider('google');
6218
+ getJson('/accounts', null).then((d) => { if (d?.supported) { accountSupported = d.supported; setConnexionProvider($('connexion-new').dataset.provider || 'google'); } });
6204
6219
  $('list-new').addEventListener('submit', async (event) => {
6205
6220
  event.preventDefault();
6206
6221
  $('assets-error').hidden = true;
package/web/index.html CHANGED
@@ -531,7 +531,7 @@
531
531
  </form>
532
532
  </div>
533
533
  <div id="connexion-box" class="as-form" data-kind="connexion"><h3>Connect an account</h3>
534
- <div class="hint">A live link to a mailbox, calendar or address book. The agent uses it through Tether, within the rights you give; the account's token stays on the server and never enters a machine. <details class="more"><summary>How the sign-in works</summary><span>Clavarium signs in as Thunderbird — that is what the provider sees. You sign in in your own browser; Clavarium never sees your password, and keeps only a token it uses on your behalf.</span></details></div>
534
+ <div class="hint">A live link to a mailbox, calendar or address book. The agent uses it through Tether, within the rights you give; the account's token stays on the server and never enters a machine. <details class="more"><summary>How the sign-in works</summary><span>Clavarium signs in by borrowing a trusted open-source desktop app's sign-in — that is what the provider sees. You sign in in your own browser; Clavarium never sees your password, and keeps only a token it uses on your behalf.</span></details></div>
535
535
  <form id="connexion-new" autocomplete="off" data-provider="google">
536
536
  <div id="connexion-provider" class="choices" role="group" aria-label="Kind of account">
537
537
  <button type="button" data-provider="google" aria-pressed="true">Google</button>
package/web/style.css CHANGED
@@ -167,6 +167,8 @@ code { font-family: ui-monospace, Menlo, Consolas, monospace; }
167
167
  .check { font-size: .8125rem; color: var(--ink2); display: flex; align-items: center; gap: 6px; }
168
168
  .check.off { opacity: .5; }
169
169
  #connexion-kinds { gap: 16px; }
170
+ /* The Google / Microsoft choice shows which is selected. */
171
+ #connexion-provider button[aria-pressed="true"] { border-color: var(--brass); color: var(--brass-ink); background: rgba(210, 169, 78, .16); }
170
172
  footer#keys { border-top: 0; }
171
173
  #voice-line { margin: 0; padding: 5px 12px; font-size: .8125rem; color: var(--ink2); background: var(--bar); border-top: 1px solid var(--line); overflow-wrap: anywhere; }
172
174
  #voice-line::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; background: var(--ok); }
@@ -1115,12 +1117,36 @@ header .ic, #folders .ic { width: 18px; height: 18px; fill: none; stroke: curren
1115
1117
  /* The by-group view: make-a-group bar, a group's name button, its inline editor. */
1116
1118
  .as-group-new { display: flex; align-items: center; gap: 6px; margin: 2px 0 4px; }
1117
1119
  .as-group-new .hint { color: var(--ink2); }
1118
- .as-group-head { gap: 2px; }
1119
- .as-chev { flex: 0 0 auto; width: 24px; height: 28px; min-width: 0 !important; min-height: 0 !important; padding: 0; background: transparent; border: 0; color: var(--ink2); font-size: .8rem; }
1120
- .as-group-name { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; justify-content: flex-start; text-align: left; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 2px 6px; }
1120
+ .as-group-head { gap: 4px; }
1121
+ .as-chev { flex: 0 0 auto; width: 16px; text-align: center; color: var(--ink2); font-size: .72rem; }
1122
+ .as-group-name { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; justify-content: flex-start; text-align: left; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 3px 6px; }
1121
1123
  .as-group-name:hover { border-color: var(--line); }
1122
1124
  .as-group-name[aria-current="true"] { background: var(--panel); border-color: var(--line); }
1125
+ .as-gear { flex: 0 0 auto; width: 30px; height: 30px; min-width: 0 !important; min-height: 0 !important; padding: 0; border-radius: 7px; border: 1px solid transparent; background: transparent; color: var(--ink2); font-size: 1rem; opacity: 1; }
1126
+ /* On a mouse, keep it quiet until the group is hovered or open; on touch (no
1127
+ hover) it must stay visible, or it can never be reached. */
1128
+ @media (hover: hover) { .as-gear { opacity: 0; } .as-group-head:hover .as-gear, .as-group-name[aria-current="true"] + .as-gear { opacity: 1; } }
1129
+ .as-gear:hover { border-color: var(--line); color: var(--ink); }
1123
1130
  .as-group-members { display: flex; flex-direction: column; gap: 2px; }
1131
+ /* Give the group: a block per conversation, a row per asset at its own level. */
1132
+ .as-give { display: flex; flex-direction: column; gap: 12px; }
1133
+ .as-give-conv { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
1134
+ .as-give-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
1135
+ .as-give-acts { display: flex; gap: 6px; }
1136
+ .as-mini { font-size: .72rem; padding: 3px 8px; border-radius: 7px; background: transparent; color: var(--ink2); }
1137
+ .as-mini:hover { border-color: var(--line); color: var(--ink); }
1138
+ .as-give-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; }
1139
+ .as-give-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
1140
+ .as-give-name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1141
+ .as-give-row .levels button { padding: 4px 9px; font-size: .78rem; }
1142
+ .as-add-conv { align-self: flex-start; }
1143
+ .as-pick { display: flex; flex-wrap: wrap; gap: 6px; }
1144
+ .as-pick-conv { font-size: .82rem; padding: 5px 10px; border-radius: 8px; }
1145
+ .as-group-rename { display: flex; gap: 8px; align-items: center; }
1146
+ .as-group-rename input { flex: 1 1 8rem; min-width: 0; padding: 7px 10px; border-radius: 8px; }
1147
+ .as-group-remove { margin-top: 6px; }
1148
+ .as-remove-link { background: transparent; border: 0; color: var(--danger); text-decoration: underline; padding: 2px 0; font: inherit; font-size: .82rem; }
1149
+ .as-group-remove .hint { margin: 2px 0 0; }
1124
1150
  .as-group-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%; }
1125
1151
  .as-group-form input { flex: 1 1 8rem; min-width: 0; padding: 6px 9px; border-radius: 8px; }
1126
1152
  .as-group-form button { font-size: .8125rem; }