@openagents-org/agent-launcher 0.2.33 → 0.2.35
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 +1 -1
- package/src/daemon.js +11 -0
- package/src/installer.js +29 -1
package/package.json
CHANGED
package/src/daemon.js
CHANGED
|
@@ -107,6 +107,11 @@ class Daemon {
|
|
|
107
107
|
*/
|
|
108
108
|
async stopAgent(agentName) {
|
|
109
109
|
this._stoppedAgents.add(agentName);
|
|
110
|
+
// Mark state as stopped immediately
|
|
111
|
+
if (this._processes[agentName]) {
|
|
112
|
+
this._processes[agentName].state = 'stopped';
|
|
113
|
+
}
|
|
114
|
+
this._writeStatus();
|
|
110
115
|
// Stop the adapter directly if running
|
|
111
116
|
if (this._adapters && this._adapters[agentName]) {
|
|
112
117
|
this._adapters[agentName].stop();
|
|
@@ -124,6 +129,12 @@ class Daemon {
|
|
|
124
129
|
* Restart a single agent by name.
|
|
125
130
|
*/
|
|
126
131
|
async restartAgent(agentName) {
|
|
132
|
+
// Set state to 'starting' immediately so UI never sees 'stopped' during restart
|
|
133
|
+
if (this._processes[agentName]) {
|
|
134
|
+
this._processes[agentName].state = 'starting';
|
|
135
|
+
this._writeStatus();
|
|
136
|
+
}
|
|
137
|
+
|
|
127
138
|
await this.stopAgent(agentName);
|
|
128
139
|
this._stoppedAgents.delete(agentName);
|
|
129
140
|
|
package/src/installer.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const fs = require('fs');
|
|
4
|
+
const os = require('os');
|
|
4
5
|
const path = require('path');
|
|
5
6
|
const { execSync, exec } = require('child_process');
|
|
6
7
|
const { whichBinary, getEnhancedEnv } = require('./paths');
|
|
@@ -91,7 +92,34 @@ class Installer {
|
|
|
91
92
|
version = match ? match[1] : raw.split('\n')[0];
|
|
92
93
|
} catch {}
|
|
93
94
|
|
|
94
|
-
|
|
95
|
+
// Check login/ready status if check_ready is defined
|
|
96
|
+
let ready = true;
|
|
97
|
+
const checkReady = entry?.check_ready;
|
|
98
|
+
if (checkReady) {
|
|
99
|
+
ready = false;
|
|
100
|
+
// Check env vars
|
|
101
|
+
if (checkReady.env_vars) {
|
|
102
|
+
for (const v of checkReady.env_vars) {
|
|
103
|
+
if (process.env[v]) { ready = true; break; }
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// Check credentials file
|
|
107
|
+
if (!ready && checkReady.creds_file) {
|
|
108
|
+
try {
|
|
109
|
+
const credsPath = checkReady.creds_file.replace('~', os.homedir());
|
|
110
|
+
if (fs.existsSync(credsPath)) {
|
|
111
|
+
const creds = JSON.parse(fs.readFileSync(credsPath, 'utf-8'));
|
|
112
|
+
if (checkReady.creds_key) {
|
|
113
|
+
ready = !!creds[checkReady.creds_key];
|
|
114
|
+
} else {
|
|
115
|
+
ready = true;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
} catch {}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return { installed: true, binary, version, ready };
|
|
95
123
|
}
|
|
96
124
|
|
|
97
125
|
/**
|