clavarium 0.2.105-next.1 → 0.2.106-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/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/web/app.js +98 -15
- package/web/style.css +7 -0
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.106-next.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "clavarium",
|
|
9
|
-
"version": "0.2.
|
|
9
|
+
"version": "0.2.106-next.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/package.json
CHANGED
package/web/app.js
CHANGED
|
@@ -3186,7 +3186,7 @@
|
|
|
3186
3186
|
line.append(summary, el('pre', '', rest));
|
|
3187
3187
|
return line;
|
|
3188
3188
|
}
|
|
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; };
|
|
3189
|
+
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
3190
|
/* A list (Binder's): the set has no such sign, so it is drawn here, in its style. */
|
|
3191
3191
|
function listIcon() {
|
|
3192
3192
|
const SVG = 'http://www.w3.org/2000/svg';
|
|
@@ -3887,9 +3887,13 @@
|
|
|
3887
3887
|
/* ---- a conversation's own ---- */
|
|
3888
3888
|
async function paintRoomAssets() {
|
|
3889
3889
|
if (!assetsShown) return;
|
|
3890
|
+
watchTether();
|
|
3890
3891
|
const c = conversations.find((x) => x.name === current);
|
|
3891
3892
|
roomSig = JSON.stringify([current, c?.resources, c?.secrets, c?.work]);
|
|
3892
|
-
const [all, secrets, boxes] = await Promise.all([getJson('/resources', []), getJson('/secrets', []), getJson('/mailboxes', [])]);
|
|
3893
|
+
const [all, secrets, boxes, tether] = await Promise.all([getJson('/resources', []), getJson('/secrets', []), getJson('/mailboxes', []), getJson('/tether', {})]);
|
|
3894
|
+
/* The calls this conversation's agent asked the owner to allow: validated here,
|
|
3895
|
+
in the parloir, without leaving for the Assets page. */
|
|
3896
|
+
const mineDemandes = (Array.isArray(tether.approvals) ? tether.approvals : []).filter((q) => (q.agent?.id ?? '') === `conversation:${current}`);
|
|
3893
3897
|
const mine = new Map((c?.resources ?? []).map((r) => [r.name, r.access]));
|
|
3894
3898
|
const items = [];
|
|
3895
3899
|
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 +3908,23 @@
|
|
|
3904
3908
|
/* TO SEND, above them all, once it has a repository: every one of them on one screen. */
|
|
3905
3909
|
const gits = items.filter((i) => i.kind === 'git').map((i) => i.name);
|
|
3906
3910
|
const outbox = gits.length ? { key: 'send:all', kind: 'send', name: 'To send', sub: 'every repository, reviewed and sent at once' } : null;
|
|
3907
|
-
const
|
|
3911
|
+
const demandes = mineDemandes.length ? { key: 'demandes:mine', kind: 'demandes', name: 'Demandes', sub: `${mineDemandes.length} waiting for you` } : null;
|
|
3912
|
+
const chosen = (outbox && roomPick === outbox.key ? outbox : null) ?? (demandes && roomPick === demandes.key ? demandes : null) ?? items.find((i) => i.key === roomPick) ?? null;
|
|
3908
3913
|
const as = $('cassets-as');
|
|
3909
3914
|
as.dataset.open = chosen ? 'detail' : 'list';
|
|
3910
3915
|
paintAsList($('cassets-rows'), items, { chosen: chosen?.key, choose: (key) => pickRoomAsset(key), empty: 'Nothing is given to it yet.' });
|
|
3911
3916
|
const top = el('div', 'as-kind-head as-list-top'); top.append(el('h3', '', 'This conversation'), roundPlus('Attach an asset', () => { void openAccess(true); }));
|
|
3912
|
-
|
|
3913
|
-
const row = el('button',
|
|
3914
|
-
if (chosen ===
|
|
3915
|
-
const words = el('span', 'as-words'); words.append(el('b', '',
|
|
3917
|
+
const pinnedRow = (entry, extra) => {
|
|
3918
|
+
const row = el('button', `as-row ts-entry${extra ? ` ${extra}` : ''}`); row.type = 'button'; row.dataset.asset = entry.key;
|
|
3919
|
+
if (chosen === entry) row.setAttribute('aria-current', 'true');
|
|
3920
|
+
const words = el('span', 'as-words'); words.append(el('b', '', entry.name), el('small', 'as-sub', entry.sub));
|
|
3916
3921
|
row.append(kindIcon('send'), words);
|
|
3917
|
-
row.
|
|
3918
|
-
|
|
3919
|
-
|
|
3922
|
+
if (entry.key === 'demandes:mine') row.append(el('b', 'count', String(mineDemandes.length)));
|
|
3923
|
+
row.addEventListener('click', () => pickRoomAsset(entry.key));
|
|
3924
|
+
return row;
|
|
3925
|
+
};
|
|
3926
|
+
if (outbox) $('cassets-rows').prepend(pinnedRow(outbox));
|
|
3927
|
+
if (demandes) $('cassets-rows').prepend(pinnedRow(demandes, 'demande-entry'));
|
|
3920
3928
|
$('cassets-rows').prepend(top);
|
|
3921
3929
|
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
3930
|
const detail = $('cassets-detail');
|
|
@@ -3927,7 +3935,10 @@
|
|
|
3927
3935
|
const back = () => { roomPick = ''; void paintRoomAssets(); };
|
|
3928
3936
|
if (keepFiles) { void paintFiles(); return; }
|
|
3929
3937
|
detail.append(asTitle(chosen, back));
|
|
3930
|
-
if (chosen.kind === '
|
|
3938
|
+
if (chosen.kind === 'demandes') {
|
|
3939
|
+
detail.append(el('p', 'hint', 'Its agent asked you to allow these Tether calls. Accept, and it runs; refuse, and it is told so.'));
|
|
3940
|
+
detail.append(demandesList(mineDemandes, { withWho: false, after: () => paintRoomAssets() }));
|
|
3941
|
+
} else if (chosen.kind === 'folder' || chosen.kind === 'mailbox') {
|
|
3931
3942
|
if (chosen.kind === 'mailbox' && !chosen.target) detail.append(el('p', chosen.box?.failure ? 'error' : 'hint', boxSub(chosen.box)));
|
|
3932
3943
|
embedFiles(detail, chosen.name);
|
|
3933
3944
|
} else if (chosen.kind === 'send') await sendDetail(detail, gits);
|
|
@@ -4054,12 +4065,62 @@
|
|
|
4054
4065
|
catch (error) { $('assets-error').textContent = error.message; $('assets-error').hidden = false; }
|
|
4055
4066
|
await refresh();
|
|
4056
4067
|
}
|
|
4057
|
-
/* Accept or refuse a Tether call that is waiting for a person.
|
|
4058
|
-
|
|
4068
|
+
/* Accept or refuse a Tether call that is waiting for a person. `after` repaints the
|
|
4069
|
+
surface the row sits in (the Assets page by default; the room passes its own). */
|
|
4070
|
+
async function decideTether(id, decision, after) {
|
|
4059
4071
|
$('assets-error').hidden = true;
|
|
4060
4072
|
try { await post(`${API}/tether/decide`, { id, decision }); }
|
|
4061
4073
|
catch (error) { $('assets-error').textContent = error.message; $('assets-error').hidden = false; }
|
|
4062
|
-
await paintAssets();
|
|
4074
|
+
if (after) await after(); else await paintAssets();
|
|
4075
|
+
}
|
|
4076
|
+
/* One Tether call waiting for the owner, as a row: what it would do, who asks and on
|
|
4077
|
+
which target, then Accept / Refuse. `withWho`: name the conversation that asks (the
|
|
4078
|
+
exhaustive list spans them all). `after`: repaint the surface once it is decided. */
|
|
4079
|
+
function demandeRow(q, { withWho = false, after } = {}) {
|
|
4080
|
+
const line = el('div', 'given-row demande');
|
|
4081
|
+
const what = el('span', 'demande-what');
|
|
4082
|
+
const head = el('span', 'demande-head'); head.append(el('b', '', q.verb ?? 'action'));
|
|
4083
|
+
if (q.detail) head.append(document.createTextNode(` ${q.detail}`));
|
|
4084
|
+
what.append(head);
|
|
4085
|
+
const tags = [withWho ? q.agent?.name : '', q.target?.title].filter(Boolean);
|
|
4086
|
+
if (tags.length) what.append(el('small', 'as-sub demande-who', tags.join(' · ')));
|
|
4087
|
+
if (q.why) what.append(el('small', 'hint demande-why', q.why));
|
|
4088
|
+
const yes = el('button', 'primary', 'Accept'); yes.type = 'button';
|
|
4089
|
+
const no = el('button', 'danger', 'Refuse'); no.type = 'button';
|
|
4090
|
+
const decide = (d) => { yes.disabled = true; no.disabled = true; void decideTether(q.id, d, after); };
|
|
4091
|
+
yes.addEventListener('click', () => decide('yes'));
|
|
4092
|
+
no.addEventListener('click', () => decide('no'));
|
|
4093
|
+
const acts = el('div', 'levels'); acts.append(yes, no);
|
|
4094
|
+
line.append(what, acts);
|
|
4095
|
+
return line;
|
|
4096
|
+
}
|
|
4097
|
+
/* Every call waiting for the owner, on one surface. `withWho`: name who asks. */
|
|
4098
|
+
function demandesList(approvals, { withWho = false, after } = {}) {
|
|
4099
|
+
const box = el('div', 'as-users demandes-box');
|
|
4100
|
+
for (const q of approvals) box.append(demandeRow(q, { withWho, after }));
|
|
4101
|
+
return box;
|
|
4102
|
+
}
|
|
4103
|
+
/* While the owner is on Assets or a room, the calls waiting for them appear and update
|
|
4104
|
+
on their own: nothing on this page is polled for Tether otherwise, so a new call or
|
|
4105
|
+
a decided one would wait for the next click. A light watch of the one number that
|
|
4106
|
+
moves with every change (tethers.changes) repaints the open surface when it moves. */
|
|
4107
|
+
let tetherSeen = null; let tetherTimer = 0;
|
|
4108
|
+
const tetherViewOpen = () => !DEVICE && (place === 'assets' || assetsShown);
|
|
4109
|
+
function watchTether() {
|
|
4110
|
+
if (tetherTimer || !tetherViewOpen()) return;
|
|
4111
|
+
const tick = async () => {
|
|
4112
|
+
if (!tetherViewOpen()) { tetherTimer = 0; tetherSeen = null; return; }
|
|
4113
|
+
const t = await getJson('/tether', null);
|
|
4114
|
+
if (t && typeof t.changes === 'number') {
|
|
4115
|
+
if (tetherSeen !== null && t.changes !== tetherSeen) {
|
|
4116
|
+
if (place === 'assets') void paintAssets();
|
|
4117
|
+
else if (assetsShown) void paintRoomAssets();
|
|
4118
|
+
}
|
|
4119
|
+
tetherSeen = t.changes;
|
|
4120
|
+
}
|
|
4121
|
+
tetherTimer = setTimeout(tick, 2500);
|
|
4122
|
+
};
|
|
4123
|
+
tetherTimer = setTimeout(tick, 0);
|
|
4063
4124
|
}
|
|
4064
4125
|
/* A new list: Binder's templates, read once. */
|
|
4065
4126
|
async function fillTemplates() {
|
|
@@ -4071,6 +4132,7 @@
|
|
|
4071
4132
|
}
|
|
4072
4133
|
async function paintAssets() {
|
|
4073
4134
|
if (place !== 'assets' || DEVICE) return;
|
|
4135
|
+
watchTether();
|
|
4074
4136
|
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
4137
|
if (place !== 'assets') return;
|
|
4076
4138
|
paintKeys(keys);
|
|
@@ -4105,7 +4167,11 @@
|
|
|
4105
4167
|
const chosen = assetsAdding ? null : items.find((i) => i.key === assetOpen) ?? null;
|
|
4106
4168
|
/* A group can be the open thing too (its own detail: give it, rename it). */
|
|
4107
4169
|
const chosenGroup = !assetsAdding && !chosen && assetOpen.startsWith('group:') ? assetGroups.find((g) => `group:${g.id}` === assetOpen) ?? null : null;
|
|
4108
|
-
|
|
4170
|
+
/* Every call waiting for the owner, across all the connexions, gathered in one place
|
|
4171
|
+
(in a connexion's own detail they still show, but only that one's). */
|
|
4172
|
+
const allApprovals = Array.isArray(tether.approvals) ? tether.approvals : [];
|
|
4173
|
+
const onDemandes = !assetsAdding && !chosen && !chosenGroup && assetOpen === 'demandes:all';
|
|
4174
|
+
$('assets-as').dataset.open = chosen || chosenGroup || assetsAdding || onDemandes ? 'detail' : 'list';
|
|
4109
4175
|
/* The "by type / by group" toggle sits above the rows (built once, kept). */
|
|
4110
4176
|
paintAssetsView();
|
|
4111
4177
|
const choose = (key) => { placeAssetStep(); if (key !== assetOpen) groupGiveShow.clear(); assetOpen = key; assetsAdding = ''; remoteEditing = false; remember(); void paintAssets(); };
|
|
@@ -4114,6 +4180,16 @@
|
|
|
4114
4180
|
} else {
|
|
4115
4181
|
paintAsList($('assets-rows'), shown, { chosen: chosen?.key, choose, add: (kind) => { placeAssetStep(); assetsAdding = kind; void paintAssets(); }, empty: assetsQuery ? 'Nothing by that name.' : '' });
|
|
4116
4182
|
}
|
|
4183
|
+
/* Above them all, once something waits: the owner reaches every call from here,
|
|
4184
|
+
not only by opening the right connexion. */
|
|
4185
|
+
if (allApprovals.length && !assetsQuery) {
|
|
4186
|
+
const row = el('button', 'as-row ts-entry demande-entry'); row.type = 'button'; row.dataset.asset = 'demandes:all';
|
|
4187
|
+
if (onDemandes) row.setAttribute('aria-current', 'true');
|
|
4188
|
+
const words = el('span', 'as-words'); words.append(el('b', '', 'Demandes'), el('small', 'as-sub', `${allApprovals.length} waiting for you`));
|
|
4189
|
+
row.append(kindIcon('send'), words, el('b', 'count', String(allApprovals.length)));
|
|
4190
|
+
row.addEventListener('click', () => choose('demandes:all'));
|
|
4191
|
+
$('assets-rows').prepend(row);
|
|
4192
|
+
}
|
|
4117
4193
|
const detail = $('assets-detail');
|
|
4118
4194
|
/* The forms go back to where they wait before the detail is drawn again. */
|
|
4119
4195
|
for (const form of detail.querySelectorAll('.as-form, #gitview-remote-box')) $('assets-forms').append(form);
|
|
@@ -4151,6 +4227,13 @@
|
|
|
4151
4227
|
return;
|
|
4152
4228
|
}
|
|
4153
4229
|
if (chosenGroup) { groupDetail(detail, chosenGroup, items, back); return; }
|
|
4230
|
+
if (onDemandes) {
|
|
4231
|
+
detail.append(asTitle({ kind: 'send', name: 'Demandes', badge: String(allApprovals.length), badgeTone: 'count' }, back));
|
|
4232
|
+
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.'));
|
|
4233
|
+
if (allApprovals.length) detail.append(demandesList(allApprovals, { withWho: true, after: () => paintAssets() }));
|
|
4234
|
+
else detail.append(el('p', 'hint', 'Nothing is waiting now.'));
|
|
4235
|
+
return;
|
|
4236
|
+
}
|
|
4154
4237
|
if (!chosen) { if (items.length) detail.append(noAssetChosen()); return; }
|
|
4155
4238
|
detail.append(asTitle(chosen, back));
|
|
4156
4239
|
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; }
|