clavarium 0.2.288-next.1 → 0.2.290-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.288-next.1",
3
+ "version": "0.2.290-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.288-next.1",
9
+ "version": "0.2.290-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.288-next.1",
3
+ "version": "0.2.290-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/web/app.js CHANGED
@@ -2379,13 +2379,17 @@
2379
2379
  /* Nothing over the screen to say it under: a long wait still says so. */
2380
2380
  /* The neutral word of a load is not a place to list troubles either, until the wait is long. */
2381
2381
  const quiet = notice.hidden || Boolean(notice.dataset.loading);
2382
+ /* The chat (or any tab but the terminal) in front: a terminal slow to come back -- often only this page
2383
+ reconnecting after an update -- is not put over it (03-11); it comes back by itself, behind. */
2384
+ if (tabNow() !== 'terminal' && !['warn', 'bad'].includes(record?.level)) { if (notice.dataset.loading || /terminal/i.test($('notice-text').textContent)) notice.hidden = true; return; }
2382
2385
  if (quiet && !long) return;
2383
- if (quiet) show('Its terminal still does not come.');
2386
+ if (quiet) show(record && record.level !== 'bad' && record.level !== 'warn' ? 'Reconnecting to its terminal\u2026' : 'Its terminal still does not come.');
2384
2387
  /* Waking it is what the page is doing: "it is asleep" would say the opposite. */
2385
2388
  const said = waiting && record ? { ...record, problems: (record.problems ?? []).filter((p) => p.kind !== 'state') } : record;
2386
2389
  const shown = healthLines($('notice-health'), said, { all: true, brief: true });
2387
2390
  $('notice-health').hidden = $('notice-health').childElementCount === 0;
2388
- $('notice-restart').hidden = !(record && (record.level === 'bad' || record.level === 'warn' || long));
2391
+ /* A restart is offered only when its machine is not well: a machine that runs and looks well is not restarted for a slow page (03-11). */
2392
+ $('notice-restart').hidden = !(record && (record.level === 'bad' || record.level === 'warn'));
2389
2393
  $('notice-restart').onclick = () => restartMachine(false);
2390
2394
  const text = $('notice-text').textContent.replace(/ This takes much longer than a start usually does\.$/, '');
2391
2395
  if (long) $('notice-text').textContent = `${text} This takes much longer than a start usually does.`;
@@ -5166,21 +5170,60 @@
5166
5170
  return b;
5167
5171
  };
5168
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 ?? '')); } };
5169
- async function openSalonNew(push = true) {
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;
5176
+ async function openSalonNew(push = true, editing = null) {
5170
5177
  if (DEVICE) return;
5178
+ salonEditing = editing;
5171
5179
  enterPlace('salon-new', push);
5172
- $('salon-new-error').hidden = true; $('salon-new-name').value = ''; salonPicked = [];
5180
+ $('salon-new-title').textContent = editing ? editing.name : 'New room';
5181
+ $('salon-new-create').textContent = editing ? 'Save' : 'Create';
5182
+ $('salon-new-remove-card').hidden = !editing;
5183
+ $('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) : [];
5173
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; }));
5174
5188
  let boxes = []; try { const x = await fetch(`${API}/boxes`); boxes = x.ok ? await x.json() : []; } catch { boxes = []; }
5175
5189
  $('salon-new-boxes-card').hidden = boxes.length === 0;
5176
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
+ }
5177
5197
  $('salon-new-name').focus();
5178
5198
  }
5179
- $('salon-new-close').addEventListener('click', () => leavePlace());
5180
- $('salon-new-cancel').addEventListener('click', () => leavePlace());
5199
+ $('salon-settings').addEventListener('click', async () => { await loadRooms(); const r = rooms.find((x) => x.id === salonId); if (r) await openSalonNew(true, r); });
5200
+ $('salon-new-remove').addEventListener('click', () => {
5201
+ const r = salonEditing; if (!r) return;
5202
+ const keep = el('button', '', 'Keep'); keep.type = 'button';
5203
+ const sure = el('button', 'danger', `Remove ${r.name}`); sure.type = 'button';
5204
+ const ask = el('span', 'callout bad confirm'); ask.setAttribute('role', 'alertdialog'); ask.append(keep, sure);
5205
+ keep.addEventListener('click', () => { ask.remove(); $('salon-new-remove').hidden = false; });
5206
+ sure.addEventListener('click', async () => { try { await post(`${API}/rooms/${r.id}/remove`, {}); salonEditing = null; await loadRooms(); paint(); openDeck(false); } catch (error) { $('salon-new-error').textContent = error.message; $('salon-new-error').hidden = false; } });
5207
+ $('salon-new-remove').hidden = true; $('salon-new-remove').after(ask); sure.focus();
5208
+ });
5209
+ /* Back from a room's settings: to the room; from a new one: where it was opened from. */
5210
+ const salonNewBack = () => { const r = salonEditing; salonEditing = null; if (r) void openSalon(r.id, false); else leavePlace(); };
5211
+ $('salon-new-close').addEventListener('click', salonNewBack);
5212
+ $('salon-new-cancel').addEventListener('click', salonNewBack);
5181
5213
  $('salon-new-create').addEventListener('click', async () => {
5182
5214
  const boxes = [...$('salon-new-boxes').querySelectorAll('[aria-checked="true"]')].map((b) => b.dataset.value);
5183
5215
  try {
5216
+ /* Set up again: what is ticked now -- members added, those unticked taken out, the first one picked welcomes. */
5217
+ if (salonEditing) {
5218
+ const r = salonEditing;
5219
+ 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);
5222
+ 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]);
5224
+ if (host && !host.host) now = await post(`${API}/rooms/${r.id}`, { host: host.id });
5225
+ salonEditing = null; await openSalon(r.id, false); return;
5226
+ }
5184
5227
  const made = await post(`${API}/rooms`, { name: $('salon-new-name').value, conversations: salonPicked, boxes, host: salonPicked[0] });
5185
5228
  await openSalon(made.id, false);
5186
5229
  } catch (error) { $('salon-new-error').textContent = error.message; $('salon-new-error').hidden = false; }
package/web/index.html CHANGED
@@ -653,13 +653,13 @@
653
653
  <!-- A room (#268): one thread for several AIs, the person and voice boxes. -->
654
654
  <div id="salon" class="sheet as-place" hidden>
655
655
  <div class="panel-top"><b id="salon-title">Room</b><button type="button" id="salon-close" class="as-link place-back">&lsaquo; Back</button></div>
656
- <button type="button" id="salon-who" class="salon-who" aria-expanded="false"></button>
656
+ <div class="salon-bar"><button type="button" id="salon-who" class="salon-who" aria-expanded="false"></button><button type="button" id="salon-settings" class="icon-btn" aria-label="Room settings" title="Room settings"><svg class="ic" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"/></svg></button></div>
657
657
  <div id="salon-members" class="salon-members" hidden></div>
658
658
  <div id="salon-thread" class="salon-thread"></div>
659
659
  <p id="salon-thinking" class="salon-thinking" hidden></p>
660
660
  </div>
661
661
  <div id="salon-new" class="sheet as-place" hidden>
662
- <div class="panel-top"><b>New room</b><button type="button" id="salon-new-close" class="as-link place-back">&lsaquo; Back</button></div>
662
+ <div class="panel-top"><b id="salon-new-title">New room</b><button type="button" id="salon-new-close" class="as-link place-back">&lsaquo; Back</button></div>
663
663
  <div class="nc-body">
664
664
  <div class="nc-card">
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>
@@ -673,6 +673,9 @@
673
673
  <span class="sub-head">Voice boxes</span>
674
674
  <div id="salon-new-boxes" class="pick" role="group" aria-label="Voice boxes"></div>
675
675
  </div>
676
+ <div class="nc-card" id="salon-new-remove-card" hidden>
677
+ <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>
678
+ </div>
676
679
  <span id="salon-new-error" class="err" role="alert" hidden></span>
677
680
  </div>
678
681
  <div class="action-row"><span class="hint" id="salon-new-status"></span><button type="button" id="salon-new-cancel">Cancel</button><button type="button" id="salon-new-create" class="primary">Create</button></div>
package/web/style.css CHANGED
@@ -2228,7 +2228,7 @@ body.as-dragging #assets-rows .as-row { touch-action: none; }
2228
2228
  .salon-chip-box::before { content: ""; width: 9px; height: 9px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H3v6h3l5 4z'/%3E%3Cpath d='M15.5 8.5a5 5 0 0 1 0 7'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H3v6h3l5 4z'/%3E%3Cpath d='M15.5 8.5a5 5 0 0 1 0 7'/%3E%3C/svg%3E") center / contain no-repeat; }
2229
2229
  #salon { display: flex; flex-direction: column; min-height: 0; }
2230
2230
  #salon[hidden] { display: none; }
2231
- .salon-who { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 4px 14px; min-height: 44px; }
2231
+ .salon-who { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 4px 14px; min-height: 44px; }
2232
2232
  .salon-members { display: flex; flex-direction: column; gap: 8px; padding: 0 14px 10px; border-bottom: 1px solid var(--line); }
2233
2233
  .salon-members-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
2234
2234
  .salon-members-row > .hint { width: 4.5rem; }
@@ -2250,3 +2250,6 @@ body.as-dragging #assets-rows .as-row { touch-action: none; }
2250
2250
  #places[hidden] { display: none; }
2251
2251
  @media (max-width: 700px) { #places { grid-column: 1; grid-row: 1; } }
2252
2252
  #app:has(> #list[hidden]) #places { grid-column: 1 / -1; }
2253
+ .salon-bar { display: flex; align-items: center; gap: 8px; padding: 0 8px 0 0; }
2254
+ .salon-bar .salon-who { flex: 1; }
2255
+ #salon-new-remove-card .confirm { display: inline-flex; gap: 6px; flex-wrap: wrap; }