@gholl-studio/pier-connector 0.3.17 → 0.3.18

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/inbound.ts +25 -7
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gholl-studio/pier-connector",
3
3
  "author": "gholl",
4
- "version": "0.3.17",
4
+ "version": "0.3.18",
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.ts",
package/src/inbound.ts CHANGED
@@ -53,12 +53,28 @@ export async function handleInbound(
53
53
 
54
54
  logger.info(`[pier-connector] Routing account '${robot.accountId}' -> agent '${finalAgentId}' (Source: ${routingSource})`);
55
55
 
56
- // Debug: Check Agent Identity (Correct Signature: resolveAgentIdentity(cfg, agentId))
56
+ // Debug: Check Agent Identity & Detailed Config
57
57
  try {
58
58
  const identity = (api.runtime as any).agent.resolveAgentIdentity(accountScopedCfg, finalAgentId);
59
- logger.info(`[pier-connector:debug] Identity resolution for ${finalAgentId}: ${JSON.stringify(identity)}`);
59
+ logger.info(`[pier-connector:debug] Identity resolution [0.3.18] for ${finalAgentId}: ${JSON.stringify(identity)}`);
60
+
61
+ // Deep Config Inspection
62
+ const agentsList = (accountScopedCfg as any)?.agents?.list || [];
63
+ const targetedAgent = agentsList.find((a: any) => a.id === finalAgentId);
64
+ if (targetedAgent) {
65
+ logger.info(`[pier-connector:debug] FULL AGENT CONFIG for ${finalAgentId}: ${JSON.stringify({
66
+ id: targetedAgent.id,
67
+ name: targetedAgent.name,
68
+ agentDir: targetedAgent.agentDir,
69
+ workspace: targetedAgent.workspace,
70
+ runtime: targetedAgent.runtime,
71
+ model: targetedAgent.model
72
+ })}`);
73
+ } else {
74
+ logger.warn(`[pier-connector:debug] Agent ${finalAgentId} NOT FOUND in agents.list of scoped config!`);
75
+ }
60
76
  } catch (err: any) {
61
- logger.warn(`[pier-connector:debug] Identity resolution failed for ${finalAgentId}: ${err.message}`);
77
+ logger.warn(`[pier-connector:debug] Identity resolution crash for ${finalAgentId}: ${err.message}`);
62
78
  }
63
79
 
64
80
  const dynamicSessionKey = `pier-job-${jobId}`;
@@ -95,7 +111,7 @@ export async function handleInbound(
95
111
  Body: inbound.body,
96
112
  BodyForAgent: inbound.body,
97
113
  RawBody: inbound.body,
98
- From: `pier:${inbound.senderId}`,
114
+ From: inbound.senderId, // Fix: senderId already includes "pier:" prefix
99
115
  To: `chat:${jobId}`,
100
116
  SessionKey: dynamicSessionKey,
101
117
  AccountId: robot.accountId,
@@ -114,6 +130,7 @@ export async function handleInbound(
114
130
  Metadata: {
115
131
  ...metadata,
116
132
  accountId: robot.accountId,
133
+ agentId: finalAgentId, // Explicitly tell SDK which agent we want
117
134
  pierJobId: jobId,
118
135
  routingSource: routingSource
119
136
  }
@@ -124,9 +141,10 @@ export async function handleInbound(
124
141
  const { dispatcher, markDispatchIdle } = api.runtime.channel.reply.createReplyDispatcherWithTyping({
125
142
  deliver: async (payload: any, info: any) => {
126
143
  const currentMeta = robot.activeNodeJobs.get(jobId);
127
- const respondingAgent = payload.agentId || payload.btw?.agentId || payload.channelData?.agentId || finalAgentId;
144
+ const rawResponder = payload.agentId || payload.btw?.agentId || payload.channelData?.agentId;
145
+ const resAgent = rawResponder || finalAgentId;
128
146
 
129
- logger.info(`[pier-connector:trace] Outbound delivery triggered for job ${jobId}. Type: ${info?.kind}. Responding Agent: ${respondingAgent}.`);
147
+ logger.info(`[pier-connector:trace] Outbound delivery for ${jobId}. Mode: ${info?.kind}. Responder: ${resAgent} (Raw: ${rawResponder || 'none'}).`);
130
148
  logger.info(`[pier-connector:debug] FULL PAYLOAD: ${JSON.stringify(payload)}`);
131
149
 
132
150
  if (payload.text && payload.text.length > 0) {
@@ -137,7 +155,7 @@ export async function handleInbound(
137
155
  ...currentMeta,
138
156
  accountId: robot.accountId,
139
157
  pierJobId: jobId,
140
- respondingAgentId: respondingAgent
158
+ respondingAgentId: resAgent
141
159
  },
142
160
  });
143
161
  }