clavarium 0.2.509-next.1 → 0.2.510-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 +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/server/conversations.mjs +9 -1
package/config/tools.json
CHANGED
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.510-next.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "clavarium",
|
|
9
|
-
"version": "0.2.
|
|
9
|
+
"version": "0.2.510-next.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/package.json
CHANGED
package/server/conversations.mjs
CHANGED
|
@@ -1055,13 +1055,20 @@ export class Conversations {
|
|
|
1055
1055
|
async #installFor(name, tool, act) {
|
|
1056
1056
|
act.ctl = new AbortController();
|
|
1057
1057
|
const run = (argv, options = {}) => this.#vms.exec(name, argv, { ...options, signal: act.ctl.signal });
|
|
1058
|
-
|
|
1058
|
+
/* AN INSTALL CUT OFF (22-11, seen on a real machine: forced off in the middle, its program left EMPTY, which
|
|
1059
|
+
starts and exits at once): marked while it runs, written to disk before the mark goes. Marked or empty: not there. */
|
|
1060
|
+
const mark = `.clavarium-installing-${tool.id}`;
|
|
1061
|
+
const present = async () => (await run(['sh', '-c', 'command -v "$1" >/dev/null && [ -s "$(readlink -f "$(command -v "$1")")" ] && [ ! -e "$HOME/$2" ]', 'probe', tool.command[0], mark])).code === 0;
|
|
1059
1062
|
let steps = tool.steps;
|
|
1060
1063
|
if (tool.steps.length === 0 || await present()) {
|
|
1061
1064
|
const r = await run(['sh', '-c', 'for p in "$@"; do [ -e "$HOME/$p" ] && exit 0; done; exit 3', 'probe', ...tool.state.keep]);
|
|
1062
1065
|
if (r.code !== 0 && r.code !== 3) return `its machine could not be read (${firstLine(r.stderr) || `exit ${r.code}`})`;
|
|
1063
1066
|
steps = r.code === 0 ? [] : tool.steps.filter((s) => s.argv[0] !== 'sudo');
|
|
1064
1067
|
}
|
|
1068
|
+
if (steps.length > 0) {
|
|
1069
|
+
const r = await run(['sh', '-c', 'touch "$HOME/$1" && sync', 'probe', mark]);
|
|
1070
|
+
if (r.code !== 0) return `its machine could not be written (${firstLine(r.stderr) || `exit ${r.code}`})`;
|
|
1071
|
+
}
|
|
1065
1072
|
for (const [i, step] of steps.entries()) {
|
|
1066
1073
|
if (!this.#store.get(name)) return 'it was archived';
|
|
1067
1074
|
if (act.preempted) return 'its machine was forced off';
|
|
@@ -1071,6 +1078,7 @@ export class Conversations {
|
|
|
1071
1078
|
if (r.code !== 0) return `installing ${tool.label} failed at step ${i + 1}: ${firstLine(r.stderr) || firstLine(r.stdout) || `exit ${r.code}`}`;
|
|
1072
1079
|
}
|
|
1073
1080
|
if (act.preempted) return 'its machine was forced off';
|
|
1081
|
+
if (steps.length > 0) await run(['sh', '-c', 'sync; rm -f "$HOME/$1"; sync', 'probe', mark]);
|
|
1074
1082
|
if (steps.length > 0 && !(await present())) return `${tool.label} is not there after its install`;
|
|
1075
1083
|
return undefined;
|
|
1076
1084
|
}
|