palz-connector 1.3.0 → 1.3.1

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "palz-connector",
3
3
  "name": "Palz Connector Channel",
4
- "version": "1.3.0",
4
+ "version": "1.3.1",
5
5
  "description": "Palz IM 接入 OpenClaw",
6
6
  "channels": [
7
7
  "palz-connector"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "palz-connector",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "type": "module",
5
5
  "main": "index.ts",
6
6
  "description": "Palz IM 接入 OpenClaw — 模块化架构,基于 OpenClaw Runtime 消息管道",
package/src/channel.ts CHANGED
@@ -72,7 +72,7 @@ export const palzPlugin = {
72
72
 
73
73
  agentPrompt: {
74
74
  messageToolHints: () => [
75
- "- Palz targeting: omit `target` to reply to the current conversation (auto-inferred). Explicit targets: `<senderId>:<conversationId>`.",
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;