palz-connector 1.1.8 → 1.2.0
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/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/palz-connector.config.json +2 -2
- package/palz-connector.dev.config.json +2 -2
- package/palz-connector.prod.config.json +2 -2
- package/palz-connector.staging.config.json +2 -2
- package/src/bot.ts +11 -1
- package/src/monitor.ts +1 -1
- package/src/types.ts +2 -0
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
package/src/bot.ts
CHANGED
|
@@ -142,13 +142,23 @@ async function dispatchPalzMessage(params: HandlePalzMessageParams): Promise<voi
|
|
|
142
142
|
|
|
143
143
|
// STEP 5: 解析路由
|
|
144
144
|
const routeInput = { cfg: "(cfg)", channel: "palz-connector", accountId, peer: { kind: "direct", id: peerId } };
|
|
145
|
-
log(`${tag}: [STEP 5/6 路由解析] 输入: ${JSON.stringify(routeInput)}`);
|
|
145
|
+
log(`${tag}: [STEP 5/6 路由解析] 输入: ${JSON.stringify(routeInput)} agent_id=${msg.agent_id ?? "(auto)"}`);
|
|
146
146
|
const route = core.channel.routing.resolveAgentRoute({
|
|
147
147
|
cfg,
|
|
148
148
|
channel: "palz-connector",
|
|
149
149
|
accountId,
|
|
150
150
|
peer: { kind: "direct", id: peerId },
|
|
151
151
|
});
|
|
152
|
+
|
|
153
|
+
// IM 指定 agent_id 时走指定 agent,否则强制走 main
|
|
154
|
+
const effectiveAgentId = msg.agent_id || "main";
|
|
155
|
+
if (route.agentId !== effectiveAgentId) {
|
|
156
|
+
const oldAgentId = route.agentId;
|
|
157
|
+
route.agentId = effectiveAgentId;
|
|
158
|
+
route.sessionKey = route.sessionKey.replace(`agent:${oldAgentId}:`, `agent:${effectiveAgentId}:`);
|
|
159
|
+
log(`${tag}: [STEP 5 覆盖] agentId: ${oldAgentId} -> ${effectiveAgentId}, sessionKey=${route.sessionKey} (${msg.agent_id ? "IM指定" : "默认main"})`);
|
|
160
|
+
}
|
|
161
|
+
|
|
152
162
|
log(`${tag}: [STEP 5 输出] agentId=${route.agentId} sessionKey=${route.sessionKey} accountId=${route.accountId} matchedBy=${route.matchedBy}`);
|
|
153
163
|
|
|
154
164
|
// STEP 6a: 构建 envelope body
|
package/src/monitor.ts
CHANGED
|
@@ -38,7 +38,7 @@ export async function monitorPalzProvider(params: MonitorPalzParams): Promise<vo
|
|
|
38
38
|
let reconnectTimer: ReturnType<typeof setTimeout> | null = null;
|
|
39
39
|
let currentWs: WebSocket | null = null;
|
|
40
40
|
let consecutive4002 = 0;
|
|
41
|
-
const MAX_CONSECUTIVE_4002 =
|
|
41
|
+
const MAX_CONSECUTIVE_4002 = 10;
|
|
42
42
|
|
|
43
43
|
const cleanup = () => {
|
|
44
44
|
closed = true;
|