@openclaw/signal 2026.6.11 → 2026.7.1-beta.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.
@@ -0,0 +1,187 @@
1
+ import { i as resolveSignalAccount } from "./accounts-B7Rz3_xV.js";
2
+ import { r as markdownToSignalText } from "./message-actions-Cs9XckSd.js";
3
+ import { n as signalRpcRequest } from "./client-adapter-Dm8-wT2n.js";
4
+ import { t as resolveSignalRpcContext } from "./rpc-context-DbFMe7am.js";
5
+ import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
6
+ import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
7
+ import { kindFromMime, resolveOutboundAttachmentFromUrl } from "openclaw/plugin-sdk/media-runtime";
8
+ import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
9
+ import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
10
+ //#region extensions/signal/src/send.ts
11
+ async function resolveSignalRpcAccountInfo(opts) {
12
+ if (opts.baseUrl?.trim() && opts.account?.trim()) return;
13
+ if (!opts.cfg) throw new Error("Signal RPC account resolution requires a resolved runtime config. Load and resolve config at the command or gateway boundary, then pass cfg through the runtime path.");
14
+ return resolveSignalAccount({
15
+ cfg: requireRuntimeConfig(opts.cfg, "Signal RPC account resolution"),
16
+ accountId: opts.accountId
17
+ });
18
+ }
19
+ function parseTarget(raw) {
20
+ let value = raw.trim();
21
+ if (!value) throw new Error("Signal recipient is required");
22
+ if (normalizeLowercaseStringOrEmpty(value).startsWith("signal:")) value = value.slice(7).trim();
23
+ const normalized = normalizeLowercaseStringOrEmpty(value);
24
+ if (normalized.startsWith("group:")) return {
25
+ type: "group",
26
+ groupId: value.slice(6).trim()
27
+ };
28
+ if (normalized.startsWith("username:")) return {
29
+ type: "username",
30
+ username: value.slice(9).trim()
31
+ };
32
+ if (normalized.startsWith("u:")) return {
33
+ type: "username",
34
+ username: value.trim()
35
+ };
36
+ return {
37
+ type: "recipient",
38
+ recipient: value
39
+ };
40
+ }
41
+ function buildTargetParams(target, allow) {
42
+ if (target.type === "recipient") {
43
+ if (!allow.recipient) return null;
44
+ return { recipient: [target.recipient] };
45
+ }
46
+ if (target.type === "group") {
47
+ if (!allow.group) return null;
48
+ return { groupId: target.groupId };
49
+ }
50
+ if (target.type === "username") {
51
+ if (!allow.username) return null;
52
+ return { username: [target.username] };
53
+ }
54
+ return null;
55
+ }
56
+ function createSignalSendReceipt(params) {
57
+ const messageId = params.messageId.trim();
58
+ const results = messageId && messageId !== "unknown" ? [{
59
+ channel: "signal",
60
+ messageId,
61
+ meta: { targetType: params.target.type }
62
+ }] : [];
63
+ if (results[0]) {
64
+ if (params.timestamp != null) results[0].timestamp = params.timestamp;
65
+ if (params.target.type === "group") results[0].chatId = params.target.groupId;
66
+ else if (params.target.type === "recipient") results[0].toJid = params.target.recipient;
67
+ else results[0].toJid = params.target.username;
68
+ }
69
+ return createMessageReceiptFromOutboundResults({
70
+ results,
71
+ kind: params.kind
72
+ });
73
+ }
74
+ async function sendMessageSignal(to, text, opts) {
75
+ const cfg = requireRuntimeConfig(opts.cfg, "Signal send");
76
+ const apiMode = cfg.channels?.signal?.apiMode;
77
+ const accountInfo = resolveSignalAccount({
78
+ cfg,
79
+ accountId: opts.accountId
80
+ });
81
+ const { baseUrl, account } = resolveSignalRpcContext(opts, accountInfo);
82
+ const target = parseTarget(to);
83
+ let message = text ?? "";
84
+ let messageFromPlaceholder = false;
85
+ let textStyles = [];
86
+ const textMode = opts.textMode ?? "markdown";
87
+ const maxBytes = (() => {
88
+ if (typeof opts.maxBytes === "number") return opts.maxBytes;
89
+ if (typeof accountInfo.config.mediaMaxMb === "number") return accountInfo.config.mediaMaxMb * 1024 * 1024;
90
+ if (typeof cfg.agents?.defaults?.mediaMaxMb === "number") return cfg.agents.defaults.mediaMaxMb * 1024 * 1024;
91
+ return 8 * 1024 * 1024;
92
+ })();
93
+ let attachments;
94
+ if (opts.mediaUrl?.trim()) {
95
+ const resolved = await resolveOutboundAttachmentFromUrl(opts.mediaUrl.trim(), maxBytes, {
96
+ mediaAccess: opts.mediaAccess,
97
+ localRoots: opts.mediaLocalRoots,
98
+ readFile: opts.mediaReadFile
99
+ });
100
+ attachments = [resolved.path];
101
+ const kind = kindFromMime(resolved.contentType ?? void 0);
102
+ if (!message && kind) {
103
+ message = kind === "image" ? "<media:image>" : `<media:${kind}>`;
104
+ messageFromPlaceholder = true;
105
+ }
106
+ }
107
+ if (message.trim() && !messageFromPlaceholder) if (textMode === "plain") textStyles = opts.textStyles ?? [];
108
+ else {
109
+ const tableMode = resolveMarkdownTableMode({
110
+ cfg,
111
+ channel: "signal",
112
+ accountId: accountInfo.accountId
113
+ });
114
+ const formatted = markdownToSignalText(message, { tableMode });
115
+ message = formatted.text;
116
+ textStyles = formatted.styles;
117
+ }
118
+ if (!message.trim() && (!attachments || attachments.length === 0)) throw new Error("Signal send requires text or media");
119
+ const params = { message };
120
+ if (textStyles.length > 0) params["text-style"] = textStyles.map((style) => `${style.start}:${style.length}:${style.style}`);
121
+ if (account) params.account = account;
122
+ if (attachments && attachments.length > 0) params.attachments = attachments;
123
+ const targetParams = buildTargetParams(target, {
124
+ recipient: true,
125
+ group: true,
126
+ username: true
127
+ });
128
+ if (!targetParams) throw new Error("Signal recipient is required");
129
+ Object.assign(params, targetParams);
130
+ const timestamp = (await signalRpcRequest("send", params, {
131
+ baseUrl,
132
+ timeoutMs: opts.timeoutMs,
133
+ apiMode
134
+ }))?.timestamp;
135
+ const messageId = timestamp ? String(timestamp) : "unknown";
136
+ return {
137
+ messageId,
138
+ timestamp,
139
+ receipt: createSignalSendReceipt({
140
+ messageId,
141
+ target,
142
+ kind: attachments && attachments.length > 0 ? "media" : "text",
143
+ ...timestamp != null ? { timestamp } : {}
144
+ })
145
+ };
146
+ }
147
+ async function sendTypingSignal(to, opts) {
148
+ const accountInfo = await resolveSignalRpcAccountInfo(opts);
149
+ const cfg = requireRuntimeConfig(opts.cfg, "Signal typing");
150
+ const { baseUrl, account } = resolveSignalRpcContext(opts, accountInfo);
151
+ const targetParams = buildTargetParams(parseTarget(to), {
152
+ recipient: true,
153
+ group: true
154
+ });
155
+ if (!targetParams) return false;
156
+ const params = { ...targetParams };
157
+ if (account) params.account = account;
158
+ if (opts.stop) params.stop = true;
159
+ await signalRpcRequest("sendTyping", params, {
160
+ baseUrl,
161
+ timeoutMs: opts.timeoutMs,
162
+ apiMode: cfg.channels?.signal?.apiMode
163
+ });
164
+ return true;
165
+ }
166
+ async function sendReadReceiptSignal(to, targetTimestamp, opts) {
167
+ if (!Number.isFinite(targetTimestamp) || targetTimestamp <= 0) return false;
168
+ const accountInfo = await resolveSignalRpcAccountInfo(opts);
169
+ const cfg = requireRuntimeConfig(opts.cfg, "Signal read receipt");
170
+ const { baseUrl, account } = resolveSignalRpcContext(opts, accountInfo);
171
+ const targetParams = buildTargetParams(parseTarget(to), { recipient: true });
172
+ if (!targetParams) return false;
173
+ const params = {
174
+ ...targetParams,
175
+ targetTimestamp,
176
+ type: opts.type ?? "read"
177
+ };
178
+ if (account) params.account = account;
179
+ await signalRpcRequest("sendReceipt", params, {
180
+ baseUrl,
181
+ timeoutMs: opts.timeoutMs,
182
+ apiMode: cfg.channels?.signal?.apiMode
183
+ });
184
+ return true;
185
+ }
186
+ //#endregion
187
+ export { sendReadReceiptSignal as n, sendTypingSignal as r, sendMessageSignal as t };
@@ -1,2 +1,2 @@
1
- import { r as sendTypingSignal, t as sendMessageSignal } from "./send-CBlFUkY_.js";
1
+ import { r as sendTypingSignal, t as sendMessageSignal } from "./send-CLzc3RUg.js";
2
2
  export { sendMessageSignal, sendTypingSignal };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@openclaw/signal",
3
- "version": "2026.6.11",
3
+ "version": "2026.7.1-beta.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@openclaw/signal",
9
- "version": "2026.6.11",
9
+ "version": "2026.7.1-beta.2",
10
10
  "dependencies": {
11
11
  "ws": "8.21.0"
12
12
  }
@@ -100,6 +100,15 @@
100
100
  "sendReadReceipts": {
101
101
  "type": "boolean"
102
102
  },
103
+ "aliases": {
104
+ "type": "object",
105
+ "propertyNames": {
106
+ "type": "string"
107
+ },
108
+ "additionalProperties": {
109
+ "type": "string"
110
+ }
111
+ },
103
112
  "dmPolicy": {
104
113
  "default": "pairing",
105
114
  "type": "string",
@@ -461,6 +470,15 @@
461
470
  "sendReadReceipts": {
462
471
  "type": "boolean"
463
472
  },
473
+ "aliases": {
474
+ "type": "object",
475
+ "propertyNames": {
476
+ "type": "string"
477
+ },
478
+ "additionalProperties": {
479
+ "type": "string"
480
+ }
481
+ },
464
482
  "dmPolicy": {
465
483
  "default": "pairing",
466
484
  "type": "string",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/signal",
3
- "version": "2026.6.11",
3
+ "version": "2026.7.1-beta.2",
4
4
  "description": "OpenClaw Signal channel plugin",
5
5
  "type": "module",
6
6
  "dependencies": {
@@ -44,10 +44,10 @@
44
44
  "allowInvalidConfigRecovery": true
45
45
  },
46
46
  "compat": {
47
- "pluginApi": ">=2026.6.11"
47
+ "pluginApi": ">=2026.7.1-beta.2"
48
48
  },
49
49
  "build": {
50
- "openclawVersion": "2026.6.11",
50
+ "openclawVersion": "2026.7.1-beta.2",
51
51
  "bundledDist": false
52
52
  },
53
53
  "release": {
@@ -70,7 +70,7 @@
70
70
  "README.md"
71
71
  ],
72
72
  "peerDependencies": {
73
- "openclaw": ">=2026.6.11"
73
+ "openclaw": ">=2026.7.1-beta.2"
74
74
  },
75
75
  "peerDependenciesMeta": {
76
76
  "openclaw": {