palz-connector 1.3.0 → 1.3.2
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/bot.ts +1 -0
- package/src/channel.ts +1 -1
- package/src/outbound.ts +12 -0
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
package/src/bot.ts
CHANGED
|
@@ -495,6 +495,7 @@ async function _dispatchPalzMessageInner(params: HandlePalzMessageParams): Promi
|
|
|
495
495
|
`sender_name: ${senderName}`,
|
|
496
496
|
`conversation_id: ${msg.conversation_id}`,
|
|
497
497
|
`conversation_type: ${msg.conversation_type || "direct"}`,
|
|
498
|
+
`to: ${palzTo}`,
|
|
498
499
|
`mentioned_bot: ${wasMentioned}`,
|
|
499
500
|
];
|
|
500
501
|
if (groupId) {
|
package/src/channel.ts
CHANGED
|
@@ -72,7 +72,7 @@ export const palzPlugin = {
|
|
|
72
72
|
|
|
73
73
|
agentPrompt: {
|
|
74
74
|
messageToolHints: () => [
|
|
75
|
-
"- Palz targeting:
|
|
75
|
+
"- Palz targeting: DO NOT set `target` — always omit it so the system auto-infers the correct conversation. Never use sender_id or conversation_id alone as target. If you must specify an explicit target, the only valid format is `<senderId>:<conversationId>`.",
|
|
76
76
|
],
|
|
77
77
|
},
|
|
78
78
|
|
package/src/outbound.ts
CHANGED
|
@@ -14,6 +14,18 @@ import type { ContentPart, TextContentPart, OpenAIContent } from "./types.js";
|
|
|
14
14
|
export const palzOutbound = {
|
|
15
15
|
deliveryMode: "direct" as const,
|
|
16
16
|
|
|
17
|
+
resolveTarget: (params: { to?: string; mode?: string }) => {
|
|
18
|
+
const to = params.to?.trim();
|
|
19
|
+
if (!to) {
|
|
20
|
+
return { ok: false as const, error: new Error("Palz target is required. Format: <senderId>:<conversationId> or chat:<conversationId>") };
|
|
21
|
+
}
|
|
22
|
+
// Must contain ":" — bare sender_id or bare conversation_id is invalid
|
|
23
|
+
if (!to.includes(":")) {
|
|
24
|
+
return { ok: false as const, error: new Error(`Invalid Palz target "${to}": must be <senderId>:<conversationId> or chat:<conversationId>. A bare ID without ":" is not a valid target.`) };
|
|
25
|
+
}
|
|
26
|
+
return { ok: true as const, to };
|
|
27
|
+
},
|
|
28
|
+
|
|
17
29
|
sendText: async (ctx: any) => {
|
|
18
30
|
const { cfg, to, text, accountId } = ctx;
|
|
19
31
|
const log = typeof ctx.log === "function" ? ctx.log : console.log;
|