agent-window 1.2.3 → 1.2.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.
package/package.json
CHANGED
|
@@ -182,16 +182,19 @@ export async function getStatus(name) {
|
|
|
182
182
|
overall: 'stopped'
|
|
183
183
|
};
|
|
184
184
|
|
|
185
|
+
let containerName = null;
|
|
186
|
+
|
|
185
187
|
try {
|
|
186
188
|
const { readFileSync } = await import('fs');
|
|
187
189
|
const { join } = await import('path');
|
|
188
190
|
const configPath = proc.configPath; // Use configPath from platform abstraction layer
|
|
189
191
|
|
|
190
192
|
if (configPath) {
|
|
191
|
-
// Read the config file to get PROJECT_DIR
|
|
193
|
+
// Read the config file to get PROJECT_DIR and container name
|
|
192
194
|
try {
|
|
193
195
|
const configContent = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
194
196
|
const projectDir = configContent.PROJECT_DIR;
|
|
197
|
+
containerName = configContent.workspace?.containerName || null;
|
|
195
198
|
|
|
196
199
|
if (projectDir) {
|
|
197
200
|
// Health file is in the project directory
|
|
@@ -216,6 +219,23 @@ export async function getStatus(name) {
|
|
|
216
219
|
console.debug('[Health] Could not read health status file:', e.message);
|
|
217
220
|
}
|
|
218
221
|
|
|
222
|
+
// If Docker status is still false and we have a container name, check directly
|
|
223
|
+
if (!healthStatus.docker && containerName && proc.status === 'online') {
|
|
224
|
+
try {
|
|
225
|
+
const { execSync } = await import('child_process');
|
|
226
|
+
const result = execSync(
|
|
227
|
+
`docker inspect -f '{{.State.Running}}' ${containerName} 2>/dev/null`,
|
|
228
|
+
{ encoding: 'utf-8' }
|
|
229
|
+
).trim();
|
|
230
|
+
healthStatus.docker = result === 'true';
|
|
231
|
+
healthStatus.overall = healthStatus.docker ? 'healthy' : 'degraded';
|
|
232
|
+
} catch (e) {
|
|
233
|
+
// Docker container not running or doesn't exist
|
|
234
|
+
healthStatus.docker = false;
|
|
235
|
+
healthStatus.overall = 'degraded';
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
219
239
|
// platformPM2 returns simplified format with direct properties
|
|
220
240
|
return {
|
|
221
241
|
name: proc.name,
|
|
@@ -129,20 +129,10 @@ async function start(scriptPath, options = {}) {
|
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
//
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
// Default: max 10 restarts, then stop
|
|
137
|
-
args.push('--max-restarts', '10');
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (options.minUptime !== undefined) {
|
|
141
|
-
args.push('--min-uptime', String(options.minUptime));
|
|
142
|
-
} else {
|
|
143
|
-
// Default: must run at least 10 seconds to be considered stable
|
|
144
|
-
args.push('--min-uptime', '10s');
|
|
145
|
-
}
|
|
132
|
+
// Note: PM2 CLI doesn't support --max-restarts or --min-uptime as direct options
|
|
133
|
+
// These must be set via ecosystem config file or app configuration
|
|
134
|
+
// For now, we skip these to avoid errors
|
|
135
|
+
// Users can configure restart behavior in ecosystem.config.js
|
|
146
136
|
|
|
147
137
|
if (options.instances) {
|
|
148
138
|
args.push('-i', String(options.instances));
|