clavarium 0.2.480-next.1 → 0.2.482-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/gitchecks.mjs +17 -3
- package/server/settingswords.mjs +1 -1
- package/web/app.js +68 -18
- package/web/style.css +3 -0
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.482-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.482-next.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/package.json
CHANGED
package/server/gitchecks.mjs
CHANGED
|
@@ -97,11 +97,24 @@ exit "$status"`;
|
|
|
97
97
|
// eslint-disable-next-line no-control-regex
|
|
98
98
|
const printable = (text) => String(text ?? '').replace(/\x1b\[[0-9;?]*[A-Za-z]/g, '').replace(/[\u0000-\u0008\u000B-\u001F\u007F]/gu, '').slice(-OUTPUT_MAX);
|
|
99
99
|
|
|
100
|
+
/* The agents' copies brought up to date at most so many at a time, across every repository: each is a
|
|
101
|
+
sudo and a `vm exec` on the host, and the keeper's tick reads its repositories side by side -- after a
|
|
102
|
+
start, every reference is due at once, and one fetch per repository and machine (48 seen in a few
|
|
103
|
+
seconds, 17-11) held up the host while the new server was watched for its answer. */
|
|
104
|
+
export const FETCHES_AT_ONCE = 2;
|
|
105
|
+
|
|
100
106
|
export class GitChecks {
|
|
101
|
-
#vms; #conversations; #resources; #now;
|
|
107
|
+
#vms; #conversations; #resources; #now; #free; #waiting = [];
|
|
102
108
|
|
|
103
|
-
constructor({ vms, conversations, resources, now = () => new Date() }) {
|
|
109
|
+
constructor({ vms, conversations, resources, now = () => new Date(), fetchesAtOnce = FETCHES_AT_ONCE }) {
|
|
104
110
|
this.#vms = vms; this.#conversations = conversations; this.#resources = resources; this.#now = now;
|
|
111
|
+
this.#free = Math.max(1, fetchesAtOnce);
|
|
112
|
+
}
|
|
113
|
+
/* A place among the fetches running, waited for in turn; given back by the function it resolves to. */
|
|
114
|
+
async #slot() {
|
|
115
|
+
if (this.#free > 0) this.#free -= 1; else await new Promise((go) => this.#waiting.push(go));
|
|
116
|
+
let given = false;
|
|
117
|
+
return () => { if (given) return; given = true; const next = this.#waiting.shift(); if (next) next(); else this.#free += 1; };
|
|
105
118
|
}
|
|
106
119
|
|
|
107
120
|
/* A machine that runs and has the repository attached: one it may write
|
|
@@ -119,8 +132,9 @@ export class GitChecks {
|
|
|
119
132
|
origin/* only: its branches, its files and what it left uncommitted are not touched.
|
|
120
133
|
-> { ok, moved: [{ branch, upstream, from, to }] }: the branches it follows whose upstream moved. */
|
|
121
134
|
async fetchIn(conversation, repository) {
|
|
135
|
+
const done = await this.#slot();
|
|
122
136
|
const r = await this.#vms.exec(conversation, ['timeout', '-k', '10', '120', 'sh', '-c', FETCH_SCRIPT, 'clavarium-fetch', `/resources/${repository}`, `/resources/${originFolder(repository)}`], { timeoutMs: 180_000 })
|
|
123
|
-
.catch(() => ({ code: -1, stdout: '' }));
|
|
137
|
+
.catch(() => ({ code: -1, stdout: '' })).finally(done);
|
|
124
138
|
if (r.code !== 0) return { ok: false, moved: [] };
|
|
125
139
|
const moved = String(r.stdout ?? '').split('\n').map((l) => l.trim().split(' ')).filter((x) => x.length === 4 && /^[0-9a-f]{40,64}$/.test(x[2]) && /^[0-9a-f]{40,64}$/.test(x[3]))
|
|
126
140
|
.map(([branch, upstream, from, to]) => ({ branch: printable(branch), upstream: printable(upstream), from, to }));
|
package/server/settingswords.mjs
CHANGED
|
@@ -196,7 +196,7 @@ export const SETTINGS_WORDS_FR = {
|
|
|
196
196
|
'set-mcp-need': 'Collez le bloc, ou donnez nom et adresse.', 'set-mcp-tools': 'Outils', 'set-mcp-refresh': 'Actualiser', 'set-mcp-seen': 'Marquer comme vu',
|
|
197
197
|
'set-mcp-none': 'Aucun outil listé pour l\'instant.', 'set-mcp-unreached': 'Injoignable : {why}', 'set-mcp-open': 'atteint l\'extérieur',
|
|
198
198
|
'set-mcp-fresh': 'Nouveau : demandé jusqu\'à ce que vous l\'ayez vu',
|
|
199
|
-
'set-mcp-oauth': 'Se connecter', 'set-mcp-client': 'Identifiant client', 'set-mcp-client-need': 'Collez son identifiant et son secret, une fois.',
|
|
199
|
+
'set-mcp-oauth': 'Se connecter', 'set-mcp-link': 'Ou ouvrez ce lien dans un autre navigateur :', 'set-mcp-link-copy': 'Copier', 'set-mcp-link-copied': 'Copié', 'set-mcp-link-open': 'Ouvrir', 'set-mcp-client': 'Identifiant client', 'set-mcp-client-need': 'Collez son identifiant et son secret, une fois.',
|
|
200
200
|
/* Its client pasted once, the permissions asked, signed out (16-11). */
|
|
201
201
|
'set-mcp-reconnect': 'Reconnecter', 'set-mcp-client-box': 'Identifiant et secret client', 'set-mcp-secret': 'Secret client',
|
|
202
202
|
'set-mcp-scopes': 'Autorisations demandées', 'set-mcp-redirect': 'Adresse de retour de son appli', 'set-mcp-client-kept': 'Gardés sur le serveur. Aucune IA ne les voit.',
|
package/web/app.js
CHANGED
|
@@ -1971,7 +1971,19 @@
|
|
|
1971
1971
|
$('items').querySelector(again)?.focus();
|
|
1972
1972
|
});
|
|
1973
1973
|
|
|
1974
|
-
|
|
1974
|
+
/* One reading of the list at a time: one asked while one runs waits for it, then one more is made for all
|
|
1975
|
+
who asked meanwhile (what they just changed is in it) -- never two side by side, nor two timers left armed. */
|
|
1976
|
+
let refreshing = null;
|
|
1977
|
+
let refreshAgain = null;
|
|
1978
|
+
function refresh() {
|
|
1979
|
+
if (refreshing) { refreshAgain ??= refreshing.then(() => { refreshAgain = null; return refresh(); }); return refreshAgain; }
|
|
1980
|
+
refreshing = refreshOnce().finally(() => { refreshing = null; });
|
|
1981
|
+
return refreshing;
|
|
1982
|
+
}
|
|
1983
|
+
/* A page out of sight (another tab, a tablet asleep) reads its list seldom; shown again, at once. */
|
|
1984
|
+
const HIDDEN_POLL_MS = 30_000;
|
|
1985
|
+
document.addEventListener('visibilitychange', () => { if (!document.hidden && home) void refresh(); });
|
|
1986
|
+
async function refreshOnce() {
|
|
1975
1987
|
clearTimeout(pollTimer);
|
|
1976
1988
|
try {
|
|
1977
1989
|
const mark = (x) => (x ? `${x.phase}/${x.asleep === true}/${holds(x)}/${Boolean(x.machine)}/${x.stopped === true}/${Boolean(x.lentTo)}` : '');
|
|
@@ -2024,7 +2036,9 @@
|
|
|
2024
2036
|
if (!DEVICE && panelShown) { void paintAnswerer(); paintWakeups(); paintMachine(conversations.find((x) => x.name === current)); }
|
|
2025
2037
|
if (!DEVICE && home) void paintJobs();
|
|
2026
2038
|
/* A start told step by step is asked about more often: its tool appears soon after its last step. */
|
|
2027
|
-
|
|
2039
|
+
clearTimeout(pollTimer);
|
|
2040
|
+
const every = conversations.some(holds) || conversations.some((c) => c.machine) ? 1500 : conversations.some((c) => c.phase === 'building' || c.phase === 'moving' || c.phase === 'restarting') ? 2500 : 10000;
|
|
2041
|
+
if (home) pollTimer = setTimeout(refresh, document.hidden ? Math.max(every, HIDDEN_POLL_MS) : every);
|
|
2028
2042
|
}
|
|
2029
2043
|
|
|
2030
2044
|
/* ---------- WHAT IT IS DOING (jobs.mjs, 14-11) ----------
|
|
@@ -3573,7 +3587,8 @@
|
|
|
3573
3587
|
: state === 'live' ? 'It is there. Below: what is ready, and what it says now.' : `Its screen: ${state}.`;
|
|
3574
3588
|
$('simple-state').dataset.needs = String(Boolean(c?.answerer?.needs));
|
|
3575
3589
|
$('simple-says').textContent = saysNow() || 'Nothing on its screen yet.';
|
|
3576
|
-
|
|
3590
|
+
/* Its files are under the plain screen: not read while the chat covers it. */
|
|
3591
|
+
if (Date.now() - simpleFilesAt > 8000 && !$('simple-plain').hidden) void paintSimpleFiles();
|
|
3577
3592
|
}
|
|
3578
3593
|
$('simple-toggle').addEventListener('click', () => toggleSimple());
|
|
3579
3594
|
function toggleSimple() {
|
|
@@ -3596,6 +3611,7 @@
|
|
|
3596
3611
|
it moved, and then only what changed (the server's cursor). The chat open keeps its own copy as it
|
|
3597
3612
|
looks again. Opened, the copy is drawn at once, then the whole window is fetched and put in its place. */
|
|
3598
3613
|
const KEPT_LAST = 50;
|
|
3614
|
+
const KEPT_EVERY_MS = 10_000;
|
|
3599
3615
|
const kept = new Map();
|
|
3600
3616
|
/* Kept once loaded: an import() asked again resolves only after the next frame, a blank one. */
|
|
3601
3617
|
let parleyLoaded = null;
|
|
@@ -3613,6 +3629,8 @@
|
|
|
3613
3629
|
const mark = JSON.stringify(c.talk);
|
|
3614
3630
|
const was = kept.get(c.name);
|
|
3615
3631
|
if (was?.mark === mark && was.thread) continue;
|
|
3632
|
+
/* Moved again soon after (the list read every 1.5 s while a machine works): its copy waits a little. */
|
|
3633
|
+
if (was?.thread && Date.now() - (was.at ?? 0) < KEPT_EVERY_MS) continue;
|
|
3616
3634
|
const cursor = typeof was?.thread?.cursor === 'string' && was.thread.cursor ? was.thread.cursor : null;
|
|
3617
3635
|
const ask = (params) => fetch(talkPath(c.name, '', params)).then((r) => (r.ok ? r.json() : null)).catch(() => null);
|
|
3618
3636
|
const [state, got] = await Promise.all([ask({ state: 1 }), ask({ last: KEPT_LAST, ...(cursor ? { since: cursor } : {}) })]);
|
|
@@ -3620,7 +3638,7 @@
|
|
|
3620
3638
|
if (c.name === threadOf) continue;
|
|
3621
3639
|
if (state && state.on !== true) { kept.delete(c.name); continue; }
|
|
3622
3640
|
if (!state || !Array.isArray(got?.messages)) continue;
|
|
3623
|
-
kept.set(c.name, { state, thread: cursor ? since(was.thread, got) : got, mark });
|
|
3641
|
+
kept.set(c.name, { state, thread: cursor ? since(was.thread, got) : got, mark, at: Date.now() });
|
|
3624
3642
|
}
|
|
3625
3643
|
} finally { keeping = false; }
|
|
3626
3644
|
}
|
|
@@ -3668,7 +3686,8 @@
|
|
|
3668
3686
|
if (talk.on) keptOf(name).state = talk; else kept.delete(name);
|
|
3669
3687
|
return talk;
|
|
3670
3688
|
}
|
|
3671
|
-
|
|
3689
|
+
/* `look`: false from the clock below -- the thread drawn already is not asked again (its own clock does). */
|
|
3690
|
+
async function paintThread(look = true) {
|
|
3672
3691
|
const box = $('simple-thread');
|
|
3673
3692
|
const wanted = talk.on && talkOf === current;
|
|
3674
3693
|
box.hidden = !wanted;
|
|
@@ -3696,7 +3715,7 @@
|
|
|
3696
3715
|
if ((wanted || offer) && simple && stopListening) stopVoice();
|
|
3697
3716
|
paintSimple();
|
|
3698
3717
|
if (!wanted) { thread?.destroy(); thread = null; threadOf = ''; return; }
|
|
3699
|
-
if (thread && threadOf === current) { void thread.refresh(); return; }
|
|
3718
|
+
if (thread && threadOf === current) { if (look !== false) void thread.refresh(); return; }
|
|
3700
3719
|
thread?.destroy(); thread = null; threadOf = '';
|
|
3701
3720
|
const name = current;
|
|
3702
3721
|
/* From where this page is: a device's page lives under /c/, and nothing else is open to it. */
|
|
@@ -3851,7 +3870,7 @@
|
|
|
3851
3870
|
tasksTimer = setInterval(async () => {
|
|
3852
3871
|
if (!thread) { clearInterval(tasksTimer); tasksTimer = null; return; }
|
|
3853
3872
|
if (document.hidden) return;
|
|
3854
|
-
const now = await
|
|
3873
|
+
const now = await peopleNow();
|
|
3855
3874
|
if (!now || now.changes === tasksChanges) return;
|
|
3856
3875
|
tasksChanges = now.changes; binderPeople = now.people;
|
|
3857
3876
|
void paintTasks(threadOf);
|
|
@@ -4249,7 +4268,9 @@
|
|
|
4249
4268
|
all.hidden = !all.hidden;
|
|
4250
4269
|
if (!all.hidden && wordsSettings) all.textContent = JSON.stringify(Object.fromEntries(Object.entries(wordsSettings.english).filter(([key]) => key !== 'lang')), null, 2);
|
|
4251
4270
|
});
|
|
4252
|
-
|
|
4271
|
+
/* Its chat drawn already: Parley's own clock looks at its thread (every 3 s) -- not asked again here,
|
|
4272
|
+
which made two looks side by side (paintThread(false)). */
|
|
4273
|
+
setInterval(() => { if (!document.hidden && current) void readTalk().then(() => { if (simple) void paintThread(false); paintSimple(); }); }, 5000);
|
|
4253
4274
|
|
|
4254
4275
|
$('simple-say').addEventListener('submit', (event) => {
|
|
4255
4276
|
event.preventDefault();
|
|
@@ -4536,6 +4557,17 @@
|
|
|
4536
4557
|
}
|
|
4537
4558
|
return fallback;
|
|
4538
4559
|
};
|
|
4560
|
+
/* WHO MAY OWN A CARD, and the binders' count of changes (GET /binder/people): asked by two clocks (the chat's
|
|
4561
|
+
batches, the Binders tab) and a binder opened. One question at a time, and its answer kept a moment, under
|
|
4562
|
+
the 4 s of those clocks: each still sees a change at its next turn, without asking twice. */
|
|
4563
|
+
const PEOPLE_KEPT_MS = 3000;
|
|
4564
|
+
let peopleAsked = null; let peopleAt = 0;
|
|
4565
|
+
const peopleNow = () => {
|
|
4566
|
+
if (peopleAsked && (peopleAt === 0 || Date.now() - peopleAt < PEOPLE_KEPT_MS)) return peopleAsked;
|
|
4567
|
+
const asking = getJson('/binder/people', null).then((got) => { if (peopleAsked === asking) { if (got) peopleAt = Date.now(); else peopleAsked = null; } return got; });
|
|
4568
|
+
peopleAsked = asking; peopleAt = 0;
|
|
4569
|
+
return asking;
|
|
4570
|
+
};
|
|
4539
4571
|
const el = (tag, cls, text) => { const e = document.createElement(tag); if (cls) e.className = cls; if (text !== undefined) e.textContent = text; return e; };
|
|
4540
4572
|
/* A commit: its line, and the rest of its message under it, opened by a click. */
|
|
4541
4573
|
function commitRow(c) {
|
|
@@ -5827,7 +5859,7 @@
|
|
|
5827
5859
|
a new tool marked until seen (« Mark as seen »); then, for each conversation at Custom, what each kind may do. */
|
|
5828
5860
|
/* A sign-in under way (its provider's tab open): the panel is painted again when this page is looked at again.
|
|
5829
5861
|
The client form opened, and what the server said it needs, per server. */
|
|
5830
|
-
let mcpSigningIn = ''; let mcpClientOpen = ''; const mcpClientNeed = new Map();
|
|
5862
|
+
let mcpSigningIn = ''; let mcpClientOpen = ''; const mcpClientNeed = new Map(); const mcpSignLink = new Map();
|
|
5831
5863
|
const backFromSignin = () => { if (!mcpSigningIn || document.visibilityState !== 'visible') return; mcpSigningIn = ''; void repaintAsset(); };
|
|
5832
5864
|
document.addEventListener('visibilitychange', backFromSignin);
|
|
5833
5865
|
window.addEventListener('focus', backFromSignin);
|
|
@@ -5860,18 +5892,31 @@
|
|
|
5860
5892
|
const redirect = el('input'); redirect.type = 'text'; redirect.readOnly = true; redirect.name = 'mcp-redirect';
|
|
5861
5893
|
const said = el('p', 'hint mcp-client-said', uiSaid('set-mcp-client-kept', 'Kept on the server. No AI sees them.'));
|
|
5862
5894
|
const asked = mcpClientNeed.get(t.id);
|
|
5863
|
-
if (asked) { redirect.value = asked.redirect ?? ''; scopes.value = (asked.scopes ?? []).join(' '); }
|
|
5895
|
+
if (asked) { redirect.value = asked.redirect ?? ''; scopes.value = (asked.scopes ?? []).join(' '); clientId.value = asked.id ?? ''; }
|
|
5864
5896
|
redirect.hidden = !redirect.value;
|
|
5865
5897
|
clientBox.append(field('set-mcp-client', 'Client ID', clientId), field('set-mcp-secret', 'Client secret', clientSecret),
|
|
5866
5898
|
field('set-mcp-scopes', 'Permissions asked', scopes), ...(redirect.value ? [field('set-mcp-redirect', 'Its app\'s redirect address', redirect)] : []), said);
|
|
5867
5899
|
clientBox.addEventListener('toggle', () => { mcpClientOpen = clientBox.open ? t.id : ''; });
|
|
5900
|
+
/* The sign-in address, shown to copy or open in another browser (17-11). */
|
|
5901
|
+
const linkBox = el('div', 'mcp-sign-link');
|
|
5902
|
+
const linkText = el('input'); linkText.type = 'text'; linkText.readOnly = true; linkText.name = 'mcp-sign-link'; linkText.spellcheck = false;
|
|
5903
|
+
const linkCopy = el('button', '', uiSaid('set-mcp-link-copy', 'Copy')); linkCopy.type = 'button';
|
|
5904
|
+
const linkOpen = el('a', 'button', uiSaid('set-mcp-link-open', 'Open')); linkOpen.target = '_blank'; linkOpen.rel = 'noopener noreferrer';
|
|
5905
|
+
linkCopy.addEventListener('click', async () => { try { await navigator.clipboard.writeText(linkText.value); linkCopy.textContent = uiSaid('set-mcp-link-copied', 'Copied'); } catch { linkText.select(); } });
|
|
5906
|
+
linkText.addEventListener('focus', () => linkText.select());
|
|
5907
|
+
const linkRow = el('div', 'mcp-sign-link-row'); linkRow.append(linkText, linkCopy, linkOpen);
|
|
5908
|
+
linkBox.append(el('p', 'hint', uiSaid('set-mcp-link', 'Or open this link in another browser:')), linkRow);
|
|
5909
|
+
const showSignLink = (url) => { if (!/^https?:\/\//.test(String(url))) { linkBox.hidden = true; return; } linkText.value = url; linkOpen.href = url; linkBox.hidden = false; };
|
|
5910
|
+
showSignLink(mcpSignLink.get(t.id) ?? '');
|
|
5868
5911
|
oauth.addEventListener('click', async () => {
|
|
5869
5912
|
$(asErrId()).hidden = true;
|
|
5870
5913
|
/* Opened now, empty; never told who opened it (the provider's page cannot reach this one). */
|
|
5871
5914
|
let tab = null;
|
|
5872
|
-
try { tab = window.open('', '_blank');
|
|
5915
|
+
try { tab = window.open('', '_blank'); } catch { tab = null; }
|
|
5916
|
+
try { if (tab) tab.opener = null; } catch { /* some browsers refuse it: the tab is still ours */ }
|
|
5873
5917
|
oauth.disabled = true; oauth.setAttribute('aria-busy', 'true');
|
|
5874
5918
|
const body = { target: t.id, lang: deviceLang(), back: location.pathname + location.search, tab: tab ? 'new' : 'same' };
|
|
5919
|
+
if (asked && clientId.value.trim()) asked.id = clientId.value.trim();
|
|
5875
5920
|
if (clientId.value.trim()) body.clientId = clientId.value.trim();
|
|
5876
5921
|
if (clientSecret.value.trim()) body.clientSecret = clientSecret.value.trim();
|
|
5877
5922
|
if (asked && scopes.value.trim() !== (asked.scopes ?? []).join(' ')) body.scope = scopes.value.trim();
|
|
@@ -5882,11 +5927,13 @@
|
|
|
5882
5927
|
const r = await post(`${API}/tether/mcp-oauth`, body);
|
|
5883
5928
|
if (r?.url) {
|
|
5884
5929
|
mcpSigningIn = t.id;
|
|
5930
|
+
/* Its address, also to copy: to sign in from another browser (17-11). */
|
|
5931
|
+
mcpSignLink.set(t.id, r.url); showSignLink(r.url);
|
|
5885
5932
|
if (tab) tab.location.href = r.url; else { location.assign(r.url); return; }
|
|
5886
5933
|
} else {
|
|
5887
5934
|
try { tab?.close(); } catch { /* gone */ }
|
|
5888
5935
|
if (r?.need === 'client') {
|
|
5889
|
-
mcpClientNeed.set(t.id, { redirect: r.redirect, scopes: r.scopes, secret: r.secret });
|
|
5936
|
+
mcpClientNeed.set(t.id, { redirect: r.redirect, scopes: r.scopes, secret: r.secret, id: clientId.value.trim() });
|
|
5890
5937
|
mcpClientOpen = t.id;
|
|
5891
5938
|
sayAsErr(new Error(r.missing === 'secret' ? uiSaid('set-mcp-secret-need', 'Paste its client secret too.') : uiSaid('set-mcp-client-need', 'Paste its client ID and secret, once.')));
|
|
5892
5939
|
await repaintAsset();
|
|
@@ -5924,7 +5971,7 @@
|
|
|
5924
5971
|
if (signedOut) body.push(el('p', 'error mcp-out', uiSaid('set-mcp-out', '{name} is disconnected. Reconnect it.', { name: t.title })));
|
|
5925
5972
|
else if (t.catalog?.error) body.push(el('p', 'error', uiSaid('set-mcp-unreached', 'Not reached: {why}', { why: t.catalog.error })));
|
|
5926
5973
|
body.push(tools.length ? list : el('p', 'hint', uiSaid('set-mcp-none', 'No tools listed yet.')));
|
|
5927
|
-
body.push(clientBox);
|
|
5974
|
+
body.push(linkBox, clientBox);
|
|
5928
5975
|
out.push({ title: uiSaid('set-mcp-tools', 'Tools'), extra: [seen, oauth, refresh], body, cls: 'as-mcp-tools' });
|
|
5929
5976
|
/* Custom: each kind of tool Yes / Ask / No, for each conversation set to it. */
|
|
5930
5977
|
const custom = Object.entries(t.grants ?? {}).filter(([id, g]) => id.startsWith('conversation:') && g?.level === 'frame');
|
|
@@ -6603,6 +6650,8 @@
|
|
|
6603
6650
|
if (v.root.isConnected) { v.away = 0; continue; }
|
|
6604
6651
|
v.away += 1;
|
|
6605
6652
|
if (v.away >= 3 && v.socket) { const ws = v.socket; v.socket = null; v.phase = 'closed'; try { ws.close(); } catch { /* gone */ } }
|
|
6653
|
+
/* Its chat too: not read every 3 s for a screen no longer there (drawn again when it is shown). */
|
|
6654
|
+
if (v.away >= 3 && v.chat) { v.chat.destroy(); v.chat = null; v.chatOf = ''; }
|
|
6606
6655
|
}
|
|
6607
6656
|
}, 10_000);
|
|
6608
6657
|
/* The parts: the console (kept), then what the AI proposes and has typed, then the journal (drawn each paint). */
|
|
@@ -6618,6 +6667,7 @@
|
|
|
6618
6667
|
if (!v.opened) { v.term.open(v.screen); v.opened = true; }
|
|
6619
6668
|
v.fit();
|
|
6620
6669
|
if (!v.socket) consoleConnect(v);
|
|
6670
|
+
if ((v.full || v.below) && !v.chatOf) void consoleChat(v);
|
|
6621
6671
|
if (hadFocus) v.term.focus();
|
|
6622
6672
|
});
|
|
6623
6673
|
consolePaint(v);
|
|
@@ -7086,7 +7136,7 @@
|
|
|
7086
7136
|
card.dataset.room = r.id;
|
|
7087
7137
|
return card;
|
|
7088
7138
|
}
|
|
7089
|
-
let salonThread = null; let salonId = '';
|
|
7139
|
+
let salonThread = null; let salonId = '';
|
|
7090
7140
|
/* A room's bar while one of its AIs speaks: its dot at work (gold, breathing), the words under its name. */
|
|
7091
7141
|
function salonLive(who) {
|
|
7092
7142
|
const dot = $('salon-state'); const line = $('salon-live');
|
|
@@ -7103,7 +7153,7 @@
|
|
|
7103
7153
|
const rows = ['person', 'ai', 'box'].map((k) => { const of = r.members.filter((m) => m.kind === k); if (!of.length) return null; const row = el('div', 'salon-members-row'); row.append(el('span', 'hint', k === 'person' ? uiSaid('set-room-people', 'People') : k === 'ai' ? uiSaid('set-room-ais-of', 'AIs') : uiSaid('set-room-boxes-of', 'Boxes')), ...of.map((m) => { const x = el('span', 'salon-member'); x.append(memberChips([m], 1), document.createTextNode(m.name)); if (m.host) x.append(el('span', 'salon-host', uiSaid('set-room-host-mark', 'host'))); return x; })); return row; }).filter(Boolean);
|
|
7104
7154
|
$('salon-members').replaceChildren(...rows);
|
|
7105
7155
|
}
|
|
7106
|
-
function salonLeft() {
|
|
7156
|
+
function salonLeft() { salonThread?.destroy(); salonThread = null; salonId = ''; }
|
|
7107
7157
|
/* `step`: picked by the owner (the list, the deck): as a conversation picked, the list folds. */
|
|
7108
7158
|
async function openSalon(id, push = true, { step = false } = {}) {
|
|
7109
7159
|
if (DEVICE) return;
|
|
@@ -7189,7 +7239,7 @@
|
|
|
7189
7239
|
draft: `room:${id}`,
|
|
7190
7240
|
act: (action) => { tetherAct(action, () => salonThread?.refresh?.()); },
|
|
7191
7241
|
});
|
|
7192
|
-
|
|
7242
|
+
/* Looked at again by Parley's own clock (every 3 s, while the page is in sight): no second clock here. */
|
|
7193
7243
|
}
|
|
7194
7244
|
$('salon-close').addEventListener('click', () => leavePlace());
|
|
7195
7245
|
$('salon-who').addEventListener('click', () => { const open = $('salon-members').hidden; $('salon-members').hidden = !open; $('salon-who').setAttribute('aria-expanded', String(open)); });
|
|
@@ -7887,7 +7937,7 @@
|
|
|
7887
7937
|
/* `still()`: whether it is still wanted once its parts are read (another one asked meanwhile: not drawn). */
|
|
7888
7938
|
async function mountBinder(holder, keep, { onLists, of, place: at = null, steps = null, still = () => true } = {}) {
|
|
7889
7939
|
binderParts ??= Promise.all([import(new URL('vendor/binder-ui.js', new URL('/', location.href)).href), fetch(`/vendor/binder-${binderLang()}.json`).then((r) => r.json()).catch(() => ({}))]);
|
|
7890
|
-
const [[{ mount }, words], seen] = await Promise.all([binderParts,
|
|
7940
|
+
const [[{ mount }, words], seen] = await Promise.all([binderParts, peopleNow()]);
|
|
7891
7941
|
if (seen) { binderPeople = seen.people; binderChanges = seen.changes; }
|
|
7892
7942
|
if (!holder.isConnected || !still()) return null;
|
|
7893
7943
|
let shown = [];
|
|
@@ -8084,7 +8134,7 @@
|
|
|
8084
8134
|
/* Read again every screen of a binder when the binders changed. Taken as seen only once every
|
|
8085
8135
|
screen read it again: one that failed (the server restarting) is read again at the next turn. */
|
|
8086
8136
|
async function catchUpBinders() {
|
|
8087
|
-
const now = await
|
|
8137
|
+
const now = await peopleNow();
|
|
8088
8138
|
if (!now) return;
|
|
8089
8139
|
binderPeople = now.people;
|
|
8090
8140
|
if (now.changes === binderChanges) return;
|
package/web/style.css
CHANGED
|
@@ -2311,6 +2311,9 @@ details.commit > pre { margin: 6px 0 0 1.6em; white-space: pre-wrap; overflow-wr
|
|
|
2311
2311
|
.mcp-client { margin: .4rem 0; }
|
|
2312
2312
|
.mcp-client summary { cursor: pointer; color: var(--ink2); }
|
|
2313
2313
|
.mcp-client-field { display: flex; flex-direction: column; gap: 2px; margin: .4rem 0; }
|
|
2314
|
+
.mcp-sign-link { margin: .4rem 0; }
|
|
2315
|
+
.mcp-sign-link-row { display: flex; gap: 6px; align-items: center; min-width: 0; }
|
|
2316
|
+
.mcp-sign-link-row input { flex: 1; min-width: 0; font-family: var(--mono, monospace); font-size: 12px; }
|
|
2314
2317
|
.mcp-client-field input { width: 100%; box-sizing: border-box; min-width: 0; }
|
|
2315
2318
|
.mcp-custom { display: flex; flex-direction: column; gap: 4px; margin: .4rem 0 .8rem; }
|
|
2316
2319
|
.mcp-custom-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
|