@gholl-studio/pier-connector 0.2.46 → 0.2.48

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 +12 -5
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.46",
4
+ "version": "0.2.48",
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
@@ -166,7 +166,7 @@ export default function register(api) {
166
166
  const route = api.runtime.channel.routing.resolveAgentRoute({
167
167
  cfg: api.runtime.config,
168
168
  channel: 'pier',
169
- accountId: inbound.accountId,
169
+ account: inbound.accountId, // Fixed: parameter name should be 'account'
170
170
  peer: { kind: 'direct', id: jobId }
171
171
  });
172
172
 
@@ -211,10 +211,16 @@ export default function register(api) {
211
211
  routingSource = 'sdk-global-bindings';
212
212
  }
213
213
 
214
- // 4. Ultimate default
214
+ // 4. Ultimate/Aggressive default
215
215
  if (!finalAgentId) {
216
- finalAgentId = route.agentId || 'main'; // Ultimate fallback
217
- routingSource = route.agentId ? 'global-bindings-fallback' : 'default-routing';
216
+ if (inbound.accountId && inbound.accountId !== 'default' && inbound.accountId !== 'main') {
217
+ // Critical fallback: if the account has a custom name, assume the user wants that specific agent
218
+ finalAgentId = inbound.accountId;
219
+ routingSource = 'aggressive-account-name-match';
220
+ } else {
221
+ finalAgentId = route.agentId || 'main'; // Ultimate fallback
222
+ routingSource = route.agentId ? 'global-bindings-fallback' : 'default-routing';
223
+ }
218
224
  }
219
225
 
220
226
  logger.info(`[pier-connector] Routing account '${inbound.accountId}' -> agent '${finalAgentId}' (Source: ${routingSource})`);
@@ -250,13 +256,14 @@ export default function register(api) {
250
256
  }
251
257
 
252
258
  const ctxPayload = api.runtime.channel.reply.finalizeInboundContext({
259
+ AgentId: finalAgentId, // Explicitly override with our calculated routing result
253
260
  Body: inbound.text,
254
261
  BodyForAgent: inbound.text,
255
262
  RawBody: inbound.text,
256
263
  From: inbound.senderId,
257
264
  To: `pier:${jobId}`,
258
265
  SessionKey: dynamicSessionKey,
259
- AccountId: route.accountId,
266
+ AccountId: inbound.accountId, // Use the real inbound account name
260
267
  ChatType: 'direct',
261
268
  SenderId: inbound.senderId,
262
269
  Provider: 'pier',