@gholl-studio/pier-connector 0.1.1 → 0.1.2
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/index.js +10 -6
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gholl-studio/pier-connector",
|
|
3
3
|
"author": "gholl",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.2",
|
|
5
5
|
"description": "OpenClaw plugin that connects to the Pier job marketplace. Automatically fetches, executes, and reports distributed tasks for rewards.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "src/index.js",
|
package/src/index.js
CHANGED
|
@@ -42,15 +42,15 @@ export default function register(api) {
|
|
|
42
42
|
|
|
43
43
|
/** Connection status for the /pier command */
|
|
44
44
|
let connectionStatus = 'disconnected';
|
|
45
|
+
const jobSubscriptions = new Map();
|
|
46
|
+
const jobStopTimeouts = new Map();
|
|
47
|
+
const activeNodeJobs = new Map();
|
|
48
|
+
|
|
45
49
|
let jobsReceived = 0;
|
|
46
50
|
let jobsCompleted = 0;
|
|
47
51
|
let jobsFailed = 0;
|
|
48
52
|
let connectedAt = null;
|
|
49
|
-
|
|
50
|
-
/** @type {Map<string, import('@nats-io/transport-node').Subscription>} */
|
|
51
|
-
const jobSubscriptions = new Map();
|
|
52
|
-
const jobStopTimeouts = new Map();
|
|
53
|
-
const activeNodeJobs = new Map();
|
|
53
|
+
let lastHeartbeatError = null;
|
|
54
54
|
|
|
55
55
|
// ── resolve plugin config ──────────────────────────────────────────
|
|
56
56
|
|
|
@@ -118,8 +118,10 @@ export default function register(api) {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
const data = await resp.json();
|
|
121
|
+
lastHeartbeatError = null;
|
|
121
122
|
return data.nats_config || null;
|
|
122
123
|
} catch (err) {
|
|
124
|
+
lastHeartbeatError = err.message;
|
|
123
125
|
logger.warn(`[pier-connector] Heartbeat failed: ${err.message}`);
|
|
124
126
|
return null;
|
|
125
127
|
}
|
|
@@ -271,7 +273,8 @@ export default function register(api) {
|
|
|
271
273
|
enabled: account.enabled,
|
|
272
274
|
configured: Boolean(account.nodeId && account.secretKey) || Boolean(account.privateKey),
|
|
273
275
|
running: connectionStatus === 'connected' || connectionStatus === 'connecting',
|
|
274
|
-
connected: connectionStatus === 'connected',
|
|
276
|
+
connected: connectionStatus === 'connected' && !lastHeartbeatError,
|
|
277
|
+
lastError: lastHeartbeatError,
|
|
275
278
|
};
|
|
276
279
|
}
|
|
277
280
|
},
|
|
@@ -815,6 +818,7 @@ export default function register(api) {
|
|
|
815
818
|
`• Publish: ${config.publishSubject}`,
|
|
816
819
|
`• Uptime: ${uptime}`,
|
|
817
820
|
`• Jobs: ${jobsReceived} received, ${jobsCompleted} completed, ${jobsFailed} failed`,
|
|
821
|
+
lastHeartbeatError ? `• \x1b[31mHeartbeat Error: ${lastHeartbeatError}\x1b[0m` : `• Heartbeat: OK`,
|
|
818
822
|
].join('\n'),
|
|
819
823
|
};
|
|
820
824
|
},
|