agent-window 1.0.5 → 1.0.7
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
|
@@ -244,15 +244,36 @@ export async function discoverInstances() {
|
|
|
244
244
|
// Extract instance name from bot-name
|
|
245
245
|
const instanceName = proc.name.replace(/^bot-/, '');
|
|
246
246
|
|
|
247
|
-
//
|
|
247
|
+
// Determine project path and config path
|
|
248
248
|
let projectPath = null;
|
|
249
|
+
let configPath = null;
|
|
249
250
|
let pluginPath = null;
|
|
250
251
|
|
|
251
|
-
|
|
252
|
-
|
|
252
|
+
// Priority 1: Read CONFIG_PATH and extract PROJECT_DIR from config
|
|
253
|
+
if (proc.configPath && existsSync(proc.configPath)) {
|
|
254
|
+
configPath = proc.configPath;
|
|
255
|
+
try {
|
|
256
|
+
const configContent = await fs.readFile(proc.configPath, 'utf8');
|
|
257
|
+
const config = JSON.parse(configContent);
|
|
258
|
+
|
|
259
|
+
// Use PROJECT_DIR from config if available
|
|
260
|
+
if (config.PROJECT_DIR) {
|
|
261
|
+
projectPath = config.PROJECT_DIR;
|
|
262
|
+
} else {
|
|
263
|
+
// Fallback to config directory
|
|
264
|
+
projectPath = path.dirname(configPath);
|
|
265
|
+
}
|
|
266
|
+
} catch {
|
|
267
|
+
// If config read fails, use directory name
|
|
268
|
+
projectPath = path.dirname(configPath);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
// Priority 2: Use cwd
|
|
272
|
+
else if (proc.cwd) {
|
|
273
|
+
projectPath = proc.cwd;
|
|
253
274
|
}
|
|
254
275
|
|
|
255
|
-
// Check if it's a BMAD project
|
|
276
|
+
// Check if it's a BMAD project (has _bmad directory)
|
|
256
277
|
if (projectPath && existsSync(path.join(projectPath, '_bmad'))) {
|
|
257
278
|
pluginPath = path.join(projectPath, '_agent-bridge', 'src');
|
|
258
279
|
} else if (projectPath && existsSync(path.join(projectPath, 'src', 'bot.js'))) {
|
|
@@ -265,6 +286,7 @@ export async function discoverInstances() {
|
|
|
265
286
|
name: instanceName,
|
|
266
287
|
displayName: instanceName.charAt(0).toUpperCase() + instanceName.slice(1),
|
|
267
288
|
projectPath,
|
|
289
|
+
configPath,
|
|
268
290
|
pluginPath,
|
|
269
291
|
status: proc.status || 'unknown',
|
|
270
292
|
pid: proc.pid,
|
|
@@ -314,6 +336,7 @@ export async function importInstance(discovered) {
|
|
|
314
336
|
name: discovered.name,
|
|
315
337
|
displayName: discovered.displayName,
|
|
316
338
|
projectPath: validatedPath,
|
|
339
|
+
configPath: discovered.configPath,
|
|
317
340
|
pluginPath: validatedPluginPath,
|
|
318
341
|
botName: discovered.botName,
|
|
319
342
|
addedAt: new Date().toISOString(),
|
|
@@ -88,7 +88,10 @@ async function list(options = {}) {
|
|
|
88
88
|
cpu: p.monit?.cpu || 0,
|
|
89
89
|
restarts: p.pm2_env?.restart_time || 0,
|
|
90
90
|
cwd: p.pm2_env?.cwd || null,
|
|
91
|
-
script: p.pm2_env?.pm_cwd || null
|
|
91
|
+
script: p.pm2_env?.pm_cwd || null,
|
|
92
|
+
// Environment variables
|
|
93
|
+
env: p.pm2_env?.env || {},
|
|
94
|
+
configPath: p.pm2_env?.env?.CONFIG_PATH || null
|
|
92
95
|
}));
|
|
93
96
|
} catch {
|
|
94
97
|
return [];
|