@gholl-studio/pier-connector 0.3.14 → 0.3.15
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/inbound.ts +21 -11
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.
|
|
4
|
+
"version": "0.3.15",
|
|
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
|
@@ -19,6 +19,11 @@ export async function handleInbound(
|
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
// 0. Log Online/Configured Agents
|
|
23
|
+
const agentsList = (api.config as any)?.agents?.list || [];
|
|
24
|
+
const agentIds = Array.isArray(agentsList) ? agentsList.map((a: any) => a.id) : Object.keys(agentsList);
|
|
25
|
+
logger.info(`[pier-connector][${robot.accountId}] Available agents in OpenClaw: ${JSON.stringify(agentIds)}`);
|
|
26
|
+
|
|
22
27
|
// 1. Resolve Account-Scoped Configuration
|
|
23
28
|
const rootConfig = api.config || {};
|
|
24
29
|
|
|
@@ -109,18 +114,23 @@ export async function handleInbound(
|
|
|
109
114
|
logger.info(`[pier-connector:trace] FULL DISPATCH CONTEXT for job ${jobId}: ${JSON.stringify(ctxPayload)}`);
|
|
110
115
|
|
|
111
116
|
const { dispatcher, markDispatchIdle } = api.runtime.channel.reply.createReplyDispatcherWithTyping({
|
|
112
|
-
deliver: async (payload: any) => {
|
|
117
|
+
deliver: async (payload: any, info: any) => {
|
|
113
118
|
const currentMeta = robot.activeNodeJobs.get(jobId);
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
119
|
+
const respondingAgent = payload.channelData?.agentId || payload.agentId || 'unknown';
|
|
120
|
+
|
|
121
|
+
logger.info(`[pier-connector:trace] Outbound delivery triggered for job ${jobId}. Type: ${info?.kind}. Responding Agent: ${respondingAgent}. Text length: ${payload.text?.length || 0}`);
|
|
122
|
+
if (payload.text && payload.text.length > 0) {
|
|
123
|
+
await pierChannel.outbound.sendText({
|
|
124
|
+
text: payload.text,
|
|
125
|
+
to: `pier:${jobId}`,
|
|
126
|
+
metadata: {
|
|
127
|
+
...currentMeta,
|
|
128
|
+
accountId: robot.accountId,
|
|
129
|
+
pierJobId: jobId,
|
|
130
|
+
respondingAgentId: respondingAgent
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
}
|
|
124
134
|
}
|
|
125
135
|
});
|
|
126
136
|
|