palz-connector 1.5.7 → 1.5.9
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/src/monitor.js +5 -23
- package/src/send.js +1 -1
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
package/src/monitor.js
CHANGED
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import WebSocket from "ws";
|
|
8
8
|
import { handlePalzMessage } from "./bot.js";
|
|
9
|
-
import { sendToPalzIM } from "./send.js";
|
|
10
|
-
import { buildPassthroughFromMsg } from "./message-utils.js";
|
|
11
9
|
import { reportPalzActivity } from "./activity.js";
|
|
12
10
|
import { tracer, extractTraceparentContext, SpanStatusCode } from "./tracing.js";
|
|
13
11
|
const WS_CONNECT_TIMEOUT_MS = 15_000;
|
|
@@ -220,28 +218,12 @@ export async function monitorPalzProvider(params) {
|
|
|
220
218
|
}).catch((err) => {
|
|
221
219
|
error(`palz[${accountId}]: [ACTIVITY_REPORT] unhandled error: ${err.message ?? err}`);
|
|
222
220
|
});
|
|
223
|
-
// agent_id
|
|
224
|
-
|
|
221
|
+
// agent_id:从消息中取,缺失/空时默认为 {userId}-main
|
|
222
|
+
let messageAgentId = typeof msg.agent_id === "string" ? msg.agent_id.trim() : "";
|
|
225
223
|
if (!messageAgentId) {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
conversationId: msg.conversation_id,
|
|
230
|
-
content: "消息缺少 agent_id,无法路由到 Agent。",
|
|
231
|
-
conversationType: msg.conversation_type || "direct",
|
|
232
|
-
msgId: msg.msg_id,
|
|
233
|
-
senderId: msg.sender_id,
|
|
234
|
-
msgType: msg.msg_type,
|
|
235
|
-
groupId: msg.conversation_type === "group" ? msg.conversation_id : undefined,
|
|
236
|
-
lobsterId: msg.lobster_id,
|
|
237
|
-
palzMsgType: "error",
|
|
238
|
-
passthrough: buildPassthroughFromMsg(msg),
|
|
239
|
-
log,
|
|
240
|
-
error,
|
|
241
|
-
}).catch((err) => {
|
|
242
|
-
error(`palz[${accountId}]: missing agent_id error reply failed: ${err.message ?? err}`);
|
|
243
|
-
});
|
|
244
|
-
return;
|
|
224
|
+
messageAgentId = `${accountId}-main`;
|
|
225
|
+
msg.agent_id = messageAgentId;
|
|
226
|
+
log(`palz[${accountId}]: agent_id missing, defaulting to "${messageAgentId}" msg_id=${msg.msg_id}`);
|
|
245
227
|
}
|
|
246
228
|
handlePalzMessage({
|
|
247
229
|
cfg,
|
package/src/send.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { tracer, trace, SpanStatusCode, buildTraceparentHeader } from "./tracing.js";
|
|
8
8
|
import { contentPartsToOpenAIContent } from "./content.js";
|
|
9
|
-
const SEND_TIMEOUT_MS =
|
|
9
|
+
const SEND_TIMEOUT_MS = 20_000;
|
|
10
10
|
let msgSeq = 0;
|
|
11
11
|
function nextMsgId() {
|
|
12
12
|
return `bot_reply_${Date.now()}_${++msgSeq}`;
|