clavarium 0.2.99-beta.1 → 0.2.100-beta.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/tethers.mjs +16 -1
- package/server/voice.mjs +1 -0
- package/web/index.html +1 -1
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.100-beta.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.100-beta.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/package.json
CHANGED
package/server/tethers.mjs
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
*/
|
|
22
22
|
import { mkdirSync, lstatSync } from 'node:fs';
|
|
23
23
|
import { keeper } from 'clavarium-tether/host';
|
|
24
|
+
import { JsonFile } from './store.mjs';
|
|
24
25
|
|
|
25
26
|
export const FOLDER = '.tether';
|
|
26
27
|
/* The keeper takes what the agents asked, this often. */
|
|
@@ -29,7 +30,7 @@ const AGENT = 'conversation:';
|
|
|
29
30
|
export const USB_DEVICE = 'usb-device';
|
|
30
31
|
|
|
31
32
|
export class Tethers {
|
|
32
|
-
#keeper; #resources; #conversations; #secrets; #timers = []; #changes = 0; #seen = new Map();
|
|
33
|
+
#keeper; #resources; #conversations; #secrets; #timers = []; #changes = 0; #seen = new Map(); #offered;
|
|
33
34
|
/* Set by the server once the thread is ready (main.mjs): (name, event) => talk.event(...).
|
|
34
35
|
A call waiting for the owner is said in its conversation's thread when there is one. */
|
|
35
36
|
announce = null;
|
|
@@ -38,6 +39,7 @@ export class Tethers {
|
|
|
38
39
|
`secrets`: the vault, read by name for a connector only (reveal). */
|
|
39
40
|
constructor({ dataDir, resources, conversations, secrets, connectors, now = () => Date.now() }) {
|
|
40
41
|
this.#resources = resources; this.#conversations = conversations; this.#secrets = secrets;
|
|
42
|
+
this.#offered = new JsonFile(`${dataDir}/tether-offered.json`, []);
|
|
41
43
|
this.#keeper = keeper(`${dataDir}/tether`, { sides: () => this.#sides(), secrets: (name) => this.#reveal(name), now, ...(connectors ? { connectors } : {}) });
|
|
42
44
|
/* Every change a page shows -- a new approval waiting, one decided, the targets,
|
|
43
45
|
the journal -- bumps the counter the client watches, so the approvals screen
|
|
@@ -97,6 +99,17 @@ export class Tethers {
|
|
|
97
99
|
return value;
|
|
98
100
|
}
|
|
99
101
|
|
|
102
|
+
/* The USB device is offered to every conversation once, at "propose": each flash still asks the
|
|
103
|
+
owner. Offered once only (the target remembers it): taken back by the owner, it stays taken back. */
|
|
104
|
+
#offerDevice(agent) {
|
|
105
|
+
try {
|
|
106
|
+
const offered = this.#offered.get();
|
|
107
|
+
if (offered.includes(agent) || !this.#keeper.store.target(USB_DEVICE)) return;
|
|
108
|
+
if (!this.#keeper.store.target(USB_DEVICE).grants?.[agent]) this.#keeper.store.grant(USB_DEVICE, agent, 'propose');
|
|
109
|
+
this.#offered.set([...offered, agent]);
|
|
110
|
+
} catch { /* a Tether without devices */ }
|
|
111
|
+
}
|
|
112
|
+
|
|
100
113
|
/* Each conversation's folder, made when missing; one that is anything but a folder of its own is left out. */
|
|
101
114
|
#sides() {
|
|
102
115
|
const out = [];
|
|
@@ -107,6 +120,7 @@ export class Tethers {
|
|
|
107
120
|
if (info === undefined) { try { mkdirSync(dir); } catch { continue; } }
|
|
108
121
|
else if (!info.isDirectory() || info.isSymbolicLink()) continue;
|
|
109
122
|
out.push({ dir, who: { id: `${AGENT}${name}`, kind: 'agent', name } });
|
|
123
|
+
this.#offerDevice(`${AGENT}${name}`);
|
|
110
124
|
}
|
|
111
125
|
return out;
|
|
112
126
|
}
|
|
@@ -141,6 +155,7 @@ export class Tethers {
|
|
|
141
155
|
given() {
|
|
142
156
|
const out = {};
|
|
143
157
|
for (const t of this.#keeper.store.targets()) {
|
|
158
|
+
if (t.kind === 'device') continue; /* offered to every conversation: not an access worth counting */
|
|
144
159
|
for (const id of Object.keys(t.grants ?? {})) if (id.startsWith(AGENT)) out[id.slice(AGENT.length)] = (out[id.slice(AGENT.length)] ?? 0) + 1;
|
|
145
160
|
}
|
|
146
161
|
return out;
|
package/server/voice.mjs
CHANGED
|
@@ -76,6 +76,7 @@ const PHANTOMS = [
|
|
|
76
76
|
d'Amara.org", "Untertitel der Amara.org-Community", "Subtítulos por la comunidad de Amara.org"...). */
|
|
77
77
|
/[^.!?。]*amara\.org[^.!?。]*[.!?。]?/giu,
|
|
78
78
|
/sous[- ]titrage\s*st\s*'?\s*\d+[.!]?/giu,
|
|
79
|
+
/sous[- ]titrage\s+fr(?:ançais)?\s*[.!?]?/giu,
|
|
79
80
|
/sous[- ]titr(?:age|es?)\s+(?:par\s+)?(?:la\s+)?société\s+radio[- ]canada[.!]?/giu,
|
|
80
81
|
/untertitel(?:ung)?\s+(?:im\s+auftrag\s+)?des\s+zdf(?:\s+für\s+funk)?,?\s*\d{0,4}[.!]?/giu,
|
|
81
82
|
];
|
package/web/index.html
CHANGED
|
@@ -463,7 +463,7 @@
|
|
|
463
463
|
</div>
|
|
464
464
|
<div id="box-ready" hidden>
|
|
465
465
|
<p>Pairing code <b id="box-code-shown"></b> <span class="hint" id="box-code-minutes"></span></p>
|
|
466
|
-
<p class="hint">Hold the box's button 5 s, join its Wi-Fi «
|
|
466
|
+
<p class="hint">Hold the box's button 5 s, join its Wi-Fi « Gambeli-… » with a phone, and type this code. A new box: ask the assistant of its conversation to flash it; you plug it in here when it asks.</p>
|
|
467
467
|
</div>
|
|
468
468
|
</div>
|
|
469
469
|
<div id="box-list"></div>
|