clavarium 0.2.105-next.1 → 0.2.107-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.105-next.1",
3
+ "version": "0.2.107-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.105-next.1",
9
+ "version": "0.2.107-next.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.105-next.1",
3
+ "version": "0.2.107-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.",
package/server/main.mjs CHANGED
@@ -470,6 +470,8 @@ export async function startHome({ port, host, dataDir, mntDir = dataDir, gitRese
470
470
  alert: (payload) => { void alerts.tell(payload); } });
471
471
  /* Its machine restarted or built again: said in its chat, and the tool told to read it again. */
472
472
  all.renewed = (name, text, running) => talk.renewed(name, text, running);
473
+ /* A Tether call waiting for the owner is said in its conversation's thread, with Accept / Refuse. */
474
+ tethers.announce = (name, event) => { try { return talk.event(name, event); } catch { return null; } };
473
475
  /* A device given a conversation that talks through the app talks there too. */
474
476
  door.talk = talk;
475
477
  /* AFTER AN UPDATE, the machines that run get the new tools at once (parley, docket: they serve from
package/server/talk.mjs CHANGED
@@ -153,6 +153,11 @@ export const EVENT_LEVELS = Object.freeze({
153
153
  'docket-failed': 'needs-you',
154
154
  'docket-unhandled': 'needs-you',
155
155
  'docket-reminder': 'trace',
156
+ /* A Tether call its agent asks the owner to allow (tethers.mjs): offered in the thread with
157
+ Accept / Refuse, the same block a machine problem uses. Its closing line (decided here, from
158
+ Assets, or by the agent) is a trace that carries the call's id, so the buttons close with it. */
159
+ 'tether-demande': 'needs-you',
160
+ 'tether-done': 'trace',
156
161
  });
157
162
  const TONES = ['warn', 'bad'];
158
163
  /* Bounds of a line: its text, its group (topic), what the grouped line says of it (brief), its buttons. */
@@ -28,7 +28,10 @@ export const PUMP_MS = 1000;
28
28
  const AGENT = 'conversation:';
29
29
 
30
30
  export class Tethers {
31
- #keeper; #resources; #conversations; #secrets; #timers = []; #changes = 0;
31
+ #keeper; #resources; #conversations; #secrets; #timers = []; #changes = 0; #seen = new Map();
32
+ /* Set by the server once the thread is ready (main.mjs): (name, event) => talk.event(...).
33
+ A call waiting for the owner is said in its conversation's thread when there is one. */
34
+ announce = null;
32
35
 
33
36
  /* `resources`: Resources (workFolder). `conversations()`: the names of the conversations.
34
37
  `secrets`: the vault, read by name for a connector only (reveal). */
@@ -38,7 +41,34 @@ export class Tethers {
38
41
  /* Every change a page shows -- a new approval waiting, one decided, the targets,
39
42
  the journal -- bumps the counter the client watches, so the approvals screen
40
43
  sees them all at once, not only when a store change happens to wake it. */
41
- this.#keeper.onChange(() => { this.#changes++; });
44
+ this.#keeper.onChange(() => { this.#changes++; this.#tellNew(); });
45
+ }
46
+
47
+ /* A new call waiting for the owner is said in its conversation's thread -- the same block a
48
+ machine problem uses -- with Accept / Refuse; when it leaves the queue (decided here or from
49
+ Assets, or taken back by the agent) a trace carrying its id closes those buttons. Nothing is
50
+ said until the server wired `announce` (it holds the thread), and nothing to a conversation
51
+ whose chat is off keeps the line waiting for when it opens. */
52
+ #tellNew() {
53
+ if (!this.announce) return;
54
+ let now;
55
+ try { now = this.#keeper.approvals() ?? []; } catch { return; }
56
+ const live = new Set(now.map((r) => r.id));
57
+ for (const r of now) {
58
+ if (this.#seen.has(r.id)) continue;
59
+ const who = r.agent?.id ?? '';
60
+ if (!who.startsWith(AGENT)) continue;
61
+ const name = who.slice(AGENT.length);
62
+ this.#seen.set(r.id, { name, verb: r.verb ?? 'action' });
63
+ const what = [r.verb ?? 'action', r.detail].filter(Boolean).join(' ');
64
+ const text = [what, r.target?.title ? `(${r.target.title})` : '', r.why ? `-- ${r.why}` : ''].filter(Boolean).join(' ');
65
+ try { this.announce(name, { kind: 'tether-demande', text: text || (r.verb ?? 'A Tether call'), topic: 'Demande', tone: 'warn', actions: [`allow:${r.id}`, `deny:${r.id}`] }); } catch { /* its chat is off */ }
66
+ }
67
+ for (const [id, info] of [...this.#seen]) {
68
+ if (live.has(id)) continue;
69
+ this.#seen.delete(id);
70
+ try { this.announce(info.name, { kind: 'tether-done', text: `Request handled: ${info.verb}`, topic: 'Demande', brief: id }); } catch { /* its chat is off */ }
71
+ }
42
72
  }
43
73
 
44
74
  /* A secret's value for a connector, by name, from this server's vault; never seen by the agent.
package/web/app.js CHANGED
@@ -2553,7 +2553,7 @@
2553
2553
  /* A reaction to one of its messages: wherever the chat may be written in. */
2554
2554
  ...(!DEVICE || deviceParts.chat === 'write' ? { react: (to, reaction) => post(talkPath(name, '/react'), { to, reaction }) } : {}),
2555
2555
  /* The buttons of a line of the machine: what this screen may do. */
2556
- act: (id) => { if (id === 'seen-done') return; if (id === 'seen') void markSeen(); else if (id === 'memory') void openMemory(); else if (id === 'disk') void openDisk(); else if (id === 'room') seeTerminal(); else if (id === 'restart') void restartMachine(false); else if (id === 'terminal') seeTerminal(); else if (id.startsWith('review:')) void openGit(id.slice('review:'.length)); else openCommits(id); },
2556
+ act: (id) => { if (id === 'seen-done') return; if (id === 'seen') void markSeen(); else if (id === 'memory') void openMemory(); else if (id === 'disk') void openDisk(); else if (id === 'room') seeTerminal(); else if (id === 'restart') void restartMachine(false); else if (id === 'terminal') seeTerminal(); else if (id.startsWith('allow:')) void decideTether(id.slice('allow:'.length), 'yes'); else if (id.startsWith('deny:')) void decideTether(id.slice('deny:'.length), 'no'); else if (id.startsWith('review:')) void openGit(id.slice('review:'.length)); else openCommits(id); },
2557
2557
  /* What it opens over the thread (a picture, its media, a search...) is a step of this page's: one Back closes it. */
2558
2558
  back: { open: (name, close) => nav.over(`chat-${name}`, () => close(), { stack: true }), closed: (step) => { if (step) nav.drop(step); } },
2559
2559
  /* Files attached to a message: wherever the chat may be written in. */
@@ -2682,8 +2682,10 @@
2682
2682
  /* "commits:<repository>.<to>.<from>.<n>": those commits, in the review ("See the 3 commits"). A commit a
2683
2683
  line names (7 to 40 hexadecimal characters, a digit among them) is a link to its review, on a line about
2684
2684
  a repository; the agent's own messages are never read for this. */
2685
- const ACTIONS = { memory: 'More memory...', disk: 'Give it more disk...', room: 'See what takes room', restart: 'Restart...', terminal: 'See the terminal', review: 'Open the review', seen: '\u2713 Seen' };
2685
+ const ACTIONS = { memory: 'More memory...', disk: 'Give it more disk...', room: 'See what takes room', restart: 'Restart...', terminal: 'See the terminal', review: 'Open the review', seen: '\u2713 Seen', allow: 'Accept', deny: 'Refuse' };
2686
2686
  const COMMITS = /^commits:([a-z0-9][a-z0-9-]*)\.([0-9a-f]{7,40})\.([0-9a-f]{7,40})\.(\d{1,4})$/;
2687
+ /* A Tether call an agent asked the owner to allow, offered right in the thread: allow:<id> / deny:<id>. */
2688
+ const DEMANDE = /^(allow|deny):[0-9a-f-]{36}$/;
2687
2689
  const COMMIT = /^commit:([a-z0-9][a-z0-9-]*)\.([0-9a-f]{7,40})$/;
2688
2690
  function openCommits(id) {
2689
2691
  if (DEVICE) return;
@@ -2694,7 +2696,7 @@
2694
2696
  function machineLines(data) {
2695
2697
  if (!Array.isArray(data?.messages)) return data;
2696
2698
  const kindOf = (id) => String(id).split(':')[0];
2697
- const may = (id) => (id === 'terminal' || id === 'room' ? !noTerminal() : id === 'disk' ? !DEVICE && !narrow() : (id === 'memory' || id === 'restart' || id === 'seen' || id === 'seen-done' || /^review:[a-z0-9][a-z0-9._-]*$/.test(id) || COMMITS.test(id)) && !DEVICE);
2699
+ const may = (id) => (id === 'terminal' || id === 'room' ? !noTerminal() : id === 'disk' ? !DEVICE && !narrow() : (id === 'memory' || id === 'restart' || id === 'seen' || id === 'seen-done' || DEMANDE.test(id) || /^review:[a-z0-9][a-z0-9._-]*$/.test(id) || COMMITS.test(id)) && !DEVICE);
2698
2700
  const label = (id) => { const n = Number(COMMITS.exec(id)?.[4] ?? 0); return n ? (n === 1 ? 'See the commit' : `See the ${n} commits`) : ACTIONS[kindOf(id)]; };
2699
2701
  const linksOf = (m) => {
2700
2702
  const repo = DEVICE ? null : (m.actions ?? []).map((id) => /^review:([a-z0-9][a-z0-9-]*)$/.exec(id)?.[1]).find(Boolean);
@@ -2706,7 +2708,10 @@
2706
2708
  const seenWords = seenAt ? `\u2713 Seen ${new Date(seenAt).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}` : '';
2707
2709
  /* Restart, offered by a line, is offered no more once its machine was restarted after it. */
2708
2710
  const restartedAt = data.messages.filter((m) => m.from === 'system' && m.event === 'restarted').map((m) => String(m.at ?? '')).sort().pop() ?? '';
2709
- const actionsOf = (m) => (m.actions ?? []).filter(may).filter((id) => !(id === 'restart' && restartedAt && String(m.at ?? '') < restartedAt))
2711
+ /* A Tether demande decided (here, from Assets, or by the agent) is marked done in the thread,
2712
+ carrying its id: Accept / Refuse are then offered no more on the line that asked. */
2713
+ const settled = new Set(data.messages.filter((m) => m.from === 'system' && m.event === 'tether-done' && m.brief).map((m) => String(m.brief)));
2714
+ const actionsOf = (m) => (m.actions ?? []).filter(may).filter((id) => !(id === 'restart' && restartedAt && String(m.at ?? '') < restartedAt)).filter((id) => !(DEMANDE.test(id) && settled.has(id.slice(id.indexOf(':') + 1))))
2710
2715
  .map((id) => (id === 'seen' && seenAt && String(m.at ?? '') <= seenAt ? { id: 'seen-done', label: seenWords } : { id, label: label(id) }));
2711
2716
  return { ...data, messages: data.messages.map((m) => (m.from === 'system' ? { ...m, actions: actionsOf(m), links: linksOf(m) } : m)) };
2712
2717
  }
@@ -3186,7 +3191,7 @@
3186
3191
  line.append(summary, el('pre', '', rest));
3187
3192
  return line;
3188
3193
  }
3189
- const kindIcon = (kind) => { const name = kind === 'send' ? 'arrow-up' : ASSET_KINDS.find((k) => k[0] === kind)?.[2]; const holder = el('span', 'as-ic'); holder.dataset.kind = kind; const svg = kind === 'list' ? listIcon() : name ? window.clavariumIcons?.icon(name) : null; if (svg) holder.append(svg); return holder; };
3194
+ const kindIcon = (kind) => { const name = kind === 'send' || kind === 'demandes' ? 'arrow-up' : ASSET_KINDS.find((k) => k[0] === kind)?.[2]; const holder = el('span', 'as-ic'); holder.dataset.kind = kind; const svg = kind === 'list' ? listIcon() : name ? window.clavariumIcons?.icon(name) : null; if (svg) holder.append(svg); return holder; };
3190
3195
  /* A list (Binder's): the set has no such sign, so it is drawn here, in its style. */
3191
3196
  function listIcon() {
3192
3197
  const SVG = 'http://www.w3.org/2000/svg';
@@ -3887,9 +3892,13 @@
3887
3892
  /* ---- a conversation's own ---- */
3888
3893
  async function paintRoomAssets() {
3889
3894
  if (!assetsShown) return;
3895
+ watchTether();
3890
3896
  const c = conversations.find((x) => x.name === current);
3891
3897
  roomSig = JSON.stringify([current, c?.resources, c?.secrets, c?.work]);
3892
- const [all, secrets, boxes] = await Promise.all([getJson('/resources', []), getJson('/secrets', []), getJson('/mailboxes', [])]);
3898
+ const [all, secrets, boxes, tether] = await Promise.all([getJson('/resources', []), getJson('/secrets', []), getJson('/mailboxes', []), getJson('/tether', {})]);
3899
+ /* The calls this conversation's agent asked the owner to allow: validated here,
3900
+ in the parloir, without leaving for the Assets page. */
3901
+ const mineDemandes = (Array.isArray(tether.approvals) ? tether.approvals : []).filter((q) => (q.agent?.id ?? '') === `conversation:${current}`);
3893
3902
  const mine = new Map((c?.resources ?? []).map((r) => [r.name, r.access]));
3894
3903
  const items = [];
3895
3904
  if (c?.work === 'kept') items.push({ key: 'folder:work', kind: 'folder', name: 'work', own: true, sub: 'where its tool works', badge: 'write', badgeTone: 'write' });
@@ -3904,19 +3913,23 @@
3904
3913
  /* TO SEND, above them all, once it has a repository: every one of them on one screen. */
3905
3914
  const gits = items.filter((i) => i.kind === 'git').map((i) => i.name);
3906
3915
  const outbox = gits.length ? { key: 'send:all', kind: 'send', name: 'To send', sub: 'every repository, reviewed and sent at once' } : null;
3907
- const chosen = (outbox && roomPick === outbox.key ? outbox : null) ?? items.find((i) => i.key === roomPick) ?? null;
3916
+ const demandes = mineDemandes.length ? { key: 'demandes:mine', kind: 'demandes', name: 'Demandes', sub: `${mineDemandes.length} waiting for you` } : null;
3917
+ const chosen = (outbox && roomPick === outbox.key ? outbox : null) ?? (demandes && roomPick === demandes.key ? demandes : null) ?? items.find((i) => i.key === roomPick) ?? null;
3908
3918
  const as = $('cassets-as');
3909
3919
  as.dataset.open = chosen ? 'detail' : 'list';
3910
3920
  paintAsList($('cassets-rows'), items, { chosen: chosen?.key, choose: (key) => pickRoomAsset(key), empty: 'Nothing is given to it yet.' });
3911
3921
  const top = el('div', 'as-kind-head as-list-top'); top.append(el('h3', '', 'This conversation'), roundPlus('Attach an asset', () => { void openAccess(true); }));
3912
- if (outbox) {
3913
- const row = el('button', 'as-row ts-entry'); row.type = 'button'; row.dataset.asset = outbox.key;
3914
- if (chosen === outbox) row.setAttribute('aria-current', 'true');
3915
- const words = el('span', 'as-words'); words.append(el('b', '', outbox.name), el('small', 'as-sub', outbox.sub));
3922
+ const pinnedRow = (entry, extra) => {
3923
+ const row = el('button', `as-row ts-entry${extra ? ` ${extra}` : ''}`); row.type = 'button'; row.dataset.asset = entry.key;
3924
+ if (chosen === entry) row.setAttribute('aria-current', 'true');
3925
+ const words = el('span', 'as-words'); words.append(el('b', '', entry.name), el('small', 'as-sub', entry.sub));
3916
3926
  row.append(kindIcon('send'), words);
3917
- row.addEventListener('click', () => pickRoomAsset(outbox.key));
3918
- $('cassets-rows').prepend(row);
3919
- }
3927
+ if (entry.key === 'demandes:mine') row.append(el('b', 'count', String(mineDemandes.length)));
3928
+ row.addEventListener('click', () => pickRoomAsset(entry.key));
3929
+ return row;
3930
+ };
3931
+ if (outbox) $('cassets-rows').prepend(pinnedRow(outbox));
3932
+ if (demandes) $('cassets-rows').prepend(pinnedRow(demandes, 'demande-entry'));
3920
3933
  $('cassets-rows').prepend(top);
3921
3934
  if (c?.work === 'disk') $('cassets-rows').append(el('p', 'hint as-disk', 'Its work is on the disk of its machine: nothing of it is kept here.'));
3922
3935
  const detail = $('cassets-detail');
@@ -3927,7 +3940,10 @@
3927
3940
  const back = () => { roomPick = ''; void paintRoomAssets(); };
3928
3941
  if (keepFiles) { void paintFiles(); return; }
3929
3942
  detail.append(asTitle(chosen, back));
3930
- if (chosen.kind === 'folder' || chosen.kind === 'mailbox') {
3943
+ if (chosen.kind === 'demandes') {
3944
+ detail.append(el('p', 'hint', 'Its agent asked you to allow these Tether calls. Accept, and it runs; refuse, and it is told so.'));
3945
+ detail.append(demandesList(mineDemandes, { withWho: false, after: () => paintRoomAssets() }));
3946
+ } else if (chosen.kind === 'folder' || chosen.kind === 'mailbox') {
3931
3947
  if (chosen.kind === 'mailbox' && !chosen.target) detail.append(el('p', chosen.box?.failure ? 'error' : 'hint', boxSub(chosen.box)));
3932
3948
  embedFiles(detail, chosen.name);
3933
3949
  } else if (chosen.kind === 'send') await sendDetail(detail, gits);
@@ -4054,12 +4070,62 @@
4054
4070
  catch (error) { $('assets-error').textContent = error.message; $('assets-error').hidden = false; }
4055
4071
  await refresh();
4056
4072
  }
4057
- /* Accept or refuse a Tether call that is waiting for a person. */
4058
- async function decideTether(id, decision) {
4073
+ /* Accept or refuse a Tether call that is waiting for a person. `after` repaints the
4074
+ surface the row sits in (the Assets page by default; the room passes its own). */
4075
+ async function decideTether(id, decision, after) {
4059
4076
  $('assets-error').hidden = true;
4060
4077
  try { await post(`${API}/tether/decide`, { id, decision }); }
4061
4078
  catch (error) { $('assets-error').textContent = error.message; $('assets-error').hidden = false; }
4062
- await paintAssets();
4079
+ if (after) await after(); else await paintAssets();
4080
+ }
4081
+ /* One Tether call waiting for the owner, as a row: what it would do, who asks and on
4082
+ which target, then Accept / Refuse. `withWho`: name the conversation that asks (the
4083
+ exhaustive list spans them all). `after`: repaint the surface once it is decided. */
4084
+ function demandeRow(q, { withWho = false, after } = {}) {
4085
+ const line = el('div', 'given-row demande');
4086
+ const what = el('span', 'demande-what');
4087
+ const head = el('span', 'demande-head'); head.append(el('b', '', q.verb ?? 'action'));
4088
+ if (q.detail) head.append(document.createTextNode(` ${q.detail}`));
4089
+ what.append(head);
4090
+ const tags = [withWho ? q.agent?.name : '', q.target?.title].filter(Boolean);
4091
+ if (tags.length) what.append(el('small', 'as-sub demande-who', tags.join(' · ')));
4092
+ if (q.why) what.append(el('small', 'hint demande-why', q.why));
4093
+ const yes = el('button', 'primary', 'Accept'); yes.type = 'button';
4094
+ const no = el('button', 'danger', 'Refuse'); no.type = 'button';
4095
+ const decide = (d) => { yes.disabled = true; no.disabled = true; void decideTether(q.id, d, after); };
4096
+ yes.addEventListener('click', () => decide('yes'));
4097
+ no.addEventListener('click', () => decide('no'));
4098
+ const acts = el('div', 'levels'); acts.append(yes, no);
4099
+ line.append(what, acts);
4100
+ return line;
4101
+ }
4102
+ /* Every call waiting for the owner, on one surface. `withWho`: name who asks. */
4103
+ function demandesList(approvals, { withWho = false, after } = {}) {
4104
+ const box = el('div', 'as-users demandes-box');
4105
+ for (const q of approvals) box.append(demandeRow(q, { withWho, after }));
4106
+ return box;
4107
+ }
4108
+ /* While the owner is on Assets or a room, the calls waiting for them appear and update
4109
+ on their own: nothing on this page is polled for Tether otherwise, so a new call or
4110
+ a decided one would wait for the next click. A light watch of the one number that
4111
+ moves with every change (tethers.changes) repaints the open surface when it moves. */
4112
+ let tetherSeen = null; let tetherTimer = 0;
4113
+ const tetherViewOpen = () => !DEVICE && (place === 'assets' || assetsShown);
4114
+ function watchTether() {
4115
+ if (tetherTimer || !tetherViewOpen()) return;
4116
+ const tick = async () => {
4117
+ if (!tetherViewOpen()) { tetherTimer = 0; tetherSeen = null; return; }
4118
+ const t = await getJson('/tether', null);
4119
+ if (t && typeof t.changes === 'number') {
4120
+ if (tetherSeen !== null && t.changes !== tetherSeen) {
4121
+ if (place === 'assets') void paintAssets();
4122
+ else if (assetsShown) void paintRoomAssets();
4123
+ }
4124
+ tetherSeen = t.changes;
4125
+ }
4126
+ tetherTimer = setTimeout(tick, 2500);
4127
+ };
4128
+ tetherTimer = setTimeout(tick, 0);
4063
4129
  }
4064
4130
  /* A new list: Binder's templates, read once. */
4065
4131
  async function fillTemplates() {
@@ -4071,6 +4137,7 @@
4071
4137
  }
4072
4138
  async function paintAssets() {
4073
4139
  if (place !== 'assets' || DEVICE) return;
4140
+ watchTether();
4074
4141
  const [all, boxes, secrets, keys, lists, tether, assetGroups] = await Promise.all([getJson('/resources', []), getJson('/mailboxes', []), getJson('/secrets', []), getJson('/git-keys', []), binderCall('lists', {}), getJson('/tether', {}), getJson('/asset-groups', []), readDevices()]);
4075
4142
  if (place !== 'assets') return;
4076
4143
  paintKeys(keys);
@@ -4105,7 +4172,11 @@
4105
4172
  const chosen = assetsAdding ? null : items.find((i) => i.key === assetOpen) ?? null;
4106
4173
  /* A group can be the open thing too (its own detail: give it, rename it). */
4107
4174
  const chosenGroup = !assetsAdding && !chosen && assetOpen.startsWith('group:') ? assetGroups.find((g) => `group:${g.id}` === assetOpen) ?? null : null;
4108
- $('assets-as').dataset.open = chosen || chosenGroup || assetsAdding ? 'detail' : 'list';
4175
+ /* Every call waiting for the owner, across all the connexions, gathered in one place
4176
+ (in a connexion's own detail they still show, but only that one's). */
4177
+ const allApprovals = Array.isArray(tether.approvals) ? tether.approvals : [];
4178
+ const onDemandes = !assetsAdding && !chosen && !chosenGroup && assetOpen === 'demandes:all';
4179
+ $('assets-as').dataset.open = chosen || chosenGroup || assetsAdding || onDemandes ? 'detail' : 'list';
4109
4180
  /* The "by type / by group" toggle sits above the rows (built once, kept). */
4110
4181
  paintAssetsView();
4111
4182
  const choose = (key) => { placeAssetStep(); if (key !== assetOpen) groupGiveShow.clear(); assetOpen = key; assetsAdding = ''; remoteEditing = false; remember(); void paintAssets(); };
@@ -4114,6 +4185,16 @@
4114
4185
  } else {
4115
4186
  paintAsList($('assets-rows'), shown, { chosen: chosen?.key, choose, add: (kind) => { placeAssetStep(); assetsAdding = kind; void paintAssets(); }, empty: assetsQuery ? 'Nothing by that name.' : '' });
4116
4187
  }
4188
+ /* Above them all, once something waits: the owner reaches every call from here,
4189
+ not only by opening the right connexion. */
4190
+ if (allApprovals.length && !assetsQuery) {
4191
+ const row = el('button', 'as-row ts-entry demande-entry'); row.type = 'button'; row.dataset.asset = 'demandes:all';
4192
+ if (onDemandes) row.setAttribute('aria-current', 'true');
4193
+ const words = el('span', 'as-words'); words.append(el('b', '', 'Demandes'), el('small', 'as-sub', `${allApprovals.length} waiting for you`));
4194
+ row.append(kindIcon('send'), words, el('b', 'count', String(allApprovals.length)));
4195
+ row.addEventListener('click', () => choose('demandes:all'));
4196
+ $('assets-rows').prepend(row);
4197
+ }
4117
4198
  const detail = $('assets-detail');
4118
4199
  /* The forms go back to where they wait before the detail is drawn again. */
4119
4200
  for (const form of detail.querySelectorAll('.as-form, #gitview-remote-box')) $('assets-forms').append(form);
@@ -4151,6 +4232,13 @@
4151
4232
  return;
4152
4233
  }
4153
4234
  if (chosenGroup) { groupDetail(detail, chosenGroup, items, back); return; }
4235
+ if (onDemandes) {
4236
+ detail.append(asTitle({ kind: 'send', name: 'Demandes', badge: String(allApprovals.length), badgeTone: 'count' }, back));
4237
+ detail.append(el('p', 'hint', 'Each is a Tether call its agent asked you to allow. Accept, and it runs; refuse, and it is told so.'));
4238
+ if (allApprovals.length) detail.append(demandesList(allApprovals, { withWho: true, after: () => paintAssets() }));
4239
+ else detail.append(el('p', 'hint', 'Nothing is waiting now.'));
4240
+ return;
4241
+ }
4154
4242
  if (!chosen) { if (items.length) detail.append(noAssetChosen()); return; }
4155
4243
  detail.append(asTitle(chosen, back));
4156
4244
  detail.append(groupPicker(chosen, assetGroups));
package/web/style.css CHANGED
@@ -1516,6 +1516,13 @@ button.inline.more-recent { text-decoration: none; }
1516
1516
 
1517
1517
  /* TO SEND: every repository of a conversation, one row each, then one review of those ticked. */
1518
1518
  .ts-entry .as-ic { color: var(--brass-ink); }
1519
+ /* DEMANDES: the Tether calls waiting for the owner, gathered as one entry (Assets, and each
1520
+ room's own), each a line with what it would do, who asks, why, then Accept / Refuse. */
1521
+ .demande-entry .count { margin-left: auto; align-self: center; }
1522
+ .demande-what { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
1523
+ .demande-head { overflow-wrap: anywhere; }
1524
+ .demande-who { color: var(--ink2); }
1525
+ .demande-why { display: block; margin: 0; }
1519
1526
  .ts-rows { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
1520
1527
  .ts-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) minmax(0, 1.6fr) max-content minmax(0, 1fr); gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
1521
1528
  .ts-row.off { opacity: .6; }