clavarium 0.2.392-next.1 → 0.2.393-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.392-next.1",
3
+ "version": "0.2.393-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.392-next.1",
9
+ "version": "0.2.393-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.62-next.1",
15
15
  "clavarium-docket": "0.1.2-next.2",
16
- "clavarium-parley": "0.17.88-next.1",
16
+ "clavarium-parley": "0.17.90-next.1",
17
17
  "clavarium-tether": "0.1.0-next.60",
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.88-next.1",
791
- "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.88-next.1.tgz",
792
- "integrity": "sha512-oZGzOfga9EXqlta35fRp/SIgUJb2J3tWzJhLnArkbxiMHrVkxgoMu6lX1F5ckAw2pWLjfgOo49TAbRZFHIigsA==",
790
+ "version": "0.17.90-next.1",
791
+ "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.90-next.1.tgz",
792
+ "integrity": "sha512-VktaI1Hwi5Kpw5B8xJuV4GjbcX+xuynIjEeko1HRnkhrU100+3BHoho2X7uMHow98i/oW6MieMxI/cBQKVS9uA==",
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.392-next.1",
3
+ "version": "0.2.393-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.",
@@ -47,7 +47,7 @@
47
47
  "@xterm/xterm": "^6.0.0",
48
48
  "clavarium-binder": "0.1.62-next.1",
49
49
  "clavarium-docket": "0.1.2-next.2",
50
- "clavarium-parley": "0.17.88-next.1",
50
+ "clavarium-parley": "0.17.90-next.1",
51
51
  "clavarium-tether": "0.1.0-next.60",
52
52
  "mammoth": "1.13.0",
53
53
  "mermaid": "11.17.2",
package/server/api.mjs CHANGED
@@ -29,6 +29,7 @@
29
29
  * POST /api/conversations/<name>/terminal/repair its terminal does not come though its machine runs: repaired
30
30
  * POST /api/conversations/<name>/talk {text, answers?, files?, via?}: written in its chat; files from .../talk/file; via 'voice': dictated
31
31
  * POST /api/conversations/<name>/talk/react {to, reaction}: the owner's reaction to a message of the tool (null: taken back)
32
+ * POST /api/conversations/<name>/talk/pin {to, on}: the owner pins a message of the chat (on: false unpins); 5 at most
32
33
  * POST /api/conversations/<name>/chat-name {name}: the name the chat gives its tool ('' : the neutral word of the dictionary)
33
34
  * POST /api/conversations/<name>/tasks-binder {binder}: the binder shown beside its chat ('' automatic, '-' none, else an id)
34
35
  * POST /api/conversations/<name>/voice-mark {on}: what is dictated into its terminal starts with a microphone sign (AI tools only)
@@ -792,12 +793,13 @@ export async function handleApi(request, response, conversations, headers, resou
792
793
  }
793
794
  return send(200, { asset, rights, given }), true;
794
795
  }
795
- const talking = /^\/api\/conversations\/([^/]+)\/talk(\/invite|\/remind|\/react)?$/.exec(pathname);
796
+ const talking = /^\/api\/conversations\/([^/]+)\/talk(\/invite|\/remind|\/react|\/pin)?$/.exec(pathname);
796
797
  if (talking && talk) {
797
798
  const conversation = decodeURIComponent(talking[1]);
798
799
  if (talking[2] === '/invite') return send(200, await talk.invite(conversation, typeof body.lang === 'string' ? body.lang : 'en')), true;
799
800
  if (talking[2] === '/remind') return send(200, await talk.remind(conversation, { urgent: body?.urgent === true })), true;
800
801
  if (talking[2] === '/react') return send(200, await talk.react(conversation, body.to, body.reaction ?? null)), true;
802
+ if (talking[2] === '/pin') return send(200, await talk.pin(conversation, body.to, body.on !== false)), true;
801
803
  if (typeof body.on === 'boolean') { const now = await talk.set(conversation, body.on); retell(conversation); return send(200, now), true; }
802
804
  /* What the chat may add to an answer: the choices ticked, the answers of a group, the zone of a picture it is about (Parley checks each). */
803
805
  return send(201, await talk.say(conversation, body.text, body.answers, body.files, body.via, { picked: body.picked, replies: body.replies, about: body.about })), true;
package/server/talk.mjs CHANGED
@@ -536,6 +536,15 @@ export class Talk {
536
536
  return { ...this.of(name), told };
537
537
  }
538
538
 
539
+ /* THE OWNER PINS a message of the chat, either side (`on` false: unpinned). Kept at the top of the
540
+ chat, 5 at most (Parley), and read again by the tool after a restart: it is not woken for it. */
541
+ async pin(name, to, on = true) {
542
+ if (!this.of(name).on) throw new Refusal(409, 'Talking through the app is not turned on for this conversation.');
543
+ if (typeof to !== 'string' || typeof on !== 'boolean') throw new Refusal(400, 'Say which message (to), and on: true or false.');
544
+ try { this.#parley(name).pin(to, on); } catch (error) { if (error instanceof RangeError) throw new Refusal(400, error.message); throw error; }
545
+ return this.of(name);
546
+ }
547
+
539
548
  /* A FILE THE PERSON ATTACHES, before the message that carries it: put in
540
549
  the bridge folder, in a folder of its own, under the name it had.
541
550
  Resolves with where the tool finds it. */
package/web/app.js CHANGED
@@ -3279,6 +3279,8 @@
3279
3279
  schemes: { mail: { icon: 'mail', open: (ref, label) => { void openMailRef(ref, { label, of: name }); } } },
3280
3280
  /* A reaction to one of its messages: wherever the chat may be written in. */
3281
3281
  ...(!DEVICE || deviceParts.chat === 'write' ? { react: (to, reaction) => post(talkPath(name, '/react'), { to, reaction }) } : {}),
3282
+ /* A message pinned at the top of the chat (5 at most, either side): wherever the chat may be written in. */
3283
+ ...(!DEVICE || deviceParts.chat === 'write' ? { pin: (to, on) => post(talkPath(name, '/pin'), { to, on }) } : {}),
3282
3284
  /* A message attached to a card (#180), from its menu: its id, as the card opens it again. */
3283
3285
  ...(!DEVICE ? { card: (m) => attachToCard({ kind: 'message', ref: m.id, title: String(m.short || m.text || '').replace(/\s+/g, ' ').trim().slice(0, 80) }) } : {}),
3284
3286
  /* The buttons of a line of the machine: what this screen may do. */