@openagents-org/agent-launcher 0.2.7 → 0.2.8
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/adapters/base.js +10 -2
package/package.json
CHANGED
package/src/adapters/base.js
CHANGED
|
@@ -80,7 +80,10 @@ class BaseAdapter {
|
|
|
80
80
|
|
|
81
81
|
try {
|
|
82
82
|
// Send initial heartbeat
|
|
83
|
-
await this._heartbeat();
|
|
83
|
+
try { await this._heartbeat(); } catch (e) {
|
|
84
|
+
this._log(`Heartbeat failed (non-fatal): ${e.message}`);
|
|
85
|
+
}
|
|
86
|
+
this._log('Starting poll loop...');
|
|
84
87
|
await this._pollLoop();
|
|
85
88
|
} finally {
|
|
86
89
|
this._running = false;
|
|
@@ -169,8 +172,10 @@ class BaseAdapter {
|
|
|
169
172
|
|
|
170
173
|
async _pollLoop() {
|
|
171
174
|
let idleCount = 0;
|
|
175
|
+
let pollCount = 0;
|
|
172
176
|
|
|
173
177
|
while (this._running) {
|
|
178
|
+
pollCount++;
|
|
174
179
|
let messages, rawCursor;
|
|
175
180
|
try {
|
|
176
181
|
const result = await this.client.pollPending(
|
|
@@ -179,8 +184,11 @@ class BaseAdapter {
|
|
|
179
184
|
);
|
|
180
185
|
messages = result.messages;
|
|
181
186
|
rawCursor = result.cursor;
|
|
187
|
+
if (pollCount <= 3 || pollCount % 20 === 0) {
|
|
188
|
+
this._log(`Poll #${pollCount}: ${messages.length} messages, cursor=${rawCursor || 'none'}`);
|
|
189
|
+
}
|
|
182
190
|
} catch (e) {
|
|
183
|
-
this._log(`Poll failed: ${e.message}`);
|
|
191
|
+
this._log(`Poll #${pollCount} failed: ${e.message}`);
|
|
184
192
|
await this._sleep(5000);
|
|
185
193
|
continue;
|
|
186
194
|
}
|