@gholl-studio/pier-connector 0.2.48 → 0.2.50

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 +14 -9
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.48",
4
+ "version": "0.2.50",
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
@@ -38,11 +38,15 @@ export default function register(api) {
38
38
  // ── resolve plugin config ──────────────────────────────────────────
39
39
 
40
40
  function resolveConfigs() {
41
- const rawAccounts = api.config?.channels?.['pier']?.accounts || {};
42
- const legacyCfg = api.config?.plugins?.entries?.['pier-connector']?.config || {};
41
+ const globalAccounts = api.runtime?.config?.channels?.['pier']?.accounts || {};
42
+ const pluginAccounts = api.config?.channels?.['pier']?.accounts || {};
43
+ const rawAccounts = { ...globalAccounts, ...pluginAccounts };
43
44
 
44
- // If no accounts defined, fallback to 'default' using legacy/env config
45
+ const legacyCfg = api.config?.plugins?.entries?.['pier-connector']?.config || api.config || {};
46
+
47
+ // If no accounts defined at all, fallback to 'default' using legacy/env config
45
48
  if (Object.keys(rawAccounts).length === 0) {
49
+ logger.info(`[pier-connector] No accounts found in global or plugin config. Falling back to default.`);
46
50
  return [{
47
51
  accountId: 'default',
48
52
  ...mergedCfgFrom(legacyCfg, {})
@@ -163,10 +167,11 @@ export default function register(api) {
163
167
 
164
168
  logger.info(`[pier-connector:trace] receiveIncoming triggered. inbound.accountId='${inbound.accountId}', inbound.senderId='${inbound.senderId}'`);
165
169
 
170
+ const globalConfig = api.runtime?.config || {};
166
171
  const route = api.runtime.channel.routing.resolveAgentRoute({
167
- cfg: api.runtime.config,
172
+ cfg: globalConfig,
168
173
  channel: 'pier',
169
- account: inbound.accountId, // Fixed: parameter name should be 'account'
174
+ account: inbound.accountId,
170
175
  peer: { kind: 'direct', id: jobId }
171
176
  });
172
177
 
@@ -177,8 +182,8 @@ export default function register(api) {
177
182
  let routingSource = 'account-config';
178
183
 
179
184
  // 2. Robust manual parse (safeguard against OpenClaw core parsing bugs)
180
- if (!finalAgentId && api.runtime?.config) {
181
- const cfg = api.runtime.config;
185
+ if (!finalAgentId) {
186
+ const cfg = globalConfig;
182
187
  const bs = Array.isArray(cfg.bindings) ? cfg.bindings : [];
183
188
  const al = Array.isArray(cfg.agents?.list) ? cfg.agents.list : [];
184
189
 
@@ -256,14 +261,14 @@ export default function register(api) {
256
261
  }
257
262
 
258
263
  const ctxPayload = api.runtime.channel.reply.finalizeInboundContext({
259
- AgentId: finalAgentId, // Explicitly override with our calculated routing result
264
+ agentId: finalAgentId, // Lowercase agentId is the standard target identifier
260
265
  Body: inbound.text,
261
266
  BodyForAgent: inbound.text,
262
267
  RawBody: inbound.text,
263
268
  From: inbound.senderId,
264
269
  To: `pier:${jobId}`,
265
270
  SessionKey: dynamicSessionKey,
266
- AccountId: inbound.accountId, // Use the real inbound account name
271
+ AccountId: inbound.accountId,
267
272
  ChatType: 'direct',
268
273
  SenderId: inbound.senderId,
269
274
  Provider: 'pier',