@gholl-studio/pier-connector 0.2.43 → 0.2.44

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +10 -2
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gholl-studio/pier-connector",
3
3
  "author": "gholl",
4
- "version": "0.2.43",
4
+ "version": "0.2.44",
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
@@ -187,8 +187,16 @@ export default function register(api) {
187
187
 
188
188
  if (!finalAgentId) {
189
189
  // Check if accountId matches an existing agent slug/ID
190
- const agents = (api.runtime && typeof api.runtime.getAgents === 'function') ? await api.runtime.getAgents() : {};
191
- if (agents && agents[inbound.accountId]) {
190
+ const rawAgents = (api.runtime && typeof api.runtime.getAgents === 'function') ? await api.runtime.getAgents() : null;
191
+ let isAgentValid = false;
192
+
193
+ if (Array.isArray(rawAgents)) {
194
+ isAgentValid = !!rawAgents.find(a => a.id === inbound.accountId);
195
+ } else if (rawAgents && typeof rawAgents === 'object') {
196
+ isAgentValid = !!rawAgents[inbound.accountId];
197
+ }
198
+
199
+ if (isAgentValid) {
192
200
  finalAgentId = inbound.accountId;
193
201
  routingSource = 'name-match-fallback';
194
202
  } else {