clavarium 0.2.229-next.1 → 0.2.231-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,17 +1,17 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.229-next.1",
3
+ "version": "0.2.231-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.229-next.1",
9
+ "version": "0.2.231-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
- "clavarium-binder": "0.1.43-next.1",
14
+ "clavarium-binder": "0.1.44-next.1",
15
15
  "clavarium-docket": "0.1.1",
16
16
  "clavarium-parley": "0.17.35-next.1",
17
17
  "clavarium-tether": "0.1.0-next.46",
@@ -721,9 +721,9 @@
721
721
  }
722
722
  },
723
723
  "node_modules/clavarium-binder": {
724
- "version": "0.1.43-next.1",
725
- "resolved": "https://registry.npmjs.org/clavarium-binder/-/clavarium-binder-0.1.43-next.1.tgz",
726
- "integrity": "sha512-eCTyVw3UmGdxlqgMB1V8Ry1UYrGJtOcv+OmD8NN6D2qF5Y3FRBohjFxPuGAE+LTq4jk8MEc3q/CVLvDlpT44SQ==",
724
+ "version": "0.1.44-next.1",
725
+ "resolved": "https://registry.npmjs.org/clavarium-binder/-/clavarium-binder-0.1.44-next.1.tgz",
726
+ "integrity": "sha512-GJMZBnxneV0775Aeo2bSnKgB/QkeBjH+3oCxpdr3qX9CQgu5gMrPaRLbQdfp/Q5uZLjRScKRlxdqlFajvnqs8g==",
727
727
  "license": "MIT",
728
728
  "bin": {
729
729
  "binder": "bin/binder.mjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.229-next.1",
3
+ "version": "0.2.231-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.",
@@ -44,7 +44,7 @@
44
44
  "dependencies": {
45
45
  "@xterm/addon-fit": "^0.11.0",
46
46
  "@xterm/xterm": "^6.0.0",
47
- "clavarium-binder": "0.1.43-next.1",
47
+ "clavarium-binder": "0.1.44-next.1",
48
48
  "clavarium-docket": "0.1.1",
49
49
  "clavarium-parley": "0.17.35-next.1",
50
50
  "clavarium-tether": "0.1.0-next.46",
package/server/api.mjs CHANGED
@@ -14,6 +14,7 @@
14
14
  * POST /api/conversations/<name>/health/seen what it says now no longer calls its owner (Needs you)
15
15
  * POST /api/conversations/<name>/exit-report why its tool ended: { now (read in its machine, if it runs), last (kept at its end) }
16
16
  * POST /api/conversations/<name>/archive
17
+ * POST /api/mailboxes/<name>/live {smtp, email?}: that mailbox connected live too (send, move...), its password reused
17
18
  * POST /api/conversations/<name>/erase {confirm: <its name>}: deleted for good -- its machine and its work files
18
19
  * POST /api/conversations/<name>/rebuild {reset?, confirm?}: built again; reset (confirm: its name) for a working one too
19
20
  * POST /api/conversations/<name>/ask-first {on}: its tool asks before acting (true), or acts without asking in its machine (false, the default), from its next start
@@ -453,6 +454,14 @@ export async function handleApi(request, response, conversations, headers, resou
453
454
  if (pathname === '/api/accounts/connect' && accounts) { const made = await accounts.connect(body); return send(201, made), true; }
454
455
  if (pathname === '/api/accounts/lookup' && accounts) return send(200, await accounts.lookup(body)), true;
455
456
  if (pathname === '/api/accounts/classic' && accounts) { const made = await accounts.classic(body); return send(201, made), true; }
457
+ /* A mailbox of Assets, connected live too (send, move...): its address and password reused, server side. */
458
+ const live = /^\/api\/mailboxes\/([a-z0-9-]{1,32})\/live$/.exec(pathname);
459
+ if (live && accounts && mailboxes) {
460
+ const c = mailboxes.credentials(live[1]);
461
+ const user = String(body?.email ?? c.user).trim();
462
+ const made = await accounts.classic({ user, password: c.password, imap: `${c.host}:${c.port}`, smtp: String(body?.smtp ?? ''), kinds: ['mail'] });
463
+ return send(201, made), true;
464
+ }
456
465
  if (pathname === '/api/accounts/verify' && accounts) { const r = await accounts.verify(body); return send(200, r), true; }
457
466
  /* Assets > Access: the owner sets a conversation's level and rules on a
458
467
  target, decides a call that waited, or removes a target. Each is an op the
@@ -134,6 +134,15 @@ export class Mailboxes {
134
134
  return this.#store.all().map((m) => ({ name: m.name, host: m.host, port: m.port ?? 993, user: m.user, provider: m.provider ?? null, messages: m.messages ?? 0, syncedAt: m.syncedAt ?? null, failure: m.failure ?? null }));
135
135
  }
136
136
 
137
+ /* What a live link needs to be made from it (02-11: a mailbox of Assets given the same actions as a
138
+ connected account): server side only, never to the page. A classic one only (a password). */
139
+ credentials(name) {
140
+ const m = this.#store.get(name);
141
+ if (!m) throw new Refusal(404, 'No such mailbox.');
142
+ if (m.provider) throw new Refusal(400, 'This mailbox signs in with Google or Microsoft: connect that account in Access instead.');
143
+ return { host: m.host, port: m.port ?? 993, user: m.user, password: this.#vault.open(m.sealed) };
144
+ }
145
+
137
146
  /* Adds a mailbox after proving it can be read, as a folder of that name. */
138
147
  async add(body) {
139
148
  const name = String(body?.name ?? '');
package/web/app.js CHANGED
@@ -4646,6 +4646,35 @@
4646
4646
  const r = chosen.resource;
4647
4647
  /* State, in a line. */
4648
4648
  if (chosen.kind === 'mailbox' && !chosen.target) detail.append(el('p', chosen.box?.failure ? 'error' : 'hint', boxSub(chosen.box)));
4649
+ /* ACTIONS TOO (02-11): a mailbox copied as files is read only; the same mailbox, connected live, can
4650
+ send, reply, move, flag -- within the rights given. Made here with its address and password (they
4651
+ stay on the server); only its sending server is asked, found from the address when known. */
4652
+ if (chosen.kind === 'mailbox' && !chosen.target && chosen.box && !chosen.box.provider) {
4653
+ const live = el('div', 'as-live');
4654
+ const go = el('button', '', 'Also allow actions (send, move…)'); go.type = 'button';
4655
+ live.append(el('p', 'hint', 'Read only here. Connected live too, an agent can send, reply, move or flag its mail, each within the rights you give.'), go);
4656
+ go.addEventListener('click', async () => {
4657
+ go.hidden = true;
4658
+ const box = chosen.box; const emailLike = String(box.user ?? '').includes('@');
4659
+ const email = el('input'); email.type = 'email'; email.value = emailLike ? box.user : ''; email.placeholder = 'its email address'; email.setAttribute('aria-label', 'Email address');
4660
+ const smtp = el('input'); smtp.placeholder = 'smtp.example.com'; smtp.spellcheck = false; smtp.setAttribute('aria-label', 'Sending server (SMTP)');
4661
+ const make = el('button', 'primary', 'Connect'); make.type = 'button';
4662
+ const said = el('p', 'error'); said.hidden = true;
4663
+ const form = el('div', 'as-live-form');
4664
+ form.append(el('label', '', 'Email address'), email, el('label', '', 'Sending server (SMTP)'), smtp, make, said);
4665
+ live.append(form);
4666
+ const guess = async () => { try { const found = await post(`${API}/accounts/lookup`, { user: email.value.trim() }); if (found?.smtp && !smtp.value.trim()) smtp.value = found.smtp; } catch { /* typed by hand */ } if (!smtp.value.trim() && box.host) smtp.value = String(box.host).replace(/^imap\./, 'smtp.'); };
4667
+ if (email.value) void guess();
4668
+ email.addEventListener('change', () => void guess());
4669
+ make.addEventListener('click', async () => {
4670
+ make.disabled = true; make.textContent = 'Trying it…'; said.hidden = true;
4671
+ try { await post(`${API}/mailboxes/${encodeURIComponent(box.name)}/live`, { email: email.value.trim(), smtp: smtp.value.trim() }); void paintAssets(); }
4672
+ catch (error) { said.textContent = error.message; said.hidden = false; make.disabled = false; make.textContent = 'Connect'; }
4673
+ });
4674
+ focusField(smtp.value ? make : smtp);
4675
+ });
4676
+ detail.append(live);
4677
+ }
4649
4678
  /* A live link: what it is, and that it is associated with the same account's others. */
4650
4679
  if (chosen.target) {
4651
4680
  const t = chosen.target;
@@ -7019,7 +7048,15 @@
7019
7048
  const MAILBOX_PROVIDER = { google: 'Google', microsoft: 'Microsoft', classic: 'your host' };
7020
7049
  /* Which kinds each provider can be connected for (from the server). */
7021
7050
  let accountSupported = { google: ['mail', 'calendar', 'contacts'], microsoft: ['mail'], classic: ['mail', 'calendar', 'contacts'] };
7022
- $('mailbox-to-connexion').addEventListener('click', () => { assetsAdding = 'connexion'; void paintAssets(); });
7051
+ /* From New mailbox: the account form, on the host's kind ("Other") with what was typed here, unless it is Gmail or Microsoft. */
7052
+ $('mailbox-to-connexion').addEventListener('click', async () => {
7053
+ const user = $('mailbox-user').value.trim(); const host = $('mailbox-host').value.trim();
7054
+ assetsAdding = 'connexion'; await paintAssets();
7055
+ const big = /@(gmail|googlemail|outlook|hotmail|live)\./i.test(user) ? (/gmail|googlemail/i.test(user) ? 'google' : 'microsoft') : null;
7056
+ setConnexionProvider(big ?? 'classic');
7057
+ if (user.includes('@')) { $('connexion-email').value = user; $('connexion-email').dispatchEvent(new Event('change')); }
7058
+ if (host && !big && !$('connexion-imap').value.trim()) $('connexion-imap').value = host;
7059
+ });
7023
7060
  /* CONNECT AN ACCOUNT (Connexions): a live link through Tether. The person signs
7024
7061
  in in their own browser; the token is kept on the server, never in a machine.
7025
7062
  Both cover mail+calendar+contacts in one go, each landing on the same
package/web/index.html CHANGED
@@ -542,7 +542,7 @@
542
542
  </div>
543
543
  <div id="mailbox-box" class="as-form" data-kind="mailbox"><h3>New mailbox</h3>
544
544
  <div class="hint">A classic IMAP mailbox, its recent messages copied as files, read only. <details class="more"><summary>Before attaching it</summary><span>Kept up to date in a folder a conversation can read and never write. The mailbox itself is never changed. Mail is written by strangers: attach it only where the tool may read what anyone can send you.</span></details></div>
545
- <p class="hint mailbox-to-cnx">Gmail or Microsoft? Connect a live link instead — the agent reads and writes within the rights you give, and the account's token stays on the server. <button type="button" id="mailbox-to-connexion" class="as-link">Add a connexion</button></p>
545
+ <p class="hint mailbox-to-cnx">To send, reply or move mail too, connect it live instead — any mailbox: Gmail, Microsoft, or your host's (OVH, Infomaniak…). The agent then acts within the rights you give. <button type="button" id="mailbox-to-connexion" class="as-link">Connect it live</button></p>
546
546
  <form id="mailbox-new" autocomplete="off" data-provider="imap">
547
547
  <label for="mailbox-name">Folder name</label>
548
548
  <input id="mailbox-name" maxlength="32" pattern="[a-z]([a-z0-9-]{0,30}[a-z0-9])?" placeholder="inbox" spellcheck="false" autocapitalize="off" required>
package/web/style.css CHANGED
@@ -2103,3 +2103,9 @@ body.as-dragging #assets-rows .as-row { touch-action: none; }
2103
2103
  .sure { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
2104
2104
  .sure label { flex: 1 1 100%; color: var(--ink2); }
2105
2105
  .sure input { flex: 1 1 12em; min-width: 0; }
2106
+
2107
+ /* A mailbox of Assets, given actions too: its small form. */
2108
+ .as-live { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; }
2109
+ .as-live > button { align-self: flex-start; }
2110
+ .as-live-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; max-width: 28rem; }
2111
+ .as-live-form > button { justify-self: start; margin-top: 4px; }