clavarium 0.2.421-next.1 → 0.2.423-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.
package/config/tools.json CHANGED
@@ -46,13 +46,17 @@
46
46
  "@anthropic-ai/claude-code"
47
47
  ],
48
48
  "npm-writable",
49
+ [
50
+ "install",
51
+ "-D",
52
+ "-m",
53
+ "0600",
54
+ "/dev/null",
55
+ ".claude/settings.json"
56
+ ],
49
57
  {
50
58
  "argv": [
51
- "install",
52
- "-D",
53
- "-m",
54
- "0600",
55
- "/dev/stdin",
59
+ "tee",
56
60
  ".claude/settings.json"
57
61
  ],
58
62
  "input": "{\n \"theme\": \"dark-ansi\",\n \"permissions\": {\n \"allow\": [\n \"Bash(parley:*)\"\n ]\n }\n}\n"
@@ -137,13 +141,17 @@
137
141
  "@anthropic-ai/claude-code"
138
142
  ],
139
143
  "npm-writable",
144
+ [
145
+ "install",
146
+ "-D",
147
+ "-m",
148
+ "0600",
149
+ "/dev/null",
150
+ ".claude/settings.json"
151
+ ],
140
152
  {
141
153
  "argv": [
142
- "install",
143
- "-D",
144
- "-m",
145
- "0600",
146
- "/dev/stdin",
154
+ "tee",
147
155
  ".claude/settings.json"
148
156
  ],
149
157
  "input": "{\n \"theme\": \"dark-ansi\",\n \"permissions\": {\n \"allow\": [\n \"Bash(parley:*)\"\n ]\n }\n}\n"
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.421-next.1",
3
+ "version": "0.2.423-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.421-next.1",
9
+ "version": "0.2.423-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.421-next.1",
3
+ "version": "0.2.423-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.",
@@ -462,10 +462,14 @@ export class Conversations {
462
462
  const sharing = await this.#vms.execMachine(name, [...SHARING_STEP], { timeoutMs: STEP_MS });
463
463
  if (sharing.code !== 0) return fail('The shared machine could not be prepared for shared folders', sharing);
464
464
  } else if (state !== 'Running') {
465
+ this.#store.patch(name, { step: `Starting the shared machine ${c.sharedMachine}` });
465
466
  const started = await this.#vms.start(name);
466
467
  if (started.code !== 0) return fail('The shared machine did not start', started);
467
468
  }
468
- /* Its door, always the one of this version (put again: an older one is replaced). */
469
+ /* Its door, always the one of this version (put again: an older one is replaced). The page's steps follow
470
+ (preparing, installing): a new shared machine takes minutes, never one frozen "Starting". */
471
+ this.#reach(name, 'preparing');
472
+ this.#store.patch(name, { step: `Opening its door in the shared machine ${c.sharedMachine}` });
469
473
  const door = await this.#vms.execMachine(name, ['sudo', '-n', 'install', '-m', '0755', '-o', 'root', '-g', 'root', '/dev/stdin', '/usr/local/sbin/clavarium-enter'], { input: readFileSync(DOOR, 'utf8'), timeoutMs: STEP_MS });
470
474
  if (door.code !== 0) return fail('The door of the shared machine could not be put in place', door);
471
475
  this.#store.patch(name, { step: 'Making its place in the shared machine' });
@@ -486,9 +490,13 @@ export class Conversations {
486
490
  /* Its tool: there already (another conversation installed it), or installed -- a step as root for the
487
491
  machine, any other as its own user (its settings, in its home). */
488
492
  const there = tool.steps.length === 0 || (await this.#vms.exec(name, ['sh', '-c', `command -v ${tool.command[0]}`])).code === 0;
489
- for (const [i, step] of (there ? [] : tool.steps).entries()) {
493
+ /* There already: its own steps still (its settings, in its own home), the machine's not. */
494
+ const steps = there ? tool.steps.filter((s) => s.argv[0] !== 'sudo') : tool.steps;
495
+ this.#reach(name, 'installing', there ? 'came' : undefined);
496
+ for (const [i, step] of steps.entries()) {
490
497
  if (!this.#store.get(name)) return undefined;
491
- this.#store.patch(name, { step: `Installing ${tool.label} (${i + 1}/${tool.steps.length})` });
498
+ this.#store.patch(name, { step: `Installing ${tool.label} (${i + 1}/${steps.length})` });
499
+ this.#reach(name, 'installing', `${i + 1}/${steps.length}`);
492
500
  const r = await this.#vms.exec(name, step.argv, { input: step.input, timeoutMs: STEP_MS });
493
501
  if (r.code !== 0) return fail(`Installing ${tool.label} failed at step ${i + 1}`, r);
494
502
  }
@@ -939,7 +947,10 @@ export class Conversations {
939
947
  + 'ex=""; for a in $2; do ex="$ex --exclude=./$a"; done; ks=""; for a in $3; do if [ -e "$HOME/$a" ]; then ks="$ks ./$a"; fi; done; '
940
948
  + 'tar -czf - -C "$m" clavarium-conversation.json -C "$HOME" $ex $ks; rm -rf "$m"';
941
949
  const argv = this.#vms.execArgv(name, ['sh', '-c', script, 'export', manifest, tool.state.skip.join(' '), tool.state.keep.join(' ')]);
942
- const child = spawn(argv[0], argv.slice(1), { stdio: ['ignore', 'pipe', 'ignore'] });
950
+ const child = spawn(argv[0], argv.slice(1), { stdio: ['ignore', 'pipe', 'pipe'] });
951
+ /* What it said when it failed: kept short, for the message that says why (a copy, a move). */
952
+ child.said = '';
953
+ child.stderr.on('data', (d) => { child.said = (child.said + d).slice(-2000); });
943
954
  return { name: `${name}-${new Date().toISOString().slice(0, 10)}.clavarium.tar.gz`, stream: child.stdout, child };
944
955
  }
945
956
 
@@ -1025,14 +1036,23 @@ export class Conversations {
1025
1036
  const started = await this.#vms.start(from);
1026
1037
  if (started.code !== 0) throw new Error(`its original's machine did not start: ${firstLine(started.stderr) || `exit ${started.code}`}.`);
1027
1038
  woke = true;
1039
+ /* Started is not yet reachable: its commands wait for it, two minutes at most. */
1040
+ for (let i = 0; i < 24 && (await this.#vms.exec(from, ['true'], { timeoutMs: 20_000 }).catch(() => ({ code: 1 }))).code !== 0; i++) await new Promise((ok) => setTimeout(ok, 5000));
1028
1041
  }
1029
- const { stream, child } = await this.exportState(from);
1030
- const failed = new Promise((ok) => child.on('error', () => ok(-1)));
1031
- const file = createWriteStream(carried, { mode: 0o600 });
1032
- stream.pipe(file);
1033
- const code = await Promise.race([new Promise((ok) => child.on('close', ok)), failed]);
1034
- await new Promise((ok) => (file.writableFinished ? ok() : file.on('finish', ok)));
1035
- if (code !== 0) throw new Error(`its tool's memory could not be read (exit ${code}).`);
1042
+ /* Read once more if the VM manager could not reach it (255): a machine just woken may still be settling. */
1043
+ let code; let child;
1044
+ for (let attempt = 0; attempt < 2 && code !== 0; attempt++) {
1045
+ if (attempt) await new Promise((ok) => setTimeout(ok, 10_000));
1046
+ const out = await this.exportState(from);
1047
+ child = out.child;
1048
+ const failed = new Promise((ok) => child.on('error', () => ok(-1)));
1049
+ const file = createWriteStream(carried, { mode: 0o600 });
1050
+ out.stream.pipe(file);
1051
+ code = await Promise.race([new Promise((ok) => child.on('close', ok)), failed]);
1052
+ await new Promise((ok) => (file.writableFinished ? ok() : file.on('finish', ok)));
1053
+ if (code !== 255) break;
1054
+ }
1055
+ if (code !== 0) throw new Error(`its tool's memory could not be read (exit ${code}${firstLine(child.said) ? `: ${firstLine(child.said)}` : ''}).`);
1036
1056
  if ((await this.#vms.state(to, { fresh: true }).catch(() => undefined)) !== 'Running') {
1037
1057
  const started = await this.#vms.start(to);
1038
1058
  if (started.code !== 0) throw new Error(`its machine did not start: ${firstLine(started.stderr) || `exit ${started.code}`}.`);
@@ -1108,7 +1128,7 @@ export class Conversations {
1108
1128
  stream.pipe(file);
1109
1129
  const code = await Promise.race([new Promise((ok) => child.on('close', ok)), failed]);
1110
1130
  await new Promise((ok) => (file.writableFinished ? ok() : file.on('finish', ok)));
1111
- if (code !== 0) return back(`its tool's state could not be taken (exit ${code}).`);
1131
+ if (code !== 0) return back(`its tool's state could not be taken (exit ${code}${firstLine(child.said) ? `: ${firstLine(child.said)}` : ''}).`);
1112
1132
  }
1113
1133
  if (state !== undefined) {
1114
1134
  this.#store.patch(name, { step: 'Stopping its own machine' });
package/web/style.css CHANGED
@@ -3049,3 +3049,11 @@ button.kit-switch[aria-checked="true"]::after { left: 18px; background: var(--ok
3049
3049
  .list-item.machine-item > .set-what > small.status-line { font-size: .75rem; margin: 0; }
3050
3050
  #manager-row .status-line { margin: 2px 0 0; font-size: .75rem; }
3051
3051
  #machines-confirm { margin: 8px 16px; }
3052
+ /* A phone (13-11): the bar's five buttons tighter, so that all stay on the screen -- its name gives way, never the bar. */
3053
+ @media (max-width: 480px) {
3054
+ html:not([data-door="device"]) #room > header #name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
3055
+ html:not([data-door="device"]) #room > header :is(.bar-right, .views) { flex: none; }
3056
+ html:not([data-door="device"]) #room > header .views { gap: 0; padding: 2px; }
3057
+ html:not([data-door="device"]) #room > header .views button { gap: 4px; padding-inline: 7px; }
3058
+ html:not([data-door="device"]) #room > header .views .count { min-width: 1.2em; padding: 1px 4px; }
3059
+ }