clavarium 0.2.338-next.1 → 0.2.340-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,12 +1,12 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.338-next.1",
3
+ "version": "0.2.340-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.338-next.1",
9
+ "version": "0.2.340-next.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.338-next.1",
3
+ "version": "0.2.340-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.",
@@ -65,6 +65,19 @@ export function demandeView(q) {
65
65
  if (sending && !c.draft && ext.length) v.irreversible = true;
66
66
  if (about.from && c.action !== 'reply') v.facts.push(fact('from', String(about.from)));
67
67
  if (about.date && !sending) v.facts.push(fact('date', when(about.date)));
68
+ /* A reply goes to the original's sender (and, to all, to its other recipients): said with their addresses even
69
+ when the act names none itself (06-11, the owner: « à qui, avec l'adresse mail »); outside the domain, said so. */
70
+ if (!c.to?.length && c.action === 'reply' && about.from) {
71
+ const addr = (x) => (/<([^>]+)>/.exec(String(x))?.[1] ?? String(x)).trim();
72
+ const me = String(c.self ?? '').toLowerCase();
73
+ const back = [String(about.from)];
74
+ const others = c.all ? [...(about.to ?? []), ...(about.cc ?? [])].map(String).filter((x) => x && addr(x).toLowerCase() !== me) : [];
75
+ const away = new Set(outside([...back, ...others].map(addr)));
76
+ const mark = (list) => list.map((x) => ({ text: x, ...(away.has(addr(x)) ? { ext: true } : {}) }));
77
+ v.facts.push(fact('to', mark(back)));
78
+ if (others.length) v.facts.push(fact('cc', mark(others)));
79
+ if (away.size && !c.draft) { if (!v.risk.includes(w('req-risk-outside'))) v.risk.push(w('req-risk-outside')); v.irreversible = true; }
80
+ }
68
81
  if (c.to?.length) v.facts.push(fact('to', chips(c.to, ext)));
69
82
  if (c.cc?.length) v.facts.push(fact('cc', chips(c.cc, ext)));
70
83
  if (c.bcc?.length) v.facts.push(fact('bcc', chips(c.bcc, ext)));
@@ -55,7 +55,7 @@ export const SETTINGS_WORDS_FR = {
55
55
  'set-mail-old-ref': 'Réf. ancienne : demandez à l\'IA de la rattacher.', 'set-mail-unreachable': 'Boîte injoignable pour le moment.',
56
56
  'set-mail-cut': 'Mail tronqué : pièces jointes incomplètes.',
57
57
  'set-ch-s-apikeys': 'Clés d\'API', 'set-apikeys-about': 'Pour un programme ou une IA.', 'set-apikeys-n1': '1 clé', 'set-apikeys-n': '{n} clés',
58
- 'set-apikeys-once': 'Copiez-la : elle ne sera plus affichée.', 'set-apikeys-copy': 'Copier', 'set-apikeys-copied': 'Copiée',
58
+ 'set-apikeys-once': 'Copiez-la : elle ne sera plus affichée.', 'set-apikeys-copy': 'Copier', 'set-apikeys-config-hint': 'Ou collez ceci dans votre outil d’IA (MCP) :', 'set-apikeys-config-copy': 'Copier la configuration', 'set-apikeys-copied': 'Copiée',
59
59
  'set-apikeys-select': 'Sélectionnée : copiez-la', 'set-apikeys-done': 'Fait', 'set-apikeys-none': 'Aucune clé.', 'set-apikeys-name': 'Nom',
60
60
  'set-apikeys-name-hint': 'À quoi elle sert', 'set-apikeys-scopes': 'Portées', 'set-apikeys-scopes-hint': 'Aucune tant que rien n\'est coché',
61
61
  'set-apikeys-expires': 'Expire', 'set-apikeys-30': 'Dans 30 jours', 'set-apikeys-90': 'Dans 90 jours', 'set-apikeys-365': 'Dans un an',
package/web/app.js CHANGED
@@ -6207,6 +6207,10 @@
6207
6207
  const r = await post(`${API}/apikeys`, { label: $('apikeys-label').value.trim(), scopes: [...$('apikeys-scopes').querySelectorAll('input:checked')].map((b) => b.value), days: days === 'never' ? null : Number(days) });
6208
6208
  apiKeyFormShown(false);
6209
6209
  $('apikeys-secret').value = r.secret; $('apikeys-once').hidden = false;
6210
+ /* 06-11 (the owner): the configuration an AI tool takes, ready to paste -- its MCP door and the key, shown this once too. */
6211
+ const slug = (appName || 'clavarium').toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, '').replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '') || 'clavarium';
6212
+ $('apikeys-config').textContent = JSON.stringify({ mcpServers: { [slug]: { type: 'http', url: `${location.origin}/api/ext/mcp`, headers: { Authorization: `Bearer ${r.secret}` } } } }, null, 2);
6213
+ $('apikeys-curl').textContent = `curl -H "Authorization: Bearer ${r.secret}" ${location.origin}/api/ext/v1/status`;
6210
6214
  } catch (error) { $('apikeys-error').textContent = error.message; $('apikeys-error').hidden = false; return; }
6211
6215
  await paintApiKeys();
6212
6216
  });
@@ -6217,7 +6221,13 @@
6217
6221
  setTimeout(() => { b.textContent = uiSaid('set-apikeys-copy', 'Copy'); }, 2500);
6218
6222
  });
6219
6223
  /* Done: the secret leaves the page too. */
6220
- $('apikeys-done').addEventListener('click', () => { $('apikeys-secret').value = ''; $('apikeys-once').hidden = true; });
6224
+ $('apikeys-config-copy').addEventListener('click', async () => {
6225
+ const b = $('apikeys-config-copy'); const pre = $('apikeys-config');
6226
+ try { await navigator.clipboard.writeText(pre.textContent); b.textContent = uiSaid('set-apikeys-copied', 'Copied'); }
6227
+ catch { const range = document.createRange(); range.selectNodeContents(pre); const sel = getSelection(); sel.removeAllRanges(); sel.addRange(range); b.textContent = uiSaid('set-apikeys-select', 'Selected: copy it'); }
6228
+ setTimeout(() => { b.textContent = uiSaid('set-apikeys-config-copy', 'Copy the configuration'); }, 2500);
6229
+ });
6230
+ $('apikeys-done').addEventListener('click', () => { $('apikeys-secret').value = ''; $('apikeys-config').textContent = ''; $('apikeys-curl').textContent = ''; $('apikeys-once').hidden = true; });
6221
6231
  function showPassword(email, password) {
6222
6232
  $('operators-password-for').textContent = email; $('operators-password-value').value = password; $('operators-password').hidden = false;
6223
6233
  }
package/web/index.html CHANGED
@@ -1032,7 +1032,7 @@
1032
1032
  <details class="chapter" id="settings-ch-apikeys" data-chapter="s-apikeys" hidden>
1033
1033
  <summary><span class="chapter-title" data-said="set-ch-s-apikeys">API keys</span><span class="chapter-about" id="apikeys-about">For a program or an AI.</span></summary>
1034
1034
  <div class="chapter-body">
1035
- <div id="apikeys-once" class="callout apikeys-once" role="status" hidden><p><b data-said="set-apikeys-once">Copy it now: it won't be shown again.</b></p><div class="row"><input id="apikeys-secret" readonly spellcheck="false" aria-label="API key"><button type="button" id="apikeys-copy" class="primary" data-said="set-apikeys-copy">Copy</button><button type="button" id="apikeys-done" data-said="set-apikeys-done">Done</button></div></div>
1035
+ <div id="apikeys-once" class="callout apikeys-once" role="status" hidden><p><b data-said="set-apikeys-once">Copy it now: it won't be shown again.</b></p><div class="row"><input id="apikeys-secret" readonly spellcheck="false" aria-label="API key"><button type="button" id="apikeys-copy" class="primary" data-said="set-apikeys-copy">Copy</button><button type="button" id="apikeys-done" data-said="set-apikeys-done">Done</button></div><p class="hint" data-said="set-apikeys-config-hint">Or paste this into your AI tool (MCP):</p><pre id="apikeys-config" class="apikeys-config"></pre><div class="row"><button type="button" id="apikeys-config-copy" data-said="set-apikeys-config-copy">Copy the configuration</button></div><p class="hint apikeys-curl"><code id="apikeys-curl"></code></p></div>
1036
1036
  <div id="apikeys-rows"></div>
1037
1037
  <p class="hint" id="apikeys-empty" data-said="set-apikeys-none" hidden>No key yet.</p>
1038
1038
  <form id="apikeys-form" class="set-rows" autocomplete="off" hidden>
package/web/style.css CHANGED
@@ -2777,3 +2777,7 @@ button.kit-switch[aria-checked="true"]::after { left: 18px; background: var(--ok
2777
2777
  .mail-acts { display: flex; flex-wrap: wrap; gap: 8px; }
2778
2778
  #viewer .mail-reply { min-height: 40px; padding: 0 16px; border: 1px solid var(--brass); border-radius: 8px; background: transparent; color: var(--brass-ink); font-weight: 600; }
2779
2779
  .mail-state .mail-state-line { font-weight: 600; color: var(--ink); text-align: center; }
2780
+
2781
+ /* An API key's configuration, shown with it once (06-11). */
2782
+ .apikeys-config { margin: 6px 0; padding: 10px 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); font: .8125rem/1.45 var(--mono, ui-monospace, monospace); white-space: pre; overflow-x: auto; max-width: 100%; }
2783
+ .apikeys-curl code { word-break: break-all; font-size: .75rem; }