clavarium 0.2.55-next.1 → 0.2.57-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.55-next.1",
3
+ "version": "0.2.57-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.55-next.1",
9
+ "version": "0.2.57-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.4-next.1",
16
+ "clavarium-parley": "0.17.5-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.4-next.1",
718
- "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.4-next.1.tgz",
719
- "integrity": "sha512-/rQy9WLP9/XndInawH6mIhS9RivA1IQmMpB5IhYMUflnLSWBvP096Z0TF3xB3u2X1e8uni4tar5Tua5hq/wjWg==",
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==",
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.55-next.1",
3
+ "version": "0.2.57-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.4-next.1",
49
+ "clavarium-parley": "0.17.5-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. */