@chrysb/alphaclaw 0.8.7-beta.3 → 0.8.7-beta.4
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.
|
@@ -7,6 +7,7 @@ const {
|
|
|
7
7
|
computePackageFingerprint,
|
|
8
8
|
isPackageRootSymlink,
|
|
9
9
|
packLocalPackageForInstall,
|
|
10
|
+
seedRuntimeFromBundledInstall,
|
|
10
11
|
} = require("./package-fingerprint");
|
|
11
12
|
|
|
12
13
|
const getManagedAlphaclawRuntimeDir = ({ rootDir = kRootDir } = {}) =>
|
|
@@ -141,6 +142,37 @@ const installManagedAlphaclawRuntime = ({
|
|
|
141
142
|
};
|
|
142
143
|
};
|
|
143
144
|
|
|
145
|
+
const seedManagedAlphaclawRuntimeFromBundledInstall = ({
|
|
146
|
+
fsModule = fs,
|
|
147
|
+
logger = console,
|
|
148
|
+
runtimeDir,
|
|
149
|
+
packageRoot,
|
|
150
|
+
} = {}) => {
|
|
151
|
+
const seedResult = seedRuntimeFromBundledInstall({
|
|
152
|
+
fsModule,
|
|
153
|
+
packageRoot,
|
|
154
|
+
runtimeDir,
|
|
155
|
+
runtimePackageJson: {
|
|
156
|
+
name: "alphaclaw-runtime",
|
|
157
|
+
private: true,
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
if (!seedResult.seeded) {
|
|
161
|
+
return {
|
|
162
|
+
seeded: false,
|
|
163
|
+
version: null,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
logger.log("[alphaclaw] Seeded managed AlphaClaw runtime from bundled node_modules");
|
|
167
|
+
return {
|
|
168
|
+
seeded: true,
|
|
169
|
+
version: readManagedAlphaclawRuntimeVersion({
|
|
170
|
+
fsModule,
|
|
171
|
+
runtimeDir,
|
|
172
|
+
}),
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
|
|
144
176
|
const syncManagedAlphaclawRuntimeWithBundled = ({
|
|
145
177
|
execSyncImpl,
|
|
146
178
|
fsModule = fs,
|
|
@@ -210,6 +242,29 @@ const syncManagedAlphaclawRuntimeWithBundled = ({
|
|
|
210
242
|
);
|
|
211
243
|
}
|
|
212
244
|
|
|
245
|
+
if (!runtimeVersion) {
|
|
246
|
+
try {
|
|
247
|
+
const seedResult = seedManagedAlphaclawRuntimeFromBundledInstall({
|
|
248
|
+
fsModule,
|
|
249
|
+
logger,
|
|
250
|
+
runtimeDir,
|
|
251
|
+
packageRoot,
|
|
252
|
+
});
|
|
253
|
+
if (seedResult.seeded) {
|
|
254
|
+
return {
|
|
255
|
+
checked: true,
|
|
256
|
+
synced: true,
|
|
257
|
+
bundledVersion,
|
|
258
|
+
runtimeVersion: seedResult.version || bundledVersion,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
} catch (error) {
|
|
262
|
+
logger.log(
|
|
263
|
+
`[alphaclaw] Could not seed managed AlphaClaw runtime from bundled node_modules: ${error.message}`,
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
213
268
|
const installResult = installManagedAlphaclawRuntime({
|
|
214
269
|
execSyncImpl,
|
|
215
270
|
fsModule,
|
|
@@ -234,5 +289,6 @@ module.exports = {
|
|
|
234
289
|
installManagedAlphaclawRuntime,
|
|
235
290
|
readBundledAlphaclawVersion,
|
|
236
291
|
readManagedAlphaclawRuntimeVersion,
|
|
292
|
+
seedManagedAlphaclawRuntimeFromBundledInstall,
|
|
237
293
|
syncManagedAlphaclawRuntimeWithBundled,
|
|
238
294
|
};
|
|
@@ -11,6 +11,7 @@ const {
|
|
|
11
11
|
isPackageRootSymlink,
|
|
12
12
|
packLocalPackageForInstall,
|
|
13
13
|
resolvePackageRootFromEntryPath,
|
|
14
|
+
seedRuntimeFromBundledInstall,
|
|
14
15
|
} = require("./package-fingerprint");
|
|
15
16
|
|
|
16
17
|
const getManagedOpenclawRuntimeDir = ({ rootDir = kRootDir } = {}) =>
|
|
@@ -215,6 +216,48 @@ const installManagedOpenclawRuntime = ({
|
|
|
215
216
|
};
|
|
216
217
|
};
|
|
217
218
|
|
|
219
|
+
const seedManagedOpenclawRuntimeFromBundledInstall = ({
|
|
220
|
+
execSyncImpl,
|
|
221
|
+
fsModule = fs,
|
|
222
|
+
logger = console,
|
|
223
|
+
runtimeDir,
|
|
224
|
+
bundledPackageRoot,
|
|
225
|
+
alphaclawRoot,
|
|
226
|
+
} = {}) => {
|
|
227
|
+
const seedResult = seedRuntimeFromBundledInstall({
|
|
228
|
+
fsModule,
|
|
229
|
+
packageRoot: bundledPackageRoot,
|
|
230
|
+
runtimeDir,
|
|
231
|
+
runtimePackageJson: {
|
|
232
|
+
name: "alphaclaw-openclaw-runtime",
|
|
233
|
+
private: true,
|
|
234
|
+
},
|
|
235
|
+
});
|
|
236
|
+
if (!seedResult.seeded) {
|
|
237
|
+
return {
|
|
238
|
+
seeded: false,
|
|
239
|
+
version: null,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
const installedVersion = readManagedOpenclawRuntimeVersion({
|
|
243
|
+
fsModule,
|
|
244
|
+
runtimeDir,
|
|
245
|
+
});
|
|
246
|
+
applyManagedOpenclawPatch({
|
|
247
|
+
execSyncImpl,
|
|
248
|
+
fsModule,
|
|
249
|
+
logger,
|
|
250
|
+
runtimeDir,
|
|
251
|
+
version: installedVersion,
|
|
252
|
+
alphaclawRoot,
|
|
253
|
+
});
|
|
254
|
+
logger.log("[alphaclaw] Seeded managed OpenClaw runtime from bundled node_modules");
|
|
255
|
+
return {
|
|
256
|
+
seeded: true,
|
|
257
|
+
version: installedVersion,
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
|
|
218
261
|
const syncManagedOpenclawRuntimeWithBundled = ({
|
|
219
262
|
execSyncImpl,
|
|
220
263
|
fsModule = fs,
|
|
@@ -284,6 +327,31 @@ const syncManagedOpenclawRuntimeWithBundled = ({
|
|
|
284
327
|
);
|
|
285
328
|
}
|
|
286
329
|
|
|
330
|
+
if (!runtimeVersion) {
|
|
331
|
+
try {
|
|
332
|
+
const seedResult = seedManagedOpenclawRuntimeFromBundledInstall({
|
|
333
|
+
execSyncImpl,
|
|
334
|
+
fsModule,
|
|
335
|
+
logger,
|
|
336
|
+
runtimeDir,
|
|
337
|
+
bundledPackageRoot,
|
|
338
|
+
alphaclawRoot,
|
|
339
|
+
});
|
|
340
|
+
if (seedResult.seeded) {
|
|
341
|
+
return {
|
|
342
|
+
checked: true,
|
|
343
|
+
synced: true,
|
|
344
|
+
bundledVersion,
|
|
345
|
+
runtimeVersion: seedResult.version || bundledVersion,
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
} catch (error) {
|
|
349
|
+
logger.log(
|
|
350
|
+
`[alphaclaw] Could not seed managed OpenClaw runtime from bundled node_modules: ${error.message}`,
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
287
355
|
const installResult = installManagedOpenclawRuntime({
|
|
288
356
|
execSyncImpl,
|
|
289
357
|
fsModule,
|
|
@@ -334,5 +402,6 @@ module.exports = {
|
|
|
334
402
|
prependManagedOpenclawBinToPath,
|
|
335
403
|
readBundledOpenclawVersion,
|
|
336
404
|
readManagedOpenclawRuntimeVersion,
|
|
405
|
+
seedManagedOpenclawRuntimeFromBundledInstall,
|
|
337
406
|
syncManagedOpenclawRuntimeWithBundled,
|
|
338
407
|
};
|
|
@@ -142,6 +142,76 @@ const resolvePackageRootFromEntryPath = ({
|
|
|
142
142
|
return null;
|
|
143
143
|
};
|
|
144
144
|
|
|
145
|
+
const resolveInstallRootFromPackageRoot = ({ packageRoot } = {}) => {
|
|
146
|
+
const resolvedPackageRoot = path.resolve(String(packageRoot || ""));
|
|
147
|
+
if (!resolvedPackageRoot) return "";
|
|
148
|
+
const nodeModulesSegment = `${path.sep}node_modules${path.sep}`;
|
|
149
|
+
const nodeModulesIndex = resolvedPackageRoot.lastIndexOf(nodeModulesSegment);
|
|
150
|
+
if (nodeModulesIndex < 0) {
|
|
151
|
+
return resolvedPackageRoot;
|
|
152
|
+
}
|
|
153
|
+
return resolvedPackageRoot.slice(0, nodeModulesIndex);
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const seedRuntimeFromBundledInstall = ({
|
|
157
|
+
fsModule = fs,
|
|
158
|
+
packageRoot,
|
|
159
|
+
runtimeDir,
|
|
160
|
+
runtimePackageJson,
|
|
161
|
+
} = {}) => {
|
|
162
|
+
const installRoot = resolveInstallRootFromPackageRoot({ packageRoot });
|
|
163
|
+
const bundledNodeModulesPath = path.join(installRoot, "node_modules");
|
|
164
|
+
if (!installRoot || !fsModule.existsSync(bundledNodeModulesPath)) {
|
|
165
|
+
return {
|
|
166
|
+
seeded: false,
|
|
167
|
+
installRoot,
|
|
168
|
+
bundledNodeModulesPath,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const resolvedRuntimeDir = path.resolve(String(runtimeDir || ""));
|
|
173
|
+
const runtimeParentDir = path.dirname(resolvedRuntimeDir);
|
|
174
|
+
fsModule.mkdirSync(runtimeParentDir, { recursive: true });
|
|
175
|
+
const tempRuntimeDir = fsModule.mkdtempSync(
|
|
176
|
+
path.join(runtimeParentDir, `${path.basename(resolvedRuntimeDir)}-seed-`),
|
|
177
|
+
);
|
|
178
|
+
let seeded = false;
|
|
179
|
+
try {
|
|
180
|
+
if (runtimePackageJson) {
|
|
181
|
+
fsModule.writeFileSync(
|
|
182
|
+
path.join(tempRuntimeDir, "package.json"),
|
|
183
|
+
JSON.stringify(runtimePackageJson, null, 2),
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
fsModule.cpSync(
|
|
187
|
+
bundledNodeModulesPath,
|
|
188
|
+
path.join(tempRuntimeDir, "node_modules"),
|
|
189
|
+
{
|
|
190
|
+
recursive: true,
|
|
191
|
+
dereference: true,
|
|
192
|
+
preserveTimestamps: true,
|
|
193
|
+
},
|
|
194
|
+
);
|
|
195
|
+
try {
|
|
196
|
+
fsModule.rmSync(resolvedRuntimeDir, { recursive: true, force: true });
|
|
197
|
+
} catch {}
|
|
198
|
+
fsModule.renameSync(tempRuntimeDir, resolvedRuntimeDir);
|
|
199
|
+
seeded = true;
|
|
200
|
+
return {
|
|
201
|
+
seeded: true,
|
|
202
|
+
installRoot,
|
|
203
|
+
bundledNodeModulesPath,
|
|
204
|
+
runtimeDir: resolvedRuntimeDir,
|
|
205
|
+
};
|
|
206
|
+
} finally {
|
|
207
|
+
if (!seeded) {
|
|
208
|
+
try {
|
|
209
|
+
fsModule.rmSync(tempRuntimeDir, { recursive: true, force: true });
|
|
210
|
+
} catch {}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
|
|
145
215
|
const packLocalPackageForInstall = ({
|
|
146
216
|
execSyncImpl,
|
|
147
217
|
fsModule = fs,
|
|
@@ -198,5 +268,7 @@ module.exports = {
|
|
|
198
268
|
computePackageFingerprint,
|
|
199
269
|
isPackageRootSymlink,
|
|
200
270
|
packLocalPackageForInstall,
|
|
271
|
+
resolveInstallRootFromPackageRoot,
|
|
201
272
|
resolvePackageRootFromEntryPath,
|
|
273
|
+
seedRuntimeFromBundledInstall,
|
|
202
274
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
|
|
1
3
|
const {
|
|
2
4
|
installManagedAlphaclawRuntime,
|
|
3
5
|
} = require("./alphaclaw-runtime");
|
|
@@ -36,13 +38,23 @@ const applyPendingAlphaclawUpdate = ({
|
|
|
36
38
|
const spec = buildPendingAlphaclawInstallSpec(marker);
|
|
37
39
|
logger.log(`[alphaclaw] Pending update detected, installing ${spec}...`);
|
|
38
40
|
|
|
41
|
+
const resolvedInstallDir = path.resolve(String(installDir || ""));
|
|
42
|
+
const installParentDir = path.dirname(resolvedInstallDir);
|
|
43
|
+
const tempInstallDir = fsModule.mkdtempSync(
|
|
44
|
+
path.join(installParentDir, `${path.basename(resolvedInstallDir)}-pending-`),
|
|
45
|
+
);
|
|
46
|
+
|
|
39
47
|
try {
|
|
40
48
|
installManagedAlphaclawRuntime({
|
|
41
49
|
execSyncImpl,
|
|
42
50
|
fsModule,
|
|
43
|
-
runtimeDir:
|
|
51
|
+
runtimeDir: tempInstallDir,
|
|
44
52
|
spec,
|
|
45
53
|
});
|
|
54
|
+
try {
|
|
55
|
+
fsModule.rmSync(resolvedInstallDir, { recursive: true, force: true });
|
|
56
|
+
} catch {}
|
|
57
|
+
fsModule.renameSync(tempInstallDir, resolvedInstallDir);
|
|
46
58
|
fsModule.unlinkSync(markerPath);
|
|
47
59
|
logger.log("[alphaclaw] Update applied successfully");
|
|
48
60
|
return {
|
|
@@ -52,6 +64,9 @@ const applyPendingAlphaclawUpdate = ({
|
|
|
52
64
|
};
|
|
53
65
|
} catch (error) {
|
|
54
66
|
logger.log(`[alphaclaw] Update install failed: ${error.message}`);
|
|
67
|
+
try {
|
|
68
|
+
fsModule.rmSync(tempInstallDir, { recursive: true, force: true });
|
|
69
|
+
} catch {}
|
|
55
70
|
try {
|
|
56
71
|
fsModule.unlinkSync(markerPath);
|
|
57
72
|
} catch {}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
|
|
1
3
|
const {
|
|
2
4
|
installManagedOpenclawRuntime,
|
|
3
5
|
} = require("./openclaw-runtime");
|
|
@@ -36,14 +38,24 @@ const applyPendingOpenclawUpdate = ({
|
|
|
36
38
|
const spec = buildPendingOpenclawInstallSpec(marker);
|
|
37
39
|
logger.log(`[alphaclaw] Pending OpenClaw update detected, installing ${spec}...`);
|
|
38
40
|
|
|
41
|
+
const resolvedInstallDir = path.resolve(String(installDir || ""));
|
|
42
|
+
const installParentDir = path.dirname(resolvedInstallDir);
|
|
43
|
+
const tempInstallDir = fsModule.mkdtempSync(
|
|
44
|
+
path.join(installParentDir, `${path.basename(resolvedInstallDir)}-pending-`),
|
|
45
|
+
);
|
|
46
|
+
|
|
39
47
|
try {
|
|
40
48
|
installManagedOpenclawRuntime({
|
|
41
49
|
execSyncImpl,
|
|
42
50
|
fsModule,
|
|
43
51
|
logger,
|
|
44
|
-
runtimeDir:
|
|
52
|
+
runtimeDir: tempInstallDir,
|
|
45
53
|
spec,
|
|
46
54
|
});
|
|
55
|
+
try {
|
|
56
|
+
fsModule.rmSync(resolvedInstallDir, { recursive: true, force: true });
|
|
57
|
+
} catch {}
|
|
58
|
+
fsModule.renameSync(tempInstallDir, resolvedInstallDir);
|
|
47
59
|
fsModule.unlinkSync(markerPath);
|
|
48
60
|
logger.log("[alphaclaw] OpenClaw update applied successfully");
|
|
49
61
|
return {
|
|
@@ -53,6 +65,9 @@ const applyPendingOpenclawUpdate = ({
|
|
|
53
65
|
};
|
|
54
66
|
} catch (error) {
|
|
55
67
|
logger.log(`[alphaclaw] OpenClaw update install failed: ${error.message}`);
|
|
68
|
+
try {
|
|
69
|
+
fsModule.rmSync(tempInstallDir, { recursive: true, force: true });
|
|
70
|
+
} catch {}
|
|
56
71
|
try {
|
|
57
72
|
fsModule.unlinkSync(markerPath);
|
|
58
73
|
} catch {}
|