clavarium 0.2.146-beta.1 → 0.2.147-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.
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/web/app.js +43 -4
- package/web/index.html +5 -2
- package/web/style.css +4 -1
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.147-beta.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.147-beta.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
|
@@ -5166,21 +5166,60 @@
|
|
|
5166
5166
|
return b;
|
|
5167
5167
|
};
|
|
5168
5168
|
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
|
-
|
|
5169
|
+
/* The same page sets a room up again (03-11, as a conversation's settings): its name, its AIs and the one that
|
|
5170
|
+
welcomes, its boxes; and removes it. `editing`: the room, or null for a new one. */
|
|
5171
|
+
let salonEditing = null;
|
|
5172
|
+
async function openSalonNew(push = true, editing = null) {
|
|
5170
5173
|
if (DEVICE) return;
|
|
5174
|
+
salonEditing = editing;
|
|
5171
5175
|
enterPlace('salon-new', push);
|
|
5172
|
-
$('salon-new-
|
|
5176
|
+
$('salon-new-title').textContent = editing ? editing.name : 'New room';
|
|
5177
|
+
$('salon-new-create').textContent = editing ? 'Save' : 'Create';
|
|
5178
|
+
$('salon-new-remove-card').hidden = !editing;
|
|
5179
|
+
$('salon-new-remove').hidden = false; $('salon-new-remove-card').querySelector('.confirm')?.remove();
|
|
5180
|
+
$('salon-new-error').hidden = true; $('salon-new-name').value = editing?.name ?? '';
|
|
5181
|
+
const host = editing?.members.find((m) => m.host)?.ref;
|
|
5182
|
+
salonPicked = editing ? [host, ...editing.members.filter((m) => m.kind === 'ai' && m.ref !== host).map((m) => m.ref)].filter(Boolean) : [];
|
|
5173
5183
|
$('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
5184
|
let boxes = []; try { const x = await fetch(`${API}/boxes`); boxes = x.ok ? await x.json() : []; } catch { boxes = []; }
|
|
5175
5185
|
$('salon-new-boxes-card').hidden = boxes.length === 0;
|
|
5176
5186
|
$('salon-new-boxes').replaceChildren(...boxes.map((b) => salonTile(b.id, b.name, b.place || 'Voice box', true)));
|
|
5187
|
+
if (editing) {
|
|
5188
|
+
for (const t of $('salon-new-ais').children) if (salonPicked.includes(t.dataset.value)) t.setAttribute('aria-checked', 'true');
|
|
5189
|
+
const mine = editing.members.filter((m) => m.kind === 'box').map((m) => m.ref);
|
|
5190
|
+
for (const t of $('salon-new-boxes').children) if (mine.includes(t.dataset.value)) t.setAttribute('aria-checked', 'true');
|
|
5191
|
+
paintWelcome();
|
|
5192
|
+
}
|
|
5177
5193
|
$('salon-new-name').focus();
|
|
5178
5194
|
}
|
|
5179
|
-
$('salon-
|
|
5180
|
-
$('salon-new-
|
|
5195
|
+
$('salon-settings').addEventListener('click', async () => { await loadRooms(); const r = rooms.find((x) => x.id === salonId); if (r) await openSalonNew(true, r); });
|
|
5196
|
+
$('salon-new-remove').addEventListener('click', () => {
|
|
5197
|
+
const r = salonEditing; if (!r) return;
|
|
5198
|
+
const keep = el('button', '', 'Keep'); keep.type = 'button';
|
|
5199
|
+
const sure = el('button', 'danger', `Remove ${r.name}`); sure.type = 'button';
|
|
5200
|
+
const ask = el('span', 'callout bad confirm'); ask.setAttribute('role', 'alertdialog'); ask.append(keep, sure);
|
|
5201
|
+
keep.addEventListener('click', () => { ask.remove(); $('salon-new-remove').hidden = false; });
|
|
5202
|
+
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; } });
|
|
5203
|
+
$('salon-new-remove').hidden = true; $('salon-new-remove').after(ask); sure.focus();
|
|
5204
|
+
});
|
|
5205
|
+
/* Back from a room's settings: to the room; from a new one: where it was opened from. */
|
|
5206
|
+
const salonNewBack = () => { const r = salonEditing; salonEditing = null; if (r) void openSalon(r.id, false); else leavePlace(); };
|
|
5207
|
+
$('salon-new-close').addEventListener('click', salonNewBack);
|
|
5208
|
+
$('salon-new-cancel').addEventListener('click', salonNewBack);
|
|
5181
5209
|
$('salon-new-create').addEventListener('click', async () => {
|
|
5182
5210
|
const boxes = [...$('salon-new-boxes').querySelectorAll('[aria-checked="true"]')].map((b) => b.dataset.value);
|
|
5183
5211
|
try {
|
|
5212
|
+
/* Set up again: what is ticked now -- members added, those unticked taken out, the first one picked welcomes. */
|
|
5213
|
+
if (salonEditing) {
|
|
5214
|
+
const r = salonEditing;
|
|
5215
|
+
const ais = r.members.filter((m) => m.kind === 'ai'); const had = r.members.filter((m) => m.kind === 'box');
|
|
5216
|
+
const add = { conversations: salonPicked.filter((c) => !ais.some((m) => m.ref === c)), boxes: boxes.filter((b) => !had.some((m) => m.ref === b)) };
|
|
5217
|
+
const remove = [...ais.filter((m) => !salonPicked.includes(m.ref)), ...had.filter((m) => !boxes.includes(m.ref))].map((m) => m.id);
|
|
5218
|
+
let now = await post(`${API}/rooms/${r.id}`, { name: $('salon-new-name').value, add, remove });
|
|
5219
|
+
const host = now.members.find((m) => m.kind === 'ai' && m.ref === salonPicked[0]);
|
|
5220
|
+
if (host && !host.host) now = await post(`${API}/rooms/${r.id}`, { host: host.id });
|
|
5221
|
+
salonEditing = null; await openSalon(r.id, false); return;
|
|
5222
|
+
}
|
|
5184
5223
|
const made = await post(`${API}/rooms`, { name: $('salon-new-name').value, conversations: salonPicked, boxes, host: salonPicked[0] });
|
|
5185
5224
|
await openSalon(made.id, false);
|
|
5186
5225
|
} 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">‹ 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">‹ 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">‹ 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 {
|
|
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; }
|