clavarium 0.2.401-next.1 → 0.2.402-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.401-next.1",
3
+ "version": "0.2.402-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.401-next.1",
9
+ "version": "0.2.402-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.401-next.1",
3
+ "version": "0.2.402-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.",
@@ -159,6 +159,7 @@ export const SETTINGS_WORDS_FR = {
159
159
  'set-na-k-mcp': 'Serveur MCP', 'set-cx-mcp': 'serveur MCP',
160
160
  'set-mcp-head': 'Ajouter un serveur MCP', 'set-mcp-hint': 'Ses outils pour vos IA ; la clé reste ici.',
161
161
  'set-mcp-name': 'Nom', 'set-mcp-url': 'Adresse', 'set-mcp-key': 'Clé', 'set-mcp-add': 'Ajouter',
162
+ 'set-mshared-with': 'Partagée « {m} », avec {others}.', 'set-mshared-alone': 'Machine partagée « {m} », seule pour l\'instant.',
162
163
  'set-carry': 'La mémoire de son outil', 'set-carry-hint': 'Mémoire, sessions, réglages : à emporter.',
163
164
  'set-carry-export': 'Exporter', 'set-carry-import': 'Importer…', 'set-carry-go': 'Importer',
164
165
  'set-carry-ask': '« {file} » dans « {name} » ? Mémoire remplacée.', 'set-carry-done': 'Importé depuis « {from} ».',
package/web/app.js CHANGED
@@ -1987,7 +1987,7 @@
1987
1987
  let chosenTool = '';
1988
1988
  let newTools = [];
1989
1989
  const ID_SHAPE = /^[a-z]([a-z0-9-]{0,30}[a-z0-9])?$/;
1990
- const NEW_FIELDS = ['name', 'group', 'id', 'memory'];
1990
+ const NEW_FIELDS = ['name', 'group', 'id', 'memory', 'machine'];
1991
1991
  function newError(field, text) {
1992
1992
  const at = field && NEW_FIELDS.includes(field) ? field : '';
1993
1993
  for (const f of NEW_FIELDS) {
@@ -2101,6 +2101,20 @@
2101
2101
  b.addEventListener('click', () => { for (const other of $('newconv-work').querySelectorAll('[data-work]')) other.setAttribute('aria-checked', String(other === b)); });
2102
2102
  }
2103
2103
  const newOnDisk = () => $('newconv-work').querySelector('[data-work="disk"]').getAttribute('aria-checked') === 'true';
2104
+ /* WHERE IT LIVES (#221): its own machine, or a shared one -- an existing one offered, or a new name. In a shared
2105
+ machine its files are always kept here: that choice is hidden. */
2106
+ const newShared = () => $('newconv-where').querySelector('[data-where="shared"]').getAttribute('aria-checked') === 'true';
2107
+ const paintWhere = () => {
2108
+ const shared = newShared();
2109
+ $('newconv-machine-row').hidden = !shared;
2110
+ $('newconv-files-card').hidden = shared;
2111
+ const names = [...new Set(conversations.map((c) => c.sharedMachine).filter(Boolean))].sort();
2112
+ $('machine-names').replaceChildren(...names.map((n) => Object.assign(document.createElement('option'), { value: n })));
2113
+ if (shared && !$('newconv-machine').value && names.length) $('newconv-machine').value = names[0];
2114
+ };
2115
+ for (const b of $('newconv-where').querySelectorAll('[data-where]')) {
2116
+ b.addEventListener('click', () => { for (const other of $('newconv-where').querySelectorAll('[data-where]')) other.setAttribute('aria-checked', String(other === b)); paintWhere(); });
2117
+ }
2104
2118
  async function openNew({ push = true, group = null } = {}) {
2105
2119
  if (DEVICE) return;
2106
2120
  newError('', '');
@@ -2149,6 +2163,7 @@
2149
2163
  const group = $('newconv-group').value.trim();
2150
2164
  if (!title) { newError('name', 'Give a name.'); return; }
2151
2165
  if (id && !ID_SHAPE.test(id)) { newError('id', 'Lower-case letters, digits, hyphens'); return; }
2166
+ if (newShared() && !ID_SHAPE.test($('newconv-machine').value.trim())) { newError('machine', 'A name: lower-case letters, digits, hyphens'); return; }
2152
2167
  const least = newTools.find((t) => t.id === chosenTool)?.memoryMb;
2153
2168
  const memoryMb = Number($('newconv-memory').value);
2154
2169
  const cpus = Number($('newconv-cpus').value); const diskGb = Number($('newconv-disk').value);
@@ -2156,9 +2171,9 @@
2156
2171
  creating = true; $('newconv-create').disabled = true;
2157
2172
  try {
2158
2173
  const opencode = await openCodeChoice();
2159
- const made = await post(`${API}/conversations`, { ...(opencode ? { opencode } : {}), title, ...(id ? { name: id } : {}), ...(group ? { group } : {}), tool: chosenTool, workOnDisk: newOnDisk(), ...(document.getElementById('newconv-chat')?.checked === false ? { chat: false } : {}), ...(memoryMb && memoryMb !== least ? { memoryMb } : {}), ...(cpus && cpus !== 1 ? { cpus } : {}), ...(diskGb && diskGb !== 8 ? { diskGb } : {}) });
2174
+ const made = await post(`${API}/conversations`, { ...(opencode ? { opencode } : {}), title, ...(id ? { name: id } : {}), ...(group ? { group } : {}), tool: chosenTool, workOnDisk: newShared() ? false : newOnDisk(), ...(newShared() ? { machine: $('newconv-machine').value.trim() } : {}), ...(document.getElementById('newconv-chat')?.checked === false ? { chat: false } : {}), ...(memoryMb && memoryMb !== least ? { memoryMb } : {}), ...(cpus && cpus !== 1 ? { cpus } : {}), ...(diskGb && diskGb !== 8 ? { diskGb } : {}) });
2160
2175
  $('newconv-name').value = ''; $('newconv-id').value = ''; $('newconv-id').placeholder = 'website-redesign'; $('newconv-group').value = '';
2161
- $('newconv-work').querySelector('[data-work="kept"]').click(); $('newconv-more').open = false; { const ch = document.getElementById('newconv-chat'); if (ch) ch.checked = true; }
2176
+ $('newconv-work').querySelector('[data-work="kept"]').click(); $('newconv-where').querySelector('[data-where="own"]').click(); $('newconv-machine').value = ''; $('newconv-more').open = false; { const ch = document.getElementById('newconv-chat'); if (ch) ch.checked = true; }
2162
2177
  await refresh();
2163
2178
  /* The new one is selected: the page gives way to it, with no step of it left behind. */
2164
2179
  select(made.name);
@@ -2574,6 +2589,15 @@
2574
2589
  catch (error) { show(error.message, 'Back to the terminal', enter); }
2575
2590
  }, () => { notice.hidden = true; focusTerminal(); });
2576
2591
  };
2592
+ /* In a shared machine (#221): its name and the others in it, said once -- stopping it stops them too. */
2593
+ const sharedIn = here?.sharedMachine;
2594
+ $('machine-shared').hidden = DEVICE || !sharedIn;
2595
+ if (sharedIn) {
2596
+ const others = conversations.filter((c) => c.sharedMachine === sharedIn && c.name !== current).map((c) => c.title ?? c.name);
2597
+ $('machine-shared').textContent = others.length
2598
+ ? uiSaid('set-mshared-with', 'Shared machine « {m} », with {others}. Stopping it stops them too.', { m: sharedIn, others: others.join(', ') })
2599
+ : uiSaid('set-mshared-alone', 'Shared machine « {m} », alone in it for now.', { m: sharedIn });
2600
+ }
2577
2601
  /* Its tool's memory, exported as one file, or put back from one (#351): the person's own act, from here. */
2578
2602
  $('carry-box').hidden = DEVICE || !here;
2579
2603
  $('carry-export').href = `${API}/conversations/${encodeURIComponent(current)}/export`;
package/web/index.html CHANGED
@@ -203,6 +203,8 @@
203
203
  <div class="curves-head"><b>Over time</b><div class="levels curves-span" role="group" aria-label="Over"><button type="button" data-span="1h" aria-pressed="true">1 h</button><button type="button" data-span="24h" aria-pressed="false">24 h</button><button type="button" data-span="7d" aria-pressed="false">7 days</button></div></div>
204
204
  <div class="curves-row"></div>
205
205
  </div>
206
+ <!-- IN A SHARED MACHINE (#221): which, and who else lives in it -- its stop or restart stops them too. -->
207
+ <p id="machine-shared" class="hint machine-shared" hidden></p>
206
208
  <p id="machine-restarted" class="hint" role="status" hidden></p>
207
209
  <div id="resume-box" hidden>
208
210
  <div class="set-row"><div class="set-what"><b>When its tool starts</b><small id="resume-hint">After a wake or restart</small></div><div class="set-control"><div class="levels" id="resume-on" role="group" aria-label="When its tool starts"><button type="button" data-on="true">Resume its last session</button><button type="button" data-on="false">Start fresh</button></div></div></div>
@@ -1432,7 +1434,16 @@
1432
1434
  </div>
1433
1435
  <small id="newconv-oc-raw" class="hint" hidden>Set it up yourself in its terminal.</small>
1434
1436
  </div>
1435
- <div class="nc-card">
1437
+ <!-- WHERE IT LIVES (#221): a machine of its own, or a shared one (lighter, for assistants). -->
1438
+ <div class="nc-card" id="newconv-where-card">
1439
+ <span class="sub-head">Where it lives</span>
1440
+ <div id="newconv-where" class="pick two" role="radiogroup" aria-label="Where it lives">
1441
+ <button type="button" role="radio" data-where="own" aria-checked="true"><b>Its own machine</b><small>All to itself</small></button>
1442
+ <button type="button" role="radio" data-where="shared" aria-checked="false"><b>A shared machine</b><small>Lighter. For assistants</small></button>
1443
+ </div>
1444
+ <div class="set-row" id="newconv-machine-row" hidden><div class="set-what"><label for="newconv-machine">Machine</label><small>An existing one, or a new name</small><span id="newconv-machine-error" class="err" role="alert" hidden></span></div><div class="set-control"><input id="newconv-machine" maxlength="32" list="machine-names" placeholder="assistants" spellcheck="false" autocapitalize="off" autocomplete="off"><datalist id="machine-names"></datalist></div></div>
1445
+ </div>
1446
+ <div class="nc-card" id="newconv-files-card">
1436
1447
  <span class="sub-head">Its files</span>
1437
1448
  <div id="newconv-work" class="pick two" role="radiogroup" aria-label="Its files">
1438
1449
  <button type="button" role="radio" data-work="kept" aria-checked="true"><b>Kept here</b><small>Seen in Files. Outlives the machine</small></button>