engine7 7.0.8 → 7.1.0

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.
Files changed (2) hide show
  1. package/dist/cli.mjs +16 -6
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -496,11 +496,19 @@ engine7 start \u2014 \u542F\u52A8 Engine
496
496
  if (fs.existsSync(localPath)) {
497
497
  enginePath = localPath;
498
498
  } else {
499
- const globalRoot = execSync("npm root -g", { encoding: "utf-8" }).trim();
500
- enginePath = path.join(globalRoot, "engine7", "dist", "main.mjs");
501
- if (!fs.existsSync(enginePath)) {
502
- console.error("\u274C \u627E\u4E0D\u5230 engine7 \u5B89\u88C5");
503
- process.exit(1);
499
+ const cliPath = path.resolve(process.argv[1]);
500
+ const distDir = path.dirname(cliPath);
501
+ const candidate = path.join(distDir, "main.mjs");
502
+ if (fs.existsSync(candidate)) {
503
+ enginePath = candidate;
504
+ } else {
505
+ try {
506
+ const globalRoot = execSync("npm root -g", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim();
507
+ enginePath = path.join(globalRoot, "engine7", "dist", "main.mjs");
508
+ } catch {
509
+ console.error("\u274C \u627E\u4E0D\u5230 engine7 main.mjs");
510
+ process.exit(1);
511
+ }
504
512
  }
505
513
  }
506
514
  console.log(`\u{1F680} engine7 start`);
@@ -603,6 +611,8 @@ cd /d "${cwd}"\r
603
611
  const plistDir = path.join(process.env.HOME, "Library", "LaunchAgents");
604
612
  fs.mkdirSync(plistDir, { recursive: true });
605
613
  const plistPath = path.join(plistDir, `${label}.plist`);
614
+ const localCli = path.join("node_modules", "engine7", "dist", "cli.mjs");
615
+ const cliMjs = fs.existsSync(localCli) ? path.resolve(localCli) : path.join(path.dirname(path.dirname(engine7Bin)), "lib", "node_modules", "engine7", "dist", "cli.mjs");
606
616
  const plist = `<?xml version="1.0" encoding="UTF-8"?>
607
617
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
608
618
  <plist version="1.0">
@@ -611,7 +621,7 @@ cd /d "${cwd}"\r
611
621
  <key>ProgramArguments</key>
612
622
  <array>
613
623
  <string>${process.execPath}</string>
614
- <string>${engine7Bin}</string>
624
+ <string>${cliMjs}</string>
615
625
  <string>start</string>
616
626
  <string>--config</string>
617
627
  <string>${path.resolve(configPath2)}</string>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "engine7",
3
- "version": "7.0.8",
3
+ "version": "7.1.0",
4
4
  "type": "module",
5
5
  "description": "Engine 7 — Self-hosted AI agent engine",
6
6
  "main": "dist/main.mjs",