clavarium 0.2.28 → 0.2.29

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,17 +1,17 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.28",
3
+ "version": "0.2.29",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.28",
9
+ "version": "0.2.29",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
13
13
  "@xterm/xterm": "^6.0.0",
14
- "clavarium-binder": "0.1.3-next.4",
14
+ "clavarium-binder": "0.1.3-next.5",
15
15
  "clavarium-docket": "0.1.1",
16
16
  "clavarium-parley": "0.17.0-next.1",
17
17
  "mermaid": "11.17.2",
@@ -688,9 +688,9 @@
688
688
  }
689
689
  },
690
690
  "node_modules/clavarium-binder": {
691
- "version": "0.1.3-next.4",
692
- "resolved": "https://registry.npmjs.org/clavarium-binder/-/clavarium-binder-0.1.3-next.4.tgz",
693
- "integrity": "sha512-H3cuO8KpFHg7W0vZZjTbpdFxMCYV+t0YHIffgjC8erCFLWE/VBKsAXHXLvqgyIavxQ8fs0eQ/PmwiCKRtC2VEg==",
691
+ "version": "0.1.3-next.5",
692
+ "resolved": "https://registry.npmjs.org/clavarium-binder/-/clavarium-binder-0.1.3-next.5.tgz",
693
+ "integrity": "sha512-+7aEA1Bfz1mrd8hWhuOGhEcUICdC1xDBSj7+jVk8q1NJueFjORIRVC02Kto7ZTXHroFUOxVGZvmzy8oYPv6vEQ==",
694
694
  "license": "MIT",
695
695
  "bin": {
696
696
  "binder": "bin/binder.mjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.28",
3
+ "version": "0.2.29",
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.",
@@ -44,7 +44,7 @@
44
44
  "dependencies": {
45
45
  "@xterm/addon-fit": "^0.11.0",
46
46
  "@xterm/xterm": "^6.0.0",
47
- "clavarium-binder": "0.1.3-next.4",
47
+ "clavarium-binder": "0.1.3-next.5",
48
48
  "clavarium-docket": "0.1.1",
49
49
  "clavarium-parley": "0.17.0-next.1",
50
50
  "mermaid": "11.17.2",
@@ -20,8 +20,10 @@
20
20
  * a date and time at that time; not done, not archived): each conversation
21
21
  * that owns it is posted one event (kind binder/due, its title and list, data
22
22
  * the card), and where a person owns it, the owner's devices are told once
23
- * (alerts.mjs). Binder keeps what it gave, so a restart says nothing again;
24
- * a due date moved says it again when the new time comes.
23
+ * (alerts.mjs). A card may also carry a lead time (remindBefore days): then it
24
+ * is told once that many days ahead too -- "Dans 7 jours : ...", the due itself
25
+ * staying "Échéance : ...". Binder keeps what it gave, so a restart says
26
+ * nothing again; a due date or a lead moved says it again when its time comes.
25
27
  */
26
28
  import { mkdirSync, lstatSync } from 'node:fs';
27
29
  import { keeper } from 'clavarium-binder/host';
@@ -32,6 +34,8 @@ export const DUE_MS = 30_000;
32
34
  export const DUE_KIND = 'binder/due';
33
35
  const AGENT = 'conversation:';
34
36
  const PERSON = 'person:';
37
+ /* A lead time in words: "Dans 1 jour", "Dans 7 jours". */
38
+ const ahead = (days) => `Dans ${days} jour${days > 1 ? 's' : ''}`;
35
39
 
36
40
  export class Binders {
37
41
  #keeper; #resources; #conversations; #dockets; #team; #alert; #timers = []; #changes = 0; #ready = new Set();
@@ -65,13 +69,17 @@ export class Binders {
65
69
  const name = id.slice(AGENT.length);
66
70
  try { this.#dockets.post(name, { kind, text, ...(data ? { data } : {}) }); } catch { /* its docket may be off */ }
67
71
  }
68
- /* The cards come due since the last look: told to who owns them, once. */
72
+ /* The moments come since the last look: told to who owns them, once each.
73
+ The lead reminder (kind due-soon) leads with "Dans N jours", the due itself
74
+ with "Échéance"; both short, high level, the card in the event's data. */
69
75
  remind() {
70
76
  const told = [];
71
- for (const { record: r, list: l } of this.#keeper.due()) {
72
- for (const id of r.owners) this.#tell(id, `Due: #${r.id} ${r.title} (${l.title})`, DUE_KIND, { card: r.id, list: l.id, due: r.due });
77
+ for (const { kind, days, record: r, list: l } of this.#keeper.due()) {
78
+ const soon = kind === 'due-soon';
79
+ const head = soon ? ahead(days) : 'Échéance';
80
+ for (const id of r.owners) this.#tell(id, `${head} : #${r.id} ${r.title} (${l.title})`, DUE_KIND, { card: r.id, list: l.id, due: r.due, ...(soon ? { days } : {}) });
73
81
  if (this.#alert && r.owners.some((id) => id.startsWith(PERSON))) {
74
- try { void Promise.resolve(this.#alert({ title: 'Due', body: `${r.title} (${l.title})`, url: `/?open=lists&a=${encodeURIComponent(`list:${l.id}`)}` })).catch(() => {}); } catch { /* as said */ }
82
+ try { void Promise.resolve(this.#alert({ title: head, body: `${r.title} (${l.title})`, url: `/?open=lists&a=${encodeURIComponent(`list:${l.id}`)}` })).catch(() => {}); } catch { /* as said */ }
75
83
  }
76
84
  told.push(r.id);
77
85
  }