@gholl-studio/pier-connector 0.3.1 → 0.3.11
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 +11 -1
- package/src/robot.ts +5 -3
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.11",
|
|
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
|
@@ -101,6 +101,8 @@ export async function handleInbound(
|
|
|
101
101
|
].join('\n');
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
logger.info(`[pier-connector:trace] Finalized inbound context for job ${jobId}. Target Agent: ${finalAgentId}, Session: ${dynamicSessionKey}`);
|
|
105
|
+
|
|
104
106
|
const ctxPayload = api.runtime.channel.reply.finalizeInboundContext({
|
|
105
107
|
AgentId: finalAgentId,
|
|
106
108
|
Body: inbound.body,
|
|
@@ -131,6 +133,7 @@ export async function handleInbound(
|
|
|
131
133
|
const { dispatcher, markDispatchIdle } = api.runtime.channel.reply.createReplyDispatcherWithTyping({
|
|
132
134
|
deliver: async (payload: any) => {
|
|
133
135
|
const currentMeta = robot.activeNodeJobs.get(jobId);
|
|
136
|
+
logger.info(`[pier-connector:trace] Outbound delivery triggered for job ${jobId}. Text length: ${payload.text?.length || 0}`);
|
|
134
137
|
await pierChannel.outbound.sendText({
|
|
135
138
|
text: payload.text,
|
|
136
139
|
to: `pier:${jobId}`,
|
|
@@ -146,16 +149,23 @@ export async function handleInbound(
|
|
|
146
149
|
if (api.runtime.channel.session?.recordSessionMetaFromInbound) {
|
|
147
150
|
try {
|
|
148
151
|
const storePath = api.runtime.channel.session.resolveStorePath(dynamicSessionKey);
|
|
152
|
+
logger.info(`[pier-connector:trace] Recording session metadata at ${storePath}`);
|
|
149
153
|
await api.runtime.channel.session.recordSessionMetaFromInbound({
|
|
150
154
|
storePath, sessionKey: dynamicSessionKey, ctx: ctxPayload
|
|
151
155
|
});
|
|
152
|
-
} catch (err) {
|
|
156
|
+
} catch (err: any) {
|
|
157
|
+
logger.error(`[pier-connector] ✖ Failed to record session metadata: ${err.message}`);
|
|
158
|
+
}
|
|
153
159
|
}
|
|
154
160
|
|
|
155
161
|
try {
|
|
162
|
+
logger.info(`[pier-connector:trace] Dispatching reply to agent ${finalAgentId}...`);
|
|
156
163
|
await api.runtime.channel.reply.dispatchReplyFromConfig({
|
|
157
164
|
ctx: ctxPayload, cfg: api.config, dispatcher
|
|
158
165
|
});
|
|
166
|
+
logger.info(`[pier-connector:trace] dispatchReplyFromConfig completed for job ${jobId}`);
|
|
167
|
+
} catch (err: any) {
|
|
168
|
+
logger.error(`[pier-connector] ✖ Dispatch error for job ${jobId}: ${err.message}`);
|
|
159
169
|
} finally {
|
|
160
170
|
markDispatchIdle();
|
|
161
171
|
}
|
package/src/robot.ts
CHANGED
|
@@ -120,13 +120,15 @@ export class PierRobot {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
msg.ack();
|
|
123
|
-
|
|
123
|
+
const inbound = {
|
|
124
124
|
accountId: this.accountId,
|
|
125
125
|
senderId: `pier:${msgPayload.sender_id}`,
|
|
126
126
|
body: content,
|
|
127
127
|
jobId: jobId
|
|
128
|
-
}
|
|
129
|
-
|
|
128
|
+
};
|
|
129
|
+
this.logger.info(`[pier-connector:trace] NATS Chat Message received on PierRobot instance accountId='${this.accountId}'. Passing to handleInbound...`);
|
|
130
|
+
await this.onInbound(inbound, jobId);
|
|
131
|
+
} catch (err: any) { this.logger.error(`[pier-connector][${this.accountId}] ✖ Failed to process chat message: ${err.message}`); }
|
|
130
132
|
}
|
|
131
133
|
})();
|
|
132
134
|
} catch (err: any) {
|