engine7 7.1.37 → 7.1.39
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/dist/cli.mjs +89 -37
- package/dist/engine-startup.mjs +2876 -1459
- package/dist/main.mjs +2655 -1238
- package/package.json +2 -1
- package/templates/config.template.json +3 -0
package/dist/cli.mjs
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
const require=(await import('node:module')).createRequire(import.meta.url)
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __esm = (fn, res) => function __init() {
|
|
5
|
-
|
|
4
|
+
var __esm = (fn, res, err) => function __init() {
|
|
5
|
+
if (err) throw err[0];
|
|
6
|
+
try {
|
|
7
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
8
|
+
} catch (e) {
|
|
9
|
+
throw err = [e], e;
|
|
10
|
+
}
|
|
6
11
|
};
|
|
7
12
|
var __export = (target, all) => {
|
|
8
13
|
for (var name in all)
|
|
@@ -205,14 +210,35 @@ async function doExport(opts) {
|
|
|
205
210
|
configFiles.push(f);
|
|
206
211
|
}
|
|
207
212
|
}
|
|
213
|
+
const EVEROS_SKIP = /* @__PURE__ */ new Set([".tmp", ".lock", "import.log", "import_progress.json"]);
|
|
214
|
+
const everosDir = path.join(stateDir, ".everos");
|
|
215
|
+
const everosFiles = [];
|
|
216
|
+
if (fs.existsSync(everosDir)) {
|
|
217
|
+
for (const f of collectAllFiles(everosDir)) {
|
|
218
|
+
if (EVEROS_SKIP.has(path.basename(f))) continue;
|
|
219
|
+
everosFiles.push(f);
|
|
220
|
+
}
|
|
221
|
+
const walFile = path.join(everosDir, ".index", "sqlite", "system.db-wal");
|
|
222
|
+
if (fs.existsSync(walFile) && fs.statSync(walFile).size > 0) {
|
|
223
|
+
console.warn(`\u26A0\uFE0F .everos/system.db-wal \u975E\u7A7A\u2014\u2014everos \u670D\u52A1\u53EF\u80FD\u6B63\u5728\u5199\u5165\uFF0C\u5FEB\u7167\u53EF\u80FD\u4E0D\u4E00\u81F4`);
|
|
224
|
+
console.warn(` \u5EFA\u8BAE: \u5148\u505C everos \u670D\u52A1\u518D export\uFF0C\u6216 import \u540E\u91CD\u5EFA\u7D22\u5F15`);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
208
227
|
console.log(` workspace \u6587\u4EF6: ${wsFiles.length}`);
|
|
209
228
|
console.log(` session jsonl: ${sessionFiles.length} (\u6700\u8FD17\u5929)`);
|
|
210
229
|
console.log(` configs: ${configFiles.length}`);
|
|
230
|
+
console.log(` everos: ${everosFiles.length} (${(everosFiles.reduce((s, f) => s + fs.statSync(f).size, 0) / 1024 / 1024).toFixed(1)} MB)`);
|
|
211
231
|
if (dryRun2) {
|
|
212
232
|
console.log(`
|
|
213
233
|
[DRY RUN] \u4F1A\u6253\u5305\u4EE5\u4E0B\u6587\u4EF6:`);
|
|
214
234
|
wsFiles.slice(0, 20).forEach((f) => console.log(` ${path.relative(workspace, f)}`));
|
|
215
235
|
if (wsFiles.length > 20) console.log(` ... \u8FD8\u6709 ${wsFiles.length - 20} \u4E2A\u6587\u4EF6`);
|
|
236
|
+
if (everosFiles.length > 0) {
|
|
237
|
+
console.log(`
|
|
238
|
+
[DRY RUN] everos (${everosFiles.length} \u6587\u4EF6):`);
|
|
239
|
+
everosFiles.slice(0, 10).forEach((f) => console.log(` ${path.relative(stateDir, f)}`));
|
|
240
|
+
if (everosFiles.length > 10) console.log(` ... \u8FD8\u6709 ${everosFiles.length - 10} \u4E2A\u6587\u4EF6`);
|
|
241
|
+
}
|
|
216
242
|
console.log(`
|
|
217
243
|
[DRY RUN] \u4E0D\u5B9E\u9645\u6253\u5305`);
|
|
218
244
|
return;
|
|
@@ -225,46 +251,47 @@ async function doExport(opts) {
|
|
|
225
251
|
fs.mkdirSync(stagingDir, { recursive: true });
|
|
226
252
|
let fileCount = 0;
|
|
227
253
|
let totalSize = 0;
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
const
|
|
254
|
+
let copyFail = 0;
|
|
255
|
+
const copyOne = (srcFile, relRoot, destRoot) => {
|
|
256
|
+
const relPath = path.relative(relRoot, srcFile);
|
|
257
|
+
const destFile = path.join(destRoot, relPath);
|
|
231
258
|
fs.mkdirSync(path.dirname(destFile), { recursive: true });
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
259
|
+
try {
|
|
260
|
+
if (isTextFile(srcFile)) {
|
|
261
|
+
const content = fs.readFileSync(srcFile, "utf-8");
|
|
262
|
+
fs.writeFileSync(destFile, sanitizeContent(content, dirs));
|
|
263
|
+
} else {
|
|
264
|
+
fs.copyFileSync(srcFile, destFile);
|
|
265
|
+
}
|
|
266
|
+
fileCount++;
|
|
267
|
+
totalSize += fs.statSync(srcFile).size;
|
|
268
|
+
} catch (e) {
|
|
269
|
+
copyFail++;
|
|
270
|
+
console.warn(` \u26A0\uFE0F \u62F7\u8D1D\u5931\u8D25: ${relPath} (${e.code || e.message})`);
|
|
237
271
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}
|
|
272
|
+
};
|
|
273
|
+
for (const srcFile of wsFiles) copyOne(srcFile, workspace, path.join(stagingDir, "workspace"));
|
|
241
274
|
for (const srcFile of sessionFiles) {
|
|
242
275
|
const relPath = path.relative(stateDir, srcFile);
|
|
243
276
|
const destFile = path.join(stagingDir, relPath);
|
|
244
277
|
fs.mkdirSync(path.dirname(destFile), { recursive: true });
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
fs.mkdirSync(path.dirname(destFile), { recursive: true });
|
|
259
|
-
if (isTextFile(srcFile)) {
|
|
260
|
-
const content = fs.readFileSync(srcFile, "utf-8");
|
|
261
|
-
fs.writeFileSync(destFile, sanitizeContent(content, dirs));
|
|
262
|
-
} else {
|
|
263
|
-
fs.copyFileSync(srcFile, destFile);
|
|
278
|
+
try {
|
|
279
|
+
let content = fs.readFileSync(srcFile, "utf-8");
|
|
280
|
+
content = sanitizeContent(content, dirs);
|
|
281
|
+
const baseName = path.basename(srcFile);
|
|
282
|
+
if (baseName === "session-index.json" || baseName === "platform-map.json") {
|
|
283
|
+
content = content.split("\\\\").join("/");
|
|
284
|
+
}
|
|
285
|
+
fs.writeFileSync(destFile, content);
|
|
286
|
+
fileCount++;
|
|
287
|
+
totalSize += fs.statSync(srcFile).size;
|
|
288
|
+
} catch (e) {
|
|
289
|
+
copyFail++;
|
|
290
|
+
console.warn(` \u26A0\uFE0F \u62F7\u8D1D\u5931\u8D25: ${relPath} (${e.code || e.message})`);
|
|
264
291
|
}
|
|
265
|
-
fileCount++;
|
|
266
|
-
totalSize += fs.statSync(srcFile).size;
|
|
267
292
|
}
|
|
293
|
+
for (const srcFile of configFiles) copyOne(srcFile, stateDir, stagingDir);
|
|
294
|
+
for (const srcFile of everosFiles) copyOne(srcFile, stateDir, stagingDir);
|
|
268
295
|
const manifest = {
|
|
269
296
|
agentName,
|
|
270
297
|
version,
|
|
@@ -286,11 +313,11 @@ async function doExport(opts) {
|
|
|
286
313
|
const tarExe = process.platform === "win32" ? "C:\\Windows\\System32\\tar.exe" : "tar";
|
|
287
314
|
execSync(`"${tarExe}" -czf "${archiveFile}" -C "${tmpDir}" ${agentName}`, { stdio: "pipe" });
|
|
288
315
|
const archiveSize = fs.statSync(archiveFile).size;
|
|
289
|
-
console.log(`\u2705 \u6253\u5305\u5B8C\u6210: ${archiveFile} (${(archiveSize / 1024 / 1024).toFixed(1)} MB, ${fileCount} \u6587\u4EF6)`);
|
|
316
|
+
console.log(`\u2705 \u6253\u5305\u5B8C\u6210: ${archiveFile} (${(archiveSize / 1024 / 1024).toFixed(1)} MB, ${fileCount} \u6587\u4EF6${copyFail ? `, \u5931\u8D25 ${copyFail}` : ""})`);
|
|
290
317
|
const cfg = loadTravelConfig();
|
|
291
318
|
if (!cfg || !cfg.githubToken) {
|
|
292
319
|
console.log(`
|
|
293
|
-
\u26A0\uFE0F \u672A\u914D\u7F6E GitHub\uFF0Ctar.gz \u5DF2\u751F\u6210: ${
|
|
320
|
+
\u26A0\uFE0F \u672A\u914D\u7F6E GitHub\uFF0Ctar.gz \u5DF2\u751F\u6210: ${archiveFile}`);
|
|
294
321
|
console.log(` \u914D\u7F6E GitHub: \u7F16\u8F91 ${CONFIG_PATH}`);
|
|
295
322
|
console.log(` \u6216\u624B\u52A8\u4E0A\u4F20\u5230 GitHub private repo release`);
|
|
296
323
|
return;
|
|
@@ -384,6 +411,28 @@ async function doImport(opts) {
|
|
|
384
411
|
restoredCount++;
|
|
385
412
|
}
|
|
386
413
|
}
|
|
414
|
+
const everosStaging = path.join(stagingDir, ".everos");
|
|
415
|
+
if (fs.existsSync(everosStaging)) {
|
|
416
|
+
const everosFiles = collectAllFiles(everosStaging);
|
|
417
|
+
for (const srcFile of everosFiles) {
|
|
418
|
+
const relPath = path.relative(stagingDir, srcFile);
|
|
419
|
+
const destFile = path.join(stateDir, relPath);
|
|
420
|
+
fs.mkdirSync(path.dirname(destFile), { recursive: true });
|
|
421
|
+
try {
|
|
422
|
+
if (isTextFile(srcFile)) {
|
|
423
|
+
const content = fs.readFileSync(srcFile, "utf-8");
|
|
424
|
+
fs.writeFileSync(destFile, restoreContent(content, dirs));
|
|
425
|
+
} else {
|
|
426
|
+
fs.copyFileSync(srcFile, destFile);
|
|
427
|
+
}
|
|
428
|
+
restoredCount++;
|
|
429
|
+
} catch (e) {
|
|
430
|
+
skipCount++;
|
|
431
|
+
console.log(` \u26A0\uFE0F \u8DF3\u8FC7: ${path.relative(everosStaging, srcFile)} (${e.code || e.message})`);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
console.log(` everos: ${everosFiles.length} \u6587\u4EF6\u5DF2\u6062\u590D`);
|
|
435
|
+
}
|
|
387
436
|
console.log(`\u2705 \u6062\u590D\u5B8C\u6210: ${restoredCount} \u6587\u4EF6 \u2192 ${stateDir}${skipCount ? ` (\u8DF3\u8FC7 ${skipCount})` : ""}`);
|
|
388
437
|
const platformConfigName = process.platform === "darwin" ? "xiaoke-mac.json" : "xiaoke-win.json";
|
|
389
438
|
const restoredConfigPath = path.join(stateDir, "configs", platformConfigName);
|
|
@@ -566,7 +615,10 @@ var init_cli_travel = __esm({
|
|
|
566
615
|
".bat",
|
|
567
616
|
".sh",
|
|
568
617
|
".csv",
|
|
569
|
-
".html"
|
|
618
|
+
".html",
|
|
619
|
+
".toml",
|
|
620
|
+
".list"
|
|
621
|
+
// .everos 的 everos.toml/config.toml/ome.toml/everos-env.list
|
|
570
622
|
]);
|
|
571
623
|
}
|
|
572
624
|
});
|