clavarium 0.2.346-next.1 → 0.2.347-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.346-next.1",
3
+ "version": "0.2.347-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.346-next.1",
9
+ "version": "0.2.347-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.77-next.1",
16
+ "clavarium-parley": "0.17.81-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.77-next.1",
791
- "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.77-next.1.tgz",
792
- "integrity": "sha512-mT6JxoADZLdPrHyN5hhV9unXsy+dmcWURGzK7m6aiFRcWaJCBCfrqv4fo0rwMi96pIlYws7Dke49jo8KJwpsSg==",
790
+ "version": "0.17.81-next.1",
791
+ "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.81-next.1.tgz",
792
+ "integrity": "sha512-qKcxmphV/EMtP2enYWMD+71DJepvOox0qkfN9tbxRBiIhcB7VA0NlEuKaXGcJADqrb5tpy+ayIzEYxVjmp/D1g==",
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.346-next.1",
3
+ "version": "0.2.347-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.77-next.1",
49
+ "clavarium-parley": "0.17.81-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
@@ -29,6 +29,9 @@ export const THINKING_MS = 10 * 60_000;
29
29
  const KINDS = ['person', 'ai', 'box'];
30
30
  const nameOf = (v) => String(v ?? '').replace(/\s+/g, ' ').trim().slice(0, ROOM_NAME_MAX);
31
31
 
32
+ /* A sign as the cards draw it (web/kit.js hueOf, initialOf): the same name, the same letter and colour. */
33
+ export const lookOf = (name) => { const text = String(name ?? ''); let h = 0; for (const ch of text) h = (h * 31 + ch.codePointAt(0)) >>> 0; return { initial: ([...text.trim()][0] ?? '?').toUpperCase(), hue: h % 360 }; };
34
+
32
35
  export class Rooms {
33
36
  #file; #dir; #say; #rooms; #conversations; #boxes; #now; #speak; #hops = new Map(); #thinking = new Map();
34
37
  /* file: a JsonFile of the rooms; dir: where their threads are; say(name, text, extra): a message written in a
@@ -48,8 +51,11 @@ export class Rooms {
48
51
  const boxes = new Map(this.#boxes().map((b) => [b.id, b]));
49
52
  /* An AI is named as its chat names it (the name the owner gave it in its chat settings), else its title, else its name. */
50
53
  const convs = new Map(this.#conversations().map((c) => [c.name, c.chatName || c.title || c.name]));
54
+ /* Its sign (06-11): an AI by its conversation's card (letter and colour of its title), anyone else by its name. */
55
+ const titles = new Map(this.#conversations().map((c) => [c.name, c.title || c.name]));
51
56
  return room.members.filter((m) => (m.kind === 'ai' ? convs.has(m.ref) : m.kind === 'box' ? boxes.has(m.ref) : true))
52
- .map((m) => ({ id: m.id, kind: m.kind, name: m.kind === 'box' ? (boxes.get(m.ref)?.name ?? m.name) : m.kind === 'ai' ? convs.get(m.ref) : m.name, ref: m.ref, ...(m.id === room.host ? { host: true } : {}) }));
57
+ .map((m) => { const name = m.kind === 'box' ? (boxes.get(m.ref)?.name ?? m.name) : m.kind === 'ai' ? convs.get(m.ref) : m.name;
58
+ 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 } : {}) }; });
53
59
  }
54
60
  #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); }
55
61
  has(id) { return this.#all().some((r) => r.id === id); }
@@ -119,7 +125,7 @@ export class Rooms {
119
125
  /* ITS THREAD, as a screen reads it (Parley's read, the members' names of the moment). */
120
126
  read(id, options) {
121
127
  const room = this.#find(id); const t = this.#thread(room.id); const members = this.#shown(room);
122
- t.setSpeakers(members.map((m) => ({ id: m.id, name: m.name, kind: m.kind })));
128
+ t.setSpeakers(members.map((m) => ({ id: m.id, name: m.name, kind: m.kind, look: m.look })));
123
129
  const read = t.read(options);
124
130
  /* A member named in a text (@{id}): its name of the moment, on the screen. */
125
131
  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; });
@@ -138,14 +144,16 @@ export class Rooms {
138
144
  const t = this.#thread(room.id);
139
145
  this.#hops.set(room.id, 0);
140
146
  /* The owner is the room's own side (no name over their words, as in any chat); anyone else is named. */
141
- const now = t.say(text, undefined, [], who.ref === 'owner' ? {} : { by: { id: who.id, name: who.name, kind: who.kind } });
147
+ const now = t.say(text, undefined, [], who.ref === 'owner' ? {} : { by: { id: who.id, name: who.name, kind: who.kind, look: who.look } });
142
148
  const said = now.messages.at(-1);
143
149
  const named = (Array.isArray(to) ? to : []).map((x) => members.find((m) => m.id === x && m.kind === 'ai')).filter(Boolean);
144
150
  const host = members.find((m) => m.id === room.host);
145
151
  for (const ai of named.length ? named : host ? [host] : []) {
146
152
  this.#think(room.id, ai.id, true);
147
- await this.#say(ai.ref, said.text, { by: { id: who.id, name: who.name, kind: who.kind }, room: { id: room.id, name: room.name, message: said.id } });
153
+ await this.#say(ai.ref, said.text, { by: { id: who.id, name: who.name, kind: who.kind, look: who.look }, room: { id: room.id, name: room.name, message: said.id } });
148
154
  }
155
+ /* Handed to its AIs: read, as a conversation's agent would say it (06-11: the clock stayed on every message). */
156
+ try { t.seen?.(); } catch { /* an older Parley */ }
149
157
  return this.read(id);
150
158
  }
151
159
 
@@ -178,18 +186,18 @@ export class Rooms {
178
186
  /* Handed on as it is: the message itself, by who said it; the room's thread keeps no copy. */
179
187
  const forwarded = find(entry.forward);
180
188
  if (forwarded) {
181
- const from = forwarded.by ? { id: forwarded.by.id, name: forwarded.by.name, kind: forwarded.by.kind ?? 'person' } : { id: members.find((m) => m.kind === 'person')?.id ?? 'owner', name: members.find((m) => m.kind === 'person')?.name ?? 'Owner', kind: 'person' };
189
+ const from = forwarded.by ? { id: forwarded.by.id, name: forwarded.by.name, kind: forwarded.by.kind ?? 'person', ...(forwarded.by.look ? { look: forwarded.by.look } : {}) } : { id: members.find((m) => m.kind === 'person')?.id ?? 'owner', name: members.find((m) => m.kind === 'person')?.name ?? 'Owner', kind: 'person' };
182
190
  for (const ai of ais) handOver(ai, forwarded.text, from, forwarded.id);
183
191
  if (!String(entry.text ?? '').trim()) return forwarded.id;
184
192
  }
185
193
  if (!String(entry.text ?? '').trim()) return null;
186
194
  /* @Name of a member, exactly: kept as its id (the screen says its name of the moment). */
187
195
  const text = String(entry.text).replace(/@([^\s@{][^@\n]{0,40}?)(?=[\s,.;:!?)]|$)/g, (whole, name) => { const m = members.find((x) => x.name.toLowerCase() === name.toLowerCase()); return m ? `@{${m.id}}` : whole; });
188
- const id = t.relay({ text, by: { id: me.id, name: me.name, kind: 'ai' }, to, re, kind: kind === 'doing' ? 'doing' : 'say' });
196
+ const id = t.relay({ text, by: { id: me.id, name: me.name, kind: 'ai', look: me.look }, to, re, kind: kind === 'doing' ? 'doing' : 'say' });
189
197
  /* The boxes it is sent to say it aloud (#281): its words, a member named by its name, never an id. */
190
198
  const boxes = to.map((x) => members.find((m) => m.id === x && m.kind === 'box')).filter(Boolean).map((m) => m.ref);
191
199
  if (boxes.length) { const aloud = text.replace(/@\{([0-9a-f-]{36})\}/g, (w, mid) => members.find((x) => x.id === mid)?.name ?? ''); try { this.#speak(`room:${room.id}`, aloud, boxes, { doing: kind === 'doing', asked: kind === 'ask' }); } catch { /* the boxes' */ } }
192
- if (!forwarded && kind !== 'doing') for (const ai of ais) handOver(ai, text, { id: me.id, name: me.name, kind: 'ai' }, id);
200
+ if (!forwarded && kind !== 'doing') for (const ai of ais) handOver(ai, text, { id: me.id, name: me.name, kind: 'ai', look: me.look }, id);
193
201
  return id;
194
202
  }
195
203
 
@@ -198,7 +206,7 @@ export class Rooms {
198
206
  const shown = list.map((r) => ({ ...r, members: this.#shown(r) }));
199
207
  for (const c of this.#conversations()) {
200
208
  const mine = shown.filter((r) => r.members.some((m) => m.kind === 'ai' && m.ref === c.name))
201
- .map((r) => ({ id: r.id, name: r.name, members: r.members.map((m) => ({ id: m.id, name: m.name, kind: m.kind })) }));
209
+ .map((r) => ({ id: r.id, name: r.name, members: r.members.map((m) => ({ id: m.id, name: m.name, kind: m.kind, look: m.look })) }));
202
210
  try { this.#rooms(c.name, mine); } catch { /* its folder is not there yet */ }
203
211
  }
204
212
  }
package/web/app.js CHANGED
@@ -1277,7 +1277,8 @@
1277
1277
  if (c.group) b.dataset.group = c.group;
1278
1278
  /* Ready, but its tool not there yet: it still reads as under way. */
1279
1279
  if (holds(c)) b.dataset.busy = 'true';
1280
- if (c.name === current) b.setAttribute('aria-current', 'true');
1280
+ /* The one open: never a conversation while a room is (06-11: the conversation left before stayed marked). */
1281
+ if (c.name === current && !roomOpenNow()) b.setAttribute('aria-current', 'true');
1281
1282
  if (c.title) b.title = c.name;
1282
1283
  if (c.hidden === true) b.dataset.hidden = 'true';
1283
1284
  if (c.asleep) b.dataset.asleep = 'true';
@@ -5330,6 +5331,8 @@
5330
5331
  const r = rooms.find((x) => x.id === id); if (!r) return;
5331
5332
  enterPlace('salon', push);
5332
5333
  salonLeft(); salonId = id;
5334
+ /* The list marks this room, and no conversation, at once. */
5335
+ paint();
5333
5336
  $('salon-name').textContent = r.name;
5334
5337
  salonLive(thinkingOf(r));
5335
5338
  $('salon-who').replaceChildren(memberChips(r.members), el('span', 'hint', `${countOf(r.members)} \u25BE`));