clavarium 0.2.57-next.1 → 0.2.60-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.
- package/npm-shrinkwrap.json +6 -6
- package/package.json +2 -2
- package/server/main.mjs +1 -1
- package/server/secret-scan.mjs +2 -2
- package/web/app.js +11 -1
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.60-next.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.60-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.8-next.1",
|
|
15
15
|
"clavarium-docket": "0.1.1",
|
|
16
|
-
"clavarium-parley": "0.17.
|
|
16
|
+
"clavarium-parley": "0.17.7-next.1",
|
|
17
17
|
"mermaid": "11.17.2",
|
|
18
18
|
"node-pty": "^1.1.0",
|
|
19
19
|
"pdfjs-dist": "6.4.299",
|
|
@@ -714,9 +714,9 @@
|
|
|
714
714
|
}
|
|
715
715
|
},
|
|
716
716
|
"node_modules/clavarium-parley": {
|
|
717
|
-
"version": "0.17.
|
|
718
|
-
"resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.
|
|
719
|
-
"integrity": "sha512-
|
|
717
|
+
"version": "0.17.7-next.1",
|
|
718
|
+
"resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.7-next.1.tgz",
|
|
719
|
+
"integrity": "sha512-qzkXBaBY8zn3VQbsbrNeqy3+x/q2wUNn9GIoob+I4EYsFRQGufhboVaD5yogeMgiq1uB1hk5O5/N9Oh18dDUNg==",
|
|
720
720
|
"license": "MIT",
|
|
721
721
|
"bin": {
|
|
722
722
|
"parley": "bin/parley.mjs",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.60-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.8-next.1",
|
|
48
48
|
"clavarium-docket": "0.1.1",
|
|
49
|
-
"clavarium-parley": "0.17.
|
|
49
|
+
"clavarium-parley": "0.17.7-next.1",
|
|
50
50
|
"mermaid": "11.17.2",
|
|
51
51
|
"node-pty": "^1.1.0",
|
|
52
52
|
"pdfjs-dist": "6.4.299",
|
package/server/main.mjs
CHANGED
|
@@ -431,7 +431,7 @@ export async function startHome({ port, host, dataDir, mntDir = dataDir, gitRese
|
|
|
431
431
|
let out = ''; let last = 0; let any = false;
|
|
432
432
|
for (const h of hits) {
|
|
433
433
|
out += text.slice(last, h.start);
|
|
434
|
-
try { const { name } = secrets.stash(conversation, h.value); out += secretRef(name); any = true; }
|
|
434
|
+
try { const { name, expiresAt } = secrets.stash(conversation, h.value); out += secretRef(name, Date.parse(expiresAt)); any = true; }
|
|
435
435
|
catch { out += text.slice(h.start, h.end); } /* cannot be stashed (too large): left as it is */
|
|
436
436
|
last = h.end;
|
|
437
437
|
}
|
package/server/secret-scan.mjs
CHANGED
|
@@ -57,8 +57,8 @@ function looksRandom(s) {
|
|
|
57
57
|
shows as stars (ui side), and the tool reads to use /run/secrets/<name>.
|
|
58
58
|
Named like `SECRET_` + 10 hex (secrets.mjs stash). The angle brackets
|
|
59
59
|
(U+27E8/U+27E9) are vanishingly rare in a real message. */
|
|
60
|
-
export const secretRef = (name) => `⟨secret:${name}⟩`;
|
|
61
|
-
export const SECRET_REF = /⟨secret:(SECRET_[0-9A-F]{10})
|
|
60
|
+
export const secretRef = (name, at) => `⟨secret:${name}${Number.isFinite(at) ? `@${at}` : ''}⟩`;
|
|
61
|
+
export const SECRET_REF = /⟨secret:(SECRET_[0-9A-F]{10})(?:@(\d+))?⟩/g;
|
|
62
62
|
|
|
63
63
|
export function scan(text) {
|
|
64
64
|
const str = String(text ?? '');
|
package/web/app.js
CHANGED
|
@@ -2519,6 +2519,11 @@
|
|
|
2519
2519
|
const name = current;
|
|
2520
2520
|
if (name !== current || (thread && threadOf === current)) return;
|
|
2521
2521
|
threadOf = name;
|
|
2522
|
+
/* The short-lived secrets live in this conversation now (secret-scan.mjs): the chat shows each as
|
|
2523
|
+
stars with its time left and a way to forget it. Kept current on each reload, read on each repaint. */
|
|
2524
|
+
const chatSecrets = {};
|
|
2525
|
+
const refreshSecrets = () => { for (const k of Object.keys(chatSecrets)) delete chatSecrets[k]; for (const s of conversations.find((x) => x.name === name)?.ephemeralSecrets ?? []) chatSecrets[s.name] = { expiresInMs: s.expiresInMs }; };
|
|
2526
|
+
refreshSecrets();
|
|
2522
2527
|
/* The lines of its machine seen so far: what changed comes alone, and their buttons are worked out on all of them. */
|
|
2523
2528
|
const lines = new Map();
|
|
2524
2529
|
const withLines = (data, asked) => {
|
|
@@ -2532,7 +2537,7 @@
|
|
|
2532
2537
|
onView: (v) => { chatView = v; try { localStorage.setItem('clavarium-chat-view', v); } catch { /* as above */ } },
|
|
2533
2538
|
/* A part of the thread: its end at first, then what changed, the page before on demand (Parley's window). */
|
|
2534
2539
|
window: windowFor(chatWindow),
|
|
2535
|
-
load: (asked = {}) => fetch(talkPath(name, '', asked)).then((r) => r.json()).then((data) => withLines(data, asked)).then(machineLines).then((data) => withMachine(data, name)),
|
|
2540
|
+
load: (asked = {}) => fetch(talkPath(name, '', asked)).then((r) => r.json()).then((data) => withLines(data, asked)).then(machineLines).then((data) => withMachine(data, name)).then((data) => (refreshSecrets(), data)),
|
|
2536
2541
|
/* The whole thread searched, however little of it is shown. */
|
|
2537
2542
|
search: (q) => fetch(talkPath(name, '/search', { q })).then((r) => (r.ok ? r.json() : { matches: [], count: 0 })),
|
|
2538
2543
|
/* `via: 'voice'`: part of it was dictated, said to the tool. */
|
|
@@ -2565,6 +2570,9 @@
|
|
|
2565
2570
|
/* Its pictures, from the shared folders only, by the same route as the thumbnails of Files (type proved by the bytes, never SVG). */
|
|
2566
2571
|
picture: (file) => { if (!file.open) return null; const at = file.open.indexOf(':'); return `${API}/files/thumb?${new URLSearchParams({ c: name, r: file.open.slice(0, at), p: file.open.slice(at + 1) })}`; },
|
|
2567
2572
|
diagram: drawDiagram, highlight: colourCode,
|
|
2573
|
+
/* Short-lived secrets of this conversation: the stars say their time left and offer to forget them. */
|
|
2574
|
+
secrets: chatSecrets,
|
|
2575
|
+
forget: (secretName) => post(`${API}/conversations/${encodeURIComponent(name)}/secrets/${encodeURIComponent(secretName)}/forget`, {}).then(() => { delete chatSecrets[secretName]; if (thread && threadOf === name) void thread.refresh(); }).catch(() => {}),
|
|
2568
2576
|
remind: () => post(talkPath(name, '/remind'), {}),
|
|
2569
2577
|
/* The helpers of the terminal, in the chat: this page's voice, the owner's ready answers, the keyboard rule of this device. */
|
|
2570
2578
|
voice: chatVoice(), autoSend: chatAuto,
|
|
@@ -3220,6 +3228,8 @@
|
|
|
3220
3228
|
const gitSub = (r) => (r.from ? `from ${hostOf(r.from)}` : 'repository');
|
|
3221
3229
|
/* A secret's expiry, as said: `due` when it asks for the person (near, or past). */
|
|
3222
3230
|
const secretState = (s) => {
|
|
3231
|
+
/* Short-lived, lifted from a message (secrets.mjs): minutes, not days -- shown so it can be seen and let go. */
|
|
3232
|
+
if (s.ephemeral) { const mins = Math.max(0, Math.round((s.expiresInMs ?? 0) / 60_000)); return s.expired || mins <= 0 ? { text: 'Expired', tone: 'bad', due: true } : { text: `Short-lived, ${mins} min left`, tone: 'warn', due: true }; }
|
|
3223
3233
|
if (s.expired) return { text: 'Expired', tone: 'bad', due: true };
|
|
3224
3234
|
if (s.days === null || s.days === undefined) return { text: 'No expiry', tone: '', due: false };
|
|
3225
3235
|
if (secretDue(s)) return { text: s.days === 1 ? 'Expires tomorrow' : `Expires in ${s.days} days`, tone: 'warn', due: true };
|