clavarium 0.2.353-next.1 → 0.2.354-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,19 +1,19 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.353-next.1",
3
+ "version": "0.2.354-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.353-next.1",
9
+ "version": "0.2.354-next.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
13
13
  "@xterm/xterm": "^6.0.0",
14
14
  "clavarium-binder": "0.1.61-next.1",
15
15
  "clavarium-docket": "0.1.2-next.2",
16
- "clavarium-parley": "0.17.82-next.1",
16
+ "clavarium-parley": "0.17.84-next.1",
17
17
  "clavarium-tether": "0.1.0-next.55",
18
18
  "mammoth": "1.13.0",
19
19
  "mermaid": "11.17.2",
@@ -787,9 +787,9 @@
787
787
  }
788
788
  },
789
789
  "node_modules/clavarium-parley": {
790
- "version": "0.17.82-next.1",
791
- "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.82-next.1.tgz",
792
- "integrity": "sha512-wCH7ajkmqfxY2qnY9zuaqdppd1C5rAiiFXH2IWcVYIpzuvnhjD2ac6lgVM3tJsfg6RsUBoBZVC9poLVeHpCwjg==",
790
+ "version": "0.17.84-next.1",
791
+ "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.84-next.1.tgz",
792
+ "integrity": "sha512-tvw4ahhxfwzbBZ1r22hhyEHts+41tt78zmEQl+DlUvR+V3GipiriOQSfLqiEWE1HbTeMZZO98lG69ipHLZ/rNg==",
793
793
  "license": "MIT",
794
794
  "bin": {
795
795
  "parley": "bin/parley.mjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.353-next.1",
3
+ "version": "0.2.354-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.",
@@ -46,7 +46,7 @@
46
46
  "@xterm/xterm": "^6.0.0",
47
47
  "clavarium-binder": "0.1.61-next.1",
48
48
  "clavarium-docket": "0.1.2-next.2",
49
- "clavarium-parley": "0.17.82-next.1",
49
+ "clavarium-parley": "0.17.84-next.1",
50
50
  "clavarium-tether": "0.1.0-next.55",
51
51
  "mammoth": "1.13.0",
52
52
  "mermaid": "11.17.2",
package/server/rooms.mjs CHANGED
@@ -64,7 +64,8 @@ export class Rooms {
64
64
  .map((m) => { const name = m.kind === 'box' ? (boxes.get(m.ref)?.name ?? m.name) : m.kind === 'ai' ? convs.get(m.ref) : m.name;
65
65
  return { id: m.id, kind: m.kind, name, ref: m.ref, look: lookOf(m.kind === 'ai' ? titles.get(m.ref) : name), ...(m.id === room.host ? { host: true } : {}) }; });
66
66
  }
67
- #think(room, member, on) { const m = this.#thinking.get(room) ?? new Map(); if (on) m.set(member, Date.now()); else m.delete(member); this.#thinking.set(room, m); }
67
+ /* Who works for the room now, and what it says it does (06-11: « je fais… » on the status line, never in the thread). */
68
+ #think(room, member, on, text = '') { const m = this.#thinking.get(room) ?? new Map(); if (on) m.set(member, { at: Date.now(), text: String(text ?? '').slice(0, 160) }); else m.delete(member); this.#thinking.set(room, m); }
68
69
  has(id) { return this.#all().some((r) => r.id === id); }
69
70
  /* What came since the owner last looked (#282): the AIs' and the boxes' messages after it. */
70
71
  #unread(r) { try { const seen = Date.parse(r.seen ?? '') || 0; return this.#thread(r.id).read({ last: 200 }).messages.filter((m) => (m.from === 'agent' || m.by) && (Date.parse(m.at) || 0) > seen).length; } catch { return 0; } }
@@ -72,7 +73,8 @@ export class Rooms {
72
73
  #last(r) { try { const m = this.#thread(r.id).read({ last: 1 }).messages.at(-1); return m ? { at: m.at, text: String(m.text ?? '').replace(/\s+/g, ' ').slice(0, 120), ...(m.by?.name ? { by: m.by.name } : {}) } : null; } catch { return null; } }
73
74
  /* Who has a message of the room and has not answered yet (#282), by their names of the moment: « Hugo parle… »
74
75
  in its row of the list and on its bar, « Hugo réfléchit… » in its thread. */
75
- #thinkingOf(id, members) { return [...(this.#thinking.get(id) ?? new Map()).entries()].filter(([, at]) => Date.now() - at < THINKING_MS).map(([mid]) => members.find((m) => m.id === mid)?.name).filter(Boolean); }
76
+ #thinkingOf(id, members) { return [...(this.#thinking.get(id) ?? new Map()).entries()].filter(([, v]) => Date.now() - v.at < THINKING_MS).map(([mid]) => members.find((m) => m.id === mid)?.name).filter(Boolean); }
77
+ #doingOf(id, members) { return [...(this.#thinking.get(id) ?? new Map()).entries()].filter(([, v]) => v.text && Date.now() - v.at < THINKING_MS).map(([mid, v]) => ({ name: members.find((m) => m.id === mid)?.name, text: v.text })).filter((x) => x.name); }
76
78
  list() { return this.#all().map((r) => { const members = this.#shown(r); return { id: r.id, name: r.name, host: r.host, members, at: r.at, unread: this.#unread(r), last: this.#last(r), thinking: this.#thinkingOf(r.id, members) }; }); }
77
79
  get(id) { const r = this.#find(id); return { id: r.id, name: r.name, host: r.host, members: this.#shown(r), at: r.at }; }
78
80
 
@@ -137,8 +139,8 @@ export class Rooms {
137
139
  /* A member named in a text (@{id}): its name of the moment, on the screen. */
138
140
  const named = (text) => String(text ?? '').replace(/@\{([0-9a-f-]{36})\}/g, (whole, mid) => { const m = members.find((x) => x.id === mid); return m ? `@${m.name}` : whole; });
139
141
  if (options?.seen !== false) { const list = this.#all(); const r = list.find((x) => x.id === id); if (r) { r.seen = this.#now().toISOString(); this.#file.set(list); } }
140
- const thinking = this.#thinkingOf(id, members);
141
- return { room: this.get(id), thinking, ...read, messages: (read.messages ?? []).map((m) => (typeof m.text === 'string' && m.text.includes('@{') ? { ...m, text: named(m.text) } : m)) };
142
+ const thinking = this.#thinkingOf(id, members); const doing = this.#doingOf(id, members);
143
+ return { room: this.get(id), thinking, doing, ...read, messages: (read.messages ?? []).map((m) => (typeof m.text === 'string' && m.text.includes('@{') ? { ...m, text: named(m.text) } : m)) };
142
144
  }
143
145
 
144
146
  /* SOMEONE OF THE PERSON'S SIDE SPEAKS (the person here, a box): kept in the room, given to the host -- or to the
@@ -176,7 +178,15 @@ export class Rooms {
176
178
  const all = () => t.read({ all: true }).messages;
177
179
  const find = (id) => (typeof id === 'string' && id.length >= 8 ? all().find((m) => m.id.startsWith(id)) : undefined);
178
180
  const re = find(entry.re)?.id;
179
- if (kind !== 'doing') this.#think(room.id, me.id, false);
181
+ /* What it does: on the room's status line only, never a line of its thread (06-11, the owner's choice). */
182
+ if (kind === 'doing') {
183
+ this.#think(room.id, me.id, true, masked(entry.text));
184
+ /* A box it is said to still says it aloud (first, at once, what it is about to do). */
185
+ const boxes = (Array.isArray(entry.to) ? entry.to : []).map((x) => members.find((m) => m.id === x && m.kind === 'box')).filter(Boolean).map((m) => m.ref);
186
+ if (boxes.length) try { this.#speak(`room:${room.id}`, masked(entry.text), boxes, { doing: true, asked: false }); } catch { /* the boxes' */ }
187
+ return 'doing';
188
+ }
189
+ this.#think(room.id, me.id, false);
180
190
  const ids = new Set(members.map((m) => m.id));
181
191
  const to = Array.isArray(entry.to) ? entry.to.filter((x) => ids.has(x) && x !== me.id) : [];
182
192
  /* The other AIs it is sent to (#280): they get it in their own chat, as said in the room -- never beyond a few
package/web/app.js CHANGED
@@ -5319,8 +5319,11 @@
5319
5319
  load: (asked = {}) => fetch(`${API}/rooms/${id}/talk${asked.last ? `?last=${asked.last}` : ''}`).then((x) => x.json()).then((d) => {
5320
5320
  /* Who was given a message and has not answered yet (#282): « Hugo réfléchit… ». */
5321
5321
  const who = thinkingOf(d);
5322
- $('salon-thinking').hidden = who.length === 0;
5323
- $('salon-thinking').replaceChildren(KIT.StatusDot({ state: 'work' }), document.createTextNode(who.length > 1 ? uiSaid('room-thinking-many', '{names} are thinking\u2026', { names: who.join(', ') }) : uiSaid('room-thinking', '{name} is thinking\u2026', { name: who[0] ?? '' })));
5322
+ /* What they say they do (06-11): on this line, « Thomas : je demande à MSM… », never in the thread. */
5323
+ const doing = (Array.isArray(d.doing) ? d.doing : []).filter((x) => x && typeof x.name === 'string' && typeof x.text === 'string' && x.text);
5324
+ $('salon-thinking').hidden = who.length === 0 && doing.length === 0;
5325
+ if (doing.length) $('salon-thinking').replaceChildren(KIT.StatusDot({ state: 'work' }), document.createTextNode(doing.map((x) => `${x.name} : ${x.text}`).join(' \u00b7 ')));
5326
+ else $('salon-thinking').replaceChildren(KIT.StatusDot({ state: 'work' }), document.createTextNode(who.length > 1 ? uiSaid('room-thinking-many', '{names} are thinking\u2026', { names: who.join(', ') }) : uiSaid('room-thinking', '{name} is thinking\u2026', { name: who[0] ?? '' })));
5324
5327
  /* Its bar says it too, as its row in the list: its dot at work, « Cuisine parle… » under its name. */
5325
5328
  salonLive(who);
5326
5329
  const known = rooms.find((x) => x.id === id);