clavarium 0.2.56-next.1 → 0.2.58-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.56-next.1",
3
+ "version": "0.2.58-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.56-next.1",
9
+ "version": "0.2.58-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.5-next.1",
16
+ "clavarium-parley": "0.17.6-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.5-next.1",
718
- "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.5-next.1.tgz",
719
- "integrity": "sha512-6yk6eLIs1LLHzByJubOPjc5h4D1lApHhzMwIUrdHEQLxKfplzGgxfD0oPW+kYha5CFfELaKLkHiVSy09lo1JjA==",
717
+ "version": "0.17.6-next.1",
718
+ "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.6-next.1.tgz",
719
+ "integrity": "sha512-7boIq+mByiORcAHRtkqp/KVYhZWDC1EaT3S4ak1PyYPYZtMFUdIy5w73Affst3+7bnoSvgYrMD0R5YHI8P+LbQ==",
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.56-next.1",
3
+ "version": "0.2.58-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.5-next.1",
49
+ "clavarium-parley": "0.17.6-next.1",
50
50
  "mermaid": "11.17.2",
51
51
  "node-pty": "^1.1.0",
52
52
  "pdfjs-dist": "6.4.299",
package/server/api.mjs CHANGED
@@ -235,7 +235,7 @@ export async function handleApi(request, response, conversations, headers, resou
235
235
  if (pathname === '/api/tools') return send(200, conversations.tools()), true;
236
236
  if (pathname === '/api/conversations') {
237
237
  const lists = binders?.given() ?? {};
238
- return send(200, conversations.list().map((c) => ({ ...c, lists: lists[c.name] ?? null, resources: resources?.of(c.name) ?? [], secrets: secrets?.of(c.name) ?? [], answerer: answerer?.of(c.name) ?? null, wakeups: wakeups?.of(c.name) ?? null, health: health?.of(c.name) ?? null, talk: talk?.brief(c.name) ?? null }))), true;
238
+ return send(200, conversations.list().map((c) => ({ ...c, lists: lists[c.name] ?? null, resources: resources?.of(c.name) ?? [], secrets: secrets?.of(c.name) ?? [], ephemeralSecrets: secrets?.liveFor(c.name) ?? [], answerer: answerer?.of(c.name) ?? null, wakeups: wakeups?.of(c.name) ?? null, health: health?.of(c.name) ?? null, talk: talk?.brief(c.name) ?? null }))), true;
239
239
  }
240
240
  if (pathname === '/api/resources' && resources) return send(200, resources.list()), true;
241
241
  if (pathname === '/api/shortcuts' && shortcuts) return send(200, shortcuts.list()), true;
@@ -505,6 +505,14 @@ export async function handleApi(request, response, conversations, headers, resou
505
505
  retell(conversation);
506
506
  return send(200, { ok: true, secrets: secrets.of(conversation) }), true;
507
507
  }
508
+ /* Forget an ephemeral secret now (its stars in the chat have a button): gone from the vault and the machine. */
509
+ const forgetSecret = /^\/api\/conversations\/([^/]+)\/secrets\/([^/]+)\/forget$/.exec(pathname);
510
+ if (forgetSecret && secrets) {
511
+ const conversation = decodeURIComponent(forgetSecret[1]);
512
+ if (!conversations.list().some((c) => c.name === conversation)) throw new Refusal(404, 'No such conversation.');
513
+ await secrets.drop(conversation, decodeURIComponent(forgetSecret[2]));
514
+ return send(200, { ok: true }), true;
515
+ }
508
516
  const share = /^\/api\/conversations\/([^/]+)\/share$/.exec(pathname);
509
517
  if (share && sharing) {
510
518
  const conversation = decodeURIComponent(share[1]);
@@ -117,6 +117,9 @@ export class Secrets {
117
117
  of(conversation) { return this.#store.all().filter((s) => this.#handed(conversation, s.name)).map((s) => s.name); }
118
118
  /* Delivered to it at its next start. */
119
119
  given(conversation) { return this.#given(conversation).map((s) => s.name); }
120
+ /* The EPHEMERAL secrets live for it now (a message of it holds their marker), each with how long it has
121
+ left -- the chat shows the stars with that, and a way to forget it (talk/parley-ui). Never a value. */
122
+ liveFor(conversation) { return this.#given(conversation).filter((s) => s.ephemeral === true).map((s) => ({ name: s.name, expiresInMs: Math.max(0, Date.parse(s.expiresAt) - this.#now().getTime()) })); }
120
123
 
121
124
  /* The value, for this server's own use only (the key of the dictation
122
125
  engine, put in a request's header): never returned by any route. */
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,