@gholl-studio/pier-connector 0.6.3 → 0.6.5

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.
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @file types.ts
3
+ * @description Centralized TypeScript interface and type definitions for the Pier connector plugin.
4
+ */
5
+ import type { OpenClawPluginApi } from 'openclaw/plugin-sdk/plugin-entry';
6
+ export interface PierAccountConfig {
7
+ accountId: string;
8
+ pierApiUrl: string;
9
+ nodeId: string;
10
+ secretKey: string;
11
+ privateKey: string;
12
+ natsUrl: string;
13
+ subject: string;
14
+ publishSubject: string;
15
+ queueGroup: string;
16
+ agentId: string;
17
+ walletAddress: string;
18
+ capabilities: string[];
19
+ }
20
+ export interface PierJob {
21
+ id: string;
22
+ subject: string;
23
+ data: any;
24
+ metadata?: any;
25
+ }
26
+ export interface InboundMessage {
27
+ accountId: string;
28
+ senderId: string;
29
+ body: string;
30
+ jobId: string;
31
+ /** UUID for unique SDK deduplication across turns */
32
+ messageId?: string;
33
+ /** True if the agent was explicitly mentioned in the group chat payload */
34
+ WasMentioned?: boolean;
35
+ }
36
+ export type PierPluginApi = OpenClawPluginApi;
package/dist/types.js ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @file types.ts
3
+ * @description Centralized TypeScript interface and type definitions for the Pier connector plugin.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
package/package.json CHANGED
@@ -1,23 +1,24 @@
1
1
  {
2
2
  "name": "@gholl-studio/pier-connector",
3
3
  "author": "gholl",
4
- "version": "0.6.3",
4
+ "version": "0.6.5",
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
- "main": "src/index.ts",
7
+ "main": "dist/index.js",
8
8
  "engines": {
9
9
  "node": ">=22"
10
10
  },
11
11
  "files": [
12
+ "dist",
12
13
  "src",
13
14
  "openclaw.plugin.json",
14
15
  "README.md"
15
16
  ],
16
17
  "openclaw": {
17
18
  "extensions": [
18
- "./src/index.ts"
19
+ "./dist/index.js"
19
20
  ],
20
- "setupEntry": "./src/cli.ts",
21
+ "setupEntry": "./dist/cli.js",
21
22
  "channel": {
22
23
  "id": "pier",
23
24
  "label": "Pier",
@@ -56,7 +57,6 @@
56
57
  }
57
58
  },
58
59
  "devDependencies": {
59
- "@gholl-studio/pier-sdk": "file:../packages/pier-sdk",
60
60
  "@types/node": "^25.5.0",
61
61
  "dotenv": "^17.3.1",
62
62
  "openclaw": ">=2.0.0",
package/src/index.ts CHANGED
@@ -118,7 +118,9 @@ const pierPlugin: ChannelPlugin<PierAccountConfig> = {
118
118
  }
119
119
 
120
120
  const jobId = ctx.to.replace(/^pier:/, '');
121
- const subject = `chat.${jobId}`;
121
+ const jobMeta = robot.activeNodeJobs.get(jobId);
122
+ const isWorkspace = jobMeta?.workspace === true || (ctx as any).metadata?.workspace === true;
123
+ const subject = isWorkspace ? `workspace.${jobId}.chat` : `chat.${jobId}`;
122
124
 
123
125
  const payload = {
124
126
  id: (globalThis.crypto as any).randomUUID ? (globalThis.crypto as any).randomUUID() : (Math.random().toString(36).substring(2)),
package/src/robot.ts CHANGED
@@ -418,6 +418,24 @@ export class PierRobot {
418
418
  return;
419
419
  }
420
420
 
421
+ if (payload.type === 'workspace_invite') {
422
+ const { groupId } = payload;
423
+ if (groupId) {
424
+ this.logger.info(`[pier-connector][${this.accountId}] 🤝 Received workspace invitation for ${groupId}`);
425
+ // Workspace messages are handled by the global workspace.>.chat subscription,
426
+ // so we just log it and potentially mark it as an active session for the SDK.
427
+ if (!this.activeNodeJobs.has(groupId)) {
428
+ this.activeNodeJobs.set(groupId, {
429
+ pierJobId: groupId,
430
+ isTargeted: true,
431
+ workspace: true
432
+ });
433
+ }
434
+ }
435
+ msg.ack();
436
+ return;
437
+ }
438
+
421
439
  if (this.isBusy) {
422
440
  msg.nak();
423
441
  return;
@@ -552,7 +570,7 @@ export class PierRobot {
552
570
 
553
571
  // Subscribe to all multi-agent workspaces via NATS core
554
572
  // Support PSP Federation namespace wildcards
555
- this.client.nats.subscribe('psp.chat.>', (payload: any, msg: any) => {
573
+ this.client.nats.subscribe('workspace.>.chat', (payload: any, msg: any) => {
556
574
  this.handleGroupChat(msg.subject, payload);
557
575
  });
558
576