clavarium 0.2.224-next.1 → 0.2.226-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/server/voice.mjs +6 -1
- package/web/app.js +47 -1
- package/web/style.css +17 -0
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.226-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.226-next.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/package.json
CHANGED
package/server/voice.mjs
CHANGED
|
@@ -85,10 +85,15 @@ const PHANTOMS = [
|
|
|
85
85
|
/^\s*(?:thank(?:s| you) (?:so much )?for watching[.!,]?\s*(?:(?:and )?see you (?:in the |on the )?next (?:video|time)[.!]?)?|see you (?:in the )?next (?:video|time)[.!]?|merci d'avoir regardé(?: cette vidéo)?\s*[.!]?(?:\s*[àa] bient[ôo]t[.!]?)?)\s*$/giu,
|
|
86
86
|
/untertitel(?:ung)?\s+(?:im\s+auftrag\s+)?des\s+zdf(?:\s+für\s+funk)?,?\s*\d{0,4}[.!]?/giu,
|
|
87
87
|
];
|
|
88
|
+
/* Chinese, Japanese or Korean mixed into Latin words: written on a room's silence (01-11: « Sous 谢谢 大家 »);
|
|
89
|
+
a sentence wholly in one of them is kept. And the « Sous » its credits leave behind, when it is all. */
|
|
90
|
+
const FOREIGN_SCRIPT = /[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]+/gu;
|
|
88
91
|
export function withoutPhantoms(text) {
|
|
89
92
|
let t = text;
|
|
90
93
|
for (const re of PHANTOMS) t = t.replace(re, ' ');
|
|
91
|
-
|
|
94
|
+
if (/\p{Script=Latin}/u.test(t)) t = t.replace(FOREIGN_SCRIPT, ' ');
|
|
95
|
+
t = t.replace(/\s+/gu, ' ').trim();
|
|
96
|
+
return /^sous[.!,…]*$/iu.test(t) ? '' : t;
|
|
92
97
|
}
|
|
93
98
|
|
|
94
99
|
/* SPEECH HAS A SPEED: nobody says more than ~25 characters a second. More
|
package/web/app.js
CHANGED
|
@@ -1050,7 +1050,43 @@
|
|
|
1050
1050
|
const plain = (text) => String(text ?? '').normalize('NFD').replace(/[̀-ͯ]/g, '').toLowerCase();
|
|
1051
1051
|
const matches = (c) => [shownName(c), c.name, c.group, c.toolLabel].some((x) => plain(x).includes(plain(query)));
|
|
1052
1052
|
const byRank = (a, b) => (a.rank ?? 0) - (b.rank ?? 0);
|
|
1053
|
+
/* A GROUP FIELD (01-11): typed freely, or chosen from the groups there are -- a ▾ beside it opens them all
|
|
1054
|
+
(a datalist alone shows only what matches what is typed, and not on every browser). */
|
|
1055
|
+
function groupChooser(input, values) {
|
|
1056
|
+
if (!input || input.dataset.chooser) return;
|
|
1057
|
+
input.dataset.chooser = 'true';
|
|
1058
|
+
const wrap = document.createElement('span'); wrap.className = 'chooser';
|
|
1059
|
+
input.replaceWith(wrap); wrap.append(input);
|
|
1060
|
+
const open = document.createElement('button'); open.type = 'button'; open.className = 'chooser-open'; open.textContent = '▾';
|
|
1061
|
+
open.setAttribute('aria-label', 'Existing groups'); open.setAttribute('aria-haspopup', 'listbox'); open.setAttribute('aria-expanded', 'false');
|
|
1062
|
+
const list = document.createElement('div'); list.className = 'chooser-list'; list.setAttribute('role', 'listbox'); list.hidden = true;
|
|
1063
|
+
const close = () => { list.hidden = true; open.setAttribute('aria-expanded', 'false'); };
|
|
1064
|
+
open.addEventListener('click', (event) => {
|
|
1065
|
+
event.stopPropagation();
|
|
1066
|
+
if (!list.hidden) { close(); return; }
|
|
1067
|
+
const all = values();
|
|
1068
|
+
list.replaceChildren(...(all.length ? all : [null]).map((v) => {
|
|
1069
|
+
if (v === null) { const none = document.createElement('div'); none.className = 'chooser-none'; none.textContent = 'No group yet: type a name.'; return none; }
|
|
1070
|
+
const o = document.createElement('button'); o.type = 'button'; o.className = 'chooser-option'; o.setAttribute('role', 'option'); o.textContent = v;
|
|
1071
|
+
if (v === input.value) o.setAttribute('aria-selected', 'true');
|
|
1072
|
+
o.addEventListener('click', () => { input.value = v; input.dispatchEvent(new Event('input', { bubbles: true })); close(); input.focus(); });
|
|
1073
|
+
return o;
|
|
1074
|
+
}));
|
|
1075
|
+
list.hidden = false; open.setAttribute('aria-expanded', 'true');
|
|
1076
|
+
list.querySelector('[aria-selected="true"], .chooser-option')?.focus();
|
|
1077
|
+
});
|
|
1078
|
+
list.addEventListener('keydown', (event) => {
|
|
1079
|
+
const opts = [...list.querySelectorAll('.chooser-option')]; const i = opts.indexOf(document.activeElement);
|
|
1080
|
+
if (event.key === 'Escape') { close(); open.focus(); event.preventDefault(); }
|
|
1081
|
+
if (event.key === 'ArrowDown' && i < opts.length - 1) { opts[i + 1].focus(); event.preventDefault(); }
|
|
1082
|
+
if (event.key === 'ArrowUp' && i > 0) { opts[i - 1].focus(); event.preventDefault(); }
|
|
1083
|
+
event.stopPropagation();
|
|
1084
|
+
});
|
|
1085
|
+
document.addEventListener('click', (event) => { if (!wrap.contains(event.target)) close(); });
|
|
1086
|
+
wrap.append(open, list);
|
|
1087
|
+
}
|
|
1053
1088
|
const groupsInOrder = () => [...new Set(conversations.filter((c) => c.group).sort((a, b) => (a.groupRank ?? 0) - (b.groupRank ?? 0)).map((c) => c.group))];
|
|
1089
|
+
groupChooser($('group-name'), groupsInOrder); groupChooser($('newconv-group'), groupsInOrder);
|
|
1054
1090
|
/* WHEN IT WAS LAST USED: what was said in its chat, and what its agent said it does (Parley) -- never what
|
|
1055
1091
|
its terminal shows. A tool with no chat (a plain terminal): the keys typed in it by hand. */
|
|
1056
1092
|
const activityOf = (c) => Math.max(...[c.talk?.lastAt, c.talk?.stepAt, c.talk ? null : c.lastActiveAt, c.createdAt].map((x) => (x ? new Date(x).getTime() : 0)));
|
|
@@ -1134,6 +1170,15 @@
|
|
|
1134
1170
|
keepFolded(); paint();
|
|
1135
1171
|
});
|
|
1136
1172
|
box.append(head);
|
|
1173
|
+
/* A conversation added right here, in this group (01-11): the same form as anywhere, its group filled. */
|
|
1174
|
+
if (!DEVICE && !String(g).startsWith('\u0001')) {
|
|
1175
|
+
const add = document.createElement('button'); add.type = 'button'; add.className = 'group-add'; add.textContent = '+';
|
|
1176
|
+
const where = g === NONE ? '' : g;
|
|
1177
|
+
add.title = where ? `New conversation in ${label}` : 'New conversation';
|
|
1178
|
+
add.setAttribute('aria-label', add.title);
|
|
1179
|
+
add.addEventListener('click', (event) => { event.stopPropagation(); void openNew({ group: where }); });
|
|
1180
|
+
box.append(add);
|
|
1181
|
+
}
|
|
1137
1182
|
if (open) { const body = document.createElement('div'); body.className = 'group-body'; body.append(...inside.map((c) => itemButton(c))); unfolding(g, [body]); box.append(body); }
|
|
1138
1183
|
return box;
|
|
1139
1184
|
}
|
|
@@ -1501,9 +1546,10 @@
|
|
|
1501
1546
|
b.addEventListener('click', () => { for (const other of $('newconv-work').querySelectorAll('[data-work]')) other.setAttribute('aria-checked', String(other === b)); });
|
|
1502
1547
|
}
|
|
1503
1548
|
const newOnDisk = () => $('newconv-work').querySelector('[data-work="disk"]').getAttribute('aria-checked') === 'true';
|
|
1504
|
-
async function openNew({ push = true } = {}) {
|
|
1549
|
+
async function openNew({ push = true, group = null } = {}) {
|
|
1505
1550
|
if (DEVICE) return;
|
|
1506
1551
|
newError('', '');
|
|
1552
|
+
if (group !== null) $('newconv-group').value = group;
|
|
1507
1553
|
if (place !== 'new') {
|
|
1508
1554
|
/* From the map: a step over it, and back to it. Otherwise a place of its own. */
|
|
1509
1555
|
if (place === 'access' && push) {
|
package/web/style.css
CHANGED
|
@@ -1384,6 +1384,13 @@ select.pill { appearance: auto; }
|
|
|
1384
1384
|
.group { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
|
|
1385
1385
|
.group-head { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; padding: 6px 8px; background: transparent; border-color: transparent; font-weight: 600; color: var(--ink2); }
|
|
1386
1386
|
.group-head:hover { border-color: var(--line); }
|
|
1387
|
+
/* + on a group: at the right of its head, shown on hover or focus; always there where there is no hover (touch). */
|
|
1388
|
+
.group { position: relative; }
|
|
1389
|
+
.group-add { position: absolute; top: 2px; right: 4px; width: 28px; height: 28px; padding: 0; display: grid; place-items: center; border-radius: 8px; font-size: 1.1rem; line-height: 1; color: var(--ink2); background: transparent; border-color: transparent; opacity: 0; transition: opacity .12s; }
|
|
1390
|
+
.group:hover > .group-add, .group-add:focus-visible { opacity: 1; }
|
|
1391
|
+
.group-add:hover { border-color: var(--line); color: var(--ink, inherit); }
|
|
1392
|
+
@media (hover: none) { .group-add { opacity: .7; } }
|
|
1393
|
+
.group:has(> .group-add) > .group-head { padding-right: 36px; }
|
|
1387
1394
|
.group-head .caret { display: inline-block; width: 1em; transition: transform .15s; }
|
|
1388
1395
|
.group-head[aria-expanded="true"] .caret { transform: rotate(90deg); }
|
|
1389
1396
|
.group-head .group-name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink, inherit); }
|
|
@@ -2081,3 +2088,13 @@ body.as-dragging #assets-rows .as-row { touch-action: none; }
|
|
|
2081
2088
|
.box-wifi-known { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
2082
2089
|
.box-wifi-net { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid var(--line, #ccc); border-radius: 999px; font-size: 0.85em; }
|
|
2083
2090
|
.box-wifi-add { width: 100%; }
|
|
2091
|
+
|
|
2092
|
+
/* A group field: typed, or chosen from the list (▾). */
|
|
2093
|
+
.chooser { position: relative; display: inline-flex; align-items: stretch; min-width: 0; flex: 1 1 auto; }
|
|
2094
|
+
.chooser > input { flex: 1 1 auto; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
|
|
2095
|
+
.chooser-open { flex: none; padding: 0 10px; border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; color: var(--ink2); }
|
|
2096
|
+
.chooser-list { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; max-height: 240px; overflow: auto; display: flex; flex-direction: column; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
|
|
2097
|
+
.chooser-option { text-align: left; padding: 8px 10px; border-color: transparent; background: transparent; border-radius: 6px; color: var(--ink, inherit); }
|
|
2098
|
+
.chooser-option:hover, .chooser-option:focus-visible { background: var(--bar); }
|
|
2099
|
+
.chooser-option[aria-selected="true"] { font-weight: 600; }
|
|
2100
|
+
.chooser-none { padding: 8px 10px; color: var(--ink2); }
|