natureco-cli 1.0.31 → 1.0.33

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natureco-cli",
3
- "version": "1.0.31",
3
+ "version": "1.0.33",
4
4
  "description": "NatureCo AI Bot Terminal Interface",
5
5
  "main": "bin/natureco.js",
6
6
  "bin": {
@@ -48,6 +48,9 @@ function log(module, message, color = 'white') {
48
48
  async function gatewayServer(action) {
49
49
  // Check if running as background worker
50
50
  if (process.argv.includes('--gateway-worker')) {
51
+ process.stdin.resume();
52
+ process.title = 'natureco-gateway';
53
+ log('gateway', 'Worker process started, PID: ' + process.pid);
51
54
  return runGatewayWorker();
52
55
  }
53
56
 
@@ -90,17 +93,26 @@ async function startGateway() {
90
93
 
91
94
  console.log(chalk.green('\nšŸš€ Starting NatureCo Gateway...\n'));
92
95
 
96
+ // Ensure log directory exists
97
+ const dir = path.dirname(LOG_FILE);
98
+ if (!fs.existsSync(dir)) {
99
+ fs.mkdirSync(dir, { recursive: true });
100
+ }
101
+
102
+ // Open log file for stdio redirection
103
+ const logFd = fs.openSync(LOG_FILE, 'a');
104
+
93
105
  // Start as detached background process
94
- const child = spawn(process.execPath, [__filename, '--gateway-worker'], {
106
+ const child = spawn(process.execPath, [require.resolve('./gateway-server'), '--gateway-worker'], {
95
107
  detached: true,
96
- stdio: 'ignore',
108
+ stdio: ['ignore', logFd, logFd],
97
109
  windowsHide: true,
110
+ cwd: os.homedir(),
98
111
  });
99
112
 
100
113
  child.unref();
101
114
 
102
115
  // Save PID
103
- const dir = path.dirname(PID_FILE);
104
116
  if (!fs.existsSync(dir)) {
105
117
  fs.mkdirSync(dir, { recursive: true });
106
118
  }