@gholl-studio/pier-connector 0.2.19 → 0.2.21

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 +36 -16
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.19",
4
+ "version": "0.2.21",
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
@@ -372,19 +372,25 @@ export default function register(api) {
372
372
  const config = getActiveConfig();
373
373
  const replySubject = `jobs.job.${jobId}.msg`;
374
374
 
375
- // Treat ALL agent text outputs as Chat Messages so the Employer sees them in real-time
376
- const chatPayload = {
377
- id: crypto.randomUUID ? crypto.randomUUID() : (Math.random().toString(36).substring(2)),
378
- job_id: jobId,
379
- sender_id: config.nodeId || 'anonymous',
380
- sender_type: 'node',
381
- content: text,
382
- timestamp: new Date().toISOString(),
383
- auth_token: config.secretKey // Secure token for backend validation
384
- };
385
-
386
- await js.publish(replySubject, new TextEncoder().encode(JSON.stringify(chatPayload)));
387
- logger.info(`[pier-connector] 💬 Agent reply published directly to NATS chat for job ${jobId}`);
375
+ // Pre-hiring Radio Silence:
376
+ // Only publish to the job channel if this node is hired (targeted)
377
+ // This prevents open market bidders from spamming the task chat with "Thinking..." messages.
378
+ if (metadata?.isTargeted) {
379
+ const chatPayload = {
380
+ id: crypto.randomUUID ? crypto.randomUUID() : (Math.random().toString(36).substring(2)),
381
+ job_id: jobId,
382
+ sender_id: config.nodeId || 'anonymous',
383
+ sender_type: 'node',
384
+ content: text,
385
+ created_at: new Date().toISOString(),
386
+ auth_token: config.secretKey // Secure token for backend validation
387
+ };
388
+
389
+ await js.publish(replySubject, new TextEncoder().encode(JSON.stringify(chatPayload)));
390
+ logger.info(`[pier-connector] 💬 Agent reply published directly to NATS chat for job ${jobId}`);
391
+ } else {
392
+ logger.debug(`[pier-connector] 🤫 Pre-hiring radio silence: suppressed chat for job ${jobId}`);
393
+ }
388
394
  } catch (err) {
389
395
  logger.error(`[pier-connector] Failed to publish realtime reply to NATS: ${err.message}`);
390
396
  }
@@ -890,10 +896,24 @@ export default function register(api) {
890
896
  isTargeted: isTargeted
891
897
  });
892
898
 
899
+ let finalText = job.task;
900
+ if (!isTargeted) {
901
+ finalText = `【PIER MARKETPLACE OPEN JOB】
902
+ Job ID: ${job.id}
903
+ Task description:
904
+ ${job.task}
905
+
906
+ === CRITICAL WARNING ===
907
+ You MUST NOT execute or solve this task directly! This is a public request for proposals.
908
+ You MUST reply by calling the \`pier_bid_task\` tool to submit a pitch explaining why you are best suited, and optionally your price.
909
+ You MUST use the Job ID provided above when calling the tool.
910
+ Any direct answer will be considered a failure to follow protocol.`;
911
+ }
912
+
893
913
  const inbound = {
894
914
  accountId: config.accountId || 'default',
895
915
  senderId: `pier:${senderCore}`,
896
- text: job.task,
916
+ text: finalText,
897
917
  };
898
918
 
899
919
  // SUBSCRIBE to job-specific messages FIRST so we don't miss follow-ups
@@ -1093,7 +1113,7 @@ export default function register(api) {
1093
1113
  sender_id: config.nodeId,
1094
1114
  sender_type: 'node',
1095
1115
  content: params.text,
1096
- timestamp: new Date().toISOString(),
1116
+ created_at: new Date().toISOString(),
1097
1117
  auth_token: config.secretKey // Secure token for backend validation
1098
1118
  };
1099
1119
 
@@ -1144,7 +1164,7 @@ export default function register(api) {
1144
1164
  action,
1145
1165
  payload
1146
1166
  }),
1147
- timestamp: new Date().toISOString(),
1167
+ created_at: new Date().toISOString(),
1148
1168
  auth_token: config.secretKey, // auth handle in DB needs updating for user role simulation
1149
1169
  type: 'system_action',
1150
1170
  action: action