@gholl-studio/pier-connector 0.2.31 → 0.2.33

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gholl-studio/pier-connector",
3
3
  "author": "gholl",
4
- "version": "0.2.31",
4
+ "version": "0.2.33",
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",
@@ -34,7 +34,7 @@
34
34
  ],
35
35
  "license": "MIT",
36
36
  "dependencies": {
37
- "pier-sdk": "file:../packages/pier-sdk",
37
+ "@gholl-studio/pier-sdk": "^1.0.1",
38
38
  "@nats-io/jetstream": "^3.3.1",
39
39
  "@nats-io/transport-node": "^3.0.0",
40
40
  "ethers": "^6.16.0",
package/src/index.js CHANGED
@@ -8,7 +8,7 @@
8
8
  * 4. A command ("/pier") for checking connection status
9
9
  */
10
10
 
11
- import { PierClient, protocol } from 'pier-sdk';
11
+ import { PierClient, protocol } from '@gholl-studio/pier-sdk';
12
12
  const { createRequestPayload, createResultPayload, createErrorPayload } = protocol;
13
13
  import { parseJob, safeRespond, truncate } from './job-handler.js';
14
14
  import { DEFAULTS } from './config.js';
@@ -469,8 +469,12 @@ export default function register(api) {
469
469
  if (!this.config.nodeId && this.config.privateKey) await this.autoRegister();
470
470
  const natsConfig = await this.heartbeat();
471
471
  if (!natsConfig) throw new Error('No NATS config');
472
-
473
- this.nc = await createNatsConnection(natsConfig.url || this.config.natsUrl, logger);
472
+ if (natsConfig.url) {
473
+ // Update SDK NATS client with latest URL from heartbeat
474
+ this.client.nats.url = natsConfig.url;
475
+ }
476
+
477
+ this.nc = await this.client.connectNats();
474
478
  this.js = jetstream(this.nc);
475
479
  this.jsm = await jetstreamManager(this.nc);
476
480
  this.connectionStatus = 'connected';
@@ -492,7 +496,7 @@ export default function register(api) {
492
496
 
493
497
  async stop() {
494
498
  if (this.heartbeatTimer) clearInterval(this.heartbeatTimer);
495
- if (this.nc) await drainConnection(this.nc, logger);
499
+ if (this.nc) await this.client.drainNats();
496
500
  this.connectionStatus = 'disconnected';
497
501
  }
498
502
  }
@@ -20,7 +20,7 @@
20
20
  * @param {object} logger
21
21
  * @returns {{ ok: true, job: object } | { ok: false, error: string }}
22
22
  */
23
- import { protocol } from 'pier-sdk';
23
+ import { protocol } from '@gholl-studio/pier-sdk';
24
24
  const { normalizeInboundPayload } = protocol;
25
25
 
26
26
  export function parseJob(msg, logger) {