clavarium 0.2.148-beta.1 → 0.2.149-beta.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.148-beta.1",
3
+ "version": "0.2.149-beta.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.148-beta.1",
9
+ "version": "0.2.149-beta.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.148-beta.1",
3
+ "version": "0.2.149-beta.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/web/app.js CHANGED
@@ -406,11 +406,20 @@
406
406
  /* ---------- the list of conversations, folded away or not ---------- */
407
407
  /* One click hides it and the terminal takes the room; one click brings
408
408
  it back. Kept on this device. */
409
+ /* The same button on every page of its own (03-11: settings, access, assets, the deck, rooms...): each shows or
410
+ hides the list as the conversation's does -- one state, one place it is kept. */
411
+ for (const top of document.querySelectorAll('#places .sheet > .panel-top')) {
412
+ const f = document.createElement('button'); f.type = 'button'; f.className = 'fold-here'; f.title = 'Hide or show the list of conversations';
413
+ f.addEventListener('click', () => $('fold').click());
414
+ top.prepend(f);
415
+ }
409
416
  const applyFold = (folded) => {
410
417
  app.dataset.list = folded ? 'folded' : 'open';
411
- $('fold').textContent = folded ? '\u00bb' : '\u00ab';
412
- $('fold').setAttribute('aria-pressed', String(folded));
413
- $('fold').setAttribute('aria-label', folded ? 'Show the list of conversations' : 'Hide the list of conversations');
418
+ for (const f of [$('fold'), ...document.querySelectorAll('.fold-here')]) {
419
+ f.textContent = folded ? '\u00bb' : '\u00ab';
420
+ f.setAttribute('aria-pressed', String(folded));
421
+ f.setAttribute('aria-label', folded ? 'Show the list of conversations' : 'Hide the list of conversations');
422
+ }
414
423
  };
415
424
  /* Folded by default: the list takes room few need all the time; the fold is remembered, so opening it
416
425
  keeps it open (a person who wants it open sets it once). Open only when that choice was remembered. */
@@ -5157,22 +5166,46 @@
5157
5166
  }
5158
5167
  $('salon-close').addEventListener('click', () => leavePlace());
5159
5168
  $('salon-who').addEventListener('click', () => { const open = $('salon-members').hidden; $('salon-members').hidden = !open; $('salon-who').setAttribute('aria-expanded', String(open)); });
5160
- /* A NEW ROOM (03-11, in the look of a new conversation): its name, its AIs as tiles to pick (the first one
5161
- picked welcomes the room), its boxes the same. */
5162
- let salonPicked = [];
5163
- const salonTile = (value, name, about, box) => {
5164
- const b = el('button'); b.type = 'button'; b.setAttribute('role', 'checkbox'); b.setAttribute('aria-checked', 'false'); b.dataset.value = value;
5165
- b.append(el('b', '', name), el('small', '', about));
5166
- b.addEventListener('click', () => {
5167
- const on = b.getAttribute('aria-checked') !== 'true'; b.setAttribute('aria-checked', String(on));
5168
- if (!box) { salonPicked = on ? [...salonPicked, value] : salonPicked.filter((x) => x !== value); paintWelcome(); }
5169
- });
5170
- return b;
5171
- };
5172
- const paintWelcome = () => { for (const b of $('salon-new-ais').children) { const small = b.querySelector('small'); const host = salonPicked[0] === b.dataset.value; small.replaceChildren(host ? el('span', 'salon-welcome', 'Welcomes the room') : document.createTextNode(small.dataset.about ?? '')); } };
5173
- /* The same page sets a room up again (03-11, as a conversation's settings): its name, its AIs and the one that
5174
- welcomes, its boxes; and removes it. `editing`: the room, or null for a new one. */
5175
- let salonEditing = null;
5169
+ /* A NEW ROOM, or a room set up again (03-11): the one that welcomes in a box of its own at the top; below, every
5170
+ conversation on one row -- its name, the name its assistant has in its chat, its tool -- with a switch (in the
5171
+ room or not) and « Welcomes »; a search; a row dragged into the box above welcomes too. Boxes: the same rows,
5172
+ with a switch only. `editing`: the room, or null for a new one. */
5173
+ let salonIn = new Set(); let salonHost = ''; let salonBoxes = new Set(); let salonEditing = null; let salonBoxList = [];
5174
+ const salonAv = (name) => { const i = el('span', 'salon-av', (name.trim()[0] ?? '?').toUpperCase()); i.style.setProperty('--h', String(huePick(name))); return i; };
5175
+ const salonWho = (c) => [c.chatName, c.toolLabel ?? c.tool].filter(Boolean).join(' \u00b7 ') || 'AI';
5176
+ function paintSalonMembers() {
5177
+ const hostC = conversations.find((c) => c.name === salonHost);
5178
+ const box = $('salon-new-host'); box.replaceChildren();
5179
+ if (hostC) { const what = el('span', 'salon-host-what'); what.append(el('b', '', shownName(hostC)), el('small', '', `${salonWho(hostC)} \u00b7 answers, or hands the message on`)); box.append(salonAv(shownName(hostC)), what); }
5180
+ else box.append(el('small', 'hint', 'Pick one below: « Welcomes »'));
5181
+ const q = $('salon-new-search').value.trim().toLowerCase();
5182
+ const rows = conversations.filter((c) => !q || `${shownName(c)} ${c.chatName ?? ''}`.toLowerCase().includes(q)).sort((a, b) => Number(salonIn.has(b.name)) - Number(salonIn.has(a.name)));
5183
+ $('salon-new-ais').replaceChildren(...rows.map((c) => {
5184
+ const row = el('div', 'salon-member-row'); row.setAttribute('role', 'listitem'); row.draggable = true; row.dataset.name = c.name;
5185
+ const what = el('span', 'salon-member-what'); what.append(el('b', '', shownName(c)), el('small', '', salonWho(c)));
5186
+ const welcome = el('button', 'salon-welcome-btn', 'Welcomes'); welcome.type = 'button'; welcome.setAttribute('aria-pressed', String(c.name === salonHost)); welcome.setAttribute('aria-label', `${shownName(c)} welcomes the room`);
5187
+ welcome.addEventListener('click', () => { salonIn.add(c.name); salonHost = c.name; paintSalonMembers(); });
5188
+ const sw = el('button', 'salon-switch'); sw.type = 'button'; sw.setAttribute('role', 'switch'); sw.setAttribute('aria-checked', String(salonIn.has(c.name))); sw.setAttribute('aria-label', `${shownName(c)} in the room`);
5189
+ sw.addEventListener('click', () => { if (salonIn.has(c.name)) { salonIn.delete(c.name); if (salonHost === c.name) salonHost = [...salonIn][0] ?? ''; } else { salonIn.add(c.name); if (!salonHost) salonHost = c.name; } paintSalonMembers(); });
5190
+ row.append(salonAv(shownName(c)), what, welcome, sw);
5191
+ return row;
5192
+ }));
5193
+ $('salon-new-count').textContent = `\u00b7 ${salonIn.size} in the room`;
5194
+ $('salon-new-boxes').replaceChildren(...salonBoxList.map((b) => {
5195
+ const row = el('div', 'salon-member-row'); row.setAttribute('role', 'listitem');
5196
+ const what = el('span', 'salon-member-what'); what.append(el('b', '', b.name), el('small', '', b.place || 'Voice box'));
5197
+ const sw = el('button', 'salon-switch'); sw.type = 'button'; sw.setAttribute('role', 'switch'); sw.setAttribute('aria-checked', String(salonBoxes.has(b.id))); sw.setAttribute('aria-label', `${b.name} in the room`);
5198
+ sw.addEventListener('click', () => { if (salonBoxes.has(b.id)) salonBoxes.delete(b.id); else salonBoxes.add(b.id); paintSalonMembers(); });
5199
+ row.append(what, sw);
5200
+ return row;
5201
+ }));
5202
+ }
5203
+ $('salon-new-search').addEventListener('input', paintSalonMembers);
5204
+ let salonDragged = '';
5205
+ $('salon-new-ais').addEventListener('dragstart', (e) => { salonDragged = e.target.closest?.('.salon-member-row')?.dataset.name ?? ''; });
5206
+ $('salon-new-host').addEventListener('dragover', (e) => { e.preventDefault(); $('salon-new-host').classList.add('over'); });
5207
+ $('salon-new-host').addEventListener('dragleave', () => $('salon-new-host').classList.remove('over'));
5208
+ $('salon-new-host').addEventListener('drop', (e) => { e.preventDefault(); $('salon-new-host').classList.remove('over'); if (salonDragged) { salonIn.add(salonDragged); salonHost = salonDragged; paintSalonMembers(); } });
5176
5209
  async function openSalonNew(push = true, editing = null) {
5177
5210
  if (DEVICE) return;
5178
5211
  salonEditing = editing;
@@ -5181,19 +5214,13 @@
5181
5214
  $('salon-new-create').textContent = editing ? 'Save' : 'Create';
5182
5215
  $('salon-new-remove-card').hidden = !editing;
5183
5216
  $('salon-new-remove').hidden = false; $('salon-new-remove-card').querySelector('.confirm')?.remove();
5184
- $('salon-new-error').hidden = true; $('salon-new-name').value = editing?.name ?? '';
5185
- const host = editing?.members.find((m) => m.host)?.ref;
5186
- salonPicked = editing ? [host, ...editing.members.filter((m) => m.kind === 'ai' && m.ref !== host).map((m) => m.ref)].filter(Boolean) : [];
5187
- $('salon-new-ais').replaceChildren(...conversations.map((c) => { const t = salonTile(c.name, shownName(c), [c.chatName, c.toolLabel ?? c.tool].filter(Boolean).join(' \u00b7 ') || 'AI'); t.querySelector('small').dataset.about = t.querySelector('small').textContent; return t; }));
5188
- let boxes = []; try { const x = await fetch(`${API}/boxes`); boxes = x.ok ? await x.json() : []; } catch { boxes = []; }
5189
- $('salon-new-boxes-card').hidden = boxes.length === 0;
5190
- $('salon-new-boxes').replaceChildren(...boxes.map((b) => salonTile(b.id, b.name, b.place || 'Voice box', true)));
5191
- if (editing) {
5192
- for (const t of $('salon-new-ais').children) if (salonPicked.includes(t.dataset.value)) t.setAttribute('aria-checked', 'true');
5193
- const mine = editing.members.filter((m) => m.kind === 'box').map((m) => m.ref);
5194
- for (const t of $('salon-new-boxes').children) if (mine.includes(t.dataset.value)) t.setAttribute('aria-checked', 'true');
5195
- paintWelcome();
5196
- }
5217
+ $('salon-new-error').hidden = true; $('salon-new-name').value = editing?.name ?? ''; $('salon-new-search').value = '';
5218
+ salonIn = new Set(editing ? editing.members.filter((m) => m.kind === 'ai').map((m) => m.ref) : []);
5219
+ salonHost = editing?.members.find((m) => m.host)?.ref ?? '';
5220
+ salonBoxes = new Set(editing ? editing.members.filter((m) => m.kind === 'box').map((m) => m.ref) : []);
5221
+ try { const x = await fetch(`${API}/boxes`); salonBoxList = x.ok ? await x.json() : []; } catch { salonBoxList = []; }
5222
+ $('salon-new-boxes-card').hidden = salonBoxList.length === 0;
5223
+ paintSalonMembers();
5197
5224
  $('salon-new-name').focus();
5198
5225
  }
5199
5226
  $('salon-settings').addEventListener('click', async () => { await loadRooms(); const r = rooms.find((x) => x.id === salonId); if (r) await openSalonNew(true, r); });
@@ -5211,20 +5238,21 @@
5211
5238
  $('salon-new-close').addEventListener('click', salonNewBack);
5212
5239
  $('salon-new-cancel').addEventListener('click', salonNewBack);
5213
5240
  $('salon-new-create').addEventListener('click', async () => {
5214
- const boxes = [...$('salon-new-boxes').querySelectorAll('[aria-checked="true"]')].map((b) => b.dataset.value);
5241
+ const picked = [salonHost, ...[...salonIn].filter((c) => c !== salonHost)].filter(Boolean);
5242
+ const boxes = [...salonBoxes];
5215
5243
  try {
5216
- /* Set up again: what is ticked now -- members added, those unticked taken out, the first one picked welcomes. */
5244
+ /* Set up again: what is switched on now -- members added, those switched off taken out, the one that welcomes. */
5217
5245
  if (salonEditing) {
5218
5246
  const r = salonEditing;
5219
5247
  const ais = r.members.filter((m) => m.kind === 'ai'); const had = r.members.filter((m) => m.kind === 'box');
5220
- const add = { conversations: salonPicked.filter((c) => !ais.some((m) => m.ref === c)), boxes: boxes.filter((b) => !had.some((m) => m.ref === b)) };
5221
- const remove = [...ais.filter((m) => !salonPicked.includes(m.ref)), ...had.filter((m) => !boxes.includes(m.ref))].map((m) => m.id);
5248
+ const add = { conversations: picked.filter((c) => !ais.some((m) => m.ref === c)), boxes: boxes.filter((b) => !had.some((m) => m.ref === b)) };
5249
+ const remove = [...ais.filter((m) => !salonIn.has(m.ref)), ...had.filter((m) => !salonBoxes.has(m.ref))].map((m) => m.id);
5222
5250
  let now = await post(`${API}/rooms/${r.id}`, { name: $('salon-new-name').value, add, remove });
5223
- const host = now.members.find((m) => m.kind === 'ai' && m.ref === salonPicked[0]);
5251
+ const host = now.members.find((m) => m.kind === 'ai' && m.ref === salonHost);
5224
5252
  if (host && !host.host) now = await post(`${API}/rooms/${r.id}`, { host: host.id });
5225
5253
  salonEditing = null; await openSalon(r.id, false); return;
5226
5254
  }
5227
- const made = await post(`${API}/rooms`, { name: $('salon-new-name').value, conversations: salonPicked, boxes, host: salonPicked[0] });
5255
+ const made = await post(`${API}/rooms`, { name: $('salon-new-name').value, conversations: picked, boxes, host: salonHost });
5228
5256
  await openSalon(made.id, false);
5229
5257
  } catch (error) { $('salon-new-error').textContent = error.message; $('salon-new-error').hidden = false; }
5230
5258
  });
package/web/index.html CHANGED
@@ -665,13 +665,18 @@
665
665
  <div class="set-row"><div class="set-what"><label for="salon-new-name">Name</label><small>Shown on its card. Can be changed</small></div><div class="set-control"><input id="salon-new-name" maxlength="60" placeholder="Home" spellcheck="false" autocomplete="off"></div></div>
666
666
  </div>
667
667
  <div class="nc-card">
668
- <span class="sub-head">AIs</span>
669
- <div id="salon-new-ais" class="pick" role="group" aria-label="AIs"></div>
670
- <small class="hint">The first one picked welcomes the room: it answers, or hands the message on.</small>
668
+ <span class="sub-head">Welcomes the room</span>
669
+ <div id="salon-new-host" class="salon-host-box" aria-live="polite"></div>
670
+ </div>
671
+ <div class="nc-card">
672
+ <span class="sub-head">Its AIs <span id="salon-new-count" class="hint"></span></span>
673
+ <div class="salon-members-tools"><input id="salon-new-search" type="search" placeholder="Find a conversation" aria-label="Find a conversation" autocomplete="off"></div>
674
+ <div id="salon-new-ais" class="salon-member-list" role="list" aria-label="AIs"></div>
675
+ <small class="hint">The switch puts it in the room or takes it out; « Welcomes » makes it the one that answers, or hands the message on. On a computer, a row can also be dragged into the box above.</small>
671
676
  </div>
672
677
  <div class="nc-card" id="salon-new-boxes-card">
673
678
  <span class="sub-head">Voice boxes</span>
674
- <div id="salon-new-boxes" class="pick" role="group" aria-label="Voice boxes"></div>
679
+ <div id="salon-new-boxes" class="salon-member-list" role="list" aria-label="Voice boxes"></div>
675
680
  </div>
676
681
  <div class="nc-card" id="salon-new-remove-card" hidden>
677
682
  <div class="set-row"><div class="set-what"><label>Remove the room</label><small>Its thread goes. Its AIs and boxes stay, each with its own chat</small></div><div class="set-control"><button type="button" id="salon-new-remove" class="danger">Remove…</button></div></div>
package/web/style.css CHANGED
@@ -2253,3 +2253,31 @@ body.as-dragging #assets-rows .as-row { touch-action: none; }
2253
2253
  .salon-bar { display: flex; align-items: center; gap: 8px; padding: 0 8px 0 0; }
2254
2254
  .salon-bar .salon-who { flex: 1; }
2255
2255
  #salon-new-remove-card .confirm { display: inline-flex; gap: 6px; flex-wrap: wrap; }
2256
+
2257
+ /* A ROOM'S MEMBERS (03-11): the one that welcomes in a box of its own; every conversation on a row, its switch. */
2258
+ .salon-host-box { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 12px; border: 1px solid var(--brass); border-radius: 10px; background: color-mix(in srgb, var(--brass) 10%, var(--panel)); transition: background .15s; }
2259
+ .salon-host-box.over { background: color-mix(in srgb, var(--brass) 22%, var(--panel)); }
2260
+ .salon-host-what, .salon-member-what { flex: 1; min-width: 0; display: flex; flex-direction: column; }
2261
+ .salon-host-what b, .salon-member-what b { font-weight: 600; font-size: .8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
2262
+ .salon-host-what small, .salon-member-what small { color: var(--ink2); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
2263
+ .salon-av { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; flex: none; color: #fff; font: 600 .8125rem/1 var(--sans); background: hsl(var(--h, 210) 40% 38%); }
2264
+ .salon-members-tools input { width: 100%; }
2265
+ .salon-member-list { display: flex; flex-direction: column; max-height: 22rem; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 0 !important; }
2266
+ .salon-member-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-height: 48px; border-top: 1px solid var(--line); }
2267
+ .salon-member-row:first-child { border-top: 0; }
2268
+ .salon-member-row[draggable="true"] { cursor: grab; }
2269
+ button.salon-welcome-btn { border-radius: 999px; padding: 4px 10px; font-size: .75rem; min-height: 32px; background: transparent; color: var(--ink2); }
2270
+ button.salon-welcome-btn[aria-pressed="true"] { color: var(--brass-ink); border-color: var(--brass); background: color-mix(in srgb, var(--brass) 14%, transparent); }
2271
+ button.salon-switch { position: relative; width: 40px; height: 24px; min-height: 0; flex: none; padding: 0; border-radius: 999px; background: var(--bg); }
2272
+ button.salon-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink2); transition: left .15s, background .15s; }
2273
+ button.salon-switch[aria-checked="true"] { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 25%, var(--bg)); }
2274
+ button.salon-switch[aria-checked="true"]::after { left: 18px; background: var(--ok); }
2275
+ @media (max-width: 700px) { button.salon-switch { min-height: 0; } }
2276
+ .nc-card > .salon-host-box, .nc-card > .salon-member-list { margin: 4px 16px 12px; }
2277
+ .nc-card > .salon-host-box { padding: 8px 12px; }
2278
+ .nc-card > .salon-members-tools { padding-bottom: 4px; }
2279
+ .nc-card > .salon-host-box + *, .nc-card > .salon-member-list + * { border-top: 0; }
2280
+ /* The list's button on each page of its own (03-11), as the conversation's. */
2281
+ .panel-top > .fold-here { font-size: 1rem; line-height: 1; padding: 4px 9px; margin-right: 8px; flex: none; }
2282
+ @media (max-width: 700px) { .panel-top > .fold-here { display: none; } }
2283
+ .panel-top > .fold-here + * { margin-right: auto; }