@gholl-studio/pier-connector 0.3.22 → 0.3.23

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/inbound.ts +8 -9
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.22",
4
+ "version": "0.3.23",
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
@@ -22,14 +22,10 @@ export async function handleInbound(
22
22
  }
23
23
 
24
24
  // 1. Resolve Account-Scoped Configuration
25
+ // 使用原始完整配置,不覆盖 channels.pier,确保 bindings 和 defaultAgent 完整可用。
26
+ // resolveAgentRoute 需要完整配置中的 bindings 才能正确匹配 channel+accountId 路由规则。
25
27
  const rootConfig = ctx.cfg || {};
26
- const accountScopedCfg = {
27
- ...rootConfig,
28
- channels: {
29
- ...rootConfig.channels,
30
- pier: robot.config
31
- }
32
- };
28
+ const accountScopedCfg = rootConfig;
33
29
 
34
30
  // 2. Resolve Agent Route
35
31
  const route = channelRuntime.routing.resolveAgentRoute({
@@ -44,7 +40,10 @@ export async function handleInbound(
44
40
 
45
41
  logger.info(`[pier-connector] Routing account '${robot.accountId}' -> agent '${finalAgentId}' (Source: ${routingSource})`);
46
42
 
47
- const dynamicSessionKey = `pier-job-${jobId}`;
43
+ // route.sessionKey resolveAgentRoute 生成,格式为 agent/{agentId}/...,
44
+ // SDK 通过解析此 key 来确定使用哪个 agent。
45
+ // 若使用自定义字符串(如 pier-job-${jobId}),SDK 无法解析 agentId,会回落到默认 main agent。
46
+ const dynamicSessionKey = route.sessionKey;
48
47
  const metadata = robot.activeNodeJobs.get(jobId);
49
48
  let injectedPrompt = "";
50
49
 
@@ -79,7 +78,7 @@ export async function handleInbound(
79
78
  RawBody: inbound.body,
80
79
  From: inbound.senderId,
81
80
  To: `chat:${jobId}`,
82
- SessionKey: dynamicSessionKey,
81
+ SessionKey: route.sessionKey,
83
82
  AccountId: robot.accountId,
84
83
  ChatType: 'direct',
85
84
  SenderId: inbound.senderId,